@m4l/components 0.1.80 → 0.1.82
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/@types/export.d.ts +9 -1
- package/components/AccountPopover/AccountPopover.d.ts +21 -0
- package/components/AccountPopover/classes/types.d.ts +1 -1
- package/components/AccountPopover/{index.00d1d15f.js → index.0ba26726.js} +68 -72
- package/components/AccountPopover/subcomponents/MyAvatar/index.d.ts +2 -2
- package/components/AccountPopover/subcomponents/MyAvatar/types.d.ts +7 -0
- package/components/AccountPopover/subcomponents/PopOver/index.d.ts +6 -0
- package/components/AccountPopover/subcomponents/PopOver/types.d.ts +5 -4
- package/components/AccountPopover/types.d.ts +3 -4
- package/components/AppBar/{index.c85b100d.js → index.fadcefc6.js} +7 -7
- package/components/CommonActions/components/ActionCancel/{index.1051a117.js → index.6cf96d04.js} +2 -2
- package/components/CommonActions/components/ActionFormCancel/{index.a0d727b2.js → index.a0335cbf.js} +15 -15
- package/components/CommonActions/components/ActionFormIntro/{index.a20dc88d.js → index.273b1b9f.js} +2 -2
- package/components/CommonActions/components/ActionIntro/{index.bfe3256c.js → index.856df8ef.js} +2 -2
- package/components/CommonActions/components/Actions/{index.19d67bc6.js → index.5abb6ac4.js} +13 -13
- package/components/DataGrid/classes/index.d.ts +1 -0
- package/components/DataGrid/classes/types.d.ts +1 -0
- package/components/DataGrid/constants.d.ts +1 -0
- package/components/DataGrid/{index.2f175eba.js → index.03ad08af.js} +28 -681
- package/components/DataGrid/subcomponents/Actions/index.db54ec98.js +621 -0
- package/components/DataGrid/subcomponents/editors/TextEditor/index.91380a55.js +64 -0
- package/components/DynamicFilter/constants.d.ts +1 -1
- package/components/DynamicFilter/{index.c1f9d560.js → index.9b72180b.js} +28 -28
- package/components/GridLayout/GridLayout.d.ts +1 -0
- package/components/GridLayout/classes/index.d.ts +4 -0
- package/components/GridLayout/classes/types.d.ts +17 -0
- package/components/GridLayout/constants.d.ts +26 -0
- package/components/GridLayout/{index.a792aacb.js → index.76bccc4f.js} +322 -575
- package/components/GridLayout/index.d.ts +4 -3
- package/components/GridLayout/subcomponents/Griditem/index.01fc14c3.js +370 -0
- package/components/GridLayout/subcomponents/Griditem/index.d.ts +9 -0
- package/components/GridLayout/subcomponents/Griditem/types.d.ts +103 -0
- package/components/GridLayout/subcomponents/Responsive/helper.d.ts +10 -0
- package/components/GridLayout/subcomponents/Responsive/index.d.ts +15 -2
- package/components/GridLayout/{Responsive/index.1671380a.js → subcomponents/Responsive/index.e589d8bf.js} +95 -139
- package/components/GridLayout/subcomponents/Responsive/responsiveUtils.d.ts +3 -6
- package/components/GridLayout/subcomponents/Responsive/types.d.ts +114 -33
- package/components/GridLayout/{WidthProvider/index.9a26dfe4.js → subcomponents/WidthProvider/index.50dafd87.js} +5 -5
- package/components/GridLayout/subcomponents/WidthProvider/index.d.ts +4 -5
- package/components/GridLayout/types.d.ts +83 -18
- package/components/GridLayout/utils.d.ts +15 -12
- package/components/HelperText/{index.6ef76993.js → index.6c3adb40.js} +7 -7
- package/components/Icon/{index.9fcd1476.js → index.2414ff25.js} +1 -1
- package/components/LanguagePopover/{index.1564bd08.js → index.66e11634.js} +7 -7
- package/components/ModalDialog/{index.fbc4cd71.js → index.4dc1c8ed.js} +4 -4
- package/components/NavLink/{index.6c9c2588.js → index.5859e048.js} +7 -7
- package/components/ObjectLogs/{index.eab1c15f.js → index.51de2deb.js} +17 -17
- package/components/PaperForm/{index.ba38a0bd.js → index.f931dc02.js} +1 -1
- package/components/Period/{index.26071a16.js → index.4fd9df2a.js} +14 -14
- package/components/PropertyValue/{index.18d3c0fd.js → index.1b09f426.js} +1 -1
- package/components/ScrollBar/{index.bbe48f4d.js → index.d4410cb5.js} +5 -0
- package/components/SideBar/{index.2f497e6c.js → index.72564ef2.js} +11 -6
- package/components/animate/AnimatedScroll/animatedScroll.d.ts +3 -0
- package/components/animate/AnimatedScroll/index.d.ts +1 -0
- package/components/animate/AnimatedScroll/types.d.ts +5 -0
- package/components/animate/index.4e9774a6.js +150 -0
- package/components/animate/index.d.ts +1 -0
- package/components/areas/components/AreasAdmin/{index.7a0dabbe.js → index.f011d49d.js} +60 -49
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/PanelWindowPopUp/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/{index.fd49f06c.js → index.51a52736.js} +41 -153
- package/components/areas/components/{index.7756928a.js → index.f496660b.js} +11 -11
- package/components/areas/contexts/AreasContext/helper.d.ts +2 -2
- package/components/areas/contexts/AreasContext/{index.0a08a08b.js → index.9820bc7f.js} +12 -6
- package/components/areas/contexts/AreasContext/types.d.ts +4 -4
- package/components/areas/contexts/{index.b303b664.js → index.361acb6f.js} +1 -1
- package/components/areas/hooks/useAreas/{index.c6eb2569.js → index.b403f383.js} +1 -1
- package/components/areas/{index.6e67d89a.js → index.eacab372.js} +11 -11
- package/components/formatters/BooleanFormatter/{index.e8de8e4c.js → index.32de0803.js} +1 -1
- package/components/formatters/{index.67aeb049.js → index.d16d2331.js} +2 -2
- package/components/hook-form/RHFAutocomplete/{index.d1bbb015.js → index.6edb51b1.js} +8 -8
- package/components/hook-form/RHFAutocompleteAsync/{index.f9a9ef48.js → index.c2ca5c66.js} +1 -1
- package/components/hook-form/RHFCheckbox/{index.7b4a21d7.js → index.c6c3933b.js} +8 -8
- package/components/hook-form/RHFDateTime/{index.46cf616e.js → index.3add0fa4.js} +8 -8
- package/components/hook-form/RHFPeriod/{index.ce513149.js → index.72edef4d.js} +2 -2
- package/components/hook-form/RHFTextField/{index.f7ee202c.js → index.20daa95e.js} +3 -3
- package/components/hook-form/RHFUpload/{index.1befd5bb.js → index.cc5adc15.js} +8 -8
- package/components/modal/{WindowBase.7e19843e.js → WindowBase.4016485b.js} +9 -9
- package/components/modal/{WindowConfirm.12a9608a.js → WindowConfirm.f148e495.js} +16 -16
- package/components/modal/{index.b0a7236c.js → index.e9fece72.js} +13 -13
- package/components/mui_extended/Accordion/{index.a6447bf8.js → index.42cef1c7.js} +3 -3
- package/components/mui_extended/Avatar/types.d.ts +3 -1
- package/components/mui_extended/Button/classes/types.d.ts +3 -0
- package/components/mui_extended/Button/{index.4288f9fc.js → index.40af964e.js} +8 -3
- package/components/mui_extended/Button/types.d.ts +2 -1
- package/components/mui_extended/IconButton/{index.12f1a3c3.js → index.a318316e.js} +1 -1
- package/components/mui_extended/MenuActions/{index.43a2e1ae.js → index.f6bfdd40.js} +2 -2
- package/components/mui_extended/Pager/classes/index.d.ts +12 -0
- package/components/mui_extended/Pager/classes/types.d.ts +12 -4
- package/components/mui_extended/Pager/{index.82e89328.js → index.da26e9d4.js} +114 -62
- package/components/mui_extended/Pager/subcomponents/CustomTablePagination/index.d.ts +3 -0
- package/components/mui_extended/Pager/subcomponents/CustomTablePagination/types.d.ts +12 -0
- package/components/mui_extended/Pager/{components → subcomponents}/PagerActions/types.d.ts +2 -0
- package/components/mui_extended/Tab/{index.c39a6681.js → index.0d5f96e6.js} +1 -1
- package/components/mui_extended/{index.d78bde19.js → index.f6a356b9.js} +7 -7
- package/contexts/ModalContext/{index.89805978.js → index.efc1135a.js} +1 -1
- package/contexts/RHFormContext/{index.fe175bab.js → index.b9266262.js} +1 -1
- package/hooks/useModal/{index.e1c5c31e.js → index.9b0cc3fe.js} +1 -1
- package/index.js +92 -88
- package/package.json +1 -2
- package/{vendor.f57d47a7.js → vendor.88ed58a5.js} +51 -48
- package/components/AccountPopover/subcomponents/MyAvatar/createAvatar.d.ts +0 -4
- package/components/GridLayout/subcomponents/GridItem/index.d.ts +0 -26
- package/components/GridLayout/subcomponents/GridItem/types.d.ts +0 -78
- package/components/animate/index.1f8eadd4.js +0 -66
- /package/components/mui_extended/Pager/{components → subcomponents}/PagerActions/index.d.ts +0 -0
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
import { M as MenuActions } from "../../../mui_extended/MenuActions/index.f6bfdd40.js";
|
|
2
|
+
import { u as useDataGrid, a as useFilters, d as dataGridClasses, b as dictionary } from "../../index.03ad08af.js";
|
|
3
|
+
import { useTheme, Checkbox, Skeleton } from "@mui/material";
|
|
4
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { P as Pager } from "../../../mui_extended/Pager/index.da26e9d4.js";
|
|
6
|
+
import { I as IconButton } from "../../../mui_extended/IconButton/index.a318316e.js";
|
|
7
|
+
import { useEnvironment, useModuleDictionary, useModuleSkeleton } from "@m4l/core";
|
|
8
|
+
import { forwardRef, useRef, useState, useImperativeHandle, useMemo, useEffect, useCallback } from "react";
|
|
9
|
+
import { D as DataGrid$1 } from "../../../../react-data-grid.d46d625e.js";
|
|
10
|
+
import { styled } from "@mui/material/styles";
|
|
11
|
+
import { u as useModal } from "../../../../hooks/useModal/index.9b0cc3fe.js";
|
|
12
|
+
import { A as ActionCancel } from "../../../CommonActions/components/ActionCancel/index.6cf96d04.js";
|
|
13
|
+
import { A as ActionIntro } from "../../../CommonActions/components/ActionIntro/index.856df8ef.js";
|
|
14
|
+
import "../../../../react-draggable.7abb5d0a.js";
|
|
15
|
+
import "../../../Resizeable/index.9a9c79a4.js";
|
|
16
|
+
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
17
|
+
import "../../../Icon/index.2414ff25.js";
|
|
18
|
+
import "clsx";
|
|
19
|
+
import "../../../modal/index.e9fece72.js";
|
|
20
|
+
import { A as Actions$1 } from "../../../CommonActions/components/Actions/index.5abb6ac4.js";
|
|
21
|
+
import "react-hook-form";
|
|
22
|
+
import "@mui/material/Button";
|
|
23
|
+
import "../../../mui_extended/Button/index.40af964e.js";
|
|
24
|
+
import "zustand";
|
|
25
|
+
import "../../../areas/contexts/AreasContext/index.9820bc7f.js";
|
|
26
|
+
import "../../../areas/components/AreasAdmin/index.f011d49d.js";
|
|
27
|
+
import "zustand/shallow";
|
|
28
|
+
import "../../../ScrollBar/index.d4410cb5.js";
|
|
29
|
+
import "../../../mui_extended/Accordion/index.42cef1c7.js";
|
|
30
|
+
import "../../../mui_extended/Typography/index.443590d6.js";
|
|
31
|
+
import "../../../mui_extended/Avatar/index.75e6ed57.js";
|
|
32
|
+
import "react-router-dom";
|
|
33
|
+
import "../../../mui_extended/CheckBox.5f6c78b0.js";
|
|
34
|
+
import "../../../mui_extended/Badge/index.cad260fe.js";
|
|
35
|
+
import "../../../Image/index.c18ebf5a.js";
|
|
36
|
+
import "@mui/lab";
|
|
37
|
+
import "../../../mui_extended/Popover/index.9f35d0eb.js";
|
|
38
|
+
import "../../../mui_extended/Tab/index.0d5f96e6.js";
|
|
39
|
+
import "../../../mui_extended/Tooltip/index.5a795dcd.js";
|
|
40
|
+
import "../../../areas/components/AreasViewer/index.51a52736.js";
|
|
41
|
+
import "../../../LinearProgressIndeterminate/index.60dabc06.js";
|
|
42
|
+
import "../../../areas/contexts/WindowToolsMFContext/index.8f3e2a04.js";
|
|
43
|
+
import "../../../areas/contexts/DynamicMFParmsContext/index.1607c78e.js";
|
|
44
|
+
import { W as WindowBase } from "../../../modal/WindowBase.4016485b.js";
|
|
45
|
+
const ACTIONS_COLUMN_KEY = "actions-row";
|
|
46
|
+
function ActionsFormatter(props) {
|
|
47
|
+
const {
|
|
48
|
+
rowActionsGetter,
|
|
49
|
+
classes
|
|
50
|
+
} = useDataGrid();
|
|
51
|
+
const theme = useTheme();
|
|
52
|
+
if (rowActionsGetter === void 0) {
|
|
53
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
54
|
+
}
|
|
55
|
+
return /* @__PURE__ */ jsx(MenuActions, {
|
|
56
|
+
arrowType: "top-left",
|
|
57
|
+
objItem: props.row,
|
|
58
|
+
menuActions: rowActionsGetter,
|
|
59
|
+
className: classes.actionsFormatter,
|
|
60
|
+
menuActionSx: theme.components?.M4LDataGridActionsFormatter?.styleOverrides,
|
|
61
|
+
marginTop: 1,
|
|
62
|
+
marginLeft: "-11px",
|
|
63
|
+
anchorOrigin: {
|
|
64
|
+
vertical: "bottom",
|
|
65
|
+
horizontal: "left"
|
|
66
|
+
},
|
|
67
|
+
transformOrigin: {
|
|
68
|
+
vertical: "top",
|
|
69
|
+
horizontal: "left"
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
const ActionsColumn = {
|
|
74
|
+
key: ACTIONS_COLUMN_KEY,
|
|
75
|
+
name: getActionLabel(),
|
|
76
|
+
width: 60,
|
|
77
|
+
withFilter: false,
|
|
78
|
+
resizable: true,
|
|
79
|
+
sortable: false,
|
|
80
|
+
frozen: true,
|
|
81
|
+
type: "custom",
|
|
82
|
+
formatter: ActionsFormatter
|
|
83
|
+
};
|
|
84
|
+
function getActionLabel() {
|
|
85
|
+
return "";
|
|
86
|
+
}
|
|
87
|
+
function Filter() {
|
|
88
|
+
const {
|
|
89
|
+
activeFilters,
|
|
90
|
+
setActiveFilters
|
|
91
|
+
} = useFilters();
|
|
92
|
+
const {
|
|
93
|
+
host_static_assets,
|
|
94
|
+
environment_assets
|
|
95
|
+
} = useEnvironment();
|
|
96
|
+
const {
|
|
97
|
+
classes
|
|
98
|
+
} = useDataGrid();
|
|
99
|
+
const toggleIcon = () => {
|
|
100
|
+
setActiveFilters(!activeFilters);
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
103
|
+
dictionaryTooltipId: activeFilters ? "data_grid.tooltip_filter_hide" : "data_grid.tooltip_filter_show",
|
|
104
|
+
className: classes.actionFilter,
|
|
105
|
+
onClick: toggleIcon,
|
|
106
|
+
"aria-label": "filter",
|
|
107
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/filter.svg`
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
const WrapperColumnsConfig = styled("div")(({ theme }) => ({
|
|
111
|
+
color: theme.palette.text.primary,
|
|
112
|
+
position: "relative",
|
|
113
|
+
display: "flex",
|
|
114
|
+
flexDirection: "column",
|
|
115
|
+
height: "100%",
|
|
116
|
+
width: "100%"
|
|
117
|
+
}));
|
|
118
|
+
styled("div")(({ theme }) => ({
|
|
119
|
+
color: theme.palette.text.primary,
|
|
120
|
+
fontSize: theme.typography.h4.fontSize
|
|
121
|
+
}));
|
|
122
|
+
const DivSelColumns = styled("div")(({ theme }) => ({
|
|
123
|
+
...theme.typography.subtitle2,
|
|
124
|
+
color: theme.palette.text.primary,
|
|
125
|
+
padding: `${theme.spacing(3)} ${theme.spacing(1)}`
|
|
126
|
+
}));
|
|
127
|
+
const WrapperDataGrid = styled("div")(() => ({
|
|
128
|
+
position: "relative",
|
|
129
|
+
display: "flex",
|
|
130
|
+
flexDirection: "column",
|
|
131
|
+
flexGrow: 1
|
|
132
|
+
}));
|
|
133
|
+
styled("div")(() => ({
|
|
134
|
+
display: "flex",
|
|
135
|
+
flexDirection: "row"
|
|
136
|
+
}));
|
|
137
|
+
const ColumnActions = styled("div")(({ theme }) => ({
|
|
138
|
+
paddingTop: theme.spacing(3),
|
|
139
|
+
display: "flex",
|
|
140
|
+
flexDirection: "row"
|
|
141
|
+
}));
|
|
142
|
+
styled("div")(({ theme }) => ({
|
|
143
|
+
paddingTop: theme.spacing(3),
|
|
144
|
+
display: "flex",
|
|
145
|
+
flexDirection: "row",
|
|
146
|
+
justifyContent: "flex-end",
|
|
147
|
+
"& > button": {
|
|
148
|
+
marginLeft: "10px"
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
151
|
+
function FormatterColumn(props) {
|
|
152
|
+
const {
|
|
153
|
+
row,
|
|
154
|
+
onRowChange,
|
|
155
|
+
column
|
|
156
|
+
} = props;
|
|
157
|
+
const handleChange = () => {
|
|
158
|
+
const newRow = {
|
|
159
|
+
...row
|
|
160
|
+
};
|
|
161
|
+
newRow[column.key] = !row[column.key];
|
|
162
|
+
onRowChange(newRow);
|
|
163
|
+
};
|
|
164
|
+
return /* @__PURE__ */ jsx(Checkbox, {
|
|
165
|
+
size: "small",
|
|
166
|
+
checked: row[column.key],
|
|
167
|
+
onChange: handleChange,
|
|
168
|
+
className: dataGridClasses.formatterColumn
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function getRowsFromColumnsConfig(columnsConfig) {
|
|
172
|
+
return columnsConfig.filter((column) => !column.hidden).map((column) => ({
|
|
173
|
+
key: column.key,
|
|
174
|
+
name: column.name,
|
|
175
|
+
visible: column.visible === void 0 ? true : column.visible,
|
|
176
|
+
frozen: column.frozen === void 0 ? false : column.frozen,
|
|
177
|
+
originalIndex: column.orginalIndex,
|
|
178
|
+
originalFrozen: column.originalFrozen,
|
|
179
|
+
originalVisible: column.originalVisible
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
const ColumnsConfig = forwardRef((props, ref) => {
|
|
183
|
+
const refdata_grid = useRef(null);
|
|
184
|
+
const {
|
|
185
|
+
onCloseSettings,
|
|
186
|
+
columnsConfig,
|
|
187
|
+
onChangeColumnsConfig,
|
|
188
|
+
classes
|
|
189
|
+
} = props;
|
|
190
|
+
const {
|
|
191
|
+
getLabel
|
|
192
|
+
} = useModuleDictionary();
|
|
193
|
+
const [isInit, setIsInit] = useState(true);
|
|
194
|
+
const [rows, setRows] = useState(getRowsFromColumnsConfig(columnsConfig));
|
|
195
|
+
const [selRows, setSelRows] = useState(() => /* @__PURE__ */ new Set());
|
|
196
|
+
const divRef = useRef(null);
|
|
197
|
+
const {
|
|
198
|
+
host_static_assets,
|
|
199
|
+
environment_assets
|
|
200
|
+
} = useEnvironment();
|
|
201
|
+
useImperativeHandle(ref, () => ({
|
|
202
|
+
onClickIntro: handleIntro,
|
|
203
|
+
current: divRef.current
|
|
204
|
+
}));
|
|
205
|
+
const columnsdata_grid = useMemo(() => [{
|
|
206
|
+
key: "name",
|
|
207
|
+
name: getLabel("data_grid.settings_column_name"),
|
|
208
|
+
width: 200,
|
|
209
|
+
resizable: true,
|
|
210
|
+
type: "string"
|
|
211
|
+
}, {
|
|
212
|
+
key: "originalIndex",
|
|
213
|
+
name: getLabel("data_grid.settings_column_position"),
|
|
214
|
+
width: 50,
|
|
215
|
+
type: "number",
|
|
216
|
+
cellClass: "rdg-cell-align-center"
|
|
217
|
+
}, {
|
|
218
|
+
key: "visible",
|
|
219
|
+
name: getLabel("data_grid.settings_column_visible"),
|
|
220
|
+
width: 80,
|
|
221
|
+
type: "boolean",
|
|
222
|
+
formatter: FormatterColumn,
|
|
223
|
+
cellClass: "rdg-cell-align-center"
|
|
224
|
+
}, {
|
|
225
|
+
key: "frozen",
|
|
226
|
+
name: getLabel("data_grid.settings_column_frozen"),
|
|
227
|
+
width: 80,
|
|
228
|
+
type: "boolean",
|
|
229
|
+
formatter: FormatterColumn,
|
|
230
|
+
cellClass: "rdg-cell-align-center"
|
|
231
|
+
}], [getLabel]);
|
|
232
|
+
const checkAll = () => {
|
|
233
|
+
setRows(rows.map((row) => ({
|
|
234
|
+
...row,
|
|
235
|
+
visible: true
|
|
236
|
+
})));
|
|
237
|
+
};
|
|
238
|
+
const unCheckAll = () => {
|
|
239
|
+
setRows(rows.map((row) => ({
|
|
240
|
+
...row,
|
|
241
|
+
visible: false
|
|
242
|
+
})));
|
|
243
|
+
};
|
|
244
|
+
const restoreAll = () => {
|
|
245
|
+
setRows(rows.map((row) => ({
|
|
246
|
+
...row,
|
|
247
|
+
visible: row.originalVisible,
|
|
248
|
+
frozen: row.originalFrozen,
|
|
249
|
+
index: row.originalIndex
|
|
250
|
+
})).sort((a, b) => a.index - b.index));
|
|
251
|
+
};
|
|
252
|
+
useEffect(() => {
|
|
253
|
+
if (isInit === false) {
|
|
254
|
+
setRows(getRowsFromColumnsConfig(columnsConfig));
|
|
255
|
+
}
|
|
256
|
+
setIsInit(false);
|
|
257
|
+
}, [columnsConfig]);
|
|
258
|
+
const rowSelectedIndex = useMemo(() => {
|
|
259
|
+
let rowIndex = -1;
|
|
260
|
+
if (selRows.size !== 1)
|
|
261
|
+
return rowIndex;
|
|
262
|
+
const iterator = selRows.entries();
|
|
263
|
+
const entry = iterator.next().value[1];
|
|
264
|
+
rowIndex = rows.findIndex((row) => row.key === entry);
|
|
265
|
+
return rowIndex;
|
|
266
|
+
}, [rows, selRows]);
|
|
267
|
+
const handleMoveFirst = () => {
|
|
268
|
+
if (rowSelectedIndex === -1)
|
|
269
|
+
return -1;
|
|
270
|
+
const newRows = [...rows];
|
|
271
|
+
newRows.splice(rowSelectedIndex, 1);
|
|
272
|
+
newRows.splice(0, 0, rows[rowSelectedIndex]);
|
|
273
|
+
refdata_grid.current?.selectCell({
|
|
274
|
+
idx: 0,
|
|
275
|
+
rowIdx: 0
|
|
276
|
+
});
|
|
277
|
+
setRows(newRows);
|
|
278
|
+
};
|
|
279
|
+
const handleMoveLast = () => {
|
|
280
|
+
if (rowSelectedIndex === -1)
|
|
281
|
+
return -1;
|
|
282
|
+
const newRows = [...rows];
|
|
283
|
+
newRows.splice(rowSelectedIndex, 1);
|
|
284
|
+
newRows.splice(newRows.length, 0, rows[rowSelectedIndex]);
|
|
285
|
+
refdata_grid.current?.selectCell({
|
|
286
|
+
idx: 0,
|
|
287
|
+
rowIdx: newRows.length - 1
|
|
288
|
+
});
|
|
289
|
+
setRows(newRows);
|
|
290
|
+
};
|
|
291
|
+
const handleMoveUpDownd = (position) => {
|
|
292
|
+
if (rowSelectedIndex === -1)
|
|
293
|
+
return -1;
|
|
294
|
+
const newRows = [...rows];
|
|
295
|
+
const element = newRows[rowSelectedIndex];
|
|
296
|
+
newRows.splice(rowSelectedIndex, 1);
|
|
297
|
+
newRows.splice(rowSelectedIndex + position, 0, element);
|
|
298
|
+
refdata_grid.current?.selectCell({
|
|
299
|
+
idx: 0,
|
|
300
|
+
rowIdx: rowSelectedIndex + position
|
|
301
|
+
});
|
|
302
|
+
setRows(newRows);
|
|
303
|
+
};
|
|
304
|
+
const getColumnConfigByKey = (key) => {
|
|
305
|
+
const rowIndexFinded = rows.findIndex((row) => row.key === key);
|
|
306
|
+
if (rowIndexFinded > -1) {
|
|
307
|
+
return {
|
|
308
|
+
visible: rows[rowIndexFinded].visible,
|
|
309
|
+
frozen: rows[rowIndexFinded].frozen
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
return void 0;
|
|
313
|
+
};
|
|
314
|
+
const getRowIndex = (column) => {
|
|
315
|
+
const rowIndexFinded = rows.findIndex((row) => row.key === column.key);
|
|
316
|
+
if (rowIndexFinded > -1) {
|
|
317
|
+
return rowIndexFinded;
|
|
318
|
+
}
|
|
319
|
+
return columnsConfig.findIndex((columnConfig) => columnConfig.key === column.key);
|
|
320
|
+
};
|
|
321
|
+
const handleIntro = () => {
|
|
322
|
+
const newColumnsConfig = columnsConfig.map((columnConfig) => {
|
|
323
|
+
const newColumnConfig = {
|
|
324
|
+
...columnConfig
|
|
325
|
+
};
|
|
326
|
+
if (!columnConfig.hidden) {
|
|
327
|
+
const columnConfigRow = getColumnConfigByKey(columnConfig.key);
|
|
328
|
+
if (columnConfigRow) {
|
|
329
|
+
newColumnConfig.visible = columnConfigRow.visible;
|
|
330
|
+
newColumnConfig.frozen = columnConfigRow.frozen;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return newColumnConfig;
|
|
334
|
+
}).sort((a, b) => getRowIndex(a) - getRowIndex(b));
|
|
335
|
+
onChangeColumnsConfig(newColumnsConfig);
|
|
336
|
+
onCloseSettings();
|
|
337
|
+
};
|
|
338
|
+
const onInternalSelectedRowsChange = () => {
|
|
339
|
+
};
|
|
340
|
+
const onInternalRowsChange = (newRows) => {
|
|
341
|
+
setRows(newRows);
|
|
342
|
+
};
|
|
343
|
+
const onRowClick = (row) => {
|
|
344
|
+
if (selRows.has(row.key))
|
|
345
|
+
return;
|
|
346
|
+
const mySet = /* @__PURE__ */ new Set([row.key]);
|
|
347
|
+
setSelRows(mySet);
|
|
348
|
+
};
|
|
349
|
+
return /* @__PURE__ */ jsxs(WrapperColumnsConfig, {
|
|
350
|
+
ref: divRef,
|
|
351
|
+
className: classes.columnsConfigContainer,
|
|
352
|
+
children: [/* @__PURE__ */ jsx(DivSelColumns, {
|
|
353
|
+
className: classes.columnsLabelSetColumns,
|
|
354
|
+
children: getLabel("data_grid.settings_sel_columns")
|
|
355
|
+
}), /* @__PURE__ */ jsx(WrapperDataGrid, {
|
|
356
|
+
className: classes.columnsConfigContent,
|
|
357
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
358
|
+
className: classes.wrapperDataGridCss,
|
|
359
|
+
children: /* @__PURE__ */ jsx(DataGrid$1, {
|
|
360
|
+
className: classes.columnsConfigGrid,
|
|
361
|
+
ref: refdata_grid,
|
|
362
|
+
columns: columnsdata_grid,
|
|
363
|
+
rows,
|
|
364
|
+
onRowsChange: onInternalRowsChange,
|
|
365
|
+
selectedRows: selRows,
|
|
366
|
+
onSelectedRowsChange: onInternalSelectedRowsChange,
|
|
367
|
+
onRowClick,
|
|
368
|
+
rowKeyGetter: (row) => row.key,
|
|
369
|
+
cellNavigationMode: "CHANGE_ROW",
|
|
370
|
+
defaultColumnOptions: {
|
|
371
|
+
resizable: true,
|
|
372
|
+
sortable: true
|
|
373
|
+
}
|
|
374
|
+
})
|
|
375
|
+
})
|
|
376
|
+
}), /* @__PURE__ */ jsxs(ColumnActions, {
|
|
377
|
+
className: classes.columnsConfigActions,
|
|
378
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
379
|
+
dictionaryTooltipId: "data_grid.settings_move_first",
|
|
380
|
+
onClick: handleMoveFirst,
|
|
381
|
+
"aria-label": "move first place",
|
|
382
|
+
disabled: rowSelectedIndex < 1,
|
|
383
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_first_place.svg`
|
|
384
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
385
|
+
dictionaryTooltipId: "data_grid.settings_move_up",
|
|
386
|
+
onClick: () => handleMoveUpDownd(-1),
|
|
387
|
+
"aria-label": "move up place",
|
|
388
|
+
disabled: rowSelectedIndex < 1,
|
|
389
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_up_place.svg`
|
|
390
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
391
|
+
dictionaryTooltipId: "data_grid.settings_move_last",
|
|
392
|
+
onClick: handleMoveLast,
|
|
393
|
+
"aria-label": "move last place",
|
|
394
|
+
disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
|
|
395
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_last_place.svg`
|
|
396
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
397
|
+
dictionaryTooltipId: "data_grid.settings_move_down",
|
|
398
|
+
onClick: () => handleMoveUpDownd(1),
|
|
399
|
+
"aria-label": "move down place",
|
|
400
|
+
disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
|
|
401
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_down_place.svg`
|
|
402
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
403
|
+
dictionaryTooltipId: "data_grid.settings_visible_all",
|
|
404
|
+
onClick: checkAll,
|
|
405
|
+
"aria-label": "check visible all",
|
|
406
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/check_all.svg`
|
|
407
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
408
|
+
dictionaryTooltipId: "data_grid.settings_no_visible_all",
|
|
409
|
+
onClick: unCheckAll,
|
|
410
|
+
"aria-label": "un check all",
|
|
411
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/uncheck_all.svg`
|
|
412
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
413
|
+
dictionaryTooltipId: "data_grid.settings_restore",
|
|
414
|
+
onClick: restoreAll,
|
|
415
|
+
"aria-label": "Restore columns",
|
|
416
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/restore_columns.svg`
|
|
417
|
+
})]
|
|
418
|
+
})]
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
ColumnsConfig.displayName = "ColumnsConfig";
|
|
422
|
+
function Settings() {
|
|
423
|
+
const {
|
|
424
|
+
openModal,
|
|
425
|
+
closeModal
|
|
426
|
+
} = useModal();
|
|
427
|
+
const {
|
|
428
|
+
columnsConfig,
|
|
429
|
+
onChangeColumnsConfig
|
|
430
|
+
} = useDataGrid();
|
|
431
|
+
const {
|
|
432
|
+
getLabel
|
|
433
|
+
} = useModuleDictionary();
|
|
434
|
+
const {
|
|
435
|
+
host_static_assets,
|
|
436
|
+
environment_assets
|
|
437
|
+
} = useEnvironment();
|
|
438
|
+
const {
|
|
439
|
+
classes
|
|
440
|
+
} = useDataGrid();
|
|
441
|
+
const ref = useRef(null);
|
|
442
|
+
const onCloseSettings = useCallback(() => {
|
|
443
|
+
closeModal();
|
|
444
|
+
}, [closeModal]);
|
|
445
|
+
const onClickIntro = useCallback(() => {
|
|
446
|
+
if (ref.current?.onClickIntro) {
|
|
447
|
+
ref.current?.onClickIntro();
|
|
448
|
+
}
|
|
449
|
+
}, []);
|
|
450
|
+
const onClickSettings = useCallback(() => {
|
|
451
|
+
openModal({
|
|
452
|
+
initialWidth: 500,
|
|
453
|
+
initialHeigth: 680,
|
|
454
|
+
window: /* @__PURE__ */ jsxs(WindowBase, {
|
|
455
|
+
title: getLabel("data_grid.settings_title"),
|
|
456
|
+
children: [/* @__PURE__ */ jsx(ColumnsConfig, {
|
|
457
|
+
ref,
|
|
458
|
+
columnsConfig,
|
|
459
|
+
onChangeColumnsConfig,
|
|
460
|
+
onCloseSettings,
|
|
461
|
+
classes
|
|
462
|
+
}), /* @__PURE__ */ jsxs(Actions$1, {
|
|
463
|
+
children: [/* @__PURE__ */ jsx(ActionCancel, {
|
|
464
|
+
onClick: closeModal
|
|
465
|
+
}), /* @__PURE__ */ jsx(ActionIntro, {
|
|
466
|
+
onClick: onClickIntro
|
|
467
|
+
})]
|
|
468
|
+
})]
|
|
469
|
+
})
|
|
470
|
+
});
|
|
471
|
+
}, [closeModal, columnsConfig, getLabel, onChangeColumnsConfig, onCloseSettings, openModal, onClickIntro]);
|
|
472
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
473
|
+
className: classes.actionSettings,
|
|
474
|
+
dictionaryTooltipId: "data_grid.tooltip_settings",
|
|
475
|
+
onClick: onClickSettings,
|
|
476
|
+
"aria-label": "settings",
|
|
477
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/configuration.svg`
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
function RowsCount() {
|
|
481
|
+
const {
|
|
482
|
+
rowsCount,
|
|
483
|
+
classes
|
|
484
|
+
} = useDataGrid();
|
|
485
|
+
const {
|
|
486
|
+
getLabel
|
|
487
|
+
} = useModuleDictionary();
|
|
488
|
+
const isSkeleton = useModuleSkeleton();
|
|
489
|
+
return /* @__PURE__ */ jsx("div", {
|
|
490
|
+
className: classes.rowsCount,
|
|
491
|
+
children: !isSkeleton ? /* @__PURE__ */ jsxs(Fragment, {
|
|
492
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
493
|
+
className: classes.rowsCountLabel,
|
|
494
|
+
children: getLabel("data_grid.rows")
|
|
495
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
496
|
+
className: classes.rowsCountValue,
|
|
497
|
+
children: rowsCount
|
|
498
|
+
})]
|
|
499
|
+
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
500
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
501
|
+
className: classes.rowsCountLabel,
|
|
502
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
503
|
+
variant: "text",
|
|
504
|
+
width: "40px",
|
|
505
|
+
height: "16px"
|
|
506
|
+
})
|
|
507
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
508
|
+
className: classes.rowsCountValue,
|
|
509
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
510
|
+
variant: "text",
|
|
511
|
+
width: "20px",
|
|
512
|
+
height: "16px"
|
|
513
|
+
})
|
|
514
|
+
})]
|
|
515
|
+
})
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
function Density() {
|
|
519
|
+
const {
|
|
520
|
+
host_static_assets,
|
|
521
|
+
environment_assets
|
|
522
|
+
} = useEnvironment();
|
|
523
|
+
const {
|
|
524
|
+
rowHeights,
|
|
525
|
+
currentRowHeightVariant,
|
|
526
|
+
setRowHeightVariant,
|
|
527
|
+
classes
|
|
528
|
+
} = useDataGrid();
|
|
529
|
+
const {
|
|
530
|
+
getLabel
|
|
531
|
+
} = useModuleDictionary();
|
|
532
|
+
const menuActions = useMemo(() => {
|
|
533
|
+
if (typeof rowHeights === "number") {
|
|
534
|
+
return [];
|
|
535
|
+
}
|
|
536
|
+
return [{
|
|
537
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/compact.svg`,
|
|
538
|
+
onClick: () => setRowHeightVariant("compact"),
|
|
539
|
+
disabled: currentRowHeightVariant === "compact",
|
|
540
|
+
dictionaryField: "data_grid.density_compact"
|
|
541
|
+
}, {
|
|
542
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/standard.svg`,
|
|
543
|
+
onClick: () => setRowHeightVariant("standard"),
|
|
544
|
+
disabled: currentRowHeightVariant === "standard",
|
|
545
|
+
dictionaryField: "data_grid.density_standard"
|
|
546
|
+
}, {
|
|
547
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/confortable.svg`,
|
|
548
|
+
onClick: () => setRowHeightVariant("confortable"),
|
|
549
|
+
disabled: currentRowHeightVariant === "confortable",
|
|
550
|
+
dictionaryField: "data_grid.density_confortable"
|
|
551
|
+
}];
|
|
552
|
+
}, [rowHeights, currentRowHeightVariant, setRowHeightVariant, host_static_assets, environment_assets]);
|
|
553
|
+
const theme = useTheme();
|
|
554
|
+
const currenViewIcon = useMemo(() => {
|
|
555
|
+
if (currentRowHeightVariant === "compact") {
|
|
556
|
+
return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/compact.svg`;
|
|
557
|
+
}
|
|
558
|
+
if (currentRowHeightVariant === "standard") {
|
|
559
|
+
return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/standard.svg`;
|
|
560
|
+
}
|
|
561
|
+
return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/confortable.svg`;
|
|
562
|
+
}, [currentRowHeightVariant, host_static_assets, environment_assets]);
|
|
563
|
+
if (menuActions.length === 0) {
|
|
564
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
565
|
+
}
|
|
566
|
+
return /* @__PURE__ */ jsx(MenuActions, {
|
|
567
|
+
arrowType: "right-top",
|
|
568
|
+
className: classes.actionDensityPopover,
|
|
569
|
+
menuActionSx: theme.components?.M4LDataGridDensityPopover?.styleOverrides,
|
|
570
|
+
anchorOrigin: {
|
|
571
|
+
vertical: "top",
|
|
572
|
+
horizontal: "left"
|
|
573
|
+
},
|
|
574
|
+
transformOrigin: {
|
|
575
|
+
vertical: "top",
|
|
576
|
+
horizontal: "right"
|
|
577
|
+
},
|
|
578
|
+
menuActions,
|
|
579
|
+
urlIcon: currenViewIcon,
|
|
580
|
+
toolTip: getLabel("data_grid.tooltip_density")
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
function Actions(props) {
|
|
584
|
+
const isDesktop = useResponsiveDesktop();
|
|
585
|
+
const {
|
|
586
|
+
rowHeights,
|
|
587
|
+
classes
|
|
588
|
+
} = useDataGrid();
|
|
589
|
+
const isSkeleton = useModuleSkeleton();
|
|
590
|
+
const {
|
|
591
|
+
getLabel
|
|
592
|
+
} = useModuleDictionary();
|
|
593
|
+
const {
|
|
594
|
+
withRowsCount = true,
|
|
595
|
+
withPager = true,
|
|
596
|
+
pagerOptions,
|
|
597
|
+
withSettings = true,
|
|
598
|
+
settingsProps,
|
|
599
|
+
withLocalFilters
|
|
600
|
+
} = props;
|
|
601
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
602
|
+
className: classes.actions,
|
|
603
|
+
children: [withRowsCount && isDesktop && /* @__PURE__ */ jsx(RowsCount, {}), withPager && pagerOptions && /* @__PURE__ */ jsx(Pager, {
|
|
604
|
+
...pagerOptions,
|
|
605
|
+
totalRecords: pagerOptions.totalRecords,
|
|
606
|
+
isSkeleton,
|
|
607
|
+
isDesktop,
|
|
608
|
+
labelRows: getLabel(dictionary.LABEL_ROWS_PER_PAGE),
|
|
609
|
+
labelOf: getLabel(dictionary.LABEL_OF)
|
|
610
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
611
|
+
className: classes.actionsConfigContainer,
|
|
612
|
+
children: [typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}), withLocalFilters && /* @__PURE__ */ jsx(Filter, {}), withSettings && /* @__PURE__ */ jsx(Settings, {
|
|
613
|
+
...settingsProps
|
|
614
|
+
})]
|
|
615
|
+
})]
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
export {
|
|
619
|
+
ActionsColumn as A,
|
|
620
|
+
Actions as a
|
|
621
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
const Input = styled("input")(() => ({
|
|
4
|
+
appearance: "none",
|
|
5
|
+
boxSizing: "border-box",
|
|
6
|
+
inlineSize: "100%",
|
|
7
|
+
blockSize: "100%",
|
|
8
|
+
paddingBlock: "0",
|
|
9
|
+
verticalAlign: "top",
|
|
10
|
+
textAlign: "right",
|
|
11
|
+
color: "var(--rdg-color)",
|
|
12
|
+
backgroundColor: "var(--rdg-background-color)",
|
|
13
|
+
fontFamily: "inherit",
|
|
14
|
+
"&:focus": {
|
|
15
|
+
outline: "none"
|
|
16
|
+
},
|
|
17
|
+
"&::placeholder": {
|
|
18
|
+
color: "#999",
|
|
19
|
+
opacity: "1"
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
function autoFocusAndSelect(input) {
|
|
23
|
+
input?.focus();
|
|
24
|
+
input?.select();
|
|
25
|
+
}
|
|
26
|
+
function TextEditor({
|
|
27
|
+
row,
|
|
28
|
+
column,
|
|
29
|
+
onRowChange,
|
|
30
|
+
onClose
|
|
31
|
+
}) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
33
|
+
className: "rdg-text-editor",
|
|
34
|
+
ref: autoFocusAndSelect,
|
|
35
|
+
value: row[column.key],
|
|
36
|
+
onChange: (event) => onRowChange({
|
|
37
|
+
...row,
|
|
38
|
+
[column.key]: event.target.value
|
|
39
|
+
}),
|
|
40
|
+
onBlur: () => onClose(true)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function NumberEditor({
|
|
44
|
+
row,
|
|
45
|
+
column,
|
|
46
|
+
onRowChange,
|
|
47
|
+
onClose
|
|
48
|
+
}) {
|
|
49
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
50
|
+
className: "rdg-text-editor",
|
|
51
|
+
ref: autoFocusAndSelect,
|
|
52
|
+
type: "number",
|
|
53
|
+
value: row[column.key],
|
|
54
|
+
onChange: (event) => onRowChange({
|
|
55
|
+
...row,
|
|
56
|
+
[column.key]: event.target.value !== "" ? Number(event.target.value) : ""
|
|
57
|
+
}),
|
|
58
|
+
onBlur: () => onClose(true)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
NumberEditor as N,
|
|
63
|
+
TextEditor as T
|
|
64
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BooleanOperator, DateTimeOperator, Field, NumberOperator, Operator, StringOperator } from './types';
|
|
2
2
|
export declare const COMPONENT_TEST_ID = "M4LDynamicFilter";
|
|
3
|
-
export declare const COMPONENT_PREFIX = "
|
|
3
|
+
export declare const COMPONENT_PREFIX = "M4LDynamicFilter";
|
|
4
4
|
export declare const COMPONENT_CLASS_NAME = "M4LDynamicFilter";
|
|
5
5
|
export declare const ASSETS_URL = "frontend/components/dynamic_filter/assets/icons";
|
|
6
6
|
export declare const ASSETS: {
|