@m4l/components 1.0.0 → 1.0.2
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/components/AccountPopover/{index.efc74d5c.js → index.ec031003.js} +5 -3
- package/components/AppBar/{index.fc126a22.js → index.1499770b.js} +4 -4
- package/components/DragResizeWindow/{index.46b380e1.js → index.5e316291.js} +3 -3
- package/components/DynamicFilter/{index.d9168c12.js → index.05e15fb8.js} +28 -211
- package/components/FieldLabel/{index.f9cdcc27.js → index.400a46e0.js} +4 -4
- package/components/GridLayout/{index.bb3b7769.js → index.7156fbc9.js} +2 -2
- package/components/GridLayout/subcomponents/Griditem/{index.bb23f651.js → index.8946f18e.js} +4 -4
- package/components/GridLayout/subcomponents/Responsive/{index.b8a2a121.js → index.3c68f0cb.js} +2 -2
- package/components/GridLayout/subcomponents/SizeProvider/{index.094bc6b5.js → index.a5b2190d.js} +1 -1
- package/components/HamburgerMenu/{index.5997af31.js → index.d57bca4c.js} +3 -3
- package/components/HelperText/{index.be949cdf.js → index.651a9b4b.js} +1 -1
- package/components/Icon/index.2e8ec5a1.js +209 -0
- package/components/Image/index.0d32558e.js +168 -0
- package/components/LoadingError/{index.9f00c83c.js → index.d137be81.js} +5 -4
- package/components/MFLoader/{index.402c1acc.js → index.2038aa6c.js} +3 -3
- package/components/ModalDialog/{index.ea9189c3.js → index.85d30f10.js} +4 -4
- package/components/NavLink/{index.4e548cee.js → index.badec599.js} +2 -2
- package/components/NoItemSelected/{index.418c8316.js → index.008154ce.js} +2 -2
- package/components/ObjectLogs/{index.bfa7dad3.js → index.65a6b1bc.js} +8 -7
- package/components/PDFViewer/{index.bb2eca5a.js → index.9677b02a.js} +2 -2
- package/components/Page/index.7482cf60.js +98 -0
- package/components/PaperForm/{index.8121e3da.js → index.e04f9f1f.js} +2 -2
- package/components/Period/{index.5233694b.js → index.3d695534.js} +8 -103
- package/components/PrintingSystem/{index.fb176a93.js → index.89493ad6.js} +15 -14
- package/components/PrintingSystem/subcomponents/BodyNode/{index.c1d61038.js → index.fdd8cebb.js} +1 -1
- package/components/PrintingSystem/subcomponents/ChartNode/{index.18bd9bad.js → index.12293a60.js} +1 -1
- package/components/PrintingSystem/subcomponents/DividerNode/{index.67d9f1b4.js → index.7fdad1df.js} +1 -1
- package/components/PrintingSystem/subcomponents/FooterNode/{index.eaee152a.js → index.fcaf9b2f.js} +1 -1
- package/components/PrintingSystem/subcomponents/GridNode/{index.f5f63a2a.js → index.03148990.js} +1 -1
- package/components/PrintingSystem/subcomponents/HeaderNode/{index.7de4e411.js → index.691b5c38.js} +1 -1
- package/components/PrintingSystem/subcomponents/PaperNode/{index.f9ccf22b.js → index.3699b685.js} +1 -1
- package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.f2f2e903.js → index.bcc87da8.js} +1 -1
- package/components/PrintingSystem/subcomponents/SectionNode/{index.540a4b19.js → index.659f28e5.js} +1 -1
- package/components/PrintingSystem/subcomponents/TextBoxNode/{index.41e7fcb0.js → index.137ebb7a.js} +1 -1
- package/components/PropertyValue/{index.9572c347.js → index.e31d4282.js} +3 -3
- package/components/Resizeable/{index.1f0c1359.js → index.8c72e36a.js} +1 -1
- package/components/ScrollBar/{index.adf0eade.js → index.9bfcc74f.js} +1 -1
- package/components/SideBar/{index.629ba840.js → index.004a2de1.js} +7 -31
- package/components/SplitLayout/{index.74091a81.js → index.aed78a1f.js} +1 -1
- package/components/ToastContainer/{index.f9b507b9.js → index.586b1194.js} +3 -3
- package/components/areas/constants.630a4f42.js +293 -0
- package/components/areas/contexts/AreasContext/{index.bb316000.js → index.81b748ec.js} +4 -4
- package/components/areas/{dictionary.7e74022a.js → dictionary.19b25583.js} +26 -34
- package/components/areas/hooks/useAreas/{index.e24bd74d.js → index.b02d5bdc.js} +1 -1
- package/components/hook-form/HelperError/index.fd10c3ab.js +19 -0
- package/components/hook-form/RHFAutocompleteAsync/index.ea3ba7a7.js +160 -0
- package/components/hook-form/RHFCheckbox/index.9ac452cc.js +143 -0
- package/components/hook-form/RHFColorPicker/index.25e4e643.js +191 -0
- package/components/hook-form/RHFDateTime/index.31a0537d.js +190 -0
- package/components/hook-form/RHFMultiCheckbox/index.437e6ba3.js +34 -0
- package/components/hook-form/RHFPeriod/index.c8868100.js +105 -0
- package/components/hook-form/RHFRadioGroup/index.11c0add8.js +35 -0
- package/components/hook-form/RHFSelect/index.c6c60ecc.js +29 -0
- package/components/hook-form/RHFTextField/index.2ae1f130.js +326 -0
- package/components/{Image/index.36a3d440.js → hook-form/RHFUpload/index.9eeaee0f.js} +32 -232
- package/components/maps/components/GpsTools/index.ef751d28.js +251 -0
- package/components/maps/{index.8ec46ce4.js → index.ba1ccfad.js} +21 -555
- package/components/modal/{WindowBase.a3ac7adc.js → WindowBase.c1e879e4.js} +4 -3
- package/components/modal/{WindowConfirm.e35da619.js → WindowConfirm.1a123368.js} +6 -6
- package/components/modal/{index.a0e30c8b.js → index.7ca17f55.js} +1 -1
- package/components/mui_extended/Accordion/index.391679d1.js +143 -0
- package/components/mui_extended/Avatar/index.3ba36655.js +63 -0
- package/components/mui_extended/Badge/index.3465d7fb.js +31 -0
- package/components/mui_extended/BoxIcon/index.d61e7ac5.js +22 -0
- package/components/mui_extended/Breadcrumbs/index.4a44883c.js +87 -0
- package/components/mui_extended/Button/index.a7dc6ef0.js +289 -0
- package/components/mui_extended/CheckBox/index.c5c8721c.js +76 -0
- package/components/mui_extended/CircularProgress/index.967e70b7.js +8 -0
- package/components/mui_extended/IconButton/index.87f4726c.js +120 -0
- package/components/{LinearProgressIndeterminate/index.de9d447c.js → mui_extended/LinearProgress/index.52edc848.js} +11 -4
- package/components/mui_extended/LinkWithRoute/index.288c51f3.js +15 -0
- package/components/{Page/index.fdf04592.js → mui_extended/Pager/index.46aec921.js} +9 -98
- package/components/mui_extended/Popover/index.8e5ac765.js +1041 -0
- package/components/mui_extended/Stack/index.fe363ca5.js +31 -0
- package/components/{maps/components/GpsTools/index.75880ce0.js → mui_extended/Tab/index.ad88441e.js} +674 -239
- package/components/mui_extended/ToggleButton/index.38ca2330.js +18 -0
- package/components/mui_extended/ToggleIconButton/index.7fbece74.js +24 -0
- package/components/mui_extended/Tooltip/index.49bb5ee1.js +40 -0
- package/components/mui_extended/Typography/index.2a1c68f8.js +55 -0
- package/components/popups/PopupsProvider/{index.18669fb4.js → index.3b43e55f.js} +1 -1
- package/components/popups/PopupsViewer/{index.ba354267.js → index.fb3f0c48.js} +5 -4
- package/contexts/ModalContext/{index.cf02e6bd.js → index.82f61407.js} +1 -1
- package/contexts/RHFormContext/{index.dc955a09.js → index.e942a298.js} +1 -1
- package/hooks/useFormAddEdit/{index.f156a2cd.js → index.fa430551.js} +2 -2
- package/hooks/useModal/{index.ef54bcf2.js → index.9fe41bde.js} +3 -3
- package/index.js +266 -239
- package/package.json +1 -1
- package/{react-draggable.5331add7.js → react-draggable.2df3b71a.js} +1 -1
- package/{react-resizable.37bfb965.js → react-resizable.c60f3843.js} +2 -2
- package/utils/{index.9ee4c99a.js → index.0660ee9c.js} +9 -62
- package/{vendor.a1ce6777.js → vendor.3eadfa16.js} +746 -3011
- package/components/Icon/index.d5fed418.js +0 -420
- package/components/LanguagePopover/index.e6fa2336.js +0 -184
- package/components/areas/constants.5387d83e.js +0 -412
- package/hooks/useTab/index.bce8b99e.js +0 -12
package/components/{maps/components/GpsTools/index.75880ce0.js → mui_extended/Tab/index.ad88441e.js}
RENAMED
|
@@ -1,261 +1,667 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { createContext,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { createContext, useState, useContext, forwardRef, useRef, useLayoutEffect, useEffect, useMemo, useCallback } from "react";
|
|
3
|
+
import { u as useRowSelection, S as SelectCellFormatter, H as HeaderRenderer, D as DataGrid$1 } from "../../../react-data-grid.c5377916.js";
|
|
4
|
+
import { useDrag, useDrop, DndProvider } from "react-dnd";
|
|
5
|
+
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
6
|
+
import { generateUtilityClasses, generateUtilityClass, styled, Tabs as Tabs$1, Tab as Tab$1, Skeleton, SvgIcon, Checkbox, InputBase, useTheme } from "@mui/material";
|
|
7
|
+
import { f as useDataGrid, g as useFilters, M as MenuActions, h as ColumnDateFormatter, A as Actions, i as ActionFormIntro, R as RHFAutocomplete, a as DataGrid } from "../../../vendor.3eadfa16.js";
|
|
8
|
+
import { T as TEST_PROP_ID, a9 as DATAGRID_SELECT_COLUMN_KEY, aa as DATAGRID_ACTIONS_COLUMN_KEY, ab as COMPONENT_MAP_TOOLS_ID, ac as STYLE_OPACITIES, ad as STYLE_WHEIGHTS, ae as STYLE_PATTERNS } from "../../areas/constants.630a4f42.js";
|
|
9
|
+
import { useModuleSkeleton, useModuleDictionary, getPropertyByString, useEnvironment, useHostTools, useNetwork, useModulePrivileges, usePaginate } from "@m4l/core";
|
|
10
|
+
import { M as MAP_DICCTIONARY } from "../../areas/dictionary.19b25583.js";
|
|
11
|
+
import { u as useGpsToolsStore, g as gpsToolsClasses, a as useLayers, D as DivGpsToolsRoot } from "../../maps/components/GpsTools/index.ef751d28.js";
|
|
5
12
|
import { shallow } from "zustand/shallow";
|
|
6
|
-
import { createStore, useStore } from "zustand";
|
|
7
|
-
import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
|
|
8
|
-
import { devtools } from "zustand/middleware";
|
|
9
|
-
import { immer } from "zustand/middleware/immer";
|
|
10
|
-
import { enableMapSet } from "immer";
|
|
11
|
-
import { u as useMapStore, C as CommonFeatureRender } from "../../index.8ec46ce4.js";
|
|
12
|
-
import { a9 as GeofencesFeaturesLayers, aa as COMPONENT_CLASS_NAME, M as MAP_ZINDEX_OVER_MAP, ab as COMPONENT_MAP_TOOLS_ID, ac as initialValues, ad as STROKE_COLOR_DEFAULT, ae as STROKE_OPACITY_DEFAULT, af as STROKE_WHEIGTH_DEFAULT, ag as STROKE_DASH_ARRAY_DEFAULT, ah as FILL_COLOR_DEFAULT, ai as FILL_OPACITY_DEFAULT, aj as STYLE_OPACITIES, ak as STYLE_WHEIGHTS, al as STYLE_PATTERNS, am as ENDPOINT_GEOFENCE_NEW_EDIT, an as ENDPOINT_GEOFENCE_GET } from "../../../areas/constants.5387d83e.js";
|
|
13
13
|
import "@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css";
|
|
14
14
|
import "@geoman-io/leaflet-geoman-free";
|
|
15
|
-
import { styled } from "@mui/material/styles";
|
|
16
|
-
import { generateUtilityClasses } from "@mui/material";
|
|
17
|
-
import "@mui/base";
|
|
18
15
|
import clsx from "clsx";
|
|
19
|
-
import { G as GPSTOOLSICONS } from "
|
|
20
|
-
import { D as DynamicFilter } from "
|
|
21
|
-
import {
|
|
16
|
+
import { G as GPSTOOLSICONS } from "../../areas/icons.504ec098.js";
|
|
17
|
+
import { D as DynamicFilter } from "../../DynamicFilter/index.05e15fb8.js";
|
|
18
|
+
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
22
19
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
23
|
-
import {
|
|
20
|
+
import { H as HelperError } from "../../hook-form/HelperError/index.fd10c3ab.js";
|
|
21
|
+
import { u as usePopupsStore } from "../../popups/PopupsProvider/index.3b43e55f.js";
|
|
22
|
+
import { B as Button } from "../Button/index.a7dc6ef0.js";
|
|
24
23
|
import { useMap } from "react-leaflet";
|
|
25
|
-
import { u as useFormReadyForUpdate } from "
|
|
24
|
+
import { u as useFormReadyForUpdate } from "../../../hooks/useFormReadyForUpdate/index.f60f500e.js";
|
|
26
25
|
import * as L from "leaflet";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
26
|
+
import { P as PaperForm } from "../../PaperForm/index.e04f9f1f.js";
|
|
27
|
+
import { R as RHFTextField } from "../../hook-form/RHFTextField/index.2ae1f130.js";
|
|
28
|
+
import { S as Stack } from "../Stack/index.fe363ca5.js";
|
|
29
|
+
import { P as PropertyValue } from "../../PropertyValue/index.e31d4282.js";
|
|
30
|
+
import { R as RHFColorPicker } from "../../hook-form/RHFColorPicker/index.25e4e643.js";
|
|
31
|
+
import { unstable_composeClasses } from "@mui/base";
|
|
32
|
+
import { styled as styled$1 } from "@mui/material/styles";
|
|
33
|
+
import { a as getNameDataTestId } from "../../../test/getNameDataTestId.aee44365.js";
|
|
34
|
+
import { T as Tooltip } from "../Tooltip/index.49bb5ee1.js";
|
|
30
35
|
import * as Yup from "yup";
|
|
31
|
-
import { R as RHFormProvider } from "
|
|
32
|
-
import { u as useFormAddEdit } from "
|
|
33
|
-
import { u as useModal } from "
|
|
34
|
-
import { W as WindowConfirm } from "
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
...initProps
|
|
36
|
+
import { R as RHFormProvider } from "../../../contexts/RHFormContext/index.e942a298.js";
|
|
37
|
+
import { u as useFormAddEdit } from "../../../hooks/useFormAddEdit/index.fa430551.js";
|
|
38
|
+
import { u as useModal } from "../../../hooks/useModal/index.9fe41bde.js";
|
|
39
|
+
import { W as WindowConfirm } from "../../modal/WindowConfirm.1a123368.js";
|
|
40
|
+
import { u as useMapStore } from "../../maps/index.ba1ccfad.js";
|
|
41
|
+
const componentName$2 = "M4LTabs";
|
|
42
|
+
generateUtilityClasses(componentName$2, [
|
|
43
|
+
"root"
|
|
44
|
+
]);
|
|
45
|
+
function getTabsUtilityClass(slot) {
|
|
46
|
+
return generateUtilityClass(componentName$2, slot);
|
|
47
|
+
}
|
|
48
|
+
const useTabsUtilityClasses = () => {
|
|
49
|
+
const slots = {
|
|
50
|
+
root: ["root"]
|
|
47
51
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
52
|
+
const composedClasses = unstable_composeClasses(slots, getTabsUtilityClass, {});
|
|
53
|
+
return {
|
|
54
|
+
...composedClasses
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const MUITabs = styled(Tabs$1)(({ theme }) => ({
|
|
58
|
+
...theme.components?.M4LTabs?.styleOverrides
|
|
59
|
+
}));
|
|
60
|
+
const Tabs = (props) => {
|
|
61
|
+
const { children, className, ...others } = props;
|
|
62
|
+
const classes = useTabsUtilityClasses();
|
|
63
|
+
return /* @__PURE__ */ jsx(MUITabs, { className: clsx(classes.root, className), ...others, children });
|
|
64
|
+
};
|
|
65
|
+
const componentName$1 = "M4LTabContent";
|
|
66
|
+
generateUtilityClasses(componentName$1, [
|
|
67
|
+
"root"
|
|
68
|
+
]);
|
|
69
|
+
function getTabContentUtilityClass(slot) {
|
|
70
|
+
return generateUtilityClass(componentName$1, slot);
|
|
71
|
+
}
|
|
72
|
+
const useTabContentUtilityClasses = () => {
|
|
73
|
+
const slots = {
|
|
74
|
+
root: ["root"]
|
|
75
|
+
};
|
|
76
|
+
const composedClasses = unstable_composeClasses(slots, getTabContentUtilityClass, {});
|
|
77
|
+
return {
|
|
78
|
+
...composedClasses
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const TabContentRoot = styled("div")(({ theme }) => ({
|
|
82
|
+
...theme.components?.M4LTabContent?.styleOverrides
|
|
83
|
+
}));
|
|
84
|
+
const TabContent = (props) => {
|
|
85
|
+
const { children, className, ...others } = props;
|
|
86
|
+
const classes = useTabContentUtilityClasses();
|
|
87
|
+
return /* @__PURE__ */ jsx(TabContentRoot, { className: clsx(classes.root, className), ...others, children });
|
|
88
|
+
};
|
|
89
|
+
const TabRoot = styled$1("div")(({ theme }) => ({
|
|
90
|
+
...theme.components?.M4LTab?.styleOverrides
|
|
91
|
+
}));
|
|
92
|
+
const SKTTabWrapper = styled$1("div")(({ theme }) => ({
|
|
93
|
+
padding: theme.spacing(1.5, 2)
|
|
94
|
+
}));
|
|
95
|
+
const componentName = "M4LTab";
|
|
96
|
+
generateUtilityClasses(componentName, [
|
|
97
|
+
"root",
|
|
98
|
+
"skeleton"
|
|
99
|
+
]);
|
|
100
|
+
function getTabUtilityClass(slot) {
|
|
101
|
+
return generateUtilityClass(componentName, slot);
|
|
102
|
+
}
|
|
103
|
+
const tabUtilityClasses = () => {
|
|
104
|
+
const slots = {
|
|
105
|
+
root: ["root"],
|
|
106
|
+
skeleton: ["skeleton"]
|
|
107
|
+
};
|
|
108
|
+
const composedClasses = unstable_composeClasses(slots, getTabUtilityClass, {});
|
|
109
|
+
return {
|
|
110
|
+
...composedClasses
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const COMPONENT_PREFIX = "m4l-tab";
|
|
114
|
+
function Tab(props) {
|
|
115
|
+
const { SKTWidth, SKTHeight, className, dataTestId = "", ...other } = props;
|
|
116
|
+
const isSkeleton = useModuleSkeleton();
|
|
117
|
+
const classes = tabUtilityClasses();
|
|
118
|
+
return /* @__PURE__ */ jsx(
|
|
119
|
+
TabRoot,
|
|
120
|
+
{
|
|
121
|
+
className: clsx(classes.root, className),
|
|
122
|
+
...process.env.NODE_ENV !== "production" ? {
|
|
123
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "root", dataTestId)
|
|
124
|
+
} : {},
|
|
125
|
+
children: !isSkeleton ? /* @__PURE__ */ jsx(Tab$1, { ...other }) : /* @__PURE__ */ jsx(
|
|
126
|
+
SKTTabWrapper,
|
|
127
|
+
{
|
|
128
|
+
className: classes.skeleton,
|
|
129
|
+
...process.env.NODE_ENV !== "production" ? {
|
|
130
|
+
[TEST_PROP_ID]: getNameDataTestId(
|
|
131
|
+
COMPONENT_PREFIX,
|
|
132
|
+
"skeleton",
|
|
133
|
+
dataTestId
|
|
134
|
+
)
|
|
135
|
+
} : {},
|
|
136
|
+
children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: SKTWidth, height: SKTHeight })
|
|
125
137
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
)
|
|
138
|
+
)
|
|
139
|
+
}
|
|
129
140
|
);
|
|
141
|
+
}
|
|
142
|
+
const TabContext = createContext(null);
|
|
143
|
+
function TabProvider(props) {
|
|
144
|
+
const { children, initialValue } = props;
|
|
145
|
+
const [currentTab, setCurrentTab] = useState(initialValue);
|
|
146
|
+
const handleChange = (_event, newTab) => {
|
|
147
|
+
setCurrentTab(newTab);
|
|
148
|
+
};
|
|
149
|
+
return /* @__PURE__ */ jsx(
|
|
150
|
+
TabContext.Provider,
|
|
151
|
+
{
|
|
152
|
+
value: {
|
|
153
|
+
currentTab: currentTab.toString(),
|
|
154
|
+
handleChange
|
|
155
|
+
},
|
|
156
|
+
children
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
const useTab = () => {
|
|
161
|
+
const context = useContext(TabContext);
|
|
162
|
+
if (context === null) {
|
|
163
|
+
throw new Error("useTab must be used within a TabProvider");
|
|
164
|
+
}
|
|
165
|
+
return context;
|
|
130
166
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
167
|
+
function CheckboxIcon(props) {
|
|
168
|
+
return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm0 2H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2z" }) });
|
|
169
|
+
}
|
|
170
|
+
function CheckboxCheckedIcon(props) {
|
|
171
|
+
return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm-1.372 4.972a1.006 1.006 0 00-.928.388l-3.78 5-1.63-2.08a1.001 1.001 0 00-1.58 1.23l2.44 3.11a1 1 0 001.58-.01l4.57-6v-.03a1.006 1.006 0 00-.672-1.608z" }) });
|
|
172
|
+
}
|
|
173
|
+
function CheckboxIndeterminateIcon(props) {
|
|
174
|
+
return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm-1.75 8h-6.5a.75.75 0 00-.75.75v.5c0 .414.336.75.75.75h6.5a.75.75 0 00.75-.75v-.5a.75.75 0 00-.75-.75z" }) });
|
|
175
|
+
}
|
|
176
|
+
const CheckboxFormatter = forwardRef(
|
|
177
|
+
function CheckboxFormatter2({ onChange, checked, ...props }, _ref) {
|
|
178
|
+
function handleChange(e) {
|
|
179
|
+
onChange(e.target.checked, e.nativeEvent.shiftKey);
|
|
180
|
+
}
|
|
181
|
+
return /* @__PURE__ */ jsx(
|
|
182
|
+
Checkbox,
|
|
183
|
+
{
|
|
184
|
+
checked,
|
|
185
|
+
size: "small",
|
|
186
|
+
icon: /* @__PURE__ */ jsx(CheckboxIcon, {}),
|
|
187
|
+
checkedIcon: /* @__PURE__ */ jsx(CheckboxCheckedIcon, {}),
|
|
188
|
+
indeterminateIcon: /* @__PURE__ */ jsx(CheckboxIndeterminateIcon, {}),
|
|
189
|
+
onChange: handleChange,
|
|
190
|
+
...props
|
|
147
191
|
}
|
|
148
|
-
|
|
192
|
+
);
|
|
149
193
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
194
|
+
);
|
|
195
|
+
const filterColumnClassName = "filter-cell";
|
|
196
|
+
const filterHeight = 35;
|
|
197
|
+
function SelectGroupFormatter(props) {
|
|
198
|
+
const [isRowSelected, onRowSelectionChange] = useRowSelection();
|
|
199
|
+
const onChange = (checked) => {
|
|
200
|
+
onRowSelectionChange({ row: props.row, checked, isShiftClick: false });
|
|
201
|
+
};
|
|
202
|
+
const cellFormater = SelectCellFormatter({
|
|
203
|
+
value: isRowSelected,
|
|
204
|
+
isCellSelected: props.isCellSelected,
|
|
205
|
+
onChange,
|
|
206
|
+
"aria-label": "Select Group"
|
|
207
|
+
});
|
|
208
|
+
return cellFormater;
|
|
209
|
+
}
|
|
210
|
+
function SelectFormatter(props) {
|
|
211
|
+
const { checkedRows, onCheckedRowsChange, rowKeyGetter } = useDataGrid();
|
|
212
|
+
const onChange = (checked, _isShiftClick) => {
|
|
213
|
+
const newCheckedRows = new Set(checkedRows);
|
|
214
|
+
if (checked) {
|
|
215
|
+
newCheckedRows.add(rowKeyGetter(props.row));
|
|
216
|
+
} else {
|
|
217
|
+
newCheckedRows.delete(rowKeyGetter(props.row));
|
|
218
|
+
}
|
|
219
|
+
onCheckedRowsChange && onCheckedRowsChange(newCheckedRows);
|
|
220
|
+
};
|
|
221
|
+
return /* @__PURE__ */ jsx(
|
|
222
|
+
SelectCellFormatter,
|
|
223
|
+
{
|
|
224
|
+
value: checkedRows?.has(rowKeyGetter(props.row)) || false,
|
|
225
|
+
isCellSelected: props.isCellSelected,
|
|
226
|
+
onChange,
|
|
227
|
+
"aria-label": "Select"
|
|
228
|
+
}
|
|
154
229
|
);
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
230
|
+
}
|
|
231
|
+
const SelectColumnHeaderRenderer = (props) => {
|
|
232
|
+
const { rows, rowKeyGetter, onCheckedRowsChange, checkedRows } = useDataGrid();
|
|
233
|
+
const onAllRowsCheckedChange = (checked) => {
|
|
234
|
+
if (!onCheckedRowsChange)
|
|
235
|
+
return;
|
|
236
|
+
if (checked) {
|
|
237
|
+
onCheckedRowsChange(new Set(rows.map((r) => rowKeyGetter(r))));
|
|
238
|
+
} else {
|
|
239
|
+
onCheckedRowsChange(/* @__PURE__ */ new Set());
|
|
158
240
|
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
241
|
+
};
|
|
242
|
+
const allRowsChecked = rows.length === checkedRows?.size;
|
|
243
|
+
return SelectCellFormatter({
|
|
244
|
+
"aria-label": "Select All",
|
|
245
|
+
isCellSelected: props.isCellSelected,
|
|
246
|
+
value: allRowsChecked,
|
|
247
|
+
onChange: onAllRowsCheckedChange
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
const SelectColumn = {
|
|
251
|
+
key: DATAGRID_SELECT_COLUMN_KEY,
|
|
252
|
+
name: "",
|
|
253
|
+
width: 32,
|
|
254
|
+
minWidth: 32,
|
|
255
|
+
isDraggable: false,
|
|
256
|
+
resizable: false,
|
|
257
|
+
sortable: false,
|
|
258
|
+
frozen: true,
|
|
259
|
+
type: "boolean",
|
|
260
|
+
headerRenderer: SelectColumnHeaderRenderer,
|
|
261
|
+
formatter: SelectFormatter,
|
|
262
|
+
groupFormatter: SelectGroupFormatter
|
|
263
|
+
};
|
|
264
|
+
function useFocusRef(isSelected) {
|
|
265
|
+
const ref = useRef(null);
|
|
266
|
+
useLayoutEffect(() => {
|
|
267
|
+
if (!isSelected)
|
|
162
268
|
return;
|
|
269
|
+
ref.current?.focus({ preventScroll: true });
|
|
270
|
+
}, [isSelected]);
|
|
271
|
+
return {
|
|
272
|
+
ref,
|
|
273
|
+
tabIndex: isSelected ? 0 : -1
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function DraggableHeaderRenderer(props) {
|
|
277
|
+
const { onColumnsReorder, column, isCellSelected, ...others } = props;
|
|
278
|
+
const { ref, tabIndex } = useFocusRef(isCellSelected);
|
|
279
|
+
const { getLabel } = useModuleDictionary();
|
|
280
|
+
const { activeFilters, filters, onChangeFilter } = useFilters();
|
|
281
|
+
const [filter, setFilter] = useState(filters?.get(column.key) || "");
|
|
282
|
+
const [{ isDragging }, drag] = useDrag({
|
|
283
|
+
type: "COLUMN_DRAG",
|
|
284
|
+
item: { key: column.key },
|
|
285
|
+
collect: (monitor) => ({
|
|
286
|
+
isDragging: monitor.isDragging()
|
|
287
|
+
})
|
|
288
|
+
});
|
|
289
|
+
const [{ isOver }, drop] = useDrop({
|
|
290
|
+
accept: "COLUMN_DRAG",
|
|
291
|
+
drop({ key }) {
|
|
292
|
+
onColumnsReorder(key, column.key);
|
|
293
|
+
},
|
|
294
|
+
collect: (monitor) => ({
|
|
295
|
+
isOver: monitor.isOver(),
|
|
296
|
+
canDrop: monitor.canDrop()
|
|
297
|
+
})
|
|
298
|
+
});
|
|
299
|
+
const handleChange = (e) => {
|
|
300
|
+
if (activeFilters) {
|
|
301
|
+
if (onChangeFilter)
|
|
302
|
+
onChangeFilter(column, e.target.value);
|
|
303
|
+
}
|
|
304
|
+
setFilter(e.target.value);
|
|
305
|
+
};
|
|
306
|
+
useEffect(() => {
|
|
307
|
+
if (!activeFilters)
|
|
308
|
+
setFilter("");
|
|
309
|
+
}, [activeFilters]);
|
|
310
|
+
const newColumn = { ...column };
|
|
311
|
+
if (newColumn.withinHeaderRenderer) {
|
|
312
|
+
newColumn.name = newColumn.withinHeaderRenderer(props);
|
|
313
|
+
}
|
|
314
|
+
return /* @__PURE__ */ jsxs(
|
|
315
|
+
"div",
|
|
316
|
+
{
|
|
317
|
+
ref: (newRef) => {
|
|
318
|
+
drag(newRef);
|
|
319
|
+
drop(newRef);
|
|
320
|
+
},
|
|
321
|
+
style: {
|
|
322
|
+
opacity: isDragging ? 0.5 : 1,
|
|
323
|
+
backgroundColor: isOver ? "#ececec" : void 0,
|
|
324
|
+
cursor: "move",
|
|
325
|
+
display: "flex",
|
|
326
|
+
flexDirection: "column",
|
|
327
|
+
lineHeight: "1",
|
|
328
|
+
height: "100%",
|
|
329
|
+
justifyContent: "center",
|
|
330
|
+
textAlign: "center"
|
|
331
|
+
},
|
|
332
|
+
children: [
|
|
333
|
+
/* @__PURE__ */ jsx(HeaderRenderer, { column: newColumn, isCellSelected, ...others }),
|
|
334
|
+
activeFilters && (column?.withFilter === void 0 || column.withFilter === true) && /* @__PURE__ */ jsx(
|
|
335
|
+
"div",
|
|
336
|
+
{
|
|
337
|
+
className: "filter_cell_div",
|
|
338
|
+
style: {
|
|
339
|
+
borderTop: "1px solid var(--rdg-border-color)",
|
|
340
|
+
width: "100%",
|
|
341
|
+
display: "flex",
|
|
342
|
+
alignItems: "center",
|
|
343
|
+
height: `${filterHeight}px`
|
|
344
|
+
},
|
|
345
|
+
children: /* @__PURE__ */ jsx(
|
|
346
|
+
InputBase,
|
|
347
|
+
{
|
|
348
|
+
inputRef: ref,
|
|
349
|
+
placeholder: getLabel("data_grid.filter_holder"),
|
|
350
|
+
style: {
|
|
351
|
+
width: "100%",
|
|
352
|
+
paddingBottom: "2px",
|
|
353
|
+
border: "1px solid var(--rdg-border-color)"
|
|
354
|
+
},
|
|
355
|
+
tabIndex,
|
|
356
|
+
type: "text",
|
|
357
|
+
onChange: handleChange,
|
|
358
|
+
value: filter
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
]
|
|
163
364
|
}
|
|
164
|
-
|
|
165
|
-
}, [isDesktop, isSkeleton]);
|
|
166
|
-
return /* @__PURE__ */ jsx(GpsToolsContext.Provider, { value: mapStoreRef.current, children });
|
|
365
|
+
);
|
|
167
366
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return
|
|
367
|
+
const getDragHeaderRenderer = (handleColumnsReorder) => {
|
|
368
|
+
function HeaderRenderer2(props) {
|
|
369
|
+
return /* @__PURE__ */ jsx(DraggableHeaderRenderer, { ...props, onColumnsReorder: handleColumnsReorder });
|
|
370
|
+
}
|
|
371
|
+
return HeaderRenderer2;
|
|
372
|
+
};
|
|
373
|
+
function ActionsFormatter(props) {
|
|
374
|
+
const { rowActionsGetter, classes } = useDataGrid();
|
|
375
|
+
const theme = useTheme();
|
|
376
|
+
if (rowActionsGetter === void 0) {
|
|
377
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
378
|
+
}
|
|
379
|
+
return /* @__PURE__ */ jsx(
|
|
380
|
+
MenuActions,
|
|
381
|
+
{
|
|
382
|
+
arrowType: "top-left",
|
|
383
|
+
objItem: props.row,
|
|
384
|
+
menuActions: rowActionsGetter,
|
|
385
|
+
className: classes.actionsFormatter,
|
|
386
|
+
menuActionSx: theme.components?.M4LDataGridActionsFormatter?.styleOverrides,
|
|
387
|
+
marginTop: 1,
|
|
388
|
+
marginLeft: "-11px",
|
|
389
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
390
|
+
transformOrigin: { vertical: "top", horizontal: "left" }
|
|
391
|
+
}
|
|
392
|
+
);
|
|
173
393
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
394
|
+
const ActionsColumn = {
|
|
395
|
+
key: DATAGRID_ACTIONS_COLUMN_KEY,
|
|
396
|
+
name: getActionLabel(),
|
|
397
|
+
width: 32,
|
|
398
|
+
minWidth: 32,
|
|
399
|
+
isDraggable: false,
|
|
400
|
+
withFilter: false,
|
|
401
|
+
resizable: true,
|
|
402
|
+
sortable: false,
|
|
403
|
+
frozen: true,
|
|
404
|
+
type: "custom",
|
|
405
|
+
formatter: ActionsFormatter
|
|
406
|
+
};
|
|
407
|
+
function getActionLabel() {
|
|
408
|
+
return "";
|
|
409
|
+
}
|
|
410
|
+
const WrapperSkeleton = styled("div")(() => ({
|
|
411
|
+
display: "flex",
|
|
412
|
+
width: "100%",
|
|
413
|
+
height: "100%",
|
|
414
|
+
alignItems: "center"
|
|
415
|
+
}));
|
|
416
|
+
function SkeletonFormatter() {
|
|
417
|
+
const { classes } = useDataGrid();
|
|
418
|
+
return /* @__PURE__ */ jsx(WrapperSkeleton, { className: classes.skeletonFormatter, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "100%", height: "12px" }) });
|
|
419
|
+
}
|
|
420
|
+
function getComparator(columns, sortColumn) {
|
|
421
|
+
const column = columns.find((d) => d.key === sortColumn);
|
|
422
|
+
let typeOrder = "string";
|
|
423
|
+
if (column) {
|
|
424
|
+
typeOrder = column.type || "string";
|
|
425
|
+
}
|
|
426
|
+
switch (typeOrder) {
|
|
427
|
+
case "number":
|
|
428
|
+
return (a, b) => {
|
|
429
|
+
try {
|
|
430
|
+
return Number(a[sortColumn]) - Number(b[sortColumn]);
|
|
431
|
+
} catch (error) {
|
|
432
|
+
return -1;
|
|
186
433
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
434
|
+
};
|
|
435
|
+
default:
|
|
436
|
+
return (a, b) => {
|
|
437
|
+
try {
|
|
438
|
+
return a[sortColumn].toString().localeCompare(b[sortColumn].toString());
|
|
439
|
+
} catch (error) {
|
|
440
|
+
return -1;
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const getColumIndex = (key, columnsConfig) => columnsConfig.findIndex((columnConfig) => columnConfig.key === key);
|
|
446
|
+
const getInOrderColumns = (columns, hasCheckedRows, columnsConfig, columnsWidths, rowActionsGetter) => {
|
|
447
|
+
let filteredSortedColumns = columns.filter((column) => {
|
|
448
|
+
const columnConfigIndex = getColumIndex(column.key, columnsConfig);
|
|
449
|
+
const visible = columnConfigIndex > -1 ? columnsConfig[columnConfigIndex].visible : true;
|
|
450
|
+
return !column.hidden && visible;
|
|
451
|
+
}).sort(
|
|
452
|
+
(a, b) => getColumIndex(a.key, columnsConfig) - getColumIndex(b.key, columnsConfig)
|
|
453
|
+
).map((columnSorted) => {
|
|
454
|
+
const columnConfigIndex = getColumIndex(columnSorted.key, columnsConfig);
|
|
455
|
+
return {
|
|
456
|
+
...columnSorted,
|
|
457
|
+
frozen: columnConfigIndex > -1 ? columnsConfig[columnConfigIndex].frozen : true,
|
|
458
|
+
width: typeof columnsWidths.get(columnSorted.key) === "number" ? columnsWidths.get(columnSorted.key) : columnSorted.width
|
|
459
|
+
};
|
|
460
|
+
}).sort((a, b) => {
|
|
461
|
+
const order = (a.frozen === void 0 || a.frozen === false) === (b.frozen === void 0 || b.frozen === false) ? 0 : a.frozen ? -1 : 1;
|
|
462
|
+
return order;
|
|
463
|
+
});
|
|
464
|
+
if (rowActionsGetter) {
|
|
465
|
+
filteredSortedColumns = [ActionsColumn, ...filteredSortedColumns];
|
|
466
|
+
}
|
|
467
|
+
if (hasCheckedRows) {
|
|
468
|
+
filteredSortedColumns = [SelectColumn, ...filteredSortedColumns];
|
|
469
|
+
}
|
|
470
|
+
return filteredSortedColumns;
|
|
471
|
+
};
|
|
472
|
+
const getAligByType = (columnType) => {
|
|
473
|
+
switch (columnType) {
|
|
474
|
+
case "string":
|
|
475
|
+
return "left";
|
|
476
|
+
case "date":
|
|
477
|
+
case "boolean":
|
|
478
|
+
case "custom":
|
|
479
|
+
return "center";
|
|
480
|
+
case "number":
|
|
481
|
+
return "right";
|
|
482
|
+
}
|
|
483
|
+
return "left";
|
|
484
|
+
};
|
|
485
|
+
const useSortColumnsRows = (sourceColumns, sourceRows) => {
|
|
486
|
+
const {
|
|
487
|
+
columnsConfig,
|
|
488
|
+
columnsWidths,
|
|
489
|
+
onChangeColumnsOrder,
|
|
490
|
+
rowActionsGetter,
|
|
491
|
+
checkedRows,
|
|
492
|
+
onCheckedRowsChange
|
|
493
|
+
} = useDataGrid();
|
|
494
|
+
const [columns, setColumns] = useState(() => []);
|
|
495
|
+
const [sortColumns, setSortColumns] = useState([]);
|
|
496
|
+
const isSkeleton = useModuleSkeleton();
|
|
497
|
+
const { activeFilters, filters } = useFilters();
|
|
498
|
+
const findKeyInColumns = (key, cols) => {
|
|
499
|
+
const index = cols.findIndex((column) => key === column.key && column.hidden === false);
|
|
500
|
+
return index !== -1;
|
|
501
|
+
};
|
|
502
|
+
useEffect(() => {
|
|
503
|
+
setColumns(
|
|
504
|
+
getInOrderColumns(
|
|
505
|
+
sourceColumns,
|
|
506
|
+
!!checkedRows && !!onCheckedRowsChange,
|
|
507
|
+
columnsConfig,
|
|
508
|
+
columnsWidths,
|
|
509
|
+
rowActionsGetter
|
|
510
|
+
)
|
|
511
|
+
);
|
|
512
|
+
const finalSortedColumns = sortColumns.filter(
|
|
513
|
+
(sortColumn) => findKeyInColumns(sortColumn.columnKey, sourceColumns)
|
|
514
|
+
);
|
|
515
|
+
if (JSON.stringify(finalSortedColumns) !== JSON.stringify(sortColumns)) {
|
|
516
|
+
setSortColumns(finalSortedColumns);
|
|
517
|
+
}
|
|
518
|
+
}, [sourceColumns, columnsConfig, rowActionsGetter]);
|
|
519
|
+
const finalColumns = useMemo(() => {
|
|
520
|
+
const DragAndDropHeaderRenderer = getDragHeaderRenderer(onChangeColumnsOrder);
|
|
521
|
+
return columns.map((c) => {
|
|
522
|
+
const newColumn = {
|
|
523
|
+
...c,
|
|
524
|
+
cellClass: c.align !== void 0 ? `rdg-cell-align-${c.align}` : `rdg-cell-align-${getAligByType(c.type)}`
|
|
525
|
+
};
|
|
526
|
+
if (newColumn.key === DATAGRID_SELECT_COLUMN_KEY || newColumn.isDraggable !== void 0 && newColumn.isDraggable === false) {
|
|
527
|
+
return newColumn;
|
|
528
|
+
}
|
|
529
|
+
if (isSkeleton) {
|
|
530
|
+
newColumn.headerRenderer = SkeletonFormatter;
|
|
531
|
+
newColumn.formatter = SkeletonFormatter;
|
|
532
|
+
}
|
|
533
|
+
if (newColumn.headerRenderer) {
|
|
534
|
+
newColumn.withinHeaderRenderer = newColumn.headerRenderer;
|
|
535
|
+
}
|
|
536
|
+
if ((newColumn?.withFilter === void 0 || newColumn.withFilter === true) && activeFilters) {
|
|
537
|
+
newColumn.headerCellClass = filterColumnClassName;
|
|
538
|
+
}
|
|
539
|
+
newColumn.headerRenderer = DragAndDropHeaderRenderer;
|
|
540
|
+
return newColumn;
|
|
189
541
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
542
|
+
}, [isSkeleton, columns, activeFilters, onChangeColumnsOrder]);
|
|
543
|
+
const finalRows = useMemo(() => {
|
|
544
|
+
const nextRows = sourceRows.filter((r) => {
|
|
545
|
+
if (!filters || filters.size === 0)
|
|
546
|
+
return true;
|
|
547
|
+
const iterator = filters.entries();
|
|
548
|
+
let valReturn = true;
|
|
549
|
+
for (let i = 0; i < filters.size; i++) {
|
|
550
|
+
const entry = iterator.next().value;
|
|
551
|
+
const columnKey = entry[0];
|
|
552
|
+
const columnFilter = entry[1];
|
|
553
|
+
let valCell;
|
|
554
|
+
const valueMaybeString = getPropertyByString(r, columnKey);
|
|
555
|
+
let fixedValue;
|
|
556
|
+
if (typeof valueMaybeString === "string") {
|
|
557
|
+
fixedValue = valueMaybeString;
|
|
558
|
+
} else {
|
|
559
|
+
fixedValue = "";
|
|
198
560
|
}
|
|
199
|
-
|
|
200
|
-
|
|
561
|
+
try {
|
|
562
|
+
if (columnFilter.customFilter) {
|
|
563
|
+
valReturn = valReturn && columnFilter.customFilter(r, columnFilter.value);
|
|
564
|
+
} else {
|
|
565
|
+
valCell = fixedValue;
|
|
566
|
+
valReturn = valReturn && valCell.includes(columnFilter.value);
|
|
567
|
+
}
|
|
568
|
+
} catch (error) {
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
if (!valReturn)
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
return valReturn;
|
|
201
575
|
});
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
576
|
+
if (sortColumns.length === 0) {
|
|
577
|
+
return nextRows;
|
|
578
|
+
}
|
|
579
|
+
nextRows.sort((a, b) => {
|
|
580
|
+
for (const sort of sortColumns) {
|
|
581
|
+
const comparator = getComparator(columns, sort.columnKey);
|
|
582
|
+
const compResult = comparator(a, b);
|
|
583
|
+
if (compResult !== 0) {
|
|
584
|
+
return sort.direction === "ASC" ? compResult : -compResult;
|
|
210
585
|
}
|
|
211
|
-
}
|
|
212
|
-
|
|
586
|
+
}
|
|
587
|
+
return 0;
|
|
213
588
|
});
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
589
|
+
return nextRows;
|
|
590
|
+
}, [sourceRows, sortColumns, filters]);
|
|
591
|
+
return { finalColumns, sortColumns, setSortColumns, finalRows };
|
|
592
|
+
};
|
|
593
|
+
function Table(props) {
|
|
594
|
+
const { columns, rows, onRowsChange, rowKeyGetter, selectedRows, onSelectedRowsChange } = props;
|
|
595
|
+
const { finalColumns, sortColumns, setSortColumns, finalRows } = useSortColumnsRows(
|
|
596
|
+
columns,
|
|
597
|
+
rows
|
|
598
|
+
);
|
|
599
|
+
const { activeFilters } = useFilters();
|
|
600
|
+
const { onChangeColumnWidth, setRowsCount, currentRowHeight, currentRowHeaderHeight, classes } = useDataGrid();
|
|
601
|
+
const ref_data_grid = useRef(null);
|
|
602
|
+
const onRowClick = (row) => {
|
|
603
|
+
if (selectedRows && onSelectedRowsChange) {
|
|
604
|
+
if (selectedRows.entries().next().value) {
|
|
605
|
+
if (selectedRows.entries().next().value[1] === rowKeyGetter(row)) {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
const mySet = /* @__PURE__ */ new Set([rowKeyGetter(row)]);
|
|
610
|
+
onSelectedRowsChange(mySet);
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
useEffect(() => {
|
|
614
|
+
let columnIndice = 0;
|
|
615
|
+
for (const column of finalColumns) {
|
|
616
|
+
const index = sortColumns.findIndex((sortColumn) => column.key === sortColumn.columnKey);
|
|
617
|
+
if (index !== -1) {
|
|
618
|
+
ref_data_grid.current?.element?.querySelector(`[role="columnheader"][aria-colindex="${columnIndice + 1}"]`)?.setAttribute("aria-columnsort", `${sortColumns[index].direction}`);
|
|
619
|
+
} else {
|
|
620
|
+
ref_data_grid.current?.element?.querySelector(`[role="columnheader"][aria-colindex="${columnIndice + 1}"]`)?.removeAttribute("aria-columnsort");
|
|
621
|
+
}
|
|
622
|
+
columnIndice++;
|
|
623
|
+
}
|
|
624
|
+
}, [sortColumns, finalColumns]);
|
|
625
|
+
useEffect(() => {
|
|
626
|
+
setRowsCount(finalRows.length);
|
|
627
|
+
}, [finalRows]);
|
|
628
|
+
const onColumnResize = (idx, width) => {
|
|
629
|
+
onChangeColumnWidth(finalColumns[idx].key, width);
|
|
630
|
+
};
|
|
631
|
+
const onChangeSort = (newSortColumns) => {
|
|
632
|
+
setSortColumns(newSortColumns);
|
|
633
|
+
};
|
|
634
|
+
return /* @__PURE__ */ jsx("div", { className: classes.tableContaniner, id: "WrapperTable", children: /* @__PURE__ */ jsx("div", { className: classes.wrapperDataGridCss, children: /* @__PURE__ */ jsx(DndProvider, { backend: HTML5Backend, context: window, children: /* @__PURE__ */ jsx(
|
|
635
|
+
DataGrid$1,
|
|
636
|
+
{
|
|
637
|
+
className: "fill-grid rdg-light",
|
|
638
|
+
ref: ref_data_grid,
|
|
639
|
+
headerRowHeight: activeFilters ? currentRowHeaderHeight + filterHeight : currentRowHeaderHeight,
|
|
640
|
+
columns: finalColumns,
|
|
641
|
+
sortColumns,
|
|
642
|
+
onSortColumnsChange: onChangeSort,
|
|
643
|
+
onColumnResize,
|
|
644
|
+
rows: finalRows,
|
|
645
|
+
onRowsChange,
|
|
646
|
+
selectedRows,
|
|
647
|
+
onSelectedRowsChange,
|
|
648
|
+
onRowClick,
|
|
649
|
+
rowHeight: currentRowHeight,
|
|
650
|
+
rowKeyGetter,
|
|
651
|
+
cellNavigationMode: "LOOP_OVER_ROW",
|
|
652
|
+
components: { checkboxFormatter: CheckboxFormatter },
|
|
653
|
+
defaultColumnOptions: { resizable: true, sortable: true }
|
|
654
|
+
}
|
|
655
|
+
) }) }) });
|
|
221
656
|
}
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"
|
|
226
|
-
"
|
|
227
|
-
"
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
"toolGeofencesAddEditStyle",
|
|
231
|
-
"visible",
|
|
232
|
-
"hidden"
|
|
233
|
-
]);
|
|
234
|
-
const DivGpsToolsRoot = styled("div")`
|
|
235
|
-
position: relative;
|
|
236
|
-
display: flex;
|
|
237
|
-
flex-direction: column;
|
|
238
|
-
flex-grow: 1;
|
|
239
|
-
width: 100%;
|
|
240
|
-
height: 100%;
|
|
241
|
-
|
|
242
|
-
z-index: ${MAP_ZINDEX_OVER_MAP};
|
|
243
|
-
|
|
244
|
-
.${gpsToolsClasses.gpsToolsTabContent}.${gpsToolsClasses.hidden} {
|
|
245
|
-
display: none;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.${gpsToolsClasses.gpsToolsGeofencesList} .M4LDataGrid-root {
|
|
249
|
-
height: unset !important;
|
|
250
|
-
flex-grow: 1;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.${gpsToolsClasses.toolGeofencesAddEditGeneral} {
|
|
254
|
-
flex-grow: 1;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
${(props) => props.theme.components?.M4LGpsTools?.styleOverrides}
|
|
258
|
-
`;
|
|
657
|
+
const ENDPOINT_GEOFENCE_GET = "geofences";
|
|
658
|
+
const ENDPOINT_GEOFENCE_NEW_EDIT = "geofences";
|
|
659
|
+
var GeofencesFeaturesLayers = /* @__PURE__ */ ((GeofencesFeaturesLayers2) => {
|
|
660
|
+
GeofencesFeaturesLayers2["LAYER_GEOFENCES"] = "geofences";
|
|
661
|
+
GeofencesFeaturesLayers2["LAYER_GEOFENCES_TRANSIT_FEATURES"] = "geofencesCrossingFeatures";
|
|
662
|
+
GeofencesFeaturesLayers2["LAYER_GEOFENCES_INTERNAL_FEATURES"] = "geofencesInternalFeatures";
|
|
663
|
+
return GeofencesFeaturesLayers2;
|
|
664
|
+
})(GeofencesFeaturesLayers || {});
|
|
259
665
|
function Filter(props) {
|
|
260
666
|
const { refresh, setBackendQueryParams } = props;
|
|
261
667
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
@@ -359,6 +765,33 @@ function MyActions(props) {
|
|
|
359
765
|
/* @__PURE__ */ jsx(ActionFormIntro, { disabled: inEdition })
|
|
360
766
|
] });
|
|
361
767
|
}
|
|
768
|
+
const STROKE_COLOR_DEFAULT = "#aaccaa";
|
|
769
|
+
const STROKE_OPACITY_DEFAULT = { value: 1, label: "100%" };
|
|
770
|
+
const STROKE_WHEIGTH_DEFAULT = { value: 1, label: "1 px" };
|
|
771
|
+
const STROKE_DASH_ARRAY_DEFAULT = { value: "", label: "-----" };
|
|
772
|
+
const FILL_COLOR_DEFAULT = "#aa3000";
|
|
773
|
+
const FILL_OPACITY_DEFAULT = { value: 0.2, label: "20%" };
|
|
774
|
+
const initialValues = {
|
|
775
|
+
name: "",
|
|
776
|
+
geofenceType: null,
|
|
777
|
+
alias: null,
|
|
778
|
+
customerId: null,
|
|
779
|
+
timeMinInSeconds: 5,
|
|
780
|
+
timeMinOutSeconds: 5,
|
|
781
|
+
inEdition: false,
|
|
782
|
+
geometry: null,
|
|
783
|
+
lat: null,
|
|
784
|
+
lng: null,
|
|
785
|
+
properties: {
|
|
786
|
+
radius: null,
|
|
787
|
+
strokeColor: STROKE_COLOR_DEFAULT,
|
|
788
|
+
strokeOpacity: STROKE_OPACITY_DEFAULT,
|
|
789
|
+
strokeWeight: STROKE_WHEIGTH_DEFAULT,
|
|
790
|
+
strokeDashArray: STROKE_DASH_ARRAY_DEFAULT,
|
|
791
|
+
fillColor: FILL_COLOR_DEFAULT,
|
|
792
|
+
fillOpacity: FILL_OPACITY_DEFAULT
|
|
793
|
+
}
|
|
794
|
+
};
|
|
362
795
|
const formatDataEnpoint = (response) => {
|
|
363
796
|
try {
|
|
364
797
|
const { data } = response;
|
|
@@ -1057,7 +1490,7 @@ function useSubmit(props) {
|
|
|
1057
1490
|
};
|
|
1058
1491
|
return { onSubmit };
|
|
1059
1492
|
}
|
|
1060
|
-
const RHFormProviderStyled = styled(RHFormProvider)`
|
|
1493
|
+
const RHFormProviderStyled = styled$1(RHFormProvider)`
|
|
1061
1494
|
height: 100% !important;
|
|
1062
1495
|
|
|
1063
1496
|
.${gpsToolsClasses.gpsToolsGeofencesAddEditContent} {
|
|
@@ -1500,7 +1933,7 @@ function useMaster() {
|
|
|
1500
1933
|
goToAddEdit: onClickAddGeofence
|
|
1501
1934
|
};
|
|
1502
1935
|
}
|
|
1503
|
-
const StackGeofenceListRoot = styled(Stack)`
|
|
1936
|
+
const StackGeofenceListRoot = styled$1(Stack)`
|
|
1504
1937
|
padding: 12px;
|
|
1505
1938
|
position: relative !important;
|
|
1506
1939
|
flex-grow: 1;
|
|
@@ -1640,12 +2073,14 @@ function TabsGpsTools() {
|
|
|
1640
2073
|
}
|
|
1641
2074
|
);
|
|
1642
2075
|
}
|
|
1643
|
-
function GpsTools() {
|
|
1644
|
-
const isSkeleton = useModuleSkeleton();
|
|
1645
|
-
return /* @__PURE__ */ jsx(Fragment, { children: !isSkeleton && /* @__PURE__ */ jsx(TabsGpsTools, {}) });
|
|
1646
|
-
}
|
|
1647
2076
|
export {
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
2077
|
+
GeofencesFeaturesLayers as G,
|
|
2078
|
+
TabsGpsTools as T,
|
|
2079
|
+
Table as a,
|
|
2080
|
+
Tab as b,
|
|
2081
|
+
Tabs as c,
|
|
2082
|
+
TabContent as d,
|
|
2083
|
+
TabProvider as e,
|
|
2084
|
+
TabContext as f,
|
|
2085
|
+
useTab as u
|
|
1651
2086
|
};
|