@gridsuite/commons-ui 0.228.0 → 0.230.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/composite/agGridTable/BottomTableButtons.d.ts +13 -0
- package/dist/components/composite/agGridTable/BottomTableButtons.js +92 -0
- package/dist/components/composite/agGridTable/CustomAgGridTable.d.ts +3 -2
- package/dist/components/composite/agGridTable/CustomAgGridTable.js +16 -38
- package/dist/components/composite/agGridTable/agGridTable-utils.d.ts +9 -0
- package/dist/components/composite/agGridTable/agGridTable-utils.js +1 -0
- package/dist/components/composite/agGridTable/cellEditors/index.js +3 -2
- package/dist/components/composite/agGridTable/cellEditors/numericEditor.d.ts +21 -19
- package/dist/components/composite/agGridTable/cellEditors/numericEditor.js +44 -57
- package/dist/components/composite/agGridTable/index.d.ts +2 -2
- package/dist/components/composite/agGridTable/index.js +5 -6
- package/dist/components/composite/customAGGrid/customAggrid.js +5 -3
- package/dist/components/composite/dnd-table/dnd-table-add-rows-dialog.js +1 -0
- package/dist/components/composite/dnd-table/dnd-table-row.js +1 -0
- package/dist/components/composite/dnd-table/dnd-table.js +1 -0
- package/dist/components/composite/filter/HeaderFilterForm.js +1 -0
- package/dist/components/composite/filter/expert/ExpertFilterForm.js +1 -0
- package/dist/components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js +122 -91
- package/dist/components/composite/index.js +4 -5
- package/dist/components/index.js +6 -5
- package/dist/components/ui/csvDownloader/use-csv-export.js +2 -2
- package/dist/components/ui/csvPicker/csv-picker-confirmation-dialog.d.ts +11 -0
- package/dist/components/ui/csvPicker/csv-picker-confirmation-dialog.js +65 -0
- package/dist/components/ui/csvPicker/csv-picker.d.ts +24 -0
- package/dist/components/ui/csvPicker/csv-picker.js +123 -0
- package/dist/components/{composite/agGridTable/csvUploader → ui/csvPicker}/index.d.ts +2 -2
- package/dist/components/ui/csvPicker/index.js +4 -0
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +1 -1
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +2 -0
- package/dist/features/index.js +1 -0
- package/dist/features/network-modifications/battery/creation/BatteryCreationForm.js +2 -3
- package/dist/features/network-modifications/battery/creation/batteryCreation.utils.js +2 -3
- package/dist/features/network-modifications/battery/modification/BatteryDialogHeader.js +2 -3
- package/dist/features/network-modifications/battery/modification/BatteryDialogTabsContent.js +2 -3
- package/dist/features/network-modifications/battery/modification/batteryModification.utils.js +2 -3
- package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-form.js +1 -0
- package/dist/features/network-modifications/by-filter/assignment/modification-by-assignment-form.js +1 -0
- package/dist/features/network-modifications/by-filter/deletion/ByFilterDeletionForm.js +1 -0
- package/dist/features/network-modifications/common/activePowerControl/ActivePowerControlForm.js +1 -0
- package/dist/features/network-modifications/common/connectivity/ConnectivityForm.js +1 -0
- package/dist/features/network-modifications/common/connectivity/PositionForm.js +1 -0
- package/dist/features/network-modifications/common/connectivity/VoltageLevelConnectivityForm.js +1 -0
- package/dist/features/network-modifications/common/measurements/BusbarSectionVoltageMeasurementsForm.js +2 -3
- package/dist/features/network-modifications/common/measurements/PowerWithValidityForm.js +1 -0
- package/dist/features/network-modifications/common/properties/PropertiesForm.js +1 -0
- package/dist/features/network-modifications/common/properties/PropertyForm.js +1 -0
- package/dist/features/network-modifications/common/reactiveLimits/ReactiveLimitsForm.js +1 -0
- package/dist/features/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveRowForm.js +1 -0
- package/dist/features/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/ReactiveCapabilityCurveTableForm.js +1 -0
- package/dist/features/network-modifications/common/regulatingTerminal/RegulatingTerminalForm.js +1 -0
- package/dist/features/network-modifications/common/setpoints/SetPointsForm.js +1 -0
- package/dist/features/network-modifications/common/shortCircuit/ShortCircuitForm.js +1 -0
- package/dist/features/network-modifications/common/voltageRegulation/VoltageRegulationForm.js +1 -0
- package/dist/features/network-modifications/equipmentDeletion/EquipmentDeletionForm.js +2 -3
- package/dist/features/network-modifications/equipmentDeletion/equipmentDeletion.utils.js +1 -0
- package/dist/features/network-modifications/equipmentDeletion/hvdcLccDeletion/ShuntCompensatorSelectionForm.js +1 -0
- package/dist/features/network-modifications/generator/creation/GeneratorCreationForm.js +2 -3
- package/dist/features/network-modifications/generator/creation/generatorCreation.utils.js +2 -3
- package/dist/features/network-modifications/generator/modification/GeneratorDialogHeader.js +2 -3
- package/dist/features/network-modifications/generator/modification/GeneratorDialogTabsContent.js +2 -3
- package/dist/features/network-modifications/generator/modification/generatorModification.utils.js +2 -3
- package/dist/features/network-modifications/index.js +1 -0
- package/dist/features/network-modifications/load/common/LoadDialogHeader.js +2 -3
- package/dist/features/network-modifications/load/creation/loadCreation.utils.js +1 -0
- package/dist/features/network-modifications/load/modification/loadModification.utils.js +2 -3
- package/dist/features/network-modifications/shunt-compensator/common/CharacteristicsForm.js +1 -0
- package/dist/features/network-modifications/shunt-compensator/creation/ShuntCompensatorCreationForm.js +2 -3
- package/dist/features/network-modifications/shunt-compensator/creation/shuntCompensatorCreation.utils.js +2 -3
- package/dist/features/network-modifications/shunt-compensator/modification/ShuntCompensatorModificationForm.js +2 -3
- package/dist/features/network-modifications/shunt-compensator/modification/shuntCompensatorModification.utils.js +2 -3
- package/dist/features/network-modifications/substation/creation/SubstationCreationForm.js +2 -3
- package/dist/features/network-modifications/substation/modification/SubstationModificationForm.js +2 -3
- package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +2 -3
- package/dist/features/network-modifications/voltageLevel/creation/index.js +2 -3
- package/dist/features/network-modifications/voltageLevel/creation/tabs/characteristicsTab/CharacteristicsTab.js +1 -0
- package/dist/features/network-modifications/voltageLevel/creation/tabs/structureTab/StructureTab.js +1 -0
- package/dist/features/network-modifications/voltageLevel/creation/tabs/structureTab/couplingOmnibus/CouplingOmnibusForm.js +1 -0
- package/dist/features/network-modifications/voltageLevel/creation/tabs/structureTab/switchesBetweenSections/SwitchesBetweenSections.js +1 -0
- package/dist/features/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationCreationSection.js +2 -3
- package/dist/features/network-modifications/voltageLevel/creation/tabs/substationTab/SubstationTab.js +1 -0
- package/dist/features/network-modifications/voltageLevel/creation/voltageLevelCreation.utils.js +2 -3
- package/dist/features/network-modifications/voltageLevel/index.js +2 -3
- package/dist/features/network-modifications/voltageLevel/modification/VoltageLevelModificationForm.js +2 -3
- package/dist/features/parameters/common/ProviderParam.js +1 -0
- package/dist/features/parameters/common/contingency-table/columns-definitions.js +1 -0
- package/dist/features/parameters/common/limitreductions/limit-reduction-table-cell.js +1 -0
- package/dist/features/parameters/common/limitreductions/limit-reductions-table-form.js +1 -0
- package/dist/features/parameters/common/name-element-editor/name-element-editor-utils.js +1 -0
- package/dist/features/parameters/common/parameter-field.js +1 -0
- package/dist/features/parameters/common/parameter-table-field/parameter-table-field.js +1 -0
- package/dist/features/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +1 -0
- package/dist/features/parameters/common/widget/parameter-float.js +1 -0
- package/dist/features/parameters/common/widget/parameter-line-directory-items-input.js +1 -0
- package/dist/features/parameters/common/widget/parameter-line-slider.js +1 -0
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +1 -0
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +1 -0
- package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +1 -0
- package/dist/features/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +1 -0
- package/dist/features/parameters/dynamic-security-analysis/contingency-parameters.js +1 -0
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +1 -0
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +1 -0
- package/dist/features/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +1 -0
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-inline.js +1 -0
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +1 -0
- package/dist/features/parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.js +1 -0
- package/dist/features/parameters/loadflow/load-flow-general-parameters.js +1 -0
- package/dist/features/parameters/loadflow/load-flow-parameters-content.js +1 -0
- package/dist/features/parameters/loadflow/load-flow-parameters-dialog.js +1 -0
- package/dist/features/parameters/loadflow/load-flow-parameters-form.js +1 -0
- package/dist/features/parameters/loadflow/load-flow-parameters-header.js +1 -0
- package/dist/features/parameters/loadflow/load-flow-parameters-inline.js +1 -0
- package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +1 -0
- package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +1 -0
- package/dist/features/parameters/network-visualizations/map-parameters.js +1 -0
- package/dist/features/parameters/network-visualizations/network-area-diagram-parameters.js +1 -0
- package/dist/features/parameters/network-visualizations/network-visualizations-form.js +1 -0
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-dialog.js +1 -0
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +1 -0
- package/dist/features/parameters/network-visualizations/single-line-diagram-parameters.js +1 -0
- package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -0
- package/dist/features/parameters/pcc-min/pcc-min-form-utils.js +1 -0
- package/dist/features/parameters/pcc-min/pcc-min-parameters-dialog.js +1 -0
- package/dist/features/parameters/pcc-min/pcc-min-parameters-form.js +1 -0
- package/dist/features/parameters/pcc-min/pcc-min-parameters-inline.js +1 -0
- package/dist/features/parameters/pcc-min/use-pcc-min-parameters-form.js +1 -0
- package/dist/features/parameters/security-analysis/columns-definitions.js +1 -0
- package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +1 -0
- package/dist/features/parameters/security-analysis/security-analysis-parameters-form.js +1 -0
- package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +1 -0
- package/dist/features/parameters/security-analysis/security-analysis-parameters-selector.js +1 -0
- package/dist/features/parameters/security-analysis/security-analysis-violations-hiding.js +1 -0
- package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +1 -0
- package/dist/features/parameters/sensi/columns-definitions.js +1 -0
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -0
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-form.js +1 -0
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-inline.js +1 -0
- package/dist/features/parameters/sensi/sensitivity-parameters-fields.js +1 -0
- package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +33 -4
- package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -0
- package/dist/features/parameters/sensi/utils.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-general-tab-panel.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-icc-cluster-table-cell.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-icc-material-table-cell.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-parameters-content.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-parameters-dialog.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-parameters-form.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-parameters-inline.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-power-electronics-tab-panel.js +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-study-area-tab-panel.js +1 -0
- package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -0
- package/dist/features/parameters/voltage-init/equipment-selection-parameters.js +1 -0
- package/dist/features/parameters/voltage-init/general-parameters.js +1 -0
- package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -0
- package/dist/features/parameters/voltage-init/voltage-init-form-utils.js +1 -0
- package/dist/features/parameters/voltage-init/voltage-init-parameters-dialog.js +1 -0
- package/dist/features/parameters/voltage-init/voltage-init-parameters-form.js +1 -0
- package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +1 -0
- package/dist/features/parameters/voltage-init/voltage-limits-parameters.js +1 -0
- package/dist/index.js +12 -8
- package/dist/translations/en/commonButtonEn.d.ts +2 -0
- package/dist/translations/en/commonButtonEn.js +2 -0
- package/dist/translations/en/csvEn.d.ts +2 -1
- package/dist/translations/en/csvEn.js +5 -4
- package/dist/translations/fr/commonButtonFr.d.ts +2 -0
- package/dist/translations/fr/commonButtonFr.js +2 -0
- package/dist/translations/fr/csvFr.d.ts +2 -1
- package/dist/translations/fr/csvFr.js +6 -5
- package/dist/utils/algos.d.ts +1 -0
- package/dist/utils/algos.js +13 -1
- package/dist/utils/functions.d.ts +5 -0
- package/dist/utils/functions.js +5 -0
- package/dist/utils/index.js +6 -3
- package/dist/utils/langs.d.ts +1 -0
- package/dist/utils/langs.js +5 -1
- package/package.json +6 -7
- package/dist/components/composite/agGridTable/BottomRightButtons.d.ts +0 -14
- package/dist/components/composite/agGridTable/BottomRightButtons.js +0 -62
- package/dist/components/composite/agGridTable/csvUploader/CsvUploader.d.ts +0 -15
- package/dist/components/composite/agGridTable/csvUploader/CsvUploader.js +0 -182
- package/dist/components/composite/agGridTable/csvUploader/index.js +0 -4
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs,
|
|
2
|
-
import { useEffect, useMemo, useCallback } from "react";
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useCallback, useState, useRef } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { useWatch } from "react-hook-form";
|
|
5
|
-
import {
|
|
5
|
+
import { Grid2, Alert } from "@mui/material";
|
|
6
6
|
import { v4 } from "uuid";
|
|
7
7
|
import * as yup from "yup";
|
|
8
8
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
9
9
|
import { CustomAgGridTable } from "../../agGridTable/CustomAgGridTable.js";
|
|
10
10
|
import { SelectInput } from "../../../ui/reactHookForm/selectInputs/SelectInput.js";
|
|
11
11
|
import { isInjection } from "../../../../utils/types/equipmentTypes.js";
|
|
12
|
-
import { NumericEditor } from "../../agGridTable/cellEditors/numericEditor.js";
|
|
12
|
+
import { suppressNonNumericKeyboardEvent, NumericEditor } from "../../agGridTable/cellEditors/numericEditor.js";
|
|
13
13
|
import { InputWithPopupConfirmation } from "../../../ui/reactHookForm/selectInputs/InputWithPopupConfirmation.js";
|
|
14
14
|
import { toFloatOrNullValue } from "../../../ui/reactHookForm/utils/functions.js";
|
|
15
15
|
import { DISTRIBUTION_KEY } from "../constants/FilterConstants.js";
|
|
@@ -18,17 +18,13 @@ import { useSnackMessage } from "../../../../hooks/useSnackMessage.js";
|
|
|
18
18
|
import { ElementType } from "../../../../utils/types/elementType.js";
|
|
19
19
|
import { ModifyElementSelection } from "../../../ui/dialogs/modifyElementSelection/ModifyElementSelection.js";
|
|
20
20
|
import { exportFilter } from "../../../../services/study.js";
|
|
21
|
-
import {
|
|
22
|
-
import "../../../ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
23
|
-
import "../../../ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
21
|
+
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./ExplicitNamingFilterConstants.js";
|
|
24
22
|
import "../../../../utils/conversionUtils.js";
|
|
25
23
|
import { snackWithFallback } from "../../../../utils/error.js";
|
|
26
24
|
import "../../../../utils/types/equipmentType.js";
|
|
25
|
+
import { LANG_SYSTEM } from "../../../../utils/langs.js";
|
|
27
26
|
import "@mui/icons-material";
|
|
28
|
-
import "@hello-pangea/dnd";
|
|
29
27
|
import "../../../ui/overflowableText/OverflowableText.js";
|
|
30
|
-
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./ExplicitNamingFilterConstants.js";
|
|
31
|
-
import { filterStyles } from "../HeaderFilterForm.js";
|
|
32
28
|
import "localized-countries";
|
|
33
29
|
import "localized-countries/data/fr";
|
|
34
30
|
import "localized-countries/data/en";
|
|
@@ -41,10 +37,14 @@ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
|
41
37
|
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
42
38
|
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
43
39
|
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
40
|
+
import "../../../ui/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
44
41
|
import "../../../ui/reactHookForm/expandableInput/ExpandableInput.js";
|
|
42
|
+
import "@hello-pangea/dnd";
|
|
43
|
+
import "../../../ui/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
45
44
|
import "../../../ui/snackbarProvider/SnackbarProvider.js";
|
|
46
45
|
import "mui-nested-menu";
|
|
47
46
|
import "react-resizable-panels";
|
|
47
|
+
import { CsvPicker } from "../../../ui/csvPicker/csv-picker.js";
|
|
48
48
|
const explicitNamingFilterSchema = {
|
|
49
49
|
[FILTER_EQUIPMENTS_ATTRIBUTES]: yup.array().of(
|
|
50
50
|
yup.object().shape({
|
|
@@ -118,6 +118,7 @@ function ExplicitNamingFilterForm({
|
|
|
118
118
|
editable: true,
|
|
119
119
|
singleClickEdit: true,
|
|
120
120
|
cellEditor: NumericEditor,
|
|
121
|
+
suppressKeyboardEvent: suppressNonNumericKeyboardEvent,
|
|
121
122
|
flex: 1
|
|
122
123
|
});
|
|
123
124
|
}
|
|
@@ -129,25 +130,35 @@ function ExplicitNamingFilterForm({
|
|
|
129
130
|
}),
|
|
130
131
|
[]
|
|
131
132
|
);
|
|
132
|
-
const csvFileHeaders = useMemo(() =>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}, []);
|
|
133
|
+
const csvFileHeaders = useMemo(() => columnDefs.map((c) => c.headerName), [columnDefs]);
|
|
134
|
+
const getDataFromCsvFile = useCallback(
|
|
135
|
+
(csvData) => {
|
|
136
|
+
const [equipmentIdHeader, distributionKeyHeader] = csvFileHeaders;
|
|
137
|
+
return csvData.map((row) => ({
|
|
138
|
+
[FieldConstants.AG_GRID_ROW_UUID]: v4(),
|
|
139
|
+
[FieldConstants.EQUIPMENT_ID]: row[equipmentIdHeader]?.trim() ?? null,
|
|
140
|
+
[DISTRIBUTION_KEY]: distributionKeyHeader ? toFloatOrNullValue(row[distributionKeyHeader]?.trim()) : null
|
|
141
|
+
}));
|
|
142
|
+
},
|
|
143
|
+
[csvFileHeaders]
|
|
144
|
+
);
|
|
145
|
+
const [selectedFile, setSelectedFile] = useState();
|
|
146
|
+
const [fileErrorMessage, setFileErrorMessage] = useState();
|
|
147
|
+
const tableRef = useRef(null);
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
setSelectedFile(void 0);
|
|
150
|
+
setFileErrorMessage(void 0);
|
|
151
|
+
}, [watchEquipmentType]);
|
|
152
|
+
const getTemplateData = useCallback(() => [csvFileHeaders], [csvFileHeaders]);
|
|
153
|
+
const getTableData = useCallback(() => {
|
|
154
|
+
const rows = getValues(FILTER_EQUIPMENTS_ATTRIBUTES) ?? [];
|
|
155
|
+
return [
|
|
156
|
+
csvFileHeaders,
|
|
157
|
+
...rows.map(
|
|
158
|
+
(r) => forGeneratorBatteryOrLoad ? [r[FieldConstants.EQUIPMENT_ID] ?? "", r[DISTRIBUTION_KEY] ?? ""] : [r[FieldConstants.EQUIPMENT_ID] ?? ""]
|
|
159
|
+
)
|
|
160
|
+
];
|
|
161
|
+
}, [csvFileHeaders, forGeneratorBatteryOrLoad, getValues]);
|
|
151
162
|
const openConfirmationPopup = () => {
|
|
152
163
|
return getValues(FILTER_EQUIPMENTS_ATTRIBUTES).some(
|
|
153
164
|
(row) => row[DISTRIBUTION_KEY] || row[FieldConstants.EQUIPMENT_ID]
|
|
@@ -170,69 +181,89 @@ function ExplicitNamingFilterForm({
|
|
|
170
181
|
(error) => snackWithFallback(snackError, error, { headerId: "convertIntoExplicitNamingFilterError" })
|
|
171
182
|
);
|
|
172
183
|
};
|
|
173
|
-
return /* @__PURE__ */ jsxs(
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
184
|
+
return /* @__PURE__ */ jsxs(
|
|
185
|
+
Grid2,
|
|
186
|
+
{
|
|
187
|
+
container: true,
|
|
188
|
+
direction: "column",
|
|
189
|
+
spacing: 2,
|
|
190
|
+
padding: 1,
|
|
191
|
+
sx: { flexGrow: 1, flexWrap: "nowrap", minHeight: 0 },
|
|
192
|
+
children: [
|
|
193
|
+
/* @__PURE__ */ jsxs(Grid2, { container: true, justifyContent: "space-between", alignItems: "center", children: [
|
|
194
|
+
/* @__PURE__ */ jsxs(Grid2, { children: [
|
|
195
|
+
/* @__PURE__ */ jsx(
|
|
196
|
+
InputWithPopupConfirmation,
|
|
197
|
+
{
|
|
198
|
+
Input: SelectInput,
|
|
199
|
+
name: FieldConstants.EQUIPMENT_TYPE,
|
|
200
|
+
options: Object.values(FILTER_EQUIPMENTS),
|
|
201
|
+
disabled: !!sourceFilterForExplicitNamingConversion || isEditing && !isDeveloperMode,
|
|
202
|
+
label: "equipmentType",
|
|
203
|
+
shouldOpenPopup: openConfirmationPopup,
|
|
204
|
+
resetOnConfirmation: handleResetOnConfirmation,
|
|
205
|
+
message: "changeTypeMessage",
|
|
206
|
+
validateButtonLabel: "button.changeType",
|
|
207
|
+
sx: { width: 400, maxWidth: "100%" },
|
|
208
|
+
"data-testid": "EquipmentTypeSelector"
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
sourceFilterForExplicitNamingConversion && /* @__PURE__ */ jsx(
|
|
212
|
+
ModifyElementSelection,
|
|
213
|
+
{
|
|
214
|
+
elementType: ElementType.STUDY,
|
|
215
|
+
onElementValidated: onStudySelected,
|
|
216
|
+
dialogOpeningButtonLabel: "selectStudyDialogButton",
|
|
217
|
+
dialogTitleLabel: "selectStudyDialogTitle",
|
|
218
|
+
dialogMessageLabel: "selectStudyText",
|
|
219
|
+
noElementMessageLabel: "noSelectedStudyText"
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
] }),
|
|
223
|
+
/* @__PURE__ */ jsx(Grid2, { children: /* @__PURE__ */ jsx(
|
|
224
|
+
CsvPicker,
|
|
225
|
+
{
|
|
226
|
+
label: "UploadCSV",
|
|
227
|
+
header: csvFileHeaders,
|
|
228
|
+
language: language ?? LANG_SYSTEM,
|
|
229
|
+
disabled: !watchEquipmentType,
|
|
230
|
+
selectedFile,
|
|
231
|
+
onFileChange: setSelectedFile,
|
|
232
|
+
onFileError: setFileErrorMessage,
|
|
233
|
+
getTableData: () => getValues(FILTER_EQUIPMENTS_ATTRIBUTES),
|
|
234
|
+
onAppend: (results) => tableRef.current?.append(getDataFromCsvFile(results.data)),
|
|
235
|
+
onReplace: (results) => tableRef.current?.replace(getDataFromCsvFile(results.data))
|
|
236
|
+
}
|
|
237
|
+
) })
|
|
238
|
+
] }),
|
|
239
|
+
fileErrorMessage && /* @__PURE__ */ jsx(Grid2, { children: /* @__PURE__ */ jsx(Alert, { severity: "error", children: fileErrorMessage }) }),
|
|
240
|
+
watchEquipmentType && /* @__PURE__ */ jsx(Grid2, { sx: { flexGrow: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx(
|
|
241
|
+
CustomAgGridTable,
|
|
242
|
+
{
|
|
243
|
+
ref: tableRef,
|
|
244
|
+
name: FILTER_EQUIPMENTS_ATTRIBUTES,
|
|
245
|
+
columnDefs,
|
|
246
|
+
defaultColDef,
|
|
247
|
+
makeDefaultRowData,
|
|
248
|
+
pagination: true,
|
|
249
|
+
rowSelection: {
|
|
250
|
+
mode: "multiRow",
|
|
251
|
+
enableClickSelection: false,
|
|
252
|
+
checkboxes: true,
|
|
253
|
+
headerCheckbox: true
|
|
254
|
+
},
|
|
255
|
+
alwaysShowVerticalScroll: true,
|
|
256
|
+
csvProps: {
|
|
257
|
+
fileName: intl.formatMessage({ id: "filterCsvFileName" }),
|
|
258
|
+
language,
|
|
259
|
+
getTemplateData,
|
|
260
|
+
getTableData
|
|
261
|
+
}
|
|
231
262
|
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
263
|
+
) })
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
);
|
|
236
267
|
}
|
|
237
268
|
export {
|
|
238
269
|
ExplicitNamingFilterForm,
|
|
@@ -43,10 +43,9 @@ import { GroupValueEditor } from "./reactQueryBuilder/compositeRuleEditor/GroupV
|
|
|
43
43
|
import { RuleValueEditor } from "./reactQueryBuilder/compositeRuleEditor/RuleValueEditor.js";
|
|
44
44
|
import { useConvertValue } from "./reactQueryBuilder/hooks/useConvertValue.js";
|
|
45
45
|
import { useValid } from "./reactQueryBuilder/hooks/useValid.js";
|
|
46
|
-
import {
|
|
46
|
+
import { BottomTableButtons } from "./agGridTable/BottomTableButtons.js";
|
|
47
47
|
import { CustomAgGridTable } from "./agGridTable/CustomAgGridTable.js";
|
|
48
|
-
import { NumericEditor } from "./agGridTable/cellEditors/numericEditor.js";
|
|
49
|
-
import { CsvUploader } from "./agGridTable/csvUploader/CsvUploader.js";
|
|
48
|
+
import { NumericEditor, suppressNonNumericKeyboardEvent } from "./agGridTable/cellEditors/numericEditor.js";
|
|
50
49
|
import { CUSTOM_AGGRID_THEME, styles } from "./customAGGrid/customAggrid.style.js";
|
|
51
50
|
import { CustomAGGrid } from "./customAGGrid/customAggrid.js";
|
|
52
51
|
import { SeparatorCellRenderer } from "./customAGGrid/separatorCellRenderer.js";
|
|
@@ -55,7 +54,7 @@ export {
|
|
|
55
54
|
AutocompleteWithFavorites,
|
|
56
55
|
BooleanCellRenderer,
|
|
57
56
|
BooleanNullableCellRenderer,
|
|
58
|
-
|
|
57
|
+
BottomTableButtons,
|
|
59
58
|
COMBINATOR_OPTIONS,
|
|
60
59
|
CONTINGENCY_LIST_EQUIPMENTS,
|
|
61
60
|
CONVERTERS_MODE_OPTIONS,
|
|
@@ -64,7 +63,6 @@ export {
|
|
|
64
63
|
CombinatorType,
|
|
65
64
|
ContingencyCellRenderer,
|
|
66
65
|
CountryValueEditor,
|
|
67
|
-
CsvUploader,
|
|
68
66
|
CustomAGGrid,
|
|
69
67
|
CustomAgGridTable,
|
|
70
68
|
CustomReactQueryBuilder,
|
|
@@ -139,6 +137,7 @@ export {
|
|
|
139
137
|
saveExpertFilter,
|
|
140
138
|
saveExplicitNamingFilter,
|
|
141
139
|
styles,
|
|
140
|
+
suppressNonNumericKeyboardEvent,
|
|
142
141
|
testQuery,
|
|
143
142
|
useConvertValue,
|
|
144
143
|
useElementSearch,
|
package/dist/components/index.js
CHANGED
|
@@ -68,6 +68,7 @@ import { ResizeHandle } from "./ui/resizablePanels/ResizeHandle.js";
|
|
|
68
68
|
import { CsvExport } from "./ui/csvDownloader/csv-export.js";
|
|
69
69
|
import { ExportCsvButton } from "./ui/csvDownloader/export-csv-button.js";
|
|
70
70
|
import { fetchCsvSeparator, useCsvExport } from "./ui/csvDownloader/use-csv-export.js";
|
|
71
|
+
import { CsvPicker } from "./ui/csvPicker/csv-picker.js";
|
|
71
72
|
import { TreeViewFinder, generateTreeViewFinderClass } from "./ui/treeViewFinder/TreeViewFinder.js";
|
|
72
73
|
import { doesNodeHasChildren } from "./ui/treeViewFinder/TreeViewUtils.js";
|
|
73
74
|
import { DirectoryItemSelector } from "./ui/directoryItemSelector/DirectoryItemSelector.js";
|
|
@@ -116,10 +117,9 @@ import { GroupValueEditor } from "./composite/reactQueryBuilder/compositeRuleEdi
|
|
|
116
117
|
import { RuleValueEditor } from "./composite/reactQueryBuilder/compositeRuleEditor/RuleValueEditor.js";
|
|
117
118
|
import { useConvertValue } from "./composite/reactQueryBuilder/hooks/useConvertValue.js";
|
|
118
119
|
import { useValid } from "./composite/reactQueryBuilder/hooks/useValid.js";
|
|
119
|
-
import {
|
|
120
|
+
import { BottomTableButtons } from "./composite/agGridTable/BottomTableButtons.js";
|
|
120
121
|
import { CustomAgGridTable } from "./composite/agGridTable/CustomAgGridTable.js";
|
|
121
|
-
import { NumericEditor } from "./composite/agGridTable/cellEditors/numericEditor.js";
|
|
122
|
-
import { CsvUploader } from "./composite/agGridTable/csvUploader/CsvUploader.js";
|
|
122
|
+
import { NumericEditor, suppressNonNumericKeyboardEvent } from "./composite/agGridTable/cellEditors/numericEditor.js";
|
|
123
123
|
import { CUSTOM_AGGRID_THEME, styles } from "./composite/customAGGrid/customAggrid.style.js";
|
|
124
124
|
import { CustomAGGrid } from "./composite/customAGGrid/customAggrid.js";
|
|
125
125
|
import { SeparatorCellRenderer } from "./composite/customAGGrid/separatorCellRenderer.js";
|
|
@@ -135,7 +135,7 @@ export {
|
|
|
135
135
|
BooleanCellRenderer,
|
|
136
136
|
BooleanInput,
|
|
137
137
|
BooleanNullableCellRenderer,
|
|
138
|
-
|
|
138
|
+
BottomTableButtons,
|
|
139
139
|
ButtonReadOnlyInput,
|
|
140
140
|
COMBINATOR_OPTIONS,
|
|
141
141
|
CONTINGENCY_LIST_EQUIPMENTS,
|
|
@@ -153,7 +153,7 @@ export {
|
|
|
153
153
|
CountrySelectionInput,
|
|
154
154
|
CountryValueEditor,
|
|
155
155
|
CsvExport,
|
|
156
|
-
|
|
156
|
+
CsvPicker,
|
|
157
157
|
CustomAGGrid,
|
|
158
158
|
CustomAgGridTable,
|
|
159
159
|
CustomFormContext,
|
|
@@ -296,6 +296,7 @@ export {
|
|
|
296
296
|
saveExpertFilter,
|
|
297
297
|
saveExplicitNamingFilter,
|
|
298
298
|
styles,
|
|
299
|
+
suppressNonNumericKeyboardEvent,
|
|
299
300
|
testQuery,
|
|
300
301
|
toFloatOrNullValue,
|
|
301
302
|
unscrollableDialogStyles,
|
|
@@ -2,7 +2,7 @@ import { useCallback } from "react";
|
|
|
2
2
|
import { useIntl } from "react-intl";
|
|
3
3
|
import "../../../utils/conversionUtils.js";
|
|
4
4
|
import "../../../utils/types/equipmentType.js";
|
|
5
|
-
import { LANG_FRENCH } from "../../../utils/langs.js";
|
|
5
|
+
import { getCsvDelimiter, LANG_FRENCH } from "../../../utils/langs.js";
|
|
6
6
|
import "react/jsx-runtime";
|
|
7
7
|
import "@mui/icons-material";
|
|
8
8
|
import { fetchStudyMetadata } from "../../../services/appsMetadata.js";
|
|
@@ -37,7 +37,7 @@ const useCsvExport = () => {
|
|
|
37
37
|
return tableName.trim().replace(/[\\/:"*?<>|\s]/g, "-").substring(0, 27);
|
|
38
38
|
};
|
|
39
39
|
const prefix = props.tableNamePrefix ?? "";
|
|
40
|
-
const defaultSeparator = props.language
|
|
40
|
+
const defaultSeparator = getCsvDelimiter(props.language);
|
|
41
41
|
const columnSeparatorValue = props.isCopyCsv ? await fetchCsvSeparator() ?? defaultSeparator : defaultSeparator;
|
|
42
42
|
return props.getData({
|
|
43
43
|
suppressQuotes: false,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ParseResult } from 'papaparse';
|
|
2
|
+
export interface CsvPickerConfirmationDialogProps<TData = unknown> {
|
|
3
|
+
pendingImport: {
|
|
4
|
+
results: ParseResult<TData>;
|
|
5
|
+
file: File;
|
|
6
|
+
} | null;
|
|
7
|
+
onReplace: (results: ParseResult<TData>, file: File) => void;
|
|
8
|
+
onAppend: (results: ParseResult<TData>, file: File) => void;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function CsvPickerConfirmationDialog<TData = unknown>({ pendingImport, onReplace, onAppend, onClose, }: CsvPickerConfirmationDialogProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
3
|
+
import { Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button } from "@mui/material";
|
|
4
|
+
import "../overflowableText/OverflowableText.js";
|
|
5
|
+
import "../../../utils/conversionUtils.js";
|
|
6
|
+
import "../../../utils/types/equipmentType.js";
|
|
7
|
+
import "@mui/icons-material";
|
|
8
|
+
import "react";
|
|
9
|
+
import "react-hook-form";
|
|
10
|
+
import "localized-countries";
|
|
11
|
+
import "localized-countries/data/fr";
|
|
12
|
+
import "localized-countries/data/en";
|
|
13
|
+
import "notistack";
|
|
14
|
+
import "../reactHookForm/provider/CustomFormProvider.js";
|
|
15
|
+
import { CancelButton } from "../reactHookForm/utils/CancelButton.js";
|
|
16
|
+
import "yup";
|
|
17
|
+
import "../treeViewFinder/TreeViewFinder.js";
|
|
18
|
+
import "../reactHookForm/numbers/RangeInput.js";
|
|
19
|
+
import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
|
|
20
|
+
import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
|
|
21
|
+
import "@material-symbols/svg-400/outlined/arrows_input.svg?react";
|
|
22
|
+
import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
|
|
23
|
+
import "@material-symbols/svg-400/outlined/add_notes.svg?react";
|
|
24
|
+
import "../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
25
|
+
import "../reactHookForm/expandableInput/ExpandableInput.js";
|
|
26
|
+
function CsvPickerConfirmationDialog({
|
|
27
|
+
pendingImport,
|
|
28
|
+
onReplace,
|
|
29
|
+
onAppend,
|
|
30
|
+
onClose
|
|
31
|
+
}) {
|
|
32
|
+
const intl = useIntl();
|
|
33
|
+
return /* @__PURE__ */ jsxs(Dialog, { open: pendingImport !== null, "aria-labelledby": "csv-picker-confirmation", children: [
|
|
34
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "csv-picker-confirmation", children: "Confirmation" }),
|
|
35
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogContentText, { children: intl.formatMessage({ id: "keepCSVDataMessage" }) }) }),
|
|
36
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
37
|
+
/* @__PURE__ */ jsx(CancelButton, { onClick: onClose }),
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
Button,
|
|
40
|
+
{
|
|
41
|
+
variant: "outlined",
|
|
42
|
+
onClick: () => {
|
|
43
|
+
onReplace(pendingImport.results, pendingImport.file);
|
|
44
|
+
onClose();
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ jsx(FormattedMessage, { id: "replace" })
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
Button,
|
|
51
|
+
{
|
|
52
|
+
variant: "outlined",
|
|
53
|
+
onClick: () => {
|
|
54
|
+
onAppend(pendingImport.results, pendingImport.file);
|
|
55
|
+
onClose();
|
|
56
|
+
},
|
|
57
|
+
children: /* @__PURE__ */ jsx(FormattedMessage, { id: "add" })
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
] })
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
CsvPickerConfirmationDialog
|
|
65
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ParseConfig, ParseResult } from 'papaparse';
|
|
2
|
+
type CsvPickerCallbacks<TData> = {
|
|
3
|
+
onComplete: (results: ParseResult<TData>, file: File) => void;
|
|
4
|
+
onAppend?: never;
|
|
5
|
+
onReplace?: never;
|
|
6
|
+
} | {
|
|
7
|
+
onComplete?: never;
|
|
8
|
+
onAppend: (results: ParseResult<TData>, file: File) => void;
|
|
9
|
+
onReplace: (results: ParseResult<TData>, file: File) => void;
|
|
10
|
+
};
|
|
11
|
+
export type CsvPickerProps<TData = unknown> = {
|
|
12
|
+
label: string;
|
|
13
|
+
header: string[];
|
|
14
|
+
maxLineNumber?: number;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
language: string;
|
|
17
|
+
parseConfig?: Partial<ParseConfig<TData>>;
|
|
18
|
+
selectedFile?: File;
|
|
19
|
+
onFileChange: (file: File | undefined) => void;
|
|
20
|
+
onFileError: (error: string | undefined) => void;
|
|
21
|
+
getTableData?: () => unknown[];
|
|
22
|
+
} & CsvPickerCallbacks<TData>;
|
|
23
|
+
export declare function CsvPicker<TData = unknown>({ label, header, maxLineNumber, disabled, language, parseConfig, selectedFile, onFileChange, onFileError, onComplete, onAppend, onReplace, getTableData, }: CsvPickerProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
4
|
+
import { Button } from "@mui/material";
|
|
5
|
+
import { useCSVReader } from "react-papaparse";
|
|
6
|
+
import { equalsArrayAnyOrder } from "../../../utils/algos.js";
|
|
7
|
+
import "../../../utils/conversionUtils.js";
|
|
8
|
+
import "../../../utils/types/equipmentType.js";
|
|
9
|
+
import { hasNonEmptyRows } from "../../../utils/functions.js";
|
|
10
|
+
import { getCsvDelimiter } from "../../../utils/langs.js";
|
|
11
|
+
import "@mui/icons-material";
|
|
12
|
+
import { CsvPickerConfirmationDialog } from "./csv-picker-confirmation-dialog.js";
|
|
13
|
+
function CsvPicker({
|
|
14
|
+
label,
|
|
15
|
+
header,
|
|
16
|
+
maxLineNumber,
|
|
17
|
+
disabled = false,
|
|
18
|
+
language,
|
|
19
|
+
parseConfig,
|
|
20
|
+
selectedFile,
|
|
21
|
+
onFileChange,
|
|
22
|
+
onFileError,
|
|
23
|
+
onComplete,
|
|
24
|
+
onAppend,
|
|
25
|
+
onReplace,
|
|
26
|
+
getTableData
|
|
27
|
+
}) {
|
|
28
|
+
const intl = useIntl();
|
|
29
|
+
const { CSVReader } = useCSVReader();
|
|
30
|
+
const [pendingImport, setPendingImport] = useState(null);
|
|
31
|
+
const handleUploadAccepted = useCallback(
|
|
32
|
+
(results, acceptedFile) => {
|
|
33
|
+
if (results.data.length === 0) {
|
|
34
|
+
onFileError(intl.formatMessage({ id: "noDataInCsvFile" }, { filename: acceptedFile.name }));
|
|
35
|
+
} else if (!equalsArrayAnyOrder(header, Object.keys(results.data[0]))) {
|
|
36
|
+
console.warn("Wrong CSV headers");
|
|
37
|
+
console.warn("Expected:", header);
|
|
38
|
+
console.warn("Actual:", Object.keys(results.data[0]));
|
|
39
|
+
onFileError(intl.formatMessage({ id: "wrongCsvHeadersError" }, { filename: acceptedFile.name }));
|
|
40
|
+
} else if (maxLineNumber && results.data.length > maxLineNumber) {
|
|
41
|
+
onFileError(
|
|
42
|
+
intl.formatMessage(
|
|
43
|
+
{ id: "tooManyLinesInCsvFile" },
|
|
44
|
+
{ value: maxLineNumber, filename: acceptedFile.name }
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
} else {
|
|
48
|
+
onFileError(void 0);
|
|
49
|
+
if (onAppend && onReplace) {
|
|
50
|
+
if (hasNonEmptyRows(getTableData?.())) {
|
|
51
|
+
setPendingImport({ results, file: acceptedFile });
|
|
52
|
+
} else {
|
|
53
|
+
onReplace(results, acceptedFile);
|
|
54
|
+
onFileChange(acceptedFile);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
onComplete?.(results, acceptedFile);
|
|
58
|
+
onFileChange(acceptedFile);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
[header, intl, maxLineNumber, onAppend, onComplete, onFileChange, onFileError, onReplace, getTableData]
|
|
63
|
+
);
|
|
64
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
CSVReader,
|
|
67
|
+
{
|
|
68
|
+
config: {
|
|
69
|
+
header: true,
|
|
70
|
+
skipEmptyLines: true,
|
|
71
|
+
comments: "#",
|
|
72
|
+
delimiter: getCsvDelimiter(language),
|
|
73
|
+
...parseConfig
|
|
74
|
+
},
|
|
75
|
+
onUploadAccepted: handleUploadAccepted,
|
|
76
|
+
children: ({ getRootProps, ProgressBar }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
style: {
|
|
81
|
+
marginRight: "10px",
|
|
82
|
+
fontWeight: "bold"
|
|
83
|
+
},
|
|
84
|
+
children: selectedFile ? selectedFile.name : intl.formatMessage({ id: "uploadMessage" })
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ jsxs(Button, { ...getRootProps(), variant: "outlined", disabled, children: [
|
|
88
|
+
/* @__PURE__ */ jsx(FormattedMessage, { id: label }),
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
ProgressBar,
|
|
91
|
+
{
|
|
92
|
+
style: {
|
|
93
|
+
position: "absolute",
|
|
94
|
+
inset: 0,
|
|
95
|
+
width: "100%",
|
|
96
|
+
height: "100%"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] })
|
|
101
|
+
] })
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
onAppend && onReplace && /* @__PURE__ */ jsx(
|
|
105
|
+
CsvPickerConfirmationDialog,
|
|
106
|
+
{
|
|
107
|
+
pendingImport,
|
|
108
|
+
onReplace: (r, f) => {
|
|
109
|
+
onReplace(r, f);
|
|
110
|
+
onFileChange(f);
|
|
111
|
+
},
|
|
112
|
+
onAppend: (r, f) => {
|
|
113
|
+
onAppend(r, f);
|
|
114
|
+
onFileChange(f);
|
|
115
|
+
},
|
|
116
|
+
onClose: () => setPendingImport(null)
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
CsvPicker
|
|
123
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2026, RTE (http://www.rte-france.com)
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
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 './
|
|
7
|
+
export * from './csv-picker';
|
|
@@ -118,7 +118,7 @@ function ElementSaveDialog({
|
|
|
118
118
|
onClose();
|
|
119
119
|
}, [onClose, reset, initialOperation]);
|
|
120
120
|
useEffect(() => {
|
|
121
|
-
if (!isCreateMode) {
|
|
121
|
+
if (!isCreateMode || !defaultName && !prefixIdForGeneratedName) {
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
const name = defaultName ?? `${intl.formatMessage({ id: prefixIdForGeneratedName })}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
@@ -68,6 +68,7 @@ import { ResizeHandle } from "./resizablePanels/ResizeHandle.js";
|
|
|
68
68
|
import { CsvExport } from "./csvDownloader/csv-export.js";
|
|
69
69
|
import { ExportCsvButton } from "./csvDownloader/export-csv-button.js";
|
|
70
70
|
import { fetchCsvSeparator, useCsvExport } from "./csvDownloader/use-csv-export.js";
|
|
71
|
+
import { CsvPicker } from "./csvPicker/csv-picker.js";
|
|
71
72
|
import { TreeViewFinder, generateTreeViewFinderClass } from "./treeViewFinder/TreeViewFinder.js";
|
|
72
73
|
import { doesNodeHasChildren } from "./treeViewFinder/TreeViewUtils.js";
|
|
73
74
|
import { DirectoryItemSelector } from "./directoryItemSelector/DirectoryItemSelector.js";
|
|
@@ -88,6 +89,7 @@ export {
|
|
|
88
89
|
CountriesInput,
|
|
89
90
|
CountrySelectionInput,
|
|
90
91
|
CsvExport,
|
|
92
|
+
CsvPicker,
|
|
91
93
|
CustomFormContext,
|
|
92
94
|
CustomFormProvider,
|
|
93
95
|
CustomMenuItem,
|