"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataGridStories = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const FormRuntime_1 = require("../../FormRuntime");
const DataGridFormControl_1 = require("../Web/DataGridFormControl");
const Containers_1 = require("../../Containers");
const FormConfiguration_1 = require("../../FormConfiguration");
const StoryData_1 = require("../../../CommonUI/StoryBook/StoryData");
const ExecutionData_1 = require("@appglue/common/dist/Common/Data/ExecutionData/ExecutionData");
function getUI() {
    let ui = new FormConfiguration_1.FormConfiguration();
    let container = new Containers_1.XStackContainer();
    ui.add(container);
    let datagrid = new DataGridFormControl_1.DataGridFormControl();
    datagrid.label = "Datagrid With Configuration";
    datagrid.valueName = "employee";
    datagrid.selectedValueName = "selectedEmployee";
    datagrid.selectedColumnSet = 0;
    datagrid.columnValues = [
        {
            field: "Name",
            headerName: "Name",
            type: "string",
            width: 180,
            sortable: false,
            filterable: false,
        },
        {
            field: "Age",
            headerName: "Age",
            type: "number",
            width: 160,
            sortable: false,
            filterable: false,
        },
        {
            field: "IsMale",
            headerName: "IsMale",
            type: "boolean",
            sortable: false,
            filterable: false,
        },
    ];
    container.add(datagrid);
    return { form: ui, control: datagrid };
}
let data = new ExecutionData_1.ExecutionData();
data.values["employee"] = [
    {
        Name: "John",
        Age: 28,
        IsMale: true,
    },
    {
        Name: "Cathy",
        Age: 25,
        IsMale: false,
    },
    {
        Name: "James",
        Age: 32,
        IsMale: true,
    },
    {
        Name: "Majesta",
        Age: 28,
        IsMale: true,
    },
];
exports.DataGridStories = [
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Default"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.dataGridMode = "Display";
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Display Mode"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.dataGridMode = "Edit";
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Edit Mode"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.dataGridMode = "Select";
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Select Mode"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.dataGridMode = "Select & Edit";
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Select and Edit Mode"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.columnValues[0].hide = true;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Hide Col Feature"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.columnValues[0].sortable = true;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Sort Col Feature"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.columnValues[0].sortable = true;
        ui.control.columnValues[1].sortable = true;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Multi-Sort Col Feature"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.columnValues[0].filterable = true;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Filter Feature"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.columnValues[0].width = 250;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Col Width"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        ui.control.columnValues[0].customHeader = true;
        ui.control.columnValues[0].fontColor = "#FF0000";
        ui.control.columnValues[0].fontSize = 20;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Data Grid", "Header Color and Font"),
];
//# sourceMappingURL=XDataGrid-stories.js.map