2021-07-26 05:50:46 +00:00
|
|
|
import {
|
|
|
|
|
PropertyPaneConfig,
|
|
|
|
|
ValidationConfig,
|
|
|
|
|
} from "constants/PropertyControlConstants";
|
2022-05-18 05:21:53 +00:00
|
|
|
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
|
2021-08-25 05:00:31 +00:00
|
|
|
import { get, isObject, isUndefined, omitBy } from "lodash";
|
2022-05-18 05:21:53 +00:00
|
|
|
import memoize from "micro-memoize";
|
2021-03-16 05:01:37 +00:00
|
|
|
import { FlattenedWidgetProps } from "reducers/entityReducers/canvasWidgetsReducer";
|
2022-05-18 05:21:53 +00:00
|
|
|
import { WidgetProps } from "widgets/BaseWidget";
|
2021-02-16 10:29:08 +00:00
|
|
|
|
2021-10-06 12:57:05 +00:00
|
|
|
/**
|
|
|
|
|
* @typedef {Object} Paths
|
|
|
|
|
* @property {Object} configBindingPaths - The Binding Path
|
2022-04-12 13:09:26 +00:00
|
|
|
* @property {Object} configReactivePaths - The Dynamic Property Path
|
2021-10-06 12:57:05 +00:00
|
|
|
* @property {Object} configTriggerPaths - The Trigger Path
|
|
|
|
|
* @property {Object} configValidationPaths - The Validation Path
|
|
|
|
|
*/
|
|
|
|
|
|
2022-04-12 13:09:26 +00:00
|
|
|
/**
|
|
|
|
|
* All widget's property or paths where user can write javaScript bindings using mustache syntax are called bindingPaths.
|
|
|
|
|
* Widget's meta and derived paths aren't binding paths as user can't add or remove binding for those value.
|
|
|
|
|
*/
|
|
|
|
|
type BindingPaths = Record<string, EvaluationSubstitutionType>;
|
|
|
|
|
/**
|
|
|
|
|
* Binding paths and non-binding paths of widget/action together form reactivePaths.
|
|
|
|
|
*/
|
|
|
|
|
type ReactivePaths = Record<string, EvaluationSubstitutionType>;
|
|
|
|
|
|
2021-10-06 12:57:05 +00:00
|
|
|
/**
|
|
|
|
|
* This function gets the binding validation and trigger paths from a config
|
|
|
|
|
* @param config
|
|
|
|
|
* @param path
|
|
|
|
|
* @returns {Paths} Paths
|
|
|
|
|
*/
|
|
|
|
|
const checkPathsInConfig = (
|
|
|
|
|
config: any,
|
|
|
|
|
path: string,
|
|
|
|
|
): {
|
2022-04-12 13:09:26 +00:00
|
|
|
configBindingPaths: BindingPaths;
|
|
|
|
|
configReactivePaths: ReactivePaths;
|
2021-10-06 12:57:05 +00:00
|
|
|
configTriggerPaths: Record<string, true>;
|
|
|
|
|
configValidationPaths: Record<string, ValidationConfig>;
|
|
|
|
|
} => {
|
2022-04-12 13:09:26 +00:00
|
|
|
const configBindingPaths: BindingPaths = {};
|
2021-10-06 12:57:05 +00:00
|
|
|
const configTriggerPaths: Record<string, true> = {};
|
|
|
|
|
const configValidationPaths: Record<any, ValidationConfig> = {};
|
|
|
|
|
// Purely a Binding Path
|
|
|
|
|
if (config.isBindProperty && !config.isTriggerProperty) {
|
|
|
|
|
configBindingPaths[path] =
|
|
|
|
|
config.evaluationSubstitutionType || EvaluationSubstitutionType.TEMPLATE;
|
|
|
|
|
if (config.validation) {
|
|
|
|
|
configValidationPaths[path] = config.validation;
|
|
|
|
|
}
|
|
|
|
|
} else if (config.isBindProperty && config.isTriggerProperty) {
|
|
|
|
|
configTriggerPaths[path] = true;
|
|
|
|
|
}
|
2022-04-12 13:09:26 +00:00
|
|
|
return {
|
|
|
|
|
configBindingPaths,
|
|
|
|
|
configReactivePaths: configBindingPaths, // All bindingPaths are reactivePaths.
|
|
|
|
|
configTriggerPaths,
|
|
|
|
|
configValidationPaths,
|
|
|
|
|
};
|
2021-10-06 12:57:05 +00:00
|
|
|
};
|
|
|
|
|
|
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
|
|
|
// "originalWidget" param here always contains the complete widget props
|
|
|
|
|
// as this function's widget parameter tends to change in each iteration
|
2021-10-06 12:57:05 +00:00
|
|
|
const childHasPanelConfig = (
|
|
|
|
|
config: any,
|
|
|
|
|
widget: WidgetProps,
|
|
|
|
|
basePath: string,
|
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
|
|
|
originalWidget: WidgetProps,
|
2021-10-06 12:57:05 +00:00
|
|
|
) => {
|
|
|
|
|
const panelPropertyPath = config.propertyName;
|
|
|
|
|
const widgetPanelPropertyValues = get(widget, panelPropertyPath);
|
2022-04-12 13:09:26 +00:00
|
|
|
|
|
|
|
|
let bindingPaths: BindingPaths = {};
|
|
|
|
|
let reactivePaths: ReactivePaths = {};
|
2021-10-06 12:57:05 +00:00
|
|
|
let triggerPaths: Record<string, true> = {};
|
|
|
|
|
let validationPaths: Record<any, ValidationConfig> = {};
|
|
|
|
|
if (widgetPanelPropertyValues) {
|
|
|
|
|
Object.values(widgetPanelPropertyValues).forEach(
|
|
|
|
|
(widgetPanelPropertyValue: any) => {
|
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
|
|
|
const { panelIdPropertyName } = config.panelConfig;
|
|
|
|
|
const propertyPath = `${basePath}.${widgetPanelPropertyValue[panelIdPropertyName]}`;
|
|
|
|
|
|
2021-10-06 12:57:05 +00:00
|
|
|
config.panelConfig.children.forEach((panelColumnConfig: any) => {
|
|
|
|
|
let isSectionHidden = false;
|
|
|
|
|
if ("hidden" in panelColumnConfig) {
|
|
|
|
|
isSectionHidden = panelColumnConfig.hidden(
|
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
|
|
|
originalWidget,
|
|
|
|
|
propertyPath,
|
2021-10-06 12:57:05 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (!isSectionHidden) {
|
|
|
|
|
panelColumnConfig.children.forEach(
|
|
|
|
|
(panelColumnControlConfig: any) => {
|
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
|
|
|
const panelPropertyConfigPath = `${propertyPath}.${panelColumnControlConfig.propertyName}`;
|
2021-10-06 12:57:05 +00:00
|
|
|
let isControlHidden = false;
|
|
|
|
|
if ("hidden" in panelColumnControlConfig) {
|
|
|
|
|
isControlHidden = panelColumnControlConfig.hidden(
|
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
|
|
|
originalWidget,
|
2021-10-06 12:57:05 +00:00
|
|
|
panelPropertyConfigPath,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (!isControlHidden) {
|
|
|
|
|
const {
|
|
|
|
|
configBindingPaths,
|
2022-04-12 13:09:26 +00:00
|
|
|
configReactivePaths,
|
2021-10-06 12:57:05 +00:00
|
|
|
configTriggerPaths,
|
|
|
|
|
configValidationPaths,
|
|
|
|
|
} = checkPathsInConfig(
|
|
|
|
|
panelColumnControlConfig,
|
|
|
|
|
panelPropertyConfigPath,
|
|
|
|
|
);
|
2022-04-12 13:09:26 +00:00
|
|
|
bindingPaths = {
|
|
|
|
|
...configBindingPaths,
|
|
|
|
|
...bindingPaths,
|
|
|
|
|
};
|
|
|
|
|
reactivePaths = {
|
|
|
|
|
...configReactivePaths,
|
|
|
|
|
...reactivePaths,
|
|
|
|
|
};
|
2021-10-06 12:57:05 +00:00
|
|
|
triggerPaths = { ...configTriggerPaths, ...triggerPaths };
|
|
|
|
|
validationPaths = {
|
|
|
|
|
...configValidationPaths,
|
|
|
|
|
...validationPaths,
|
|
|
|
|
};
|
|
|
|
|
// Has child Panel Config
|
|
|
|
|
if (panelColumnControlConfig.panelConfig) {
|
|
|
|
|
const {
|
|
|
|
|
bindingPaths: panelBindingPaths,
|
2022-04-12 13:09:26 +00:00
|
|
|
reactivePaths: panelReactivePaths,
|
2021-10-06 12:57:05 +00:00
|
|
|
triggerPaths: panelTriggerPaths,
|
|
|
|
|
validationPaths: panelValidationPaths,
|
|
|
|
|
} = childHasPanelConfig(
|
|
|
|
|
panelColumnControlConfig,
|
|
|
|
|
widgetPanelPropertyValue,
|
|
|
|
|
panelPropertyConfigPath,
|
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
|
|
|
originalWidget,
|
2021-10-06 12:57:05 +00:00
|
|
|
);
|
2022-04-12 13:09:26 +00:00
|
|
|
bindingPaths = {
|
|
|
|
|
...panelBindingPaths,
|
|
|
|
|
...bindingPaths,
|
|
|
|
|
};
|
|
|
|
|
reactivePaths = {
|
|
|
|
|
...panelReactivePaths,
|
|
|
|
|
...reactivePaths,
|
|
|
|
|
};
|
2021-10-06 12:57:05 +00:00
|
|
|
triggerPaths = { ...panelTriggerPaths, ...triggerPaths };
|
|
|
|
|
validationPaths = {
|
|
|
|
|
...panelValidationPaths,
|
|
|
|
|
...validationPaths,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-12 13:09:26 +00:00
|
|
|
return { reactivePaths, triggerPaths, validationPaths, bindingPaths };
|
2021-10-06 12:57:05 +00:00
|
|
|
};
|
|
|
|
|
|
2022-05-18 05:21:53 +00:00
|
|
|
const getAllPathsFromPropertyConfigWithoutMemo = (
|
2021-02-16 10:29:08 +00:00
|
|
|
widget: WidgetProps,
|
|
|
|
|
widgetConfig: readonly PropertyPaneConfig[],
|
2021-04-26 05:41:32 +00:00
|
|
|
defaultProperties: Record<string, any>,
|
2021-02-16 10:29:08 +00:00
|
|
|
): {
|
2022-04-12 13:09:26 +00:00
|
|
|
bindingPaths: BindingPaths;
|
|
|
|
|
reactivePaths: ReactivePaths;
|
2021-02-16 10:29:08 +00:00
|
|
|
triggerPaths: Record<string, true>;
|
2021-07-26 05:50:46 +00:00
|
|
|
validationPaths: Record<string, ValidationConfig>;
|
2021-02-16 10:29:08 +00:00
|
|
|
} => {
|
2022-04-12 13:09:26 +00:00
|
|
|
let bindingPaths: BindingPaths = {};
|
|
|
|
|
let reactivePaths: ReactivePaths = {};
|
|
|
|
|
Object.keys(defaultProperties).forEach((property) => {
|
|
|
|
|
reactivePaths[property] = EvaluationSubstitutionType.TEMPLATE;
|
|
|
|
|
});
|
2021-10-06 12:57:05 +00:00
|
|
|
let triggerPaths: Record<string, true> = {};
|
|
|
|
|
let validationPaths: Record<any, ValidationConfig> = {};
|
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
|
|
|
|
2021-02-16 10:29:08 +00:00
|
|
|
widgetConfig.forEach((config) => {
|
|
|
|
|
if (config.children) {
|
|
|
|
|
config.children.forEach((controlConfig: any) => {
|
|
|
|
|
const basePath = controlConfig.propertyName;
|
|
|
|
|
let isHidden = false;
|
|
|
|
|
if ("hidden" in controlConfig) {
|
|
|
|
|
isHidden = controlConfig.hidden(widget, basePath);
|
|
|
|
|
}
|
|
|
|
|
if (!isHidden) {
|
2021-10-06 12:57:05 +00:00
|
|
|
const path = controlConfig.propertyName;
|
|
|
|
|
const {
|
|
|
|
|
configBindingPaths,
|
2022-04-12 13:09:26 +00:00
|
|
|
configReactivePaths,
|
2021-10-06 12:57:05 +00:00
|
|
|
configTriggerPaths,
|
|
|
|
|
configValidationPaths,
|
|
|
|
|
} = checkPathsInConfig(controlConfig, path);
|
2022-04-12 13:09:26 +00:00
|
|
|
bindingPaths = {
|
|
|
|
|
...bindingPaths,
|
|
|
|
|
...configBindingPaths,
|
|
|
|
|
};
|
2021-11-17 13:57:58 +00:00
|
|
|
// Update default path configs with the ones in the property config
|
2022-04-12 13:09:26 +00:00
|
|
|
reactivePaths = {
|
|
|
|
|
...reactivePaths,
|
|
|
|
|
...configReactivePaths,
|
|
|
|
|
};
|
2021-11-17 13:57:58 +00:00
|
|
|
triggerPaths = { ...triggerPaths, ...configTriggerPaths };
|
|
|
|
|
validationPaths = { ...validationPaths, ...configValidationPaths };
|
2021-02-16 10:29:08 +00:00
|
|
|
}
|
2021-10-06 12:57:05 +00:00
|
|
|
// Has child Panel Config
|
2021-02-16 10:29:08 +00:00
|
|
|
if (controlConfig.panelConfig) {
|
2021-10-06 12:57:05 +00:00
|
|
|
const resultingPaths = childHasPanelConfig(
|
|
|
|
|
controlConfig,
|
|
|
|
|
widget,
|
|
|
|
|
basePath,
|
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
|
|
|
widget,
|
2021-10-06 12:57:05 +00:00
|
|
|
);
|
2022-04-12 13:09:26 +00:00
|
|
|
bindingPaths = {
|
|
|
|
|
...bindingPaths,
|
|
|
|
|
...resultingPaths.bindingPaths,
|
|
|
|
|
};
|
|
|
|
|
reactivePaths = {
|
|
|
|
|
...reactivePaths,
|
|
|
|
|
...resultingPaths.reactivePaths,
|
|
|
|
|
};
|
2021-11-17 13:57:58 +00:00
|
|
|
triggerPaths = { ...triggerPaths, ...resultingPaths.triggerPaths };
|
2021-10-06 12:57:05 +00:00
|
|
|
validationPaths = {
|
|
|
|
|
...validationPaths,
|
2021-11-17 13:57:58 +00:00
|
|
|
...resultingPaths.validationPaths,
|
2021-10-06 12:57:05 +00:00
|
|
|
};
|
2021-02-16 10:29:08 +00:00
|
|
|
}
|
2021-03-04 05:24:47 +00:00
|
|
|
if (controlConfig.children) {
|
|
|
|
|
const basePropertyPath = controlConfig.propertyName;
|
2021-03-09 14:35:42 +00:00
|
|
|
const widgetPropertyValue = get(widget, basePropertyPath, []);
|
2021-04-26 10:35:59 +00:00
|
|
|
// Property in object structure
|
|
|
|
|
if (
|
|
|
|
|
!isUndefined(widgetPropertyValue) &&
|
|
|
|
|
isObject(widgetPropertyValue)
|
|
|
|
|
) {
|
2021-10-06 12:57:05 +00:00
|
|
|
Object.keys(widgetPropertyValue).forEach((key: string) => {
|
2021-04-26 10:35:59 +00:00
|
|
|
const objectIndexPropertyPath = `${basePropertyPath}.${key}`;
|
|
|
|
|
controlConfig.children.forEach((childPropertyConfig: any) => {
|
|
|
|
|
const childArrayPropertyPath = `${objectIndexPropertyPath}.${childPropertyConfig.propertyName}`;
|
2021-10-06 12:57:05 +00:00
|
|
|
const {
|
|
|
|
|
configBindingPaths,
|
2022-04-12 13:09:26 +00:00
|
|
|
configReactivePaths,
|
2021-10-06 12:57:05 +00:00
|
|
|
configTriggerPaths,
|
|
|
|
|
configValidationPaths,
|
|
|
|
|
} = checkPathsInConfig(
|
|
|
|
|
childPropertyConfig,
|
|
|
|
|
childArrayPropertyPath,
|
|
|
|
|
);
|
2022-04-12 13:09:26 +00:00
|
|
|
bindingPaths = {
|
|
|
|
|
...bindingPaths,
|
|
|
|
|
...configBindingPaths,
|
|
|
|
|
};
|
|
|
|
|
reactivePaths = {
|
|
|
|
|
...reactivePaths,
|
|
|
|
|
...configReactivePaths,
|
|
|
|
|
};
|
2021-11-17 13:57:58 +00:00
|
|
|
triggerPaths = { ...triggerPaths, ...configTriggerPaths };
|
2021-10-06 12:57:05 +00:00
|
|
|
validationPaths = {
|
|
|
|
|
...validationPaths,
|
2021-11-17 13:57:58 +00:00
|
|
|
...configValidationPaths,
|
2021-10-06 12:57:05 +00:00
|
|
|
};
|
2021-04-26 10:35:59 +00:00
|
|
|
});
|
|
|
|
|
});
|
2021-03-09 14:35:42 +00:00
|
|
|
}
|
2021-03-04 05:24:47 +00:00
|
|
|
}
|
2021-02-16 10:29:08 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2022-04-12 13:09:26 +00:00
|
|
|
return { reactivePaths, triggerPaths, validationPaths, bindingPaths };
|
2021-02-16 10:29:08 +00:00
|
|
|
};
|
2021-03-16 05:01:37 +00:00
|
|
|
|
2022-05-18 05:21:53 +00:00
|
|
|
export const getAllPathsFromPropertyConfig = memoize(
|
|
|
|
|
getAllPathsFromPropertyConfigWithoutMemo,
|
|
|
|
|
{ maxSize: 1000 },
|
|
|
|
|
);
|
|
|
|
|
|
2021-08-25 05:00:31 +00:00
|
|
|
/**
|
|
|
|
|
* this function gets the next available row for pasting widgets
|
|
|
|
|
* NOTE: this function excludes modal widget when calculating next available row
|
|
|
|
|
*
|
|
|
|
|
* @param parentContainerId
|
|
|
|
|
* @param canvasWidgets
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
2021-03-16 05:01:37 +00:00
|
|
|
export const nextAvailableRowInContainer = (
|
2021-04-26 05:41:32 +00:00
|
|
|
parentContainerId: string,
|
2021-03-16 05:01:37 +00:00
|
|
|
canvasWidgets: { [widgetId: string]: FlattenedWidgetProps },
|
|
|
|
|
) => {
|
2021-08-25 05:00:31 +00:00
|
|
|
const filteredCanvasWidgets = omitBy(canvasWidgets, (widget) => {
|
2021-09-09 15:10:22 +00:00
|
|
|
return widget.type === "MODAL_WIDGET";
|
2021-08-25 05:00:31 +00:00
|
|
|
});
|
|
|
|
|
|
2021-03-16 05:01:37 +00:00
|
|
|
return (
|
2021-08-25 05:00:31 +00:00
|
|
|
Object.values(filteredCanvasWidgets).reduce(
|
2021-03-16 05:01:37 +00:00
|
|
|
(prev: number, next: any) =>
|
2021-04-26 05:41:32 +00:00
|
|
|
next?.parentId === parentContainerId && next.bottomRow > prev
|
2021-03-16 05:01:37 +00:00
|
|
|
? next.bottomRow
|
|
|
|
|
: prev,
|
|
|
|
|
0,
|
|
|
|
|
) + 1
|
|
|
|
|
);
|
|
|
|
|
};
|