@gridsuite/commons-ui 0.93.1 → 0.95.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/checkBoxList/CheckBoxList.d.ts +1 -1
- package/dist/components/checkBoxList/CheckBoxList.js +3 -11
- package/dist/components/checkBoxList/CheckBoxListItem.d.ts +1 -1
- package/dist/components/checkBoxList/CheckBoxListItem.js +47 -14
- package/dist/components/checkBoxList/CheckBoxListItemContent.d.ts +2 -0
- package/dist/components/checkBoxList/CheckBoxListItemContent.js +45 -0
- package/dist/components/checkBoxList/CheckBoxListItems.d.ts +1 -1
- package/dist/components/checkBoxList/CheckBoxListItems.js +24 -20
- package/dist/components/checkBoxList/DraggableCheckBoxListItem.d.ts +1 -1
- package/dist/components/checkBoxList/DraggableCheckBoxListItem.js +46 -17
- package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.d.ts +2 -0
- package/dist/components/checkBoxList/DraggableCheckBoxListItemContent.js +38 -0
- package/dist/components/checkBoxList/checkBoxList.type.d.ts +9 -11
- package/dist/components/customAGGrid/customAggrid.d.ts +11 -8
- package/dist/components/customAGGrid/customAggrid.js +51 -48
- package/dist/components/customAGGrid/customAggrid.style.d.ts +0 -5
- package/dist/components/customAGGrid/customAggrid.style.js +1 -7
- package/dist/components/dialogs/elementSaveDialog/ElementSaveDialog.js +0 -2
- package/dist/components/filter/HeaderFilterForm.js +0 -2
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.d.ts +4 -11
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +0 -23
- package/dist/components/topBar/TopBar.d.ts +3 -5
- package/dist/components/topBar/TopBar.js +2 -1
- package/dist/components/treeViewFinder/TreeViewFinder.d.ts +3 -3
- package/dist/components/treeViewFinder/TreeViewFinder.js +46 -32
- package/dist/hooks/useLocalizedCountries.js +1 -1
- package/dist/index.js +2 -2
- package/dist/utils/constants/index.d.ts +0 -1
- package/dist/utils/constants/index.js +0 -6
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -2
- package/dist/utils/langs.d.ts +5 -0
- package/dist/utils/{constants/browserConstants.js → langs.js} +1 -5
- package/dist/utils/styles.d.ts +3 -0
- package/dist/utils/styles.js +4 -0
- package/dist/utils/types/equipmentType.js +1 -1
- package/package.json +3 -2
- package/dist/components/checkBoxList/ClickableCheckBoxItem.d.ts +0 -2
- package/dist/components/checkBoxList/ClickableCheckBoxItem.js +0 -12
- package/dist/components/checkBoxList/ClickableRowItem.d.ts +0 -2
- package/dist/components/checkBoxList/ClickableRowItem.js +0 -51
- package/dist/components/checkBoxList/DraggableClickableCheckBoxItem.d.ts +0 -2
- package/dist/components/checkBoxList/DraggableClickableCheckBoxItem.js +0 -50
- package/dist/components/checkBoxList/DraggableClickableRowItem.d.ts +0 -2
- package/dist/components/checkBoxList/DraggableClickableRowItem.js +0 -77
- package/dist/utils/constants/browserConstants.d.ts +0 -11
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { CustomAGGridProps } from '../../../customAGGrid';
|
|
2
|
+
export type CustomAgGridTableProps = Required<Pick<CustomAGGridProps, 'columnDefs' | 'defaultColDef' | 'pagination' | 'paginationPageSize' | 'alwaysShowVerticalScroll' | 'stopEditingWhenCellsLoseFocus'>> & Pick<CustomAGGridProps, 'rowSelection' | 'overrideLocales'> & {
|
|
3
3
|
name: string;
|
|
4
|
-
columnDefs: any;
|
|
5
4
|
makeDefaultRowData: any;
|
|
6
5
|
csvProps: unknown;
|
|
7
6
|
cssProps: unknown;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
paginationPageSize: number;
|
|
11
|
-
rowSelection?: AgGridReactProps['rowSelection'];
|
|
12
|
-
alwaysShowVerticalScroll: boolean;
|
|
13
|
-
stopEditingWhenCellsLoseFocus: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function CustomAgGridTable({ name, columnDefs, makeDefaultRowData, csvProps, cssProps, defaultColDef, pagination, paginationPageSize, rowSelection, alwaysShowVerticalScroll, stopEditingWhenCellsLoseFocus, ...props }: Readonly<CustomAgGridTableProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export declare function CustomAgGridTable({ name, makeDefaultRowData, csvProps, cssProps, rowSelection, ...props }: Readonly<CustomAgGridTableProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { useFormContext, useFieldArray } from "react-hook-form";
|
|
4
|
-
import "ag-grid-community/styles/ag-grid.css";
|
|
5
|
-
import "ag-grid-community/styles/ag-theme-alpine.css";
|
|
6
4
|
import { useTheme, Box } from "@mui/material";
|
|
7
|
-
import { useIntl } from "react-intl";
|
|
8
5
|
import { BottomRightButtons } from "./BottomRightButtons.js";
|
|
9
6
|
import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
|
|
10
7
|
import { CustomAGGrid } from "../../../customAGGrid/customAggrid.js";
|
|
@@ -65,16 +62,10 @@ const style = (customProps) => ({
|
|
|
65
62
|
});
|
|
66
63
|
function CustomAgGridTable({
|
|
67
64
|
name,
|
|
68
|
-
columnDefs,
|
|
69
65
|
makeDefaultRowData,
|
|
70
66
|
csvProps,
|
|
71
67
|
cssProps,
|
|
72
|
-
defaultColDef,
|
|
73
|
-
pagination,
|
|
74
|
-
paginationPageSize,
|
|
75
68
|
rowSelection,
|
|
76
|
-
alwaysShowVerticalScroll,
|
|
77
|
-
stopEditingWhenCellsLoseFocus,
|
|
78
69
|
...props
|
|
79
70
|
}) {
|
|
80
71
|
var _a, _b;
|
|
@@ -136,14 +127,6 @@ function CustomAgGridTable({
|
|
|
136
127
|
append(makeDefaultRowData());
|
|
137
128
|
setNewRowAdded(true);
|
|
138
129
|
};
|
|
139
|
-
const intl = useIntl();
|
|
140
|
-
const getLocaleText = useCallback(
|
|
141
|
-
(params) => {
|
|
142
|
-
const key = `agGrid.${params.key}`;
|
|
143
|
-
return intl.messages[key] || params.defaultValue;
|
|
144
|
-
},
|
|
145
|
-
[intl]
|
|
146
|
-
);
|
|
147
130
|
const onGridReady = (params) => {
|
|
148
131
|
setGridApi(params);
|
|
149
132
|
};
|
|
@@ -175,13 +158,11 @@ function CustomAgGridTable({
|
|
|
175
158
|
{
|
|
176
159
|
rowData,
|
|
177
160
|
onGridReady,
|
|
178
|
-
getLocaleText,
|
|
179
161
|
cacheOverflowSize: 10,
|
|
180
162
|
rowSelection: rowSelection ?? "multiple",
|
|
181
163
|
rowDragEntireRow: true,
|
|
182
164
|
rowDragManaged: true,
|
|
183
165
|
onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
|
|
184
|
-
columnDefs,
|
|
185
166
|
detailRowAutoHeight: true,
|
|
186
167
|
onSelectionChanged: () => {
|
|
187
168
|
setSelectedRows(gridApi.api.getSelectedRows());
|
|
@@ -190,10 +171,6 @@ function CustomAgGridTable({
|
|
|
190
171
|
onCellEditingStopped,
|
|
191
172
|
onSortChanged,
|
|
192
173
|
getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
|
|
193
|
-
pagination,
|
|
194
|
-
paginationPageSize,
|
|
195
|
-
alwaysShowVerticalScroll,
|
|
196
|
-
stopEditingWhenCellsLoseFocus,
|
|
197
174
|
theme: "legacy",
|
|
198
175
|
...props
|
|
199
176
|
}
|
|
@@ -3,11 +3,9 @@ import { User } from 'oidc-client';
|
|
|
3
3
|
import { GridLogoProps } from './GridLogo';
|
|
4
4
|
import { AboutDialogProps } from './AboutDialog';
|
|
5
5
|
import { LogoutProps } from '../authentication/Logout';
|
|
6
|
-
import { Metadata } from '../../utils';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
export type GsLang = GsLangUser | typeof LANG_SYSTEM;
|
|
10
|
-
export type GsTheme = typeof LIGHT_THEME | typeof DARK_THEME;
|
|
6
|
+
import { Metadata } from '../../utils/types/metadata';
|
|
7
|
+
import { GsTheme } from '../../utils/styles';
|
|
8
|
+
import { GsLang } from '../../utils/langs';
|
|
11
9
|
export type TopBarProps = Omit<GridLogoProps, 'onClick'> & Omit<LogoutProps, 'disabled'> & Omit<AboutDialogProps, 'open' | 'onClose'> & {
|
|
12
10
|
onLogoClick: GridLogoProps['onClick'];
|
|
13
11
|
user?: User;
|
|
@@ -8,7 +8,8 @@ import { AboutDialog } from "./AboutDialog.js";
|
|
|
8
8
|
import { useStateBoolean } from "../../hooks/customStates/useStateBoolean.js";
|
|
9
9
|
import UserInformationDialog from "./UserInformationDialog.js";
|
|
10
10
|
import UserSettingsDialog from "./UserSettingsDialog.js";
|
|
11
|
-
import { LIGHT_THEME, DARK_THEME
|
|
11
|
+
import { LIGHT_THEME, DARK_THEME } from "../../utils/styles.js";
|
|
12
|
+
import { LANG_SYSTEM, LANG_ENGLISH, LANG_FRENCH } from "../../utils/langs.js";
|
|
12
13
|
import MessageBanner from "./MessageBanner.js";
|
|
13
14
|
const styles = {
|
|
14
15
|
grow: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ButtonProps, ModalProps } from '@mui/material';
|
|
3
|
-
import {
|
|
3
|
+
import { SimpleTreeViewClasses } from '@mui/x-tree-view';
|
|
4
4
|
import { UUID } from 'crypto';
|
|
5
5
|
export declare const generateTreeViewFinderClass: (className: string) => string;
|
|
6
6
|
export interface TreeViewFinderNodeProps {
|
|
@@ -18,7 +18,7 @@ export interface TreeViewFinderProps {
|
|
|
18
18
|
selected?: string[];
|
|
19
19
|
expanded?: string[];
|
|
20
20
|
multiSelect?: boolean;
|
|
21
|
-
classes?: Partial<
|
|
21
|
+
classes?: Partial<SimpleTreeViewClasses>;
|
|
22
22
|
className?: string;
|
|
23
23
|
contentText?: string;
|
|
24
24
|
open: ModalProps['open'];
|
|
@@ -28,7 +28,7 @@ export interface TreeViewFinderProps {
|
|
|
28
28
|
title?: string;
|
|
29
29
|
onlyLeaves?: boolean;
|
|
30
30
|
data?: TreeViewFinderNodeProps[];
|
|
31
|
-
onTreeBrowse?: (
|
|
31
|
+
onTreeBrowse?: (itemId: string) => void;
|
|
32
32
|
sortMethod?: (a: TreeViewFinderNodeProps, b: TreeViewFinderNodeProps) => number;
|
|
33
33
|
}
|
|
34
34
|
export declare const TreeViewFinder: import('@emotion/styled').StyledComponent<Readonly<TreeViewFinderProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, {}, {}>;
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useRef, useCallback, useEffect } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { styled, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button, Typography } from "@mui/material";
|
|
5
|
-
import {
|
|
5
|
+
import { SimpleTreeView, TreeItem } from "@mui/x-tree-view";
|
|
6
6
|
import { ExpandMore, ChevronRight, Check } from "@mui/icons-material";
|
|
7
7
|
import { toNestedGlobalSelectors, makeComposeClasses } from "../../utils/styles.js";
|
|
8
8
|
import { CancelButton } from "../inputs/reactHookForm/utils/CancelButton.js";
|
|
@@ -34,6 +34,12 @@ const defaultStyles = {
|
|
|
34
34
|
};
|
|
35
35
|
const generateTreeViewFinderClass = (className) => `GsiTreeViewFinder-${className}`;
|
|
36
36
|
const composeClasses = makeComposeClasses(generateTreeViewFinderClass);
|
|
37
|
+
function CustomExpandIcon({ className }) {
|
|
38
|
+
return /* @__PURE__ */ jsx(ChevronRight, { className });
|
|
39
|
+
}
|
|
40
|
+
function CustomCollapseIcon({ className }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(ExpandMore, { className });
|
|
42
|
+
}
|
|
37
43
|
function TreeViewFinderComponant(props) {
|
|
38
44
|
const intl = useIntl();
|
|
39
45
|
const {
|
|
@@ -67,7 +73,7 @@ function TreeViewFinderComponant(props) {
|
|
|
67
73
|
return onlyLeaves ? isLeaf(node) : true;
|
|
68
74
|
};
|
|
69
75
|
const isValidationDisabled = () => {
|
|
70
|
-
return (selected == null ? void 0 : selected.length) === 0 || (selected == null ? void 0 : selected.length) === (selectedProp == null ? void 0 : selectedProp.length) && (selected == null ? void 0 : selected.every((
|
|
76
|
+
return (selected == null ? void 0 : selected.length) === 0 || (selected == null ? void 0 : selected.length) === (selectedProp == null ? void 0 : selectedProp.length) && (selected == null ? void 0 : selected.every((itemId) => selectedProp == null ? void 0 : selectedProp.includes(itemId)));
|
|
71
77
|
};
|
|
72
78
|
const computeMapPrintedNodes = useCallback((nodes) => {
|
|
73
79
|
const newMapPrintedNodes = {};
|
|
@@ -79,15 +85,15 @@ function TreeViewFinderComponant(props) {
|
|
|
79
85
|
});
|
|
80
86
|
return newMapPrintedNodes;
|
|
81
87
|
}, []);
|
|
82
|
-
const findParents = (
|
|
88
|
+
const findParents = (itemId, nodes, parentPath = []) => {
|
|
83
89
|
let result = null;
|
|
84
90
|
nodes.some((node) => {
|
|
85
|
-
if (node.id ===
|
|
91
|
+
if (node.id === itemId) {
|
|
86
92
|
result = parentPath;
|
|
87
93
|
return true;
|
|
88
94
|
}
|
|
89
95
|
if (node.children) {
|
|
90
|
-
const childResult = findParents(
|
|
96
|
+
const childResult = findParents(itemId, node.children, [...parentPath, node]);
|
|
91
97
|
if (childResult) {
|
|
92
98
|
result = childResult;
|
|
93
99
|
return true;
|
|
@@ -105,27 +111,27 @@ function TreeViewFinderComponant(props) {
|
|
|
105
111
|
if (!selected) {
|
|
106
112
|
return [];
|
|
107
113
|
}
|
|
108
|
-
return selected.map((
|
|
109
|
-
const selectedNode = mapPrintedNodes[
|
|
114
|
+
return selected.map((itemId) => {
|
|
115
|
+
const selectedNode = mapPrintedNodes[itemId];
|
|
110
116
|
if (!selectedNode) {
|
|
111
117
|
return null;
|
|
112
118
|
}
|
|
113
|
-
const parents = findParents(
|
|
119
|
+
const parents = findParents(itemId, data ?? []);
|
|
114
120
|
return {
|
|
115
121
|
...selectedNode,
|
|
116
122
|
parents: parents ?? []
|
|
117
123
|
};
|
|
118
124
|
}).filter((node) => node !== null);
|
|
119
125
|
};
|
|
120
|
-
const handleNodeToggle = (_e,
|
|
121
|
-
|
|
122
|
-
if (!(expanded == null ? void 0 : expanded.includes(
|
|
123
|
-
onTreeBrowse == null ? void 0 : onTreeBrowse(
|
|
126
|
+
const handleNodeToggle = (_e, itemIds) => {
|
|
127
|
+
itemIds.every((itemId) => {
|
|
128
|
+
if (!(expanded == null ? void 0 : expanded.includes(itemId))) {
|
|
129
|
+
onTreeBrowse == null ? void 0 : onTreeBrowse(itemId);
|
|
124
130
|
return false;
|
|
125
131
|
}
|
|
126
132
|
return true;
|
|
127
133
|
});
|
|
128
|
-
setExpanded(
|
|
134
|
+
setExpanded(itemIds);
|
|
129
135
|
};
|
|
130
136
|
useEffect(() => {
|
|
131
137
|
if (!selectedProp) {
|
|
@@ -148,7 +154,7 @@ function TreeViewFinderComponant(props) {
|
|
|
148
154
|
return;
|
|
149
155
|
}
|
|
150
156
|
if (selectedProp.length > 0 && autoScrollAllowed) {
|
|
151
|
-
const isNodeExpanded = expandedProp == null ? void 0 : expandedProp.every((
|
|
157
|
+
const isNodeExpanded = expandedProp == null ? void 0 : expandedProp.every((itemId) => expanded == null ? void 0 : expanded.includes(itemId));
|
|
152
158
|
const lastScrollRef = scrollRef.current[scrollRef.current.length - 1];
|
|
153
159
|
if (isNodeExpanded && lastScrollRef) {
|
|
154
160
|
lastScrollRef.scrollIntoView({
|
|
@@ -162,8 +168,8 @@ function TreeViewFinderComponant(props) {
|
|
|
162
168
|
}, [expanded, selectedProp, expandedProp, data, autoScrollAllowed]);
|
|
163
169
|
const handleNodeSelect = (_e, values) => {
|
|
164
170
|
if (multiSelect && Array.isArray(values)) {
|
|
165
|
-
setSelected(values.filter((
|
|
166
|
-
} else if (
|
|
171
|
+
setSelected(values.filter((itemId) => isSelectable(mapPrintedNodes[itemId])));
|
|
172
|
+
} else if (typeof values === "string") {
|
|
167
173
|
if (selected == null ? void 0 : selected.includes(values)) {
|
|
168
174
|
setSelected([]);
|
|
169
175
|
} else {
|
|
@@ -192,7 +198,7 @@ function TreeViewFinderComponant(props) {
|
|
|
192
198
|
if (!node) {
|
|
193
199
|
return null;
|
|
194
200
|
}
|
|
195
|
-
if (isSelectable(node) && (selected == null ? void 0 : selected.find((
|
|
201
|
+
if (isSelectable(node) && (selected == null ? void 0 : selected.find((itemId) => itemId === node.id))) {
|
|
196
202
|
return /* @__PURE__ */ jsx(Check, { className: composeClasses(classes, cssLabelIcon) });
|
|
197
203
|
}
|
|
198
204
|
if (node.icon) {
|
|
@@ -207,28 +213,36 @@ function TreeViewFinderComponant(props) {
|
|
|
207
213
|
] });
|
|
208
214
|
};
|
|
209
215
|
const showChevron = (node) => {
|
|
210
|
-
return !!(node.childrenCount
|
|
216
|
+
return !!(node.childrenCount && node.childrenCount > 0);
|
|
211
217
|
};
|
|
212
218
|
const renderTree = (node) => {
|
|
213
219
|
if (!node) {
|
|
214
220
|
return null;
|
|
215
221
|
}
|
|
216
222
|
let childrenNodes = null;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
childrenNodes = [false];
|
|
223
|
-
}
|
|
223
|
+
const showExpandIcon = showChevron(node);
|
|
224
|
+
if (Array.isArray(node.children) && node.children.length > 0) {
|
|
225
|
+
childrenNodes = node.children.toSorted(sortMethod).map(renderTree);
|
|
226
|
+
} else if (showExpandIcon) {
|
|
227
|
+
childrenNodes = [/* @__PURE__ */ jsx("span", { style: { display: "none" } }, "placeholder")];
|
|
224
228
|
}
|
|
225
229
|
return /* @__PURE__ */ jsx(
|
|
226
230
|
TreeItem,
|
|
227
231
|
{
|
|
228
|
-
|
|
232
|
+
itemId: node.id,
|
|
229
233
|
label: renderTreeItemLabel(node),
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
slots: {
|
|
235
|
+
expandIcon: CustomExpandIcon,
|
|
236
|
+
collapseIcon: CustomCollapseIcon
|
|
237
|
+
},
|
|
238
|
+
slotProps: {
|
|
239
|
+
expandIcon: {
|
|
240
|
+
className: composeClasses(classes, cssIcon)
|
|
241
|
+
},
|
|
242
|
+
collapseIcon: {
|
|
243
|
+
className: composeClasses(classes, cssIcon)
|
|
244
|
+
}
|
|
245
|
+
},
|
|
232
246
|
ref: (element) => {
|
|
233
247
|
if (selectedProp == null ? void 0 : selectedProp.includes(node.id)) {
|
|
234
248
|
scrollRef.current.push(element);
|
|
@@ -274,11 +288,11 @@ function TreeViewFinderComponant(props) {
|
|
|
274
288
|
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
275
289
|
/* @__PURE__ */ jsx(DialogContentText, { children: contentText ?? intl.formatMessage({ id: "treeview_finder/contentText" }, { multiSelect }) }),
|
|
276
290
|
/* @__PURE__ */ jsx(
|
|
277
|
-
|
|
291
|
+
SimpleTreeView,
|
|
278
292
|
{
|
|
279
|
-
expanded,
|
|
280
|
-
|
|
281
|
-
|
|
293
|
+
expandedItems: expanded,
|
|
294
|
+
onExpandedItemsChange: handleNodeToggle,
|
|
295
|
+
onSelectedItemsChange: handleNodeSelect,
|
|
282
296
|
...getTreeViewSelectionProps(),
|
|
283
297
|
children: data && Array.isArray(data) ? data.sort(sortMethod).map((child) => renderTree(child)) : null
|
|
284
298
|
}
|
|
@@ -2,7 +2,7 @@ import { useState, useEffect, useMemo, useCallback } from "react";
|
|
|
2
2
|
import localizedCountries from "localized-countries";
|
|
3
3
|
import countriesFr from "localized-countries/data/fr";
|
|
4
4
|
import countriesEn from "localized-countries/data/en";
|
|
5
|
-
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "../utils/
|
|
5
|
+
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "../utils/langs.js";
|
|
6
6
|
const supportedLanguages = [LANG_FRENCH, LANG_ENGLISH];
|
|
7
7
|
const getSystemLanguage = () => {
|
|
8
8
|
const systemLanguage = navigator.language.split(/[-_]/)[0];
|
package/dist/index.js
CHANGED
|
@@ -126,16 +126,16 @@ import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefau
|
|
|
126
126
|
import { elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders } from "./services/directory.js";
|
|
127
127
|
import { exportFilter } from "./services/study.js";
|
|
128
128
|
import { equalsArray } from "./utils/algos.js";
|
|
129
|
-
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./utils/constants/browserConstants.js";
|
|
130
129
|
import { FetchStatus } from "./utils/constants/fetchStatus.js";
|
|
131
130
|
import { FieldConstants } from "./utils/constants/fieldConstants.js";
|
|
132
131
|
import { MAX_CHAR_DESCRIPTION } from "./utils/constants/uiConstants.js";
|
|
133
132
|
import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./utils/constants/unitsConstants.js";
|
|
134
133
|
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./utils/conversionUtils.js";
|
|
135
134
|
import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./utils/functions.js";
|
|
135
|
+
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./utils/langs.js";
|
|
136
136
|
import { getFileIcon } from "./utils/mapper/getFileIcon.js";
|
|
137
137
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
138
|
-
import { makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
|
|
138
|
+
import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
|
|
139
139
|
import { ElementType } from "./utils/types/elementType.js";
|
|
140
140
|
import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/types/equipmentType.js";
|
|
141
141
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./utils/types/equipmentTypes.js";
|
|
@@ -4,7 +4,6 @@
|
|
|
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 './browserConstants';
|
|
8
7
|
export * from './fetchStatus';
|
|
9
8
|
export * from './fieldConstants';
|
|
10
9
|
export * from './uiConstants';
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./browserConstants.js";
|
|
2
1
|
import { FetchStatus } from "./fetchStatus.js";
|
|
3
2
|
import { FieldConstants } from "./fieldConstants.js";
|
|
4
3
|
import { MAX_CHAR_DESCRIPTION } from "./uiConstants.js";
|
|
5
4
|
import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./unitsConstants.js";
|
|
6
5
|
export {
|
|
7
6
|
AMPERE,
|
|
8
|
-
DARK_THEME,
|
|
9
7
|
DEGREE,
|
|
10
8
|
FetchStatus,
|
|
11
9
|
FieldConstants,
|
|
12
10
|
KILO_AMPERE,
|
|
13
11
|
KILO_METER,
|
|
14
12
|
KILO_VOLT,
|
|
15
|
-
LANG_ENGLISH,
|
|
16
|
-
LANG_FRENCH,
|
|
17
|
-
LANG_SYSTEM,
|
|
18
|
-
LIGHT_THEME,
|
|
19
13
|
MAX_CHAR_DESCRIPTION,
|
|
20
14
|
MEGA_VAR,
|
|
21
15
|
MEGA_VOLT_AMPERE,
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { equalsArray } from "./algos.js";
|
|
2
|
-
import { DARK_THEME, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM, LIGHT_THEME } from "./constants/browserConstants.js";
|
|
3
2
|
import { FetchStatus } from "./constants/fetchStatus.js";
|
|
4
3
|
import { FieldConstants } from "./constants/fieldConstants.js";
|
|
5
4
|
import { MAX_CHAR_DESCRIPTION } from "./constants/uiConstants.js";
|
|
6
5
|
import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT_AMPERE, MEGA_WATT, MICRO_SIEMENS, OHM, PERCENTAGE, SIEMENS } from "./constants/unitsConstants.js";
|
|
7
6
|
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./conversionUtils.js";
|
|
8
7
|
import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./functions.js";
|
|
8
|
+
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./langs.js";
|
|
9
9
|
import { getFileIcon } from "./mapper/getFileIcon.js";
|
|
10
10
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
11
|
-
import { makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./styles.js";
|
|
11
|
+
import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./styles.js";
|
|
12
12
|
import { ElementType } from "./types/elementType.js";
|
|
13
13
|
import { BASE_EQUIPMENTS, EQUIPMENT_TYPE, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./types/equipmentType.js";
|
|
14
14
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./types/equipmentTypes.js";
|
package/dist/utils/styles.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
export declare const DARK_THEME = "Dark";
|
|
3
|
+
export declare const LIGHT_THEME = "Light";
|
|
4
|
+
export type GsTheme = typeof LIGHT_THEME | typeof DARK_THEME;
|
|
2
5
|
export declare const makeComposeClasses: (generateGlobalClass: (className: string) => string) => (classes: Record<string, string>, ruleName: string) => string;
|
|
3
6
|
export declare const toNestedGlobalSelectors: (styles: object, generateGlobalClass: (className: string) => string) => {
|
|
4
7
|
[k: string]: any;
|
package/dist/utils/styles.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const DARK_THEME = "Dark";
|
|
2
|
+
const LIGHT_THEME = "Light";
|
|
1
3
|
const makeComposeClasses = (generateGlobalClass) => (classes, ruleName) => [generateGlobalClass(ruleName), classes[ruleName]].filter((x) => x).join(" ");
|
|
2
4
|
const toNestedGlobalSelectors = (styles, generateGlobalClass) => Object.fromEntries(Object.entries(styles).map(([k, v]) => [`& .${generateGlobalClass(k)}`, v]));
|
|
3
5
|
const isSxProps = (sx) => {
|
|
@@ -5,6 +7,8 @@ const isSxProps = (sx) => {
|
|
|
5
7
|
};
|
|
6
8
|
const mergeSx = (...allSx) => allSx.filter(isSxProps).flat();
|
|
7
9
|
export {
|
|
10
|
+
DARK_THEME,
|
|
11
|
+
LIGHT_THEME,
|
|
8
12
|
makeComposeClasses,
|
|
9
13
|
mergeSx,
|
|
10
14
|
toNestedGlobalSelectors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridsuite/commons-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.0",
|
|
4
4
|
"description": "common react components for gridsuite applications",
|
|
5
5
|
"author": "gridsuite team",
|
|
6
6
|
"homepage": "https://github.com/gridsuite",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"licenses-check": "license-checker --summary --excludePrivatePackages --production --onlyAllow \"$( jq -r .onlyAllow[] license-checker-config.json | tr '\n' ';')\" --excludePackages \"$( jq -r .excludePackages[] license-checker-config.json | tr '\n' ';')\""
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@ag-grid-community/locale": "^33.1.0",
|
|
37
38
|
"@hello-pangea/dnd": "^18.0.1",
|
|
38
39
|
"@react-querybuilder/dnd": "^8.2.0",
|
|
39
40
|
"@react-querybuilder/material": "^8.2.0",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"@mui/icons-material": "^5.16.14",
|
|
59
60
|
"@mui/lab": "5.0.0-alpha.175",
|
|
60
61
|
"@mui/material": "^5.16.14",
|
|
61
|
-
"@mui/x-tree-view": "^
|
|
62
|
+
"@mui/x-tree-view": "^7.28.1",
|
|
62
63
|
"ag-grid-community": "^33.0.3",
|
|
63
64
|
"ag-grid-react": "^33.0.4",
|
|
64
65
|
"notistack": "^3.0.2",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ListItemIcon, Checkbox, ListItemText } from "@mui/material";
|
|
3
|
-
import { OverflowableText } from "../overflowableText/OverflowableText.js";
|
|
4
|
-
function ClickableCheckBoxItem({ sx, label, ...props }) {
|
|
5
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6
|
-
/* @__PURE__ */ jsx(ListItemIcon, { sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkBoxIcon }, children: /* @__PURE__ */ jsx(Checkbox, { disableRipple: true, sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkbox }, ...props }) }),
|
|
7
|
-
/* @__PURE__ */ jsx(ListItemText, { sx: { display: "flex" }, disableTypography: true, children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label }) })
|
|
8
|
-
] });
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
ClickableCheckBoxItem
|
|
12
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ListItemButton, ListItemIcon, Checkbox, ListItemText } from "@mui/material";
|
|
3
|
-
import { OverflowableText } from "../overflowableText/OverflowableText.js";
|
|
4
|
-
const styles = {
|
|
5
|
-
unclickableItem: {
|
|
6
|
-
"&:hover": {
|
|
7
|
-
backgroundColor: "transparent"
|
|
8
|
-
},
|
|
9
|
-
cursor: "inherit"
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
function ClickableRowItem({
|
|
13
|
-
sx,
|
|
14
|
-
disabled,
|
|
15
|
-
label,
|
|
16
|
-
onClick,
|
|
17
|
-
onItemClick,
|
|
18
|
-
isItemClickable = true,
|
|
19
|
-
...props
|
|
20
|
-
}) {
|
|
21
|
-
const onCheckboxClick = (event) => {
|
|
22
|
-
event.stopPropagation();
|
|
23
|
-
onClick();
|
|
24
|
-
};
|
|
25
|
-
const handleItemClick = () => isItemClickable && onItemClick();
|
|
26
|
-
return /* @__PURE__ */ jsxs(
|
|
27
|
-
ListItemButton,
|
|
28
|
-
{
|
|
29
|
-
disableTouchRipple: !isItemClickable,
|
|
30
|
-
sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkboxButton, ...!isItemClickable && styles.unclickableItem },
|
|
31
|
-
disabled,
|
|
32
|
-
onClick: handleItemClick,
|
|
33
|
-
children: [
|
|
34
|
-
/* @__PURE__ */ jsx(ListItemIcon, { sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkBoxIcon }, children: /* @__PURE__ */ jsx(Checkbox, { disableRipple: true, sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkbox }, onClick: onCheckboxClick, ...props }) }),
|
|
35
|
-
/* @__PURE__ */ jsx(
|
|
36
|
-
ListItemText,
|
|
37
|
-
{
|
|
38
|
-
sx: {
|
|
39
|
-
display: "flex"
|
|
40
|
-
},
|
|
41
|
-
disableTypography: true,
|
|
42
|
-
children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
export {
|
|
50
|
-
ClickableRowItem
|
|
51
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { DraggableClickableCheckBoxItemProps } from './checkBoxList.type';
|
|
2
|
-
export declare function DraggableClickableCheckBoxItem({ sx, disabled, provided, isHighlighted, label, ...props }: Readonly<DraggableClickableCheckBoxItemProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DragIndicator } from "@mui/icons-material";
|
|
3
|
-
import { IconButton, ListItemIcon, Checkbox, ListItemText } from "@mui/material";
|
|
4
|
-
import { OverflowableText } from "../overflowableText/OverflowableText.js";
|
|
5
|
-
const styles = {
|
|
6
|
-
dragIcon: (theme) => ({
|
|
7
|
-
padding: "unset",
|
|
8
|
-
border: theme.spacing(0),
|
|
9
|
-
borderRadius: theme.spacing(0),
|
|
10
|
-
zIndex: 90
|
|
11
|
-
})
|
|
12
|
-
};
|
|
13
|
-
function DraggableClickableCheckBoxItem({
|
|
14
|
-
sx,
|
|
15
|
-
disabled,
|
|
16
|
-
provided,
|
|
17
|
-
isHighlighted,
|
|
18
|
-
label,
|
|
19
|
-
...props
|
|
20
|
-
}) {
|
|
21
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
-
/* @__PURE__ */ jsx(
|
|
23
|
-
IconButton,
|
|
24
|
-
{
|
|
25
|
-
...provided.dragHandleProps,
|
|
26
|
-
size: "small",
|
|
27
|
-
sx: {
|
|
28
|
-
opacity: isHighlighted ? "1" : "0",
|
|
29
|
-
padding: "unset",
|
|
30
|
-
...styles.dragIcon
|
|
31
|
-
},
|
|
32
|
-
children: /* @__PURE__ */ jsx(DragIndicator, { spacing: 0 })
|
|
33
|
-
}
|
|
34
|
-
),
|
|
35
|
-
/* @__PURE__ */ jsx(ListItemIcon, { sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkBoxIcon }, children: /* @__PURE__ */ jsx(Checkbox, { disableRipple: true, sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkbox }, ...props }) }),
|
|
36
|
-
/* @__PURE__ */ jsx(
|
|
37
|
-
ListItemText,
|
|
38
|
-
{
|
|
39
|
-
sx: {
|
|
40
|
-
display: "flex"
|
|
41
|
-
},
|
|
42
|
-
disableTypography: true,
|
|
43
|
-
children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
] });
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
DraggableClickableCheckBoxItem
|
|
50
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { DraggableClickableRowItemProps } from './checkBoxList.type';
|
|
2
|
-
export declare function DraggableClickableRowItem({ sx, disabled, onClick, provided, isHighlighted, label, onItemClick, isItemClickable, ...props }: Readonly<DraggableClickableRowItemProps>): import("react/jsx-runtime").JSX.Element;
|