@gridsuite/commons-ui 0.242.0 → 0.244.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/README.md +6 -2
- package/dist/components/composite/filter/explicitNaming/ExplicitNamingFilterForm.js +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/ui/csvPicker/csv-picker.d.ts +7 -2
- package/dist/components/ui/csvPicker/csv-picker.js +7 -6
- package/dist/components/ui/icons/VoltageUnitIcon.d.ts +2 -0
- package/dist/components/ui/icons/VoltageUnitIcon.js +10 -0
- package/dist/components/ui/icons/index.d.ts +1 -0
- package/dist/components/ui/icons/index.js +3 -1
- package/dist/components/ui/index.js +2 -0
- package/dist/index.js +2 -4
- package/dist/translations/en/index.d.ts +0 -1
- package/dist/translations/en/index.js +0 -2
- package/dist/translations/fr/index.d.ts +0 -1
- package/dist/translations/fr/index.js +0 -2
- package/package.json +1 -1
- package/dist/translations/en/inputsEn.d.ts +0 -24
- package/dist/translations/en/inputsEn.js +0 -21
- package/dist/translations/fr/inputsFr.d.ts +0 -24
- package/dist/translations/fr/inputsFr.js +0 -21
package/README.md
CHANGED
|
@@ -20,8 +20,12 @@ Components are organized as follows:
|
|
|
20
20
|
|
|
21
21
|
#### For developers
|
|
22
22
|
|
|
23
|
-
The commons-ui library
|
|
24
|
-
The `npm start` command
|
|
23
|
+
The commons-ui library has a demo app in which you can call your components to test them.
|
|
24
|
+
The `npm start` command installs the library's dependencies then launches the demo app.
|
|
25
|
+
|
|
26
|
+
The commons-ui Storybook is also available at https://www.gridsuite.org/commons-ui/.
|
|
27
|
+
It is the reference place to document and preview reusable UI components from `src/components/ui`.
|
|
28
|
+
When you add a new component under `src/components/ui`, also add the corresponding story so it is available in Storybook.
|
|
25
29
|
|
|
26
30
|
##### Development Scripts
|
|
27
31
|
|
package/dist/components/index.js
CHANGED
|
@@ -65,6 +65,7 @@ import { ArrowsOutputIcon } from "./ui/icons/ArrowsOutputIcon.js";
|
|
|
65
65
|
import { ArrowsInputIcon } from "./ui/icons/ArrowsInputIcon.js";
|
|
66
66
|
import { LeftPanelCloseIcon } from "./ui/icons/LeftPanelCloseIcon.js";
|
|
67
67
|
import { EditNoteIcon } from "./ui/icons/EditNoteIcon.js";
|
|
68
|
+
import { VoltageUnitIcon } from "./ui/icons/VoltageUnitIcon.js";
|
|
68
69
|
import { CustomMenuItem, CustomNestedMenuItem } from "./ui/menus/custom-nested-menu.js";
|
|
69
70
|
import { ResizeHandle } from "./ui/resizablePanels/ResizeHandle.js";
|
|
70
71
|
import { CsvExport } from "./ui/csvDownloader/csv-export.js";
|
|
@@ -331,6 +332,7 @@ export {
|
|
|
331
332
|
UniqueNameInput,
|
|
332
333
|
ValueEditor,
|
|
333
334
|
ValueSelector,
|
|
335
|
+
VoltageUnitIcon,
|
|
334
336
|
addToleranceToFilter,
|
|
335
337
|
computeTolerance,
|
|
336
338
|
countRules,
|
|
@@ -10,7 +10,12 @@ type CsvPickerCallbacks<TData> = {
|
|
|
10
10
|
};
|
|
11
11
|
export type CsvPickerProps<TData = unknown> = {
|
|
12
12
|
label: string;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Columns that must be present in the imported file. The file is accepted as soon as it
|
|
15
|
+
* contains every column listed here, in any order; any column that matches none of them is
|
|
16
|
+
* ignored (not rejected). Pass an empty array to accept any header.
|
|
17
|
+
*/
|
|
18
|
+
requiredColumns: string[];
|
|
14
19
|
maxLineNumber?: number;
|
|
15
20
|
disabled?: boolean;
|
|
16
21
|
language: string;
|
|
@@ -20,5 +25,5 @@ export type CsvPickerProps<TData = unknown> = {
|
|
|
20
25
|
onFileError: (error: string | undefined) => void;
|
|
21
26
|
getTableData?: () => unknown[];
|
|
22
27
|
} & CsvPickerCallbacks<TData>;
|
|
23
|
-
export declare function CsvPicker<TData = unknown>({ label,
|
|
28
|
+
export declare function CsvPicker<TData = unknown>({ label, requiredColumns, maxLineNumber, disabled, language, parseConfig, selectedFile, onFileChange, onFileError, onComplete, onAppend, onReplace, getTableData, }: CsvPickerProps<TData>): import("react").JSX.Element;
|
|
24
29
|
export {};
|
|
@@ -3,7 +3,6 @@ import { useState, useCallback } from "react";
|
|
|
3
3
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
4
4
|
import { Button } from "@mui/material";
|
|
5
5
|
import { useCSVReader } from "react-papaparse";
|
|
6
|
-
import { equalsArrayAnyOrder } from "../../../utils/algos.js";
|
|
7
6
|
import "../../../utils/conversionUtils.js";
|
|
8
7
|
import "../../../utils/types/equipmentType.js";
|
|
9
8
|
import { hasNonEmptyRows } from "../../../utils/functions.js";
|
|
@@ -12,7 +11,7 @@ import "@mui/icons-material";
|
|
|
12
11
|
import { CsvPickerConfirmationDialog } from "./csv-picker-confirmation-dialog.js";
|
|
13
12
|
function CsvPicker({
|
|
14
13
|
label,
|
|
15
|
-
|
|
14
|
+
requiredColumns,
|
|
16
15
|
maxLineNumber,
|
|
17
16
|
disabled = false,
|
|
18
17
|
language,
|
|
@@ -30,12 +29,14 @@ function CsvPicker({
|
|
|
30
29
|
const [pendingImport, setPendingImport] = useState(null);
|
|
31
30
|
const handleUploadAccepted = useCallback(
|
|
32
31
|
(results, acceptedFile) => {
|
|
32
|
+
const actualHeader = Object.keys(results.data[0] ?? {});
|
|
33
|
+
const isHeaderValid = requiredColumns.every((column) => actualHeader.includes(column));
|
|
33
34
|
if (results.data.length === 0) {
|
|
34
35
|
onFileError(intl.formatMessage({ id: "noDataInCsvFile" }, { filename: acceptedFile.name }));
|
|
35
|
-
} else if (!
|
|
36
|
+
} else if (!isHeaderValid) {
|
|
36
37
|
console.warn("Wrong CSV headers");
|
|
37
|
-
console.warn("
|
|
38
|
-
console.warn("Actual:",
|
|
38
|
+
console.warn("Required:", requiredColumns);
|
|
39
|
+
console.warn("Actual:", actualHeader);
|
|
39
40
|
onFileError(intl.formatMessage({ id: "wrongCsvHeadersError" }, { filename: acceptedFile.name }));
|
|
40
41
|
} else if (maxLineNumber && results.data.length > maxLineNumber) {
|
|
41
42
|
onFileError(
|
|
@@ -59,7 +60,7 @@ function CsvPicker({
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
|
-
[
|
|
63
|
+
[requiredColumns, intl, maxLineNumber, onAppend, onComplete, onFileChange, onFileError, onReplace, getTableData]
|
|
63
64
|
);
|
|
64
65
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
66
|
/* @__PURE__ */ jsx(
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
const SvgVoltageUnit = (props) => /* @__PURE__ */ React.createElement("svg", { width: 21, height: 21, viewBox: "-0.265 -0.266 21 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("rect", { x: 2.34576, y: 4.04986, width: 15.7794, height: 12.3676, rx: 1.06618, fill: "none", stroke: "currentColor", strokeWidth: 1.27941 }), /* @__PURE__ */ React.createElement("path", { d: "M6.1435 6.02734V13.4954H4.74414V6.02734H6.1435ZM9.45725 8.23813L7.17358 10.8425L5.94914 12.0815L5.43896 11.0709L6.41074 9.8367L7.77608 8.23813H9.45725ZM8.00445 13.4954L6.44961 11.066L7.41652 10.2206L9.61759 13.4954H8.00445Z", fill: "currentColor" }), /* @__PURE__ */ React.createElement("path", { d: "M12.6981 12.0183L14.3647 6.42091H15.9876L13.5241 13.4954H12.4552L12.6981 12.0183ZM11.1627 6.42091L12.8245 12.0183L13.0771 13.4954H11.9984L9.54957 6.42091H11.1627Z", fill: "currentColor" }));
|
|
5
|
+
function VoltageUnitIcon(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(SvgIcon, { component: SvgVoltageUnit, inheritViewBox: true, ...props });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
VoltageUnitIcon
|
|
10
|
+
};
|
|
@@ -9,3 +9,4 @@ export { ArrowsOutputIcon } from './ArrowsOutputIcon';
|
|
|
9
9
|
export { ArrowsInputIcon } from './ArrowsInputIcon';
|
|
10
10
|
export { LeftPanelCloseIcon } from './LeftPanelCloseIcon';
|
|
11
11
|
export { EditNoteIcon } from './EditNoteIcon';
|
|
12
|
+
export { VoltageUnitIcon } from './VoltageUnitIcon';
|
|
@@ -3,10 +3,12 @@ import { ArrowsOutputIcon } from "./ArrowsOutputIcon.js";
|
|
|
3
3
|
import { ArrowsInputIcon } from "./ArrowsInputIcon.js";
|
|
4
4
|
import { LeftPanelCloseIcon } from "./LeftPanelCloseIcon.js";
|
|
5
5
|
import { EditNoteIcon } from "./EditNoteIcon.js";
|
|
6
|
+
import { VoltageUnitIcon } from "./VoltageUnitIcon.js";
|
|
6
7
|
export {
|
|
7
8
|
ArrowsInputIcon,
|
|
8
9
|
ArrowsOutputIcon,
|
|
9
10
|
EditNoteIcon,
|
|
10
11
|
LeftPanelCloseIcon,
|
|
11
|
-
LeftPanelOpenIcon
|
|
12
|
+
LeftPanelOpenIcon,
|
|
13
|
+
VoltageUnitIcon
|
|
12
14
|
};
|
|
@@ -65,6 +65,7 @@ import { ArrowsOutputIcon } from "./icons/ArrowsOutputIcon.js";
|
|
|
65
65
|
import { ArrowsInputIcon } from "./icons/ArrowsInputIcon.js";
|
|
66
66
|
import { LeftPanelCloseIcon } from "./icons/LeftPanelCloseIcon.js";
|
|
67
67
|
import { EditNoteIcon } from "./icons/EditNoteIcon.js";
|
|
68
|
+
import { VoltageUnitIcon } from "./icons/VoltageUnitIcon.js";
|
|
68
69
|
import { CustomMenuItem, CustomNestedMenuItem } from "./menus/custom-nested-menu.js";
|
|
69
70
|
import { ResizeHandle } from "./resizablePanels/ResizeHandle.js";
|
|
70
71
|
import { CsvExport } from "./csvDownloader/csv-export.js";
|
|
@@ -155,6 +156,7 @@ export {
|
|
|
155
156
|
TextInput,
|
|
156
157
|
TreeViewFinder,
|
|
157
158
|
UniqueNameInput,
|
|
159
|
+
VoltageUnitIcon,
|
|
158
160
|
directoryItemSchema,
|
|
159
161
|
doesNodeHasChildren,
|
|
160
162
|
fetchCsvSeparator,
|
package/dist/index.js
CHANGED
|
@@ -66,6 +66,7 @@ import { ArrowsOutputIcon } from "./components/ui/icons/ArrowsOutputIcon.js";
|
|
|
66
66
|
import { ArrowsInputIcon } from "./components/ui/icons/ArrowsInputIcon.js";
|
|
67
67
|
import { LeftPanelCloseIcon } from "./components/ui/icons/LeftPanelCloseIcon.js";
|
|
68
68
|
import { EditNoteIcon } from "./components/ui/icons/EditNoteIcon.js";
|
|
69
|
+
import { VoltageUnitIcon } from "./components/ui/icons/VoltageUnitIcon.js";
|
|
69
70
|
import { CustomMenuItem, CustomNestedMenuItem } from "./components/ui/menus/custom-nested-menu.js";
|
|
70
71
|
import { ResizeHandle } from "./components/ui/resizablePanels/ResizeHandle.js";
|
|
71
72
|
import { CsvExport } from "./components/ui/csvDownloader/csv-export.js";
|
|
@@ -454,7 +455,6 @@ import { errorsEn } from "./translations/en/errorsEn.js";
|
|
|
454
455
|
import { filterEn } from "./translations/en/filterEn.js";
|
|
455
456
|
import { filterExpertEn } from "./translations/en/filterExpertEn.js";
|
|
456
457
|
import { flatParametersEn } from "./translations/en/flatParametersEn.js";
|
|
457
|
-
import { inputsEn } from "./translations/en/inputsEn.js";
|
|
458
458
|
import { loginEn } from "./translations/en/loginEn.js";
|
|
459
459
|
import { multipleSelectionDialogEn } from "./translations/en/multipleSelectionDialogEn.js";
|
|
460
460
|
import { reportViewerEn } from "./translations/en/reportViewerEn.js";
|
|
@@ -485,7 +485,6 @@ import { errorsFr } from "./translations/fr/errorsFr.js";
|
|
|
485
485
|
import { filterExpertFr } from "./translations/fr/filterExpertFr.js";
|
|
486
486
|
import { filterFr } from "./translations/fr/filterFr.js";
|
|
487
487
|
import { flatParametersFr } from "./translations/fr/flatParametersFr.js";
|
|
488
|
-
import { inputsFr } from "./translations/fr/inputsFr.js";
|
|
489
488
|
import { loginFr } from "./translations/fr/loginFr.js";
|
|
490
489
|
import { multipleSelectionDialogFr } from "./translations/fr/multipleSelectionDialogFr.js";
|
|
491
490
|
import { reportViewerFr } from "./translations/fr/reportViewerFr.js";
|
|
@@ -1121,6 +1120,7 @@ export {
|
|
|
1121
1120
|
VoltageLevelCreationForm,
|
|
1122
1121
|
VoltageLevelModificationForm,
|
|
1123
1122
|
VoltageRegulationForm,
|
|
1123
|
+
VoltageUnitIcon,
|
|
1124
1124
|
WRITE_SLACK_BUS,
|
|
1125
1125
|
YUP_DEFAULT,
|
|
1126
1126
|
YUP_NOT_NULL,
|
|
@@ -1453,8 +1453,6 @@ export {
|
|
|
1453
1453
|
initializeAuthenticationProd,
|
|
1454
1454
|
initializeDirectory,
|
|
1455
1455
|
initializedProperty,
|
|
1456
|
-
inputsEn,
|
|
1457
|
-
inputsFr,
|
|
1458
1456
|
intlInitialVoltageProfileMode,
|
|
1459
1457
|
intlPredefinedParametersOptions,
|
|
1460
1458
|
isBlankOrEmpty,
|
|
@@ -21,7 +21,6 @@ export * from './errorsEn';
|
|
|
21
21
|
export * from './filterEn';
|
|
22
22
|
export * from './filterExpertEn';
|
|
23
23
|
export * from './flatParametersEn';
|
|
24
|
-
export * from './inputsEn';
|
|
25
24
|
export * from './loginEn';
|
|
26
25
|
export * from './multipleSelectionDialogEn';
|
|
27
26
|
export * from './reportViewerEn';
|
|
@@ -15,7 +15,6 @@ import { errorsEn } from "./errorsEn.js";
|
|
|
15
15
|
import { filterEn } from "./filterEn.js";
|
|
16
16
|
import { filterExpertEn } from "./filterExpertEn.js";
|
|
17
17
|
import { flatParametersEn } from "./flatParametersEn.js";
|
|
18
|
-
import { inputsEn } from "./inputsEn.js";
|
|
19
18
|
import { loginEn } from "./loginEn.js";
|
|
20
19
|
import { multipleSelectionDialogEn } from "./multipleSelectionDialogEn.js";
|
|
21
20
|
import { reportViewerEn } from "./reportViewerEn.js";
|
|
@@ -50,7 +49,6 @@ export {
|
|
|
50
49
|
filterExpertEn,
|
|
51
50
|
flatParametersEn,
|
|
52
51
|
importParamsEn,
|
|
53
|
-
inputsEn,
|
|
54
52
|
loginEn,
|
|
55
53
|
multipleSelectionDialogEn,
|
|
56
54
|
networkModificationsEn,
|
|
@@ -21,7 +21,6 @@ export * from './errorsFr';
|
|
|
21
21
|
export * from './filterExpertFr';
|
|
22
22
|
export * from './filterFr';
|
|
23
23
|
export * from './flatParametersFr';
|
|
24
|
-
export * from './inputsFr';
|
|
25
24
|
export * from './loginFr';
|
|
26
25
|
export * from './multipleSelectionDialogFr';
|
|
27
26
|
export * from './reportViewerFr';
|
|
@@ -15,7 +15,6 @@ import { errorsFr } from "./errorsFr.js";
|
|
|
15
15
|
import { filterExpertFr } from "./filterExpertFr.js";
|
|
16
16
|
import { filterFr } from "./filterFr.js";
|
|
17
17
|
import { flatParametersFr } from "./flatParametersFr.js";
|
|
18
|
-
import { inputsFr } from "./inputsFr.js";
|
|
19
18
|
import { loginFr } from "./loginFr.js";
|
|
20
19
|
import { multipleSelectionDialogFr } from "./multipleSelectionDialogFr.js";
|
|
21
20
|
import { reportViewerFr } from "./reportViewerFr.js";
|
|
@@ -50,7 +49,6 @@ export {
|
|
|
50
49
|
filterFr,
|
|
51
50
|
flatParametersFr,
|
|
52
51
|
importParamsFr,
|
|
53
|
-
inputsFr,
|
|
54
52
|
loginFr,
|
|
55
53
|
multipleSelectionDialogFr,
|
|
56
54
|
networkModificationsFr,
|
package/package.json
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022, 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 declare const inputsEn: {
|
|
8
|
-
'inputs/kiki': string;
|
|
9
|
-
'inputs/ney': string;
|
|
10
|
-
'inputs/lapulga': string;
|
|
11
|
-
'inputs/ibra': string;
|
|
12
|
-
'inputs/float': string;
|
|
13
|
-
'inputs/integer': string;
|
|
14
|
-
'inputs/radio': string;
|
|
15
|
-
'inputs/select': string;
|
|
16
|
-
'inputs/slider': string;
|
|
17
|
-
'inputs/text': string;
|
|
18
|
-
'inputs/description': string;
|
|
19
|
-
'inputs/autocomplete': string;
|
|
20
|
-
'inputs/boolean': string;
|
|
21
|
-
'inputs/checkbox': string;
|
|
22
|
-
'inputs/switch': string;
|
|
23
|
-
'inputs/directory-items': string;
|
|
24
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const inputsEn = {
|
|
2
|
-
"inputs/kiki": "Kylian Mbappe",
|
|
3
|
-
"inputs/ney": "Neymar",
|
|
4
|
-
"inputs/lapulga": "Lionel Messi",
|
|
5
|
-
"inputs/ibra": "Zlatan Ibrahimovic",
|
|
6
|
-
"inputs/float": "Float",
|
|
7
|
-
"inputs/integer": "Integer",
|
|
8
|
-
"inputs/radio": "Radio",
|
|
9
|
-
"inputs/select": "Select",
|
|
10
|
-
"inputs/slider": "Slider",
|
|
11
|
-
"inputs/text": "Text",
|
|
12
|
-
"inputs/description": "Description",
|
|
13
|
-
"inputs/autocomplete": "Autocomplete",
|
|
14
|
-
"inputs/boolean": "Boolean",
|
|
15
|
-
"inputs/checkbox": "Checkbox",
|
|
16
|
-
"inputs/switch": "Switch",
|
|
17
|
-
"inputs/directory-items": "Directory items"
|
|
18
|
-
};
|
|
19
|
-
export {
|
|
20
|
-
inputsEn
|
|
21
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022, 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 declare const inputsFr: {
|
|
8
|
-
'inputs/kiki': string;
|
|
9
|
-
'inputs/ney': string;
|
|
10
|
-
'inputs/lapulga': string;
|
|
11
|
-
'inputs/ibra': string;
|
|
12
|
-
'inputs/float': string;
|
|
13
|
-
'inputs/integer': string;
|
|
14
|
-
'inputs/radio': string;
|
|
15
|
-
'inputs/select': string;
|
|
16
|
-
'inputs/slider': string;
|
|
17
|
-
'inputs/text': string;
|
|
18
|
-
'inputs/description': string;
|
|
19
|
-
'inputs/autocomplete': string;
|
|
20
|
-
'inputs/boolean': string;
|
|
21
|
-
'inputs/checkbox': string;
|
|
22
|
-
'inputs/switch': string;
|
|
23
|
-
'inputs/directory-items': string;
|
|
24
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const inputsFr = {
|
|
2
|
-
"inputs/kiki": "Kylian Mbappe",
|
|
3
|
-
"inputs/ney": "Neymar",
|
|
4
|
-
"inputs/lapulga": "Lionel Messi",
|
|
5
|
-
"inputs/ibra": "Zlatan Ibrahimovic",
|
|
6
|
-
"inputs/float": "Float",
|
|
7
|
-
"inputs/integer": "Integer",
|
|
8
|
-
"inputs/radio": "Radio",
|
|
9
|
-
"inputs/select": "Select",
|
|
10
|
-
"inputs/slider": "Slider",
|
|
11
|
-
"inputs/text": "Text",
|
|
12
|
-
"inputs/description": "Description",
|
|
13
|
-
"inputs/autocomplete": "Autocomplete",
|
|
14
|
-
"inputs/boolean": "Boolean",
|
|
15
|
-
"inputs/checkbox": "Checkbox",
|
|
16
|
-
"inputs/switch": "Switch",
|
|
17
|
-
"inputs/directory-items": "Éléments du répertoire"
|
|
18
|
-
};
|
|
19
|
-
export {
|
|
20
|
-
inputsFr
|
|
21
|
-
};
|