@evoke-platform/ui-components 1.0.0-dev.226 → 1.0.0-dev.227

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/dist/published/components/core/Accordion/Accordion.js +1 -1
  2. package/dist/published/components/core/Accordion/AccordionActions/AccordionActions.js +1 -1
  3. package/dist/published/components/core/Accordion/AccordionDetails/AccordionDetails.js +1 -1
  4. package/dist/published/components/core/Accordion/AccordionSummary/AccordionSummary.js +1 -1
  5. package/dist/published/components/core/Alert/Alert.js +8 -9
  6. package/dist/published/components/core/AlertTitle/AlertTitle.js +1 -1
  7. package/dist/published/components/core/AppBar/AppBar.js +1 -1
  8. package/dist/published/components/core/Autocomplete/Autocomplete.js +33 -15
  9. package/dist/published/components/core/Autocomplete/Autocomplete.test.js +1 -1
  10. package/dist/published/components/core/Avatar/Avatar.js +7 -4
  11. package/dist/published/components/core/Backdrop/Backdrop.js +1 -1
  12. package/dist/published/components/core/Badge/Badge.js +1 -1
  13. package/dist/published/components/core/Breadcrumbs/Breadcrumbs.js +1 -1
  14. package/dist/published/components/core/Button/Button.js +1 -1
  15. package/dist/published/components/core/ButtonGroup/ButtonGroup.js +1 -1
  16. package/dist/published/components/core/Card/Card.js +1 -1
  17. package/dist/published/components/core/Checkbox/Checkbox.js +1 -1
  18. package/dist/published/components/core/Chip/Chip.js +1 -1
  19. package/dist/published/components/core/CircularProgress/CircularProgress.js +1 -1
  20. package/dist/published/components/core/Collapse/Collapse.js +1 -1
  21. package/dist/published/components/core/DatePicker/DatePicker.js +4 -16
  22. package/dist/published/components/core/DateTimePicker/DateTimePicker.js +3 -15
  23. package/dist/published/components/core/Dialog/Dialog.js +1 -1
  24. package/dist/published/components/core/Dialog/DialogActions/DialogActions.js +2 -13
  25. package/dist/published/components/core/Dialog/DialogContent/DialogContent.js +1 -1
  26. package/dist/published/components/core/Dialog/DialogContentText/DialogContentText.js +1 -1
  27. package/dist/published/components/core/Dialog/DialogTitle/DialogTitle.js +1 -1
  28. package/dist/published/components/core/Divider/Divider.js +1 -1
  29. package/dist/published/components/core/Drawer/Drawer.js +1 -1
  30. package/dist/published/components/core/FieldError/FieldError.js +1 -2
  31. package/dist/published/components/core/FormElements/FormControl/FormControl.js +1 -1
  32. package/dist/published/components/core/FormElements/FormControlLabel/FormControlLabel.js +1 -1
  33. package/dist/published/components/core/FormElements/FormGroup/FormGroup.js +1 -1
  34. package/dist/published/components/core/FormElements/FormHelperText/FormHelperText.js +1 -1
  35. package/dist/published/components/core/FormElements/FormLabel/FormLabel.js +1 -1
  36. package/dist/published/components/core/IconButton/IconButton.js +1 -1
  37. package/dist/published/components/core/LinearProgress/LinearProgress.js +1 -1
  38. package/dist/published/components/core/Link/Link.js +1 -1
  39. package/dist/published/components/core/List/List.js +1 -1
  40. package/dist/published/components/core/List/ListItem.js +1 -1
  41. package/dist/published/components/core/List/ListItemText/ListItemText.js +1 -1
  42. package/dist/published/components/core/LoadingButton/LoadingButton.js +1 -1
  43. package/dist/published/components/core/LocalizationProvider/LocalizationProvider.js +3 -14
  44. package/dist/published/components/core/Menu/Menu.js +1 -1
  45. package/dist/published/components/core/Menu/MenuItem/MenuItem.js +1 -1
  46. package/dist/published/components/core/Paper/Paper.js +1 -1
  47. package/dist/published/components/core/Popover/Popover.js +1 -1
  48. package/dist/published/components/core/Popper/Popper.js +1 -1
  49. package/dist/published/components/core/RadioGroup/Radio.js +1 -1
  50. package/dist/published/components/core/RadioGroup/RadioGroup.js +1 -1
  51. package/dist/published/components/core/Select/Select.js +11 -4
  52. package/dist/published/components/core/Skeleton/Skeleton.js +1 -1
  53. package/dist/published/components/core/Snackbar/Snackbar.js +2 -2
  54. package/dist/published/components/core/StaticDatePicker/StaticDatePicker.js +3 -15
  55. package/dist/published/components/core/Stepper/Step/Step.js +1 -1
  56. package/dist/published/components/core/Stepper/StepButton/StepButton.js +1 -1
  57. package/dist/published/components/core/Stepper/StepConnector/StepConnector.js +1 -1
  58. package/dist/published/components/core/Stepper/StepContent/StepContent.js +1 -1
  59. package/dist/published/components/core/Stepper/StepIcon/StepIcon.js +1 -1
  60. package/dist/published/components/core/Stepper/StepLabel/StepLabel.js +1 -1
  61. package/dist/published/components/core/Stepper/Stepper.js +1 -1
  62. package/dist/published/components/core/Switch/Switch.js +1 -1
  63. package/dist/published/components/core/Table/Table.js +1 -1
  64. package/dist/published/components/core/Tabs/Tab/Tab.js +1 -1
  65. package/dist/published/components/core/Tabs/Tabs.js +1 -1
  66. package/dist/published/components/core/TextField/TextField.js +12 -6
  67. package/dist/published/components/core/ToggleButton/ToggleButton.js +1 -1
  68. package/dist/published/components/core/ToggleButtonGroup/ToggleButtonGroup.js +1 -1
  69. package/dist/published/components/core/Tooltip/Tooltip.js +15 -2
  70. package/dist/published/components/core/Typography/index.js +1 -1
  71. package/dist/published/components/custom/BuilderGrid/BuilderGrid.js +33 -29
  72. package/dist/published/components/custom/BuilderGrid/BuilderGridToolbar.js +1 -2
  73. package/dist/published/components/custom/BuilderGrid/EmptyContent.js +4 -5
  74. package/dist/published/components/custom/BuilderGrid/EmptyContentIllustration.js +6 -1
  75. package/dist/published/components/custom/BuilderGrid/ToolbarActions.js +3 -1
  76. package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.js +46 -27
  77. package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.test.js +12 -21
  78. package/dist/published/components/custom/CriteriaBuilder/ValueEditor.js +27 -34
  79. package/dist/published/components/custom/DataGrid/DataGrid.js +38 -33
  80. package/dist/published/components/custom/DataGrid/DateTimeCustomOperator.js +3 -5
  81. package/dist/published/components/custom/DataGrid/Toolbar.js +3 -4
  82. package/dist/published/components/custom/ErrorComponent/ErrorComponent.js +11 -1
  83. package/dist/published/components/custom/Form/Common/Form.js +106 -80
  84. package/dist/published/components/custom/Form/Common/FormComponentWrapper.js +20 -11
  85. package/dist/published/components/custom/Form/FormComponents/ButtonComponent.js +9 -20
  86. package/dist/published/components/custom/Form/FormComponents/DocumentComponent/Document.js +10 -20
  87. package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentComponent.js +24 -28
  88. package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentList.js +49 -64
  89. package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.d.ts +1 -0
  90. package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.js +109 -34
  91. package/dist/published/components/custom/Form/FormComponents/ImageComponent/Image.d.ts +2 -0
  92. package/dist/published/components/custom/Form/FormComponents/ImageComponent/Image.js +13 -25
  93. package/dist/published/components/custom/Form/FormComponents/ImageComponent/ImageComponent.d.ts +3 -1
  94. package/dist/published/components/custom/Form/FormComponents/ImageComponent/ImageComponent.js +30 -9
  95. package/dist/published/components/custom/Form/FormComponents/ObjectComponent/InstanceLookup.js +26 -31
  96. package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectComponent.d.ts +5 -4
  97. package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectComponent.js +70 -22
  98. package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +93 -75
  99. package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.d.ts +2 -2
  100. package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.js +17 -26
  101. package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ActionDialog.js +20 -24
  102. package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableField.js +22 -33
  103. package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableFieldInput.js +12 -9
  104. package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableField.js +61 -60
  105. package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableFieldComponent.js +8 -6
  106. package/dist/published/components/custom/Form/FormComponents/UserComponent/UserComponent.d.ts +3 -1
  107. package/dist/published/components/custom/Form/FormComponents/UserComponent/UserComponent.js +55 -12
  108. package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +32 -30
  109. package/dist/published/components/custom/Form/FormComponents/ViewOnlyComponent.js +12 -9
  110. package/dist/published/components/custom/Form/types.d.ts +5 -5
  111. package/dist/published/components/custom/Form/utils.js +611 -446
  112. package/dist/published/components/custom/FormField/AddressFieldComponent/AddressFieldComponent.test.js +41 -54
  113. package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js +7 -8
  114. package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.js +1 -1
  115. package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.test.js +5 -14
  116. package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.js +2 -2
  117. package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.test.js +12 -21
  118. package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.js +2 -2
  119. package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.test.js +12 -21
  120. package/dist/published/components/custom/FormField/FileUpload/FileUpload.js +10 -11
  121. package/dist/published/components/custom/FormField/FormField.js +10 -10
  122. package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +22 -30
  123. package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.test.js +8 -17
  124. package/dist/published/components/custom/FormField/Select/Select.js +5 -6
  125. package/dist/published/components/custom/FormField/Select/Select.test.js +18 -27
  126. package/dist/published/components/custom/FormField/TimePickerSelect/TimePickerSelect.js +4 -4
  127. package/dist/published/components/custom/HistoryLog/DisplayedProperty.js +12 -13
  128. package/dist/published/components/custom/HistoryLog/HistoryData.js +49 -45
  129. package/dist/published/components/custom/HistoryLog/HistoryLoading.js +5 -5
  130. package/dist/published/components/custom/HistoryLog/index.js +5 -6
  131. package/dist/published/components/custom/Menubar/Menubar.js +2 -2
  132. package/dist/published/components/custom/MultiSelect/MultiSelect.js +38 -50
  133. package/dist/published/components/custom/MultiSelect/SortableItem.js +1 -1
  134. package/dist/published/components/custom/RepeatableField/RepeatableField.js +14 -16
  135. package/dist/published/components/custom/UserAvatar/UserAvatar.js +12 -5
  136. package/dist/published/components/custom/util.js +1 -1
  137. package/dist/published/components/layout/Box/Box.js +1 -1
  138. package/dist/published/components/layout/Container/Container.js +1 -1
  139. package/dist/published/components/layout/Grid/Grid.js +1 -1
  140. package/dist/published/components/layout/Stack/Stack.js +1 -1
  141. package/dist/published/icons/custom/FileWithExtension.js +8 -4
  142. package/dist/published/icons/custom/Inherited.js +8 -6
  143. package/dist/published/icons/custom/Overrides.js +9 -7
  144. package/dist/published/icons/custom/TrashCan.js +10 -8
  145. package/dist/published/icons/custom/UploadCloud.js +9 -7
  146. package/dist/published/stories/Accordion.stories.js +2 -2
  147. package/dist/published/stories/Alert.stories.js +1 -1
  148. package/dist/published/stories/AlertTitle.stories.js +1 -1
  149. package/dist/published/stories/Autocomplete.stories.js +2 -2
  150. package/dist/published/stories/Avatar.stories.js +1 -1
  151. package/dist/published/stories/Backdrop.stories.js +1 -1
  152. package/dist/published/stories/Badge.stories.js +1 -1
  153. package/dist/published/stories/Box.stories.js +2 -2
  154. package/dist/published/stories/Breadcrumbs.stories.js +1 -1
  155. package/dist/published/stories/Button.stories.js +1 -1
  156. package/dist/published/stories/ButtonGroup.stories.js +1 -1
  157. package/dist/published/stories/Card.stories.js +1 -1
  158. package/dist/published/stories/Checkbox.stories.js +1 -1
  159. package/dist/published/stories/Chip.stories.js +1 -1
  160. package/dist/published/stories/CircularProgress.stories.js +1 -1
  161. package/dist/published/stories/Collapse.stories.js +1 -1
  162. package/dist/published/stories/Container.stories.js +1 -1
  163. package/dist/published/stories/CriteriaBuilder.stories.js +7 -3
  164. package/dist/published/stories/DataGrid.stories.js +3 -3
  165. package/dist/published/stories/DatePicker.stories.js +3 -14
  166. package/dist/published/stories/Dialog.stories.js +1 -1
  167. package/dist/published/stories/Divider.stories.js +1 -1
  168. package/dist/published/stories/Drawer.stories.js +2 -2
  169. package/dist/published/stories/FormControl.stories.js +1 -1
  170. package/dist/published/stories/FormControlLabel.stories.js +1 -1
  171. package/dist/published/stories/FormField.stories.js +3 -12
  172. package/dist/published/stories/FormGroup.stories.js +1 -1
  173. package/dist/published/stories/FormHelperText.stories.js +1 -1
  174. package/dist/published/stories/FormLabel.stories.js +1 -1
  175. package/dist/published/stories/Grid.stories.js +1 -1
  176. package/dist/published/stories/HistoryLog.stories.js +1 -1
  177. package/dist/published/stories/IconButton.stories.js +4 -4
  178. package/dist/published/stories/LinearProgress.stories.js +1 -1
  179. package/dist/published/stories/Link.stories.js +1 -1
  180. package/dist/published/stories/List.stories.js +2 -2
  181. package/dist/published/stories/Menu.stories.js +2 -2
  182. package/dist/published/stories/MenuBar.stories.js +1 -1
  183. package/dist/published/stories/MultiSelect.stories.js +3 -3
  184. package/dist/published/stories/Palette.stories.js +11 -11
  185. package/dist/published/stories/Paper.stories.js +1 -1
  186. package/dist/published/stories/RadioGroup.stories.js +1 -1
  187. package/dist/published/stories/RepeatableField.stories.js +6 -7
  188. package/dist/published/stories/RichTextViewer.stories.js +1 -1
  189. package/dist/published/stories/Skeleton.stories.js +1 -1
  190. package/dist/published/stories/Snackbar.stories.js +1 -1
  191. package/dist/published/stories/Stack.stories.js +1 -1
  192. package/dist/published/stories/StaticDatePicker.stories.js +3 -14
  193. package/dist/published/stories/Stepper.stories.js +3 -3
  194. package/dist/published/stories/Switch.stories.js +1 -1
  195. package/dist/published/stories/Table.stories.js +2 -2
  196. package/dist/published/stories/Tabs.stories.js +6 -17
  197. package/dist/published/stories/TextField.stories.js +1 -1
  198. package/dist/published/stories/TimePicker.stories.js +3 -14
  199. package/dist/published/stories/TimePickerSelect.stories.js +3 -14
  200. package/dist/published/stories/ToggleButton.stories.js +4 -4
  201. package/dist/published/theme/UIThemeProvider.js +1 -2
  202. package/package.json +1 -1
@@ -27,7 +27,7 @@ const ALL_OPERATORS = [
27
27
  { name: 'notIn', label: 'not in' },
28
28
  ];
29
29
  const CustomRuleGroup = (props) => {
30
- const rg = Object.assign(Object.assign({}, props), useRuleGroup(props));
30
+ const rg = { ...props, ...useRuleGroup(props) };
31
31
  const [addRule, addGroup, cloneGroup, toggleLockGroup, removeGroup] = [
32
32
  rg.addRule,
33
33
  rg.addGroup,
@@ -40,16 +40,24 @@ const CustomRuleGroup = (props) => {
40
40
  event.stopPropagation();
41
41
  f(event, context);
42
42
  });
43
- const subComponentProps = Object.assign(Object.assign({}, rg), { addRule,
43
+ const subComponentProps = {
44
+ ...rg,
45
+ addRule,
44
46
  addGroup,
45
47
  cloneGroup,
46
48
  toggleLockGroup,
47
- removeGroup });
49
+ removeGroup,
50
+ };
48
51
  return (React.createElement("div", { ref: rg.previewRef, className: rg.outerClassName, "data-testid": TestID.ruleGroup, "data-dragmonitorid": rg.dragMonitorId, "data-dropmonitorid": rg.dropMonitorId, "data-rule-group-id": rg.id, "data-level": rg.path.length, "data-path": JSON.stringify(rg.path) },
49
52
  React.createElement("div", { className: rg.classNames.body },
50
- React.createElement(RuleGroupBodyComponents, Object.assign({}, subComponentProps))),
53
+ React.createElement(RuleGroupBodyComponents, { ...subComponentProps })),
51
54
  React.createElement("div", { ref: rg.dropRef, className: rg.classNames.header },
52
- React.createElement(RuleGroupHeaderComponents, Object.assign({}, subComponentProps, { schema: Object.assign(Object.assign({}, subComponentProps.schema), { controls: Object.assign({}, subComponentProps.schema.controls) }) })))));
55
+ React.createElement(RuleGroupHeaderComponents, { ...subComponentProps, schema: {
56
+ ...subComponentProps.schema,
57
+ controls: {
58
+ ...subComponentProps.schema.controls,
59
+ },
60
+ } }))));
53
61
  };
54
62
  const customButton = (props) => {
55
63
  const { title, handleOnClick, label } = props;
@@ -72,7 +80,6 @@ const customButton = (props) => {
72
80
  } }, buttonLabel));
73
81
  };
74
82
  const customSelector = (props) => {
75
- var _a, _b, _c;
76
83
  const { options, value, handleOnChange, title, context, level } = props;
77
84
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
85
  const rule = props.rule;
@@ -92,7 +99,7 @@ const customSelector = (props) => {
92
99
  switch (title) {
93
100
  case 'Operators':
94
101
  width = '20%';
95
- if (((_a = props.fieldData) === null || _a === void 0 ? void 0 : _a.inputType) === 'array') {
102
+ if (props.fieldData?.inputType === 'array') {
96
103
  opts = options
97
104
  .filter((option) => ['null', 'notNull', 'in', 'notIn'].includes(option.name))
98
105
  .map((option) => ({ name: option.name, label: option.label }));
@@ -101,7 +108,7 @@ const customSelector = (props) => {
101
108
  ? ''
102
109
  : options.find((option) => option.name === displayedValue).name;
103
110
  }
104
- else if (((_b = props.fieldData) === null || _b === void 0 ? void 0 : _b.inputType) === 'document') {
111
+ else if (props.fieldData?.inputType === 'document') {
105
112
  opts = options
106
113
  .filter((option) => ['null', 'notNull'].includes(option.name))
107
114
  .map((option) => ({ name: option.name, label: option.label }));
@@ -113,13 +120,13 @@ const customSelector = (props) => {
113
120
  break;
114
121
  case 'Fields':
115
122
  width = '33%';
116
- displayedValue = (_c = options.find((option) => option.name === displayedValue)) === null || _c === void 0 ? void 0 : _c.label;
123
+ displayedValue = options.find((option) => option.name === displayedValue)?.label;
117
124
  if (isFreeSoloEnabled && !displayedValue) {
118
125
  displayedValue = value;
119
126
  }
120
127
  break;
121
128
  }
122
- return (React.createElement(Autocomplete, { options: opts, value: displayedValue !== null && displayedValue !== void 0 ? displayedValue : null, getOptionLabel: (option) => {
129
+ return (React.createElement(Autocomplete, { options: opts, value: displayedValue ?? null, getOptionLabel: (option) => {
123
130
  if (typeof option === 'string') {
124
131
  return option;
125
132
  }
@@ -129,22 +136,22 @@ const customSelector = (props) => {
129
136
  },
130
137
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
131
138
  onChange: (event, newValue) => {
132
- handleOnChange(newValue === null || newValue === void 0 ? void 0 : newValue.value.name);
139
+ handleOnChange(newValue?.value.name);
133
140
  }, onInputChange: (event, value) => {
134
141
  if (isFreeSoloEnabled) {
135
142
  handleOnChange(value);
136
143
  }
137
- }, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { size: "small", name: title })), sx: { width: width, maxWidth: title === 'Operators' ? '200px' : 'none' }, disableClearable: true, readOnly: readOnly }));
144
+ }, renderInput: (params) => React.createElement(TextField, { ...params, size: "small", name: title }), sx: { width: width, maxWidth: title === 'Operators' ? '200px' : 'none' }, disableClearable: true, readOnly: readOnly }));
138
145
  };
139
146
  const customCombinator = (props) => {
140
147
  const { options, value, handleOnChange, context, level } = props;
141
148
  return (React.createElement(Autocomplete, { options: options, value: startCase(value),
142
149
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
- getOptionLabel: (option) => { var _a; return startCase((_a = option === null || option === void 0 ? void 0 : option.name) !== null && _a !== void 0 ? _a : option); },
150
+ getOptionLabel: (option) => startCase(option?.name ?? option),
144
151
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
145
152
  isOptionEqualToValue: (option, value) => option === value,
146
153
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
147
- onChange: (event, newValue) => handleOnChange(newValue === null || newValue === void 0 ? void 0 : newValue.value.name), size: 'small', renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { size: "small", sx: { '& fieldset': { border: 'none' } } })), sx: {
154
+ onChange: (event, newValue) => handleOnChange(newValue?.value.name), size: 'small', renderInput: (params) => React.createElement(TextField, { ...params, size: "small", sx: { '& fieldset': { border: 'none' } } }), sx: {
148
155
  width: '80px',
149
156
  backgroundColor: '#DFE3E8',
150
157
  borderWidth: 'none',
@@ -168,10 +175,9 @@ const customDelete = (props) => {
168
175
  React.createElement(RemoveCircleOutlineRounded, null))) : (React.createElement(React.Fragment, null));
169
176
  };
170
177
  export const valueEditor = (props) => {
171
- var _a, _b;
172
178
  // For backward compatibility, if enable preset values is true, but preset
173
179
  // values are not defined, add in the user id preset value
174
- if (!((_a = props.context) === null || _a === void 0 ? void 0 : _a.presetValues) && ((_b = props.context) === null || _b === void 0 ? void 0 : _b.enablePresetValues)) {
180
+ if (!props.context?.presetValues && props.context?.enablePresetValues) {
175
181
  props.context.presetValues = [
176
182
  {
177
183
  label: 'User ID',
@@ -188,7 +194,10 @@ const CriteriaBuilder = (props) => {
188
194
  if (criteria || originalCriteria) {
189
195
  const criteriaToParse = criteria || originalCriteria || {};
190
196
  const updatedQuery = parseMongoDB(criteriaToParse);
191
- setQuery(Object.assign(Object.assign({}, updatedQuery), { rules: processRules(updatedQuery.rules) }));
197
+ setQuery({
198
+ ...updatedQuery,
199
+ rules: processRules(updatedQuery.rules),
200
+ });
192
201
  }
193
202
  else {
194
203
  setQuery({ combinator: 'and', rules: [] });
@@ -196,16 +205,21 @@ const CriteriaBuilder = (props) => {
196
205
  }, [originalCriteria]);
197
206
  function processRules(rules) {
198
207
  return rules.map((rule) => {
199
- var _a, _b;
200
208
  if ('rules' in rule) {
201
- return Object.assign(Object.assign({}, rule), { rules: processRules(rule.rules) });
209
+ return {
210
+ ...rule,
211
+ rules: processRules(rule.rules),
212
+ };
202
213
  }
203
214
  else {
204
- const propertyType = (_a = properties.find((property) => property.id === rule.field)) === null || _a === void 0 ? void 0 : _a.type;
205
- return Object.assign(Object.assign({}, rule), { value: propertyType === 'array' ||
215
+ const propertyType = properties.find((property) => property.id === rule.field)?.type;
216
+ return {
217
+ ...rule,
218
+ value: propertyType === 'array' ||
206
219
  (propertyType === 'string' && (rule.operator === 'in' || rule.operator === 'notIn'))
207
- ? (_b = rule.value) === null || _b === void 0 ? void 0 : _b.split(',')
208
- : rule.value });
220
+ ? rule.value?.split(',')
221
+ : rule.value,
222
+ };
209
223
  }
210
224
  });
211
225
  }
@@ -221,10 +235,15 @@ const CriteriaBuilder = (props) => {
221
235
  };
222
236
  const fields = useMemo(() => {
223
237
  return properties.map((property) => {
224
- return Object.assign({ name: property.type === 'object' ? `${property.id}.id` : property.id, label: property.name, inputType: property.type }, (property.enum && {
225
- valueEditorType: property.type === 'array' ? 'multiselect' : 'select',
226
- values: property.enum.map((item) => ({ name: item, label: item })),
227
- }));
238
+ return {
239
+ name: property.type === 'object' ? `${property.id}.id` : property.id,
240
+ label: property.name,
241
+ inputType: property.type,
242
+ ...(property.enum && {
243
+ valueEditorType: property.type === 'array' ? 'multiselect' : 'select',
244
+ values: property.enum.map((item) => ({ name: item, label: item })),
245
+ }),
246
+ };
228
247
  });
229
248
  }, [properties]);
230
249
  if (query) {
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import React from 'react';
11
2
  import { render, screen } from '@testing-library/react';
12
3
  import userEvent from '@testing-library/user-event';
@@ -18,7 +9,7 @@ const mockProperties = [
18
9
  { id: 'issueDate', name: 'issue date', type: 'date', required: false },
19
10
  ];
20
11
  describe('CriteriaBuilder', () => {
21
- test('allows selection of a property and clears value input when selected', () => __awaiter(void 0, void 0, void 0, function* () {
12
+ test('allows selection of a property and clears value input when selected', async () => {
22
13
  const user = userEvent.setup();
23
14
  render(React.createElement(CriteriaBuilder, { properties: mockProperties, criteria: {
24
15
  $or: [
@@ -27,15 +18,15 @@ describe('CriteriaBuilder', () => {
27
18
  },
28
19
  ],
29
20
  }, setCriteria: jest.fn(), freeSolo: true }));
30
- const field = yield screen.findByDisplayValue(/name/);
31
- const value = yield screen.findByDisplayValue(/test value/);
32
- yield user.click(field);
33
- const option = yield screen.findByRole('option', { name: /license number/ });
34
- yield user.click(option);
21
+ const field = await screen.findByDisplayValue(/name/);
22
+ const value = await screen.findByDisplayValue(/test value/);
23
+ await user.click(field);
24
+ const option = await screen.findByRole('option', { name: /license number/ });
25
+ await user.click(option);
35
26
  expect(field).toHaveValue('license number');
36
27
  expect(value).toHaveValue('');
37
- }));
38
- test('allows free solo input when freeSolo is true, clears value input when entered', () => __awaiter(void 0, void 0, void 0, function* () {
28
+ });
29
+ test('allows free solo input when freeSolo is true, clears value input when entered', async () => {
39
30
  const user = userEvent.setup();
40
31
  render(React.createElement(CriteriaBuilder, { properties: mockProperties, criteria: {
41
32
  $or: [
@@ -44,10 +35,10 @@ describe('CriteriaBuilder', () => {
44
35
  },
45
36
  ],
46
37
  }, setCriteria: jest.fn(), freeSolo: true }));
47
- const field = yield screen.findByDisplayValue(/name/);
48
- const value = yield screen.findByDisplayValue(/test value/);
49
- yield user.type(field, 'person.license.name');
38
+ const field = await screen.findByDisplayValue(/name/);
39
+ const value = await screen.findByDisplayValue(/test value/);
40
+ await user.type(field, 'person.license.name');
50
41
  expect(field).toHaveValue('person.license.name');
51
42
  expect(value).toHaveValue('');
52
- }));
43
+ });
53
44
  });
@@ -17,15 +17,14 @@ const GroupHeader = styled('div')(({ theme }) => ({
17
17
  }));
18
18
  const GroupItems = styled('ul')({ padding: 0 });
19
19
  const ValueEditor = (props) => {
20
- var _a, _b, _c, _d;
21
20
  const { handleOnChange, value, values, operator, inputType, context, level, rule } = props;
22
21
  const inputRef = useRef(null);
23
22
  const [openPresetValues, setOpenPresetValues] = useState(false);
24
23
  const disabled = ['null', 'notNull'].includes(operator);
25
- const presetValues = (_a = context.presetValues) !== null && _a !== void 0 ? _a : [];
26
- const isPresetValue = (value) => (value === null || value === void 0 ? void 0 : value.startsWith('{{{')) && (value === null || value === void 0 ? void 0 : value.endsWith('}}}'));
24
+ const presetValues = context.presetValues ?? [];
25
+ const isPresetValue = (value) => value?.startsWith('{{{') && value?.endsWith('}}}');
27
26
  const isPresetValueSelected = presetValues && typeof value === 'string' && isPresetValue(value);
28
- const presetDisplayValue = (_c = (_b = presetValues === null || presetValues === void 0 ? void 0 : presetValues.find((option) => option.value.name === value)) === null || _b === void 0 ? void 0 : _b.label) !== null && _c !== void 0 ? _c : '';
27
+ const presetDisplayValue = presetValues?.find((option) => option.value.name === value)?.label ?? '';
29
28
  let readOnly = false;
30
29
  if (context.disabledCriteria) {
31
30
  readOnly =
@@ -33,9 +32,8 @@ const ValueEditor = (props) => {
33
32
  }
34
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
34
  const onClick = (e) => {
36
- var _a;
37
35
  // if property is date and date picker is open, don't open preset values
38
- if (inputType && ['date', 'time'].includes(inputType) && ((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) !== 'INPUT') {
36
+ if (inputType && ['date', 'time'].includes(inputType) && e.target?.tagName !== 'INPUT') {
39
37
  return;
40
38
  }
41
39
  setOpenPresetValues(true);
@@ -54,7 +52,6 @@ const ValueEditor = (props) => {
54
52
  React.createElement(GroupHeader, null, params.group),
55
53
  React.createElement(GroupItems, null, params.children)));
56
54
  const getEditor = () => {
57
- var _a, _b;
58
55
  if (isPresetValueSelected) {
59
56
  return;
60
57
  }
@@ -64,80 +61,76 @@ const ValueEditor = (props) => {
64
61
  if (inputType === 'date') {
65
62
  // date editor
66
63
  return (React.createElement(LocalizationProvider, null,
67
- React.createElement(DatePicker, { inputRef: inputRef, disabled: disabled, value: disabled ? null : value, onChange: handleOnChange, onClose: onClose, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } }))), readOnly: readOnly })));
64
+ React.createElement(DatePicker, { inputRef: inputRef, disabled: disabled, value: disabled ? null : value, onChange: handleOnChange, onClose: onClose, renderInput: (params) => (React.createElement(TextField, { ...params, onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } })), readOnly: readOnly })));
68
65
  }
69
66
  else if (inputType === 'time') {
70
67
  return (React.createElement(LocalizationProvider, null,
71
- React.createElement(TimePicker, { inputRef: inputRef, disabled: disabled, value: disabled || !value ? null : value, onChange: handleOnChange, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } }))), readOnly: readOnly })));
68
+ React.createElement(TimePicker, { inputRef: inputRef, disabled: disabled, value: disabled || !value ? null : value, onChange: handleOnChange, renderInput: (params) => (React.createElement(TextField, { ...params, onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } })), readOnly: readOnly })));
72
69
  }
73
70
  else if (inputType === 'number' || inputType === 'integer') {
74
71
  const isMultiple = ['in', 'notIn'].includes(operator);
75
72
  const options = presetValues;
76
73
  if (isMultiple) {
77
- return (React.createElement(Autocomplete, { freeSolo: true, multiple: true, options: options, getOptionLabel: (option) => typeof option === 'object' && (option === null || option === void 0 ? void 0 : option.label) ? option.label : option, value: Array.isArray(value) ? (disabled ? [] : value) : [], disabled: disabled,
74
+ return (React.createElement(Autocomplete, { freeSolo: true, multiple: true, options: options, getOptionLabel: (option) => typeof option === 'object' && option?.label ? option.label : option, value: Array.isArray(value) ? (disabled ? [] : value) : [], disabled: disabled,
78
75
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
76
  onChange: (event, newValue) => {
80
77
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
- const uniqueSelections = newValue.map((item) => { var _a; return (_a = item.value) !== null && _a !== void 0 ? _a : Number(item); });
78
+ const uniqueSelections = newValue.map((item) => item.value ?? Number(item));
82
79
  handleOnChange(uniqueSelections.length ? uniqueSelections : '');
83
80
  },
84
81
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
- isOptionEqualToValue: (option, value) => option === value, renderInput: (params) => (React.createElement(TextField, Object.assign({ label: params.label }, params, { size: "small" }))), groupBy: (option) => { var _a; return isPresetValue((_a = option.value) === null || _a === void 0 ? void 0 : _a.name) ? context.presetGroupLabel || 'Preset Values' : 'Options'; }, renderGroup: groupRenderGroup, sx: { width: '33%' }, readOnly: readOnly }));
82
+ isOptionEqualToValue: (option, value) => option === value, renderInput: (params) => (React.createElement(TextField, { label: params.label, ...params, size: "small" })), groupBy: (option) => isPresetValue(option.value?.name) ? context.presetGroupLabel || 'Preset Values' : 'Options', renderGroup: groupRenderGroup, sx: { width: '33%' }, readOnly: readOnly }));
86
83
  }
87
84
  else {
88
- return (React.createElement(TextField, Object.assign({ inputRef: inputRef, value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => {
89
- var _a;
85
+ return (React.createElement(TextField, { inputRef: inputRef, value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => {
90
86
  if (inputType === 'number') {
91
- handleOnChange((_a = e.target.value) !== null && _a !== void 0 ? _a : '');
87
+ handleOnChange(e.target.value ?? '');
92
88
  }
93
89
  else {
94
90
  handleOnChange(isNaN(parseInt(e.target.value)) ? '' : parseInt(e.target.value));
95
91
  }
96
- } }, (inputType === 'number'
97
- ? { InputProps: { inputComponent: NumericFormat } }
98
- : { type: 'number' }), { placeholder: "Value", size: "small", onClick: onClick, sx: { width: '33%' }, readOnly: readOnly })));
92
+ }, ...(inputType === 'number'
93
+ ? { InputProps: { inputComponent: NumericFormat } }
94
+ : { type: 'number' }), placeholder: "Value", size: "small", onClick: onClick, sx: { width: '33%' }, readOnly: readOnly }));
99
95
  }
100
96
  }
101
97
  else {
102
98
  const isMultiple = inputType === 'array' || ['in', 'notIn'].includes(operator);
103
99
  const options = [
104
- ...((_a = values === null || values === void 0 ? void 0 : values.sort((a, b) => a.label.localeCompare(b.label))) !== null && _a !== void 0 ? _a : []),
105
- ...((_b = presetValues === null || presetValues === void 0 ? void 0 : presetValues.sort((a, b) => a.label.localeCompare(b.label))) !== null && _b !== void 0 ? _b : []),
100
+ ...(values?.sort((a, b) => a.label.localeCompare(b.label)) ?? []),
101
+ ...(presetValues?.sort((a, b) => a.label.localeCompare(b.label)) ?? []),
106
102
  ];
107
- if (isMultiple || (values === null || values === void 0 ? void 0 : values.length)) {
103
+ if (isMultiple || values?.length) {
108
104
  return (React.createElement(Autocomplete, { freeSolo: inputType !== 'array' && inputType !== 'select', multiple: isMultiple, options: options, value: isMultiple ? (Array.isArray(value) ? value : []) : value,
109
105
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
106
  onChange: (event, newValue) => {
111
- var _a, _b, _c;
112
107
  let value;
113
108
  if (isMultiple) {
114
109
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
- const values = newValue.map((item) => { var _a; return item.name || ((_a = item.value) === null || _a === void 0 ? void 0 : _a.name) || item; });
110
+ const values = newValue.map((item) => item.name || item.value?.name || item);
116
111
  value = Array.from(new Set(values));
117
112
  }
118
113
  else {
119
- value = (_c = (_a = newValue === null || newValue === void 0 ? void 0 : newValue.name) !== null && _a !== void 0 ? _a : (_b = newValue === null || newValue === void 0 ? void 0 : newValue.value) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '';
114
+ value = newValue?.name ?? newValue?.value?.name ?? '';
120
115
  }
121
116
  handleOnChange(value);
122
- }, renderInput: (params) => (React.createElement(TextField, Object.assign({ inputRef: inputRef, label: params === null || params === void 0 ? void 0 : params.label }, params, { size: "small" }))),
117
+ }, renderInput: (params) => (React.createElement(TextField, { inputRef: inputRef, label: params?.label, ...params, size: "small" })),
123
118
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
119
  getOptionLabel: (option) => {
125
- var _a;
126
120
  if (typeof option === 'string') {
127
- return ((_a = options.find((o) => { var _a; return option === o.name || option == ((_a = o.value) === null || _a === void 0 ? void 0 : _a.name); })) === null || _a === void 0 ? void 0 : _a.label) || '';
121
+ return options.find((o) => option === o.name || option == o.value?.name)?.label || '';
128
122
  }
129
- return option === null || option === void 0 ? void 0 : option.label;
123
+ return option?.label;
130
124
  },
131
125
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
132
126
  isOptionEqualToValue: (option, value) => {
133
- var _a;
134
127
  if (typeof value === 'string') {
135
- return (option === null || option === void 0 ? void 0 : option.name) === value || ((_a = option === null || option === void 0 ? void 0 : option.value) === null || _a === void 0 ? void 0 : _a.name) === value;
128
+ return option?.name === value || option?.value?.name === value;
136
129
  }
137
130
  else {
138
- return (option === null || option === void 0 ? void 0 : option.label) === (value === null || value === void 0 ? void 0 : value.label);
131
+ return option?.label === value?.label;
139
132
  }
140
- }, groupBy: (option) => { var _a; return isPresetValue((_a = option.value) === null || _a === void 0 ? void 0 : _a.name) ? context.presetGroupLabel || 'Preset Values' : 'Options'; }, renderGroup: groupRenderGroup, sortBy: "NONE", sx: { width: '33%' }, readOnly: readOnly }));
133
+ }, groupBy: (option) => isPresetValue(option.value?.name) ? context.presetGroupLabel || 'Preset Values' : 'Options', renderGroup: groupRenderGroup, sortBy: "NONE", sx: { width: '33%' }, readOnly: readOnly }));
141
134
  }
142
135
  else {
143
136
  return (React.createElement(TextField, { inputRef: inputRef, value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => handleOnChange(e.target.value), onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' }, readOnly: readOnly }));
@@ -153,9 +146,9 @@ const ValueEditor = (props) => {
153
146
  padding: '0 5px',
154
147
  justifyContent: 'space-between',
155
148
  }, deleteIcon: React.createElement(ClearRounded, { fontSize: "small" }), onDelete: clearValue })) : (getEditor()),
156
- !!(presetValues === null || presetValues === void 0 ? void 0 : presetValues.length) && (React.createElement(Menu, { open: openPresetValues, anchorEl: inputRef === null || inputRef === void 0 ? void 0 : inputRef.current, PaperProps: { sx: { borderRadius: '8px', width: (_d = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _d === void 0 ? void 0 : _d.offsetWidth } }, onClose: onClose }, presetValues &&
149
+ !!presetValues?.length && (React.createElement(Menu, { open: openPresetValues, anchorEl: inputRef?.current, PaperProps: { sx: { borderRadius: '8px', width: inputRef?.current?.offsetWidth } }, onClose: onClose }, presetValues &&
157
150
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
158
- presetValues.map((option) => (React.createElement(MenuItem, Object.assign({}, props, { onClick: () => setPresetValue(option.value.name), sx: { padding: '8px', minHeight: '25px' } }),
151
+ presetValues.map((option) => (React.createElement(MenuItem, { ...props, onClick: () => setPresetValue(option.value.name), sx: { padding: '8px', minHeight: '25px' } },
159
152
  React.createElement(Box, { padding: 0, margin: 0 },
160
153
  React.createElement(Typography, { fontSize: '14px', fontWeight: 500, sx: { lineHeight: '20px' } }, option.label),
161
154
  option.value.sublabel && (React.createElement(Typography, { fontSize: '14px', fontWeight: 500, color: 'rgba(145, 158, 171)', sx: { lineHeight: '20px' } }, option.value.sublabel))))))))));
@@ -1,14 +1,3 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import { Box, Typography, lighten } from '@mui/material';
13
2
  import { GridPagination, DataGrid as MuiDataGrid, getGridBooleanOperators, getGridDateOperators, getGridNumericOperators, getGridSingleSelectOperators, getGridStringOperators, } from '@mui/x-data-grid';
14
3
  import React, { useEffect, useState } from 'react';
@@ -17,13 +6,14 @@ import LinearProgress from '../../core/LinearProgress';
17
6
  import { dateTimeBetweenOperator } from './DateTimeCustomOperator';
18
7
  import Toolbar from './Toolbar';
19
8
  export default function (props) {
20
- var _a;
21
- const { onRefresh, loading, theme, title, bulkAction, filterSettings, columns, rows, hideSearchbar, loadingOptions } = props, rest = __rest(props, ["onRefresh", "loading", "theme", "title", "bulkAction", "filterSettings", "columns", "rows", "hideSearchbar", "loadingOptions"]);
9
+ const { onRefresh, loading, theme, title, bulkAction, filterSettings, columns, rows, hideSearchbar, loadingOptions, ...rest } = props;
22
10
  const [anchorEl, setAnchorEl] = useState();
23
11
  const [loadingMessageIndex, setLoadingMessageIndex] = useState(0);
24
12
  const addColumnFilterOperators = (columns) => {
25
- return (filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.mode) === 'server' || !!(filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.filterColumns)
26
- ? columns.map((column) => (Object.assign(Object.assign({}, column), { filterOperators: column.type === 'string'
13
+ return filterSettings?.mode === 'server' || !!filterSettings?.filterColumns
14
+ ? columns.map((column) => ({
15
+ ...column,
16
+ filterOperators: column.type === 'string'
27
17
  ? getGridStringOperators().filter((o) => !['isEmpty', 'isNotEmpty', 'isAnyOf'].includes(o.value))
28
18
  : column.type === 'date' || column.type === 'dateTime'
29
19
  ? getGridDateOperators(column.type === 'dateTime')
@@ -33,12 +23,12 @@ export default function (props) {
33
23
  ? getGridNumericOperators().filter((o) => !['isEmpty', 'isNotEmpty', 'isAnyOf'].includes(o.value))
34
24
  : column.type === 'singleSelect'
35
25
  ? getGridSingleSelectOperators().filter((o) => !['isEmpty', 'isNotEmpty', 'isAnyOf'].includes(o.value))
36
- : getGridBooleanOperators().filter((o) => !['isEmpty', 'isNotEmpty', 'isAnyOf'].includes(o.value)) })))
26
+ : getGridBooleanOperators().filter((o) => !['isEmpty', 'isNotEmpty', 'isAnyOf'].includes(o.value)),
27
+ }))
37
28
  : columns;
38
29
  };
39
30
  useEffect(() => {
40
- var _a;
41
- if (!loading || !((_a = loadingOptions === null || loadingOptions === void 0 ? void 0 : loadingOptions.messages) === null || _a === void 0 ? void 0 : _a.length))
31
+ if (!loading || !loadingOptions?.messages?.length)
42
32
  return;
43
33
  const intervalId = setInterval(() => {
44
34
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -47,32 +37,48 @@ export default function (props) {
47
37
  return () => clearInterval(intervalId);
48
38
  }, [loading, loadingMessageIndex, loadingOptions]);
49
39
  return (React.createElement(UIThemeProvider, { args: { theme: theme } },
50
- React.createElement(MuiDataGrid, Object.assign({ onMenuOpen: (env) => setAnchorEl(env.target), loading: loading, filterMode: (_a = filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.mode) !== null && _a !== void 0 ? _a : 'client', rows: rows }, rest, { columns: addColumnFilterOperators(columns), sx: Object.assign({ borderRadius: '8px', border: 'none', '& .MuiDataGrid-columnHeaders': {
40
+ React.createElement(MuiDataGrid, { onMenuOpen: (env) => setAnchorEl(env.target), loading: loading, filterMode: filterSettings?.mode ?? 'client', rows: rows, ...rest, columns: addColumnFilterOperators(columns), sx: {
41
+ borderRadius: '8px',
42
+ border: 'none',
43
+ '& .MuiDataGrid-columnHeaders': {
51
44
  backgroundColor: '#F4F6F8',
52
45
  color: '#637381',
53
46
  borderRadius: '8px 8px 0 0',
54
- }, '& .MuiDataGrid-virtualScrollerContent': {
47
+ },
48
+ '& .MuiDataGrid-virtualScrollerContent': {
55
49
  borderRight: '1px solid #eee',
56
50
  borderLeft: '1px solid #eee',
57
- }, '& .MuiDataGrid-virtualScroller': Object.assign({}, (loading ? { overflow: 'hidden' } : {})), '& .MuiDataGrid-toolbarContainer': {
51
+ },
52
+ '& .MuiDataGrid-virtualScroller': {
53
+ ...(loading ? { overflow: 'hidden' } : {}),
54
+ },
55
+ '& .MuiDataGrid-toolbarContainer': {
58
56
  padding: '0',
59
57
  fontColor: '#212B36',
60
- }, '& .MuiDataGrid-row': {
58
+ },
59
+ '& .MuiDataGrid-row': {
61
60
  borderBottom: '1px solid #eee',
62
- }, '& .MuiDataGrid-cell': {
61
+ },
62
+ '& .MuiDataGrid-cell': {
63
63
  border: 'none',
64
- }, '& .MuiDataGrid-footerContainer': {
64
+ },
65
+ '& .MuiDataGrid-footerContainer': {
65
66
  border: '1px solid #eee',
66
67
  borderRadius: '0 0 8px 8px',
67
- }, '& .MuiTablePagination-displayedRows': {
68
+ },
69
+ '& .MuiTablePagination-displayedRows': {
68
70
  marginBottom: 0,
69
- }, '.css-17hki28-MuiButtonBase-root-MuiButton-root': {
71
+ },
72
+ '.css-17hki28-MuiButtonBase-root-MuiButton-root': {
70
73
  padding: '7px',
71
74
  color: '#757575',
72
75
  '&:hover': {
73
76
  backgroundColor: '#f2f3f5',
74
77
  },
75
- }, height: 'calc(100vh - 240px)' }, rest.sx), localeText: {
78
+ },
79
+ height: 'calc(100vh - 240px)',
80
+ ...rest.sx,
81
+ }, localeText: {
76
82
  toolbarColumns: '',
77
83
  toolbarDensity: '',
78
84
  toolbarFilters: '',
@@ -107,12 +113,11 @@ export default function (props) {
107
113
  Toolbar: Toolbar,
108
114
  Footer: () => {
109
115
  return (React.createElement(Box, { display: 'flex', alignItems: 'center', justifyContent: 'space-between', sx: { border: '1px solid #eee', borderRadius: '0 0 6px 6px' } },
110
- React.createElement(Box, null, (filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.mode) === 'server' && (filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.maxRows) === (rows === null || rows === void 0 ? void 0 : rows.length) && (React.createElement(Typography, { marginLeft: '8px', color: '#8f8c8c', fontSize: '14px' }, `You are viewing ${filterSettings.maxRows} records. If you can't find a record, please refine your
116
+ React.createElement(Box, null, filterSettings?.mode === 'server' && filterSettings?.maxRows === rows?.length && (React.createElement(Typography, { marginLeft: '8px', color: '#8f8c8c', fontSize: '14px' }, `You are viewing ${filterSettings.maxRows} records. If you can't find a record, please refine your
111
117
  search.`))),
112
118
  React.createElement(GridPagination, null)));
113
119
  },
114
120
  LoadingOverlay: () => {
115
- var _a, _b;
116
121
  return (React.createElement(Box, { sx: {
117
122
  minHeight: '100%',
118
123
  display: 'flex',
@@ -122,17 +127,17 @@ export default function (props) {
122
127
  overflow: 'hidden',
123
128
  } },
124
129
  React.createElement(Box, { width: '225px' },
125
- React.createElement(Typography, { sx: { marginBottom: '8px', color: '#aaa', width: '100%', textAlign: 'center' } }, (loadingOptions === null || loadingOptions === void 0 ? void 0 : loadingOptions.messages)
130
+ React.createElement(Typography, { sx: { marginBottom: '8px', color: '#aaa', width: '100%', textAlign: 'center' } }, loadingOptions?.messages
126
131
  ? loadingOptions.messages[loadingMessageIndex]
127
132
  : 'Loading'),
128
133
  React.createElement(LinearProgress, { sx: {
129
- backgroundColor: (_a = loadingOptions === null || loadingOptions === void 0 ? void 0 : loadingOptions.color) !== null && _a !== void 0 ? _a : '#0075A7',
134
+ backgroundColor: loadingOptions?.color ?? '#0075A7',
130
135
  '& .MuiLinearProgress-bar': {
131
- backgroundColor: lighten((_b = loadingOptions === null || loadingOptions === void 0 ? void 0 : loadingOptions.color) !== null && _b !== void 0 ? _b : '#0075A7', 0.5),
136
+ backgroundColor: lighten(loadingOptions?.color ?? '#0075A7', 0.5),
132
137
  },
133
138
  borderRadius: '6px',
134
139
  width: '100%',
135
140
  } }))));
136
141
  },
137
- } }))));
142
+ } })));
138
143
  }
@@ -3,19 +3,17 @@ import { useGridRootProps } from '@mui/x-data-grid';
3
3
  import { isNil } from 'lodash';
4
4
  import React, { useEffect, useState } from 'react';
5
5
  function DateTimeRangeFilter(props) {
6
- var _a;
7
6
  const rootProps = useGridRootProps();
8
7
  const { item, applyValue, focusElementRef = null } = props;
9
- const [filterValueState, setFilterValueState] = useState((_a = item.value) !== null && _a !== void 0 ? _a : '');
8
+ const [filterValueState, setFilterValueState] = useState(item.value ?? '');
10
9
  useEffect(() => {
11
- var _a;
12
- const itemValue = (_a = item.value) !== null && _a !== void 0 ? _a : [undefined, undefined];
10
+ const itemValue = item.value ?? [undefined, undefined];
13
11
  setFilterValueState(itemValue);
14
12
  }, [item.value]);
15
13
  const updateFilterValue = (from, to) => {
16
14
  setFilterValueState([from, to]);
17
15
  debounce(() => {
18
- applyValue(Object.assign(Object.assign({}, item), { value: [from, to] }));
16
+ applyValue({ ...item, value: [from, to] });
19
17
  }, rootProps.filterDebounceMs)();
20
18
  };
21
19
  const handleChange = (event) => {
@@ -6,7 +6,6 @@ import UIThemeProvider from '../../../theme';
6
6
  import { Button, IconButton } from '../../core';
7
7
  import { Grid } from '../../layout';
8
8
  function Toolbar(props) {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
10
9
  const { onRefresh, setAnchorEl, loading, theme, title, bulkAction, hideSearchbar } = props;
11
10
  const styles = {
12
11
  container: { display: 'flex', justifyContent: 'space-between', margin: '0 0 15px 0' },
@@ -14,9 +13,9 @@ function Toolbar(props) {
14
13
  minWidth: '36px',
15
14
  height: '36px',
16
15
  backgroundColor: 'rgba(145, 158, 171, 0.12)',
17
- color: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.primary) === null || _b === void 0 ? void 0 : _b.main) !== null && _c !== void 0 ? _c : 'primary',
16
+ color: theme?.palette?.primary?.main ?? 'primary',
18
17
  '&:hover': {
19
- backgroundColor: (_f = (_e = (_d = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _d === void 0 ? void 0 : _d.primary) === null || _e === void 0 ? void 0 : _e.light) !== null && _f !== void 0 ? _f : '#99C8DC',
18
+ backgroundColor: theme?.palette?.primary?.light ?? '#99C8DC',
20
19
  },
21
20
  marginLeft: '3px',
22
21
  marginRight: '3px',
@@ -27,7 +26,7 @@ function Toolbar(props) {
27
26
  quickFilter: {
28
27
  '& .MuiOutlinedInput-root': {
29
28
  '&.Mui-focused fieldset': {
30
- borderColor: (_j = (_h = (_g = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _g === void 0 ? void 0 : _g.primary) === null || _h === void 0 ? void 0 : _h.main) !== null && _j !== void 0 ? _j : 'primary',
29
+ borderColor: theme?.palette?.primary?.main ?? 'primary',
31
30
  },
32
31
  },
33
32
  '& fieldset': {
@@ -41,7 +41,17 @@ export default function ErrorComponent(props) {
41
41
  return React.createElement(WarningRounded, { sx: { color: '#ef8228' } });
42
42
  }
43
43
  };
44
- return (React.createElement(Grid, { item: true, xs: colspan !== null && colspan !== void 0 ? colspan : 12, sm: colspan !== null && colspan !== void 0 ? colspan : 12, sx: Object.assign({ background: 'white', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column', boxShadow: '0px 8px 16px 0px rgba(145, 158, 171, 0.12)', borderRadius: '6px', height: 200 }, styles) },
44
+ return (React.createElement(Grid, { item: true, xs: colspan ?? 12, sm: colspan ?? 12, sx: {
45
+ background: 'white',
46
+ display: 'flex',
47
+ justifyContent: 'center',
48
+ alignItems: 'center',
49
+ flexDirection: 'column',
50
+ boxShadow: '0px 8px 16px 0px rgba(145, 158, 171, 0.12)',
51
+ borderRadius: '6px',
52
+ height: 200,
53
+ ...styles,
54
+ } },
45
55
  React.createElement(Box, { sx: {
46
56
  padding: '8px',
47
57
  height: '36px',