diff --git a/app/client/cypress/fixtures/testdata.json b/app/client/cypress/fixtures/testdata.json index 79451cae17..b278c86a42 100644 --- a/app/client/cypress/fixtures/testdata.json +++ b/app/client/cypress/fixtures/testdata.json @@ -107,7 +107,7 @@ "momentDate": "{{moment()}}", "defaultRowIndexBinding": "{{Table1.selectedRowIndex", "bindingAlign": "{{currentRow.userName.indexOf('Michael') > -1 ? 'LEFT' : 'RIGHT'}}", - "bindingSize": "{{currentRow.userName.indexOf('Michael') > -1 ? 'PARAGRAGH' : 'HEADING1'}}", + "bindingSize": "{{currentRow.userName.indexOf('Michael') > -1 ? 'PARAGRAPH' : 'HEADING1'}}", "bindingVerticalAlig": "{{currentRow.userName.indexOf('Michael') > -1 ? 'TOP' : 'BOTTOM'}}", "bindingTextColor": "{{currentRow.userName.indexOf('Michael') > -1 ? 'GREEN' : 'RED'}}", "bindingButton": "{{currentRow.userName.indexOf('Michael') > -1 ? 'Discount' : 'NoDiscount'}}", diff --git a/app/client/src/entities/Widget/utils.test.ts b/app/client/src/entities/Widget/utils.test.ts index 03c06ce948..8172b42dd0 100644 --- a/app/client/src/entities/Widget/utils.test.ts +++ b/app/client/src/entities/Widget/utils.test.ts @@ -4,6 +4,7 @@ import tablePropertyPaneConfig from "widgets/TableWidget/widget/propertyConfig"; import chartPorpertyConfig from "widgets/ChartWidget/widget/propertyConfig"; import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory"; import { AutocompleteDataType } from "utils/autocomplete/TernServer"; +import { ValidationTypes } from "constants/WidgetValidation"; describe("getAllPathsFromPropertyConfig", () => { it("works as expected for table widget", () => { @@ -219,6 +220,222 @@ describe("getAllPathsFromPropertyConfig", () => { default: [], }, }, + "primaryColumns.createdAt.isCellVisible": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.BOOLEAN, + }, + }, + "primaryColumns.name.isCellVisible": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.BOOLEAN, + }, + }, + "primaryColumns.status.isCellVisible": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.BOOLEAN, + }, + }, + "primaryColumns.status.isDisabled": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.BOOLEAN, + }, + }, + "primaryColumns.createdAt.inputFormat": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: [ + "Epoch", + "Milliseconds", + "YYYY-MM-DD", + "YYYY-MM-DD HH:mm", + "YYYY-MM-DDTHH:mm:ss.sssZ", + "YYYY-MM-DDTHH:mm:ss", + "YYYY-MM-DD hh:mm:ss", + "Do MMM YYYY", + "DD/MM/YYYY", + "DD/MM/YYYY HH:mm", + "LLL", + "LL", + "D MMMM, YYYY", + "H:mm A D MMMM, YYYY", + "MM-DD-YYYY", + "DD-MM-YYYY", + "MM/DD/YYYY", + "DD/MM/YYYY", + "DD/MM/YY", + "MM/DD/YY", + ], + }, + }, + }, + "primaryColumns.createdAt.outputFormat": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: [ + "Epoch", + "Milliseconds", + "YYYY-MM-DD", + "YYYY-MM-DD HH:mm", + "YYYY-MM-DDTHH:mm:ss.sssZ", + "YYYY-MM-DDTHH:mm:ss", + "YYYY-MM-DD hh:mm:ss", + "Do MMM YYYY", + "DD/MM/YYYY", + "DD/MM/YYYY HH:mm", + "LLL", + "LL", + "D MMMM, YYYY", + "H:mm A D MMMM, YYYY", + "MM-DD-YYYY", + "DD-MM-YYYY", + "MM/DD/YYYY", + "DD/MM/YYYY", + "DD/MM/YY", + "MM/DD/YY", + ], + }, + }, + }, + "primaryColumns.name.horizontalAlignment": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: ["LEFT", "CENTER", "RIGHT"], + }, + }, + }, + "primaryColumns.createdAt.horizontalAlignment": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: ["LEFT", "CENTER", "RIGHT"], + }, + }, + }, + "primaryColumns.name.textSize": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: [ + "HEADING1", + "HEADING2", + "HEADING3", + "PARAGRAPH", + "PARAGRAPH2", + ], + }, + }, + }, + "primaryColumns.createdAt.textSize": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: [ + "HEADING1", + "HEADING2", + "HEADING3", + "PARAGRAPH", + "PARAGRAPH2", + ], + }, + }, + }, + "primaryColumns.createdAt.fontStyle": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + }, + }, + "primaryColumns.name.fontStyle": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + }, + }, + "primaryColumns.createdAt.verticalAlignment": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: ["TOP", "CENTER", "BOTTOM"], + }, + }, + }, + "primaryColumns.name.verticalAlignment": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: ["TOP", "CENTER", "BOTTOM"], + }, + }, + }, + "primaryColumns.createdAt.textColor": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, + "primaryColumns.name.textColor": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, + "primaryColumns.createdAt.cellBackground": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, + "primaryColumns.name.cellBackground": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, + "primaryColumns.status.buttonColor": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, + "primaryColumns.status.buttonLabelColor": { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, }, }; diff --git a/app/client/src/utils/WidgetRegistry.tsx b/app/client/src/utils/WidgetRegistry.tsx index 9e2d291f1d..60e3d2467d 100644 --- a/app/client/src/utils/WidgetRegistry.tsx +++ b/app/client/src/utils/WidgetRegistry.tsx @@ -1,4 +1,4 @@ -import { registerWidget } from "./WidgetRegisterHelpers"; +import { registerWidget, WidgetConfiguration } from "./WidgetRegisterHelpers"; import CanvasWidget, { CONFIG as CANVAS_WIDGET_CONFIG, } from "widgets/CanvasWidget"; @@ -123,53 +123,59 @@ import MapChartWidget, { import log from "loglevel"; +export const ALL_WDIGETS_AND_CONFIG = [ + [CanvasWidget, CANVAS_WIDGET_CONFIG], + [SkeletonWidget, SKELETON_WIDGET_CONFIG], + [ContainerWidget, CONTAINER_WIDGET_CONFIG], + [TextWidget, TEXT_WIDGET_CONFIG], + [TableWidget, TABLE_WIDGET_CONFIG], + [CheckboxWidget, CHECKBOX_WIDGET_CONFIG], + [RadioGroupWidget, RADIO_GROUP_WIDGET_CONFIG], + [ButtonWidget, BUTTON_WIDGET_CONFIG], + [DropdownWidget, DROPDOWN_WIDGET_CONFIG], + [ImageWidget, IMAGE_WIDGET_CONFIG], + [VideoWidget, VIDEO_WIDGET_CONFIG], + [TabsWidget, TABS_WIDGET_CONFIG], + [InputWidget, INPUT_WIDGET_CONFIG], + [ModalWidget, MODAL_WIDGET_CONFIG], + [ChartWidget, CHART_WIDGET_CONFIG], + [MapWidget, MAP_WIDGET_CONFIG], + [FilePickerWidget, FILEPICKER_WIDGET_CONFIG], + [RichTextEditorWidget, RICH_TEXT_EDITOR_WIDGET_CONFIG], + [DatePickerWidget, DATE_PICKER_WIDGET_CONFIG], + [DatePickerWidget2, DATE_PICKER_WIDGET_2_CONFIG], + [SwitchWidget, SWITCH_WIDGET_CONFIG], + [FormWidget, FORM_WIDGET_CONFIG], + [FormButtonWidget, FORM_BUTTON_WIDGET_CONFIG], + [IconWidget, ICON_WIDGET_CONFIG], + [ListWidget, LIST_WIDGET_CONFIG], + [RateWidget, RATE_WIDGET_CONFIG], + [IframeWidget, IFRAME_WIDGET_CONFIG], + [TabsMigratorWidget, TABS_MIGRATOR_WIDGET_CONFIG], + [DividerWidget, DIVIDER_WIDGET_CONFIG], + [MenuButtonWidget, MENU_BUTTON_WIDGET_CONFIG], + [MultiSelectWidget, MULTI_SELECT_WIDGET_CONFIG], + [IconButtonWidget, ICON_BUTTON_WIDGET_CONFIG], + [CheckboxGroupWidget, CHECKBOX_GROUP_WIDGET_CONFIG], + [FilePickerWidgetV2, FILEPICKER_WIDGET_V2_CONFIG], + [StatboxWidget, STATBOX_WIDGET_CONFIG], + [AudioRecorderWidget, AUDIO_RECORDER_WIDGET_CONFIG], + [DocumentViewerWidget, DOCUMENT_VIEWER_WIDGET_CONFIG], + [ButtonGroupWidget, BUTTON_GROUP_CONFIG], + [MultiSelectTreeWidget, MULTI_SELECT_TREE_WIDGET_CONFIG], + [SingleSelectTreeWidget, SINGLE_SELECT_TREE_WIDGET_CONFIG], + [SwitchGroupWidget, SWITCH_GROUP_WIDGET_CONFIG], + [AudioWidget, AUDIO_WIDGET_CONFIG], + [ProgressBarWidget, PROGRESSBAR_WIDGET_CONFIG], + [CameraWidget, CAMERA_WIDGET_CONFIG], + [MapChartWidget, MAP_CHART_WIDGET_CONFIG], +]; + export const registerWidgets = () => { const start = performance.now(); - registerWidget(CanvasWidget, CANVAS_WIDGET_CONFIG); - registerWidget(SkeletonWidget, SKELETON_WIDGET_CONFIG); - registerWidget(ContainerWidget, CONTAINER_WIDGET_CONFIG); - registerWidget(TextWidget, TEXT_WIDGET_CONFIG); - registerWidget(TableWidget, TABLE_WIDGET_CONFIG); - registerWidget(CheckboxWidget, CHECKBOX_WIDGET_CONFIG); - registerWidget(RadioGroupWidget, RADIO_GROUP_WIDGET_CONFIG); - registerWidget(ButtonWidget, BUTTON_WIDGET_CONFIG); - registerWidget(DropdownWidget, DROPDOWN_WIDGET_CONFIG); - registerWidget(ImageWidget, IMAGE_WIDGET_CONFIG); - registerWidget(VideoWidget, VIDEO_WIDGET_CONFIG); - registerWidget(TabsWidget, TABS_WIDGET_CONFIG); - registerWidget(InputWidget, INPUT_WIDGET_CONFIG); - registerWidget(ModalWidget, MODAL_WIDGET_CONFIG); - registerWidget(ChartWidget, CHART_WIDGET_CONFIG); - registerWidget(MapWidget, MAP_WIDGET_CONFIG); - registerWidget(FilePickerWidget, FILEPICKER_WIDGET_CONFIG); - registerWidget(RichTextEditorWidget, RICH_TEXT_EDITOR_WIDGET_CONFIG); - registerWidget(DatePickerWidget, DATE_PICKER_WIDGET_CONFIG); - registerWidget(DatePickerWidget2, DATE_PICKER_WIDGET_2_CONFIG); - registerWidget(SwitchWidget, SWITCH_WIDGET_CONFIG); - registerWidget(FormWidget, FORM_WIDGET_CONFIG); - registerWidget(FormButtonWidget, FORM_BUTTON_WIDGET_CONFIG); - registerWidget(IconWidget, ICON_WIDGET_CONFIG); - registerWidget(ListWidget, LIST_WIDGET_CONFIG); - registerWidget(RateWidget, RATE_WIDGET_CONFIG); - registerWidget(IframeWidget, IFRAME_WIDGET_CONFIG); - registerWidget(TabsMigratorWidget, TABS_MIGRATOR_WIDGET_CONFIG); - registerWidget(DividerWidget, DIVIDER_WIDGET_CONFIG); - registerWidget(MenuButtonWidget, MENU_BUTTON_WIDGET_CONFIG); - registerWidget(MultiSelectWidget, MULTI_SELECT_WIDGET_CONFIG); - registerWidget(IconButtonWidget, ICON_BUTTON_WIDGET_CONFIG); - registerWidget(CheckboxGroupWidget, CHECKBOX_GROUP_WIDGET_CONFIG); - registerWidget(FilePickerWidgetV2, FILEPICKER_WIDGET_V2_CONFIG); - registerWidget(StatboxWidget, STATBOX_WIDGET_CONFIG); - registerWidget(AudioRecorderWidget, AUDIO_RECORDER_WIDGET_CONFIG); - registerWidget(DocumentViewerWidget, DOCUMENT_VIEWER_WIDGET_CONFIG); - registerWidget(ButtonGroupWidget, BUTTON_GROUP_CONFIG); - registerWidget(MultiSelectTreeWidget, MULTI_SELECT_TREE_WIDGET_CONFIG); - registerWidget(SingleSelectTreeWidget, SINGLE_SELECT_TREE_WIDGET_CONFIG); - registerWidget(SwitchGroupWidget, SWITCH_GROUP_WIDGET_CONFIG); - registerWidget(AudioWidget, AUDIO_WIDGET_CONFIG); - registerWidget(ProgressBarWidget, PROGRESSBAR_WIDGET_CONFIG); - registerWidget(CameraWidget, CAMERA_WIDGET_CONFIG); - registerWidget(MapChartWidget, MAP_CHART_WIDGET_CONFIG); + for (const widget of ALL_WDIGETS_AND_CONFIG) { + registerWidget(widget[0], widget[1] as WidgetConfiguration); + } log.debug("Widget registration took: ", performance.now() - start, "ms"); }; diff --git a/app/client/src/utils/testPropertyPaneConfig.test.ts b/app/client/src/utils/testPropertyPaneConfig.test.ts new file mode 100644 index 0000000000..3a6953f79d --- /dev/null +++ b/app/client/src/utils/testPropertyPaneConfig.test.ts @@ -0,0 +1,89 @@ +import { + PropertyPaneConfig, + PropertyPaneControlConfig, + ValidationConfig, +} from "constants/PropertyControlConstants"; +import { ValidationTypes } from "constants/WidgetValidation"; +import { ALL_WDIGETS_AND_CONFIG } from "./WidgetRegistry"; + +function validatePropertyPaneConfig(config: PropertyPaneConfig[]) { + for (const sectionOrControlConfig of config) { + if (sectionOrControlConfig.children) { + for (const propertyControlConfig of sectionOrControlConfig.children) { + const propertyControlValidation = validatePropertyControl( + propertyControlConfig, + ); + if (propertyControlValidation !== true) + return propertyControlValidation; + } + } + } + + return true; +} + +function validatePropertyControl(config: PropertyPaneConfig): boolean | string { + const _config = config as PropertyPaneControlConfig; + const controls = ["INPUT_TEXT"]; + + if ( + (_config.isJSConvertible || controls.includes(_config.controlType)) && + !_config.isTriggerProperty + ) { + if (!_config.isBindProperty) + return `${ + _config.propertyName + }: isBindProperty should be true if isJSConvertible is true or when control type is [${controls.join( + " | ", + )}]`; + if (!_config.validation) + return `${ + _config.propertyName + }: validation should be defined if isJSConvertible is true or when control type is [${controls.join( + " | ", + )}]`; + } + + if (_config.validation !== undefined) { + const res = validateValidationStructure(_config.validation); + if (res !== true) return `${_config.propertyName}: ${res}`; + } + if (_config.children) { + for (const child of _config.children) { + const res = validatePropertyControl(child); + if (res !== true) return `${_config.propertyName}.${res}`; + } + } + if (_config.panelConfig) { + const res = validatePropertyPaneConfig(_config.panelConfig.children); + if (res !== true) return `${_config.propertyName}.${res}`; + } + return true; +} + +function validateValidationStructure( + config: ValidationConfig, +): boolean | string { + if ( + config.type === ValidationTypes.FUNCTION && + config.params && + config.params.fn + ) { + if (!config.params.expected) + return `For a ${ValidationTypes.FUNCTION} type validation, expected type and example are mandatory`; + } + return true; +} + +describe("Tests all widget's propertyPane config", () => { + ALL_WDIGETS_AND_CONFIG.forEach((widgetAndConfig) => { + const widget: any = widgetAndConfig[0]; + it(`Checks ${widget.getWidgetType()}'s propertyPaneConfig`, () => { + const propertyPaneConfig = widget.getPropertyPaneConfig(); + const validatedPropertyPaneConfig = validatePropertyPaneConfig( + propertyPaneConfig, + ); + expect(validatedPropertyPaneConfig).toStrictEqual(true); + }); + }); +}); diff --git a/app/client/src/widgets/ButtonGroupWidget/widget/index.tsx b/app/client/src/widgets/ButtonGroupWidget/widget/index.tsx index a06488c0c9..bfdef23b3d 100644 --- a/app/client/src/widgets/ButtonGroupWidget/widget/index.tsx +++ b/app/client/src/widgets/ButtonGroupWidget/widget/index.tsx @@ -132,9 +132,14 @@ class ButtonGroupWidget extends BaseWidget< }, ], isJSConvertible: true, - isBindProperty: false, + isBindProperty: true, isTriggerProperty: false, - validation: { type: ValidationTypes.TEXT }, + validation: { + type: ValidationTypes.TEXT, + params: { + allowedValues: ["SIMPLE", "MENU"], + }, + }, }, { propertyName: "buttonColor", diff --git a/app/client/src/widgets/DatePickerWidget/widget/index.tsx b/app/client/src/widgets/DatePickerWidget/widget/index.tsx index cecf8e6381..e04c6a50b9 100644 --- a/app/client/src/widgets/DatePickerWidget/widget/index.tsx +++ b/app/client/src/widgets/DatePickerWidget/widget/index.tsx @@ -207,7 +207,7 @@ class DatePickerWidget extends BaseWidget { ], isBindProperty: true, isTriggerProperty: false, - dateFormat: { type: ValidationTypes.TEXT }, + validation: { type: ValidationTypes.TEXT }, }, { propertyName: "isRequired", diff --git a/app/client/src/widgets/DividerWidget/widget/index.tsx b/app/client/src/widgets/DividerWidget/widget/index.tsx index 6c43fdf036..7f69467267 100644 --- a/app/client/src/widgets/DividerWidget/widget/index.tsx +++ b/app/client/src/widgets/DividerWidget/widget/index.tsx @@ -106,9 +106,15 @@ class DividerWidget extends BaseWidget { propertyName: "dividerColor", label: "Divider Color", controlType: "COLOR_PICKER", - isBindProperty: false, + isBindProperty: true, isJSConvertible: true, isTriggerProperty: false, + validation: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, }, { helpText: "Controls the type of divider cap", @@ -136,8 +142,16 @@ class DividerWidget extends BaseWidget { iconSize: "large", }, ], - isBindProperty: false, + isBindProperty: true, isTriggerProperty: false, + validation: { + type: ValidationTypes.TEXT, + params: { + allowedValues: ["nc", "arrow", "dot"], + required: true, + default: "arrow", + }, + }, }, { helpText: diff --git a/app/client/src/widgets/FormButtonWidget/widget/index.tsx b/app/client/src/widgets/FormButtonWidget/widget/index.tsx index e7dccf5cb5..9083c1eede 100644 --- a/app/client/src/widgets/FormButtonWidget/widget/index.tsx +++ b/app/client/src/widgets/FormButtonWidget/widget/index.tsx @@ -55,7 +55,7 @@ class FormButtonWidget extends ButtonWidget { label: "Disabled Invalid Forms", controlType: "SWITCH", isJSConvertible: true, - isBindProperty: false, + isBindProperty: true, isTriggerProperty: false, validation: { type: ValidationTypes.BOOLEAN }, }, diff --git a/app/client/src/widgets/ProgressBarWidget/widget/index.tsx b/app/client/src/widgets/ProgressBarWidget/widget/index.tsx index 92cf878a29..5d3293ef02 100644 --- a/app/client/src/widgets/ProgressBarWidget/widget/index.tsx +++ b/app/client/src/widgets/ProgressBarWidget/widget/index.tsx @@ -104,6 +104,12 @@ class ProgressBarWidget extends BaseWidget< isBindProperty: true, isJSConvertible: true, isTriggerProperty: false, + validation: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, }, ], }, diff --git a/app/client/src/widgets/TableWidget/widget/propertyConfig.ts b/app/client/src/widgets/TableWidget/widget/propertyConfig.ts index 8dd4b7e107..2ae96a6909 100644 --- a/app/client/src/widgets/TableWidget/widget/propertyConfig.ts +++ b/app/client/src/widgets/TableWidget/widget/propertyConfig.ts @@ -197,6 +197,12 @@ export default [ isJSConvertible: true, isBindProperty: true, isTriggerProperty: false, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.BOOLEAN, + }, + }, }, { propertyName: "isDisabled", @@ -208,6 +214,12 @@ export default [ isJSConvertible: true, isBindProperty: true, isTriggerProperty: false, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.BOOLEAN, + }, + }, dependencies: [ "primaryColumns", "derivedColumns", @@ -230,6 +242,12 @@ export default [ customJSControl: "COMPUTE_VALUE", isJSConvertible: true, isBindProperty: true, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.BOOLEAN, + }, + }, isTriggerProperty: false, dependencies: [ "primaryColumns", @@ -347,6 +365,36 @@ export default [ "columnOrder", ], isBindProperty: true, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: [ + "Epoch", + "Milliseconds", + "YYYY-MM-DD", + "YYYY-MM-DD HH:mm", + "YYYY-MM-DDTHH:mm:ss.sssZ", + "YYYY-MM-DDTHH:mm:ss", + "YYYY-MM-DD hh:mm:ss", + "Do MMM YYYY", + "DD/MM/YYYY", + "DD/MM/YYYY HH:mm", + "LLL", + "LL", + "D MMMM, YYYY", + "H:mm A D MMMM, YYYY", + "MM-DD-YYYY", + "DD-MM-YYYY", + "MM/DD/YYYY", + "DD/MM/YYYY", + "DD/MM/YY", + "MM/DD/YY", + ], + }, + }, + }, isTriggerProperty: false, }, { @@ -454,6 +502,36 @@ export default [ "columnType", ], isBindProperty: true, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: [ + "Epoch", + "Milliseconds", + "YYYY-MM-DD", + "YYYY-MM-DD HH:mm", + "YYYY-MM-DDTHH:mm:ss.sssZ", + "YYYY-MM-DDTHH:mm:ss", + "YYYY-MM-DD hh:mm:ss", + "Do MMM YYYY", + "DD/MM/YYYY", + "DD/MM/YYYY HH:mm", + "LLL", + "LL", + "D MMMM, YYYY", + "H:mm A D MMMM, YYYY", + "MM-DD-YYYY", + "DD-MM-YYYY", + "MM/DD/YYYY", + "DD/MM/YYYY", + "DD/MM/YY", + "MM/DD/YY", + ], + }, + }, + }, isTriggerProperty: false, }, { @@ -526,6 +604,15 @@ export default [ "columnOrder", ], isBindProperty: true, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: ["LEFT", "CENTER", "RIGHT"], + }, + }, + }, isTriggerProperty: false, }, { @@ -574,6 +661,21 @@ export default [ ], isBindProperty: true, isTriggerProperty: false, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: [ + "HEADING1", + "HEADING2", + "HEADING3", + "PARAGRAPH", + "PARAGRAPH2", + ], + }, + }, + }, }, { propertyName: "fontStyle", @@ -603,6 +705,12 @@ export default [ ], isBindProperty: true, isTriggerProperty: false, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + }, + }, }, { propertyName: "verticalAlignment", @@ -632,6 +740,15 @@ export default [ "columnOrder", ], isBindProperty: true, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + allowedValues: ["TOP", "CENTER", "BOTTOM"], + }, + }, + }, isTriggerProperty: false, }, { @@ -647,6 +764,15 @@ export default [ "columnOrder", ], isBindProperty: true, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, isTriggerProperty: false, }, { @@ -662,6 +788,15 @@ export default [ "columnOrder", ], isBindProperty: true, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, isTriggerProperty: false, }, ], @@ -797,6 +932,15 @@ export default [ "columnOrder", ], isBindProperty: true, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, isTriggerProperty: false, }, { @@ -872,12 +1016,15 @@ export default [ "derivedColumns", "columnOrder", ], - isBindProperty: false, + isBindProperty: true, isTriggerProperty: false, validation: { - type: ValidationTypes.TEXT, + type: ValidationTypes.TABLE_PROPERTY, params: { - allowedValues: ["CIRCLE", "SHARP", "ROUNDED"], + type: ValidationTypes.TEXT, + params: { + allowedValues: ["CIRCLE", "SHARP", "ROUNDED"], + }, }, }, }, @@ -899,19 +1046,22 @@ export default [ "derivedColumns", "columnOrder", ], - isBindProperty: false, + isBindProperty: true, isTriggerProperty: false, validation: { - type: ValidationTypes.TEXT, + type: ValidationTypes.TABLE_PROPERTY, params: { - allowedValues: [ - "NONE", - "VARIANT1", - "VARIANT2", - "VARIANT3", - "VARIANT4", - "VARIANT5", - ], + type: ValidationTypes.TEXT, + params: { + allowedValues: [ + "NONE", + "VARIANT1", + "VARIANT2", + "VARIANT3", + "VARIANT4", + "VARIANT5", + ], + }, }, }, }, @@ -932,7 +1082,16 @@ export default [ "derivedColumns", "columnOrder", ], - isBindProperty: false, + isBindProperty: true, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, isTriggerProperty: false, }, { @@ -954,6 +1113,15 @@ export default [ updateHook: updateDerivedColumnsHook, isBindProperty: true, isTriggerProperty: false, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, }, { @@ -962,11 +1130,19 @@ export default [ "Sets the custom color preset based on the menu button variant", label: "Menu Color", controlType: "COLOR_PICKER", - isBindProperty: false, + isBindProperty: true, isTriggerProperty: false, isJSConvertible: true, placeholderText: "#FFFFFF / Gray / rgb(255, 99, 71)", - validation: { type: ValidationTypes.TEXT }, + validation: { + type: ValidationTypes.TABLE_PROPERTY, + params: { + type: ValidationTypes.TEXT, + params: { + regex: /^(?![<|{{]).+/, + }, + }, + }, hidden: (props: TableWidgetProps, propertyPath: string) => { return hideByColumnType(props, propertyPath, [ ColumnTypes.MENU_BUTTON,