{
    "i18n": true,
    "type": "tabs",
    "items": {
        "_devices": {
            "type": "panel",
            "label": "lblConfig",
            "items": {
                "_headerMode": {
                    "type": "header",
                    "text": "hdrMode",
                    "size": 2
                },

                "ctrlMode": {
                    "type": "select",
                    "newLine": true,
                    "sm": 2,
                    "md": 2,
                    "lg": 2,
                    "label": "lblCtrlMode",
                    "tooltip": "ttCtrlMode",
                    "options": [
                        { "label": "lblCtrlModeKp", "value": 0 },
                        { "label": "lblCtrlModeXp", "value": 1 }
                    ],
                    "default": 0
                },
                "_ctrlModeTxt_0": {
                    "type": "staticText",
                    "sm": 10,
                    "md": 10,
                    "lg": 10,
                    "text": "lblCtrlModeText_0",
                    "hidden": "data.ctrlMode!==0",
                    "style": {
                        "fontSize": 16
                    }
                },
                "_ctrlModeTxt_1": {
                    "type": "staticText",
                    "sm": 10,
                    "md": 10,
                    "lg": 10,
                    "text": "lblCtrlModeText_1",
                    "hidden": "data.ctrlMode!==1",
                    "style": {
                        "fontSize": 16
                    }
                },
                "ctrlActDiff": {
                    "type": "checkbox",
                    "newLine": true,
                    "sm": 2,
                    "md": 2,
                    "lg": 2,
                    "label": "lblCtrlActDiffText",
                    "tooltip": "ttCtrlActDiffText",
                    "default": false
                },
                "_ctrlActDiff_f": {
                    "type": "staticText",
                    "sm": 10,
                    "md": 10,
                    "lg": 10,
                    "text": "lblCtrlActDiffText_f",
                    "hidden": "!!data.ctrlActDiff",
                    "style": {
                        "fontSize": 16
                    }
                },
                "_ctrlActDiff_t": {
                    "type": "staticText",
                    "sm": 10,
                    "md": 10,
                    "lg": 10,
                    "text": "lblCtrlActDiffText_t",
                    "hidden": "!data.ctrlActDiff",
                    "style": {
                        "fontSize": 16
                    }
                },
                "_headerControllers": {
                    "type": "header",
                    "text": "hdrCtrl",
                    "size": 2
                },

                "_ctrlErrTxt_1": {
                    "type": "staticText",
                    "sm": 10,
                    "md": 10,
                    "lg": 10,
                    "text": "errValCtrlId",
                    "hidden": "const x={};if (!data.controllers) return true; for (const c of data.controllers) {if ((!c.ctrlId.match(/^[A-Za-z0-9]([A-Za-z0-9-_])*$/)) || (x[c.ctrlId]==='x') ) return false; x[c.ctrlId]='x';}; return true;",
                    "style": {
                        "fontSize": 16,
                        "color": "red"
                    }
                },

                "controllers": {
                    "type": "table",
                    "newLine": true,
                    "sm": 12,
                    "md": 12,
                    "lg": 12,
                    "label": "",
                    "showSecondAddAt": 5,
                    "items": [
                        {
                            "type": "checkbox",
                            "attr": "ctrlAct",
                            "width": "5% ",
                            "title": "lblCtrlAct",
                            "tooltip": "ttCtrlAct",
                            "filter": false,
                            "sort": false,
                            "default": true
                        },
                        {
                            "type": "checkbox",
                            "attr": "ctrlAutoStart",
                            "width": "5% ",
                            "title": "lblCtrlAutoStart",
                            "tooltip": "ttCtrlAutoStart",
                            "filter": false,
                            "sort": false,
                            "default": true
                        },
                        {
                            "type": "checkbox",
                            "attr": "ctrlUseStateCfg",
                            "width": "5% ",
                            "title": "lblCtrlUseStateCfg",
                            "tooltip": "ttCtrlUseStateCfg",
                            "filter": false,
                            "sort": false,
                            "default": false
                        },
                        {
                            "type": "text",
                            "attr": "ctrlId",
                            "width": "8% ",
                            "title": "lblCtrlId",
                            "tooltip": "ttCtrlId",
                            "filter": false,
                            "sort": false,
                            "default": "",
                            "validator": "const x={};for (const c of globalData.controllers) {if (x[c.ctrlId]==='x') return false; x[c.ctrlId]='x';}; return data.ctrlId.match(/^[A-Za-z0-9]([A-Za-z0-9-_])*$/);",
                            "validatorNoSaveOnError": true
                        },
                        {
                            "type": "number",
                            "attr": "ctrlKpXp",
                            "width": "6% ",
                            "title": "lblCtrlKpXp",
                            "tooltip": "ttCtrlKpXp",
                            "hidden": "data.ctrlUseStateCfg",
                            "filter": false,
                            "sort": false,
                            "min": 0,
                            "step": 0.001,
                            "default": 1
                        },
                        {
                            "type": "number",
                            "attr": "ctrlTn",
                            "width": "6% ",
                            "title": "lblCtrlTn",
                            "tooltip": "ttCtrlTn",
                            "hidden": "data.ctrlUseStateCfg",
                            "filter": false,
                            "sort": false,
                            "min": 0,
                            "step": 0.001,
                            "default": 0
                        },
                        {
                            "type": "number",
                            "attr": "ctrlTv",
                            "width": "6% ",
                            "title": "lblCtrlTv",
                            "tooltip": "ttCtrlTv",
                            "hidden": "data.ctrlUseStateCfg",
                            "filter": false,
                            "sort": false,
                            "min": 0,
                            "step": 0.001,
                            "default": 0
                        },
                        {
                            "type": "number",
                            "attr": "ctrlMin",
                            "width": "6% ",
                            "title": "lblCtrlMin",
                            "tooltip": "ttCtrlMin",
                            "hidden": "data.ctrlUseStateCfg",
                            "filter": false,
                            "sort": false,
                            "default": 0,
                            "validator": "data.ctrlMin < data.ctrlMax",
                            "validatorErrorText": "errValCtrlMinMax",
                            "validatorNoSaveOnError": true
                        },
                        {
                            "type": "number",
                            "attr": "ctrlMax",
                            "width": "6% ",
                            "title": "lblCtrlMax",
                            "tooltip": "ttCtrlMax",
                            "hidden": "data.ctrlUseStateCfg",
                            "filter": false,
                            "sort": false,
                            "default": 100,
                            "validator": "data.ctrlMin < data.ctrlMax",
                            "validatorErrorText": "errValCtrlMinMax",
                            "validatorNoSaveOnError": true
                        },
                        {
                            "type": "number",
                            "attr": "ctrlOff",
                            "width": "6% ",
                            "title": "lblCtrlOff",
                            "tooltip": "ttCtrlOff",
                            "hidden": "data.ctrlUseStateCfg",
                            "filter": false,
                            "sort": false,
                            "default": 0
                        },
                        {
                            "type": "number",
                            "attr": "ctrlSup",
                            "width": "6% ",
                            "title": "lblCtrlSup",
                            "tooltip": "ttCtrlSup",
                            "hidden": "data.ctrlUseStateCfg",
                            "filter": false,
                            "sort": false,
                            "min": 0,
                            "default": 0
                        },
                        {
                            "type": "checkbox",
                            "attr": "ctrlInvert",
                            "width": "5% ",
                            "title": "lblCtrlInvert",
                            "tooltip": "ttCtrInvert",
                            "hidden": "data.ctrlUseStateCfg",
                            "filter": false,
                            "sort": false,
                            "default": false
                        },
                        {
                            "type": "number",
                            "attr": "ctrlCycle",
                            "width": "13% ",
                            "title": "lblCtrlCycle",
                            "tooltip": "ttCtrlCycle",
                            "filter": false,
                            "sort": false,
                            "min": 100,
                            "max": 3600000,
                            "step": 100,
                            "default": 1000
                        }
                    ]
                }
            }
        },
        "options": {
            "type": "panel",
            "label": "lblOptions",
            "items": {
                "optLogCalc": {
                    "type": "checkbox",
                    "label": "lblOptLogCalc",
                    "default": false,
                    "tooltip": "ttOptLogCalc",
                    "help": "hlpOptLogCalc"
                },
                "optNoFolders": {
                    "type": "checkbox",
                    "label": "lblOptNoFolders",
                    "newLine": true,
                    "default": false,
                    "tooltip": "ttOptNoFolders",
                    "help": "hlpOptNoFolders",
                    "confirm": {
                        "condition": "!data.optNoFolders || data.optNoFolders",
                        "title": "lblWarning",
                        "text": "txtNoFoldersChg",
                        "ok": "lblOk",
                        "cancel": "lblCancel",
                        "type": "warning"
                    }
                }
            }
        }
    }
}
