@m4l/components 0.0.46 → 0.0.49
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.js +1 -1
- package/dist/components/CommonActions/components/ActionCancel/index.d.ts +3 -0
- package/dist/components/CommonActions/components/ActionCancel/index.js +15 -0
- package/dist/components/CommonActions/components/ActionFormCancel/index.d.ts +3 -0
- package/dist/components/CommonActions/components/ActionFormCancel/index.js +62 -0
- package/dist/components/CommonActions/components/ActionFormCancel/types.d.ts +6 -0
- package/dist/components/CommonActions/components/ActionFormIntro/index.d.ts +3 -0
- package/dist/components/CommonActions/components/ActionFormIntro/index.js +35 -0
- package/dist/components/CommonActions/components/ActionIntro/index.d.ts +3 -0
- package/dist/components/CommonActions/components/ActionIntro/index.js +16 -0
- package/dist/components/CommonActions/components/Actions/index.d.ts +3 -0
- package/dist/components/CommonActions/components/Actions/index.js +857 -0
- package/dist/components/CommonActions/components/Actions/styles.d.ts +2 -0
- package/dist/components/CommonActions/components/Actions/types.d.ts +4 -0
- package/dist/components/{FormActions → CommonActions}/dictionary.d.ts +1 -1
- package/dist/components/CommonActions/index.d.ts +6 -0
- package/dist/components/DataGrid/index.js +8 -648
- package/dist/components/DynamicFilter/components/fieldstypes/DateTimeFilter/index.d.ts +2 -1
- package/dist/components/DynamicFilter/components/fieldstypes/factory.d.ts +2 -1
- package/dist/components/DynamicFilter/index.js +23 -23
- package/dist/components/Icon/index.js +14 -12
- package/dist/components/ModalDialog/components/Header/types.d.ts +2 -2
- package/dist/components/ModalDialog/index.js +20 -20
- package/dist/components/ModalDialog/types.d.ts +2 -2
- package/dist/components/ObjectLogs/index.js +0 -3
- package/dist/components/SplitLayout/index.js +0 -1
- package/dist/components/formatters/DateFormatter/index.js +10 -8
- package/dist/components/hook-form/FormProvider/index.js +8 -124
- package/dist/components/hook-form/FormProvider/types.d.ts +0 -2
- package/dist/components/hook-form/RHFTextField/index.d.ts +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/mui_extended/Button/index.d.ts +3 -0
- package/dist/components/mui_extended/Button/styles.d.ts +12 -0
- package/dist/components/mui_extended/Button/types.d.ts +2 -0
- package/dist/components/mui_extended/IconButton/index.d.ts +0 -1
- package/dist/components/mui_extended/IconButton/index.js +23 -16
- package/dist/components/mui_extended/Pager/index.js +1 -66
- package/dist/contexts/ModalContext/components/ContentConfirm/types.d.ts +3 -3
- package/dist/contexts/ModalContext/index.js +12 -9
- package/dist/contexts/ModalContext/types.d.ts +5 -6
- package/dist/index.js +8 -5
- package/dist/react-lazy-load-image-component.js +197 -173
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/types.d.ts +1 -0
- package/dist/vendor.js +55 -34
- package/package.json +4 -5
- package/dist/components/FormActions/index.d.ts +0 -3
- package/dist/components/FormActions/index.js +0 -51
- package/dist/components/FormActions/styles.d.ts +0 -2
- package/dist/components/FormActions/types.d.ts +0 -7
- package/dist/components/hook-form/FormProvider/components/FormActions/index.d.ts +0 -3
- package/dist/components/hook-form/FormProvider/components/FormActions/skeleton.d.ts +0 -2
- package/dist/components/hook-form/FormProvider/components/FormActions/styles.d.ts +0 -3
- package/dist/components/hook-form/FormProvider/components/FormActions/types.d.ts +0 -4
- package/dist/components/mui_extended/MenuActions/index.js +0 -111
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { styled, alpha } from "@mui/material/styles";
|
|
2
|
-
import { forwardRef, useRef, useLayoutEffect, createContext, useState, useContext, useEffect, useMemo, useCallback
|
|
2
|
+
import { forwardRef, useRef, useLayoutEffect, createContext, useState, useContext, useEffect, useMemo, useCallback } from "react";
|
|
3
3
|
import { S as SELECT_COLUMN_KEY, a as SelectCellFormatter, u as useRowSelection, H as HeaderRenderer, D as DataGrid$1 } from "../../react-data-grid.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
|
|
8
|
-
import { voidFunction, useModuleDictionary
|
|
9
|
-
import {
|
|
10
|
-
import { P as Pager, g as getPagerComponentsDictionary, d as defaultPagerDictionary } from "../mui_extended/Pager/index.js";
|
|
11
|
-
import { I as IconButton } from "../mui_extended/IconButton/index.js";
|
|
12
|
-
import { u as useModal } from "../../hooks/useModal/index.js";
|
|
13
|
-
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { voidFunction, useModuleDictionary } from "@m4l/core";
|
|
9
|
+
import { A as ActionsColumn, a as Actions } from "../CommonActions/components/Actions/index.js";
|
|
14
10
|
import { g as getModalDialogComponentsDictionary, d as defaultModalDialogDictionary } from "../ModalDialog/index.js";
|
|
15
|
-
|
|
11
|
+
import { g as getPagerComponentsDictionary, d as defaultPagerDictionary } from "../mui_extended/Pager/index.js";
|
|
12
|
+
const WrapperGrid = styled("div")(() => ({
|
|
16
13
|
display: "flex",
|
|
17
14
|
flexDirection: "column",
|
|
18
15
|
position: "absolute",
|
|
@@ -642,41 +639,6 @@ function BaseProvider(props) {
|
|
|
642
639
|
});
|
|
643
640
|
}
|
|
644
641
|
const useBase = () => useContext(BaseContext);
|
|
645
|
-
const ACTIONS_COLUMN_KEY = "actions-row";
|
|
646
|
-
function ActionsFormatter(props) {
|
|
647
|
-
const {
|
|
648
|
-
rowActionsGetter
|
|
649
|
-
} = useBase();
|
|
650
|
-
if (rowActionsGetter === void 0) {
|
|
651
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
652
|
-
}
|
|
653
|
-
return /* @__PURE__ */ jsx(MenuActions, {
|
|
654
|
-
arrow: "top-left",
|
|
655
|
-
objItem: props.row,
|
|
656
|
-
menuActions: rowActionsGetter,
|
|
657
|
-
marginTop: 1,
|
|
658
|
-
marginLeft: "-11px",
|
|
659
|
-
anchorOrigin: {
|
|
660
|
-
vertical: "bottom",
|
|
661
|
-
horizontal: "left"
|
|
662
|
-
},
|
|
663
|
-
transformOrigin: {
|
|
664
|
-
vertical: "top",
|
|
665
|
-
horizontal: "left"
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
const ActionsColumn = {
|
|
670
|
-
key: ACTIONS_COLUMN_KEY,
|
|
671
|
-
name: "Actions",
|
|
672
|
-
width: 60,
|
|
673
|
-
withFilter: false,
|
|
674
|
-
resizable: true,
|
|
675
|
-
sortable: false,
|
|
676
|
-
frozen: true,
|
|
677
|
-
type: "custom",
|
|
678
|
-
formatter: ActionsFormatter
|
|
679
|
-
};
|
|
680
642
|
const WrapperSkeleton = styled("div")(() => ({
|
|
681
643
|
display: "flex",
|
|
682
644
|
width: "100%",
|
|
@@ -948,608 +910,6 @@ function Table(props) {
|
|
|
948
910
|
})
|
|
949
911
|
});
|
|
950
912
|
}
|
|
951
|
-
const SKTWrapperFilter = styled("div")(({
|
|
952
|
-
theme
|
|
953
|
-
}) => ({
|
|
954
|
-
display: "flex",
|
|
955
|
-
justifyContent: "center",
|
|
956
|
-
alignItems: "center",
|
|
957
|
-
minWidth: theme.spacing(3.75),
|
|
958
|
-
height: theme.spacing(3.75)
|
|
959
|
-
}));
|
|
960
|
-
function Filter() {
|
|
961
|
-
const {
|
|
962
|
-
isSkeleton
|
|
963
|
-
} = useBase();
|
|
964
|
-
const {
|
|
965
|
-
activeFilters,
|
|
966
|
-
setActiveFilters
|
|
967
|
-
} = useFilters();
|
|
968
|
-
const {
|
|
969
|
-
host_static_assets,
|
|
970
|
-
environment_assets
|
|
971
|
-
} = useEnvironment();
|
|
972
|
-
const toggleIcon = () => {
|
|
973
|
-
setActiveFilters(!activeFilters);
|
|
974
|
-
};
|
|
975
|
-
if (isSkeleton) {
|
|
976
|
-
return /* @__PURE__ */ jsx(SKTWrapperFilter, {
|
|
977
|
-
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
978
|
-
variant: "circular",
|
|
979
|
-
width: 20,
|
|
980
|
-
height: 20
|
|
981
|
-
})
|
|
982
|
-
});
|
|
983
|
-
}
|
|
984
|
-
return /* @__PURE__ */ jsx(IconButton, {
|
|
985
|
-
dictionaryTooltip: activeFilters ? "grid.filter_hide" : "grid.filter_show",
|
|
986
|
-
onClick: toggleIcon,
|
|
987
|
-
"aria-label": "filter",
|
|
988
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/filter.svg`
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
const WrapperColumnsConfig = styled("div")(({ theme }) => ({
|
|
992
|
-
color: theme.palette.text.primary,
|
|
993
|
-
position: "relative",
|
|
994
|
-
display: "flex",
|
|
995
|
-
flexDirection: "column",
|
|
996
|
-
height: "100%",
|
|
997
|
-
width: "100%"
|
|
998
|
-
}));
|
|
999
|
-
styled("div")(({ theme }) => ({
|
|
1000
|
-
color: theme.palette.text.primary,
|
|
1001
|
-
fontSize: theme.typography.h4.fontSize
|
|
1002
|
-
}));
|
|
1003
|
-
const DivSelColumns = styled("div")(({ theme }) => ({
|
|
1004
|
-
...theme.typography.subtitle2,
|
|
1005
|
-
color: theme.palette.text.primary,
|
|
1006
|
-
padding: `${theme.spacing(3)} ${theme.spacing(1)}`
|
|
1007
|
-
}));
|
|
1008
|
-
const WrapperGrid = styled("div")(() => ({
|
|
1009
|
-
position: "relative",
|
|
1010
|
-
display: "flex",
|
|
1011
|
-
flexDirection: "column",
|
|
1012
|
-
flexGrow: 1
|
|
1013
|
-
}));
|
|
1014
|
-
styled("div")(() => ({
|
|
1015
|
-
display: "flex",
|
|
1016
|
-
flexDirection: "row"
|
|
1017
|
-
}));
|
|
1018
|
-
const ColumnActions = styled("div")(({ theme }) => ({
|
|
1019
|
-
paddingTop: theme.spacing(3),
|
|
1020
|
-
display: "flex",
|
|
1021
|
-
flexDirection: "row"
|
|
1022
|
-
}));
|
|
1023
|
-
styled("div")(({ theme }) => ({
|
|
1024
|
-
paddingTop: theme.spacing(3),
|
|
1025
|
-
display: "flex",
|
|
1026
|
-
flexDirection: "row",
|
|
1027
|
-
justifyContent: "flex-end",
|
|
1028
|
-
"& > button": {
|
|
1029
|
-
marginLeft: "10px"
|
|
1030
|
-
}
|
|
1031
|
-
}));
|
|
1032
|
-
function FormatterColumn({
|
|
1033
|
-
row,
|
|
1034
|
-
onRowChange,
|
|
1035
|
-
column
|
|
1036
|
-
}) {
|
|
1037
|
-
const handleChange = () => {
|
|
1038
|
-
const newRow = {
|
|
1039
|
-
...row
|
|
1040
|
-
};
|
|
1041
|
-
newRow[column.key] = !row[column.key];
|
|
1042
|
-
onRowChange(newRow);
|
|
1043
|
-
};
|
|
1044
|
-
return /* @__PURE__ */ jsx(Checkbox, {
|
|
1045
|
-
size: "small",
|
|
1046
|
-
checked: row[column.key],
|
|
1047
|
-
onChange: handleChange
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
function getRowsFromColumnsConfig(columnsConfig) {
|
|
1051
|
-
return columnsConfig.filter((column) => !column.hidden).map((column) => ({
|
|
1052
|
-
key: column.key,
|
|
1053
|
-
name: column.name,
|
|
1054
|
-
visible: column.visible === void 0 ? true : column.visible,
|
|
1055
|
-
frozen: column.frozen === void 0 ? false : column.frozen,
|
|
1056
|
-
originalIndex: column.orginalIndex,
|
|
1057
|
-
originalFrozen: column.originalFrozen,
|
|
1058
|
-
originalVisible: column.originalVisible
|
|
1059
|
-
}));
|
|
1060
|
-
}
|
|
1061
|
-
const ColumnsConfig = forwardRef((props, ref) => {
|
|
1062
|
-
const refGrid = useRef(null);
|
|
1063
|
-
const {
|
|
1064
|
-
onCloseSettings,
|
|
1065
|
-
columnsConfig,
|
|
1066
|
-
onChangeColumnsConfig
|
|
1067
|
-
} = props;
|
|
1068
|
-
const {
|
|
1069
|
-
getLabel
|
|
1070
|
-
} = useModuleDictionary();
|
|
1071
|
-
const [isInit, setIsInit] = useState(true);
|
|
1072
|
-
const [rows, setRows] = useState(getRowsFromColumnsConfig(columnsConfig));
|
|
1073
|
-
const [selRows, setSelRows] = useState(() => /* @__PURE__ */ new Set());
|
|
1074
|
-
const divRef = useRef(null);
|
|
1075
|
-
const {
|
|
1076
|
-
host_static_assets,
|
|
1077
|
-
environment_assets
|
|
1078
|
-
} = useEnvironment();
|
|
1079
|
-
useImperativeHandle(ref, () => ({
|
|
1080
|
-
onClickIntro: handleIntro,
|
|
1081
|
-
current: divRef.current
|
|
1082
|
-
}));
|
|
1083
|
-
const columnsGrid = useMemo(() => [{
|
|
1084
|
-
key: "name",
|
|
1085
|
-
name: getLabel("grid.settings_column_name"),
|
|
1086
|
-
width: 200,
|
|
1087
|
-
resizable: true,
|
|
1088
|
-
type: "text"
|
|
1089
|
-
}, {
|
|
1090
|
-
key: "originalIndex",
|
|
1091
|
-
name: getLabel("grid.settings_column_position"),
|
|
1092
|
-
width: 50,
|
|
1093
|
-
type: "number",
|
|
1094
|
-
cellClass: "rdg-cell-align-center"
|
|
1095
|
-
}, {
|
|
1096
|
-
key: "visible",
|
|
1097
|
-
name: getLabel("grid.settings_column_visible"),
|
|
1098
|
-
width: 80,
|
|
1099
|
-
type: "boolean",
|
|
1100
|
-
formatter: FormatterColumn,
|
|
1101
|
-
cellClass: "rdg-cell-align-center"
|
|
1102
|
-
}, {
|
|
1103
|
-
key: "frozen",
|
|
1104
|
-
name: getLabel("grid.settings_column_frozen"),
|
|
1105
|
-
width: 80,
|
|
1106
|
-
type: "boolean",
|
|
1107
|
-
formatter: FormatterColumn,
|
|
1108
|
-
cellClass: "rdg-cell-align-center"
|
|
1109
|
-
}], [getLabel]);
|
|
1110
|
-
const checkAll = () => {
|
|
1111
|
-
setRows(rows.map((row) => ({
|
|
1112
|
-
...row,
|
|
1113
|
-
visible: true
|
|
1114
|
-
})));
|
|
1115
|
-
};
|
|
1116
|
-
const unCheckAll = () => {
|
|
1117
|
-
setRows(rows.map((row) => ({
|
|
1118
|
-
...row,
|
|
1119
|
-
visible: false
|
|
1120
|
-
})));
|
|
1121
|
-
};
|
|
1122
|
-
const restoreAll = () => {
|
|
1123
|
-
setRows(rows.map((row) => ({
|
|
1124
|
-
...row,
|
|
1125
|
-
visible: row.originalVisible,
|
|
1126
|
-
frozen: row.originalFrozen,
|
|
1127
|
-
index: row.originalIndex
|
|
1128
|
-
})).sort((a, b) => a.index - b.index));
|
|
1129
|
-
};
|
|
1130
|
-
useEffect(() => {
|
|
1131
|
-
if (isInit === false) {
|
|
1132
|
-
setRows(getRowsFromColumnsConfig(columnsConfig));
|
|
1133
|
-
}
|
|
1134
|
-
setIsInit(false);
|
|
1135
|
-
}, [columnsConfig]);
|
|
1136
|
-
const rowSelectedIndex = useMemo(() => {
|
|
1137
|
-
let rowIndex = -1;
|
|
1138
|
-
if (selRows.size !== 1)
|
|
1139
|
-
return rowIndex;
|
|
1140
|
-
const iterator = selRows.entries();
|
|
1141
|
-
const entry = iterator.next().value[1];
|
|
1142
|
-
rowIndex = rows.findIndex((row) => row.key === entry);
|
|
1143
|
-
return rowIndex;
|
|
1144
|
-
}, [rows, selRows]);
|
|
1145
|
-
const handleMoveFirst = () => {
|
|
1146
|
-
if (rowSelectedIndex === -1)
|
|
1147
|
-
return -1;
|
|
1148
|
-
const newRows = [...rows];
|
|
1149
|
-
newRows.splice(rowSelectedIndex, 1);
|
|
1150
|
-
newRows.splice(0, 0, rows[rowSelectedIndex]);
|
|
1151
|
-
refGrid.current?.selectCell({
|
|
1152
|
-
idx: 0,
|
|
1153
|
-
rowIdx: 0
|
|
1154
|
-
});
|
|
1155
|
-
setRows(newRows);
|
|
1156
|
-
};
|
|
1157
|
-
const handleMoveLast = () => {
|
|
1158
|
-
if (rowSelectedIndex === -1)
|
|
1159
|
-
return -1;
|
|
1160
|
-
const newRows = [...rows];
|
|
1161
|
-
newRows.splice(rowSelectedIndex, 1);
|
|
1162
|
-
newRows.splice(newRows.length, 0, rows[rowSelectedIndex]);
|
|
1163
|
-
refGrid.current?.selectCell({
|
|
1164
|
-
idx: 0,
|
|
1165
|
-
rowIdx: newRows.length - 1
|
|
1166
|
-
});
|
|
1167
|
-
setRows(newRows);
|
|
1168
|
-
};
|
|
1169
|
-
const handleMoveUpDownd = (position) => {
|
|
1170
|
-
if (rowSelectedIndex === -1)
|
|
1171
|
-
return -1;
|
|
1172
|
-
const newRows = [...rows];
|
|
1173
|
-
const element = newRows[rowSelectedIndex];
|
|
1174
|
-
newRows.splice(rowSelectedIndex, 1);
|
|
1175
|
-
newRows.splice(rowSelectedIndex + position, 0, element);
|
|
1176
|
-
refGrid.current?.selectCell({
|
|
1177
|
-
idx: 0,
|
|
1178
|
-
rowIdx: rowSelectedIndex + position
|
|
1179
|
-
});
|
|
1180
|
-
setRows(newRows);
|
|
1181
|
-
};
|
|
1182
|
-
const getColumnConfigByKey2 = (key) => {
|
|
1183
|
-
const rowIndexFinded = rows.findIndex((row) => row.key === key);
|
|
1184
|
-
if (rowIndexFinded > -1) {
|
|
1185
|
-
return {
|
|
1186
|
-
visible: rows[rowIndexFinded].visible,
|
|
1187
|
-
frozen: rows[rowIndexFinded].frozen
|
|
1188
|
-
};
|
|
1189
|
-
}
|
|
1190
|
-
return void 0;
|
|
1191
|
-
};
|
|
1192
|
-
const getRowIndex = (column) => {
|
|
1193
|
-
const rowIndexFinded = rows.findIndex((row) => row.key === column.key);
|
|
1194
|
-
if (rowIndexFinded > -1) {
|
|
1195
|
-
return rowIndexFinded;
|
|
1196
|
-
}
|
|
1197
|
-
return columnsConfig.findIndex((columnConfig) => columnConfig.key === column.key);
|
|
1198
|
-
};
|
|
1199
|
-
const handleIntro = () => {
|
|
1200
|
-
const newColumnsConfig = columnsConfig.map((columnConfig) => {
|
|
1201
|
-
const newColumnConfig = {
|
|
1202
|
-
...columnConfig
|
|
1203
|
-
};
|
|
1204
|
-
if (!columnConfig.hidden) {
|
|
1205
|
-
const columnConfigRow = getColumnConfigByKey2(columnConfig.key);
|
|
1206
|
-
if (columnConfigRow) {
|
|
1207
|
-
newColumnConfig.visible = columnConfigRow.visible;
|
|
1208
|
-
newColumnConfig.frozen = columnConfigRow.frozen;
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
return newColumnConfig;
|
|
1212
|
-
}).sort((a, b) => getRowIndex(a) - getRowIndex(b));
|
|
1213
|
-
onChangeColumnsConfig(newColumnsConfig);
|
|
1214
|
-
onCloseSettings();
|
|
1215
|
-
};
|
|
1216
|
-
const onInternalSelectedRowsChange = () => {
|
|
1217
|
-
};
|
|
1218
|
-
const onInternalRowsChange = (newRows) => {
|
|
1219
|
-
setRows(newRows);
|
|
1220
|
-
};
|
|
1221
|
-
const onRowClick = (row) => {
|
|
1222
|
-
if (selRows.has(row.key))
|
|
1223
|
-
return;
|
|
1224
|
-
const mySet = /* @__PURE__ */ new Set([row.key]);
|
|
1225
|
-
setSelRows(mySet);
|
|
1226
|
-
};
|
|
1227
|
-
return /* @__PURE__ */ jsxs(WrapperColumnsConfig, {
|
|
1228
|
-
id: "WrapperColumnsConfig",
|
|
1229
|
-
ref: divRef,
|
|
1230
|
-
children: [/* @__PURE__ */ jsx(DivSelColumns, {
|
|
1231
|
-
id: "divInfo",
|
|
1232
|
-
children: getLabel("grid.settings_sel_columns")
|
|
1233
|
-
}), /* @__PURE__ */ jsx(WrapperGrid, {
|
|
1234
|
-
id: "WrapperGrid",
|
|
1235
|
-
children: /* @__PURE__ */ jsx(OriginalGridWrapperStyled, {
|
|
1236
|
-
id: "OriginalGridWrapperStyled",
|
|
1237
|
-
children: /* @__PURE__ */ jsx(DataGrid$1, {
|
|
1238
|
-
className: "fill-grid rdg-light",
|
|
1239
|
-
ref: refGrid,
|
|
1240
|
-
columns: columnsGrid,
|
|
1241
|
-
rows,
|
|
1242
|
-
onRowsChange: onInternalRowsChange,
|
|
1243
|
-
selectedRows: selRows,
|
|
1244
|
-
onSelectedRowsChange: onInternalSelectedRowsChange,
|
|
1245
|
-
onRowClick,
|
|
1246
|
-
rowKeyGetter: (row) => row.key,
|
|
1247
|
-
cellNavigationMode: "CHANGE_ROW",
|
|
1248
|
-
defaultColumnOptions: {
|
|
1249
|
-
resizable: true,
|
|
1250
|
-
sortable: true
|
|
1251
|
-
}
|
|
1252
|
-
})
|
|
1253
|
-
})
|
|
1254
|
-
}), /* @__PURE__ */ jsxs(ColumnActions, {
|
|
1255
|
-
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
1256
|
-
dictionaryTooltip: "grid.settings_move_first",
|
|
1257
|
-
onClick: handleMoveFirst,
|
|
1258
|
-
"aria-label": "move first place",
|
|
1259
|
-
disabled: rowSelectedIndex < 1,
|
|
1260
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/move_first_place.svg`
|
|
1261
|
-
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1262
|
-
dictionaryTooltip: "grid.settings_move_up",
|
|
1263
|
-
onClick: () => handleMoveUpDownd(-1),
|
|
1264
|
-
"aria-label": "move up place",
|
|
1265
|
-
disabled: rowSelectedIndex < 1,
|
|
1266
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/move_up_place.svg`
|
|
1267
|
-
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1268
|
-
dictionaryTooltip: "grid.settings_move_last",
|
|
1269
|
-
onClick: handleMoveLast,
|
|
1270
|
-
"aria-label": "move last place",
|
|
1271
|
-
disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
|
|
1272
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/move_last_place.svg`
|
|
1273
|
-
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1274
|
-
dictionaryTooltip: "grid.settings_move_down",
|
|
1275
|
-
onClick: () => handleMoveUpDownd(1),
|
|
1276
|
-
"aria-label": "move down place",
|
|
1277
|
-
disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
|
|
1278
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/move_down_place.svg`
|
|
1279
|
-
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1280
|
-
dictionaryTooltip: "grid.settings_visible_all",
|
|
1281
|
-
onClick: checkAll,
|
|
1282
|
-
"aria-label": "check visible all",
|
|
1283
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/check_all.svg`
|
|
1284
|
-
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1285
|
-
dictionaryTooltip: "grid.settings_no_visible_all",
|
|
1286
|
-
onClick: unCheckAll,
|
|
1287
|
-
"aria-label": "un check all",
|
|
1288
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/uncheck_all.svg`
|
|
1289
|
-
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1290
|
-
dictionaryTooltip: "grid.settings_restore",
|
|
1291
|
-
onClick: restoreAll,
|
|
1292
|
-
"aria-label": "Restore columns",
|
|
1293
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/restore_columns.svg`
|
|
1294
|
-
})]
|
|
1295
|
-
})]
|
|
1296
|
-
});
|
|
1297
|
-
});
|
|
1298
|
-
ColumnsConfig.displayName = "ColumnsConfig";
|
|
1299
|
-
const SKTWrapperColumnsSettings = styled("div")(({ theme }) => ({
|
|
1300
|
-
display: "flex",
|
|
1301
|
-
justifyContent: "center",
|
|
1302
|
-
alignItems: "center",
|
|
1303
|
-
minWidth: theme.spacing(3.75),
|
|
1304
|
-
height: theme.spacing(3.75)
|
|
1305
|
-
}));
|
|
1306
|
-
function Settings() {
|
|
1307
|
-
const {
|
|
1308
|
-
openModal,
|
|
1309
|
-
closeModal
|
|
1310
|
-
} = useModal();
|
|
1311
|
-
const {
|
|
1312
|
-
columnsConfig,
|
|
1313
|
-
onChangeColumnsConfig,
|
|
1314
|
-
isSkeleton
|
|
1315
|
-
} = useBase();
|
|
1316
|
-
const {
|
|
1317
|
-
getLabel
|
|
1318
|
-
} = useModuleDictionary();
|
|
1319
|
-
const {
|
|
1320
|
-
host_static_assets,
|
|
1321
|
-
environment_assets
|
|
1322
|
-
} = useEnvironment();
|
|
1323
|
-
const ref = useRef(null);
|
|
1324
|
-
const onCloseSettings = useCallback(() => {
|
|
1325
|
-
closeModal();
|
|
1326
|
-
}, [closeModal]);
|
|
1327
|
-
const onClickIntro = useCallback(() => {
|
|
1328
|
-
if (ref.current?.onClickIntro) {
|
|
1329
|
-
ref.current?.onClickIntro();
|
|
1330
|
-
}
|
|
1331
|
-
}, []);
|
|
1332
|
-
const onClickSettings = useCallback(() => {
|
|
1333
|
-
openModal({
|
|
1334
|
-
onQueryClose: () => closeModal(),
|
|
1335
|
-
title: "grid.settings_tooltip",
|
|
1336
|
-
initialWidth: 500,
|
|
1337
|
-
initialHeigth: 680,
|
|
1338
|
-
contentComponent: /* @__PURE__ */ jsx(ColumnsConfig, {
|
|
1339
|
-
ref,
|
|
1340
|
-
columnsConfig,
|
|
1341
|
-
onChangeColumnsConfig,
|
|
1342
|
-
onCloseSettings
|
|
1343
|
-
}),
|
|
1344
|
-
actionComponents: void 0,
|
|
1345
|
-
standardActions: {
|
|
1346
|
-
withCancel: true,
|
|
1347
|
-
onClickIntro
|
|
1348
|
-
}
|
|
1349
|
-
});
|
|
1350
|
-
}, [closeModal, columnsConfig, getLabel, onChangeColumnsConfig, onCloseSettings, openModal, onClickIntro]);
|
|
1351
|
-
if (isSkeleton) {
|
|
1352
|
-
return /* @__PURE__ */ jsx(SKTWrapperColumnsSettings, {
|
|
1353
|
-
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1354
|
-
variant: "circular",
|
|
1355
|
-
width: 20,
|
|
1356
|
-
height: 20
|
|
1357
|
-
})
|
|
1358
|
-
});
|
|
1359
|
-
}
|
|
1360
|
-
return /* @__PURE__ */ jsx(IconButton, {
|
|
1361
|
-
dictionaryTooltip: "grid.settings_tooltip",
|
|
1362
|
-
onClick: onClickSettings,
|
|
1363
|
-
"aria-label": "settings",
|
|
1364
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/configuration.svg`
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
|
-
const Container = styled("div")(() => ({
|
|
1368
|
-
display: "flex",
|
|
1369
|
-
alignItems: "center"
|
|
1370
|
-
}));
|
|
1371
|
-
const RowsLabel = styled("span")(() => ({}));
|
|
1372
|
-
const InsetLabel = styled("span")(({ theme }) => ({
|
|
1373
|
-
marginLeft: theme.spacing(2),
|
|
1374
|
-
paddingTop: "2px",
|
|
1375
|
-
paddingBottom: "2px",
|
|
1376
|
-
paddingLeft: "4px",
|
|
1377
|
-
paddingRight: "4px",
|
|
1378
|
-
border: `1px solid ${theme.palette.divider}`
|
|
1379
|
-
}));
|
|
1380
|
-
function RowsCount() {
|
|
1381
|
-
const {
|
|
1382
|
-
rowsCount,
|
|
1383
|
-
isSkeleton
|
|
1384
|
-
} = useBase();
|
|
1385
|
-
const {
|
|
1386
|
-
getLabel
|
|
1387
|
-
} = useModuleDictionary();
|
|
1388
|
-
if (isSkeleton) {
|
|
1389
|
-
return /* @__PURE__ */ jsxs(Container, {
|
|
1390
|
-
children: [/* @__PURE__ */ jsx(RowsLabel, {
|
|
1391
|
-
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1392
|
-
variant: "text",
|
|
1393
|
-
width: "40px",
|
|
1394
|
-
height: "16px"
|
|
1395
|
-
})
|
|
1396
|
-
}), /* @__PURE__ */ jsx(InsetLabel, {
|
|
1397
|
-
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1398
|
-
variant: "text",
|
|
1399
|
-
width: "20px",
|
|
1400
|
-
height: "16px"
|
|
1401
|
-
})
|
|
1402
|
-
})]
|
|
1403
|
-
});
|
|
1404
|
-
}
|
|
1405
|
-
return /* @__PURE__ */ jsxs(Container, {
|
|
1406
|
-
className: "rows-count",
|
|
1407
|
-
id: "RowsCount",
|
|
1408
|
-
children: [/* @__PURE__ */ jsx(RowsLabel, {
|
|
1409
|
-
children: getLabel("grid.rows")
|
|
1410
|
-
}), /* @__PURE__ */ jsx(InsetLabel, {
|
|
1411
|
-
children: rowsCount
|
|
1412
|
-
})]
|
|
1413
|
-
});
|
|
1414
|
-
}
|
|
1415
|
-
const WrapperDensity = styled("div")(({ theme }) => ({
|
|
1416
|
-
marginLeft: 0,
|
|
1417
|
-
[theme.breakpoints.up("sm")]: {
|
|
1418
|
-
marginLeft: theme.spacing(3)
|
|
1419
|
-
}
|
|
1420
|
-
}));
|
|
1421
|
-
const SKTWrapperDensity = styled("div")(({ theme }) => ({
|
|
1422
|
-
display: "flex",
|
|
1423
|
-
justifyContent: "center",
|
|
1424
|
-
alignItems: "center",
|
|
1425
|
-
minWidth: theme.spacing(3.75),
|
|
1426
|
-
height: theme.spacing(3.75)
|
|
1427
|
-
}));
|
|
1428
|
-
function Density() {
|
|
1429
|
-
const {
|
|
1430
|
-
host_static_assets,
|
|
1431
|
-
environment_assets
|
|
1432
|
-
} = useEnvironment();
|
|
1433
|
-
const {
|
|
1434
|
-
rowHeights,
|
|
1435
|
-
currentRowHeightVariant,
|
|
1436
|
-
setRowHeightVariant,
|
|
1437
|
-
isSkeleton
|
|
1438
|
-
} = useBase();
|
|
1439
|
-
const {
|
|
1440
|
-
getLabel
|
|
1441
|
-
} = useModuleDictionary();
|
|
1442
|
-
const menuActions = useMemo(() => {
|
|
1443
|
-
if (typeof rowHeights === "number") {
|
|
1444
|
-
return [];
|
|
1445
|
-
}
|
|
1446
|
-
return [{
|
|
1447
|
-
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/compact.svg`,
|
|
1448
|
-
onClick: () => setRowHeightVariant("compact"),
|
|
1449
|
-
disabled: currentRowHeightVariant === "compact",
|
|
1450
|
-
dictionaryField: "grid.density_compact"
|
|
1451
|
-
}, {
|
|
1452
|
-
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/standard.svg`,
|
|
1453
|
-
onClick: () => setRowHeightVariant("standard"),
|
|
1454
|
-
disabled: currentRowHeightVariant === "standard",
|
|
1455
|
-
dictionaryField: "grid.density_standard"
|
|
1456
|
-
}, {
|
|
1457
|
-
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/confortable.svg`,
|
|
1458
|
-
onClick: () => setRowHeightVariant("confortable"),
|
|
1459
|
-
disabled: currentRowHeightVariant === "confortable",
|
|
1460
|
-
dictionaryField: "grid.density_confortable"
|
|
1461
|
-
}];
|
|
1462
|
-
}, [rowHeights, currentRowHeightVariant, setRowHeightVariant, host_static_assets, environment_assets]);
|
|
1463
|
-
const currenViewIcon = useMemo(() => {
|
|
1464
|
-
if (currentRowHeightVariant === "compact") {
|
|
1465
|
-
return `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/compact.svg`;
|
|
1466
|
-
}
|
|
1467
|
-
if (currentRowHeightVariant === "standard") {
|
|
1468
|
-
return `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/standard.svg`;
|
|
1469
|
-
}
|
|
1470
|
-
return `${host_static_assets}/${environment_assets}/frontend/components/grid/assets/icons/confortable.svg`;
|
|
1471
|
-
}, [currentRowHeightVariant, host_static_assets, environment_assets]);
|
|
1472
|
-
if (menuActions.length === 0) {
|
|
1473
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
1474
|
-
}
|
|
1475
|
-
if (isSkeleton) {
|
|
1476
|
-
return /* @__PURE__ */ jsx(SKTWrapperDensity, {
|
|
1477
|
-
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1478
|
-
variant: "circular",
|
|
1479
|
-
width: "20px",
|
|
1480
|
-
height: "20px"
|
|
1481
|
-
})
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1484
|
-
return /* @__PURE__ */ jsx(WrapperDensity, {
|
|
1485
|
-
id: "WrapperDensity",
|
|
1486
|
-
children: /* @__PURE__ */ jsx(MenuActions, {
|
|
1487
|
-
arrow: "right-top",
|
|
1488
|
-
anchorOrigin: {
|
|
1489
|
-
vertical: "top",
|
|
1490
|
-
horizontal: "left"
|
|
1491
|
-
},
|
|
1492
|
-
transformOrigin: {
|
|
1493
|
-
vertical: "top",
|
|
1494
|
-
horizontal: "right"
|
|
1495
|
-
},
|
|
1496
|
-
menuActions,
|
|
1497
|
-
urlIcon: currenViewIcon,
|
|
1498
|
-
toolTip: getLabel("grid.density_tooltip")
|
|
1499
|
-
})
|
|
1500
|
-
});
|
|
1501
|
-
}
|
|
1502
|
-
const WrapperActions = styled("div")(({ theme }) => ({
|
|
1503
|
-
...theme.typography.caption,
|
|
1504
|
-
position: "absolute",
|
|
1505
|
-
left: "0px",
|
|
1506
|
-
right: "0px",
|
|
1507
|
-
top: "0px",
|
|
1508
|
-
height: theme.spacing(5.5),
|
|
1509
|
-
padding: 0,
|
|
1510
|
-
display: "flex",
|
|
1511
|
-
flexDirection: "row",
|
|
1512
|
-
alignItems: "center",
|
|
1513
|
-
justifyContent: "flex-end",
|
|
1514
|
-
[theme.breakpoints.up("sm")]: {
|
|
1515
|
-
padding: theme.spacing(0, 1.5)
|
|
1516
|
-
},
|
|
1517
|
-
"&.with-no-pager .rows-count": {
|
|
1518
|
-
flexGrow: 1
|
|
1519
|
-
},
|
|
1520
|
-
"& .MuiTablePagination-root": {
|
|
1521
|
-
flexGrow: 1,
|
|
1522
|
-
display: "flex",
|
|
1523
|
-
justifyContent: "center",
|
|
1524
|
-
overflow: "hidden"
|
|
1525
|
-
}
|
|
1526
|
-
}));
|
|
1527
|
-
function Actions(props) {
|
|
1528
|
-
const isDesktop = useResponsiveDesktop();
|
|
1529
|
-
const {
|
|
1530
|
-
rowHeights,
|
|
1531
|
-
isSkeleton
|
|
1532
|
-
} = useBase();
|
|
1533
|
-
const {
|
|
1534
|
-
withRowsCount = true,
|
|
1535
|
-
withPager = true,
|
|
1536
|
-
pagerOptions,
|
|
1537
|
-
withSettings = true,
|
|
1538
|
-
settingsProps,
|
|
1539
|
-
withLocalFilters
|
|
1540
|
-
} = props;
|
|
1541
|
-
return /* @__PURE__ */ jsxs(WrapperActions, {
|
|
1542
|
-
id: "WrapperActions",
|
|
1543
|
-
className: withPager && pagerOptions ? "with-pager" : "with-no-pager",
|
|
1544
|
-
children: [withRowsCount && isDesktop && /* @__PURE__ */ jsx(RowsCount, {}), withPager && pagerOptions && /* @__PURE__ */ jsx(Pager, {
|
|
1545
|
-
...pagerOptions,
|
|
1546
|
-
totalRecords: pagerOptions.totalRecords,
|
|
1547
|
-
isSkeleton
|
|
1548
|
-
}), typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}), withLocalFilters && /* @__PURE__ */ jsx(Filter, {}), withSettings && /* @__PURE__ */ jsx(Settings, {
|
|
1549
|
-
...settingsProps
|
|
1550
|
-
})]
|
|
1551
|
-
});
|
|
1552
|
-
}
|
|
1553
913
|
function DataGrid(props) {
|
|
1554
914
|
const {
|
|
1555
915
|
isSkeleton = false,
|
|
@@ -1562,7 +922,7 @@ function DataGrid(props) {
|
|
|
1562
922
|
rowHeights = [36, 52, 67],
|
|
1563
923
|
initialRowHeightVariant = "compact"
|
|
1564
924
|
} = props;
|
|
1565
|
-
return /* @__PURE__ */ jsx(WrapperGrid
|
|
925
|
+
return /* @__PURE__ */ jsx(WrapperGrid, {
|
|
1566
926
|
id: `WrapperGrid_${props.id}`,
|
|
1567
927
|
children: /* @__PURE__ */ jsx(BaseProvider, {
|
|
1568
928
|
id: props.id,
|
|
@@ -1623,4 +983,4 @@ function getGridComponentsDictionary() {
|
|
|
1623
983
|
...defaultPagerDictionary,
|
|
1624
984
|
...defaultModalDialogDictionary
|
|
1625
985
|
});
|
|
1626
|
-
export { DataGrid as D, getGridComponentsDictionary as g };
|
|
986
|
+
export { DataGrid as D, OriginalGridWrapperStyled as O, useFilters as a, getGridComponentsDictionary as g, useBase as u };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FilterFieldApply, Field } from '../../../types';
|
|
3
|
-
|
|
3
|
+
import type { HostToolsType } from '@m4l/core';
|
|
4
|
+
export declare const getDefaultDateTimeFilter: (field: Field, fixed: boolean, getLabel: (key: string) => string, hostTools: HostToolsType) => FilterFieldApply;
|
|
4
5
|
export declare function DateTimeFilter(): JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { FilterFieldApply, Field } from '../../types';
|
|
3
|
-
|
|
3
|
+
import type { HostToolsType } from '@m4l/core';
|
|
4
|
+
export declare const getDefaultFilterValues: (field: Field, fixed: boolean, getLabel: (key: string) => string, hostTools: HostToolsType) => FilterFieldApply;
|
|
4
5
|
export declare const PopupEditFilterComponent: (props: {
|
|
5
6
|
filter: FilterFieldApply;
|
|
6
7
|
}) => JSX.Element;
|