"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NumberBoxStories = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const FormConfiguration_1 = require("../../FormConfiguration");
const FormRuntime_1 = require("../../FormRuntime");
const NumberFormControl_1 = require("../Web/NumberFormControl");
const Containers_1 = require("../../Containers");
const LabelFormControl_1 = require("../Web/LabelFormControl");
const FormDesignConstants_1 = require("../../Utilities/FormDesignConstants");
const ExecutionData_1 = require("@appglue/common/dist/Common/Data/ExecutionData/ExecutionData");
const StoryData_1 = require("../../../CommonUI/StoryBook/StoryData");
function getUI() {
    let ui = new FormConfiguration_1.FormConfiguration();
    let container = new Containers_1.XColumnContainer();
    let col1 = new Containers_1.XColumnContainerColumn();
    let col2 = new Containers_1.XColumnContainerColumn();
    col2.interControlSpacing = 20;
    container.add(col1);
    container.add(col2);
    ui.add(container);
    let label = new LabelFormControl_1.LabelFormControl();
    label.text = "Large Size";
    col1.add(label);
    let textField = new NumberFormControl_1.NumberFormControl();
    textField.label = "Text Field Label";
    textField.valueName = "value";
    textField.requiredOnAllOutcomes = false;
    col1.add(textField);
    textField = new NumberFormControl_1.NumberFormControl();
    textField.label = "Text Field Label";
    textField.style = FormDesignConstants_1.TextControlStyle.OUTLINE;
    textField.valueName = "value";
    textField.requiredOnAllOutcomes = false;
    textField.overrideStyle = true;
    col1.add(textField);
    textField = new NumberFormControl_1.NumberFormControl();
    textField.label = "Text Field Label";
    textField.style = FormDesignConstants_1.TextControlStyle.SHADED;
    textField.valueName = "value";
    textField.requiredOnAllOutcomes = false;
    textField.overrideStyle = true;
    col1.add(textField);
    textField = new NumberFormControl_1.NumberFormControl();
    textField.label = "Text Field Label";
    textField.valueName = "value";
    textField.style = FormDesignConstants_1.TextControlStyle.UNDERLINED;
    textField.requiredOnAllOutcomes = false;
    textField.overrideStyle = true;
    col1.add(textField);
    label = new LabelFormControl_1.LabelFormControl();
    label.text = "Small Size";
    col2.add(label);
    textField = new NumberFormControl_1.NumberFormControl();
    textField.label = "Text Field Label";
    textField.valueName = "value";
    textField.requiredOnAllOutcomes = false;
    textField.size = FormDesignConstants_1.TextControlSize.SMALL;
    col2.add(textField);
    textField = new NumberFormControl_1.NumberFormControl();
    textField.label = "Text Field Label";
    textField.style = FormDesignConstants_1.TextControlStyle.OUTLINE;
    textField.valueName = "value";
    textField.size = FormDesignConstants_1.TextControlSize.SMALL;
    textField.requiredOnAllOutcomes = false;
    textField.overrideStyle = true;
    col2.add(textField);
    textField = new NumberFormControl_1.NumberFormControl();
    textField.label = "Text Field Label";
    textField.style = FormDesignConstants_1.TextControlStyle.SHADED;
    textField.valueName = "value";
    textField.size = FormDesignConstants_1.TextControlSize.SMALL;
    textField.requiredOnAllOutcomes = false;
    textField.overrideStyle = true;
    col2.add(textField);
    textField = new NumberFormControl_1.NumberFormControl();
    textField.label = "Text Field Label";
    textField.style = FormDesignConstants_1.TextControlStyle.UNDERLINED;
    textField.valueName = "value";
    textField.size = FormDesignConstants_1.TextControlSize.SMALL;
    textField.requiredOnAllOutcomes = false;
    textField.overrideStyle = true;
    col2.add(textField);
    return { form: ui };
}
function getUIForOneControl() {
    let ui = new FormConfiguration_1.FormConfiguration();
    let container = new Containers_1.XStackContainer();
    let control = new NumberFormControl_1.NumberFormControl();
    container.add(control);
    control.valueName = "value";
    ui.add(container);
    return { form: ui, control };
}
exports.NumberBoxStories = [
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form });
    }, "Form Designer", "Controls", "Number Box", "Default"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let controls = ui.form.getAllControls();
        for (let c of controls) {
            let ctf = c;
            if (ctf) {
                ctf.hintText = "hint text";
            }
        }
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form });
    }, "Form Designer", "Controls", "Number Box", "With Hint"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let controls = ui.form.getAllControls();
        for (let c of controls) {
            let ctf = c;
            if (ctf) {
                ctf.placeholderText = "placeholder text";
            }
        }
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form });
    }, "Form Designer", "Controls", "Number Box", "With Placeholder"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let controls = ui.form.getAllControls();
        for (let c of controls) {
            let ctf = c;
            if (ctf) {
                ctf.requiredOnAllOutcomes = true;
            }
        }
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form });
    }, "Form Designer", "Controls", "Number Box", "With Validation"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let data = new ExecutionData_1.ExecutionData();
        data.values["value"] = 200;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Number Box", "From Data"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let data = new ExecutionData_1.ExecutionData();
        data.values["value"] = 200;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "Number Box", "From Data"),
    new StoryData_1.StoryNode(() => {
        let conf = getUIForOneControl();
        conf.control.min = 500;
        let data = new ExecutionData_1.ExecutionData();
        data.values["value"] = 200;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: conf.form, formData: data });
    }, "Form Designer", "Controls", "Number Box", "Validation With Min"),
    new StoryData_1.StoryNode(() => {
        let conf = getUIForOneControl();
        conf.control.separator = true;
        let data = new ExecutionData_1.ExecutionData();
        data.values["value"] = "123,456,789";
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: conf.form, formData: data });
    }, "Form Designer", "Controls", "Number Box", "Separators??? - FIX"),
    new StoryData_1.StoryNode(() => {
        let conf = getUIForOneControl();
        conf.control.allowDecimals = true;
        let data = new ExecutionData_1.ExecutionData();
        data.values["value"] = 150.12;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: conf.form, formData: data });
    }, "Form Designer", "Controls", "Number Box", "Decimals"),
];
//# sourceMappingURL=XNumberBox-stories.js.map