@gridsuite/commons-ui 0.63.3 → 0.63.5

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 (129) hide show
  1. package/dist/_mocks_/svg.js +1 -3
  2. package/dist/assets/expert-filter-form.css +18 -8
  3. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +88 -97
  4. package/dist/components/CardErrorBoundary/card-error-boundary.js +6 -20
  5. package/dist/components/CustomAGGrid/custom-aggrid.js +47 -49
  6. package/dist/components/DirectoryItemSelector/directory-item-selector.js +10 -40
  7. package/dist/components/ElementSearchDialog/element-search-dialog.js +1 -17
  8. package/dist/components/ElementSearchDialog/equipment-item.js +29 -47
  9. package/dist/components/ElementSearchDialog/tag-renderer.js +2 -8
  10. package/dist/components/ElementSearchDialog/use-element-search.js +1 -4
  11. package/dist/components/FlatParameters/FlatParameters.js +13 -77
  12. package/dist/components/Login/Login.js +9 -34
  13. package/dist/components/Login/Logout.js +3 -26
  14. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +35 -64
  15. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +4 -17
  16. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +1 -1
  17. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +19 -95
  18. package/dist/components/MuiVirtualizedTable/index.d.ts +1 -1
  19. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +2 -6
  20. package/dist/components/OverflowableText/overflowable-text.js +3 -10
  21. package/dist/components/ReportViewer/filter-button.d.ts +1 -1
  22. package/dist/components/ReportViewer/filter-button.js +2 -7
  23. package/dist/components/ReportViewer/log-report-item.js +7 -17
  24. package/dist/components/ReportViewer/log-report.js +4 -13
  25. package/dist/components/ReportViewer/log-table.d.ts +1 -1
  26. package/dist/components/ReportViewer/log-table.js +3 -16
  27. package/dist/components/ReportViewer/multi-select-list.d.ts +1 -1
  28. package/dist/components/ReportViewer/multi-select-list.js +2 -14
  29. package/dist/components/ReportViewer/report-item.js +4 -10
  30. package/dist/components/ReportViewer/report-viewer.d.ts +1 -1
  31. package/dist/components/ReportViewer/report-viewer.js +2 -7
  32. package/dist/components/ReportViewerDialog/report-viewer-dialog.js +1 -13
  33. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +1 -1
  34. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +1 -4
  35. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +1 -1
  36. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +1 -4
  37. package/dist/components/SnackbarProvider/SnackbarProvider.js +4 -11
  38. package/dist/components/TopBar/AboutDialog.js +51 -152
  39. package/dist/components/TopBar/GridLogo.d.ts +2 -2
  40. package/dist/components/TopBar/GridLogo.js +8 -41
  41. package/dist/components/TopBar/TopBar.js +197 -328
  42. package/dist/components/TreeViewFinder/TreeViewFinder.js +23 -66
  43. package/dist/components/TreeViewFinder/index.d.ts +2 -2
  44. package/dist/components/dialogs/custom-mui-dialog.d.ts +2 -1
  45. package/dist/components/dialogs/custom-mui-dialog.js +64 -39
  46. package/dist/components/dialogs/modify-element-selection.js +1 -3
  47. package/dist/components/dialogs/popup-confirmation-dialog.d.ts +1 -1
  48. package/dist/components/dialogs/popup-confirmation-dialog.js +8 -15
  49. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +3 -18
  50. package/dist/components/filter/criteria-based/criteria-based-filter-utils.js +3 -9
  51. package/dist/components/filter/criteria-based/criteria-based-form.d.ts +1 -1
  52. package/dist/components/filter/criteria-based/criteria-based-form.js +7 -15
  53. package/dist/components/filter/criteria-based/filter-free-properties.d.ts +1 -1
  54. package/dist/components/filter/criteria-based/filter-free-properties.js +1 -4
  55. package/dist/components/filter/criteria-based/filter-properties.js +16 -24
  56. package/dist/components/filter/criteria-based/filter-property.js +1 -4
  57. package/dist/components/filter/expert/expert-filter-constants.d.ts +13 -6
  58. package/dist/components/filter/expert/expert-filter-constants.js +76 -36
  59. package/dist/components/filter/expert/expert-filter-edition-dialog.js +3 -18
  60. package/dist/components/filter/expert/expert-filter-form.js +1 -7
  61. package/dist/components/filter/expert/expert-filter-utils.js +10 -30
  62. package/dist/components/filter/expert/expert-filter.type.d.ts +3 -1
  63. package/dist/components/filter/expert/expert-filter.type.js +2 -0
  64. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +2 -15
  65. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.d.ts +1 -1
  66. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +10 -35
  67. package/dist/components/filter/filter-creation-dialog.js +5 -10
  68. package/dist/components/filter/filter-form.js +1 -6
  69. package/dist/components/filter/utils/filter-api.js +1 -7
  70. package/dist/components/inputs/react-hook-form/ExpandingTextField.js +1 -9
  71. package/dist/components/inputs/react-hook-form/ag-grid-table/bottom-right-buttons.js +14 -52
  72. package/dist/components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader.js +14 -62
  73. package/dist/components/inputs/react-hook-form/ag-grid-table/custom-ag-grid-table.js +29 -40
  74. package/dist/components/inputs/react-hook-form/autocomplete-inputs/autocomplete-input.js +2 -8
  75. package/dist/components/inputs/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.js +1 -3
  76. package/dist/components/inputs/react-hook-form/booleans/boolean-input.js +1 -7
  77. package/dist/components/inputs/react-hook-form/booleans/checkbox-input.js +1 -9
  78. package/dist/components/inputs/react-hook-form/booleans/switch-input.js +1 -9
  79. package/dist/components/inputs/react-hook-form/directory-items-input.js +5 -29
  80. package/dist/components/inputs/react-hook-form/error-management/error-input.d.ts +1 -1
  81. package/dist/components/inputs/react-hook-form/provider/custom-form-provider.js +1 -7
  82. package/dist/components/inputs/react-hook-form/radio-input.js +8 -18
  83. package/dist/components/inputs/react-hook-form/range-input.js +1 -4
  84. package/dist/components/inputs/react-hook-form/select-inputs/countries-input.js +1 -9
  85. package/dist/components/inputs/react-hook-form/select-inputs/mui-select-input.js +2 -13
  86. package/dist/components/inputs/react-hook-form/select-inputs/select-input.js +2 -6
  87. package/dist/components/inputs/react-hook-form/slider-input.d.ts +1 -1
  88. package/dist/components/inputs/react-hook-form/slider-input.js +2 -19
  89. package/dist/components/inputs/react-hook-form/unique-name-input.js +1 -9
  90. package/dist/components/inputs/react-hook-form/utils/field-label.d.ts +1 -1
  91. package/dist/components/inputs/react-hook-form/utils/field-label.js +1 -5
  92. package/dist/components/inputs/react-hook-form/utils/submit-button.js +1 -8
  93. package/dist/components/inputs/react-hook-form/utils/text-field-with-adornment.js +18 -47
  94. package/dist/components/inputs/react-query-builder/add-button.js +1 -10
  95. package/dist/components/inputs/react-query-builder/autocomplete-with-favorites.d.ts +12 -0
  96. package/dist/components/inputs/react-query-builder/autocomplete-with-favorites.js +43 -0
  97. package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.js +14 -27
  98. package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.js +1 -3
  99. package/dist/components/inputs/react-query-builder/country-value-editor.js +27 -28
  100. package/dist/components/inputs/react-query-builder/custom-react-query-builder.js +25 -31
  101. package/dist/components/inputs/react-query-builder/element-value-editor.js +1 -10
  102. package/dist/components/inputs/react-query-builder/property-value-editor.js +6 -11
  103. package/dist/components/inputs/react-query-builder/remove-button.js +1 -9
  104. package/dist/components/inputs/react-query-builder/text-value-editor.js +2 -1
  105. package/dist/components/inputs/react-query-builder/translated-value-editor.js +3 -4
  106. package/dist/components/inputs/react-query-builder/use-convert-value.d.ts +1 -1
  107. package/dist/components/inputs/react-query-builder/use-convert-value.js +1 -6
  108. package/dist/components/inputs/react-query-builder/value-editor.js +4 -20
  109. package/dist/components/translations/filter-expert-en.d.ts +21 -7
  110. package/dist/components/translations/filter-expert-en.js +24 -10
  111. package/dist/components/translations/filter-expert-fr.d.ts +21 -7
  112. package/dist/components/translations/filter-expert-fr.js +24 -10
  113. package/dist/hooks/localized-countries-hook.js +1 -3
  114. package/dist/hooks/useConfidentialityWarning.d.ts +8 -0
  115. package/dist/hooks/useConfidentialityWarning.js +14 -0
  116. package/dist/hooks/useDebounce.js +1 -4
  117. package/dist/hooks/useSnackMessage.js +3 -12
  118. package/dist/index.d.ts +10 -9
  119. package/dist/index.js +77 -73
  120. package/dist/services/apps-metadata.d.ts +7 -0
  121. package/dist/services/apps-metadata.js +13 -0
  122. package/dist/services/directory.js +3 -11
  123. package/dist/services/explore.js +2 -8
  124. package/dist/services/index.js +3 -1
  125. package/dist/services/utils.js +4 -12
  126. package/dist/utils/AuthService.js +8 -29
  127. package/dist/utils/UserManagerMock.js +6 -23
  128. package/dist/utils/styles.js +1 -6
  129. package/package.json +2 -1
@@ -52,9 +52,7 @@ function CsvUploader({
52
52
  }
53
53
  for (let i = 0; i < fileHeaders.length; i++) {
54
54
  if (fileHeaders[i] !== "" && rows[0][i] !== fileHeaders[i]) {
55
- setCreateError(
56
- intl.formatMessage({ id: "wrongCsvHeadersError" })
57
- );
55
+ setCreateError(intl.formatMessage({ id: "wrongCsvHeadersError" }));
58
56
  return false;
59
57
  }
60
58
  }
@@ -87,11 +85,7 @@ function CsvUploader({
87
85
  };
88
86
  const handleOpenCSVConfirmationDataDialog = () => {
89
87
  const isValuesInTable = Array.isArray(watchTableValues) && watchTableValues.some(
90
- (val) => val && Object.keys(val).filter(
91
- (key) => key !== FieldConstants.AG_GRID_ROW_UUID
92
- ).some(
93
- (e) => val[e] !== void 0 && val[e] !== null && String(val[e]).trim().length > 0
94
- )
88
+ (val) => val && Object.keys(val).filter((key) => key !== FieldConstants.AG_GRID_ROW_UUID).some((e) => val[e] !== void 0 && val[e] !== null && String(val[e]).trim().length > 0)
95
89
  );
96
90
  if (isValuesInTable && getResultsFromImportedData().length > 0) {
97
91
  setIsConfirmationPopupOpen(true);
@@ -112,51 +106,22 @@ function CsvUploader({
112
106
  setIsConfirmationPopupOpen(false);
113
107
  };
114
108
  const renderConfirmationCsvData = () => {
115
- return /* @__PURE__ */ jsxs(
116
- Dialog,
117
- {
118
- open: isConfirmationPopupOpen,
119
- "aria-labelledby": "dialog-confirmation-csv-data",
120
- children: [
121
- /* @__PURE__ */ jsx(DialogTitle, { id: "dialog-confirmation-csv-data", children: "Confirmation" }),
122
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogContentText, { children: intl.formatMessage({ id: "keepCSVDataMessage" }) }) }),
123
- /* @__PURE__ */ jsxs(DialogActions, { children: [
124
- /* @__PURE__ */ jsx(CancelButton, { onClick: handleCancelDialog }),
125
- /* @__PURE__ */ jsx(
126
- Button,
127
- {
128
- onClick: () => handleReplacePopupConfirmation(),
129
- variant: "outlined",
130
- children: /* @__PURE__ */ jsx(FormattedMessage, { id: "replace" })
131
- }
132
- ),
133
- /* @__PURE__ */ jsx(
134
- Button,
135
- {
136
- onClick: () => handleAddPopupConfirmation(),
137
- variant: "outlined",
138
- children: /* @__PURE__ */ jsx(FormattedMessage, { id: "add" })
139
- }
140
- )
141
- ] })
142
- ]
143
- }
144
- );
109
+ return /* @__PURE__ */ jsxs(Dialog, { open: isConfirmationPopupOpen, "aria-labelledby": "dialog-confirmation-csv-data", children: [
110
+ /* @__PURE__ */ jsx(DialogTitle, { id: "dialog-confirmation-csv-data", children: "Confirmation" }),
111
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogContentText, { children: intl.formatMessage({ id: "keepCSVDataMessage" }) }) }),
112
+ /* @__PURE__ */ jsxs(DialogActions, { children: [
113
+ /* @__PURE__ */ jsx(CancelButton, { onClick: handleCancelDialog }),
114
+ /* @__PURE__ */ jsx(Button, { onClick: () => handleReplacePopupConfirmation(), variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "replace" }) }),
115
+ /* @__PURE__ */ jsx(Button, { onClick: () => handleAddPopupConfirmation(), variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "add" }) })
116
+ ] })
117
+ ] });
145
118
  };
146
119
  return /* @__PURE__ */ jsxs(Fragment, { children: [
147
120
  /* @__PURE__ */ jsxs(Dialog, { open, onClose: handleClose, fullWidth: true, children: [
148
121
  /* @__PURE__ */ jsx(DialogTitle, { children: title }),
149
122
  /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs("div", { children: [
150
123
  /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
151
- /* @__PURE__ */ jsx(Grid, { container: true, item: true, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(
152
- CsvDownloader,
153
- {
154
- datas: data,
155
- filename: fileName,
156
- separator: ",",
157
- children: /* @__PURE__ */ jsx(Button, { variant: "contained", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "GenerateCSV" }) })
158
- }
159
- ) }) }),
124
+ /* @__PURE__ */ jsx(Grid, { container: true, item: true, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(CsvDownloader, { datas: data, filename: fileName, separator: ",", children: /* @__PURE__ */ jsx(Button, { variant: "contained", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "GenerateCSV" }) }) }) }) }),
160
125
  /* @__PURE__ */ jsx(Grid, { container: true, item: true, spacing: 3, children: /* @__PURE__ */ jsx(
161
126
  CSVReader,
162
127
  {
@@ -166,23 +131,10 @@ function CsvUploader({
166
131
  },
167
132
  config: {
168
133
  // We use | for multi values in one cell, then we remove it from the default value for this config, to avoid delimiter autodetection
169
- delimitersToGuess: [
170
- ",",
171
- " ",
172
- ";",
173
- RECORD_SEP,
174
- UNIT_SEP
175
- ]
134
+ delimitersToGuess: [",", " ", ";", RECORD_SEP, UNIT_SEP]
176
135
  },
177
136
  children: ({ getRootProps, acceptedFile }) => /* @__PURE__ */ jsxs(Grid, { item: true, children: [
178
- /* @__PURE__ */ jsx(
179
- Button,
180
- {
181
- ...getRootProps(),
182
- variant: "contained",
183
- children: /* @__PURE__ */ jsx(FormattedMessage, { id: "UploadCSV" })
184
- }
185
- ),
137
+ /* @__PURE__ */ jsx(Button, { ...getRootProps(), variant: "contained", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "UploadCSV" }) }),
186
138
  /* @__PURE__ */ jsx(
187
139
  "span",
188
140
  {
@@ -102,9 +102,7 @@ function CustomAgGridTable({
102
102
  (rowData == null ? void 0 : rowData.length) && ((_a = gridApi == null ? void 0 : gridApi.api.getRowNode(rowData[0][FieldConstants.AG_GRID_ROW_UUID])) == null ? void 0 : _a.isSelected())
103
103
  );
104
104
  const isLastSelected = Boolean(
105
- (rowData == null ? void 0 : rowData.length) && ((_b = gridApi == null ? void 0 : gridApi.api.getRowNode(
106
- rowData[rowData.length - 1][FieldConstants.AG_GRID_ROW_UUID]
107
- )) == null ? void 0 : _b.isSelected())
105
+ (rowData == null ? void 0 : rowData.length) && ((_b = gridApi == null ? void 0 : gridApi.api.getRowNode(rowData[rowData.length - 1][FieldConstants.AG_GRID_ROW_UUID])) == null ? void 0 : _b.isSelected())
108
106
  );
109
107
  const noRowSelected = selectedRows.length === 0;
110
108
  const getIndex = useCallback(
@@ -185,45 +183,36 @@ function CustomAgGridTable({
185
183
  setIsSortApplied(isAnycolumnhasSort);
186
184
  }, []);
187
185
  return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
188
- /* @__PURE__ */ jsx(
189
- Grid,
186
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, className: theme.aggrid.theme, sx: style(cssProps).grid, children: /* @__PURE__ */ jsx(
187
+ AgGridReact,
190
188
  {
191
- item: true,
192
- xs: 12,
193
- className: theme.aggrid.theme,
194
- sx: style(cssProps).grid,
195
- children: /* @__PURE__ */ jsx(
196
- AgGridReact,
197
- {
198
- rowData,
199
- onGridReady,
200
- getLocaleText,
201
- cacheOverflowSize: 10,
202
- rowSelection: "multiple",
203
- domLayout: "autoHeight",
204
- rowDragEntireRow: true,
205
- rowDragManaged: true,
206
- onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
207
- suppressBrowserResizeObserver: true,
208
- columnDefs,
209
- detailRowAutoHeight: true,
210
- onSelectionChanged: () => {
211
- setSelectedRows(gridApi.api.getSelectedRows());
212
- },
213
- onRowDataUpdated: newRowAdded ? onRowDataUpdated : void 0,
214
- onCellEditingStopped,
215
- onSortChanged,
216
- getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
217
- pagination,
218
- paginationPageSize,
219
- suppressRowClickSelection,
220
- alwaysShowVerticalScroll,
221
- stopEditingWhenCellsLoseFocus,
222
- ...props
223
- }
224
- )
189
+ rowData,
190
+ onGridReady,
191
+ getLocaleText,
192
+ cacheOverflowSize: 10,
193
+ rowSelection: "multiple",
194
+ domLayout: "autoHeight",
195
+ rowDragEntireRow: true,
196
+ rowDragManaged: true,
197
+ onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
198
+ suppressBrowserResizeObserver: true,
199
+ columnDefs,
200
+ detailRowAutoHeight: true,
201
+ onSelectionChanged: () => {
202
+ setSelectedRows(gridApi.api.getSelectedRows());
203
+ },
204
+ onRowDataUpdated: newRowAdded ? onRowDataUpdated : void 0,
205
+ onCellEditingStopped,
206
+ onSortChanged,
207
+ getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
208
+ pagination,
209
+ paginationPageSize,
210
+ suppressRowClickSelection,
211
+ alwaysShowVerticalScroll,
212
+ stopEditingWhenCellsLoseFocus,
213
+ ...props
225
214
  }
226
- ),
215
+ ) }),
227
216
  /* @__PURE__ */ jsx(
228
217
  BottomRightButtons,
229
218
  {
@@ -31,9 +31,7 @@ function AutocompleteInput({
31
31
  onChange(outputTransform(newValue));
32
32
  return;
33
33
  }
34
- const matchingOption = options.find(
35
- (option) => typeof option !== "string" && option.id === newValue
36
- );
34
+ const matchingOption = options.find((option) => typeof option !== "string" && option.id === newValue);
37
35
  if (matchingOption) {
38
36
  onChange(outputTransform(matchingOption));
39
37
  return;
@@ -61,11 +59,7 @@ function AutocompleteInput({
61
59
  ...label && {
62
60
  label: FieldLabel({
63
61
  label,
64
- optional: !isFieldRequired(
65
- name,
66
- validationSchema,
67
- getValues()
68
- ) && !(props == null ? void 0 : props.disabled) && !removeOptional
62
+ optional: !isFieldRequired(name, validationSchema, getValues()) && !(props == null ? void 0 : props.disabled) && !removeOptional
69
63
  })
70
64
  },
71
65
  inputRef: ref,
@@ -18,9 +18,7 @@ function MultipleAutocompleteInput({ name, ...props }) {
18
18
  };
19
19
  const outputTransform = (values) => {
20
20
  const newValues = values.map((val) => val.trim());
21
- return newValues.filter(
22
- (val, index) => newValues.indexOf(val) === index
23
- );
21
+ return newValues.filter((val, index) => newValues.indexOf(val) === index);
24
22
  };
25
23
  return /* @__PURE__ */ jsx(
26
24
  AutocompleteInput,
@@ -27,13 +27,7 @@ function BooleanInput({ name, label, formProps, Input }) {
27
27
  }
28
28
  );
29
29
  if (label) {
30
- return /* @__PURE__ */ jsx(
31
- FormControlLabel,
32
- {
33
- control: CustomInput,
34
- label: intl.formatMessage({ id: label })
35
- }
36
- );
30
+ return /* @__PURE__ */ jsx(FormControlLabel, { control: CustomInput, label: intl.formatMessage({ id: label }) });
37
31
  }
38
32
  return CustomInput;
39
33
  }
@@ -2,15 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Checkbox } from "@mui/material";
3
3
  import BooleanInput from "./boolean-input.js";
4
4
  function CheckboxInput({ name, label, formProps }) {
5
- return /* @__PURE__ */ jsx(
6
- BooleanInput,
7
- {
8
- name,
9
- label,
10
- formProps,
11
- Input: Checkbox
12
- }
13
- );
5
+ return /* @__PURE__ */ jsx(BooleanInput, { name, label, formProps, Input: Checkbox });
14
6
  }
15
7
  export {
16
8
  CheckboxInput as default
@@ -2,15 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Switch } from "@mui/material";
3
3
  import BooleanInput from "./boolean-input.js";
4
4
  function SwitchInput({ name, label, formProps }) {
5
- return /* @__PURE__ */ jsx(
6
- BooleanInput,
7
- {
8
- name,
9
- label,
10
- formProps,
11
- Input: Switch
12
- }
13
- );
5
+ return /* @__PURE__ */ jsx(BooleanInput, { name, label, formProps, Input: Switch });
14
6
  }
15
7
  export {
16
8
  SwitchInput as default
@@ -88,18 +88,12 @@ function DirectoryItemsInput({
88
88
  }
89
89
  if ((selected == null ? void 0 : selected.length) > 0 && (values == null ? void 0 : values.length) > 0) {
90
90
  selected.forEach((chip) => {
91
- remove(
92
- getValues(name).findIndex(
93
- (item) => item.id === chip
94
- )
95
- );
91
+ remove(getValues(name).findIndex((item) => item.id === chip));
96
92
  });
97
93
  }
98
94
  values.forEach((value) => {
99
95
  const { icon, children, ...otherElementAttributes } = value;
100
- if (getValues(name).find(
101
- (v) => (v == null ? void 0 : v.id) === otherElementAttributes.id
102
- ) !== void 0) {
96
+ if (getValues(name).find((v) => (v == null ? void 0 : v.id) === otherElementAttributes.id) !== void 0) {
103
97
  snackError({
104
98
  messageTxt: "",
105
99
  headerId: "directory_items_input/ElementAlreadyUsed"
@@ -113,16 +107,7 @@ function DirectoryItemsInput({
113
107
  setDirectoryItemSelectorOpen(false);
114
108
  setSelected([]);
115
109
  },
116
- [
117
- append,
118
- getValues,
119
- snackError,
120
- name,
121
- onRowChanged,
122
- onChange,
123
- selected,
124
- remove
125
- ]
110
+ [append, getValues, snackError, name, onRowChanged, onChange, selected, remove]
126
111
  );
127
112
  const removeElements = useCallback(
128
113
  (index) => {
@@ -164,11 +149,7 @@ function DirectoryItemsInput({
164
149
  FieldLabel,
165
150
  {
166
151
  label,
167
- optional: labelRequiredFromContext && !isFieldRequired(
168
- name,
169
- validationSchema,
170
- getValues()
171
- )
152
+ optional: labelRequiredFromContext && !isFieldRequired(name, validationSchema, getValues())
172
153
  }
173
154
  ),
174
155
  (elements == null ? void 0 : elements.length) > 0 && /* @__PURE__ */ jsx(FormControl, { sx: styles.formDirectoryElements2, children: elements.map((item, index) => /* @__PURE__ */ jsx(
@@ -180,12 +161,7 @@ function DirectoryItemsInput({
180
161
  label: /* @__PURE__ */ jsx(
181
162
  OverflowableText,
182
163
  {
183
- text: /* @__PURE__ */ jsx(
184
- RawReadOnlyInput,
185
- {
186
- name: `${name}.${index}.${NAME}`
187
- }
188
- ),
164
+ text: /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${name}.${index}.${NAME}` }),
189
165
  sx: { width: "100%" }
190
166
  }
191
167
  )
@@ -6,7 +6,7 @@ export type ErrorMessage = {
6
6
  } | string;
7
7
  export interface ErrorInputProps {
8
8
  name: string;
9
- InputField: ({ message, }: {
9
+ InputField: ({ message }: {
10
10
  message: string | React.ReactNode;
11
11
  }) => React.ReactNode;
12
12
  }
@@ -9,13 +9,7 @@ const CustomFormContext = createContext({
9
9
  language: getSystemLanguage()
10
10
  });
11
11
  function CustomFormProvider(props) {
12
- const {
13
- validationSchema,
14
- removeOptional,
15
- language,
16
- children,
17
- ...formMethods
18
- } = props;
12
+ const { validationSchema, removeOptional, language, children, ...formMethods } = props;
19
13
  return /* @__PURE__ */ jsx(FormProvider, { ...formMethods, children: /* @__PURE__ */ jsx(
20
14
  CustomFormContext.Provider,
21
15
  {
@@ -9,25 +9,15 @@ function RadioInput({ name, label, id, options, formProps }) {
9
9
  } = useController({ name });
10
10
  return /* @__PURE__ */ jsxs(FormControl, { children: [
11
11
  label && /* @__PURE__ */ jsx(FormLabel, { id: id ?? label, children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }),
12
- /* @__PURE__ */ jsx(
13
- RadioGroup,
12
+ /* @__PURE__ */ jsx(RadioGroup, { row: true, "aria-labelledby": id ?? label, value, onChange, ...formProps, children: options.map((option) => /* @__PURE__ */ jsx(
13
+ FormControlLabel,
14
14
  {
15
- row: true,
16
- "aria-labelledby": id ?? label,
17
- value,
18
- onChange,
19
- ...formProps,
20
- children: options.map((option) => /* @__PURE__ */ jsx(
21
- FormControlLabel,
22
- {
23
- control: /* @__PURE__ */ jsx(Radio, {}),
24
- value: option.id,
25
- label: /* @__PURE__ */ jsx(FieldLabel, { label: option.label })
26
- },
27
- option.id
28
- ))
29
- }
30
- )
15
+ control: /* @__PURE__ */ jsx(Radio, {}),
16
+ value: option.id,
17
+ label: /* @__PURE__ */ jsx(FieldLabel, { label: option.label })
18
+ },
19
+ option.id
20
+ )) })
31
21
  ] });
32
22
  }
33
23
  export {
@@ -55,10 +55,7 @@ function RangeInput({ name, label }) {
55
55
  const watchOperationType = useWatch({
56
56
  name: `${name}.${FieldConstants.OPERATION_TYPE}`
57
57
  });
58
- const isOperationTypeRange = useMemo(
59
- () => watchOperationType === RangeType.RANGE.id,
60
- [watchOperationType]
61
- );
58
+ const isOperationTypeRange = useMemo(() => watchOperationType === RangeType.RANGE.id, [watchOperationType]);
62
59
  const firstValueField = /* @__PURE__ */ jsx(
63
60
  FloatInput,
64
61
  {
@@ -25,15 +25,7 @@ function CountriesInput({ name, label }) {
25
25
  getOptionLabel: translateOption,
26
26
  fullWidth: true,
27
27
  multiple: true,
28
- renderTags: (val, getTagsProps) => val.map((code, index) => /* @__PURE__ */ jsx(
29
- Chip,
30
- {
31
- size: "small",
32
- label: translate(code),
33
- ...getTagsProps({ index })
34
- },
35
- code
36
- ))
28
+ renderTags: (val, getTagsProps) => val.map((code, index) => /* @__PURE__ */ jsx(Chip, { size: "small", label: translate(code), ...getTagsProps({ index }) }, code))
37
29
  }
38
30
  );
39
31
  }
@@ -2,24 +2,13 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { FormattedMessage } from "react-intl";
3
3
  import { Select, MenuItem } from "@mui/material";
4
4
  import { useController } from "react-hook-form";
5
- function MuiSelectInput({
6
- name,
7
- options,
8
- ...props
9
- }) {
5
+ function MuiSelectInput({ name, options, ...props }) {
10
6
  const {
11
7
  field: { value, onChange }
12
8
  } = useController({
13
9
  name
14
10
  });
15
- return /* @__PURE__ */ jsx(Select, { value, onChange, ...props, children: options.map((option) => /* @__PURE__ */ jsx(
16
- MenuItem,
17
- {
18
- value: option.id ?? option,
19
- children: /* @__PURE__ */ jsx(FormattedMessage, { id: option.label ?? option })
20
- },
21
- option.id ?? option.label
22
- )) });
11
+ return /* @__PURE__ */ jsx(Select, { value, onChange, ...props, children: options.map((option) => /* @__PURE__ */ jsx(MenuItem, { value: option.id ?? option, children: /* @__PURE__ */ jsx(FormattedMessage, { id: option.label ?? option }) }, option.id ?? option.label)) });
23
12
  }
24
13
  export {
25
14
  MuiSelectInput as default
@@ -9,13 +9,9 @@ function SelectInput(props) {
9
9
  return null;
10
10
  }
11
11
  if (typeof value === "string") {
12
- return options.find(
13
- (option) => typeof option !== "string" && (option == null ? void 0 : option.id) === value
14
- ) || null;
12
+ return options.find((option) => typeof option !== "string" && (option == null ? void 0 : option.id) === value) || null;
15
13
  }
16
- return options.find(
17
- (option) => typeof option !== "string" && (option == null ? void 0 : option.id) === value.id
18
- ) || null;
14
+ return options.find((option) => typeof option !== "string" && (option == null ? void 0 : option.id) === value.id) || null;
19
15
  };
20
16
  const outputTransform = (value) => {
21
17
  if (typeof value === "string") {
@@ -4,5 +4,5 @@ export interface SliderInputProps extends SliderProps {
4
4
  name: string;
5
5
  onValueChanged: (value: any) => void;
6
6
  }
7
- declare function SliderInput({ name, min, max, step, size, onValueChanged, }: SliderInputProps): import("react/jsx-runtime").JSX.Element;
7
+ declare function SliderInput({ name, min, max, step, size, onValueChanged }: SliderInputProps): import("react/jsx-runtime").JSX.Element;
8
8
  export default SliderInput;
@@ -2,14 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Slider } from "@mui/material";
3
3
  import { useController } from "react-hook-form";
4
4
  import { identity } from "./utils/functions.js";
5
- function SliderInput({
6
- name,
7
- min,
8
- max,
9
- step,
10
- size = "small",
11
- onValueChanged = identity
12
- }) {
5
+ function SliderInput({ name, min, max, step, size = "small", onValueChanged = identity }) {
13
6
  const {
14
7
  field: { onChange, value }
15
8
  } = useController({ name });
@@ -17,17 +10,7 @@ function SliderInput({
17
10
  onValueChanged(newValue);
18
11
  onChange(newValue);
19
12
  };
20
- return /* @__PURE__ */ jsx(
21
- Slider,
22
- {
23
- size,
24
- min,
25
- max,
26
- step,
27
- value,
28
- onChange: handleValueChange
29
- }
30
- );
13
+ return /* @__PURE__ */ jsx(Slider, { size, min, max, step, value, onChange: handleValueChange });
31
14
  }
32
15
  export {
33
16
  SliderInput as default
@@ -84,15 +84,7 @@ function UniqueNameInput({
84
84
  message: "nameEmpty"
85
85
  });
86
86
  }
87
- }, [
88
- debouncedHandleCheckName,
89
- setError,
90
- clearErrors,
91
- name,
92
- value,
93
- isDirty,
94
- selectedDirectory
95
- ]);
87
+ }, [debouncedHandleCheckName, setError, clearErrors, name, value, isDirty, selectedDirectory]);
96
88
  const handleManualChange = (e) => {
97
89
  onChange(e.target.value);
98
90
  onManualChangeCallback == null ? void 0 : onManualChangeCallback();
@@ -9,5 +9,5 @@ type FieldLabelProps = {
9
9
  optional?: boolean;
10
10
  values?: any;
11
11
  };
12
- declare function FieldLabel({ label, optional, values, }: FieldLabelProps): import("react/jsx-runtime").JSX.Element;
12
+ declare function FieldLabel({ label, optional, values }: FieldLabelProps): import("react/jsx-runtime").JSX.Element;
13
13
  export default FieldLabel;
@@ -1,10 +1,6 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { FormattedMessage } from "react-intl";
3
- function FieldLabel({
4
- label,
5
- optional = false,
6
- values = void 0
7
- }) {
3
+ function FieldLabel({ label, optional = false, values = void 0 }) {
8
4
  return /* @__PURE__ */ jsxs(Fragment, { children: [
9
5
  /* @__PURE__ */ jsx(FormattedMessage, { id: label, values }),
10
6
  optional && /* @__PURE__ */ jsx(FormattedMessage, { id: "Optional" })
@@ -4,14 +4,7 @@ import { useFormState } from "react-hook-form";
4
4
  import { FormattedMessage } from "react-intl";
5
5
  function SubmitButton({ ...buttonProps }) {
6
6
  const { isDirty } = useFormState();
7
- return /* @__PURE__ */ jsx(
8
- Button,
9
- {
10
- ...buttonProps,
11
- disabled: !isDirty || ((buttonProps == null ? void 0 : buttonProps.disabled) ?? false),
12
- children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" })
13
- }
14
- );
7
+ return /* @__PURE__ */ jsx(Button, { ...buttonProps, disabled: !isDirty || ((buttonProps == null ? void 0 : buttonProps.disabled) ?? false), children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) });
15
8
  }
16
9
  export {
17
10
  SubmitButton as default