"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ListEntryStories = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
// also exported from '@storybook/react' if you can deal with breaking changes in 6.1
const FormConfiguration_1 = require("../../FormConfiguration");
const FormRuntime_1 = require("../../FormRuntime");
const ListEntryFormControl_1 = require("../Web/ListEntryFormControl");
const Containers_1 = require("../../Containers");
const LabelFormControl_1 = require("../Web/LabelFormControl");
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 col = new Containers_1.XColumnContainerColumn();
    container.add(col);
    ui.add(container);
    let label = new LabelFormControl_1.LabelFormControl();
    label.text = "List Entry";
    col.add(label);
    let textField = new ListEntryFormControl_1.ListEntryFormControl();
    textField.label = "Text Field Label";
    textField.valueName = "value";
    textField.requiredOnAllOutcomes = false;
    col.add(textField);
    textField = new ListEntryFormControl_1.ListEntryFormControl();
    textField.label = "Text Field Label";
    textField.valueName = "value";
    textField.requiredOnAllOutcomes = false;
    textField.mode = ListEntryFormControl_1.ListEntryType.LIST;
    col.add(textField);
    textField = new ListEntryFormControl_1.ListEntryFormControl();
    textField.label = "Text Field Label";
    textField.valueName = "value";
    textField.requiredOnAllOutcomes = false;
    textField.mode = ListEntryFormControl_1.ListEntryType.TEXT;
    col.add(textField);
    textField = new ListEntryFormControl_1.ListEntryFormControl();
    textField.label = "Text Field Label";
    textField.valueName = "value";
    textField.requiredOnAllOutcomes = true;
    textField.mode = ListEntryFormControl_1.ListEntryType.LIST;
    col.add(textField);
    textField = new ListEntryFormControl_1.ListEntryFormControl();
    textField.label = "Text Field Label";
    textField.valueName = "value";
    textField.requiredOnAllOutcomes = true;
    textField.mode = ListEntryFormControl_1.ListEntryType.TEXT;
    col.add(textField);
    return { form: ui };
}
exports.ListEntryStories = [
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form });
    }, "Form Designer", "Controls", "List Entry", "Default"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let controls = ui.form.getAllControls();
        for (let c of controls) {
            let ctf = c;
            if (ctf) {
                ctf.mode = "TEXT";
            }
        }
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form });
    }, "Form Designer", "Controls", "List Entry", "With Text Type"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let controls = ui.form.getAllControls();
        for (let c of controls) {
            let ctf = c;
            if (ctf) {
                ctf.mode = "LIST";
            }
        }
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form });
    }, "Form Designer", "Controls", "List Entry", "With List Type"),
    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", "List Entry", "With Validation Breaks"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let data = new ExecutionData_1.ExecutionData();
        data.values["value"] = ["Upwork", "HubStaff"];
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: data });
    }, "Form Designer", "Controls", "List Entry", "With Value"),
];
//# sourceMappingURL=XListEntry-stories.js.map