"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RatingStories = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const FormConfiguration_1 = require("../../FormConfiguration");
const FormRuntime_1 = require("../../FormRuntime");
const RatingFormControl_1 = require("../Web/RatingFormControl");
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");
let formData = new ExecutionData_1.ExecutionData();
formData.values["rating"] = 8;
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 rating = new RatingFormControl_1.RatingFormControl();
    rating.label = "Please rate us";
    rating.valueName = "rating";
    rating.size = "large";
    rating.requiredOnAllOutcomes = false;
    col1.add(rating);
    label = new LabelFormControl_1.LabelFormControl();
    label.text = "Small Size";
    col2.add(label);
    rating = new RatingFormControl_1.RatingFormControl();
    rating.label = "Please rate us";
    rating.valueName = "rating";
    rating.size = "small";
    rating.requiredOnAllOutcomes = false;
    col2.add(rating);
    return { form: ui };
}
exports.RatingStories = [
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: formData });
    }, "Form Designer", "Controls", "Rating", "Default"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let controls = ui.form.getAllControls();
        for (let c of controls) {
            let ctf = c;
            if (ctf) {
                ctf.label = "label text";
            }
        }
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: formData });
    }, "Form Designer", "Controls", "Rating", "With Control Label"),
    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, formData: formData });
    }, "Form Designer", "Controls", "Rating", "With Validation"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let formData = new ExecutionData_1.ExecutionData();
        formData.values["rating"] = 5.5;
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: formData });
    }, "Form Designer", "Controls", "Rating", "With Validation"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let controls = ui.form.getAllControls();
        for (let i = 0; i < controls.length; i++) {
            let ctf = controls[i];
            ctf.showLabels = true;
            ctf.left = "bad";
            ctf.right = "good";
        }
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: formData });
    }, "Form Designer", "Controls", "Rating", "With Mark Labels"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let controls = ui.form.getAllControls();
        for (let i = 0; i < controls.length; i++) {
            let ctf = controls[i];
            ctf.showLabels = false;
        }
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: formData });
    }, "Form Designer", "Controls", "Rating", "Without Mark Labels"),
    new StoryData_1.StoryNode(() => {
        let ui = getUI();
        let controls = ui.form.getAllControls();
        for (let i = 0; i < controls.length; i++) {
            let ctf = controls[i];
            ctf.count = 5;
        }
        return (0, jsx_runtime_1.jsx)(FormRuntime_1.FormRuntime, { form: ui.form, formData: formData });
    }, "Form Designer", "Controls", "Rating", "5 Stars"),
];
//# sourceMappingURL=XRating-stories.js.map