@m4l/components 1.0.11 → 1.0.13
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.62b1290b.js → index.f22ad364.js} +4 -4
- package/components/AppBar/{index.b48343d8.js → index.8d90ce87.js} +4 -4
- package/components/CommonActions/components/ActionCancel/index.609a78ca.js +12 -0
- package/components/CommonActions/components/ActionFormCancel/index.a1318eac.js +56 -0
- package/components/CommonActions/components/ActionFormIntro/index.34d569d1.js +33 -0
- package/components/CommonActions/components/ActionIntro/index.ebac0bc1.js +25 -0
- package/components/CommonActions/components/Actions/index.258bf919.js +71 -0
- package/components/DataGrid/constants.e334cd50.js +10 -0
- package/components/DataGrid/formatters/ColumnBooleanFormatter/index.7fb1ebaa.js +26 -0
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.0ee10612.js +22 -0
- package/components/DataGrid/formatters/ColumnDateFormatter/index.e00d0cf2.js +19 -0
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.dce9ada8.js +23 -0
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.880e743b.js +14 -0
- package/components/DataGrid/formatters/ColumnPointsFormatter/index.226cc583.js +10 -0
- package/components/DataGrid/formatters/ColumnPriceFormatter/index.bf9d9e60.js +10 -0
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.4045b2f2.js +36 -0
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.a87302d1.js +10 -0
- package/components/DataGrid/formatters/index.2c2f0ae4.js +1 -0
- package/components/DataGrid/index.68e19254.js +915 -0
- package/components/DataGrid/subcomponents/Actions/index.6b044e84.js +596 -0
- package/components/DataGrid/subcomponents/editors/TextEditor/index.3f0d9e28.js +76 -0
- package/components/DragResizeWindow/{index.8b3e79f7.js → index.a358789f.js} +6 -3
- package/components/DynamicFilter/constants.1dddd09c.js +31 -0
- package/components/DynamicFilter/dictionary.d28d39ef.js +51 -0
- package/components/DynamicFilter/helpers/{index.609b3915.js → index.11ed2896.js} +4 -4
- package/components/DynamicFilter/{index.0f04f223.js → index.056a99c7.js} +3 -3
- package/components/DynamicFilter/slots/{index.00b68384.js → index.82d7eaf2.js} +31 -31
- package/components/DynamicFilter/store/{index.85a2812f.js → index.9b5121d6.js} +2 -2
- package/components/DynamicFilter/subcomponents/{index.86c6fda2.js → index.778c93cc.js} +217 -15
- package/components/FieldLabel/{index.1577ac9c.js → index.6b6f708e.js} +4 -4
- package/components/GridLayout/{index.656840a5.js → index.68d907d4.js} +34 -11
- package/components/GridLayout/subcomponents/Griditem/{index.b23625d7.js → index.8955a794.js} +3 -4
- package/components/GridLayout/subcomponents/Responsive/{index.97505a31.js → index.45cecca2.js} +1 -2
- package/components/GridLayout/subcomponents/SizeProvider/{index.36cb4139.js → index.7050ac4f.js} +1 -1
- package/components/HelperText/{index.ebb53dac.js → index.09e80920.js} +1 -1
- package/components/Icon/{index.8ecfb193.js → index.83867398.js} +10 -26
- package/components/Image/{index.4a822ede.js → index.19aa7ff5.js} +3 -2
- package/components/LanguagePopover/index.921efd11.js +188 -0
- package/components/{mui_extended/LinearProgress/index.e9455b2e.js → LinearProgressIndeterminate/index.ea9c8518.js} +4 -9
- package/components/LoadingError/{index.9e829e8d.js → index.aee18b24.js} +11 -7
- package/components/MFLoader/{index.29f445e2.js → index.c975666e.js} +8 -4
- package/components/ModalDialog/{index.96c4aba3.js → index.0dd5af28.js} +14 -5
- package/components/NavLink/{index.9f5d5670.js → index.ad039baf.js} +3 -2
- package/components/NoItemSelected/{index.0ae9f28f.js → index.d10603d7.js} +13 -3
- package/components/ObjectLogs/{index.40c5047f.js → index.a3e42b21.js} +26 -8
- package/components/PDFViewer/{index.651cc4b6.js → index.35f68e67.js} +2 -2
- package/components/Page/{index.1d08818c.js → index.f4755eba.js} +18 -2
- package/components/PaperForm/{index.1a8b10d4.js → index.007ef4cf.js} +2 -2
- package/components/Period/{index.236971ae.js → index.9647181b.js} +15 -54
- package/components/PrintingSystem/{index.9fdae551.js → index.a69a9d85.js} +14 -15
- package/components/PrintingSystem/subcomponents/BodyNode/{index.794dbc69.js → index.528fcfbf.js} +1 -1
- package/components/PrintingSystem/subcomponents/ChartNode/{index.6bbf7d75.js → index.fbe87257.js} +1 -1
- package/components/PrintingSystem/subcomponents/DividerNode/{index.015a2212.js → index.f5adab1d.js} +1 -1
- package/components/PrintingSystem/subcomponents/FooterNode/{index.08eeb1d2.js → index.f42ca7dc.js} +1 -1
- package/components/PrintingSystem/subcomponents/GridNode/{index.23995699.js → index.041b9cff.js} +1 -1
- package/components/PrintingSystem/subcomponents/HeaderNode/{index.3fa36620.js → index.a8140332.js} +1 -1
- package/components/PrintingSystem/subcomponents/PaperNode/{index.8b7d43f4.js → index.aabde2bb.js} +1 -1
- package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.9856c572.js → index.7f75ca46.js} +1 -1
- package/components/PrintingSystem/subcomponents/SectionNode/{index.89b3a4e0.js → index.61babb47.js} +1 -1
- package/components/PrintingSystem/subcomponents/TextBoxNode/{index.dc6e9dc2.js → index.4d0e67a3.js} +1 -1
- package/components/PropertyValue/{index.646a7e8b.js → index.51faabb5.js} +7 -4
- package/components/Resizeable/{index.414ff687.js → index.4f75c0b5.js} +1 -1
- package/components/ScrollBar/{index.1e89bb44.js → index.21bc5025.js} +1 -1
- package/components/SideBar/{index.d221254d.js → index.4075c562.js} +36 -7
- package/components/SplitLayout/{index.7d9edf4e.js → index.15756f0f.js} +3 -1
- package/components/ToastContainer/{index.7f246bbd.js → index.2a7d304e.js} +3 -3
- package/components/animate/variants/index.7a912140.js +1 -0
- package/components/areas/components/AreasAdmin/index.325bac22.js +733 -0
- package/components/areas/components/AreasViewer/index.6e30ec72.js +1072 -0
- package/components/areas/components/index.558684b3.js +1 -0
- package/components/areas/constants.66529246.js +6 -0
- package/components/areas/contexts/AreasContext/{index.0815f278.js → index.3311cbf9.js} +6 -5
- package/components/areas/contexts/DynamicMFParmsContext/{index.37d1d444.js → index.3d9ad0ad.js} +2 -2
- package/components/areas/contexts/WindowToolsMFContext/{index.69d95c15.js → index.992ae7a3.js} +2 -2
- package/components/areas/contexts/index.24025b97.js +1 -0
- package/components/areas/dictionary.08cfc4c9.js +36 -0
- package/components/areas/hooks/index.d9dc1e21.js +1 -0
- package/components/areas/hooks/useAreas/{index.4039e30d.js → index.f81493ef.js} +1 -1
- package/components/areas/hooks/useDynamicMFParameters/{index.03ce6078.js → index.9e09e1e3.js} +1 -1
- package/components/areas/hooks/useWindowToolsMF/{index.09801b66.js → index.2fbae9dc.js} +1 -1
- package/components/areas/icons.8266ccc8.js +26 -0
- package/components/areas/index.4cc6a221.js +22 -0
- package/components/commercial/AppBarCommercial/index.cbd55cf8.js +28 -0
- package/components/commercial/SectionCommercial/index.d22ebbd5.js +57 -0
- package/components/commercial/TopBar/index.410fffa8.js +234 -0
- package/components/{HamburgerMenu/index.6c82741d.js → commercial/index.07638f52.js} +5 -3
- package/components/formatters/BooleanFormatter/index.cbf9cd6e.js +44 -0
- package/components/formatters/DateFormatter/index.2ef6f261.js +43 -0
- package/components/formatters/PointsFormatter/index.d8a4ee54.js +25 -0
- package/components/formatters/PriceFormatter/index.97f75b4b.js +35 -0
- package/components/formatters/UncertaintyFormatter/index.c3ffdebc.js +29 -0
- package/components/formatters/index.63a3e08e.js +117 -0
- package/components/hook-form/HelperError/{index.2ed03a3c.js → index.c0109d5b.js} +1 -1
- package/components/hook-form/RHFAutocomplete/index.2991d444.js +404 -0
- package/components/hook-form/RHFAutocompleteAsync/{index.69f5661d.js → index.d97c727b.js} +2 -3
- package/components/hook-form/RHFCheckbox/{index.13de27db.js → index.b57e3131.js} +4 -4
- package/components/hook-form/RHFColorPicker/{index.66004599.js → index.310f6ff0.js} +6 -6
- package/components/hook-form/RHFDateTime/{index.dfe07e18.js → index.5689a29f.js} +5 -5
- package/components/hook-form/RHFPeriod/{index.d852649b.js → index.019e61ae.js} +4 -4
- package/components/hook-form/RHFTextField/{index.d207efc1.js → index.10e57945.js} +6 -6
- package/components/hook-form/RHFUpload/{index.955a4ba5.js → index.7fd23b2a.js} +5 -5
- package/components/{mui_extended/Tab/index.37d588d6.js → maps/components/GpsTools/index.20f83559.js} +331 -645
- package/components/maps/{index.a1bf63f2.js → components/Map/index.c37f3304.js} +737 -28
- package/components/maps/index.13bb982c.js +7 -0
- package/components/modal/{WindowBase.390b0910.js → WindowBase.cfbb0c9e.js} +4 -4
- package/components/modal/{WindowConfirm.243e1bef.js → WindowConfirm.300bd34b.js} +10 -6
- package/components/modal/{index.5bce430d.js → index.81eb6def.js} +5 -1
- package/components/mui_extended/Accordion/{index.f7a17c83.js → index.0843a609.js} +5 -5
- package/components/mui_extended/Avatar/{index.12b96914.js → index.fb9ad158.js} +1 -1
- package/components/mui_extended/Badge/{index.4737c113.js → index.8beaeefc.js} +1 -1
- package/components/mui_extended/Button/{index.52852c42.js → index.d742e9ee.js} +6 -81
- package/components/mui_extended/{CheckBox/index.01218423.js → CheckBox.21c25705.js} +1 -1
- package/components/mui_extended/IconButton/{index.d5b273e6.js → index.b4532b85.js} +1 -1
- package/components/mui_extended/LinearProgress/index.4092bb69.js +9 -0
- package/components/mui_extended/MenuActions/index.eae97857.js +176 -0
- package/components/mui_extended/Pager/{index.8960227c.js → index.3926c835.js} +22 -40
- package/components/mui_extended/Popover/index.2348fc4f.js +143 -0
- package/components/mui_extended/Tab/index.e911930f.js +135 -0
- package/components/mui_extended/ToggleButton/{index.c441b949.js → index.b834f5f0.js} +1 -1
- package/components/mui_extended/ToggleIconButton/{index.8a84f25e.js → index.fcd5205c.js} +1 -1
- package/components/mui_extended/Typography/{index.463f613f.js → index.642798f1.js} +1 -1
- package/components/mui_extended/index.b606cd9d.js +1 -0
- package/components/popups/PopupsProvider/{index.d4caacc3.js → index.d7c9efce.js} +1 -1
- package/components/popups/PopupsViewer/{index.42312806.js → index.f3677ab1.js} +10 -6
- package/contexts/ModalContext/{index.5f77a463.js → index.ad1fb73b.js} +1 -1
- package/contexts/RHFormContext/{index.95ebabc9.js → index.bf3a2812.js} +6 -2
- package/hooks/useFormAddEdit/{index.ecb77e67.js → index.6d983cd8.js} +6 -2
- package/hooks/useModal/index.2003c854.js +11 -0
- package/hooks/useTab/index.8d1a6e63.js +12 -0
- package/index.js +328 -273
- package/package.json +1 -1
- package/{react-draggable.0cc9b257.js → react-draggable.1c1ba224.js} +1 -1
- package/{react-resizable.837c446d.js → react-resizable.a59c14f4.js} +2 -2
- package/test/constants_no_mock.86c553a9.js +4 -0
- package/test/{getNameDataTestId.aee44365.js → getNameDataTestId.0faeade8.js} +2 -2
- package/utils/{index.c64c2dd1.js → index.14912462.js} +1 -54
- package/components/CommonActions/index.19f39dca.js +0 -170
- package/components/areas/constants.0d3ba950.js +0 -289
- package/components/areas/dictionary.6168209a.js +0 -266
- package/components/areas/icons.504ec098.js +0 -83
- package/components/maps/components/GpsTools/index.01acaf3e.js +0 -251
- package/components/mui_extended/Popover/index.146ded9e.js +0 -1044
- package/hooks/useModal/index.d14c7e46.js +0 -67
- package/vendor.5b266106.js +0 -3952
package/components/{mui_extended/Tab/index.37d588d6.js → maps/components/GpsTools/index.20f83559.js}
RENAMED
|
@@ -1,659 +1,183 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { createContext,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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 { d as useDataGrid, e as useFilters, M as MenuActions, f as ColumnDateFormatter, R as RHFAutocomplete, a as DataGrid } from "../../../vendor.5b266106.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.0d3ba950.js";
|
|
9
|
-
import { useModuleSkeleton, useModuleDictionary, getPropertyByString, useEnvironment, useHostTools, useNetwork, useModulePrivileges, usePaginate } from "@m4l/core";
|
|
10
|
-
import { M as MAP_DICCTIONARY } from "../../areas/dictionary.6168209a.js";
|
|
11
|
-
import { u as useGpsToolsStore, g as gpsToolsClasses, a as useLayers, D as DivGpsToolsRoot } from "../../maps/components/GpsTools/index.01acaf3e.js";
|
|
2
|
+
import { createContext, useRef, useEffect, useContext, useState, useMemo, useCallback } from "react";
|
|
3
|
+
import { useModuleDictionary, useModuleSkeleton, useEnvironment, useHostTools, useNetwork, useModulePrivileges, usePaginate } from "@m4l/core";
|
|
4
|
+
import { u as useMapStore, C as CommonFeatureRender, M as MAP_ZINDEX_OVER_MAP, b as MAP_DICCTIONARY } from "../Map/index.c37f3304.js";
|
|
12
5
|
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";
|
|
13
11
|
import "@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css";
|
|
14
12
|
import "@geoman-io/leaflet-geoman-free";
|
|
13
|
+
import { styled } from "@mui/material/styles";
|
|
14
|
+
import { generateUtilityClasses } from "@mui/material";
|
|
15
|
+
import "@mui/base";
|
|
15
16
|
import clsx from "clsx";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
17
|
+
import { a as DynamicFilter } from "../../../DynamicFilter/index.056a99c7.js";
|
|
18
|
+
import { C as ColumnDateFormatter } from "../../../DataGrid/formatters/ColumnDateFormatter/index.e00d0cf2.js";
|
|
19
19
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
20
|
-
import { H as HelperError } from "
|
|
21
|
-
import { u as usePopupsStore } from "
|
|
22
|
-
import { A as
|
|
23
|
-
import {
|
|
20
|
+
import { H as HelperError } from "../../../hook-form/HelperError/index.c0109d5b.js";
|
|
21
|
+
import { u as usePopupsStore } from "../../../popups/PopupsProvider/index.d7c9efce.js";
|
|
22
|
+
import { A as ActionFormIntro } from "../../../CommonActions/components/ActionFormIntro/index.34d569d1.js";
|
|
23
|
+
import { A as Actions } from "../../../CommonActions/components/Actions/index.258bf919.js";
|
|
24
|
+
import { B as Button } from "../../../mui_extended/Button/index.d742e9ee.js";
|
|
24
25
|
import { useMap } from "react-leaflet";
|
|
25
|
-
import { u as useFormReadyForUpdate } from "
|
|
26
|
+
import { u as useFormReadyForUpdate } from "../../../../hooks/useFormReadyForUpdate/index.f60f500e.js";
|
|
26
27
|
import * as L from "leaflet";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { a as
|
|
35
|
-
import { T as Tooltip } from "
|
|
28
|
+
import { u as useTab } from "../../../../hooks/useTab/index.8d1a6e63.js";
|
|
29
|
+
import { P as PaperForm } from "../../../PaperForm/index.007ef4cf.js";
|
|
30
|
+
import { R as RHFAutocomplete } from "../../../hook-form/RHFAutocomplete/index.2991d444.js";
|
|
31
|
+
import { R as RHFTextField } from "../../../hook-form/RHFTextField/index.10e57945.js";
|
|
32
|
+
import { S as Stack } from "../../../mui_extended/Stack/index.fe363ca5.js";
|
|
33
|
+
import { P as PropertyValue } from "../../../PropertyValue/index.51faabb5.js";
|
|
34
|
+
import { R as RHFColorPicker } from "../../../hook-form/RHFColorPicker/index.310f6ff0.js";
|
|
35
|
+
import { T as Tabs, a as Tab, b as TabContent, c as TabProvider } from "../../../mui_extended/Tab/index.e911930f.js";
|
|
36
|
+
import { T as Tooltip } from "../../../mui_extended/Tooltip/index.49bb5ee1.js";
|
|
36
37
|
import * as Yup from "yup";
|
|
37
|
-
import { R as RHFormProvider } from "
|
|
38
|
-
import { u as useFormAddEdit } from "
|
|
39
|
-
import { u as useModal } from "
|
|
40
|
-
import { W as WindowConfirm } from "
|
|
41
|
-
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
const composedClasses = unstable_composeClasses(slots, getTabsUtilityClass, {});
|
|
54
|
-
return {
|
|
55
|
-
...composedClasses
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
const MUITabs = styled(Tabs$1)(({ theme }) => ({
|
|
59
|
-
...theme.components?.M4LTabs?.styleOverrides
|
|
60
|
-
}));
|
|
61
|
-
const Tabs = (props) => {
|
|
62
|
-
const { children, className, ...others } = props;
|
|
63
|
-
const classes = useTabsUtilityClasses();
|
|
64
|
-
return /* @__PURE__ */ jsx(MUITabs, { className: clsx(classes.root, className), ...others, children });
|
|
65
|
-
};
|
|
66
|
-
const componentName$1 = "M4LTabContent";
|
|
67
|
-
generateUtilityClasses(componentName$1, [
|
|
68
|
-
"root"
|
|
69
|
-
]);
|
|
70
|
-
function getTabContentUtilityClass(slot) {
|
|
71
|
-
return generateUtilityClass(componentName$1, slot);
|
|
72
|
-
}
|
|
73
|
-
const useTabContentUtilityClasses = () => {
|
|
74
|
-
const slots = {
|
|
75
|
-
root: ["root"]
|
|
76
|
-
};
|
|
77
|
-
const composedClasses = unstable_composeClasses(slots, getTabContentUtilityClass, {});
|
|
78
|
-
return {
|
|
79
|
-
...composedClasses
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
const TabContentRoot = styled("div")(({ theme }) => ({
|
|
83
|
-
...theme.components?.M4LTabContent?.styleOverrides
|
|
84
|
-
}));
|
|
85
|
-
const TabContent = (props) => {
|
|
86
|
-
const { children, className, ...others } = props;
|
|
87
|
-
const classes = useTabContentUtilityClasses();
|
|
88
|
-
return /* @__PURE__ */ jsx(TabContentRoot, { className: clsx(classes.root, className), ...others, children });
|
|
89
|
-
};
|
|
90
|
-
const TabRoot = styled$1("div")(({ theme }) => ({
|
|
91
|
-
...theme.components?.M4LTab?.styleOverrides
|
|
92
|
-
}));
|
|
93
|
-
const SKTTabWrapper = styled$1("div")(({ theme }) => ({
|
|
94
|
-
padding: theme.spacing(1.5, 2)
|
|
95
|
-
}));
|
|
96
|
-
const componentName = "M4LTab";
|
|
97
|
-
generateUtilityClasses(componentName, [
|
|
98
|
-
"root",
|
|
99
|
-
"skeleton"
|
|
100
|
-
]);
|
|
101
|
-
function getTabUtilityClass(slot) {
|
|
102
|
-
return generateUtilityClass(componentName, slot);
|
|
103
|
-
}
|
|
104
|
-
const tabUtilityClasses = () => {
|
|
105
|
-
const slots = {
|
|
106
|
-
root: ["root"],
|
|
107
|
-
skeleton: ["skeleton"]
|
|
108
|
-
};
|
|
109
|
-
const composedClasses = unstable_composeClasses(slots, getTabUtilityClass, {});
|
|
110
|
-
return {
|
|
111
|
-
...composedClasses
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
const COMPONENT_PREFIX = "m4l-tab";
|
|
115
|
-
function Tab(props) {
|
|
116
|
-
const { SKTWidth, SKTHeight, className, dataTestId = "", ...other } = props;
|
|
117
|
-
const isSkeleton = useModuleSkeleton();
|
|
118
|
-
const classes = tabUtilityClasses();
|
|
119
|
-
return /* @__PURE__ */ jsx(
|
|
120
|
-
TabRoot,
|
|
121
|
-
{
|
|
122
|
-
className: clsx(classes.root, className),
|
|
123
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
124
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "root", dataTestId)
|
|
125
|
-
} : {},
|
|
126
|
-
children: !isSkeleton ? /* @__PURE__ */ jsx(Tab$1, { ...other }) : /* @__PURE__ */ jsx(
|
|
127
|
-
SKTTabWrapper,
|
|
128
|
-
{
|
|
129
|
-
className: classes.skeleton,
|
|
130
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
131
|
-
[TEST_PROP_ID]: getNameDataTestId(
|
|
132
|
-
COMPONENT_PREFIX,
|
|
133
|
-
"skeleton",
|
|
134
|
-
dataTestId
|
|
135
|
-
)
|
|
136
|
-
} : {},
|
|
137
|
-
children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: SKTWidth, height: SKTHeight })
|
|
138
|
-
}
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
const TabContext = createContext(null);
|
|
144
|
-
function TabProvider(props) {
|
|
145
|
-
const { children, initialValue } = props;
|
|
146
|
-
const [currentTab, setCurrentTab] = useState(initialValue);
|
|
147
|
-
const handleChange = (_event, newTab) => {
|
|
148
|
-
setCurrentTab(newTab);
|
|
149
|
-
};
|
|
150
|
-
return /* @__PURE__ */ jsx(
|
|
151
|
-
TabContext.Provider,
|
|
152
|
-
{
|
|
153
|
-
value: {
|
|
154
|
-
currentTab: currentTab.toString(),
|
|
155
|
-
handleChange
|
|
156
|
-
},
|
|
157
|
-
children
|
|
158
|
-
}
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
const useTab = () => {
|
|
162
|
-
const context = useContext(TabContext);
|
|
163
|
-
if (context === null) {
|
|
164
|
-
throw new Error("useTab must be used within a TabProvider");
|
|
165
|
-
}
|
|
166
|
-
return context;
|
|
167
|
-
};
|
|
168
|
-
function CheckboxIcon(props) {
|
|
169
|
-
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" }) });
|
|
170
|
-
}
|
|
171
|
-
function CheckboxCheckedIcon(props) {
|
|
172
|
-
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" }) });
|
|
173
|
-
}
|
|
174
|
-
function CheckboxIndeterminateIcon(props) {
|
|
175
|
-
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" }) });
|
|
176
|
-
}
|
|
177
|
-
const CheckboxFormatter = forwardRef(
|
|
178
|
-
function CheckboxFormatter2({ onChange, checked, ...props }, _ref) {
|
|
179
|
-
function handleChange(e) {
|
|
180
|
-
onChange(e.target.checked, e.nativeEvent.shiftKey);
|
|
181
|
-
}
|
|
182
|
-
return /* @__PURE__ */ jsx(
|
|
183
|
-
Checkbox,
|
|
184
|
-
{
|
|
185
|
-
checked,
|
|
186
|
-
size: "small",
|
|
187
|
-
icon: /* @__PURE__ */ jsx(CheckboxIcon, {}),
|
|
188
|
-
checkedIcon: /* @__PURE__ */ jsx(CheckboxCheckedIcon, {}),
|
|
189
|
-
indeterminateIcon: /* @__PURE__ */ jsx(CheckboxIndeterminateIcon, {}),
|
|
190
|
-
onChange: handleChange,
|
|
191
|
-
...props
|
|
192
|
-
}
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
);
|
|
196
|
-
const filterColumnClassName = "filter-cell";
|
|
197
|
-
const filterHeight = 35;
|
|
198
|
-
function SelectGroupFormatter(props) {
|
|
199
|
-
const [isRowSelected, onRowSelectionChange] = useRowSelection();
|
|
200
|
-
const onChange = (checked) => {
|
|
201
|
-
onRowSelectionChange({ row: props.row, checked, isShiftClick: false });
|
|
202
|
-
};
|
|
203
|
-
const cellFormater = SelectCellFormatter({
|
|
204
|
-
value: isRowSelected,
|
|
205
|
-
isCellSelected: props.isCellSelected,
|
|
206
|
-
onChange,
|
|
207
|
-
"aria-label": "Select Group"
|
|
208
|
-
});
|
|
209
|
-
return cellFormater;
|
|
210
|
-
}
|
|
211
|
-
function SelectFormatter(props) {
|
|
212
|
-
const { checkedRows, onCheckedRowsChange, rowKeyGetter } = useDataGrid();
|
|
213
|
-
const onChange = (checked, _isShiftClick) => {
|
|
214
|
-
const newCheckedRows = new Set(checkedRows);
|
|
215
|
-
if (checked) {
|
|
216
|
-
newCheckedRows.add(rowKeyGetter(props.row));
|
|
217
|
-
} else {
|
|
218
|
-
newCheckedRows.delete(rowKeyGetter(props.row));
|
|
219
|
-
}
|
|
220
|
-
onCheckedRowsChange && onCheckedRowsChange(newCheckedRows);
|
|
221
|
-
};
|
|
222
|
-
return /* @__PURE__ */ jsx(
|
|
223
|
-
SelectCellFormatter,
|
|
224
|
-
{
|
|
225
|
-
value: checkedRows?.has(rowKeyGetter(props.row)) || false,
|
|
226
|
-
isCellSelected: props.isCellSelected,
|
|
227
|
-
onChange,
|
|
228
|
-
"aria-label": "Select"
|
|
229
|
-
}
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
const SelectColumnHeaderRenderer = (props) => {
|
|
233
|
-
const { rows, rowKeyGetter, onCheckedRowsChange, checkedRows } = useDataGrid();
|
|
234
|
-
const onAllRowsCheckedChange = (checked) => {
|
|
235
|
-
if (!onCheckedRowsChange)
|
|
236
|
-
return;
|
|
237
|
-
if (checked) {
|
|
238
|
-
onCheckedRowsChange(new Set(rows.map((r) => rowKeyGetter(r))));
|
|
239
|
-
} else {
|
|
240
|
-
onCheckedRowsChange(/* @__PURE__ */ new Set());
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
const allRowsChecked = rows.length === checkedRows?.size;
|
|
244
|
-
return SelectCellFormatter({
|
|
245
|
-
"aria-label": "Select All",
|
|
246
|
-
isCellSelected: props.isCellSelected,
|
|
247
|
-
value: allRowsChecked,
|
|
248
|
-
onChange: onAllRowsCheckedChange
|
|
249
|
-
});
|
|
250
|
-
};
|
|
251
|
-
const SelectColumn = {
|
|
252
|
-
key: DATAGRID_SELECT_COLUMN_KEY,
|
|
253
|
-
name: "",
|
|
254
|
-
width: 32,
|
|
255
|
-
minWidth: 32,
|
|
256
|
-
isDraggable: false,
|
|
257
|
-
resizable: false,
|
|
258
|
-
sortable: false,
|
|
259
|
-
frozen: true,
|
|
260
|
-
type: "boolean",
|
|
261
|
-
headerRenderer: SelectColumnHeaderRenderer,
|
|
262
|
-
formatter: SelectFormatter,
|
|
263
|
-
groupFormatter: SelectGroupFormatter
|
|
264
|
-
};
|
|
265
|
-
function useFocusRef(isSelected) {
|
|
266
|
-
const ref = useRef(null);
|
|
267
|
-
useLayoutEffect(() => {
|
|
268
|
-
if (!isSelected)
|
|
269
|
-
return;
|
|
270
|
-
ref.current?.focus({ preventScroll: true });
|
|
271
|
-
}, [isSelected]);
|
|
272
|
-
return {
|
|
273
|
-
ref,
|
|
274
|
-
tabIndex: isSelected ? 0 : -1
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function DraggableHeaderRenderer(props) {
|
|
278
|
-
const { onColumnsReorder, column, isCellSelected, ...others } = props;
|
|
279
|
-
const { ref, tabIndex } = useFocusRef(isCellSelected);
|
|
280
|
-
const { getLabel } = useModuleDictionary();
|
|
281
|
-
const { activeFilters, filters, onChangeFilter } = useFilters();
|
|
282
|
-
const [filter, setFilter] = useState(filters?.get(column.key) || "");
|
|
283
|
-
const [{ isDragging }, drag] = useDrag({
|
|
284
|
-
type: "COLUMN_DRAG",
|
|
285
|
-
item: { key: column.key },
|
|
286
|
-
collect: (monitor) => ({
|
|
287
|
-
isDragging: monitor.isDragging()
|
|
288
|
-
})
|
|
289
|
-
});
|
|
290
|
-
const [{ isOver }, drop] = useDrop({
|
|
291
|
-
accept: "COLUMN_DRAG",
|
|
292
|
-
drop({ key }) {
|
|
293
|
-
onColumnsReorder(key, column.key);
|
|
38
|
+
import { R as RHFormProvider } from "../../../../contexts/RHFormContext/index.bf3a2812.js";
|
|
39
|
+
import { u as useFormAddEdit } from "../../../../hooks/useFormAddEdit/index.6d983cd8.js";
|
|
40
|
+
import { u as useModal } from "../../../../hooks/useModal/index.2003c854.js";
|
|
41
|
+
import { W as WindowConfirm } from "../../../modal/WindowConfirm.300bd34b.js";
|
|
42
|
+
import { c as DataGrid } from "../../../DataGrid/index.68e19254.js";
|
|
43
|
+
enableMapSet();
|
|
44
|
+
const createGpsToolsStore = (initProps) => {
|
|
45
|
+
const startProps = {
|
|
46
|
+
currentTabGpsTool: "geofences",
|
|
47
|
+
geofenceState: {
|
|
48
|
+
rows: [],
|
|
49
|
+
checkedGeofences: /* @__PURE__ */ new Set(),
|
|
50
|
+
checkedCrossingFeatures: /* @__PURE__ */ new Set(),
|
|
51
|
+
checkedInternalFeatures: /* @__PURE__ */ new Set(),
|
|
52
|
+
hashGeofences: {}
|
|
294
53
|
},
|
|
295
|
-
|
|
296
|
-
isOver: monitor.isOver(),
|
|
297
|
-
canDrop: monitor.canDrop()
|
|
298
|
-
})
|
|
299
|
-
});
|
|
300
|
-
const handleChange = (e) => {
|
|
301
|
-
if (activeFilters) {
|
|
302
|
-
if (onChangeFilter)
|
|
303
|
-
onChangeFilter(column, e.target.value);
|
|
304
|
-
}
|
|
305
|
-
setFilter(e.target.value);
|
|
54
|
+
...initProps
|
|
306
55
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
)
|
|
56
|
+
return createStore(
|
|
57
|
+
devtools(
|
|
58
|
+
immer((set, _get) => ({
|
|
59
|
+
...startProps,
|
|
60
|
+
gpsToolsActions: {
|
|
61
|
+
init: () => {
|
|
62
|
+
set((state) => {
|
|
63
|
+
state.ownerState.status = "ready";
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
setGpsToolsState: (status) => {
|
|
67
|
+
set((state) => {
|
|
68
|
+
state.ownerState.status = status;
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
setHandlerGetLabel: (newHandler) => {
|
|
72
|
+
set((state) => {
|
|
73
|
+
state.getLabel = newHandler;
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
setExternalState: (newExternalState) => {
|
|
77
|
+
set((state) => {
|
|
78
|
+
state.ownerState = { ...state.ownerState, ...newExternalState };
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
setCurrentTabTool: (newTabTool) => {
|
|
82
|
+
set((state) => {
|
|
83
|
+
state.currentTabGpsTool = newTabTool;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
geofenceActions: {
|
|
88
|
+
addGeofence: (geofenceId, geofence) => {
|
|
89
|
+
set((state) => {
|
|
90
|
+
state.geofenceState.hashGeofences[geofenceId] = geofence;
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
updatePartialGeofence: (geofenceId, geofence) => {
|
|
94
|
+
set((state) => {
|
|
95
|
+
state.geofenceState.hashGeofences[geofenceId] = {
|
|
96
|
+
...state.geofenceState.hashGeofences[geofenceId],
|
|
97
|
+
...geofence
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
updateRows: (newRows) => {
|
|
102
|
+
set((state) => {
|
|
103
|
+
state.geofenceState.rows = newRows;
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
addCheckedGeofence: (geofenceId) => {
|
|
107
|
+
set((state) => {
|
|
108
|
+
state.geofenceState.checkedGeofences.add(geofenceId);
|
|
109
|
+
state.geofenceState.checkedGeofences = new Set(state.geofenceState.checkedGeofences);
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
removeCheckedGeofence: (geofenceId) => {
|
|
113
|
+
set((state) => {
|
|
114
|
+
state.geofenceState.checkedGeofences.delete(geofenceId);
|
|
115
|
+
state.geofenceState.checkedGeofences = new Set(state.geofenceState.checkedGeofences);
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
setCheckedGeofences: (newGeofences) => {
|
|
119
|
+
set((state) => {
|
|
120
|
+
state.geofenceState.checkedGeofences = new Set(newGeofences);
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
setCheckedCrossingFeatures: (newFeatures) => {
|
|
124
|
+
set((state) => {
|
|
125
|
+
state.geofenceState.checkedCrossingFeatures = new Set(newFeatures);
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
setCheckedInternalFeatures: (newFeatures) => {
|
|
129
|
+
set((state) => {
|
|
130
|
+
state.geofenceState.checkedInternalFeatures = new Set(newFeatures);
|
|
131
|
+
});
|
|
362
132
|
}
|
|
363
|
-
)
|
|
364
|
-
]
|
|
365
|
-
}
|
|
366
|
-
);
|
|
367
|
-
}
|
|
368
|
-
const getDragHeaderRenderer = (handleColumnsReorder) => {
|
|
369
|
-
function HeaderRenderer2(props) {
|
|
370
|
-
return /* @__PURE__ */ jsx(DraggableHeaderRenderer, { ...props, onColumnsReorder: handleColumnsReorder });
|
|
371
|
-
}
|
|
372
|
-
return HeaderRenderer2;
|
|
373
|
-
};
|
|
374
|
-
function ActionsFormatter(props) {
|
|
375
|
-
const { rowActionsGetter, classes } = useDataGrid();
|
|
376
|
-
const theme = useTheme();
|
|
377
|
-
if (rowActionsGetter === void 0) {
|
|
378
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
379
|
-
}
|
|
380
|
-
return /* @__PURE__ */ jsx(
|
|
381
|
-
MenuActions,
|
|
382
|
-
{
|
|
383
|
-
arrowType: "top-left",
|
|
384
|
-
objItem: props.row,
|
|
385
|
-
menuActions: rowActionsGetter,
|
|
386
|
-
className: classes.actionsFormatter,
|
|
387
|
-
menuActionSx: theme.components?.M4LDataGridActionsFormatter?.styleOverrides,
|
|
388
|
-
marginTop: 1,
|
|
389
|
-
marginLeft: "-11px",
|
|
390
|
-
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
391
|
-
transformOrigin: { vertical: "top", horizontal: "left" }
|
|
392
|
-
}
|
|
393
|
-
);
|
|
394
|
-
}
|
|
395
|
-
const ActionsColumn = {
|
|
396
|
-
key: DATAGRID_ACTIONS_COLUMN_KEY,
|
|
397
|
-
name: getActionLabel(),
|
|
398
|
-
width: 32,
|
|
399
|
-
minWidth: 32,
|
|
400
|
-
isDraggable: false,
|
|
401
|
-
withFilter: false,
|
|
402
|
-
resizable: true,
|
|
403
|
-
sortable: false,
|
|
404
|
-
frozen: true,
|
|
405
|
-
type: "custom",
|
|
406
|
-
formatter: ActionsFormatter
|
|
407
|
-
};
|
|
408
|
-
function getActionLabel() {
|
|
409
|
-
return "";
|
|
410
|
-
}
|
|
411
|
-
const WrapperSkeleton = styled("div")(() => ({
|
|
412
|
-
display: "flex",
|
|
413
|
-
width: "100%",
|
|
414
|
-
height: "100%",
|
|
415
|
-
alignItems: "center"
|
|
416
|
-
}));
|
|
417
|
-
function SkeletonFormatter() {
|
|
418
|
-
const { classes } = useDataGrid();
|
|
419
|
-
return /* @__PURE__ */ jsx(WrapperSkeleton, { className: classes.skeletonFormatter, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "100%", height: "12px" }) });
|
|
420
|
-
}
|
|
421
|
-
function getComparator(columns, sortColumn) {
|
|
422
|
-
const column = columns.find((d) => d.key === sortColumn);
|
|
423
|
-
let typeOrder = "string";
|
|
424
|
-
if (column) {
|
|
425
|
-
typeOrder = column.type || "string";
|
|
426
|
-
}
|
|
427
|
-
switch (typeOrder) {
|
|
428
|
-
case "number":
|
|
429
|
-
return (a, b) => {
|
|
430
|
-
try {
|
|
431
|
-
return Number(a[sortColumn]) - Number(b[sortColumn]);
|
|
432
|
-
} catch (error) {
|
|
433
|
-
return -1;
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
default:
|
|
437
|
-
return (a, b) => {
|
|
438
|
-
try {
|
|
439
|
-
return a[sortColumn].toString().localeCompare(b[sortColumn].toString());
|
|
440
|
-
} catch (error) {
|
|
441
|
-
return -1;
|
|
442
133
|
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
const getInOrderColumns = (columns, hasCheckedRows, columnsConfig, columnsWidths, rowActionsGetter) => {
|
|
448
|
-
let filteredSortedColumns = columns.filter((column) => {
|
|
449
|
-
const columnConfigIndex = getColumIndex(column.key, columnsConfig);
|
|
450
|
-
const visible = columnConfigIndex > -1 ? columnsConfig[columnConfigIndex].visible : true;
|
|
451
|
-
return !column.hidden && visible;
|
|
452
|
-
}).sort(
|
|
453
|
-
(a, b) => getColumIndex(a.key, columnsConfig) - getColumIndex(b.key, columnsConfig)
|
|
454
|
-
).map((columnSorted) => {
|
|
455
|
-
const columnConfigIndex = getColumIndex(columnSorted.key, columnsConfig);
|
|
456
|
-
return {
|
|
457
|
-
...columnSorted,
|
|
458
|
-
frozen: columnConfigIndex > -1 ? columnsConfig[columnConfigIndex].frozen : true,
|
|
459
|
-
width: typeof columnsWidths.get(columnSorted.key) === "number" ? columnsWidths.get(columnSorted.key) : columnSorted.width
|
|
460
|
-
};
|
|
461
|
-
}).sort((a, b) => {
|
|
462
|
-
const order = (a.frozen === void 0 || a.frozen === false) === (b.frozen === void 0 || b.frozen === false) ? 0 : a.frozen ? -1 : 1;
|
|
463
|
-
return order;
|
|
464
|
-
});
|
|
465
|
-
if (rowActionsGetter) {
|
|
466
|
-
filteredSortedColumns = [ActionsColumn, ...filteredSortedColumns];
|
|
467
|
-
}
|
|
468
|
-
if (hasCheckedRows) {
|
|
469
|
-
filteredSortedColumns = [SelectColumn, ...filteredSortedColumns];
|
|
470
|
-
}
|
|
471
|
-
return filteredSortedColumns;
|
|
472
|
-
};
|
|
473
|
-
const getAligByType = (columnType) => {
|
|
474
|
-
switch (columnType) {
|
|
475
|
-
case "string":
|
|
476
|
-
return "left";
|
|
477
|
-
case "date":
|
|
478
|
-
case "boolean":
|
|
479
|
-
case "custom":
|
|
480
|
-
return "center";
|
|
481
|
-
case "number":
|
|
482
|
-
return "right";
|
|
483
|
-
}
|
|
484
|
-
return "left";
|
|
134
|
+
})),
|
|
135
|
+
{ name: `Map Tools Store` }
|
|
136
|
+
)
|
|
137
|
+
);
|
|
485
138
|
};
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
rowActionsGetter,
|
|
492
|
-
checkedRows,
|
|
493
|
-
onCheckedRowsChange
|
|
494
|
-
} = useDataGrid();
|
|
495
|
-
const [columns, setColumns] = useState(() => []);
|
|
496
|
-
const [sortColumns, setSortColumns] = useState([]);
|
|
139
|
+
const GpsToolsContext = createContext(null);
|
|
140
|
+
function GpsToolsProvider(props) {
|
|
141
|
+
const { children } = props;
|
|
142
|
+
const { getLabel } = useModuleDictionary();
|
|
143
|
+
const isDesktop = useResponsiveDesktop();
|
|
497
144
|
const isSkeleton = useModuleSkeleton();
|
|
498
|
-
const
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
columnsConfig,
|
|
509
|
-
columnsWidths,
|
|
510
|
-
rowActionsGetter
|
|
511
|
-
)
|
|
512
|
-
);
|
|
513
|
-
const finalSortedColumns = sortColumns.filter(
|
|
514
|
-
(sortColumn) => findKeyInColumns(sortColumn.columnKey, sourceColumns)
|
|
515
|
-
);
|
|
516
|
-
if (JSON.stringify(finalSortedColumns) !== JSON.stringify(sortColumns)) {
|
|
517
|
-
setSortColumns(finalSortedColumns);
|
|
518
|
-
}
|
|
519
|
-
}, [sourceColumns, columnsConfig, rowActionsGetter]);
|
|
520
|
-
const finalColumns = useMemo(() => {
|
|
521
|
-
const DragAndDropHeaderRenderer = getDragHeaderRenderer(onChangeColumnsOrder);
|
|
522
|
-
return columns.map((c) => {
|
|
523
|
-
const newColumn = {
|
|
524
|
-
...c,
|
|
525
|
-
cellClass: c.align !== void 0 ? `rdg-cell-align-${c.align}` : `rdg-cell-align-${getAligByType(c.type)}`
|
|
526
|
-
};
|
|
527
|
-
if (newColumn.key === DATAGRID_SELECT_COLUMN_KEY || newColumn.isDraggable !== void 0 && newColumn.isDraggable === false) {
|
|
528
|
-
return newColumn;
|
|
529
|
-
}
|
|
530
|
-
if (isSkeleton) {
|
|
531
|
-
newColumn.headerRenderer = SkeletonFormatter;
|
|
532
|
-
newColumn.formatter = SkeletonFormatter;
|
|
533
|
-
}
|
|
534
|
-
if (newColumn.headerRenderer) {
|
|
535
|
-
newColumn.withinHeaderRenderer = newColumn.headerRenderer;
|
|
536
|
-
}
|
|
537
|
-
if ((newColumn?.withFilter === void 0 || newColumn.withFilter === true) && activeFilters) {
|
|
538
|
-
newColumn.headerCellClass = filterColumnClassName;
|
|
539
|
-
}
|
|
540
|
-
newColumn.headerRenderer = DragAndDropHeaderRenderer;
|
|
541
|
-
return newColumn;
|
|
542
|
-
});
|
|
543
|
-
}, [isSkeleton, columns, activeFilters, onChangeColumnsOrder]);
|
|
544
|
-
const finalRows = useMemo(() => {
|
|
545
|
-
const nextRows = sourceRows.filter((r) => {
|
|
546
|
-
if (!filters || filters.size === 0)
|
|
547
|
-
return true;
|
|
548
|
-
const iterator = filters.entries();
|
|
549
|
-
let valReturn = true;
|
|
550
|
-
for (let i = 0; i < filters.size; i++) {
|
|
551
|
-
const entry = iterator.next().value;
|
|
552
|
-
const columnKey = entry[0];
|
|
553
|
-
const columnFilter = entry[1];
|
|
554
|
-
let valCell;
|
|
555
|
-
const valueMaybeString = getPropertyByString(r, columnKey);
|
|
556
|
-
let fixedValue;
|
|
557
|
-
if (typeof valueMaybeString === "string") {
|
|
558
|
-
fixedValue = valueMaybeString;
|
|
559
|
-
} else {
|
|
560
|
-
fixedValue = "";
|
|
561
|
-
}
|
|
562
|
-
try {
|
|
563
|
-
if (columnFilter.customFilter) {
|
|
564
|
-
valReturn = valReturn && columnFilter.customFilter(r, columnFilter.value);
|
|
565
|
-
} else {
|
|
566
|
-
valCell = fixedValue;
|
|
567
|
-
valReturn = valReturn && valCell.includes(columnFilter.value);
|
|
568
|
-
}
|
|
569
|
-
} catch (error) {
|
|
570
|
-
continue;
|
|
571
|
-
}
|
|
572
|
-
if (!valReturn)
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
return valReturn;
|
|
576
|
-
});
|
|
577
|
-
if (sortColumns.length === 0) {
|
|
578
|
-
return nextRows;
|
|
579
|
-
}
|
|
580
|
-
nextRows.sort((a, b) => {
|
|
581
|
-
for (const sort of sortColumns) {
|
|
582
|
-
const comparator = getComparator(columns, sort.columnKey);
|
|
583
|
-
const compResult = comparator(a, b);
|
|
584
|
-
if (compResult !== 0) {
|
|
585
|
-
return sort.direction === "ASC" ? compResult : -compResult;
|
|
586
|
-
}
|
|
145
|
+
const isFirstRender = useFirstRender([getLabel]);
|
|
146
|
+
const mapStoreRef = useRef();
|
|
147
|
+
if (!mapStoreRef.current) {
|
|
148
|
+
mapStoreRef.current = createGpsToolsStore({
|
|
149
|
+
getLabel,
|
|
150
|
+
ownerState: {
|
|
151
|
+
status: "init",
|
|
152
|
+
isMobile: !isDesktop,
|
|
153
|
+
isSkeleton,
|
|
154
|
+
focus: false
|
|
587
155
|
}
|
|
588
|
-
return 0;
|
|
589
156
|
});
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
const { columns, rows, onRowsChange, rowKeyGetter, selectedRows, onSelectedRowsChange } = props;
|
|
596
|
-
const { finalColumns, sortColumns, setSortColumns, finalRows } = useSortColumnsRows(
|
|
597
|
-
columns,
|
|
598
|
-
rows
|
|
157
|
+
}
|
|
158
|
+
const { setHandlerGetLabel, setExternalState } = useStore(
|
|
159
|
+
mapStoreRef.current,
|
|
160
|
+
(state) => state.gpsToolsActions,
|
|
161
|
+
shallow
|
|
599
162
|
);
|
|
600
|
-
const { activeFilters } = useFilters();
|
|
601
|
-
const { onChangeColumnWidth, setRowsCount, currentRowHeight, currentRowHeaderHeight, classes } = useDataGrid();
|
|
602
|
-
const ref_data_grid = useRef(null);
|
|
603
|
-
const onRowClick = (row) => {
|
|
604
|
-
if (selectedRows && onSelectedRowsChange) {
|
|
605
|
-
if (selectedRows.entries().next().value) {
|
|
606
|
-
if (selectedRows.entries().next().value[1] === rowKeyGetter(row)) {
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
const mySet = /* @__PURE__ */ new Set([rowKeyGetter(row)]);
|
|
611
|
-
onSelectedRowsChange(mySet);
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
163
|
useEffect(() => {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
const index = sortColumns.findIndex((sortColumn) => column.key === sortColumn.columnKey);
|
|
618
|
-
if (index !== -1) {
|
|
619
|
-
ref_data_grid.current?.element?.querySelector(`[role="columnheader"][aria-colindex="${columnIndice + 1}"]`)?.setAttribute("aria-columnsort", `${sortColumns[index].direction}`);
|
|
620
|
-
} else {
|
|
621
|
-
ref_data_grid.current?.element?.querySelector(`[role="columnheader"][aria-colindex="${columnIndice + 1}"]`)?.removeAttribute("aria-columnsort");
|
|
622
|
-
}
|
|
623
|
-
columnIndice++;
|
|
164
|
+
if (!isFirstRender) {
|
|
165
|
+
setHandlerGetLabel(getLabel);
|
|
624
166
|
}
|
|
625
|
-
}, [
|
|
167
|
+
}, [getLabel]);
|
|
626
168
|
useEffect(() => {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
const onColumnResize = (idx, width) => {
|
|
630
|
-
onChangeColumnWidth(finalColumns[idx].key, width);
|
|
631
|
-
};
|
|
632
|
-
const onChangeSort = (newSortColumns) => {
|
|
633
|
-
setSortColumns(newSortColumns);
|
|
634
|
-
};
|
|
635
|
-
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(
|
|
636
|
-
DataGrid$1,
|
|
637
|
-
{
|
|
638
|
-
className: "fill-grid rdg-light",
|
|
639
|
-
ref: ref_data_grid,
|
|
640
|
-
headerRowHeight: activeFilters ? currentRowHeaderHeight + filterHeight : currentRowHeaderHeight,
|
|
641
|
-
columns: finalColumns,
|
|
642
|
-
sortColumns,
|
|
643
|
-
onSortColumnsChange: onChangeSort,
|
|
644
|
-
onColumnResize,
|
|
645
|
-
rows: finalRows,
|
|
646
|
-
onRowsChange,
|
|
647
|
-
selectedRows,
|
|
648
|
-
onSelectedRowsChange,
|
|
649
|
-
onRowClick,
|
|
650
|
-
rowHeight: currentRowHeight,
|
|
651
|
-
rowKeyGetter,
|
|
652
|
-
cellNavigationMode: "LOOP_OVER_ROW",
|
|
653
|
-
components: { checkboxFormatter: CheckboxFormatter },
|
|
654
|
-
defaultColumnOptions: { resizable: true, sortable: true }
|
|
169
|
+
if (isFirstRender) {
|
|
170
|
+
return;
|
|
655
171
|
}
|
|
656
|
-
|
|
172
|
+
setExternalState({ isMobile: !isDesktop, isSkeleton });
|
|
173
|
+
}, [isDesktop, isSkeleton]);
|
|
174
|
+
return /* @__PURE__ */ jsx(GpsToolsContext.Provider, { value: mapStoreRef.current, children });
|
|
175
|
+
}
|
|
176
|
+
function useGpsToolsStore(selector, equalityFn) {
|
|
177
|
+
const context = useContext(GpsToolsContext);
|
|
178
|
+
if (!context)
|
|
179
|
+
throw new Error("useGpsToolsStore context must be use inside GpsToolsContext");
|
|
180
|
+
return useStore(context, selector, equalityFn);
|
|
657
181
|
}
|
|
658
182
|
const ENDPOINT_GEOFENCE_GET = "geofences";
|
|
659
183
|
const ENDPOINT_GEOFENCE_NEW_EDIT = "geofences";
|
|
@@ -663,6 +187,170 @@ var GeofencesFeaturesLayers = /* @__PURE__ */ ((GeofencesFeaturesLayers2) => {
|
|
|
663
187
|
GeofencesFeaturesLayers2["LAYER_GEOFENCES_INTERNAL_FEATURES"] = "geofencesInternalFeatures";
|
|
664
188
|
return GeofencesFeaturesLayers2;
|
|
665
189
|
})(GeofencesFeaturesLayers || {});
|
|
190
|
+
function useLayers() {
|
|
191
|
+
const { addLayer, removeLayer } = useMapStore((state) => state.mapActions, shallow);
|
|
192
|
+
const { init } = useGpsToolsStore((state) => state.gpsToolsActions, shallow);
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
addLayer({
|
|
195
|
+
layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES,
|
|
196
|
+
name: "Geocercas",
|
|
197
|
+
renderFeature: CommonFeatureRender,
|
|
198
|
+
geoJsonObject: {
|
|
199
|
+
object: {
|
|
200
|
+
type: "FeatureCollection",
|
|
201
|
+
features: []
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
autoFocus: false
|
|
205
|
+
});
|
|
206
|
+
addLayer({
|
|
207
|
+
layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES,
|
|
208
|
+
name: "Geometr\xEDas de tr\xE1nsito",
|
|
209
|
+
renderFeature: CommonFeatureRender,
|
|
210
|
+
geoJsonObject: {
|
|
211
|
+
object: {
|
|
212
|
+
type: "FeatureCollection",
|
|
213
|
+
features: []
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
autoFocus: false
|
|
217
|
+
});
|
|
218
|
+
addLayer({
|
|
219
|
+
layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES,
|
|
220
|
+
name: "Geometr\xEDas internas",
|
|
221
|
+
renderFeature: CommonFeatureRender,
|
|
222
|
+
geoJsonObject: {
|
|
223
|
+
object: {
|
|
224
|
+
type: "FeatureCollection",
|
|
225
|
+
features: []
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
autoFocus: false
|
|
229
|
+
});
|
|
230
|
+
init();
|
|
231
|
+
return () => {
|
|
232
|
+
removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES);
|
|
233
|
+
removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES);
|
|
234
|
+
removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES);
|
|
235
|
+
};
|
|
236
|
+
}, []);
|
|
237
|
+
}
|
|
238
|
+
const COMPONENT_CLASS_NAME = "M4LGpsTools";
|
|
239
|
+
const COMPONENT_MAP_TOOLS_ID = "gps_tools";
|
|
240
|
+
const STYLE_OPACITIES = [
|
|
241
|
+
{
|
|
242
|
+
value: 0,
|
|
243
|
+
label: "0%"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
value: 0.1,
|
|
247
|
+
label: "10%"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
value: 0.2,
|
|
251
|
+
label: "20%"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
value: 0.3,
|
|
255
|
+
label: "30%"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
value: 0.4,
|
|
259
|
+
label: "40%"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
value: 0.5,
|
|
263
|
+
label: "50%"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
value: 1,
|
|
267
|
+
label: "100%"
|
|
268
|
+
}
|
|
269
|
+
];
|
|
270
|
+
const STYLE_WHEIGHTS = [
|
|
271
|
+
{
|
|
272
|
+
value: 0,
|
|
273
|
+
label: "0px"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
value: 1,
|
|
277
|
+
label: "1px"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
value: 2,
|
|
281
|
+
label: "2px"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
value: 3,
|
|
285
|
+
label: "3px"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
value: 4,
|
|
289
|
+
label: "4px"
|
|
290
|
+
}
|
|
291
|
+
];
|
|
292
|
+
const STYLE_PATTERNS = [
|
|
293
|
+
{
|
|
294
|
+
value: "",
|
|
295
|
+
label: "------"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
value: "4 1 2",
|
|
299
|
+
label: "-- - - --"
|
|
300
|
+
}
|
|
301
|
+
];
|
|
302
|
+
const gpsToolsClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
|
|
303
|
+
"gpsToolsRoot",
|
|
304
|
+
"gpsToolsTab",
|
|
305
|
+
"gpsToolsTabContent",
|
|
306
|
+
"gpsToolsGeofencesList",
|
|
307
|
+
"gpsToolsGeofencesAddEdit",
|
|
308
|
+
"gpsToolsGeofencesAddEditContent",
|
|
309
|
+
"toolGeofencesAddEditGeneral",
|
|
310
|
+
"toolGeofencesAddEditStyle",
|
|
311
|
+
"visible",
|
|
312
|
+
"hidden"
|
|
313
|
+
]);
|
|
314
|
+
const DivGpsToolsRoot = styled("div")`
|
|
315
|
+
position: relative;
|
|
316
|
+
display: flex;
|
|
317
|
+
flex-direction: column;
|
|
318
|
+
flex-grow: 1;
|
|
319
|
+
width: 100%;
|
|
320
|
+
height: 100%;
|
|
321
|
+
|
|
322
|
+
z-index: ${MAP_ZINDEX_OVER_MAP};
|
|
323
|
+
|
|
324
|
+
.${gpsToolsClasses.gpsToolsTabContent}.${gpsToolsClasses.hidden} {
|
|
325
|
+
display: none;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.${gpsToolsClasses.gpsToolsGeofencesList} .M4LDataGrid-root {
|
|
329
|
+
height: unset !important;
|
|
330
|
+
flex-grow: 1;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.${gpsToolsClasses.toolGeofencesAddEditGeneral} {
|
|
334
|
+
flex-grow: 1;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
${(props) => props.theme.components?.M4LGpsTools?.styleOverrides}
|
|
338
|
+
`;
|
|
339
|
+
const GPSTOOLSICONS = {
|
|
340
|
+
GEOMETRY_CIRCLE: "geometry_circle.svg",
|
|
341
|
+
GEOMETRY_RECTANGLE: "geometry_rectangle.svg",
|
|
342
|
+
GEOMETRY_POLYGON: "geometry_polygon.svg",
|
|
343
|
+
ADD: "add.svg",
|
|
344
|
+
MEASURE: "measure.svg",
|
|
345
|
+
GENERAL: "general.svg",
|
|
346
|
+
CONFIG: "config.svg",
|
|
347
|
+
STROKE: "stroke.svg",
|
|
348
|
+
FILL: "fill.svg",
|
|
349
|
+
EDIT: "edit.svg",
|
|
350
|
+
DELETE: "delete.svg",
|
|
351
|
+
ACTIVE: "active.svg",
|
|
352
|
+
NAME: "name.svg"
|
|
353
|
+
};
|
|
666
354
|
function Filter(props) {
|
|
667
355
|
const { refresh, setBackendQueryParams } = props;
|
|
668
356
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
@@ -1491,7 +1179,7 @@ function useSubmit(props) {
|
|
|
1491
1179
|
};
|
|
1492
1180
|
return { onSubmit };
|
|
1493
1181
|
}
|
|
1494
|
-
const RHFormProviderStyled = styled
|
|
1182
|
+
const RHFormProviderStyled = styled(RHFormProvider)`
|
|
1495
1183
|
height: 100% !important;
|
|
1496
1184
|
|
|
1497
1185
|
.${gpsToolsClasses.gpsToolsGeofencesAddEditContent} {
|
|
@@ -1934,7 +1622,7 @@ function useMaster() {
|
|
|
1934
1622
|
goToAddEdit: onClickAddGeofence
|
|
1935
1623
|
};
|
|
1936
1624
|
}
|
|
1937
|
-
const StackGeofenceListRoot = styled
|
|
1625
|
+
const StackGeofenceListRoot = styled(Stack)`
|
|
1938
1626
|
padding: 12px;
|
|
1939
1627
|
position: relative !important;
|
|
1940
1628
|
flex-grow: 1;
|
|
@@ -2074,14 +1762,12 @@ function TabsGpsTools() {
|
|
|
2074
1762
|
}
|
|
2075
1763
|
);
|
|
2076
1764
|
}
|
|
1765
|
+
function GpsTools() {
|
|
1766
|
+
const isSkeleton = useModuleSkeleton();
|
|
1767
|
+
return /* @__PURE__ */ jsx(Fragment, { children: !isSkeleton && /* @__PURE__ */ jsx(TabsGpsTools, {}) });
|
|
1768
|
+
}
|
|
2077
1769
|
export {
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
Tab as b,
|
|
2082
|
-
Tabs as c,
|
|
2083
|
-
TabContent as d,
|
|
2084
|
-
TabProvider as e,
|
|
2085
|
-
TabContext as f,
|
|
2086
|
-
useTab as u
|
|
1770
|
+
GpsTools as G,
|
|
1771
|
+
GpsToolsProvider as a,
|
|
1772
|
+
useGpsToolsStore as u
|
|
2087
1773
|
};
|