import { XLabel } from "../../Controls/XLabel";
import { XTextField } from "../../Controls/XTextField";
import { DefaultOffOverride } from "../../Utilities/DefaultOffOverride";
import { DefaultOnOff } from "../../Utilities/DefaultOnOff";
import { XFormConfiguration } from "../../XFormConfiguration";
import { XGridContainer, XGridRow, XGridArea } from "../XGridContainer";
function getUI() {
    let ui = new XFormConfiguration();
    let gridContainer = new XGridContainer();
    // show border so we can see
    gridContainer.overrideFormBorderSettings = DefaultOnOff.On;
    ui.add(gridContainer);
    return { form: ui, container: gridContainer };
}
export const getGridForm = () => {
    let ui = getUI();
    for (let i = 0; i < 5; i++) {
        ui.container.addRow(new XGridRow());
    }
    // creating areas
    let area = new XGridArea(0, 0, 4, 6);
    area.add(new XTextField());
    area.add(new XTextField());
    ui.container.addArea(area);
    area = new XGridArea(0, 4, 8, 3);
    area.add(new XTextField());
    area.add(new XTextField());
    ui.container.addArea(area);
    area = new XGridArea(3, 4, 4, 3);
    area.oneControl = true;
    area.controlAlign = {
        top: 10,
        left: 20,
    };
    area.add(new XTextField());
    area.add(new XTextField());
    ui.container.addArea(area);
    area = new XGridArea(3, 8, 4, 3);
    area.oneControl = true;
    area.add(new XTextField());
    area.add(new XTextField());
    ui.container.addArea(area);
    return ui;
};
export const getOneControlsGrid = () => {
    let ui = getUI();
    for (let i = 0; i < 3; i++) {
        ui.container.addRow(new XGridRow());
    }
    let label = new XLabel();
    label.text = "center control";
    let area = new XGridArea(0, 0, 5, 4);
    area.oneControl = true;
    area.add(label);
    ui.container.addArea(area);
    area = new XGridArea(0, 6, 6, 4);
    area.controlAlign = {
        top: 40,
        left: 40,
    };
    label = new XLabel();
    label.text = `top: ${area.controlAlign.top}, left: ${area.controlAlign.left}`;
    area.oneControl = true;
    area.add(label);
    ui.container.addArea(area);
    return ui;
};
export const getOverridedBorderGrid = () => {
    let ui = getUI();
    ui.container.defaultAreaBorderWidth = 2;
    ui.container.defaultAreaBorderColor = "rgba(64, 80, 166, 0.1)";
    ui.container.defaultAreaBorderRadius = 20;
    for (let i = 0; i < 3; i++) {
        ui.container.addRow(new XGridRow());
    }
    let area = new XGridArea(0, 0, 4, 4);
    let label = new XLabel();
    label.text = "default border";
    area.add(label);
    ui.container.addArea(area);
    area = new XGridArea(0, 4, 4, 4);
    area.add(label);
    ui.container.addArea(area);
    area = new XGridArea(0, 8, 4, 4);
    label = new XLabel();
    label.text = "Overrided Border";
    area.add(label);
    area.formBorderSettings = DefaultOffOverride.Override;
    area.containerBorderColor = "rgba(64, 80, 166, 1)";
    area.containerBorderWidth = 5;
    area.containerBorderRadius = 20;
    ui.container.add(area);
    return ui;
};
export const getOverridedBackgroundGrid = () => {
    let ui = getUI();
    ui.container.defaultAreaBackgroundColor = "rgba(64, 80, 166, 0.1)";
    for (let i = 0; i < 3; i++) {
        ui.container.addRow(new XGridRow());
    }
    let area = new XGridArea(0, 0, 4, 4);
    let label = new XLabel();
    label.text = "default background";
    area.add(label);
    ui.container.addArea(area);
    area = new XGridArea(0, 4, 4, 4);
    area.add(label);
    ui.container.addArea(area);
    area = new XGridArea(0, 8, 4, 4);
    label = new XLabel();
    label.text = "Overrided background";
    area.add(label);
    area.backgroundColorSettings = DefaultOffOverride.Override;
    area.containerBackgroundColor = "rgba(64, 80, 166, 0.5)";
    ui.container.add(area);
    return ui;
};
export const getOverridedInnerMargin = () => {
    let ui = getUI();
    ui.container.defaultAreaInnerMargin = 10;
    for (let i = 0; i < 3; i++) {
        ui.container.addRow(new XGridRow());
    }
    let area = new XGridArea(0, 0, 4, 4);
    let label = new XLabel();
    label.text = "default inner margin";
    area.add(label);
    ui.container.addArea(area);
    area = new XGridArea(0, 4, 4, 4);
    area.add(label);
    ui.container.addArea(area);
    area = new XGridArea(0, 8, 4, 4);
    label = new XLabel();
    label.text = "Overrided inner margin";
    area.add(label);
    area.innerMarginSettings = DefaultOffOverride.Override;
    area.innerMargin = 30;
    ui.container.add(area);
    return ui;
};
export const getRowHeightGridForm = () => {
    let ui = getUI();
    ui.container.defaultAreaInnerMargin = 10;
    for (let i = 0; i < 2; i++) {
        ui.container.addRow(new XGridRow());
    }
    let area = new XGridArea(0, 0, 12, 1);
    let label = new XLabel();
    label.text = "not set row height";
    area.add(label);
    ui.container.addArea(area);
    area = new XGridArea(1, 0, 12, 1);
    area.add(label);
    area.add(new XTextField());
    area.add(new XTextField());
    ui.container.addArea(area);
    area = new XGridArea(2, 0, 12, 1);
    label = new XLabel();
    label.text = "100px";
    area.add(label);
    area.add(new XTextField());
    area.add(new XTextField());
    area.add(new XTextField());
    area.add(new XTextField());
    area.add(new XTextField());
    ui.container.rows[ui.container.rows.length - 1].height = 100;
    ui.container.add(area);
    return ui;
};
//# sourceMappingURL=TestDataSetup.js.map