@gridsuite/commons-ui 0.227.0 → 0.229.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/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.d.ts +2 -1
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +6 -14
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +2 -0
- package/dist/components/ui/treeViewFinder/TreeViewFinder.js +14 -2
- 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-constants.d.ts +1 -1
- package/dist/features/network-modifications/by-filter/assignment/assignment/assignment-constants.js +17 -2
- 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 +10 -8
- package/dist/features/network-modifications/common/measurements/PowerWithValidityForm.js +1 -0
- package/dist/features/network-modifications/common/measurements/measurement.type.d.ts +5 -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/network-modifications/voltageLevel/modification/voltageLevelModification.utils.d.ts +1 -5
- 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 +2 -1
- 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/en/networkModificationsEn.d.ts +2 -0
- package/dist/translations/en/networkModificationsEn.js +2 -0
- 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/translations/fr/networkModificationsFr.d.ts +2 -0
- package/dist/translations/fr/networkModificationsFr.js +2 -0
- 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/dist/utils/types/elementType.d.ts +1 -0
- package/dist/utils/types/elementType.js +1 -0
- package/dist/utils/types/fieldType.d.ts +2 -0
- package/dist/utils/types/fieldType.js +2 -0
- package/package.json +1 -2
- 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,182 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Dialog, DialogTitle, DialogContent, Grid, Button, Alert, DialogActions, DialogContentText } from "@mui/material";
|
|
3
|
-
import { useCSVReader, RECORD_SEP, UNIT_SEP } from "react-papaparse";
|
|
4
|
-
import React, { useState, useMemo } from "react";
|
|
5
|
-
import { useIntl, FormattedMessage } from "react-intl";
|
|
6
|
-
import CsvDownloader from "react-csv-downloader";
|
|
7
|
-
import { useWatch } from "react-hook-form";
|
|
8
|
-
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
9
|
-
import "../../../../utils/conversionUtils.js";
|
|
10
|
-
import "../../../../utils/types/equipmentType.js";
|
|
11
|
-
import { LANG_FRENCH } from "../../../../utils/langs.js";
|
|
12
|
-
import "@mui/icons-material";
|
|
13
|
-
import { CancelButton } from "../../../ui/reactHookForm/utils/CancelButton.js";
|
|
14
|
-
import "yup";
|
|
15
|
-
function CsvUploader({
|
|
16
|
-
name,
|
|
17
|
-
onClose,
|
|
18
|
-
open,
|
|
19
|
-
title,
|
|
20
|
-
fileHeaders,
|
|
21
|
-
fileName,
|
|
22
|
-
csvData,
|
|
23
|
-
validateData = () => true,
|
|
24
|
-
getDataFromCsv,
|
|
25
|
-
useFieldArrayOutput,
|
|
26
|
-
language
|
|
27
|
-
}) {
|
|
28
|
-
const watchTableValues = useWatch({ name });
|
|
29
|
-
const { append, replace } = useFieldArrayOutput;
|
|
30
|
-
const [createError, setCreateError] = React.useState("");
|
|
31
|
-
const intl = useIntl();
|
|
32
|
-
const { CSVReader } = useCSVReader();
|
|
33
|
-
const [importedData, setImportedData] = useState([]);
|
|
34
|
-
const [isConfirmationPopupOpen, setIsConfirmationPopupOpen] = useState(false);
|
|
35
|
-
const data = useMemo(() => {
|
|
36
|
-
const newData = [...[fileHeaders]];
|
|
37
|
-
if (Array.isArray(csvData)) {
|
|
38
|
-
csvData.forEach((row) => newData.push([row]));
|
|
39
|
-
}
|
|
40
|
-
return newData;
|
|
41
|
-
}, [csvData, fileHeaders]);
|
|
42
|
-
const handleClose = () => {
|
|
43
|
-
onClose();
|
|
44
|
-
setCreateError("");
|
|
45
|
-
};
|
|
46
|
-
const validateCsvFile = (rows) => {
|
|
47
|
-
if (rows.length === 0) {
|
|
48
|
-
setCreateError(intl.formatMessage({ id: "noDataInCsvFile" }));
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
for (let i = 0; i < fileHeaders.length; i++) {
|
|
52
|
-
if (fileHeaders[i] !== "" && rows[0][i] !== fileHeaders[i]) {
|
|
53
|
-
setCreateError(intl.formatMessage({ id: "wrongCsvHeadersError" }));
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return validateData(rows);
|
|
58
|
-
};
|
|
59
|
-
const getResultsFromImportedData = () => {
|
|
60
|
-
return importedData.filter((row) => {
|
|
61
|
-
if (row[0].startsWith("#")) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
return row.some((column) => !!column?.trim());
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
const handleFileSubmit = (keepTableValues) => {
|
|
68
|
-
if (importedData.length !== 0) {
|
|
69
|
-
const result = getResultsFromImportedData();
|
|
70
|
-
if (validateCsvFile(result)) {
|
|
71
|
-
result.splice(0, 1);
|
|
72
|
-
const dataFromCsv = getDataFromCsv(result);
|
|
73
|
-
if (keepTableValues) {
|
|
74
|
-
append(dataFromCsv);
|
|
75
|
-
} else {
|
|
76
|
-
replace(dataFromCsv);
|
|
77
|
-
}
|
|
78
|
-
handleClose();
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
setCreateError(intl.formatMessage({ id: "noDataInCsvFile" }));
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const handleOpenCSVConfirmationDataDialog = () => {
|
|
85
|
-
const isValuesInTable = Array.isArray(watchTableValues) && watchTableValues.some(
|
|
86
|
-
(val) => val && Object.keys(val).filter((key) => key !== FieldConstants.AG_GRID_ROW_UUID).some((e) => val[e] !== void 0 && val[e] !== null && String(val[e]).trim().length > 0)
|
|
87
|
-
);
|
|
88
|
-
if (isValuesInTable && getResultsFromImportedData().length > 0) {
|
|
89
|
-
setIsConfirmationPopupOpen(true);
|
|
90
|
-
} else {
|
|
91
|
-
setIsConfirmationPopupOpen(false);
|
|
92
|
-
handleFileSubmit(false);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
const handleAddPopupConfirmation = () => {
|
|
96
|
-
handleFileSubmit(true);
|
|
97
|
-
setIsConfirmationPopupOpen(false);
|
|
98
|
-
};
|
|
99
|
-
const handleReplacePopupConfirmation = () => {
|
|
100
|
-
handleFileSubmit(false);
|
|
101
|
-
setIsConfirmationPopupOpen(false);
|
|
102
|
-
};
|
|
103
|
-
const handleCancelDialog = () => {
|
|
104
|
-
setIsConfirmationPopupOpen(false);
|
|
105
|
-
};
|
|
106
|
-
const renderConfirmationCsvData = () => {
|
|
107
|
-
return /* @__PURE__ */ jsxs(Dialog, { open: isConfirmationPopupOpen, "aria-labelledby": "dialog-confirmation-csv-data", children: [
|
|
108
|
-
/* @__PURE__ */ jsx(DialogTitle, { id: "dialog-confirmation-csv-data", children: "Confirmation" }),
|
|
109
|
-
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogContentText, { children: intl.formatMessage({ id: "keepCSVDataMessage" }) }) }),
|
|
110
|
-
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
111
|
-
/* @__PURE__ */ jsx(CancelButton, { onClick: handleCancelDialog }),
|
|
112
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => handleReplacePopupConfirmation(), variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "replace" }) }),
|
|
113
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => handleAddPopupConfirmation(), variant: "outlined", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "add" }) })
|
|
114
|
-
] })
|
|
115
|
-
] });
|
|
116
|
-
};
|
|
117
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
118
|
-
/* @__PURE__ */ jsxs(Dialog, { open, onClose: handleClose, fullWidth: true, children: [
|
|
119
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: title }),
|
|
120
|
-
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs("div", { children: [
|
|
121
|
-
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
122
|
-
/* @__PURE__ */ jsx(Grid, { container: true, item: true, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(
|
|
123
|
-
CsvDownloader,
|
|
124
|
-
{
|
|
125
|
-
datas: data,
|
|
126
|
-
filename: fileName,
|
|
127
|
-
separator: language === LANG_FRENCH ? ";" : ",",
|
|
128
|
-
children: /* @__PURE__ */ jsx(Button, { variant: "contained", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "GenerateCSV" }) })
|
|
129
|
-
}
|
|
130
|
-
) }) }),
|
|
131
|
-
/* @__PURE__ */ jsx(Grid, { container: true, item: true, spacing: 3, children: /* @__PURE__ */ jsx(
|
|
132
|
-
CSVReader,
|
|
133
|
-
{
|
|
134
|
-
onUploadAccepted: (results) => {
|
|
135
|
-
setImportedData([...results.data]);
|
|
136
|
-
setCreateError("");
|
|
137
|
-
},
|
|
138
|
-
config: {
|
|
139
|
-
// We use | for multi values in one cell, then we remove it from the default value for this config, to avoid delimiter autodetection
|
|
140
|
-
delimitersToGuess: [",", " ", ";", RECORD_SEP, UNIT_SEP],
|
|
141
|
-
delimiter: language === LANG_FRENCH ? ";" : ","
|
|
142
|
-
},
|
|
143
|
-
children: ({ getRootProps, acceptedFile }) => /* @__PURE__ */ jsxs(Grid, { item: true, children: [
|
|
144
|
-
/* @__PURE__ */ jsx(Button, { ...getRootProps(), variant: "contained", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "UploadCSV" }) }),
|
|
145
|
-
/* @__PURE__ */ jsx(
|
|
146
|
-
"span",
|
|
147
|
-
{
|
|
148
|
-
style: {
|
|
149
|
-
marginLeft: "10px",
|
|
150
|
-
fontWeight: "bold"
|
|
151
|
-
},
|
|
152
|
-
children: acceptedFile ? acceptedFile.name : intl.formatMessage({
|
|
153
|
-
id: "uploadMessage"
|
|
154
|
-
})
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
] })
|
|
158
|
-
}
|
|
159
|
-
) })
|
|
160
|
-
] }),
|
|
161
|
-
createError !== "" && /* @__PURE__ */ jsx(Alert, { severity: "error", children: createError })
|
|
162
|
-
] }) }),
|
|
163
|
-
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
164
|
-
/* @__PURE__ */ jsx(CancelButton, { onClick: handleClose }),
|
|
165
|
-
/* @__PURE__ */ jsx(
|
|
166
|
-
Button,
|
|
167
|
-
{
|
|
168
|
-
variant: "outlined",
|
|
169
|
-
onClick: () => handleOpenCSVConfirmationDataDialog(),
|
|
170
|
-
disabled: createError !== "",
|
|
171
|
-
"data-testid": "ValidateButton",
|
|
172
|
-
children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" })
|
|
173
|
-
}
|
|
174
|
-
)
|
|
175
|
-
] })
|
|
176
|
-
] }),
|
|
177
|
-
renderConfirmationCsvData()
|
|
178
|
-
] });
|
|
179
|
-
}
|
|
180
|
-
export {
|
|
181
|
-
CsvUploader
|
|
182
|
-
};
|