@m4l/components 0.1.36 → 0.1.37
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/{commonjs.bcc6b707.js → commonjs.565e6834.js} +0 -1
- package/dist/components/CommonActions/components/ActionCancel/{index.4b36950f.js → index.9230c57b.js} +1 -1
- package/dist/components/CommonActions/components/ActionFormCancel/{index.945e9887.js → index.ab514bd9.js} +9 -7
- package/dist/components/CommonActions/components/ActionIntro/{index.35a0d240.js → index.a0a341c7.js} +1 -1
- package/dist/components/CommonActions/components/Actions/index.d3e1f36e.js +54 -0
- package/dist/components/DataGrid/{index.156cc30c.js → index.67260455.js} +663 -15
- package/dist/components/DynamicFilter/{index.32f84995.js → index.071aa795.js} +92 -18
- package/dist/components/Icon/{index.1dbd3e58.js → index.8d754623.js} +62 -5
- package/dist/components/LanguagePopover/index.cbc4b282.js +144 -0
- package/dist/components/Loadable/{index.8c6006be.js → index.117eaced.js} +1 -1
- package/dist/components/ModalDialog/{index.91777582.js → index.a684827f.js} +5 -5
- package/dist/components/ObjectLogs/{index.9d3fc2ae.js → index.4a859658.js} +12 -10
- package/dist/components/PaperForm/{index.218a6c4b.js → index.c5948756.js} +1 -1
- package/dist/components/Period/{index.74f35862.js → index.abe445bd.js} +9 -7
- package/dist/components/Resizeable/{index.44a0dd46.js → index.c96c0f09.js} +1 -1
- package/dist/components/SplitLayout/{index.81fc4750.js → index.5a8355d8.js} +1 -1
- package/dist/components/animate/PropagateLoader/index.be5b02c3.js +30 -0
- package/dist/components/areas/components/AreasAdmin/index.6794b22f.js +112 -0
- package/dist/components/areas/components/AreasContainer/index.a2f8899b.js +43 -0
- package/dist/components/areas/components/GridLayout/index.b9c1e846.js +92 -0
- package/dist/components/areas/components/Window/index.252fbf4e.js +646 -0
- package/dist/components/areas/components/WindowPopUp/index.214cf099.js +120 -0
- package/dist/components/areas/components/index.7d6cd649.js +67 -0
- package/dist/components/areas/contexts/AreaContext/index.4894cf23.js +286 -0
- package/dist/components/areas/contexts/AreasContext/index.cd8e4bee.js +158 -0
- package/dist/components/areas/contexts/DynamicMFParmsContext/index.668bc2e2.js +17 -0
- package/dist/components/areas/contexts/index.f9196fb2.js +1 -0
- package/dist/components/areas/hooks/useArea/index.9b85ce24.js +19 -0
- package/dist/components/areas/hooks/useDynamicMFParameters/index.e6a44ae3.js +11 -0
- package/dist/components/areas/index.d1bf612c.js +16 -0
- package/dist/components/formatters/BooleanFormatter/{index.efc8ffc2.js → index.3a9b16c8.js} +1 -1
- package/dist/components/formatters/{index.c3f4b687.js → index.0b5f95d0.js} +1 -1
- package/dist/components/hook-form/RHFPeriod/{index.2b8e63a2.js → index.3772295b.js} +1 -1
- package/dist/components/hook-form/RHFTextField/{index.7feaec71.js → index.b17d68f4.js} +1 -1
- package/dist/components/modal/WindowBase.04439b8e.js +120 -0
- package/dist/components/modal/WindowConfirm.0b8a6818.js +115 -0
- package/dist/components/modal/index.8387e90e.js +18 -0
- package/dist/components/mui_extended/Accordion/{index.8e123c57.js → index.a541c71c.js} +2 -2
- package/dist/components/mui_extended/Button/index.86a155a2.js +101 -0
- package/dist/components/mui_extended/IconButton/{index.e3adaa33.js → index.82f16572.js} +5 -62
- package/dist/components/mui_extended/MenuActions/index.ee17bddd.js +112 -0
- package/dist/components/mui_extended/Pager/{index.d245f821.js → index.74d3f5fc.js} +66 -1
- package/dist/components/mui_extended/Popover/index.53c77d23.js +137 -0
- package/dist/components/mui_extended/index.85dfadf1.js +16 -0
- package/dist/contexts/ModalContext/{index.0797eb17.js → index.b90eec94.js} +1 -1
- package/dist/hooks/useModal/{index.32da4dcb.js → index.d14edee3.js} +1 -1
- package/dist/index.js +128 -1691
- package/dist/{components/animate/PropagateLoader/index.eb401503.js → node_modules.416f1da3.js} +59 -28
- package/dist/package.json +2 -1
- package/dist/{react-draggable.3b5b6680.js → react-draggable.84d6b038.js} +1 -1
- package/dist/{react-json-view.03ae95f5.js → react-json-view.57125fcf.js} +1 -1
- package/dist/{react-resizable.6eae0397.js → react-resizable.1d00271d.js} +3 -4
- package/dist/{react-splitter-layout.873aece3.js → react-splitter-layout.8b1655c8.js} +1 -1
- package/dist/style.css +0 -114
- package/dist/utils/{index.9dce2e2f.js → index.899eb67b.js} +28 -460
- package/package.json +3 -1
- package/vite.config.ts +201 -129
- package/dist/components/CommonActions/components/Actions/index.ba86f72f.js +0 -868
- package/dist/components/mui_extended/Button/index.55fc70dc.js +0 -178
- package/dist/components/mui_extended/Popover/index.97cf3a3e.js +0 -275
- package/dist/node_modules.e0b84fac.js +0 -2154
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import { styled, alpha } from "@mui/material/styles";
|
|
2
|
-
import { forwardRef, createContext, useState, useMemo, useEffect, useCallback, useContext, useRef, useLayoutEffect } from "react";
|
|
2
|
+
import { forwardRef, createContext, useState, useMemo, useEffect, useCallback, useContext, useRef, useLayoutEffect, useImperativeHandle } from "react";
|
|
3
3
|
import { S as SELECT_COLUMN_KEY, u as useRowSelection, a as SelectCellFormatter, H as HeaderRenderer, D as DataGrid$1 } from "../../react-data-grid.d46d625e.js";
|
|
4
4
|
import { useDrag, useDrop, DndProvider } from "react-dnd";
|
|
5
5
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
6
6
|
import { SvgIcon, Checkbox, InputBase, Skeleton } from "@mui/material";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { voidFunction, useModuleDictionary, useModuleSkeleton, getPropertyByString } from "@m4l/core";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import "
|
|
12
|
-
import "
|
|
7
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
8
|
+
import { voidFunction, useModuleDictionary, useModuleSkeleton, getPropertyByString, useEnvironment } from "@m4l/core";
|
|
9
|
+
import { M as MenuActions } from "../mui_extended/MenuActions/index.ee17bddd.js";
|
|
10
|
+
import { P as Pager, g as getPagerComponentsDictionary, d as defaultPagerDictionary } from "../mui_extended/Pager/index.74d3f5fc.js";
|
|
11
|
+
import { I as IconButton } from "../mui_extended/IconButton/index.82f16572.js";
|
|
12
|
+
import { u as useModal } from "../../hooks/useModal/index.d14edee3.js";
|
|
13
|
+
import { A as ActionCancel } from "../CommonActions/components/ActionCancel/index.9230c57b.js";
|
|
14
|
+
import { A as ActionIntro } from "../CommonActions/components/ActionIntro/index.a0a341c7.js";
|
|
15
|
+
import "../../react-draggable.84d6b038.js";
|
|
16
|
+
import { g as getModalDialogComponentsDictionary, d as defaultModalDialogDictionary } from "../ModalDialog/index.a684827f.js";
|
|
17
|
+
import "../Resizeable/index.c96c0f09.js";
|
|
18
|
+
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
19
|
+
import "../areas/contexts/DynamicMFParmsContext/index.668bc2e2.js";
|
|
20
|
+
import { A as Actions$1 } from "../CommonActions/components/Actions/index.d3e1f36e.js";
|
|
21
|
+
import "react-hook-form";
|
|
22
|
+
import "@mui/material/Button";
|
|
23
|
+
import "@mui/lab";
|
|
24
|
+
import "../modal/WindowConfirm.0b8a6818.js";
|
|
25
|
+
import "../Icon/index.8d754623.js";
|
|
26
|
+
import { W as WindowBase } from "../modal/WindowBase.04439b8e.js";
|
|
27
|
+
import { B as BooleanFormatter } from "../formatters/BooleanFormatter/index.3a9b16c8.js";
|
|
13
28
|
import { D as DateFormatter } from "../formatters/DateFormatter/index.80522f69.js";
|
|
14
|
-
import { g as getModalDialogComponentsDictionary, d as defaultModalDialogDictionary } from "../ModalDialog/index.91777582.js";
|
|
15
|
-
import { g as getPagerComponentsDictionary, d as defaultPagerDictionary } from "../mui_extended/Pager/index.d245f821.js";
|
|
16
29
|
const WrapperGrid = styled("div")(() => ({
|
|
17
30
|
display: "flex",
|
|
18
31
|
flexDirection: "column",
|
|
@@ -661,6 +674,41 @@ const getDragHeaderRenderer = (handleColumnsReorder) => {
|
|
|
661
674
|
}
|
|
662
675
|
return HeaderRenderer2;
|
|
663
676
|
};
|
|
677
|
+
const ACTIONS_COLUMN_KEY = "actions-row";
|
|
678
|
+
function ActionsFormatter(props) {
|
|
679
|
+
const {
|
|
680
|
+
rowActionsGetter
|
|
681
|
+
} = useDataGrid();
|
|
682
|
+
if (rowActionsGetter === void 0) {
|
|
683
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
684
|
+
}
|
|
685
|
+
return /* @__PURE__ */ jsx(MenuActions, {
|
|
686
|
+
arrowType: "top-left",
|
|
687
|
+
objItem: props.row,
|
|
688
|
+
menuActions: rowActionsGetter,
|
|
689
|
+
marginTop: 1,
|
|
690
|
+
marginLeft: "-11px",
|
|
691
|
+
anchorOrigin: {
|
|
692
|
+
vertical: "bottom",
|
|
693
|
+
horizontal: "left"
|
|
694
|
+
},
|
|
695
|
+
transformOrigin: {
|
|
696
|
+
vertical: "top",
|
|
697
|
+
horizontal: "left"
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
const ActionsColumn = {
|
|
702
|
+
key: ACTIONS_COLUMN_KEY,
|
|
703
|
+
name: "Actions",
|
|
704
|
+
width: 60,
|
|
705
|
+
withFilter: false,
|
|
706
|
+
resizable: true,
|
|
707
|
+
sortable: false,
|
|
708
|
+
frozen: true,
|
|
709
|
+
type: "custom",
|
|
710
|
+
formatter: ActionsFormatter
|
|
711
|
+
};
|
|
664
712
|
const WrapperSkeleton = styled("div")(() => ({
|
|
665
713
|
display: "flex",
|
|
666
714
|
width: "100%",
|
|
@@ -935,6 +983,609 @@ function Table(props) {
|
|
|
935
983
|
})
|
|
936
984
|
});
|
|
937
985
|
}
|
|
986
|
+
const SKTWrapperFilter = styled("div")(({
|
|
987
|
+
theme
|
|
988
|
+
}) => ({
|
|
989
|
+
display: "flex",
|
|
990
|
+
justifyContent: "center",
|
|
991
|
+
alignItems: "center",
|
|
992
|
+
minWidth: theme.spacing(3.75),
|
|
993
|
+
height: theme.spacing(3.75)
|
|
994
|
+
}));
|
|
995
|
+
function Filter() {
|
|
996
|
+
const isSkeleton = useModuleSkeleton();
|
|
997
|
+
const {
|
|
998
|
+
activeFilters,
|
|
999
|
+
setActiveFilters
|
|
1000
|
+
} = useFilters();
|
|
1001
|
+
const {
|
|
1002
|
+
host_static_assets,
|
|
1003
|
+
environment_assets
|
|
1004
|
+
} = useEnvironment();
|
|
1005
|
+
const toggleIcon = () => {
|
|
1006
|
+
setActiveFilters(!activeFilters);
|
|
1007
|
+
};
|
|
1008
|
+
if (isSkeleton) {
|
|
1009
|
+
return /* @__PURE__ */ jsx(SKTWrapperFilter, {
|
|
1010
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1011
|
+
variant: "circular",
|
|
1012
|
+
width: 20,
|
|
1013
|
+
height: 20
|
|
1014
|
+
})
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
1018
|
+
dictionaryTooltip: activeFilters ? "data_grid.tooltip_filter_hide" : "data_grid.tooltip_filter_show",
|
|
1019
|
+
onClick: toggleIcon,
|
|
1020
|
+
"aria-label": "filter",
|
|
1021
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/filter.svg`
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
const WrapperColumnsConfig = styled("div")(({ theme }) => ({
|
|
1025
|
+
color: theme.palette.text.primary,
|
|
1026
|
+
position: "relative",
|
|
1027
|
+
display: "flex",
|
|
1028
|
+
flexDirection: "column",
|
|
1029
|
+
height: "100%",
|
|
1030
|
+
width: "100%"
|
|
1031
|
+
}));
|
|
1032
|
+
styled("div")(({ theme }) => ({
|
|
1033
|
+
color: theme.palette.text.primary,
|
|
1034
|
+
fontSize: theme.typography.h4.fontSize
|
|
1035
|
+
}));
|
|
1036
|
+
const DivSelColumns = styled("div")(({ theme }) => ({
|
|
1037
|
+
...theme.typography.subtitle2,
|
|
1038
|
+
color: theme.palette.text.primary,
|
|
1039
|
+
padding: `${theme.spacing(3)} ${theme.spacing(1)}`
|
|
1040
|
+
}));
|
|
1041
|
+
const WrapperDataGrid = styled("div")(() => ({
|
|
1042
|
+
position: "relative",
|
|
1043
|
+
display: "flex",
|
|
1044
|
+
flexDirection: "column",
|
|
1045
|
+
flexGrow: 1
|
|
1046
|
+
}));
|
|
1047
|
+
styled("div")(() => ({
|
|
1048
|
+
display: "flex",
|
|
1049
|
+
flexDirection: "row"
|
|
1050
|
+
}));
|
|
1051
|
+
const ColumnActions = styled("div")(({ theme }) => ({
|
|
1052
|
+
paddingTop: theme.spacing(3),
|
|
1053
|
+
display: "flex",
|
|
1054
|
+
flexDirection: "row"
|
|
1055
|
+
}));
|
|
1056
|
+
styled("div")(({ theme }) => ({
|
|
1057
|
+
paddingTop: theme.spacing(3),
|
|
1058
|
+
display: "flex",
|
|
1059
|
+
flexDirection: "row",
|
|
1060
|
+
justifyContent: "flex-end",
|
|
1061
|
+
"& > button": {
|
|
1062
|
+
marginLeft: "10px"
|
|
1063
|
+
}
|
|
1064
|
+
}));
|
|
1065
|
+
function FormatterColumn({
|
|
1066
|
+
row,
|
|
1067
|
+
onRowChange,
|
|
1068
|
+
column
|
|
1069
|
+
}) {
|
|
1070
|
+
const handleChange = () => {
|
|
1071
|
+
const newRow = {
|
|
1072
|
+
...row
|
|
1073
|
+
};
|
|
1074
|
+
newRow[column.key] = !row[column.key];
|
|
1075
|
+
onRowChange(newRow);
|
|
1076
|
+
};
|
|
1077
|
+
return /* @__PURE__ */ jsx(Checkbox, {
|
|
1078
|
+
size: "small",
|
|
1079
|
+
checked: row[column.key],
|
|
1080
|
+
onChange: handleChange
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
function getRowsFromColumnsConfig(columnsConfig) {
|
|
1084
|
+
return columnsConfig.filter((column) => !column.hidden).map((column) => ({
|
|
1085
|
+
key: column.key,
|
|
1086
|
+
name: column.name,
|
|
1087
|
+
visible: column.visible === void 0 ? true : column.visible,
|
|
1088
|
+
frozen: column.frozen === void 0 ? false : column.frozen,
|
|
1089
|
+
originalIndex: column.orginalIndex,
|
|
1090
|
+
originalFrozen: column.originalFrozen,
|
|
1091
|
+
originalVisible: column.originalVisible
|
|
1092
|
+
}));
|
|
1093
|
+
}
|
|
1094
|
+
const ColumnsConfig = forwardRef((props, ref) => {
|
|
1095
|
+
const refdata_grid = useRef(null);
|
|
1096
|
+
const {
|
|
1097
|
+
onCloseSettings,
|
|
1098
|
+
columnsConfig,
|
|
1099
|
+
onChangeColumnsConfig
|
|
1100
|
+
} = props;
|
|
1101
|
+
const {
|
|
1102
|
+
getLabel
|
|
1103
|
+
} = useModuleDictionary();
|
|
1104
|
+
const [isInit, setIsInit] = useState(true);
|
|
1105
|
+
const [rows, setRows] = useState(getRowsFromColumnsConfig(columnsConfig));
|
|
1106
|
+
const [selRows, setSelRows] = useState(() => /* @__PURE__ */ new Set());
|
|
1107
|
+
const divRef = useRef(null);
|
|
1108
|
+
const {
|
|
1109
|
+
host_static_assets,
|
|
1110
|
+
environment_assets
|
|
1111
|
+
} = useEnvironment();
|
|
1112
|
+
useImperativeHandle(ref, () => ({
|
|
1113
|
+
onClickIntro: handleIntro,
|
|
1114
|
+
current: divRef.current
|
|
1115
|
+
}));
|
|
1116
|
+
const columnsdata_grid = useMemo(() => [{
|
|
1117
|
+
key: "name",
|
|
1118
|
+
name: getLabel("data_grid.settings_column_name"),
|
|
1119
|
+
width: 200,
|
|
1120
|
+
resizable: true,
|
|
1121
|
+
type: "string"
|
|
1122
|
+
}, {
|
|
1123
|
+
key: "originalIndex",
|
|
1124
|
+
name: getLabel("data_grid.settings_column_position"),
|
|
1125
|
+
width: 50,
|
|
1126
|
+
type: "number",
|
|
1127
|
+
cellClass: "rdg-cell-align-center"
|
|
1128
|
+
}, {
|
|
1129
|
+
key: "visible",
|
|
1130
|
+
name: getLabel("data_grid.settings_column_visible"),
|
|
1131
|
+
width: 80,
|
|
1132
|
+
type: "boolean",
|
|
1133
|
+
formatter: FormatterColumn,
|
|
1134
|
+
cellClass: "rdg-cell-align-center"
|
|
1135
|
+
}, {
|
|
1136
|
+
key: "frozen",
|
|
1137
|
+
name: getLabel("data_grid.settings_column_frozen"),
|
|
1138
|
+
width: 80,
|
|
1139
|
+
type: "boolean",
|
|
1140
|
+
formatter: FormatterColumn,
|
|
1141
|
+
cellClass: "rdg-cell-align-center"
|
|
1142
|
+
}], [getLabel]);
|
|
1143
|
+
const checkAll = () => {
|
|
1144
|
+
setRows(rows.map((row) => ({
|
|
1145
|
+
...row,
|
|
1146
|
+
visible: true
|
|
1147
|
+
})));
|
|
1148
|
+
};
|
|
1149
|
+
const unCheckAll = () => {
|
|
1150
|
+
setRows(rows.map((row) => ({
|
|
1151
|
+
...row,
|
|
1152
|
+
visible: false
|
|
1153
|
+
})));
|
|
1154
|
+
};
|
|
1155
|
+
const restoreAll = () => {
|
|
1156
|
+
setRows(rows.map((row) => ({
|
|
1157
|
+
...row,
|
|
1158
|
+
visible: row.originalVisible,
|
|
1159
|
+
frozen: row.originalFrozen,
|
|
1160
|
+
index: row.originalIndex
|
|
1161
|
+
})).sort((a, b) => a.index - b.index));
|
|
1162
|
+
};
|
|
1163
|
+
useEffect(() => {
|
|
1164
|
+
if (isInit === false) {
|
|
1165
|
+
setRows(getRowsFromColumnsConfig(columnsConfig));
|
|
1166
|
+
}
|
|
1167
|
+
setIsInit(false);
|
|
1168
|
+
}, [columnsConfig]);
|
|
1169
|
+
const rowSelectedIndex = useMemo(() => {
|
|
1170
|
+
let rowIndex = -1;
|
|
1171
|
+
if (selRows.size !== 1)
|
|
1172
|
+
return rowIndex;
|
|
1173
|
+
const iterator = selRows.entries();
|
|
1174
|
+
const entry = iterator.next().value[1];
|
|
1175
|
+
rowIndex = rows.findIndex((row) => row.key === entry);
|
|
1176
|
+
return rowIndex;
|
|
1177
|
+
}, [rows, selRows]);
|
|
1178
|
+
const handleMoveFirst = () => {
|
|
1179
|
+
if (rowSelectedIndex === -1)
|
|
1180
|
+
return -1;
|
|
1181
|
+
const newRows = [...rows];
|
|
1182
|
+
newRows.splice(rowSelectedIndex, 1);
|
|
1183
|
+
newRows.splice(0, 0, rows[rowSelectedIndex]);
|
|
1184
|
+
refdata_grid.current?.selectCell({
|
|
1185
|
+
idx: 0,
|
|
1186
|
+
rowIdx: 0
|
|
1187
|
+
});
|
|
1188
|
+
setRows(newRows);
|
|
1189
|
+
};
|
|
1190
|
+
const handleMoveLast = () => {
|
|
1191
|
+
if (rowSelectedIndex === -1)
|
|
1192
|
+
return -1;
|
|
1193
|
+
const newRows = [...rows];
|
|
1194
|
+
newRows.splice(rowSelectedIndex, 1);
|
|
1195
|
+
newRows.splice(newRows.length, 0, rows[rowSelectedIndex]);
|
|
1196
|
+
refdata_grid.current?.selectCell({
|
|
1197
|
+
idx: 0,
|
|
1198
|
+
rowIdx: newRows.length - 1
|
|
1199
|
+
});
|
|
1200
|
+
setRows(newRows);
|
|
1201
|
+
};
|
|
1202
|
+
const handleMoveUpDownd = (position) => {
|
|
1203
|
+
if (rowSelectedIndex === -1)
|
|
1204
|
+
return -1;
|
|
1205
|
+
const newRows = [...rows];
|
|
1206
|
+
const element = newRows[rowSelectedIndex];
|
|
1207
|
+
newRows.splice(rowSelectedIndex, 1);
|
|
1208
|
+
newRows.splice(rowSelectedIndex + position, 0, element);
|
|
1209
|
+
refdata_grid.current?.selectCell({
|
|
1210
|
+
idx: 0,
|
|
1211
|
+
rowIdx: rowSelectedIndex + position
|
|
1212
|
+
});
|
|
1213
|
+
setRows(newRows);
|
|
1214
|
+
};
|
|
1215
|
+
const getColumnConfigByKey2 = (key) => {
|
|
1216
|
+
const rowIndexFinded = rows.findIndex((row) => row.key === key);
|
|
1217
|
+
if (rowIndexFinded > -1) {
|
|
1218
|
+
return {
|
|
1219
|
+
visible: rows[rowIndexFinded].visible,
|
|
1220
|
+
frozen: rows[rowIndexFinded].frozen
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
return void 0;
|
|
1224
|
+
};
|
|
1225
|
+
const getRowIndex = (column) => {
|
|
1226
|
+
const rowIndexFinded = rows.findIndex((row) => row.key === column.key);
|
|
1227
|
+
if (rowIndexFinded > -1) {
|
|
1228
|
+
return rowIndexFinded;
|
|
1229
|
+
}
|
|
1230
|
+
return columnsConfig.findIndex((columnConfig) => columnConfig.key === column.key);
|
|
1231
|
+
};
|
|
1232
|
+
const handleIntro = () => {
|
|
1233
|
+
const newColumnsConfig = columnsConfig.map((columnConfig) => {
|
|
1234
|
+
const newColumnConfig = {
|
|
1235
|
+
...columnConfig
|
|
1236
|
+
};
|
|
1237
|
+
if (!columnConfig.hidden) {
|
|
1238
|
+
const columnConfigRow = getColumnConfigByKey2(columnConfig.key);
|
|
1239
|
+
if (columnConfigRow) {
|
|
1240
|
+
newColumnConfig.visible = columnConfigRow.visible;
|
|
1241
|
+
newColumnConfig.frozen = columnConfigRow.frozen;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
return newColumnConfig;
|
|
1245
|
+
}).sort((a, b) => getRowIndex(a) - getRowIndex(b));
|
|
1246
|
+
onChangeColumnsConfig(newColumnsConfig);
|
|
1247
|
+
onCloseSettings();
|
|
1248
|
+
};
|
|
1249
|
+
const onInternalSelectedRowsChange = () => {
|
|
1250
|
+
};
|
|
1251
|
+
const onInternalRowsChange = (newRows) => {
|
|
1252
|
+
setRows(newRows);
|
|
1253
|
+
};
|
|
1254
|
+
const onRowClick = (row) => {
|
|
1255
|
+
if (selRows.has(row.key))
|
|
1256
|
+
return;
|
|
1257
|
+
const mySet = /* @__PURE__ */ new Set([row.key]);
|
|
1258
|
+
setSelRows(mySet);
|
|
1259
|
+
};
|
|
1260
|
+
return /* @__PURE__ */ jsxs(WrapperColumnsConfig, {
|
|
1261
|
+
id: "WrapperColumnsConfig",
|
|
1262
|
+
ref: divRef,
|
|
1263
|
+
children: [/* @__PURE__ */ jsx(DivSelColumns, {
|
|
1264
|
+
id: "divInfo",
|
|
1265
|
+
children: getLabel("data_grid.settings_sel_columns")
|
|
1266
|
+
}), /* @__PURE__ */ jsx(WrapperDataGrid, {
|
|
1267
|
+
id: "WrapperDataGrid",
|
|
1268
|
+
children: /* @__PURE__ */ jsx(OriginalDataGridWrapperStyled, {
|
|
1269
|
+
id: "Originaldata_gridWrapperStyled",
|
|
1270
|
+
children: /* @__PURE__ */ jsx(DataGrid$1, {
|
|
1271
|
+
className: "fill-data_grid rdg-light",
|
|
1272
|
+
ref: refdata_grid,
|
|
1273
|
+
columns: columnsdata_grid,
|
|
1274
|
+
rows,
|
|
1275
|
+
onRowsChange: onInternalRowsChange,
|
|
1276
|
+
selectedRows: selRows,
|
|
1277
|
+
onSelectedRowsChange: onInternalSelectedRowsChange,
|
|
1278
|
+
onRowClick,
|
|
1279
|
+
rowKeyGetter: (row) => row.key,
|
|
1280
|
+
cellNavigationMode: "CHANGE_ROW",
|
|
1281
|
+
defaultColumnOptions: {
|
|
1282
|
+
resizable: true,
|
|
1283
|
+
sortable: true
|
|
1284
|
+
}
|
|
1285
|
+
})
|
|
1286
|
+
})
|
|
1287
|
+
}), /* @__PURE__ */ jsxs(ColumnActions, {
|
|
1288
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
1289
|
+
dictionaryTooltip: "data_grid.settings_move_first",
|
|
1290
|
+
onClick: handleMoveFirst,
|
|
1291
|
+
"aria-label": "move first place",
|
|
1292
|
+
disabled: rowSelectedIndex < 1,
|
|
1293
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_first_place.svg`
|
|
1294
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1295
|
+
dictionaryTooltip: "data_grid.settings_move_up",
|
|
1296
|
+
onClick: () => handleMoveUpDownd(-1),
|
|
1297
|
+
"aria-label": "move up place",
|
|
1298
|
+
disabled: rowSelectedIndex < 1,
|
|
1299
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_up_place.svg`
|
|
1300
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1301
|
+
dictionaryTooltip: "data_grid.settings_move_last",
|
|
1302
|
+
onClick: handleMoveLast,
|
|
1303
|
+
"aria-label": "move last place",
|
|
1304
|
+
disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
|
|
1305
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_last_place.svg`
|
|
1306
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1307
|
+
dictionaryTooltip: "data_grid.settings_move_down",
|
|
1308
|
+
onClick: () => handleMoveUpDownd(1),
|
|
1309
|
+
"aria-label": "move down place",
|
|
1310
|
+
disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
|
|
1311
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_down_place.svg`
|
|
1312
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1313
|
+
dictionaryTooltip: "data_grid.settings_visible_all",
|
|
1314
|
+
onClick: checkAll,
|
|
1315
|
+
"aria-label": "check visible all",
|
|
1316
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/check_all.svg`
|
|
1317
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1318
|
+
dictionaryTooltip: "data_grid.settings_no_visible_all",
|
|
1319
|
+
onClick: unCheckAll,
|
|
1320
|
+
"aria-label": "un check all",
|
|
1321
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/uncheck_all.svg`
|
|
1322
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1323
|
+
dictionaryTooltip: "data_grid.settings_restore",
|
|
1324
|
+
onClick: restoreAll,
|
|
1325
|
+
"aria-label": "Restore columns",
|
|
1326
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/restore_columns.svg`
|
|
1327
|
+
})]
|
|
1328
|
+
})]
|
|
1329
|
+
});
|
|
1330
|
+
});
|
|
1331
|
+
ColumnsConfig.displayName = "ColumnsConfig";
|
|
1332
|
+
const SKTWrapperColumnsSettings = styled("div")(({ theme }) => ({
|
|
1333
|
+
display: "flex",
|
|
1334
|
+
justifyContent: "center",
|
|
1335
|
+
alignItems: "center",
|
|
1336
|
+
minWidth: theme.spacing(3.75),
|
|
1337
|
+
height: theme.spacing(3.75)
|
|
1338
|
+
}));
|
|
1339
|
+
function Settings() {
|
|
1340
|
+
const {
|
|
1341
|
+
openModal,
|
|
1342
|
+
closeModal
|
|
1343
|
+
} = useModal();
|
|
1344
|
+
const {
|
|
1345
|
+
columnsConfig,
|
|
1346
|
+
onChangeColumnsConfig
|
|
1347
|
+
} = useDataGrid();
|
|
1348
|
+
const {
|
|
1349
|
+
getLabel
|
|
1350
|
+
} = useModuleDictionary();
|
|
1351
|
+
const {
|
|
1352
|
+
host_static_assets,
|
|
1353
|
+
environment_assets
|
|
1354
|
+
} = useEnvironment();
|
|
1355
|
+
const isSkeleton = useModuleSkeleton();
|
|
1356
|
+
const ref = useRef(null);
|
|
1357
|
+
const onCloseSettings = useCallback(() => {
|
|
1358
|
+
closeModal();
|
|
1359
|
+
}, [closeModal]);
|
|
1360
|
+
const onClickIntro = useCallback(() => {
|
|
1361
|
+
if (ref.current?.onClickIntro) {
|
|
1362
|
+
ref.current?.onClickIntro();
|
|
1363
|
+
}
|
|
1364
|
+
}, []);
|
|
1365
|
+
const onClickSettings = useCallback(() => {
|
|
1366
|
+
openModal({
|
|
1367
|
+
initialWidth: 500,
|
|
1368
|
+
initialHeigth: 680,
|
|
1369
|
+
window: /* @__PURE__ */ jsxs(WindowBase, {
|
|
1370
|
+
title: getLabel("data_grid.settings_title"),
|
|
1371
|
+
children: [/* @__PURE__ */ jsx(ColumnsConfig, {
|
|
1372
|
+
ref,
|
|
1373
|
+
columnsConfig,
|
|
1374
|
+
onChangeColumnsConfig,
|
|
1375
|
+
onCloseSettings
|
|
1376
|
+
}), /* @__PURE__ */ jsxs(Actions$1, {
|
|
1377
|
+
children: [/* @__PURE__ */ jsx(ActionCancel, {
|
|
1378
|
+
onClick: closeModal
|
|
1379
|
+
}), /* @__PURE__ */ jsx(ActionIntro, {
|
|
1380
|
+
onClick: onClickIntro
|
|
1381
|
+
})]
|
|
1382
|
+
})]
|
|
1383
|
+
})
|
|
1384
|
+
});
|
|
1385
|
+
}, [closeModal, columnsConfig, getLabel, onChangeColumnsConfig, onCloseSettings, openModal, onClickIntro]);
|
|
1386
|
+
if (isSkeleton) {
|
|
1387
|
+
return /* @__PURE__ */ jsx(SKTWrapperColumnsSettings, {
|
|
1388
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1389
|
+
variant: "circular",
|
|
1390
|
+
width: 20,
|
|
1391
|
+
height: 20
|
|
1392
|
+
})
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
1396
|
+
dictionaryTooltip: "data_grid.tooltip_settings",
|
|
1397
|
+
onClick: onClickSettings,
|
|
1398
|
+
"aria-label": "settings",
|
|
1399
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/configuration.svg`
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
const Container = styled("div")(() => ({
|
|
1403
|
+
display: "flex",
|
|
1404
|
+
alignItems: "center"
|
|
1405
|
+
}));
|
|
1406
|
+
const RowsLabel = styled("span")(() => ({}));
|
|
1407
|
+
const InsetLabel = styled("span")(({ theme }) => ({
|
|
1408
|
+
marginLeft: theme.spacing(2),
|
|
1409
|
+
paddingTop: "2px",
|
|
1410
|
+
paddingBottom: "2px",
|
|
1411
|
+
paddingLeft: "4px",
|
|
1412
|
+
paddingRight: "4px",
|
|
1413
|
+
border: `1px solid ${theme.palette.divider}`
|
|
1414
|
+
}));
|
|
1415
|
+
function RowsCount() {
|
|
1416
|
+
const {
|
|
1417
|
+
rowsCount
|
|
1418
|
+
} = useDataGrid();
|
|
1419
|
+
const {
|
|
1420
|
+
getLabel
|
|
1421
|
+
} = useModuleDictionary();
|
|
1422
|
+
const isSkeleton = useModuleSkeleton();
|
|
1423
|
+
if (isSkeleton) {
|
|
1424
|
+
return /* @__PURE__ */ jsxs(Container, {
|
|
1425
|
+
children: [/* @__PURE__ */ jsx(RowsLabel, {
|
|
1426
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1427
|
+
variant: "text",
|
|
1428
|
+
width: "40px",
|
|
1429
|
+
height: "16px"
|
|
1430
|
+
})
|
|
1431
|
+
}), /* @__PURE__ */ jsx(InsetLabel, {
|
|
1432
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1433
|
+
variant: "text",
|
|
1434
|
+
width: "20px",
|
|
1435
|
+
height: "16px"
|
|
1436
|
+
})
|
|
1437
|
+
})]
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
return /* @__PURE__ */ jsxs(Container, {
|
|
1441
|
+
className: "rows-count",
|
|
1442
|
+
id: "RowsCount",
|
|
1443
|
+
children: [/* @__PURE__ */ jsx(RowsLabel, {
|
|
1444
|
+
children: getLabel("data_grid.rows")
|
|
1445
|
+
}), /* @__PURE__ */ jsx(InsetLabel, {
|
|
1446
|
+
children: rowsCount
|
|
1447
|
+
})]
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
const WrapperDensity = styled("div")(({ theme }) => ({
|
|
1451
|
+
marginLeft: 0,
|
|
1452
|
+
[theme.breakpoints.up("sm")]: {
|
|
1453
|
+
marginLeft: theme.spacing(3)
|
|
1454
|
+
}
|
|
1455
|
+
}));
|
|
1456
|
+
const SKTWrapperDensity = styled("div")(({ theme }) => ({
|
|
1457
|
+
display: "flex",
|
|
1458
|
+
justifyContent: "center",
|
|
1459
|
+
alignItems: "center",
|
|
1460
|
+
minWidth: theme.spacing(3.75),
|
|
1461
|
+
height: theme.spacing(3.75)
|
|
1462
|
+
}));
|
|
1463
|
+
function Density() {
|
|
1464
|
+
const {
|
|
1465
|
+
host_static_assets,
|
|
1466
|
+
environment_assets
|
|
1467
|
+
} = useEnvironment();
|
|
1468
|
+
const {
|
|
1469
|
+
rowHeights,
|
|
1470
|
+
currentRowHeightVariant,
|
|
1471
|
+
setRowHeightVariant
|
|
1472
|
+
} = useDataGrid();
|
|
1473
|
+
const {
|
|
1474
|
+
getLabel
|
|
1475
|
+
} = useModuleDictionary();
|
|
1476
|
+
const isSkeleton = useModuleSkeleton();
|
|
1477
|
+
const menuActions = useMemo(() => {
|
|
1478
|
+
if (typeof rowHeights === "number") {
|
|
1479
|
+
return [];
|
|
1480
|
+
}
|
|
1481
|
+
return [{
|
|
1482
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/compact.svg`,
|
|
1483
|
+
onClick: () => setRowHeightVariant("compact"),
|
|
1484
|
+
disabled: currentRowHeightVariant === "compact",
|
|
1485
|
+
dictionaryField: "data_grid.density_compact"
|
|
1486
|
+
}, {
|
|
1487
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/standard.svg`,
|
|
1488
|
+
onClick: () => setRowHeightVariant("standard"),
|
|
1489
|
+
disabled: currentRowHeightVariant === "standard",
|
|
1490
|
+
dictionaryField: "data_grid.density_standard"
|
|
1491
|
+
}, {
|
|
1492
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/confortable.svg`,
|
|
1493
|
+
onClick: () => setRowHeightVariant("confortable"),
|
|
1494
|
+
disabled: currentRowHeightVariant === "confortable",
|
|
1495
|
+
dictionaryField: "data_grid.density_confortable"
|
|
1496
|
+
}];
|
|
1497
|
+
}, [rowHeights, currentRowHeightVariant, setRowHeightVariant, host_static_assets, environment_assets]);
|
|
1498
|
+
const currenViewIcon = useMemo(() => {
|
|
1499
|
+
if (currentRowHeightVariant === "compact") {
|
|
1500
|
+
return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/compact.svg`;
|
|
1501
|
+
}
|
|
1502
|
+
if (currentRowHeightVariant === "standard") {
|
|
1503
|
+
return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/standard.svg`;
|
|
1504
|
+
}
|
|
1505
|
+
return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/confortable.svg`;
|
|
1506
|
+
}, [currentRowHeightVariant, host_static_assets, environment_assets]);
|
|
1507
|
+
if (menuActions.length === 0) {
|
|
1508
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
1509
|
+
}
|
|
1510
|
+
if (isSkeleton) {
|
|
1511
|
+
return /* @__PURE__ */ jsx(SKTWrapperDensity, {
|
|
1512
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1513
|
+
variant: "circular",
|
|
1514
|
+
width: "20px",
|
|
1515
|
+
height: "20px"
|
|
1516
|
+
})
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
return /* @__PURE__ */ jsx(WrapperDensity, {
|
|
1520
|
+
id: "WrapperDensity",
|
|
1521
|
+
children: /* @__PURE__ */ jsx(MenuActions, {
|
|
1522
|
+
arrowType: "right-top",
|
|
1523
|
+
anchorOrigin: {
|
|
1524
|
+
vertical: "top",
|
|
1525
|
+
horizontal: "left"
|
|
1526
|
+
},
|
|
1527
|
+
transformOrigin: {
|
|
1528
|
+
vertical: "top",
|
|
1529
|
+
horizontal: "right"
|
|
1530
|
+
},
|
|
1531
|
+
menuActions,
|
|
1532
|
+
url_icon: currenViewIcon,
|
|
1533
|
+
toolTip: getLabel("data_grid.tooltip_density")
|
|
1534
|
+
})
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
const WrapperActions = styled("div")(({ theme }) => ({
|
|
1538
|
+
...theme.typography.caption,
|
|
1539
|
+
position: "absolute",
|
|
1540
|
+
left: "0px",
|
|
1541
|
+
right: "0px",
|
|
1542
|
+
top: "0px",
|
|
1543
|
+
height: theme.spacing(5.5),
|
|
1544
|
+
padding: 0,
|
|
1545
|
+
display: "flex",
|
|
1546
|
+
flexDirection: "row",
|
|
1547
|
+
alignItems: "center",
|
|
1548
|
+
justifyContent: "flex-end",
|
|
1549
|
+
[theme.breakpoints.up("sm")]: {
|
|
1550
|
+
padding: theme.spacing(0, 1.5)
|
|
1551
|
+
},
|
|
1552
|
+
"&.with-no-pager .rows-count": {
|
|
1553
|
+
flexGrow: 1
|
|
1554
|
+
},
|
|
1555
|
+
"& .MuiTablePagination-root": {
|
|
1556
|
+
flexGrow: 1,
|
|
1557
|
+
display: "flex",
|
|
1558
|
+
justifyContent: "center",
|
|
1559
|
+
overflow: "hidden"
|
|
1560
|
+
}
|
|
1561
|
+
}));
|
|
1562
|
+
function Actions(props) {
|
|
1563
|
+
const isDesktop = useResponsiveDesktop();
|
|
1564
|
+
const {
|
|
1565
|
+
rowHeights
|
|
1566
|
+
} = useDataGrid();
|
|
1567
|
+
const isSkeleton = useModuleSkeleton();
|
|
1568
|
+
const {
|
|
1569
|
+
withRowsCount = true,
|
|
1570
|
+
withPager = true,
|
|
1571
|
+
pagerOptions,
|
|
1572
|
+
withSettings = true,
|
|
1573
|
+
settingsProps,
|
|
1574
|
+
withLocalFilters
|
|
1575
|
+
} = props;
|
|
1576
|
+
return /* @__PURE__ */ jsxs(WrapperActions, {
|
|
1577
|
+
id: "WrapperActions",
|
|
1578
|
+
className: withPager && pagerOptions ? "with-pager" : "with-no-pager",
|
|
1579
|
+
children: [withRowsCount && isDesktop && /* @__PURE__ */ jsx(RowsCount, {}), withPager && pagerOptions && /* @__PURE__ */ jsx(Pager, {
|
|
1580
|
+
...pagerOptions,
|
|
1581
|
+
totalRecords: pagerOptions.totalRecords,
|
|
1582
|
+
isSkeleton,
|
|
1583
|
+
isDesktop
|
|
1584
|
+
}), typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}), withLocalFilters && /* @__PURE__ */ jsx(Filter, {}), withSettings && /* @__PURE__ */ jsx(Settings, {
|
|
1585
|
+
...settingsProps
|
|
1586
|
+
})]
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
938
1589
|
function DataGrid(props) {
|
|
939
1590
|
const {
|
|
940
1591
|
id,
|
|
@@ -1123,12 +1774,9 @@ const getDataGridRowsFromSet = (set, rows, rowKeyGetter) => {
|
|
|
1123
1774
|
export {
|
|
1124
1775
|
DataGrid as D,
|
|
1125
1776
|
NumberEditor as N,
|
|
1126
|
-
OriginalDataGridWrapperStyled as O,
|
|
1127
1777
|
TextEditor as T,
|
|
1128
|
-
|
|
1129
|
-
|
|
1778
|
+
getDataGridRowsFromSet as a,
|
|
1779
|
+
columnDateFormatter as b,
|
|
1130
1780
|
columnBooleanFormatter as c,
|
|
1131
|
-
|
|
1132
|
-
getDataGridComponentsDictionary as g,
|
|
1133
|
-
useDataGrid as u
|
|
1781
|
+
getDataGridComponentsDictionary as g
|
|
1134
1782
|
};
|