@m4l/components 0.1.77 → 0.1.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/export.d.ts +3 -3
- package/components/AccountPopover/{index.3a79c395.js → index.d541e4e6.js} +6 -6
- package/components/AppBar/{index.71b38ee9.js → index.f90014de.js} +6 -6
- package/components/CommonActions/components/ActionCancel/{index.b748a38e.js → index.92536832.js} +1 -1
- package/components/CommonActions/components/ActionFormCancel/{index.27ad09e1.js → index.7fb1ed8d.js} +19 -15
- package/components/CommonActions/components/ActionFormIntro/{index.2556f054.js → index.bebc0c94.js} +1 -1
- package/components/CommonActions/components/ActionIntro/{index.a7d92e66.js → index.aa4e432e.js} +1 -1
- package/components/CommonActions/components/Actions/{index.3eba9d91.js → index.5732847f.js} +11 -11
- package/components/DataGrid/{index.545b492f.js → index.302080d3.js} +20 -23
- package/components/DataGrid/types.d.ts +1 -1
- package/components/DynamicFilter/constants.d.ts +1 -0
- package/components/DynamicFilter/contexts/DynamicFilterContext/store.d.ts +6 -1
- package/components/DynamicFilter/{index.d7be0f37.js → index.0887320f.js} +50 -50
- package/components/DynamicFilter/subcomponents/InnerForHooks/index.d.ts +1 -2
- package/components/DynamicFilter/tests/contants.d.ts +2 -3
- package/components/GridLayout/Responsive/{index.a12a8cec.js → index.0905a698.js} +61 -43
- package/components/GridLayout/WidthProvider/{index.8ff65909.js → index.9a26dfe4.js} +1 -3
- package/components/GridLayout/index.d.ts +1 -1
- package/components/GridLayout/{index.4ba3767a.js → index.da6fd387.js} +103 -93
- package/components/GridLayout/subcomponents/GridItem/index.d.ts +1 -0
- package/components/GridLayout/subcomponents/GridItem/types.d.ts +2 -0
- package/components/GridLayout/subcomponents/Responsive/responsiveUtils.d.ts +6 -3
- package/components/GridLayout/subcomponents/Responsive/types.d.ts +1 -3
- package/components/HelperText/{index.ef31df1f.js → index.29d5ad65.js} +6 -6
- package/components/Icon/{index.ecb63e65.js → index.9fcd1476.js} +1 -1
- package/components/LanguagePopover/{index.0023d069.js → index.ce84f099.js} +6 -6
- package/components/ModalDialog/{index.d880e685.js → index.ab432b77.js} +4 -4
- package/components/NavLink/{index.cd92eceb.js → index.3bf44e30.js} +6 -6
- package/components/ObjectLogs/{index.f174c542.js → index.c947ded4.js} +22 -16
- package/components/ObjectLogs/types.d.ts +1 -0
- package/components/PaperForm/{index.1bd86ee5.js → index.ba38a0bd.js} +1 -1
- package/components/Period/{index.711db043.js → index.adc328ca.js} +12 -12
- package/components/PropertyValue/constants.d.ts +3 -0
- package/components/PropertyValue/{index.8a1adf3e.js → index.6b583e7a.js} +17 -11
- package/components/PropertyValue/types.d.ts +2 -1
- package/components/SideBar/{index.c5ce0bad.js → index.2f497e6c.js} +2 -2
- package/components/areas/components/AreasAdmin/classes/index.d.ts +1 -1
- package/components/areas/components/AreasAdmin/classes/types.d.ts +3 -0
- package/components/areas/components/AreasAdmin/{index.cc4cbf56.js → index.31905078.js} +91 -79
- package/components/areas/components/AreasViewer/classes/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/classes/types.d.ts +1 -0
- package/components/areas/components/AreasViewer/{index.9c2aaaeb.js → index.fe18bdbc.js} +151 -163
- package/components/areas/components/{index.0f7ac464.js → index.7ae189ba.js} +9 -9
- package/components/areas/contexts/AreasContext/helper.d.ts +3 -1
- package/components/areas/contexts/AreasContext/{index.c8147e8e.js → index.1213c3ef.js} +104 -78
- package/components/areas/contexts/AreasContext/types.d.ts +2 -2
- package/components/areas/contexts/WindowToolsMFContext/types.d.ts +1 -0
- package/components/areas/contexts/{index.02336412.js → index.84d35ffe.js} +1 -1
- package/components/areas/hooks/useAreas/{index.3406a6cb.js → index.cd799cf6.js} +1 -1
- package/components/areas/{index.6f2e5dab.js → index.6ee7a4eb.js} +9 -9
- package/components/areas/types.d.ts +5 -1
- package/components/formatters/BooleanFormatter/{index.5268b024.js → index.e8de8e4c.js} +1 -1
- package/components/formatters/{index.137169d8.js → index.67aeb049.js} +2 -2
- package/components/hook-form/RHFAutocomplete/{index.ac2b1fae.js → index.e52c1f6a.js} +23 -12
- package/components/hook-form/RHFAutocompleteAsync/{index.8b4ccc8d.js → index.a226b8ac.js} +1 -1
- package/components/hook-form/RHFCheckbox/{index.acef119c.js → index.9619debd.js} +1 -1
- package/components/hook-form/RHFDateTime/{index.5b080342.js → index.5da7b839.js} +7 -7
- package/components/hook-form/RHFPeriod/{index.5304e3bd.js → index.7e42c292.js} +2 -2
- package/components/hook-form/RHFTextField/{index.e751dca7.js → index.13447584.js} +3 -3
- package/components/hook-form/RHFUpload/{index.25db0511.js → index.80071782.js} +7 -10
- package/components/modal/{WindowBase.850ea31a.js → WindowBase.90d3c1d5.js} +8 -8
- package/components/modal/{WindowConfirm.cb37bc58.js → WindowConfirm.835f8d13.js} +14 -14
- package/components/modal/{index.a0978193.js → index.cd34ddb3.js} +11 -11
- package/components/mui_extended/Accordion/constants.d.ts +1 -0
- package/components/mui_extended/Accordion/{index.12b1339a.js → index.e8ba0755.js} +8 -9
- package/components/mui_extended/Accordion/types.d.ts +1 -0
- package/components/mui_extended/IconButton/{index.fc5b7c2d.js → index.12f1a3c3.js} +4 -1
- package/components/mui_extended/MenuActions/{index.f5b1c022.js → index.43a2e1ae.js} +15 -6
- package/components/mui_extended/MenuActions/index.d.ts +3 -2
- package/components/mui_extended/MenuActions/types.d.ts +1 -0
- package/components/mui_extended/Pager/{index.435af0df.js → index.2f6d6d7d.js} +1 -1
- package/components/mui_extended/Tab/constant.d.ts +1 -0
- package/components/mui_extended/Tab/{index.9e2f6e34.js → index.3c005df1.js} +5 -6
- package/components/mui_extended/Tab/types.d.ts +1 -0
- package/components/mui_extended/{index.83979b6a.js → index.ff59a512.js} +6 -6
- package/contexts/ModalContext/{index.dee85a61.js → index.feded672.js} +1 -1
- package/hooks/useModal/{index.de522a10.js → index.6d238807.js} +1 -1
- package/index.js +220 -217
- package/package.json +1 -1
- package/test/getNameDataTestId.d.ts +1 -0
- package/vendor.9b969b18.js +124 -0
- package/components/DynamicFilter/subcomponents/InnerForHooks/types.d.ts +0 -2
- package/components/DynamicFilter/tests/types.d.ts +0 -2
- package/components/DynamicFilter/tests/utils.d.ts +0 -2
- package/components/PropertyValue/tests/constants.d.ts +0 -1
- package/components/PropertyValue/tests/utils.d.ts +0 -2
- package/components/mui_extended/Accordion/tests/constants.d.ts +0 -1
- package/components/mui_extended/Accordion/tests/utils.d.ts +0 -2
- package/components/mui_extended/Tab/tests/constants.d.ts +0 -1
- package/components/mui_extended/Tab/tests/utils.d.ts +0 -2
|
@@ -4,39 +4,40 @@ import { useContext, useMemo, useEffect, createContext, useRef, createElement, u
|
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { useModuleDictionary, useEnvironment, useModuleSkeleton, useFlagsPresent, CommonFlags } from "@m4l/core";
|
|
6
6
|
import { useResponsiveDesktop, useFirstRender, useFormatter } from "@m4l/graphics";
|
|
7
|
-
import { I as IconButton } from "../mui_extended/IconButton/index.
|
|
7
|
+
import { I as IconButton } from "../mui_extended/IconButton/index.12f1a3c3.js";
|
|
8
8
|
import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
|
|
9
|
+
import { g as getNameDataTestId } from "../../vendor.9b969b18.js";
|
|
9
10
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
10
11
|
import { generateUtilityClasses, alpha, styled as styled$1, Skeleton, MenuItem } from "@mui/material";
|
|
11
|
-
import { L as LabelMemuItem } from "../mui_extended/MenuActions/index.
|
|
12
|
+
import { L as LabelMemuItem } from "../mui_extended/MenuActions/index.43a2e1ae.js";
|
|
12
13
|
import { P as Popover } from "../mui_extended/Popover/index.9f35d0eb.js";
|
|
13
|
-
import { I as Icon } from "../Icon/index.
|
|
14
|
+
import { I as Icon } from "../Icon/index.9fcd1476.js";
|
|
14
15
|
import { styled, useTheme } from "@mui/material/styles";
|
|
15
16
|
import { R as RHFormProvider } from "../../contexts/RHFormContext/index.fe175bab.js";
|
|
16
|
-
import { g as getCommonActionsDictionary, A as Actions } from "../CommonActions/components/Actions/index.
|
|
17
|
-
import { A as ActionCancel } from "../CommonActions/components/ActionCancel/index.
|
|
18
|
-
import { A as ActionIntro } from "../CommonActions/components/ActionIntro/index.
|
|
17
|
+
import { g as getCommonActionsDictionary, A as Actions } from "../CommonActions/components/Actions/index.5732847f.js";
|
|
18
|
+
import { A as ActionCancel } from "../CommonActions/components/ActionCancel/index.92536832.js";
|
|
19
|
+
import { A as ActionIntro } from "../CommonActions/components/ActionIntro/index.aa4e432e.js";
|
|
19
20
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
20
21
|
import "@mui/material/Button";
|
|
21
22
|
import "../mui_extended/Button/index.4288f9fc.js";
|
|
22
|
-
import "../../contexts/ModalContext/index.
|
|
23
|
+
import "../../contexts/ModalContext/index.feded672.js";
|
|
23
24
|
import "../../react-draggable.7abb5d0a.js";
|
|
24
25
|
import "../Resizeable/index.9a9c79a4.js";
|
|
25
|
-
import "../modal/index.
|
|
26
|
+
import "../modal/index.cd34ddb3.js";
|
|
26
27
|
import "../Image/index.c18ebf5a.js";
|
|
27
|
-
import "../mui_extended/Accordion/index.
|
|
28
|
+
import "../mui_extended/Accordion/index.e8ba0755.js";
|
|
28
29
|
import { T as Typography } from "../mui_extended/Typography/index.443590d6.js";
|
|
29
30
|
import "../mui_extended/Avatar/index.75e6ed57.js";
|
|
30
31
|
import "react-router-dom";
|
|
31
32
|
import "../mui_extended/Badge/index.8c2b8b66.js";
|
|
32
33
|
import "@mui/lab";
|
|
33
|
-
import "../mui_extended/Pager/index.
|
|
34
|
-
import "../mui_extended/Tab/index.
|
|
34
|
+
import "../mui_extended/Pager/index.2f6d6d7d.js";
|
|
35
|
+
import "../mui_extended/Tab/index.3c005df1.js";
|
|
35
36
|
import "../mui_extended/Tooltip/index.5a795dcd.js";
|
|
36
37
|
import { useStore, createStore } from "zustand";
|
|
37
|
-
import "../areas/contexts/AreasContext/index.
|
|
38
|
-
import "../areas/components/AreasAdmin/index.
|
|
39
|
-
import "../areas/components/AreasViewer/index.
|
|
38
|
+
import "../areas/contexts/AreasContext/index.1213c3ef.js";
|
|
39
|
+
import "../areas/components/AreasAdmin/index.31905078.js";
|
|
40
|
+
import "../areas/components/AreasViewer/index.fe18bdbc.js";
|
|
40
41
|
import "../LinearProgressIndeterminate/index.60dabc06.js";
|
|
41
42
|
import "../areas/contexts/WindowToolsMFContext/index.8f3e2a04.js";
|
|
42
43
|
import "../areas/contexts/DynamicMFParmsContext/index.1607c78e.js";
|
|
@@ -44,20 +45,21 @@ import { unstable_composeClasses } from "@mui/base";
|
|
|
44
45
|
import { g as getComponentUtilityClass, i as isValidDate } from "../../utils/index.c43a95f4.js";
|
|
45
46
|
import { devtools } from "zustand/middleware";
|
|
46
47
|
import { immer } from "zustand/middleware/immer";
|
|
47
|
-
import { R as RHFAutocomplete } from "../hook-form/RHFAutocomplete/index.
|
|
48
|
+
import { R as RHFAutocomplete } from "../hook-form/RHFAutocomplete/index.e52c1f6a.js";
|
|
48
49
|
import "lodash/debounce";
|
|
49
|
-
import "../hook-form/RHFAutocompleteAsync/index.
|
|
50
|
-
import "../hook-form/RHFCheckbox/index.
|
|
51
|
-
import "../HelperText/index.
|
|
50
|
+
import "../hook-form/RHFAutocompleteAsync/index.a226b8ac.js";
|
|
51
|
+
import "../hook-form/RHFCheckbox/index.9619debd.js";
|
|
52
|
+
import "../HelperText/index.29d5ad65.js";
|
|
52
53
|
import "@mui/x-date-pickers";
|
|
53
|
-
import { R as RHFDateTime } from "../hook-form/RHFDateTime/index.
|
|
54
|
-
import { R as RHFTextField } from "../hook-form/RHFTextField/index.
|
|
55
|
-
import "../hook-form/RHFPeriod/index.
|
|
56
|
-
import "../Period/index.
|
|
54
|
+
import { R as RHFDateTime } from "../hook-form/RHFDateTime/index.5da7b839.js";
|
|
55
|
+
import { R as RHFTextField } from "../hook-form/RHFTextField/index.13447584.js";
|
|
56
|
+
import "../hook-form/RHFPeriod/index.7e42c292.js";
|
|
57
|
+
import "../Period/index.adc328ca.js";
|
|
57
58
|
import "lodash/isString";
|
|
58
59
|
import "react-dropzone";
|
|
59
|
-
import "../hook-form/RHFUpload/index.
|
|
60
|
+
import "../hook-form/RHFUpload/index.80071782.js";
|
|
60
61
|
import * as Yup from "yup";
|
|
62
|
+
const COMPONENT_PREFIX = "m4l-dynamic-filter";
|
|
61
63
|
const COMPONENT_CLASS_NAME = "M4LDynamicFilter";
|
|
62
64
|
const ASSETS_URL = "frontend/components/dynamic_filter/assets/icons";
|
|
63
65
|
const ASSETS = {
|
|
@@ -149,12 +151,6 @@ function useDynamicFilter(selector, equalityFn) {
|
|
|
149
151
|
throw new Error("useDynamicFilterStore context must be use inside DynamicFilterContext");
|
|
150
152
|
return useStore(store, selector, equalityFn);
|
|
151
153
|
}
|
|
152
|
-
const DYNAMICFILTER_TEST_ID = "M4LDynamicFilter";
|
|
153
|
-
const PREFIX_TEST_ATTRIBUTE = "data-test";
|
|
154
|
-
const TEST_PROP_FIELDS = `${PREFIX_TEST_ATTRIBUTE}-${DYNAMICFILTER_TEST_ID}-fields`;
|
|
155
|
-
function getTestIdByClass(key, detailId) {
|
|
156
|
-
return `${DYNAMICFILTER_TEST_ID}-${key}` + (detailId ? "-" + detailId : "");
|
|
157
|
-
}
|
|
158
154
|
const DYNAMICFILTER_DICTIONARY_ID = "dynamic_filter";
|
|
159
155
|
function getDynamicFilterComponentsDictionary() {
|
|
160
156
|
return [DYNAMICFILTER_DICTIONARY_ID].concat(getCommonActionsDictionary());
|
|
@@ -191,6 +187,7 @@ const getDynamicFilterDictionary = (key) => {
|
|
|
191
187
|
};
|
|
192
188
|
function BooleanFilter() {
|
|
193
189
|
const classesContainerBooleanFilter = useDynamicFilter((state) => state.classes.containerBooleanFilter);
|
|
190
|
+
const dataTestId = useDynamicFilter((state) => state.classes.containerBooleanFilter);
|
|
194
191
|
const {
|
|
195
192
|
getLabel
|
|
196
193
|
} = useModuleDictionary();
|
|
@@ -207,7 +204,7 @@ function BooleanFilter() {
|
|
|
207
204
|
}], [getLabel]);
|
|
208
205
|
return /* @__PURE__ */ jsxs("div", {
|
|
209
206
|
...process.env.NODE_ENV !== "production" ? {
|
|
210
|
-
[TEST_PROP_ID]:
|
|
207
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "containerBooleanFilter", dataTestId)
|
|
211
208
|
} : {},
|
|
212
209
|
className: classesContainerBooleanFilter,
|
|
213
210
|
children: [/* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
@@ -877,7 +874,6 @@ const updateAutomatic = (state) => {
|
|
|
877
874
|
updateOwnerStateClasses(state);
|
|
878
875
|
};
|
|
879
876
|
const createAreaStore = (initProps) => {
|
|
880
|
-
console.log("valores iniciales de createDinamicFilter store", initProps);
|
|
881
877
|
const startProps = {
|
|
882
878
|
countOnChangeFiltersApplyed: 0,
|
|
883
879
|
applyedFilters: [],
|
|
@@ -1031,7 +1027,8 @@ function DynamicFilterProvider(props) {
|
|
|
1031
1027
|
fields,
|
|
1032
1028
|
initialApplyedFilters = [],
|
|
1033
1029
|
onChangeFilters,
|
|
1034
|
-
children
|
|
1030
|
+
children,
|
|
1031
|
+
dataTestId = ""
|
|
1035
1032
|
} = props;
|
|
1036
1033
|
const {
|
|
1037
1034
|
getLabel
|
|
@@ -1054,6 +1051,7 @@ function DynamicFilterProvider(props) {
|
|
|
1054
1051
|
fields,
|
|
1055
1052
|
automatic,
|
|
1056
1053
|
getLabel,
|
|
1054
|
+
dataTestId,
|
|
1057
1055
|
ownerState: {
|
|
1058
1056
|
isSkeleton,
|
|
1059
1057
|
isDirty: !automatic,
|
|
@@ -1217,6 +1215,7 @@ function ApplyedFilter(props) {
|
|
|
1217
1215
|
hidePopoverFilter: hidePopupEdit,
|
|
1218
1216
|
showPopoverFilterForEdit: showPopupForEdit
|
|
1219
1217
|
} = useDynamicFilter((state) => state.actions);
|
|
1218
|
+
const dataTestId = useDynamicFilter((state) => state.dataTestId);
|
|
1220
1219
|
const labels = useMemo(() => {
|
|
1221
1220
|
return getLabelsFilter(props, getLabel, formatters);
|
|
1222
1221
|
}, [props, getLabel]);
|
|
@@ -1235,7 +1234,7 @@ function ApplyedFilter(props) {
|
|
|
1235
1234
|
return /* @__PURE__ */ jsxs(WrapperApplyedFilter, {
|
|
1236
1235
|
className: clsx(classesApplyedFilter, !isSetted ? `${COMPONENT_CLASS_NAME}-noSetted` : null),
|
|
1237
1236
|
...process.env.NODE_ENV !== "production" ? {
|
|
1238
|
-
[TEST_PROP_ID]:
|
|
1237
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "applyedFilter", `${dataTestId}-${field.name}`)
|
|
1239
1238
|
} : {},
|
|
1240
1239
|
children: [urlIcon && /* @__PURE__ */ jsx(IconButton, {
|
|
1241
1240
|
src: urlIcon,
|
|
@@ -1277,6 +1276,7 @@ const ContainerApplyedFilters = styled("div")(({
|
|
|
1277
1276
|
}));
|
|
1278
1277
|
function ApplyedFilters() {
|
|
1279
1278
|
const classesWrapperApplyedFilters = useDynamicFilter((state) => state.classes.wrapperApplyedFilters, shallow);
|
|
1279
|
+
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1280
1280
|
const classesContainerApplyedFilters = useDynamicFilter((state) => state.classes.containerApplyedFilters, shallow);
|
|
1281
1281
|
const applyedFilters = useDynamicFilter((state) => state.applyedFilters, shallow);
|
|
1282
1282
|
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton, shallow);
|
|
@@ -1288,13 +1288,13 @@ function ApplyedFilters() {
|
|
|
1288
1288
|
return /* @__PURE__ */ jsx(WrapperApplyedFilters, {
|
|
1289
1289
|
className: classesWrapperApplyedFilters,
|
|
1290
1290
|
...process.env.NODE_ENV !== "production" ? {
|
|
1291
|
-
[TEST_PROP_ID]:
|
|
1291
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "wrapperApplyedFilters", dataTestId)
|
|
1292
1292
|
} : {},
|
|
1293
1293
|
children: /* @__PURE__ */ jsx(ScrollBar, {
|
|
1294
1294
|
children: /* @__PURE__ */ jsx(ContainerApplyedFilters, {
|
|
1295
1295
|
className: classesContainerApplyedFilters,
|
|
1296
1296
|
...process.env.NODE_ENV !== "production" ? {
|
|
1297
|
-
[TEST_PROP_ID]:
|
|
1297
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "containerApplyedFilters", dataTestId)
|
|
1298
1298
|
} : {},
|
|
1299
1299
|
children: [...applyedFilters].sort((a, b) => a.isSetted === b.isSetted ? 0 : a.isSetted ? -1 : 1).reverse().map((filter) => /* @__PURE__ */ jsx(ApplyedFilter, {
|
|
1300
1300
|
...filter
|
|
@@ -1363,6 +1363,7 @@ styled("div")(() => ({
|
|
|
1363
1363
|
display: "block"
|
|
1364
1364
|
}));
|
|
1365
1365
|
function FilterButton() {
|
|
1366
|
+
const dataTestId = useDynamicFilter((state) => state.dataTestId);
|
|
1366
1367
|
const automatic = useDynamicFilter((state) => state.automatic);
|
|
1367
1368
|
const isValid = useDynamicFilter((state) => state.ownerState.isValid);
|
|
1368
1369
|
const isDirty = useDynamicFilter((state) => state.ownerState.isDirty);
|
|
@@ -1388,7 +1389,7 @@ function FilterButton() {
|
|
|
1388
1389
|
return /* @__PURE__ */ jsx(IconButton, {
|
|
1389
1390
|
className: classesFilterButton,
|
|
1390
1391
|
...process.env.NODE_ENV !== "production" ? {
|
|
1391
|
-
[TEST_PROP_ID]:
|
|
1392
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "classesFilterButton", dataTestId)
|
|
1392
1393
|
} : {},
|
|
1393
1394
|
dictionaryTooltipId: getDynamicFilterDictionary(isValid ? isDirty ? DICCTIONARY.filter_tooltip_dirty : DICCTIONARY.filter_tooltip_refresh : DICCTIONARY.filter_tooltip_invalid),
|
|
1394
1395
|
onClick: fireOnChangeFilters,
|
|
@@ -1404,6 +1405,7 @@ function PopoverMenuFields(props) {
|
|
|
1404
1405
|
} = props;
|
|
1405
1406
|
const fnAnchorEl = useDynamicFilter((state) => state.fnAnchorEl, shallow);
|
|
1406
1407
|
const classesPopUpMenuFields = useDynamicFilter((state) => state.classes.popoverMenuFields, shallow);
|
|
1408
|
+
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1407
1409
|
const classesPopUpMenuFieldsPaper = useDynamicFilter((state) => state.classes.popoverMenuFieldsPaper, shallow);
|
|
1408
1410
|
const classespopoverMenuFieldsItem = useDynamicFilter((state) => state.classes.popoverMenuFieldsItem, shallow);
|
|
1409
1411
|
const classespopoverLabelMemuItem = useDynamicFilter((state) => state.classes.classespopoverLabelMemuItem, shallow);
|
|
@@ -1445,12 +1447,12 @@ function PopoverMenuFields(props) {
|
|
|
1445
1447
|
PaperProps: {
|
|
1446
1448
|
className: classesPopUpMenuFieldsPaper,
|
|
1447
1449
|
...process.env.NODE_ENV !== "production" ? {
|
|
1448
|
-
[TEST_PROP_ID]:
|
|
1450
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "popoverMenuFieldsPaper", dataTestId)
|
|
1449
1451
|
} : {}
|
|
1450
1452
|
},
|
|
1451
1453
|
children: Boolean(fnAnchorEl) && fields.map((field, index) => /* @__PURE__ */ createElement(MenuItem, {
|
|
1452
1454
|
...process.env.NODE_ENV !== "production" ? {
|
|
1453
|
-
[TEST_PROP_ID]:
|
|
1455
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "popoverMenuFieldsItem", `${dataTestId}-${field.name}`)
|
|
1454
1456
|
} : {},
|
|
1455
1457
|
className: classespopoverMenuFieldsItem,
|
|
1456
1458
|
key: `menu_action_${field.label ?? getLabel(field.dictionaryId)}`,
|
|
@@ -1470,6 +1472,7 @@ function InputFilter() {
|
|
|
1470
1472
|
const withAllField = useDynamicFilter((state) => state.withAllField);
|
|
1471
1473
|
const inputData = useDynamicFilter((state) => state.inputData);
|
|
1472
1474
|
const availableFields = useDynamicFilter((state) => state.availableFields, shallow);
|
|
1475
|
+
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1473
1476
|
const classesContainerInputFilter = useDynamicFilter((state) => state.classes.containerInputFilter, shallow);
|
|
1474
1477
|
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton, shallow);
|
|
1475
1478
|
const {
|
|
@@ -1570,7 +1573,7 @@ function InputFilter() {
|
|
|
1570
1573
|
return /* @__PURE__ */ jsxs("div", {
|
|
1571
1574
|
className: classesContainerInputFilter,
|
|
1572
1575
|
...process.env.NODE_ENV !== "production" ? {
|
|
1573
|
-
[TEST_PROP_ID]:
|
|
1576
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "containerInputFilter", dataTestId)
|
|
1574
1577
|
} : {},
|
|
1575
1578
|
children: [!isSkeleton ? /* @__PURE__ */ jsxs(Fragment, {
|
|
1576
1579
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
@@ -1624,6 +1627,7 @@ const PopoverFilter = () => {
|
|
|
1624
1627
|
const refPreviousPopoverFilterData = useRef(popoverFilterData);
|
|
1625
1628
|
const classesPopoverFilter = useDynamicFilter((state) => state.classes.popoverFilter, shallow);
|
|
1626
1629
|
const classesPopoverFilterPapper = useDynamicFilter((state) => state.classes.popoverFilterPaper, shallow);
|
|
1630
|
+
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1627
1631
|
const classesPopoverFilterHeader = useDynamicFilter((state) => state.classes.popoverFilterHeader, shallow);
|
|
1628
1632
|
const classesPopoverHeaderTitle = useDynamicFilter((state) => state.classes.popoverHeaderTitle, shallow);
|
|
1629
1633
|
const classesPopoverContainerFields = useDynamicFilter((state) => state.classes.popoverContainerFields, shallow);
|
|
@@ -1723,7 +1727,7 @@ const PopoverFilter = () => {
|
|
|
1723
1727
|
PaperProps: {
|
|
1724
1728
|
className: classesPopoverFilterPapper,
|
|
1725
1729
|
...process.env.NODE_ENV !== "production" ? {
|
|
1726
|
-
[TEST_PROP_ID]:
|
|
1730
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "popoverFilterPaper", dataTestId)
|
|
1727
1731
|
} : {}
|
|
1728
1732
|
},
|
|
1729
1733
|
children: /* @__PURE__ */ jsxs(RHFormProvider, {
|
|
@@ -1757,21 +1761,19 @@ const PopoverFilter = () => {
|
|
|
1757
1761
|
})
|
|
1758
1762
|
});
|
|
1759
1763
|
};
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1762
|
-
dataTestId
|
|
1763
|
-
} = props;
|
|
1764
|
+
const TEST_PROPS_DATA = `data-testing`;
|
|
1765
|
+
const InnerForHooks = () => {
|
|
1764
1766
|
const isMobile = useDynamicFilter((state) => state.ownerState.isMobile, shallow);
|
|
1767
|
+
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1765
1768
|
const classesRoot = useDynamicFilter((state) => state.classes.root, shallow);
|
|
1766
1769
|
const containerClearFilter = useDynamicFilter((state) => state.classes.containerClearFilter, shallow);
|
|
1767
1770
|
const classesContainerFistRow = useDynamicFilter((state) => state.classes.containerFistRow, shallow);
|
|
1768
1771
|
const fields = useDynamicFilter((state) => state.fields, shallow);
|
|
1769
|
-
console.log("fields test data", fields);
|
|
1770
1772
|
return /* @__PURE__ */ jsx(DynamicFilterRoot, {
|
|
1771
1773
|
className: classesRoot,
|
|
1772
1774
|
...process.env.NODE_ENV !== "production" ? {
|
|
1773
|
-
[
|
|
1774
|
-
"
|
|
1775
|
+
[TEST_PROPS_DATA]: JSON.stringify(fields),
|
|
1776
|
+
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "root", dataTestId)
|
|
1775
1777
|
} : {},
|
|
1776
1778
|
children: !isMobile ? /* @__PURE__ */ jsxs(Fragment, {
|
|
1777
1779
|
children: [/* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsx(ApplyedFilters, {}), /* @__PURE__ */ jsx(PopoverFilter, {}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -1796,9 +1798,7 @@ const DynamicFilter = (inProps) => {
|
|
|
1796
1798
|
}
|
|
1797
1799
|
return /* @__PURE__ */ jsx(DynamicFilterProvider, {
|
|
1798
1800
|
...inProps,
|
|
1799
|
-
children: /* @__PURE__ */ jsx(InnerForHooks, {
|
|
1800
|
-
dataTestId: inProps.dataTestId
|
|
1801
|
-
})
|
|
1801
|
+
children: /* @__PURE__ */ jsx(InnerForHooks, {})
|
|
1802
1802
|
});
|
|
1803
1803
|
};
|
|
1804
1804
|
export {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { InnerForHooksProps } from './types';
|
|
3
2
|
/**
|
|
4
3
|
* @description InnerForHooks es una estrategia de mover el componente a nivel interno para poder acceder a los hooks que acceden al contexto DynamicFilterProvider
|
|
5
4
|
* @returns Componente DynamicFilter
|
|
6
5
|
*/
|
|
7
|
-
export declare const InnerForHooks: (
|
|
6
|
+
export declare const InnerForHooks: () => import("react").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Field } from '../types';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const TEST_PROP_FIELDS: string;
|
|
2
|
+
export declare const DYNAMICFILTER_PROP_DATA = "m4l-dynamic-filter";
|
|
3
|
+
export declare const TEST_PROPS_DATA = "data-testing";
|
|
5
4
|
export declare const TEST_FIELDS: Field[];
|
|
6
5
|
export declare const INITIAL_APPLYED_FILTERS_EMPTY: never[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as cloneLayoutItem, a as cloneLayout, b as compact, d as correctBounds, G as GridLayout, n as noop } from "../index.
|
|
1
|
+
import { c as cloneLayoutItem, a as cloneLayout, b as compact, d as correctBounds, G as GridLayout, n as noop } from "../index.da6fd387.js";
|
|
2
2
|
import { useState, useRef, useEffect, useCallback } from "react";
|
|
3
3
|
import { useFirstRender } from "@m4l/graphics";
|
|
4
4
|
import { d as deepEqual } from "../../../node_modules.d73a220d.js";
|
|
@@ -21,12 +21,11 @@ function getColsFromBreakpoint(breakpoint, cols) {
|
|
|
21
21
|
}
|
|
22
22
|
return cols[breakpoint];
|
|
23
23
|
}
|
|
24
|
-
function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBreakpoint, cols, compactType, brekpointsCols, colapsedHeight
|
|
24
|
+
function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBreakpoint, cols, compactType, brekpointsCols, colapsedHeight) {
|
|
25
25
|
let layout = layouts[breakpoint];
|
|
26
26
|
const breakpointsSorted = sortBreakpoints(breakpoints);
|
|
27
27
|
const indexBreakointInit = breakpointsSorted.indexOf(breakpoint);
|
|
28
28
|
let compareBreakpoint;
|
|
29
|
-
console.log("findOrGenerateResponsiveLayout start", layout);
|
|
30
29
|
if (!layout) {
|
|
31
30
|
if (lastBreakpoint !== breakpoint && layouts[lastBreakpoint]) {
|
|
32
31
|
compareBreakpoint = lastBreakpoint;
|
|
@@ -35,27 +34,20 @@ function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBr
|
|
|
35
34
|
...breakpointsSorted.splice(indexBreakointInit),
|
|
36
35
|
...breakpointsSorted.reverse()
|
|
37
36
|
];
|
|
38
|
-
console.log("findOrGenerateResponsiveLayout rotatedBreakpoints ", rotatedBreakpoints);
|
|
39
37
|
for (let i = 0, len = rotatedBreakpoints.length; i < len; i++) {
|
|
40
38
|
const b = rotatedBreakpoints[i];
|
|
41
39
|
if (layouts[b]) {
|
|
42
|
-
console.log("findOrGenerateResponsiveLayout above I*:", i, b);
|
|
43
40
|
compareBreakpoint = b;
|
|
44
41
|
break;
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
|
-
console.log("findOrGenerateResponsiveLayout compareBreakpoint ", compareBreakpoint);
|
|
49
45
|
if (compareBreakpoint) {
|
|
50
46
|
layout = [];
|
|
51
47
|
for (let i = 0, len = layouts[compareBreakpoint].length; i < len; i++) {
|
|
52
48
|
const li = cloneLayoutItem(layouts[compareBreakpoint][i]);
|
|
53
49
|
if (brekpointsCols[compareBreakpoint]) {
|
|
54
50
|
const newW = Math.round(li.w * cols / brekpointsCols[compareBreakpoint]);
|
|
55
|
-
console.log(
|
|
56
|
-
`findOrGenerateResponsiveLayout li:${li.i}, actual: ${li.w} -> new: ${newW} `,
|
|
57
|
-
compareBreakpoint
|
|
58
|
-
);
|
|
59
51
|
li.w = newW;
|
|
60
52
|
}
|
|
61
53
|
layout.push(li);
|
|
@@ -67,23 +59,13 @@ function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBr
|
|
|
67
59
|
} else {
|
|
68
60
|
layout = cloneLayout(layout);
|
|
69
61
|
}
|
|
70
|
-
console.log("findOrGenerateResponsiveLayout layout filtrado:", layout);
|
|
71
62
|
layout = cloneLayout(layout);
|
|
72
|
-
for (let index = 0; index < layout.length; index++) {
|
|
73
|
-
const element = layout[index];
|
|
74
|
-
element.colapsed = false;
|
|
75
|
-
if (colapsedItems && colapsedItems[element.i]) {
|
|
76
|
-
element.colapsed = true;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
console.log("findOrGenerateResponsiveLayout layout clonado:", layout);
|
|
80
63
|
const ret = compact(
|
|
81
64
|
correctBounds(layout, { cols }, colapsedHeight),
|
|
82
65
|
compactType,
|
|
83
66
|
cols,
|
|
84
67
|
colapsedHeight
|
|
85
68
|
);
|
|
86
|
-
console.log("findOrGenerateResponsiveLayout layout ret **:", ret);
|
|
87
69
|
return ret;
|
|
88
70
|
}
|
|
89
71
|
function sortBreakpoints(breakpoints) {
|
|
@@ -97,7 +79,7 @@ function getIndentationValue(param, breakpoint) {
|
|
|
97
79
|
return [0, 0];
|
|
98
80
|
return Array.isArray(param) ? param : param[breakpoint];
|
|
99
81
|
}
|
|
100
|
-
function addLayoutItemToBreakPointIfNoExists(layouts, breakpoint, layoutItem, cols, margin, containerPadding, rowHeight, containerHeight) {
|
|
82
|
+
function addLayoutItemToBreakPointIfNoExists(layouts, breakpoint, layoutItem, cols, margin, containerPadding, rowHeight, containerHeight, currentBreakpoint) {
|
|
101
83
|
if (!layouts[breakpoint])
|
|
102
84
|
return;
|
|
103
85
|
if (layouts[breakpoint].findIndex((l) => l.i === layoutItem.i) === -1) {
|
|
@@ -108,15 +90,21 @@ function addLayoutItemToBreakPointIfNoExists(layouts, breakpoint, layoutItem, co
|
|
|
108
90
|
l.y = Math.round(heigthUnits / 4);
|
|
109
91
|
l.w = Math.round(cols[breakpoint] / 2);
|
|
110
92
|
l.h = heigthUnits / 2;
|
|
93
|
+
if (breakpoint === "xxs") {
|
|
94
|
+
l.visible = false;
|
|
95
|
+
for (let index = 0; index < layouts[breakpoint].length; index++) {
|
|
96
|
+
if (layouts[breakpoint][index].freeMove) {
|
|
97
|
+
layouts[breakpoint][index].visible = false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (currentBreakpoint === "xxs") {
|
|
101
|
+
l.visible = true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
111
104
|
} else {
|
|
112
105
|
l.w = cols[breakpoint];
|
|
113
106
|
l.h = Math.round(heigthUnits * 0.8);
|
|
114
107
|
}
|
|
115
|
-
if (breakpoint === "xxs") {
|
|
116
|
-
if (l.freeMove) {
|
|
117
|
-
l.visible = false;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
108
|
if (l.freeMove) {
|
|
121
109
|
layouts[breakpoint].push(l);
|
|
122
110
|
} else {
|
|
@@ -124,7 +112,7 @@ function addLayoutItemToBreakPointIfNoExists(layouts, breakpoint, layoutItem, co
|
|
|
124
112
|
}
|
|
125
113
|
}
|
|
126
114
|
}
|
|
127
|
-
function addLayoutItemToBreakPoints(layouts, layoutItem, cols, margin, containerPadding, rowHeight, containerHeight) {
|
|
115
|
+
function addLayoutItemToBreakPoints(layouts, layoutItem, cols, margin, containerPadding, rowHeight, containerHeight, currentBreakpoint) {
|
|
128
116
|
const newLayouts = {};
|
|
129
117
|
for (const key in layouts) {
|
|
130
118
|
const layoutBreakpoint = cloneLayout(layouts[key]);
|
|
@@ -137,19 +125,53 @@ function addLayoutItemToBreakPoints(layouts, layoutItem, cols, margin, container
|
|
|
137
125
|
margin,
|
|
138
126
|
containerPadding,
|
|
139
127
|
rowHeight,
|
|
140
|
-
containerHeight
|
|
128
|
+
containerHeight,
|
|
129
|
+
currentBreakpoint
|
|
141
130
|
);
|
|
142
131
|
}
|
|
143
132
|
return newLayouts;
|
|
144
133
|
}
|
|
145
134
|
function cloneLayouts(layouts, layoutItemReplaceProps) {
|
|
146
|
-
console.log("cloneLayout");
|
|
147
135
|
const newLayouts = {};
|
|
148
136
|
for (const breakPoint in layouts) {
|
|
149
137
|
newLayouts[breakPoint] = cloneLayout(layouts[breakPoint], layoutItemReplaceProps);
|
|
150
138
|
}
|
|
151
139
|
return newLayouts;
|
|
152
140
|
}
|
|
141
|
+
function isEqualLayoutItem(layoutA, layoutB) {
|
|
142
|
+
if (layoutA.i !== layoutB.i) {
|
|
143
|
+
return false;
|
|
144
|
+
} else if (layoutA.x !== layoutB.x || layoutA.y !== layoutB.y || layoutA.w !== layoutB.w || layoutA.h !== layoutB.h || layoutA.colapsed !== layoutB.colapsed || layoutA.visible !== layoutB.visible || layoutA.freeMove !== layoutB.freeMove) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
function isEqualLayout(layoutA, layoutB) {
|
|
150
|
+
if (layoutA.length !== layoutB.length) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
for (let index = 0; index < layoutA.length; index++) {
|
|
154
|
+
if (!isEqualLayoutItem(layoutA[index], layoutB[index])) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
function isEqualLayouts(layoutsA, layoutsB) {
|
|
161
|
+
if (Object.keys(layoutsA).length !== Object.keys(layoutsB).length) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
for (const breakPoint in layoutsA) {
|
|
165
|
+
if (layoutsB[breakPoint]) {
|
|
166
|
+
if (!isEqualLayout(layoutsA[breakPoint], layoutsB[breakPoint])) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
153
175
|
function generateInitialState(props) {
|
|
154
176
|
const {
|
|
155
177
|
width,
|
|
@@ -160,7 +182,6 @@ function generateInitialState(props) {
|
|
|
160
182
|
layouts: defaultLayouts = {},
|
|
161
183
|
cols,
|
|
162
184
|
compactType = null,
|
|
163
|
-
colapsedItems,
|
|
164
185
|
colapsedHeight = 2
|
|
165
186
|
} = props;
|
|
166
187
|
const newBreakpoint = breakpoint || getBreakpointFromWidth(breakpoints, width);
|
|
@@ -168,7 +189,7 @@ function generateInitialState(props) {
|
|
|
168
189
|
let fireOnLoadLayoutChange = true;
|
|
169
190
|
const initialLayout = findOrGenerateResponsiveLayout(defaultLayouts, breakpoints, newBreakpoint, newBreakpoint, colNo, compactType, {
|
|
170
191
|
[newBreakpoint]: colNo
|
|
171
|
-
}, colapsedHeight
|
|
192
|
+
}, colapsedHeight);
|
|
172
193
|
if (defaultLayouts[newBreakpoint]) {
|
|
173
194
|
if (deepEqual(defaultLayouts[newBreakpoint], initialLayout)) {
|
|
174
195
|
fireOnLoadLayoutChange = false;
|
|
@@ -182,7 +203,6 @@ function generateInitialState(props) {
|
|
|
182
203
|
contaierPadding: getIndentationValue(containerPadding, newBreakpoint),
|
|
183
204
|
fireOnLoadLayoutChange
|
|
184
205
|
};
|
|
185
|
-
console.log("generateInitialState", ret, initialLayout);
|
|
186
206
|
return ret;
|
|
187
207
|
}
|
|
188
208
|
function Responsive(props) {
|
|
@@ -212,7 +232,6 @@ function Responsive(props) {
|
|
|
212
232
|
onLayoutChange = noop,
|
|
213
233
|
onContainerChange = noop,
|
|
214
234
|
layoutItemRender,
|
|
215
|
-
colapsedItems,
|
|
216
235
|
colapsedHeight = 2,
|
|
217
236
|
...other
|
|
218
237
|
} = props;
|
|
@@ -224,13 +243,11 @@ function Responsive(props) {
|
|
|
224
243
|
},
|
|
225
244
|
breakpoint: currentState.breakpoint,
|
|
226
245
|
breakpoints,
|
|
227
|
-
colapsedItems,
|
|
228
246
|
width,
|
|
229
247
|
height
|
|
230
248
|
});
|
|
231
249
|
const isFirstRender = useFirstRender([width, height, layouts]);
|
|
232
250
|
useEffect(() => {
|
|
233
|
-
console.log("useEffect componente", currentState.fireOnLoadLayoutChange);
|
|
234
251
|
onContainerChange({
|
|
235
252
|
containerWidth: refLayouts.current.width,
|
|
236
253
|
containerHeight: refLayouts.current.height,
|
|
@@ -261,8 +278,7 @@ function Responsive(props) {
|
|
|
261
278
|
};
|
|
262
279
|
let newContainerMargin = currentState.contaierMargin;
|
|
263
280
|
let newContainerPadding = currentState.contaierPadding;
|
|
264
|
-
|
|
265
|
-
if (newBreakpoint !== currentState.breakpoint || newCols !== currentState.cols || breakpoints !== refLayouts.current.breakpoints || colapsedItems !== refLayouts.current.colapsedItems || !deepEqual(layouts, refLayouts.current.layouts)) {
|
|
281
|
+
if (newBreakpoint !== currentState.breakpoint || newCols !== currentState.cols || breakpoints !== refLayouts.current.breakpoints || !isEqualLayouts(layouts, refLayouts.current.layouts)) {
|
|
266
282
|
console.debug("useEffect responsive con cambio de algo", newBreakpoint, lastBreakpoint);
|
|
267
283
|
newContainerMargin = getIndentationValue(containerMargin, newBreakpoint);
|
|
268
284
|
newContainerPadding = getIndentationValue(containerPadding, newBreakpoint);
|
|
@@ -270,7 +286,7 @@ function Responsive(props) {
|
|
|
270
286
|
console.error("useEffect casi imposible", lastBreakpoint, newLayouts);
|
|
271
287
|
newLayouts[lastBreakpoint] = cloneLayout(currentState.layout);
|
|
272
288
|
}
|
|
273
|
-
const layout = findOrGenerateResponsiveLayout(newLayouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType, cols, colapsedHeight
|
|
289
|
+
const layout = findOrGenerateResponsiveLayout(newLayouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType, cols, colapsedHeight);
|
|
274
290
|
newLayouts[newBreakpoint] = layout;
|
|
275
291
|
if (newBreakpoint !== currentState.breakpoint) {
|
|
276
292
|
onBreakpointChange(newBreakpoint, newCols, width, height);
|
|
@@ -278,7 +294,6 @@ function Responsive(props) {
|
|
|
278
294
|
refLayouts.current.layouts = newLayouts;
|
|
279
295
|
refLayouts.current.breakpoint = newBreakpoint;
|
|
280
296
|
refLayouts.current.breakpoints = breakpoints;
|
|
281
|
-
refLayouts.current.colapsedItems = colapsedItems;
|
|
282
297
|
console.debug("useEffect responsive****", layout);
|
|
283
298
|
setCurrentState({
|
|
284
299
|
breakpoint: newBreakpoint,
|
|
@@ -296,9 +311,11 @@ function Responsive(props) {
|
|
|
296
311
|
breakpoint: newBreakpoint,
|
|
297
312
|
cols: newCols
|
|
298
313
|
});
|
|
299
|
-
}, [width, height, layouts, breakpoint, breakpoints
|
|
314
|
+
}, [width, height, layouts, breakpoint, breakpoints]);
|
|
315
|
+
useEffect(() => {
|
|
316
|
+
onLayoutChange(currentState.layout, refLayouts.current.layouts);
|
|
317
|
+
}, [currentState.layout]);
|
|
300
318
|
const localOnLayoutChange = useCallback((newlayout) => {
|
|
301
|
-
console.log("localOnLayoutChange layouts antes de iniciar", refLayouts.current.layouts, newlayout);
|
|
302
319
|
try {
|
|
303
320
|
refLayouts.current.layouts[refLayouts.current.breakpoint] = cloneLayout(newlayout);
|
|
304
321
|
} catch (error) {
|
|
@@ -312,7 +329,6 @@ function Responsive(props) {
|
|
|
312
329
|
...refLayouts.current.layouts
|
|
313
330
|
});
|
|
314
331
|
}, [onLayoutChange]);
|
|
315
|
-
console.log("Render ResponsiveReactGridLayout: ", layouts, currentState, width, height);
|
|
316
332
|
return /* @__PURE__ */ jsx(GridLayout, {
|
|
317
333
|
width,
|
|
318
334
|
height,
|
|
@@ -331,5 +347,7 @@ export {
|
|
|
331
347
|
Responsive as R,
|
|
332
348
|
addLayoutItemToBreakPointIfNoExists as a,
|
|
333
349
|
addLayoutItemToBreakPoints as b,
|
|
334
|
-
|
|
350
|
+
isEqualLayouts as c,
|
|
351
|
+
cloneLayouts as d,
|
|
352
|
+
isEqualLayout as i
|
|
335
353
|
};
|
|
@@ -4,7 +4,7 @@ import { throttle } from "lodash";
|
|
|
4
4
|
import { useResizeObserver } from "@m4l/graphics";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
const THROTTLE_RESIZE_TIME = 200;
|
|
7
|
-
const layoutClassName = "
|
|
7
|
+
const layoutClassName = "M4LGridLayout";
|
|
8
8
|
function WidthProvider(ComposedComponent) {
|
|
9
9
|
return (props) => {
|
|
10
10
|
const {
|
|
@@ -20,7 +20,6 @@ function WidthProvider(ComposedComponent) {
|
|
|
20
20
|
const onWindowResizeMemo = useMemo(() => () => {
|
|
21
21
|
const node = elementRef.current;
|
|
22
22
|
if (node instanceof HTMLElement && node.offsetWidth) {
|
|
23
|
-
console.log("onWindowResize*******************************", node.offsetWidth, node.offsetHeight);
|
|
24
23
|
setCurrentState((prev) => ({
|
|
25
24
|
...prev,
|
|
26
25
|
width: node.offsetWidth,
|
|
@@ -53,7 +52,6 @@ function WidthProvider(ComposedComponent) {
|
|
|
53
52
|
ref: elementRef
|
|
54
53
|
});
|
|
55
54
|
}
|
|
56
|
-
console.log("Render with provider");
|
|
57
55
|
return /* @__PURE__ */ jsx(ComposedComponent, {
|
|
58
56
|
innerRef: elementRef,
|
|
59
57
|
width: currentState.width,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { GridLayout } from './GridLayout';
|
|
2
2
|
export { Responsive } from './subcomponents/Responsive';
|
|
3
|
-
export { addLayoutItemToBreakPoints, addLayoutItemToBreakPointIfNoExists, cloneLayouts, } from './subcomponents/Responsive/responsiveUtils';
|
|
3
|
+
export { addLayoutItemToBreakPoints, addLayoutItemToBreakPointIfNoExists, cloneLayouts, isEqualLayouts, isEqualLayout, } from './subcomponents/Responsive/responsiveUtils';
|
|
4
4
|
export type { GridLayoutProps, LayoutItemRenderProps, Layout, LayoutItem, BaseLayoutItem, } from './types';
|
|
5
5
|
export type { Layouts, ContainerChangeEvent } from './subcomponents/Responsive/types';
|
|
6
6
|
export { WidthProvider } from './subcomponents/WidthProvider';
|