@gridsuite/commons-ui 0.132.0 → 0.134.0
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.
- package/dist/components/authentication/utils/authService.js +6 -9
- package/dist/components/checkBoxList/CheckBoxList.js +1 -1
- package/dist/components/checkBoxList/CheckBoxListItem.js +3 -3
- package/dist/components/checkBoxList/CheckBoxListItemContent.js +3 -3
- package/dist/components/checkBoxList/CheckBoxListItems.js +4 -4
- package/dist/components/checkBoxList/DraggableCheckBoxListItem.js +5 -5
- package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.js +1 -1
- package/dist/components/contingencyList/criteriaBased/criteriaBasedUtils.js +7 -7
- package/dist/components/csvDownloader/use-csv-export.js +1 -4
- package/dist/components/customAGGrid/customAggrid.js +2 -2
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +2 -2
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +1 -2
- package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +6 -6
- package/dist/components/dialogs/elementSaveDialog/utils.js +1 -1
- package/dist/components/dialogs/modifyElementSelection/ModifyElementSelection.js +1 -1
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +3 -4
- package/dist/components/dnd-table/dnd-table-bottom-right-buttons.js +2 -3
- package/dist/components/dnd-table/dnd-table.js +7 -7
- package/dist/components/elementSearch/elementItem/EquipmentItem.js +6 -7
- package/dist/components/elementSearch/elementSearchDialog/ElementSearchDialog.js +1 -1
- package/dist/components/elementSearch/tagRenderer/TagRenderer.js +3 -4
- package/dist/components/filter/FilterCreationDialog.js +23 -13
- package/dist/components/filter/FilterForm.js +2 -2
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +13 -6
- package/dist/components/filter/expert/ExpertFilterForm.d.ts +0 -1
- package/dist/components/filter/expert/ExpertFilterForm.js +11 -21
- package/dist/components/filter/expert/expertFilterConstants.d.ts +13 -12
- package/dist/components/filter/expert/expertFilterConstants.js +17 -48
- package/dist/components/filter/expert/expertFilterUtils.js +21 -25
- package/dist/components/filter/expert/index.js +1 -2
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +2 -4
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +11 -18
- package/dist/components/filter/index.js +1 -2
- package/dist/components/filter/utils/filterApi.js +14 -6
- package/dist/components/flatParameters/FlatParameters.js +2 -2
- package/dist/components/index.js +1 -4
- package/dist/components/inputs/SelectClearable.js +1 -1
- package/dist/components/inputs/index.js +0 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +44 -48
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +3 -4
- package/dist/components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.js +1 -1
- package/dist/components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js +4 -4
- package/dist/components/inputs/reactHookForm/chip-items-input.js +3 -3
- package/dist/components/inputs/reactHookForm/errorManagement/ErrorInput.js +1 -2
- package/dist/components/inputs/reactHookForm/index.js +0 -2
- package/dist/components/inputs/reactHookForm/numbers/FloatInput.js +1 -1
- package/dist/components/inputs/reactHookForm/numbers/SliderInput.js +1 -1
- package/dist/components/inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js +2 -2
- package/dist/components/inputs/reactHookForm/selectInputs/SelectInput.js +3 -3
- package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.js +4 -4
- package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.js +3 -3
- package/dist/components/inputs/reactHookForm/text/ExpandingTextField.js +2 -2
- package/dist/components/inputs/reactHookForm/text/TextInput.js +5 -5
- package/dist/components/inputs/reactHookForm/text/UniqueNameInput.js +2 -2
- package/dist/components/inputs/reactHookForm/utils/SubmitButton.js +1 -1
- package/dist/components/inputs/reactHookForm/utils/functions.js +2 -3
- package/dist/components/inputs/reactHookForm/utils/index.d.ts +0 -1
- package/dist/components/inputs/reactHookForm/utils/index.js +0 -2
- package/dist/components/inputs/reactQueryBuilder/OperatorSelector.js +2 -2
- package/dist/components/inputs/reactQueryBuilder/PropertyValueEditor.js +8 -9
- package/dist/components/inputs/reactQueryBuilder/TextValueEditor.js +1 -1
- package/dist/components/inputs/reactQueryBuilder/TranslatedValueEditor.js +1 -1
- package/dist/components/inputs/reactQueryBuilder/ValueEditor.js +2 -3
- package/dist/components/inputs/reactQueryBuilder/compositeRuleEditor/GroupValueEditor.js +12 -15
- package/dist/components/inputs/reactQueryBuilder/compositeRuleEditor/RuleValueEditor.js +3 -4
- package/dist/components/notifications/hooks/useListenerManager.js +2 -4
- package/dist/components/overflowableText/OverflowableText.js +4 -5
- package/dist/components/parameters/common/computing-type.d.ts +2 -1
- package/dist/components/parameters/common/computing-type.js +3 -0
- package/dist/components/parameters/common/limitreductions/columns-definitions.js +1 -1
- package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-content.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-form.js +1 -1
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +3 -3
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +15 -16
- package/dist/components/parameters/network-visualizations/map-parameters.js +13 -17
- package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +1 -2
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +2 -2
- package/dist/components/parameters/network-visualizations/single-line-diagram-parameters.js +2 -3
- package/dist/components/parameters/security-analysis/security-analysis-parameters-form.js +2 -3
- package/dist/components/parameters/security-analysis/security-analysis-parameters-selector.js +3 -3
- package/dist/components/parameters/security-analysis/security-analysis-violations-hiding.js +1 -1
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +5 -5
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-form.js +1 -1
- package/dist/components/parameters/sensi/sensitivity-table.js +2 -3
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +42 -54
- package/dist/components/parameters/sensi/utils.js +16 -27
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +2 -2
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +1 -1
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +47 -56
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +1 -1
- package/dist/components/snackbarProvider/SnackbarProvider.js +1 -4
- package/dist/components/topBar/TopBar.js +33 -36
- package/dist/components/topBar/UserInformationDialog.js +7 -8
- package/dist/components/topBar/UserSettingsDialog.js +1 -1
- package/dist/components/treeViewFinder/TreeViewFinder.js +13 -13
- package/dist/hooks/use-parameters-backend.js +5 -5
- package/dist/hooks/use-unique-name-validation.js +2 -3
- package/dist/hooks/useConfidentialityWarning.js +1 -1
- package/dist/hooks/usePredefinedProperties.js +1 -2
- package/dist/index.js +9 -5
- package/dist/redux/commonStore.js +1 -2
- package/dist/services/businessErrorCode.d.ts +11 -0
- package/dist/services/businessErrorCode.js +10 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +2 -0
- package/dist/services/utils.js +13 -7
- package/dist/translations/en/businessErrorsEn.d.ts +28 -0
- package/dist/translations/en/businessErrorsEn.js +25 -0
- package/dist/translations/en/equipmentsEn.d.ts +1 -0
- package/dist/translations/en/equipmentsEn.js +2 -1
- package/dist/translations/en/index.d.ts +1 -0
- package/dist/translations/en/index.js +2 -0
- package/dist/translations/fr/businessErrorsFr.d.ts +28 -0
- package/dist/translations/fr/businessErrorsFr.js +25 -0
- package/dist/translations/fr/equipmentsFr.d.ts +1 -0
- package/dist/translations/fr/equipmentsFr.js +2 -1
- package/dist/translations/fr/index.d.ts +1 -0
- package/dist/translations/fr/index.js +2 -0
- package/dist/utils/index.js +2 -1
- package/dist/utils/types/equipmentType.d.ts +162 -8
- package/dist/utils/types/equipmentType.js +126 -22
- package/dist/utils/types/index.js +2 -1
- package/package.json +6 -6
- package/dist/components/inputs/reactHookForm/utils/RefreshButton.d.ts +0 -2
- package/dist/components/inputs/reactHookForm/utils/RefreshButton.js +0 -9
package/dist/components/index.js
CHANGED
|
@@ -42,7 +42,7 @@ import { DISTRIBUTION_KEY, FilterType, NO_ITEM_SELECTION_FOR_COPY } from "./filt
|
|
|
42
42
|
import { CriteriaBasedForm } from "./contingencyList/criteriaBased/CriteriaBasedForm.js";
|
|
43
43
|
import { getCriteriaBasedFormData, getCriteriaBasedSchema } from "./contingencyList/criteriaBased/criteriaBasedUtils.js";
|
|
44
44
|
import { ExpertFilterEditionDialog } from "./filter/expert/ExpertFilterEditionDialog.js";
|
|
45
|
-
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData
|
|
45
|
+
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData } from "./filter/expert/ExpertFilterForm.js";
|
|
46
46
|
import { CombinatorType, DataType, OperatorType } from "./filter/expert/expertFilter.type.js";
|
|
47
47
|
import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXPERT_FILTER_EQUIPMENTS, EXPERT_FILTER_FIELDS, EXPERT_FILTER_QUERY, FIELDS_OPTIONS, LOAD_TYPE_OPTIONS, OPERATOR_OPTIONS, PHASE_REGULATION_MODE_OPTIONS, RATIO_REGULATION_MODE_OPTIONS, REGULATION_TYPE_OPTIONS, RULES, SHUNT_COMPENSATOR_TYPE_OPTIONS, SVAR_REGULATION_MODE_OPTIONS } from "./filter/expert/expertFilterConstants.js";
|
|
48
48
|
import { countRules, exportExpertRules, getFilterEquipmentTypeLabel, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./filter/expert/expertFilterUtils.js";
|
|
@@ -92,7 +92,6 @@ import { UniqueNameInput } from "./inputs/reactHookForm/text/UniqueNameInput.js"
|
|
|
92
92
|
import { CancelButton } from "./inputs/reactHookForm/utils/CancelButton.js";
|
|
93
93
|
import { FieldLabel } from "./inputs/reactHookForm/utils/FieldLabel.js";
|
|
94
94
|
import { SubmitButton } from "./inputs/reactHookForm/utils/SubmitButton.js";
|
|
95
|
-
import { RefreshButton } from "./inputs/reactHookForm/utils/RefreshButton.js";
|
|
96
95
|
import { TextFieldWithAdornment } from "./inputs/reactHookForm/utils/TextFieldWithAdornment.js";
|
|
97
96
|
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./inputs/reactHookForm/utils/functions.js";
|
|
98
97
|
import { HelperPreviousValue } from "./inputs/reactHookForm/utils/HelperPreviousValue.js";
|
|
@@ -397,7 +396,6 @@ export {
|
|
|
397
396
|
RangeType,
|
|
398
397
|
RawReadOnlyInput,
|
|
399
398
|
ReactivePowerAdornment,
|
|
400
|
-
RefreshButton,
|
|
401
399
|
RemoveButton,
|
|
402
400
|
RuleValueEditor,
|
|
403
401
|
SELECTED,
|
|
@@ -516,7 +514,6 @@ export {
|
|
|
516
514
|
logout,
|
|
517
515
|
queryValidator,
|
|
518
516
|
recursiveRemove,
|
|
519
|
-
rqbQuerySchemaValidator,
|
|
520
517
|
sanitizePercentageValue,
|
|
521
518
|
saveExpertFilter,
|
|
522
519
|
saveExplicitNamingFilter,
|
|
@@ -9,7 +9,7 @@ function SelectClearable(props) {
|
|
|
9
9
|
return value && options.find((option) => option.id === inputValue) || null;
|
|
10
10
|
};
|
|
11
11
|
const outputTransform = (option) => {
|
|
12
|
-
return
|
|
12
|
+
return option?.id ?? null;
|
|
13
13
|
};
|
|
14
14
|
return /* @__PURE__ */ jsx(
|
|
15
15
|
Autocomplete,
|
|
@@ -35,7 +35,6 @@ import { UniqueNameInput } from "./reactHookForm/text/UniqueNameInput.js";
|
|
|
35
35
|
import { CancelButton } from "./reactHookForm/utils/CancelButton.js";
|
|
36
36
|
import { FieldLabel } from "./reactHookForm/utils/FieldLabel.js";
|
|
37
37
|
import { SubmitButton } from "./reactHookForm/utils/SubmitButton.js";
|
|
38
|
-
import { RefreshButton } from "./reactHookForm/utils/RefreshButton.js";
|
|
39
38
|
import { TextFieldWithAdornment } from "./reactHookForm/utils/TextFieldWithAdornment.js";
|
|
40
39
|
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./reactHookForm/utils/functions.js";
|
|
41
40
|
import { HelperPreviousValue } from "./reactHookForm/utils/HelperPreviousValue.js";
|
|
@@ -99,7 +98,6 @@ export {
|
|
|
99
98
|
RangeInput,
|
|
100
99
|
RangeType,
|
|
101
100
|
RawReadOnlyInput,
|
|
102
|
-
RefreshButton,
|
|
103
101
|
RemoveButton,
|
|
104
102
|
RuleValueEditor,
|
|
105
103
|
SelectClearable,
|
|
@@ -97,22 +97,22 @@ function DirectoryItemsInput({
|
|
|
97
97
|
if (!values) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
100
|
+
if (selected?.length > 0 && values?.length > 0) {
|
|
101
101
|
selected.forEach((chip) => {
|
|
102
102
|
remove(getValues(name).findIndex((item) => item.id === chip));
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
values.forEach((value) => {
|
|
106
106
|
const { icon, children, ...otherElementAttributes } = value;
|
|
107
|
-
if (getValues(name).find((v) =>
|
|
107
|
+
if (getValues(name).find((v) => v?.id === otherElementAttributes.id) !== void 0) {
|
|
108
108
|
snackError({
|
|
109
109
|
messageTxt: "",
|
|
110
110
|
headerId: "directory_items_input/ElementAlreadyUsed"
|
|
111
111
|
});
|
|
112
112
|
} else {
|
|
113
113
|
append(otherElementAttributes);
|
|
114
|
-
onRowChanged
|
|
115
|
-
onChange
|
|
114
|
+
onRowChanged?.(true);
|
|
115
|
+
onChange?.(getValues(name), ArrayAction.ADD, otherElementAttributes);
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
setDirectoryItemSelectorOpen(false);
|
|
@@ -124,16 +124,15 @@ function DirectoryItemsInput({
|
|
|
124
124
|
(index) => {
|
|
125
125
|
const currentValues = getValues(name);
|
|
126
126
|
remove(index);
|
|
127
|
-
onRowChanged
|
|
128
|
-
onChange
|
|
127
|
+
onRowChanged?.(true);
|
|
128
|
+
onChange?.(currentValues, ArrayAction.REMOVE, currentValues[index]);
|
|
129
129
|
},
|
|
130
130
|
[onRowChanged, remove, getValues, name, onChange]
|
|
131
131
|
);
|
|
132
132
|
const handleChipClick = useCallback(
|
|
133
133
|
(index) => {
|
|
134
|
-
var _a;
|
|
135
134
|
const chips = getValues(name);
|
|
136
|
-
const chip =
|
|
135
|
+
const chip = chips.at(index)?.id;
|
|
137
136
|
if (chip) {
|
|
138
137
|
fetchDirectoryElementPath(chip).then((response) => {
|
|
139
138
|
const path = response.filter((e) => e.elementUuid !== chip).map((e) => e.elementUuid);
|
|
@@ -147,7 +146,7 @@ function DirectoryItemsInput({
|
|
|
147
146
|
[getValues, name]
|
|
148
147
|
);
|
|
149
148
|
const shouldReplaceElement = useMemo(() => {
|
|
150
|
-
return allowMultiSelect === false &&
|
|
149
|
+
return allowMultiSelect === false && elements?.length === 1;
|
|
151
150
|
}, [allowMultiSelect, elements]);
|
|
152
151
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
153
152
|
/* @__PURE__ */ jsxs(
|
|
@@ -156,53 +155,50 @@ function DirectoryItemsInput({
|
|
|
156
155
|
sx: mergeSx(
|
|
157
156
|
styles.formDirectoryElements1,
|
|
158
157
|
// @ts-expect-error
|
|
159
|
-
|
|
158
|
+
error?.message && styles.formDirectoryElementsError
|
|
160
159
|
),
|
|
161
|
-
error: !!
|
|
160
|
+
error: !!error?.message,
|
|
162
161
|
children: [
|
|
163
|
-
|
|
162
|
+
elements?.length === 0 && label && /* @__PURE__ */ jsx(
|
|
164
163
|
FieldLabel,
|
|
165
164
|
{
|
|
166
165
|
label,
|
|
167
166
|
optional: labelRequiredFromContext && !isFieldRequired(name, validationSchema, getValues())
|
|
168
167
|
}
|
|
169
168
|
),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
{
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
item.id
|
|
204
|
-
);
|
|
205
|
-
}) }),
|
|
169
|
+
elements?.length > 0 && /* @__PURE__ */ jsx(FormControl, { sx: styles.formDirectoryElements2, children: elements.map((item, index) => /* @__PURE__ */ jsxs(
|
|
170
|
+
Box,
|
|
171
|
+
{
|
|
172
|
+
sx: { display: "flex", alignItems: "center", flexDirection: "column", gap: 1 },
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ jsx(
|
|
175
|
+
Chip,
|
|
176
|
+
{
|
|
177
|
+
size: "small",
|
|
178
|
+
sx: {
|
|
179
|
+
backgroundColor: item?.specificMetadata?.equipmentType && equipmentColorsMap?.get(item?.specificMetadata?.equipmentType)
|
|
180
|
+
},
|
|
181
|
+
onDelete: () => removeElements(index),
|
|
182
|
+
onClick: () => handleChipClick(index),
|
|
183
|
+
label: /* @__PURE__ */ jsx(
|
|
184
|
+
OverflowableText,
|
|
185
|
+
{
|
|
186
|
+
text: getValues(`${name}.${index}.${NAME}`) ? /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${name}.${index}.${NAME}` }) : intl.formatMessage({ id: "elementNotFound" }),
|
|
187
|
+
sx: { width: "100%" }
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
equipmentColorsMap && /* @__PURE__ */ jsx(FormHelperText, { children: item?.specificMetadata?.equipmentType ? /* @__PURE__ */ jsx(
|
|
193
|
+
FormattedMessage,
|
|
194
|
+
{
|
|
195
|
+
id: getFilterEquipmentTypeLabel(item.specificMetadata.equipmentType)
|
|
196
|
+
}
|
|
197
|
+
) : "" })
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
item.id
|
|
201
|
+
)) }),
|
|
206
202
|
/* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(Grid, { container: true, direction: "row-reverse", children: /* @__PURE__ */ jsx(Tooltip, { title: intl.formatMessage({ id: titleId }), children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
207
203
|
IconButton,
|
|
208
204
|
{
|
|
@@ -72,7 +72,6 @@ function CustomAgGridTable({
|
|
|
72
72
|
rowSelection,
|
|
73
73
|
...props
|
|
74
74
|
}) {
|
|
75
|
-
var _a, _b;
|
|
76
75
|
const theme = useTheme();
|
|
77
76
|
const [gridApi, setGridApi] = useState(null);
|
|
78
77
|
const [selectedRows, setSelectedRows] = useState([]);
|
|
@@ -86,10 +85,10 @@ function CustomAgGridTable({
|
|
|
86
85
|
const { append, remove, update, swap, move } = useFieldArrayOutput;
|
|
87
86
|
const rowData = watch(name);
|
|
88
87
|
const isFirstSelected = Boolean(
|
|
89
|
-
|
|
88
|
+
rowData?.length && gridApi?.api.getRowNode(rowData[0][FieldConstants.AG_GRID_ROW_UUID])?.isSelected()
|
|
90
89
|
);
|
|
91
90
|
const isLastSelected = Boolean(
|
|
92
|
-
|
|
91
|
+
rowData?.length && gridApi?.api.getRowNode(rowData[rowData.length - 1][FieldConstants.AG_GRID_ROW_UUID])?.isSelected()
|
|
93
92
|
);
|
|
94
93
|
const noRowSelected = selectedRows.length === 0;
|
|
95
94
|
const getIndex = useCallback(
|
|
@@ -136,7 +135,7 @@ function CustomAgGridTable({
|
|
|
136
135
|
};
|
|
137
136
|
const onRowDataUpdated = () => {
|
|
138
137
|
setNewRowAdded(false);
|
|
139
|
-
if (gridApi
|
|
138
|
+
if (gridApi?.api) {
|
|
140
139
|
const lastIndex = rowData.length - 1;
|
|
141
140
|
gridApi.api.paginationGoToLastPage();
|
|
142
141
|
gridApi.api.ensureIndexVisible(lastIndex, "bottom");
|
|
@@ -62,7 +62,7 @@ function CsvUploader({
|
|
|
62
62
|
if (row[0].startsWith("#")) {
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
|
-
return row.some((column) => !!
|
|
65
|
+
return row.some((column) => !!column?.trim());
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
68
|
const handleFileSubmit = (keepTableValues) => {
|
|
@@ -34,13 +34,13 @@ function AutocompleteInput({
|
|
|
34
34
|
} = useController({ name });
|
|
35
35
|
const handleChange = (newValue) => {
|
|
36
36
|
const currentValue = getValues(name);
|
|
37
|
-
if (
|
|
37
|
+
if (currentValue?.id === newValue) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
if (onCheckNewValue && !onCheckNewValue(newValue)) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
onChangeCallback
|
|
43
|
+
onChangeCallback?.();
|
|
44
44
|
if (!allowNewValue || typeof newValue !== "string") {
|
|
45
45
|
onChange(outputTransform(newValue));
|
|
46
46
|
return;
|
|
@@ -74,7 +74,7 @@ function AutocompleteInput({
|
|
|
74
74
|
...label && {
|
|
75
75
|
label: FieldLabel({
|
|
76
76
|
label,
|
|
77
|
-
optional: !isFieldRequired(name, validationSchema, getValues()) && !
|
|
77
|
+
optional: !isFieldRequired(name, validationSchema, getValues()) && !props?.disabled && !removeOptional
|
|
78
78
|
})
|
|
79
79
|
},
|
|
80
80
|
inputRef: ref,
|
|
@@ -87,7 +87,7 @@ function AutocompleteInput({
|
|
|
87
87
|
disabledTooltip: disabledTooltip || !isUpdate && isNodeBuilt
|
|
88
88
|
}
|
|
89
89
|
),
|
|
90
|
-
...genHelperError(error
|
|
90
|
+
...genHelperError(error?.message),
|
|
91
91
|
...formProps,
|
|
92
92
|
...rest
|
|
93
93
|
}
|
|
@@ -83,15 +83,15 @@ function ChipItemsInput({ label, name, hideErrorMessage }) {
|
|
|
83
83
|
const handleChange = (e) => {
|
|
84
84
|
setTextEntered(e.target.value);
|
|
85
85
|
};
|
|
86
|
-
const hasError = !!
|
|
86
|
+
const hasError = !!error?.message;
|
|
87
87
|
const containerStyle = useMemo(
|
|
88
88
|
() => ({ ...styles.chipContainer, borderColor: hasError ? "error.main" : null }),
|
|
89
89
|
[hasError]
|
|
90
90
|
);
|
|
91
91
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
92
92
|
/* @__PURE__ */ jsxs(FormControl, { sx: containerStyle, error: hasError, children: [
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
elements?.length === 0 && label && /* @__PURE__ */ jsx(FieldLabel, { label, optional: !isFieldRequired(name, validationSchema, getValues()) }),
|
|
94
|
+
elements?.length > 0 && /* @__PURE__ */ jsx(FormControl, { sx: styles.chipItem, children: elements.map((item, index) => /* @__PURE__ */ jsx(
|
|
95
95
|
Chip,
|
|
96
96
|
{
|
|
97
97
|
size: "small",
|
|
@@ -3,7 +3,6 @@ import { useRef, useEffect } from "react";
|
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
4
|
import { useController } from "react-hook-form";
|
|
5
5
|
function ErrorInput({ name, InputField }) {
|
|
6
|
-
var _a;
|
|
7
6
|
const {
|
|
8
7
|
fieldState: { error },
|
|
9
8
|
formState: { isSubmitting }
|
|
@@ -32,7 +31,7 @@ function ErrorInput({ name, InputField }) {
|
|
|
32
31
|
errorRef.current.scrollIntoView({ behavior: "smooth" });
|
|
33
32
|
}
|
|
34
33
|
}, [isSubmitting]);
|
|
35
|
-
const errorMsg =
|
|
34
|
+
const errorMsg = error?.message || error?.root?.message;
|
|
36
35
|
return errorMsg && /* @__PURE__ */ jsx("div", { ref: errorRef, children: InputField({
|
|
37
36
|
message: /* @__PURE__ */ jsx(FormattedMessage, { ...errorProps(errorMsg) })
|
|
38
37
|
}) });
|
|
@@ -34,7 +34,6 @@ import { UniqueNameInput } from "./text/UniqueNameInput.js";
|
|
|
34
34
|
import { CancelButton } from "./utils/CancelButton.js";
|
|
35
35
|
import { FieldLabel } from "./utils/FieldLabel.js";
|
|
36
36
|
import { SubmitButton } from "./utils/SubmitButton.js";
|
|
37
|
-
import { RefreshButton } from "./utils/RefreshButton.js";
|
|
38
37
|
import { TextFieldWithAdornment } from "./utils/TextFieldWithAdornment.js";
|
|
39
38
|
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./utils/functions.js";
|
|
40
39
|
import { HelperPreviousValue } from "./utils/HelperPreviousValue.js";
|
|
@@ -72,7 +71,6 @@ export {
|
|
|
72
71
|
RangeInput,
|
|
73
72
|
RangeType,
|
|
74
73
|
RawReadOnlyInput,
|
|
75
|
-
RefreshButton,
|
|
76
74
|
SelectInput,
|
|
77
75
|
SliderInput,
|
|
78
76
|
SubmitButton,
|
|
@@ -27,7 +27,7 @@ function FloatInput(props) {
|
|
|
27
27
|
if (value === "") {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
-
const tmp =
|
|
30
|
+
const tmp = value?.replace(",", ".") || "";
|
|
31
31
|
if (tmp.endsWith(".") || tmp.includes(".") && tmp.endsWith("0")) {
|
|
32
32
|
return tmp;
|
|
33
33
|
}
|
|
@@ -18,7 +18,7 @@ function SliderInput({
|
|
|
18
18
|
field: { onChange, value }
|
|
19
19
|
} = useController({ name });
|
|
20
20
|
const handleValueChange = (event, newValue, activeThumb) => {
|
|
21
|
-
onValueChanged
|
|
21
|
+
onValueChanged?.(newValue);
|
|
22
22
|
onChange(newValue);
|
|
23
23
|
};
|
|
24
24
|
return /* @__PURE__ */ jsx(
|
|
@@ -29,7 +29,7 @@ function InputWithPopupConfirmation({
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
const handlePopupConfirmation = () => {
|
|
32
|
-
resetOnConfirmation
|
|
32
|
+
resetOnConfirmation?.();
|
|
33
33
|
onChange(newValue);
|
|
34
34
|
setOpenPopup(false);
|
|
35
35
|
};
|
|
@@ -40,7 +40,7 @@ function InputWithPopupConfirmation({
|
|
|
40
40
|
name,
|
|
41
41
|
...props,
|
|
42
42
|
onChange: (e, value) => {
|
|
43
|
-
handleOnChange(e,
|
|
43
|
+
handleOnChange(e, value?.id ?? value);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
),
|
|
@@ -11,15 +11,15 @@ function SelectInput(props) {
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
if (typeof value === "string") {
|
|
14
|
-
return options.find((option) => typeof option !== "string" &&
|
|
14
|
+
return options.find((option) => typeof option !== "string" && option?.id === value) || null;
|
|
15
15
|
}
|
|
16
|
-
return options.find((option) => typeof option !== "string" &&
|
|
16
|
+
return options.find((option) => typeof option !== "string" && option?.id === value.id) || null;
|
|
17
17
|
};
|
|
18
18
|
const outputTransform = (value) => {
|
|
19
19
|
if (typeof value === "string") {
|
|
20
20
|
return value;
|
|
21
21
|
}
|
|
22
|
-
return
|
|
22
|
+
return value?.id ?? null;
|
|
23
23
|
};
|
|
24
24
|
const getOptionLabel = (option) => {
|
|
25
25
|
if (typeof option === "string") {
|
|
@@ -46,7 +46,7 @@ function TableNumericalInput({
|
|
|
46
46
|
if (str === "") {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
-
const tmp =
|
|
49
|
+
const tmp = str?.replace(",", ".") || "";
|
|
50
50
|
if (tmp.endsWith(".") || tmp.endsWith("0")) {
|
|
51
51
|
return str;
|
|
52
52
|
}
|
|
@@ -67,13 +67,13 @@ function TableNumericalInput({
|
|
|
67
67
|
{
|
|
68
68
|
value: transformedValue,
|
|
69
69
|
onChange: handleInputChange,
|
|
70
|
-
error: !!
|
|
70
|
+
error: !!error?.message,
|
|
71
71
|
size: "small",
|
|
72
72
|
fullWidth: true,
|
|
73
73
|
inputRef: ref,
|
|
74
74
|
InputProps: {
|
|
75
75
|
endAdornment: /* @__PURE__ */ jsxs(InputAdornment, { position: "end", children: [
|
|
76
|
-
transformedValue &&
|
|
76
|
+
transformedValue && adornment?.text,
|
|
77
77
|
clearable && /* @__PURE__ */ jsx(
|
|
78
78
|
IconButton,
|
|
79
79
|
{
|
|
@@ -92,7 +92,7 @@ function TableNumericalInput({
|
|
|
92
92
|
fontSize: "small",
|
|
93
93
|
color: previousValue !== void 0 && previousValue === parseFloat(value) && !valueModified ? "grey" : void 0,
|
|
94
94
|
// grey out the value if it is the same as the previous one
|
|
95
|
-
textAlign:
|
|
95
|
+
textAlign: style?.textAlign ?? "left"
|
|
96
96
|
},
|
|
97
97
|
inputMode: "numeric",
|
|
98
98
|
pattern: "[0-9]*",
|
|
@@ -9,7 +9,7 @@ function TableTextInput({ name, showErrorMsg, inputProps, ...props }) {
|
|
|
9
9
|
} = useController({ name });
|
|
10
10
|
const intl = useIntl();
|
|
11
11
|
const outputTransform = (str) => {
|
|
12
|
-
return
|
|
12
|
+
return str?.trim() === "" ? "" : str;
|
|
13
13
|
};
|
|
14
14
|
const handleInputChange = (e) => {
|
|
15
15
|
onChange(outputTransform(e.target.value));
|
|
@@ -19,8 +19,8 @@ function TableTextInput({ name, showErrorMsg, inputProps, ...props }) {
|
|
|
19
19
|
{
|
|
20
20
|
value,
|
|
21
21
|
onChange: handleInputChange,
|
|
22
|
-
error: !!
|
|
23
|
-
helperText: showErrorMsg && (
|
|
22
|
+
error: !!error?.message,
|
|
23
|
+
helperText: showErrorMsg && (error?.message ? intl.formatMessage({ id: error.message }) : ""),
|
|
24
24
|
size: "small",
|
|
25
25
|
fullWidth: true,
|
|
26
26
|
inputRef: ref,
|
|
@@ -23,8 +23,8 @@ function ExpandingTextField({
|
|
|
23
23
|
const handleBlur = () => {
|
|
24
24
|
setIsFocused(false);
|
|
25
25
|
};
|
|
26
|
-
const isOverTheLimit =
|
|
27
|
-
const descriptionLength =
|
|
26
|
+
const isOverTheLimit = descriptionWatch?.length > maxCharactersNumber;
|
|
27
|
+
const descriptionLength = descriptionWatch?.length ?? 0;
|
|
28
28
|
const descriptionCounter = `${descriptionLength}/${maxCharactersNumber}`;
|
|
29
29
|
const rowsToDisplay = isFocused ? rows : minRows;
|
|
30
30
|
const formProps = {
|
|
@@ -35,8 +35,8 @@ function TextInput({
|
|
|
35
35
|
} = useController({ name });
|
|
36
36
|
const Field = adornment ? TextFieldWithAdornment : TextField;
|
|
37
37
|
const finalAdornment = {
|
|
38
|
-
adornmentPosition:
|
|
39
|
-
adornmentText:
|
|
38
|
+
adornmentPosition: adornment?.position ?? "",
|
|
39
|
+
adornmentText: adornment?.text ?? ""
|
|
40
40
|
};
|
|
41
41
|
const handleClearValue = () => {
|
|
42
42
|
onChange(outputTransform(""));
|
|
@@ -50,7 +50,7 @@ function TextInput({
|
|
|
50
50
|
const fieldLabel = !label ? null : FieldLabel({
|
|
51
51
|
label,
|
|
52
52
|
values: labelValues,
|
|
53
|
-
optional: !isFieldRequired(name, validationSchema, getValues()) && !
|
|
53
|
+
optional: !isFieldRequired(name, validationSchema, getValues()) && !formProps?.disabled && !removeOptional
|
|
54
54
|
});
|
|
55
55
|
return /* @__PURE__ */ jsx(
|
|
56
56
|
Field,
|
|
@@ -78,10 +78,10 @@ function TextInput({
|
|
|
78
78
|
previousValue,
|
|
79
79
|
isNodeBuilt,
|
|
80
80
|
disabledTooltip: disabledTooltip || !isUpdate && isNodeBuilt,
|
|
81
|
-
adornmentText: adornment
|
|
81
|
+
adornmentText: adornment?.text
|
|
82
82
|
}
|
|
83
83
|
),
|
|
84
|
-
...genHelperError(error
|
|
84
|
+
...genHelperError(error?.message),
|
|
85
85
|
...formProps,
|
|
86
86
|
...adornment && { ...finalAdornment }
|
|
87
87
|
},
|
|
@@ -32,11 +32,11 @@ function UniqueNameInput({
|
|
|
32
32
|
});
|
|
33
33
|
const handleManualChange = (e) => {
|
|
34
34
|
onChange(e.target.value);
|
|
35
|
-
onManualChangeCallback
|
|
35
|
+
onManualChangeCallback?.();
|
|
36
36
|
};
|
|
37
37
|
const translatedLabel = /* @__PURE__ */ jsx(FormattedMessage, { id: label });
|
|
38
38
|
const translatedError = error && /* @__PURE__ */ jsx(FormattedMessage, { id: error.message });
|
|
39
|
-
const showOk =
|
|
39
|
+
const showOk = value?.trim() && !isValidating && !error;
|
|
40
40
|
const endAdornment = /* @__PURE__ */ jsxs(InputAdornment, { position: "end", children: [
|
|
41
41
|
isValidating && /* @__PURE__ */ jsx(CircularProgress, { size: "1rem" }),
|
|
42
42
|
showOk && /* @__PURE__ */ jsx(Check, { style: { color: "green" } })
|
|
@@ -4,7 +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(Button, { ...buttonProps, disabled: !isDirty || (
|
|
7
|
+
return /* @__PURE__ */ jsx(Button, { ...buttonProps, disabled: !isDirty || (buttonProps?.disabled ?? false), children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) });
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
10
10
|
SubmitButton
|
|
@@ -16,9 +16,8 @@ function identity(x) {
|
|
|
16
16
|
return x;
|
|
17
17
|
}
|
|
18
18
|
const isFieldRequired = (fieldName, schema, values) => {
|
|
19
|
-
var _a;
|
|
20
19
|
const { schema: fieldSchema, parent: parentValues } = getIn(schema, fieldName, values) || {};
|
|
21
|
-
return
|
|
20
|
+
return fieldSchema.describe({ parent: parentValues })?.optional === false;
|
|
22
21
|
};
|
|
23
22
|
const gridItem = (field, size = 6) => {
|
|
24
23
|
return /* @__PURE__ */ jsx(Grid, { item: true, xs: size, alignItems: "start", children: field });
|
|
@@ -30,7 +29,7 @@ const toFloatOrNullValue = (value) => {
|
|
|
30
29
|
if (value === "0") {
|
|
31
30
|
return 0;
|
|
32
31
|
}
|
|
33
|
-
const tmp =
|
|
32
|
+
const tmp = value?.replace(",", ".") || "";
|
|
34
33
|
return parseFloat(tmp) || null;
|
|
35
34
|
};
|
|
36
35
|
export {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CancelButton } from "./CancelButton.js";
|
|
2
2
|
import { FieldLabel } from "./FieldLabel.js";
|
|
3
3
|
import { SubmitButton } from "./SubmitButton.js";
|
|
4
|
-
import { RefreshButton } from "./RefreshButton.js";
|
|
5
4
|
import { TextFieldWithAdornment } from "./TextFieldWithAdornment.js";
|
|
6
5
|
import { genHelperError, gridItem, identity, isFieldRequired, toFloatOrNullValue } from "./functions.js";
|
|
7
6
|
import { HelperPreviousValue } from "./HelperPreviousValue.js";
|
|
@@ -9,7 +8,6 @@ export {
|
|
|
9
8
|
CancelButton,
|
|
10
9
|
FieldLabel,
|
|
11
10
|
HelperPreviousValue,
|
|
12
|
-
RefreshButton,
|
|
13
11
|
SubmitButton,
|
|
14
12
|
TextFieldWithAdornment,
|
|
15
13
|
genHelperError,
|
|
@@ -15,8 +15,8 @@ import { useSelectAppearance } from "../../../hooks/useSelectAppearance.js";
|
|
|
15
15
|
import "react-hook-form";
|
|
16
16
|
function OperatorSelector(props) {
|
|
17
17
|
const { options } = props;
|
|
18
|
-
const selectAppearance = useSelectAppearance(
|
|
19
|
-
if (!
|
|
18
|
+
const selectAppearance = useSelectAppearance(options?.length || 0);
|
|
19
|
+
if (!options?.length) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
return /* @__PURE__ */ jsx(MaterialValueSelector, { ...props, ...selectAppearance, sx: { border: "none" } });
|