"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRowHeightGridForm = exports.getOverridedInnerMargin = exports.getOverridedBackgroundGrid = exports.getOverridedBorderGrid = exports.getOneControlsGrid = exports.getGridForm = void 0;
const LabelFormControl_1 = require("../../Controls/Web/LabelFormControl");
const TextFormControl_1 = require("../../Controls/Web/TextFormControl");
const DefaultOffOverride_1 = require("../../Utilities/DefaultOffOverride");
const DefaultOnOff_1 = require("../../Utilities/DefaultOnOff");
const FormConfiguration_1 = require("../../FormConfiguration");
const XGridContainer_1 = require("../XGridContainer");
function getUI() {
    let ui = new FormConfiguration_1.FormConfiguration();
    let gridContainer = new XGridContainer_1.XGridContainer();
    // show border so we can see
    gridContainer.overrideFormBorderSettings = DefaultOnOff_1.DefaultOnOff.On;
    ui.add(gridContainer);
    return { form: ui, container: gridContainer };
}
const getGridForm = () => {
    let ui = getUI();
    for (let i = 0; i < 5; i++) {
        ui.container.addRow(new XGridContainer_1.XGridRow());
    }
    // creating areas
    let area = new XGridContainer_1.XGridArea(0, 0, 4, 6);
    area.add(new TextFormControl_1.TextFormControl());
    area.add(new TextFormControl_1.TextFormControl());
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(0, 4, 8, 3);
    area.add(new TextFormControl_1.TextFormControl());
    area.add(new TextFormControl_1.TextFormControl());
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(3, 4, 4, 3);
    area.oneControl = true;
    area.controlAlign = {
        top: 10,
        left: 20,
    };
    area.add(new TextFormControl_1.TextFormControl());
    area.add(new TextFormControl_1.TextFormControl());
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(3, 8, 4, 3);
    area.oneControl = true;
    area.add(new TextFormControl_1.TextFormControl());
    area.add(new TextFormControl_1.TextFormControl());
    ui.container.addArea(area);
    return ui;
};
exports.getGridForm = getGridForm;
const getOneControlsGrid = () => {
    let ui = getUI();
    for (let i = 0; i < 3; i++) {
        ui.container.addRow(new XGridContainer_1.XGridRow());
    }
    let label = new LabelFormControl_1.LabelFormControl();
    label.text = "center control";
    let area = new XGridContainer_1.XGridArea(0, 0, 5, 4);
    area.oneControl = true;
    area.add(label);
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(0, 6, 6, 4);
    area.controlAlign = {
        top: 40,
        left: 40,
    };
    label = new LabelFormControl_1.LabelFormControl();
    label.text = `top: ${area.controlAlign.top}, left: ${area.controlAlign.left}`;
    area.oneControl = true;
    area.add(label);
    ui.container.addArea(area);
    return ui;
};
exports.getOneControlsGrid = getOneControlsGrid;
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 XGridContainer_1.XGridRow());
    }
    let area = new XGridContainer_1.XGridArea(0, 0, 4, 4);
    let label = new LabelFormControl_1.LabelFormControl();
    label.text = "default border";
    area.add(label);
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(0, 4, 4, 4);
    area.add(label);
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(0, 8, 4, 4);
    label = new LabelFormControl_1.LabelFormControl();
    label.text = "Overrided Border";
    area.add(label);
    area.formBorderSettings = DefaultOffOverride_1.DefaultOffOverride.Override;
    area.containerBorderColor = "rgba(64, 80, 166, 1)";
    area.containerBorderWidth = 5;
    area.containerBorderRadius = 20;
    ui.container.add(area);
    return ui;
};
exports.getOverridedBorderGrid = getOverridedBorderGrid;
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 XGridContainer_1.XGridRow());
    }
    let area = new XGridContainer_1.XGridArea(0, 0, 4, 4);
    let label = new LabelFormControl_1.LabelFormControl();
    label.text = "default background";
    area.add(label);
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(0, 4, 4, 4);
    area.add(label);
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(0, 8, 4, 4);
    label = new LabelFormControl_1.LabelFormControl();
    label.text = "Overrided background";
    area.add(label);
    area.backgroundColorSettings = DefaultOffOverride_1.DefaultOffOverride.Override;
    area.containerBackgroundColor = "rgba(64, 80, 166, 0.5)";
    ui.container.add(area);
    return ui;
};
exports.getOverridedBackgroundGrid = getOverridedBackgroundGrid;
const getOverridedInnerMargin = () => {
    let ui = getUI();
    ui.container.defaultAreaInnerMargin = 10;
    for (let i = 0; i < 3; i++) {
        ui.container.addRow(new XGridContainer_1.XGridRow());
    }
    let area = new XGridContainer_1.XGridArea(0, 0, 4, 4);
    let label = new LabelFormControl_1.LabelFormControl();
    label.text = "default inner margin";
    area.add(label);
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(0, 4, 4, 4);
    area.add(label);
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(0, 8, 4, 4);
    label = new LabelFormControl_1.LabelFormControl();
    label.text = "Overrided inner margin";
    area.add(label);
    area.innerMarginSettings = DefaultOffOverride_1.DefaultOffOverride.Override;
    area.innerMargin = 30;
    ui.container.add(area);
    return ui;
};
exports.getOverridedInnerMargin = getOverridedInnerMargin;
const getRowHeightGridForm = () => {
    let ui = getUI();
    ui.container.defaultAreaInnerMargin = 10;
    for (let i = 0; i < 2; i++) {
        ui.container.addRow(new XGridContainer_1.XGridRow());
    }
    let area = new XGridContainer_1.XGridArea(0, 0, 12, 1);
    let label = new LabelFormControl_1.LabelFormControl();
    label.text = "not set row height";
    area.add(label);
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(1, 0, 12, 1);
    area.add(label);
    area.add(new TextFormControl_1.TextFormControl());
    area.add(new TextFormControl_1.TextFormControl());
    ui.container.addArea(area);
    area = new XGridContainer_1.XGridArea(2, 0, 12, 1);
    label = new LabelFormControl_1.LabelFormControl();
    label.text = "100px";
    area.add(label);
    area.add(new TextFormControl_1.TextFormControl());
    area.add(new TextFormControl_1.TextFormControl());
    area.add(new TextFormControl_1.TextFormControl());
    area.add(new TextFormControl_1.TextFormControl());
    area.add(new TextFormControl_1.TextFormControl());
    ui.container.rows[ui.container.rows.length - 1].height = 100;
    ui.container.add(area);
    return ui;
};
exports.getRowHeightGridForm = getRowHeightGridForm;
//# sourceMappingURL=TestDataSetup.js.map