@gridsuite/commons-ui 0.107.1 → 0.109.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/dialogs/elementSaveDialog/ElementSaveDialog.js +10 -10
- package/dist/components/dnd-table/dnd-table-add-rows-dialog.d.ts +13 -0
- package/dist/components/dnd-table/dnd-table-add-rows-dialog.js +69 -0
- package/dist/components/dnd-table/dnd-table-bottom-left-buttons.d.ts +17 -0
- package/dist/components/dnd-table/dnd-table-bottom-left-buttons.js +48 -0
- package/dist/components/dnd-table/dnd-table-bottom-right-buttons.d.ts +17 -0
- package/dist/components/dnd-table/dnd-table-bottom-right-buttons.js +104 -0
- package/dist/components/dnd-table/dnd-table.d.ts +28 -0
- package/dist/components/dnd-table/dnd-table.js +394 -0
- package/dist/components/dnd-table/dnd-table.type.d.ts +51 -0
- package/dist/components/dnd-table/dnd-table.type.js +16 -0
- package/dist/components/dnd-table/index.d.ts +11 -0
- package/dist/components/dnd-table/index.js +14 -0
- package/dist/components/filter/HeaderFilterForm.js +4 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +60 -4
- package/dist/components/inputs/index.js +6 -0
- package/dist/components/inputs/reactHookForm/chip-items-input.d.ts +13 -0
- package/dist/components/inputs/reactHookForm/chip-items-input.js +129 -0
- package/dist/components/inputs/reactHookForm/index.d.ts +2 -0
- package/dist/components/inputs/reactHookForm/index.js +6 -0
- package/dist/components/inputs/reactHookForm/tableInputs/index.d.ts +8 -0
- package/dist/components/inputs/reactHookForm/tableInputs/index.js +6 -0
- package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.d.ts +12 -0
- package/dist/components/inputs/reactHookForm/tableInputs/table-numerical-input.js +110 -0
- package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.d.ts +8 -0
- package/dist/components/inputs/reactHookForm/tableInputs/table-text-input.js +43 -0
- package/dist/components/parameters/common/ProviderParam.js +6 -6
- package/dist/components/parameters/common/constant.d.ts +8 -0
- package/dist/components/parameters/common/constant.js +12 -1
- package/dist/components/parameters/common/index.js +3 -1
- package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +7 -7
- package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +6 -6
- package/dist/components/parameters/common/name-element-editor/name-element-editor-form.js +8 -8
- package/dist/components/parameters/common/name-element-editor/name-element-editor-utils.js +11 -10
- package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +7 -7
- package/dist/components/parameters/common/widget/parameter-float.js +6 -6
- package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +11 -10
- package/dist/components/parameters/common/widget/parameter-line-slider.js +6 -6
- package/dist/components/parameters/index.d.ts +1 -0
- package/dist/components/parameters/index.js +42 -4
- package/dist/components/parameters/loadflow/constants.d.ts +0 -1
- package/dist/components/parameters/loadflow/constants.js +0 -2
- package/dist/components/parameters/loadflow/index.js +1 -2
- package/dist/components/parameters/loadflow/load-flow-general-parameters.js +7 -12
- package/dist/components/parameters/loadflow/load-flow-parameter-field.js +6 -6
- package/dist/components/parameters/loadflow/load-flow-parameters-form.js +6 -6
- package/dist/components/parameters/loadflow/load-flow-parameters-header.js +6 -6
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +48 -12
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +0 -4
- package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +1 -2
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +2 -1
- package/dist/components/parameters/network-visualizations/constants.js +5 -1
- package/dist/components/parameters/network-visualizations/index.js +2 -1
- package/dist/components/parameters/network-visualizations/network-area-diagram-parameters.js +6 -6
- package/dist/components/parameters/network-visualizations/network-visualizations-form.js +7 -7
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-dialog.js +3 -3
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +2 -2
- package/dist/components/parameters/network-visualizations/network-visualizations.types.d.ts +2 -1
- package/dist/components/parameters/network-visualizations/network-visualizations.types.js +2 -0
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +12 -11
- package/dist/components/parameters/short-circuit/short-circuit-fields.js +5 -5
- package/dist/components/parameters/short-circuit/short-circuit-parameters-dialog.js +3 -3
- package/dist/components/parameters/short-circuit/short-circuit-parameters-form.js +6 -6
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +2 -2
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +11 -10
- package/dist/components/parameters/voltage-init/constants.d.ts +39 -0
- package/dist/components/parameters/voltage-init/constants.js +65 -0
- package/dist/components/parameters/voltage-init/equipment-selection-parameters.d.ts +7 -0
- package/dist/components/parameters/voltage-init/equipment-selection-parameters.js +119 -0
- package/dist/components/parameters/voltage-init/general-parameters.d.ts +4 -0
- package/dist/components/parameters/voltage-init/general-parameters.js +112 -0
- package/dist/components/parameters/voltage-init/index.d.ts +10 -0
- package/dist/components/parameters/voltage-init/index.js +38 -0
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.d.ts +32 -0
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +218 -0
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.d.ts +4 -0
- package/dist/components/parameters/voltage-init/voltage-init-form-utils.js +220 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.d.ts +2 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-dialog.js +97 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.d.ts +30 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-form.js +150 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.d.ts +8 -0
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +173 -0
- package/dist/components/parameters/voltage-init/voltage-init.type.d.ts +33 -0
- package/dist/components/parameters/voltage-init/voltage-init.type.js +8 -0
- package/dist/components/parameters/voltage-init/voltage-limits-parameters.d.ts +7 -0
- package/dist/components/parameters/voltage-init/voltage-limits-parameters.js +188 -0
- package/dist/index.js +72 -5
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +6 -2
- package/dist/services/study.d.ts +2 -0
- package/dist/services/study.js +15 -1
- package/dist/services/voltage-init.d.ts +4 -0
- package/dist/services/voltage-init.js +14 -0
- package/dist/translations/en/dndTableEn.d.ts +16 -0
- package/dist/translations/en/dndTableEn.js +13 -0
- package/dist/translations/en/index.d.ts +1 -0
- package/dist/translations/en/index.js +2 -0
- package/dist/translations/en/networkModificationsEn.js +12 -12
- package/dist/translations/en/parameters.d.ts +32 -1
- package/dist/translations/en/parameters.js +33 -2
- package/dist/translations/fr/dndTableFr.d.ts +16 -0
- package/dist/translations/fr/dndTableFr.js +13 -0
- package/dist/translations/fr/index.d.ts +1 -0
- package/dist/translations/fr/index.js +2 -0
- package/dist/translations/fr/networkModificationsFr.js +12 -12
- package/dist/translations/fr/parameters.d.ts +33 -1
- package/dist/translations/fr/parameters.js +34 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/validation-functions.d.ts +8 -0
- package/dist/utils/validation-functions.js +23 -0
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -22,6 +22,11 @@ import { ElementSaveDialog } from "./dialogs/elementSaveDialog/ElementSaveDialog
|
|
|
22
22
|
import { ModifyElementSelection } from "./dialogs/modifyElementSelection/ModifyElementSelection.js";
|
|
23
23
|
import { PopupConfirmationDialog } from "./dialogs/popupConfirmationDialog/PopupConfirmationDialog.js";
|
|
24
24
|
import { DirectoryItemSelector } from "./directoryItemSelector/DirectoryItemSelector.js";
|
|
25
|
+
import { DndTable } from "./dnd-table/dnd-table.js";
|
|
26
|
+
import { DndColumnType, MAX_ROWS_NUMBER, SELECTED } from "./dnd-table/dnd-table.type.js";
|
|
27
|
+
import { DndTableAddRowsDialog } from "./dnd-table/dnd-table-add-rows-dialog.js";
|
|
28
|
+
import { DndTableBottomLeftButtons } from "./dnd-table/dnd-table-bottom-left-buttons.js";
|
|
29
|
+
import { DndTableBottomRightButtons } from "./dnd-table/dnd-table-bottom-right-buttons.js";
|
|
25
30
|
import { EquipmentItem } from "./elementSearch/elementItem/EquipmentItem.js";
|
|
26
31
|
import { ElementSearchDialog } from "./elementSearch/elementSearchDialog/ElementSearchDialog.js";
|
|
27
32
|
import { ElementSearchInput } from "./elementSearch/elementSearchInput/ElementSearchInput.js";
|
|
@@ -47,6 +52,7 @@ import "react/jsx-runtime";
|
|
|
47
52
|
import "@mui/material";
|
|
48
53
|
import "react-intl";
|
|
49
54
|
import { SelectClearable } from "./inputs/SelectClearable.js";
|
|
55
|
+
import { ChipItemsInput } from "./inputs/reactHookForm/chip-items-input.js";
|
|
50
56
|
import { DESCRIPTION_INPUT, DirectoryItemsInput, NAME } from "./inputs/reactHookForm/DirectoryItemsInput.js";
|
|
51
57
|
import { RawReadOnlyInput } from "./inputs/reactHookForm/RawReadOnlyInput.js";
|
|
52
58
|
import { BottomRightButtons } from "./inputs/reactHookForm/agGridTable/BottomRightButtons.js";
|
|
@@ -73,6 +79,8 @@ import { CountriesInput } from "./inputs/reactHookForm/selectInputs/CountriesInp
|
|
|
73
79
|
import { InputWithPopupConfirmation } from "./inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js";
|
|
74
80
|
import { MuiSelectInput } from "./inputs/reactHookForm/selectInputs/MuiSelectInput.js";
|
|
75
81
|
import { SelectInput } from "./inputs/reactHookForm/selectInputs/SelectInput.js";
|
|
82
|
+
import { TableNumericalInput } from "./inputs/reactHookForm/tableInputs/table-numerical-input.js";
|
|
83
|
+
import { TableTextInput } from "./inputs/reactHookForm/tableInputs/table-text-input.js";
|
|
76
84
|
import { DescriptionField } from "./inputs/reactHookForm/text/DescriptionField.js";
|
|
77
85
|
import { ExpandingTextField } from "./inputs/reactHookForm/text/ExpandingTextField.js";
|
|
78
86
|
import { TextInput } from "./inputs/reactHookForm/text/TextInput.js";
|
|
@@ -116,7 +124,7 @@ import { LeftPanelOpenIcon } from "./icons/LeftPanelOpenIcon.js";
|
|
|
116
124
|
import { LeftPanelCloseIcon } from "./icons/LeftPanelCloseIcon.js";
|
|
117
125
|
import { DeviceHubIcon } from "./icons/DeviceHubIcon.js";
|
|
118
126
|
import { ComputingType, formatComputingTypeLabel, isValidComputingType } from "./parameters/common/computing-type.js";
|
|
119
|
-
import { PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER, PROVIDER, VOLTAGE_LEVEL } from "./parameters/common/constant.js";
|
|
127
|
+
import { PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_HIGH_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_LOW_VOLTAGE_ABSOLUTE_THRESHOLD, PARAM_SA_LOW_VOLTAGE_PROPORTIONAL_THRESHOLD, PARAM_SA_PROVIDER, PROVIDER, ReactivePowerAdornment, VOLTAGE_LEVEL, VoltageAdornment } from "./parameters/common/constant.js";
|
|
120
128
|
import { LineSeparator } from "./parameters/common/line-separator.js";
|
|
121
129
|
import { LabelledButton, SwitchWithLabel, TabPanel } from "./parameters/common/parameters.js";
|
|
122
130
|
import { CreateParameterDialog } from "./parameters/common/parameters-creation-dialog.js";
|
|
@@ -135,16 +143,20 @@ import { LimitReductionsTableForm } from "./parameters/common/limitreductions/li
|
|
|
135
143
|
import { LimitReductionTableRow } from "./parameters/common/limitreductions/limit-reduction-table-row.js";
|
|
136
144
|
import { LimitReductionTableCell } from "./parameters/common/limitreductions/limit-reduction-table-cell.js";
|
|
137
145
|
import { CENTER_LABEL, COMPONENT_LIBRARY, DIAGONAL_LABEL, INIT_NAD_WITH_GEO_DATA, INTL_LINE_FLOW_MODE_OPTIONS, INTL_MAP_BASE_MAP_OPTIONS, INTL_SUBSTATION_LAYOUT_OPTIONS, LINE_FLOW_MODE, LineFlowMode, MAP_BASE_MAP, MAP_MANUAL_REFRESH, NetworkVisualizationTabValues, PARAM_CENTER_LABEL, PARAM_COMPONENT_LIBRARY, PARAM_DIAGONAL_LABEL, PARAM_INIT_NAD_WITH_GEO_DATA, PARAM_LINE_FLOW_MODE, PARAM_LINE_FULL_PATH, PARAM_LINE_PARALLEL_PATH, PARAM_MAP_BASEMAP, PARAM_MAP_MANUAL_REFRESH, PARAM_SUBSTATION_LAYOUT, SUBSTATION_LAYOUT } from "./parameters/network-visualizations/constants.js";
|
|
138
|
-
import { MAP_BASEMAP_CARTO, MAP_BASEMAP_CARTO_NOLABEL, MAP_BASEMAP_MAPBOX, SubstationLayout } from "./parameters/network-visualizations/network-visualizations.types.js";
|
|
146
|
+
import { MAP_BASEMAP_CARTO, MAP_BASEMAP_CARTO_NOLABEL, MAP_BASEMAP_ETALAB, MAP_BASEMAP_MAPBOX, SubstationLayout } from "./parameters/network-visualizations/network-visualizations.types.js";
|
|
139
147
|
import { NetworkVisualizationParametersInline } from "./parameters/network-visualizations/network-visualizations-parameters-inline.js";
|
|
140
148
|
import { NetworkVisualizationsParametersEditionDialog } from "./parameters/network-visualizations/network-visualizations-parameters-dialog.js";
|
|
141
149
|
import { getTabIndicatorStyle, getTabStyle, parametersStyles } from "./parameters/parameters-style.js";
|
|
142
|
-
import { BALANCE_TYPE, COMMON_PARAMETERS, CONNECTED_COMPONENT_MODE, COUNTRIES_TO_BALANCE, DC, DC_POWER_FACTOR, DC_USE_TRANSFORMER_RATIO, DEFAULT_LIMIT_REDUCTION_VALUE, DISTRIBUTED_SLACK, HVDC_AC_EMULATION, MAX_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, PARAM_LIMIT_REDUCTION, PARAM_PROVIDER_OPENLOADFLOW, PHASE_SHIFTER_REGULATION_ON, READ_SLACK_BUS, SHUNT_COMPENSATOR_VOLTAGE_CONTROL_ON, SPECIFIC_PARAMETERS,
|
|
150
|
+
import { BALANCE_TYPE, COMMON_PARAMETERS, CONNECTED_COMPONENT_MODE, COUNTRIES_TO_BALANCE, DC, DC_POWER_FACTOR, DC_USE_TRANSFORMER_RATIO, DEFAULT_LIMIT_REDUCTION_VALUE, DISTRIBUTED_SLACK, HVDC_AC_EMULATION, MAX_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION, PARAM_LIMIT_REDUCTION, PARAM_PROVIDER_OPENLOADFLOW, PHASE_SHIFTER_REGULATION_ON, READ_SLACK_BUS, SHUNT_COMPENSATOR_VOLTAGE_CONTROL_ON, SPECIFIC_PARAMETERS, TWT_SPLIT_SHUNT_ADMITTANCE, USE_REACTIVE_LIMITS, VOLTAGE_INIT_MODE, WRITE_SLACK_BUS, alertThresholdMarks } from "./parameters/loadflow/constants.js";
|
|
143
151
|
import { LoadFlowParametersInline } from "./parameters/loadflow/load-flow-parameters-inline.js";
|
|
144
152
|
import { LoadFlowParametersEditionDialog } from "./parameters/loadflow/load-flow-parameters-dialog.js";
|
|
145
153
|
import { InitialVoltage, PredefinedParameters, SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE, SHORT_CIRCUIT_PREDEFINED_PARAMS, SHORT_CIRCUIT_WITH_FEEDER_RESULT, SHORT_CIRCUIT_WITH_LOADS, SHORT_CIRCUIT_WITH_NEUTRAL_POSITION, SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS, SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS, intlInitialVoltageProfileMode, intlPredefinedParametersOptions } from "./parameters/short-circuit/constants.js";
|
|
146
154
|
import { ShortCircuitParametersInLine } from "./parameters/short-circuit/short-circuit-parameters-inline.js";
|
|
147
155
|
import { ShortCircuitParametersEditionDialog } from "./parameters/short-circuit/short-circuit-parameters-dialog.js";
|
|
156
|
+
import { DEFAULT_GENERAL_APPLY_MODIFICATIONS, DEFAULT_REACTIVE_SLACKS_THRESHOLD, DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, DEFAULT_UPDATE_BUS_VOLTAGE, FILTERS, FILTER_ID, FILTER_NAME, GENERAL, GENERAL_APPLY_MODIFICATIONS, GENERATORS_SELECTION_TYPE, HIGH_VOLTAGE_LIMIT, ID, LEG_SIDE, LOW_VOLTAGE_LIMIT, PRIORITY, RATIO_TAP_CHANGER_POSITION, RATIO_TAP_CHANGER_TARGET_V, REACTIVE_SLACKS_THRESHOLD, SELECTION_TYPE, SHUNT_COMPENSATORS_SELECTION_TYPE, SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD, TRANSFORMERS_SELECTION_TYPE, UPDATE_BUS_VOLTAGE, VARIABLE_Q_GENERATORS, VARIABLE_SHUNT_COMPENSATORS, VARIABLE_TRANSFORMERS, VOLTAGE_LIMITS_DEFAULT, VOLTAGE_LIMITS_MODIFICATION, VoltageInitTabValues } from "./parameters/voltage-init/constants.js";
|
|
157
|
+
import { EquipmentsSelectionType } from "./parameters/voltage-init/voltage-init.type.js";
|
|
158
|
+
import { VoltageInitParametersEditionDialog } from "./parameters/voltage-init/voltage-init-parameters-dialog.js";
|
|
159
|
+
import { VoltageInitParametersInLine } from "./parameters/voltage-init/voltage-init-parameters-inline.js";
|
|
148
160
|
import { CustomMenuItem, CustomNestedMenuItem } from "./menus/custom-nested-menu.js";
|
|
149
161
|
export {
|
|
150
162
|
AboutDialog,
|
|
@@ -173,6 +185,7 @@ export {
|
|
|
173
185
|
CardErrorBoundary,
|
|
174
186
|
CheckBoxList,
|
|
175
187
|
CheckboxInput,
|
|
188
|
+
ChipItemsInput,
|
|
176
189
|
CombinatorSelector,
|
|
177
190
|
CombinatorType,
|
|
178
191
|
ComputingType,
|
|
@@ -195,8 +208,12 @@ export {
|
|
|
195
208
|
DC,
|
|
196
209
|
DC_POWER_FACTOR,
|
|
197
210
|
DC_USE_TRANSFORMER_RATIO,
|
|
211
|
+
DEFAULT_GENERAL_APPLY_MODIFICATIONS,
|
|
198
212
|
DEFAULT_LIMIT_REDUCTION_VALUE,
|
|
199
213
|
DEFAULT_RANGE_VALUE,
|
|
214
|
+
DEFAULT_REACTIVE_SLACKS_THRESHOLD,
|
|
215
|
+
DEFAULT_SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
|
|
216
|
+
DEFAULT_UPDATE_BUS_VOLTAGE,
|
|
200
217
|
DESCRIPTION_INPUT,
|
|
201
218
|
DIAGONAL_LABEL,
|
|
202
219
|
DISTRIBUTED_SLACK,
|
|
@@ -208,6 +225,11 @@ export {
|
|
|
208
225
|
DeviceHubIcon,
|
|
209
226
|
DirectoryItemSelector,
|
|
210
227
|
DirectoryItemsInput,
|
|
228
|
+
DndColumnType,
|
|
229
|
+
DndTable,
|
|
230
|
+
DndTableAddRowsDialog,
|
|
231
|
+
DndTableBottomLeftButtons,
|
|
232
|
+
DndTableBottomRightButtons,
|
|
211
233
|
ENERGY_SOURCE_OPTIONS,
|
|
212
234
|
EXPERT_FILTER_EQUIPMENTS,
|
|
213
235
|
EXPERT_FILTER_FIELDS,
|
|
@@ -217,6 +239,7 @@ export {
|
|
|
217
239
|
ElementSearchInput,
|
|
218
240
|
ElementValueEditor,
|
|
219
241
|
EquipmentItem,
|
|
242
|
+
EquipmentsSelectionType,
|
|
220
243
|
ErrorInLogoutAlert,
|
|
221
244
|
ErrorInUserValidationAlert,
|
|
222
245
|
ErrorInput,
|
|
@@ -226,8 +249,11 @@ export {
|
|
|
226
249
|
ExplicitNamingFilterEditionDialog,
|
|
227
250
|
ExplicitNamingFilterForm,
|
|
228
251
|
FIELDS_OPTIONS,
|
|
252
|
+
FILTERS,
|
|
229
253
|
FILTER_EQUIPMENTS,
|
|
230
254
|
FILTER_EQUIPMENTS_ATTRIBUTES,
|
|
255
|
+
FILTER_ID,
|
|
256
|
+
FILTER_NAME,
|
|
231
257
|
FieldErrorAlert,
|
|
232
258
|
FieldLabel,
|
|
233
259
|
FilterCreationDialog,
|
|
@@ -235,10 +261,15 @@ export {
|
|
|
235
261
|
FilterType,
|
|
236
262
|
FlatParameters,
|
|
237
263
|
FloatInput,
|
|
264
|
+
GENERAL,
|
|
265
|
+
GENERAL_APPLY_MODIFICATIONS,
|
|
266
|
+
GENERATORS_SELECTION_TYPE,
|
|
238
267
|
GridLogo,
|
|
239
268
|
GroupValueEditor,
|
|
269
|
+
HIGH_VOLTAGE_LIMIT,
|
|
240
270
|
HVDC_AC_EMULATION,
|
|
241
271
|
HelperPreviousValue,
|
|
272
|
+
ID,
|
|
242
273
|
INIT_NAD_WITH_GEO_DATA,
|
|
243
274
|
INTL_LINE_FLOW_MODE_OPTIONS,
|
|
244
275
|
INTL_MAP_BASE_MAP_OPTIONS,
|
|
@@ -247,10 +278,12 @@ export {
|
|
|
247
278
|
InitialVoltage,
|
|
248
279
|
InputWithPopupConfirmation,
|
|
249
280
|
IntegerInput,
|
|
281
|
+
LEG_SIDE,
|
|
250
282
|
LIMIT_DURATION_FORM,
|
|
251
283
|
LIMIT_REDUCTIONS_FORM,
|
|
252
284
|
LINE_FLOW_MODE,
|
|
253
285
|
LOAD_TYPE_OPTIONS,
|
|
286
|
+
LOW_VOLTAGE_LIMIT,
|
|
254
287
|
LabelledButton,
|
|
255
288
|
LeftPanelCloseIcon,
|
|
256
289
|
LeftPanelOpenIcon,
|
|
@@ -266,9 +299,11 @@ export {
|
|
|
266
299
|
Logout,
|
|
267
300
|
MAP_BASEMAP_CARTO,
|
|
268
301
|
MAP_BASEMAP_CARTO_NOLABEL,
|
|
302
|
+
MAP_BASEMAP_ETALAB,
|
|
269
303
|
MAP_BASEMAP_MAPBOX,
|
|
270
304
|
MAP_BASE_MAP,
|
|
271
305
|
MAP_MANUAL_REFRESH,
|
|
306
|
+
MAX_ROWS_NUMBER,
|
|
272
307
|
MAX_VALUE_ALLOWED_FOR_LIMIT_REDUCTION,
|
|
273
308
|
MIN_VALUE_ALLOWED_FOR_LIMIT_REDUCTION,
|
|
274
309
|
MidFormError,
|
|
@@ -307,6 +342,7 @@ export {
|
|
|
307
342
|
PARAM_SUBSTATION_LAYOUT,
|
|
308
343
|
PHASE_REGULATION_MODE_OPTIONS,
|
|
309
344
|
PHASE_SHIFTER_REGULATION_ON,
|
|
345
|
+
PRIORITY,
|
|
310
346
|
PROVIDER,
|
|
311
347
|
ParameterFloat,
|
|
312
348
|
ParameterGroup,
|
|
@@ -318,6 +354,9 @@ export {
|
|
|
318
354
|
PropertyValueEditor,
|
|
319
355
|
ProviderParam,
|
|
320
356
|
RATIO_REGULATION_MODE_OPTIONS,
|
|
357
|
+
RATIO_TAP_CHANGER_POSITION,
|
|
358
|
+
RATIO_TAP_CHANGER_TARGET_V,
|
|
359
|
+
REACTIVE_SLACKS_THRESHOLD,
|
|
321
360
|
READ_SLACK_BUS,
|
|
322
361
|
REGULATION_TYPE_OPTIONS,
|
|
323
362
|
RULES,
|
|
@@ -325,8 +364,11 @@ export {
|
|
|
325
364
|
RangeInput,
|
|
326
365
|
RangeType,
|
|
327
366
|
RawReadOnlyInput,
|
|
367
|
+
ReactivePowerAdornment,
|
|
328
368
|
RemoveButton,
|
|
329
369
|
RuleValueEditor,
|
|
370
|
+
SELECTED,
|
|
371
|
+
SELECTION_TYPE,
|
|
330
372
|
SHORT_CIRCUIT_INITIAL_VOLTAGE_PROFILE_MODE,
|
|
331
373
|
SHORT_CIRCUIT_PREDEFINED_PARAMS,
|
|
332
374
|
SHORT_CIRCUIT_WITH_FEEDER_RESULT,
|
|
@@ -334,6 +376,8 @@ export {
|
|
|
334
376
|
SHORT_CIRCUIT_WITH_NEUTRAL_POSITION,
|
|
335
377
|
SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS,
|
|
336
378
|
SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS,
|
|
379
|
+
SHUNT_COMPENSATORS_SELECTION_TYPE,
|
|
380
|
+
SHUNT_COMPENSATOR_ACTIVATION_THRESHOLD,
|
|
337
381
|
SHUNT_COMPENSATOR_TYPE_OPTIONS,
|
|
338
382
|
SHUNT_COMPENSATOR_VOLTAGE_CONTROL_ON,
|
|
339
383
|
SPECIFIC_PARAMETERS,
|
|
@@ -352,10 +396,12 @@ export {
|
|
|
352
396
|
SwitchInput,
|
|
353
397
|
SwitchWithLabel,
|
|
354
398
|
TAB_INFO,
|
|
355
|
-
|
|
399
|
+
TRANSFORMERS_SELECTION_TYPE,
|
|
356
400
|
TWT_SPLIT_SHUNT_ADMITTANCE,
|
|
357
401
|
TabPanel,
|
|
358
402
|
TabValues,
|
|
403
|
+
TableNumericalInput,
|
|
404
|
+
TableTextInput,
|
|
359
405
|
TagRenderer,
|
|
360
406
|
TextFieldWithAdornment,
|
|
361
407
|
TextInput,
|
|
@@ -363,15 +409,25 @@ export {
|
|
|
363
409
|
TopBar,
|
|
364
410
|
TranslatedValueEditor,
|
|
365
411
|
TreeViewFinder,
|
|
412
|
+
UPDATE_BUS_VOLTAGE,
|
|
366
413
|
USE_REACTIVE_LIMITS,
|
|
367
414
|
UnauthorizedAccessAlert,
|
|
368
415
|
UniqueNameInput,
|
|
369
416
|
UserManagerMock,
|
|
417
|
+
VARIABLE_Q_GENERATORS,
|
|
418
|
+
VARIABLE_SHUNT_COMPENSATORS,
|
|
419
|
+
VARIABLE_TRANSFORMERS,
|
|
370
420
|
VOLTAGE_INIT_MODE,
|
|
371
421
|
VOLTAGE_LEVEL,
|
|
372
422
|
VOLTAGE_LEVELS_FORM,
|
|
423
|
+
VOLTAGE_LIMITS_DEFAULT,
|
|
424
|
+
VOLTAGE_LIMITS_MODIFICATION,
|
|
373
425
|
ValueEditor,
|
|
374
426
|
ValueSelector,
|
|
427
|
+
VoltageAdornment,
|
|
428
|
+
VoltageInitParametersEditionDialog,
|
|
429
|
+
VoltageInitParametersInLine,
|
|
430
|
+
VoltageInitTabValues,
|
|
375
431
|
WRITE_SLACK_BUS,
|
|
376
432
|
alertThresholdMarks,
|
|
377
433
|
countRules,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SelectClearable } from "./SelectClearable.js";
|
|
2
|
+
import { ChipItemsInput } from "./reactHookForm/chip-items-input.js";
|
|
2
3
|
import { DESCRIPTION_INPUT, DirectoryItemsInput, NAME } from "./reactHookForm/DirectoryItemsInput.js";
|
|
3
4
|
import { RawReadOnlyInput } from "./reactHookForm/RawReadOnlyInput.js";
|
|
4
5
|
import { BottomRightButtons } from "./reactHookForm/agGridTable/BottomRightButtons.js";
|
|
@@ -25,6 +26,8 @@ import { CountriesInput } from "./reactHookForm/selectInputs/CountriesInput.js";
|
|
|
25
26
|
import { InputWithPopupConfirmation } from "./reactHookForm/selectInputs/InputWithPopupConfirmation.js";
|
|
26
27
|
import { MuiSelectInput } from "./reactHookForm/selectInputs/MuiSelectInput.js";
|
|
27
28
|
import { SelectInput } from "./reactHookForm/selectInputs/SelectInput.js";
|
|
29
|
+
import { TableNumericalInput } from "./reactHookForm/tableInputs/table-numerical-input.js";
|
|
30
|
+
import { TableTextInput } from "./reactHookForm/tableInputs/table-text-input.js";
|
|
28
31
|
import { DescriptionField } from "./reactHookForm/text/DescriptionField.js";
|
|
29
32
|
import { ExpandingTextField } from "./reactHookForm/text/ExpandingTextField.js";
|
|
30
33
|
import { TextInput } from "./reactHookForm/text/TextInput.js";
|
|
@@ -61,6 +64,7 @@ export {
|
|
|
61
64
|
BottomRightButtons,
|
|
62
65
|
CancelButton,
|
|
63
66
|
CheckboxInput,
|
|
67
|
+
ChipItemsInput,
|
|
64
68
|
CombinatorSelector,
|
|
65
69
|
CountriesInput,
|
|
66
70
|
CountryValueEditor,
|
|
@@ -100,6 +104,8 @@ export {
|
|
|
100
104
|
SliderInput,
|
|
101
105
|
SubmitButton,
|
|
102
106
|
SwitchInput,
|
|
107
|
+
TableNumericalInput,
|
|
108
|
+
TableTextInput,
|
|
103
109
|
TextFieldWithAdornment,
|
|
104
110
|
TextInput,
|
|
105
111
|
TextValueEditor,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
interface ChipItemsInputProps {
|
|
8
|
+
label?: string;
|
|
9
|
+
name: string;
|
|
10
|
+
hideErrorMessage: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function ChipItemsInput({ label, name, hideErrorMessage }: Readonly<ChipItemsInputProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FormControl, Chip, TextField } from "@mui/material";
|
|
3
|
+
import { useState, useCallback } from "react";
|
|
4
|
+
import { useFieldArray, useController } from "react-hook-form";
|
|
5
|
+
import "react-intl";
|
|
6
|
+
import "../../../utils/types/equipmentType.js";
|
|
7
|
+
import "localized-countries";
|
|
8
|
+
import "localized-countries/data/fr";
|
|
9
|
+
import "localized-countries/data/en";
|
|
10
|
+
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
11
|
+
import "./provider/CustomFormProvider.js";
|
|
12
|
+
import { useCustomFormContext } from "./provider/useCustomFormContext.js";
|
|
13
|
+
import { FieldLabel } from "./utils/FieldLabel.js";
|
|
14
|
+
import "@mui/icons-material";
|
|
15
|
+
import { isFieldRequired } from "./utils/functions.js";
|
|
16
|
+
import { OverflowableText } from "../../overflowableText/OverflowableText.js";
|
|
17
|
+
import { RawReadOnlyInput } from "./RawReadOnlyInput.js";
|
|
18
|
+
import { ErrorInput } from "./errorManagement/ErrorInput.js";
|
|
19
|
+
import { MidFormError } from "./errorManagement/MidFormError.js";
|
|
20
|
+
function ChipItemsInput({ label, name, hideErrorMessage }) {
|
|
21
|
+
const [textEntered, setTextEntered] = useState("");
|
|
22
|
+
const { snackError } = useSnackMessage();
|
|
23
|
+
const {
|
|
24
|
+
fields: elements,
|
|
25
|
+
append,
|
|
26
|
+
remove
|
|
27
|
+
} = useFieldArray({
|
|
28
|
+
name
|
|
29
|
+
});
|
|
30
|
+
const { validationSchema, getValues } = useCustomFormContext();
|
|
31
|
+
const {
|
|
32
|
+
fieldState: { error }
|
|
33
|
+
} = useController({
|
|
34
|
+
name
|
|
35
|
+
});
|
|
36
|
+
const addItem = useCallback(
|
|
37
|
+
(value) => {
|
|
38
|
+
if (getValues(name).find((v) => v === value) !== void 0) {
|
|
39
|
+
snackError({
|
|
40
|
+
messageTxt: "",
|
|
41
|
+
headerId: "directory_items_input/ElementAlreadyUsed"
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
append(value);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
[append, getValues, snackError, name]
|
|
48
|
+
);
|
|
49
|
+
const keyPress = (e) => {
|
|
50
|
+
if (e.key === "Enter" && textEntered.length > 0) {
|
|
51
|
+
addItem(textEntered);
|
|
52
|
+
setTextEntered("");
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const onBlur = () => {
|
|
56
|
+
if (textEntered.length > 0) {
|
|
57
|
+
addItem(textEntered);
|
|
58
|
+
setTextEntered("");
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const handleChange = (e) => {
|
|
62
|
+
setTextEntered(e.target.value);
|
|
63
|
+
};
|
|
64
|
+
const styles = {
|
|
65
|
+
chipContainer: {
|
|
66
|
+
display: "flex",
|
|
67
|
+
gap: "8px",
|
|
68
|
+
flexWrap: "wrap",
|
|
69
|
+
flexDirection: "row",
|
|
70
|
+
border: "2px solid lightgray",
|
|
71
|
+
borderRadius: "4px",
|
|
72
|
+
overflow: "hidden",
|
|
73
|
+
borderColor: (error == null ? void 0 : error.message) ? "error.main" : null
|
|
74
|
+
},
|
|
75
|
+
chipItem: {
|
|
76
|
+
display: "flex",
|
|
77
|
+
gap: "8px",
|
|
78
|
+
flexWrap: "wrap",
|
|
79
|
+
flexDirection: "row",
|
|
80
|
+
marginTop: 0,
|
|
81
|
+
padding: 1,
|
|
82
|
+
overflow: "hidden"
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
86
|
+
/* @__PURE__ */ jsxs(FormControl, { sx: styles.chipContainer, error: !!(error == null ? void 0 : error.message), children: [
|
|
87
|
+
(elements == null ? void 0 : elements.length) === 0 && label && /* @__PURE__ */ jsx(FieldLabel, { label, optional: !isFieldRequired(name, validationSchema, getValues()) }),
|
|
88
|
+
(elements == null ? void 0 : elements.length) > 0 && /* @__PURE__ */ jsx(FormControl, { sx: styles.chipItem, children: elements.map((item, index) => /* @__PURE__ */ jsx(
|
|
89
|
+
Chip,
|
|
90
|
+
{
|
|
91
|
+
size: "small",
|
|
92
|
+
onDelete: () => {
|
|
93
|
+
remove(index);
|
|
94
|
+
},
|
|
95
|
+
label: /* @__PURE__ */ jsx(
|
|
96
|
+
OverflowableText,
|
|
97
|
+
{
|
|
98
|
+
text: /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${name}.${index}` }),
|
|
99
|
+
sx: { width: "100%" }
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
},
|
|
103
|
+
item.id
|
|
104
|
+
)) }),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
TextField,
|
|
107
|
+
{
|
|
108
|
+
variant: "standard",
|
|
109
|
+
InputProps: {
|
|
110
|
+
disableUnderline: true,
|
|
111
|
+
style: {
|
|
112
|
+
marginTop: "5px",
|
|
113
|
+
height: "30px",
|
|
114
|
+
marginLeft: "10px"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
value: textEntered,
|
|
118
|
+
onKeyDown: keyPress,
|
|
119
|
+
onChange: handleChange,
|
|
120
|
+
onBlur
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] }),
|
|
124
|
+
!hideErrorMessage && /* @__PURE__ */ jsx(ErrorInput, { name, InputField: MidFormError })
|
|
125
|
+
] });
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
ChipItemsInput
|
|
129
|
+
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
|
+
export * from './chip-items-input';
|
|
7
8
|
export * from './DirectoryItemsInput';
|
|
8
9
|
export * from './RawReadOnlyInput';
|
|
9
10
|
export * from './agGridTable';
|
|
@@ -13,5 +14,6 @@ export * from './errorManagement';
|
|
|
13
14
|
export * from './numbers';
|
|
14
15
|
export * from './provider';
|
|
15
16
|
export * from './selectInputs';
|
|
17
|
+
export * from './tableInputs';
|
|
16
18
|
export * from './text';
|
|
17
19
|
export * from './utils';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChipItemsInput } from "./chip-items-input.js";
|
|
1
2
|
import { DESCRIPTION_INPUT, DirectoryItemsInput, NAME } from "./DirectoryItemsInput.js";
|
|
2
3
|
import { RawReadOnlyInput } from "./RawReadOnlyInput.js";
|
|
3
4
|
import { BottomRightButtons } from "./agGridTable/BottomRightButtons.js";
|
|
@@ -24,6 +25,8 @@ import { CountriesInput } from "./selectInputs/CountriesInput.js";
|
|
|
24
25
|
import { InputWithPopupConfirmation } from "./selectInputs/InputWithPopupConfirmation.js";
|
|
25
26
|
import { MuiSelectInput } from "./selectInputs/MuiSelectInput.js";
|
|
26
27
|
import { SelectInput } from "./selectInputs/SelectInput.js";
|
|
28
|
+
import { TableNumericalInput } from "./tableInputs/table-numerical-input.js";
|
|
29
|
+
import { TableTextInput } from "./tableInputs/table-text-input.js";
|
|
27
30
|
import { DescriptionField } from "./text/DescriptionField.js";
|
|
28
31
|
import { ExpandingTextField } from "./text/ExpandingTextField.js";
|
|
29
32
|
import { TextInput } from "./text/TextInput.js";
|
|
@@ -40,6 +43,7 @@ export {
|
|
|
40
43
|
BottomRightButtons,
|
|
41
44
|
CancelButton,
|
|
42
45
|
CheckboxInput,
|
|
46
|
+
ChipItemsInput,
|
|
43
47
|
CountriesInput,
|
|
44
48
|
CsvUploader,
|
|
45
49
|
CustomAgGridTable,
|
|
@@ -70,6 +74,8 @@ export {
|
|
|
70
74
|
SliderInput,
|
|
71
75
|
SubmitButton,
|
|
72
76
|
SwitchInput,
|
|
77
|
+
TableNumericalInput,
|
|
78
|
+
TableTextInput,
|
|
73
79
|
TextFieldWithAdornment,
|
|
74
80
|
TextInput,
|
|
75
81
|
UniqueNameInput,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export * from './table-numerical-input';
|
|
8
|
+
export * from './table-text-input';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InputBaseComponentProps, StandardTextFieldProps } from '@mui/material';
|
|
2
|
+
export interface TableNumericalInputProps extends StandardTextFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
inputProps?: InputBaseComponentProps;
|
|
5
|
+
previousValue?: number;
|
|
6
|
+
valueModified: boolean;
|
|
7
|
+
adornment?: {
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
|
10
|
+
isClearable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function TableNumericalInput({ name, style, inputProps, previousValue, valueModified, adornment, isClearable, ...props }: Readonly<TableNumericalInputProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TextField, InputAdornment, IconButton } from "@mui/material";
|
|
3
|
+
import { useFormContext, useController } from "react-hook-form";
|
|
4
|
+
import { Clear } from "@mui/icons-material";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import "../../../../utils/conversionUtils.js";
|
|
7
|
+
import "../../../../utils/types/equipmentType.js";
|
|
8
|
+
import { validateValueIsANumber } from "../../../../utils/validation-functions.js";
|
|
9
|
+
import "../../../../utils/yupConfig.js";
|
|
10
|
+
function TableNumericalInput({
|
|
11
|
+
name,
|
|
12
|
+
style,
|
|
13
|
+
inputProps,
|
|
14
|
+
previousValue,
|
|
15
|
+
valueModified,
|
|
16
|
+
adornment,
|
|
17
|
+
isClearable = true,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const { trigger } = useFormContext();
|
|
21
|
+
const {
|
|
22
|
+
field: { onChange, value, ref },
|
|
23
|
+
fieldState: { error }
|
|
24
|
+
} = useController({ name });
|
|
25
|
+
const inputTransform = (str) => {
|
|
26
|
+
if (str === null) {
|
|
27
|
+
return "";
|
|
28
|
+
}
|
|
29
|
+
if (["-", "."].includes(str)) {
|
|
30
|
+
return str;
|
|
31
|
+
}
|
|
32
|
+
return Number.isNaN(Number(str)) ? "" : str.toString();
|
|
33
|
+
};
|
|
34
|
+
const clearable = useMemo(
|
|
35
|
+
() => (
|
|
36
|
+
// We add the clear button only if the field is clearable and the previous value is different from the current one
|
|
37
|
+
isClearable && (previousValue === Number.MAX_VALUE ? validateValueIsANumber(value) : previousValue !== void 0 && previousValue !== value)
|
|
38
|
+
),
|
|
39
|
+
[isClearable, previousValue, value]
|
|
40
|
+
);
|
|
41
|
+
const outputTransform = (str) => {
|
|
42
|
+
if (typeof str === "string") {
|
|
43
|
+
if (str === "-") {
|
|
44
|
+
return str;
|
|
45
|
+
}
|
|
46
|
+
if (str === "") {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const tmp = (str == null ? void 0 : str.replace(",", ".")) || "";
|
|
50
|
+
if (tmp.endsWith(".") || tmp.endsWith("0")) {
|
|
51
|
+
return str;
|
|
52
|
+
}
|
|
53
|
+
return parseFloat(tmp) || null;
|
|
54
|
+
}
|
|
55
|
+
return str === Number.MAX_VALUE ? null : str;
|
|
56
|
+
};
|
|
57
|
+
const handleInputChange = (e) => {
|
|
58
|
+
onChange(outputTransform(e.target.value));
|
|
59
|
+
trigger(name);
|
|
60
|
+
};
|
|
61
|
+
const transformedValue = inputTransform(value);
|
|
62
|
+
const handleClearValue = () => {
|
|
63
|
+
onChange(outputTransform(previousValue));
|
|
64
|
+
};
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
TextField,
|
|
67
|
+
{
|
|
68
|
+
value: transformedValue,
|
|
69
|
+
onChange: handleInputChange,
|
|
70
|
+
error: !!(error == null ? void 0 : error.message),
|
|
71
|
+
size: "small",
|
|
72
|
+
fullWidth: true,
|
|
73
|
+
inputRef: ref,
|
|
74
|
+
InputProps: {
|
|
75
|
+
endAdornment: /* @__PURE__ */ jsxs(InputAdornment, { position: "end", children: [
|
|
76
|
+
transformedValue && (adornment == null ? void 0 : adornment.text),
|
|
77
|
+
clearable && /* @__PURE__ */ jsx(
|
|
78
|
+
IconButton,
|
|
79
|
+
{
|
|
80
|
+
onClick: handleClearValue,
|
|
81
|
+
style: {
|
|
82
|
+
visibility: clearable ? "visible" : "hidden"
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ jsx(Clear, {})
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] }),
|
|
88
|
+
disableInjectingGlobalStyles: true,
|
|
89
|
+
// disable auto-fill animations and increase rendering perf
|
|
90
|
+
inputProps: {
|
|
91
|
+
style: {
|
|
92
|
+
fontSize: "small",
|
|
93
|
+
color: previousValue !== void 0 && previousValue === parseFloat(value) && !valueModified ? "grey" : void 0,
|
|
94
|
+
// grey out the value if it is the same as the previous one
|
|
95
|
+
textAlign: (style == null ? void 0 : style.textAlign) ?? "left"
|
|
96
|
+
},
|
|
97
|
+
inputMode: "numeric",
|
|
98
|
+
pattern: "[0-9]*",
|
|
99
|
+
lang: "en-US",
|
|
100
|
+
// to have '.' as decimal separator
|
|
101
|
+
...inputProps
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
...props
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
TableNumericalInput
|
|
110
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputBaseComponentProps } from '@mui/material';
|
|
2
|
+
interface TableTextInputProps {
|
|
3
|
+
name: string;
|
|
4
|
+
showErrorMsg?: boolean;
|
|
5
|
+
inputProps?: InputBaseComponentProps;
|
|
6
|
+
}
|
|
7
|
+
export declare function TableTextInput({ name, showErrorMsg, inputProps, ...props }: Readonly<TableTextInputProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextField } from "@mui/material";
|
|
3
|
+
import { useController } from "react-hook-form";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
function TableTextInput({ name, showErrorMsg, inputProps, ...props }) {
|
|
6
|
+
const {
|
|
7
|
+
field: { onChange, value, ref },
|
|
8
|
+
fieldState: { error }
|
|
9
|
+
} = useController({ name });
|
|
10
|
+
const intl = useIntl();
|
|
11
|
+
const outputTransform = (str) => {
|
|
12
|
+
return (str == null ? void 0 : str.trim()) === "" ? "" : str;
|
|
13
|
+
};
|
|
14
|
+
const handleInputChange = (e) => {
|
|
15
|
+
onChange(outputTransform(e.target.value));
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
TextField,
|
|
19
|
+
{
|
|
20
|
+
value,
|
|
21
|
+
onChange: handleInputChange,
|
|
22
|
+
error: !!(error == null ? void 0 : error.message),
|
|
23
|
+
helperText: showErrorMsg && ((error == null ? void 0 : error.message) ? intl.formatMessage({ id: error.message }) : ""),
|
|
24
|
+
size: "small",
|
|
25
|
+
fullWidth: true,
|
|
26
|
+
inputRef: ref,
|
|
27
|
+
InputProps: {
|
|
28
|
+
disableInjectingGlobalStyles: true,
|
|
29
|
+
// disable auto-fill animations and increase rendering perf
|
|
30
|
+
inputProps: {
|
|
31
|
+
style: {
|
|
32
|
+
fontSize: "small"
|
|
33
|
+
},
|
|
34
|
+
...inputProps
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
TableTextInput
|
|
43
|
+
};
|