'function optionsCustomValidation(options, props, _) {\n var validationUtil = (options, _) => {\n var _isValid = true;\n var message = "";\n var valueType = "";\n var uniqueLabels = {};\n\n for (var i = 0; i < options.length; i++) {\n var _options$i = options[i],\n label = _options$i.label,\n value = _options$i.value;\n\n if (!valueType) {\n valueType = typeof value;\n } //Checks the uniqueness all the values in the options\n\n\n if (!uniqueLabels.hasOwnProperty(value)) {\n uniqueLabels[value] = "";\n } else {\n _isValid = false;\n message = "path:value must be unique. Duplicate values found";\n break;\n } //Check if the required field "label" is present:\n\n\n if (!label) {\n _isValid = false;\n message = "Invalid entry at index: " + i + ". Missing required key: label";\n break;\n } //Validation checks for the the label.\n\n\n if (_.isNil(label) || label === "" || typeof label !== "string" && typeof label !== "number") {\n _isValid = false;\n message = "Invalid entry at index: " + i + ". Value of key: label is invalid: This value does not evaluate to type string";\n break;\n } //Check if all the data types for the value prop is the same.\n\n\n if (typeof value !== valueType) {\n _isValid = false;\n message = "All value properties in options must have the same type";\n break;\n } //Check if the each object has value property.\n\n\n if (_.isNil(value)) {\n _isValid = false;\n message = \'This value does not evaluate to type Array<{ "label": "string", "value": "string" | number }>\';\n break;\n }\n }\n\n return {\n isValid: _isValid,\n parsed: _isValid ? options : [],\n messages: [message]\n };\n };\n\n var invalidResponse = {\n isValid: false,\n parsed: [],\n messages: [\'This value does not evaluate to type Array<{ "label": "string", "value": "string" | number }>\']\n };\n\n try {\n if (_.isString(options)) {\n options = JSON.parse(options);\n }\n\n if (Array.isArray(options)) {\n return validationUtil(options, _);\n } else {\n return invalidResponse;\n }\n } catch (e) {\n return invalidResponse;\n }\n}',
},
},
evaluationSubstitutionType:
EvaluationSubstitutionType.SMART_SUBSTITUTE,
id:"6su4u0bwoe",
},
{
helpText:"Sets a default selected option",
propertyName:"defaultOptionValue",
label:"Default Selected Value",
// placeholderText: "Y",
controlType:"INPUT_TEXT",
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.FUNCTION,
params:{
expected:{
type:"string |\nnumber (only works in mustache syntax)",
'function defaultOptionValidation(value, props, _) {\n //Checks if the value is not of object type in {{}}\n if (_.isObject(value)) {\n return {\n isValid: false,\n parsed: JSON.stringify(value, null, 2),\n messages: ["This value does not evaluate to type: string or number"]\n };\n } //Checks if the value is not of boolean type in {{}}\n\n\n if (_.isBoolean(value)) {\n return {\n isValid: false,\n parsed: value,\n messages: ["This value does not evaluate to type: string or number"]\n };\n }\n\n return {\n isValid: true,\n parsed: value\n };\n}',
},
},
id:"8wpzo6szbl",
},
{
propertyName:"isRequired",
label:"Required",
helpText:"Makes input to the widget mandatory",
controlType:"SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.BOOLEAN,
},
id:"60kc73ivwp",
},
{
helpText:"Controls the visibility of the widget",
propertyName:"isVisible",
label:"Visible",
controlType:"SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.BOOLEAN,
},
id:"w4591dtf5l",
},
{
propertyName:"isDisabled",
label:"Disabled",
helpText:"Disables input to this widget",
controlType:"SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.BOOLEAN,
},
id:"6p7181ccec",
},
{
propertyName:"animateLoading",
label:"Animate Loading",
controlType:"SWITCH",
helpText:"Controls the loading of the widget",
// defaultValue: true,
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.BOOLEAN,
},
id:"y2gw796t2z",
},
],
id:"jfh7ud39r4",
},
{
sectionName:"Events",
children:[
{
helpText:
"Triggers an action when a user changes the selected option",
'function optionsCustomValidation(options, props, _) {\n var validationUtil = (options, _) => {\n var _isValid = true;\n var message = "";\n var valueType = "";\n var uniqueLabels = {};\n\n for (var i = 0; i < options.length; i++) {\n var _options$i = options[i],\n label = _options$i.label,\n value = _options$i.value;\n\n if (!valueType) {\n valueType = typeof value;\n } //Checks the uniqueness all the values in the options\n\n\n if (!uniqueLabels.hasOwnProperty(value)) {\n uniqueLabels[value] = "";\n } else {\n _isValid = false;\n message = "path:value must be unique. Duplicate values found";\n break;\n } //Check if the required field "label" is present:\n\n\n if (!label) {\n _isValid = false;\n message = "Invalid entry at index: " + i + ". Missing required key: label";\n break;\n } //Validation checks for the the label.\n\n\n if (_.isNil(label) || label === "" || typeof label !== "string" && typeof label !== "number") {\n _isValid = false;\n message = "Invalid entry at index: " + i + ". Value of key: label is invalid: This value does not evaluate to type string";\n break;\n } //Check if all the data types for the value prop is the same.\n\n\n if (typeof value !== valueType) {\n _isValid = false;\n message = "All value properties in options must have the same type";\n break;\n } //Check if the each object has value property.\n\n\n if (_.isNil(value)) {\n _isValid = false;\n message = \'This value does not evaluate to type Array<{ "label": "string", "value": "string" | number }>\';\n break;\n }\n }\n\n return {\n isValid: _isValid,\n parsed: _isValid ? options : [],\n messages: [message]\n };\n };\n\n var invalidResponse = {\n isValid: false,\n parsed: [],\n messages: [\'This value does not evaluate to type Array<{ "label": "string", "value": "string" | number }>\']\n };\n\n try {\n if (_.isString(options)) {\n options = JSON.parse(options);\n }\n\n if (Array.isArray(options)) {\n return validationUtil(options, _);\n } else {\n return invalidResponse;\n }\n } catch (e) {\n return invalidResponse;\n }\n}',
},
},
evaluationSubstitutionType:
EvaluationSubstitutionType.SMART_SUBSTITUTE,
id:"6su4u0bwoe",
},
{
helpText:"Sets a default selected option",
propertyName:"defaultOptionValue",
label:"Default Selected Value",
// placeholderText: "Y",
controlType:"INPUT_TEXT",
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.FUNCTION,
params:{
expected:{
type:"string |\nnumber (only works in mustache syntax)",
'function defaultOptionValidation(value, props, _) {\n //Checks if the value is not of object type in {{}}\n if (_.isObject(value)) {\n return {\n isValid: false,\n parsed: JSON.stringify(value, null, 2),\n messages: ["This value does not evaluate to type: string or number"]\n };\n } //Checks if the value is not of boolean type in {{}}\n\n\n if (_.isBoolean(value)) {\n return {\n isValid: false,\n parsed: value,\n messages: ["This value does not evaluate to type: string or number"]\n };\n }\n\n return {\n isValid: true,\n parsed: value\n };\n}',
},
},
id:"8wpzo6szbl",
},
{
propertyName:"isRequired",
label:"Required",
helpText:"Makes input to the widget mandatory",
controlType:"SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.BOOLEAN,
},
id:"60kc73ivwp",
},
{
helpText:"Controls the visibility of the widget",
propertyName:"isVisible",
label:"Visible",
controlType:"SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.BOOLEAN,
},
id:"w4591dtf5l",
},
{
propertyName:"isDisabled",
label:"Disabled",
helpText:"Disables input to this widget",
controlType:"SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.BOOLEAN,
},
id:"6p7181ccec",
},
{
propertyName:"animateLoading",
label:"Animate Loading",
controlType:"SWITCH",
helpText:"Controls the loading of the widget",
// defaultValue: true,
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation:{
type:ValidationTypes.BOOLEAN,
},
id:"y2gw796t2z",
},
],
id:"jfh7ud39r4",
},
{
sectionName:"Events",
children:[
{
helpText:
"Triggers an action when a user changes the selected option",