@m4l/components 0.1.77 → 0.1.78
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.7e76dbb7.js} +6 -6
- package/components/AppBar/{index.71b38ee9.js → index.06858422.js} +6 -6
- package/components/CommonActions/components/ActionCancel/{index.b748a38e.js → index.d536ccfa.js} +1 -1
- package/components/CommonActions/components/ActionFormCancel/{index.27ad09e1.js → index.a915b105.js} +13 -13
- package/components/CommonActions/components/ActionFormIntro/{index.2556f054.js → index.14e65d6c.js} +1 -1
- package/components/CommonActions/components/ActionIntro/{index.a7d92e66.js → index.aa1648eb.js} +1 -1
- package/components/CommonActions/components/Actions/{index.3eba9d91.js → index.52125041.js} +11 -11
- package/components/DataGrid/{index.545b492f.js → index.9fb3e6a1.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.d1a2e2d1.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.a019742c.js} +6 -6
- package/components/Icon/{index.ecb63e65.js → index.9fcd1476.js} +1 -1
- package/components/LanguagePopover/{index.0023d069.js → index.98b63dcb.js} +6 -6
- package/components/ModalDialog/{index.d880e685.js → index.d9937d46.js} +4 -4
- package/components/NavLink/{index.cd92eceb.js → index.a5dea6d3.js} +6 -6
- package/components/ObjectLogs/{index.f174c542.js → index.d9d20b9d.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.7b94c418.js} +12 -12
- package/components/PropertyValue/constants.d.ts +3 -0
- package/components/PropertyValue/{index.8a1adf3e.js → index.45c73161.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.43ecd998.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.14e62059.js} +143 -161
- package/components/areas/components/{index.0f7ac464.js → index.a87653a9.js} +9 -9
- package/components/areas/contexts/AreasContext/helper.d.ts +3 -1
- package/components/areas/contexts/AreasContext/{index.c8147e8e.js → index.02c4e7be.js} +99 -78
- package/components/areas/contexts/AreasContext/types.d.ts +1 -2
- package/components/areas/contexts/{index.02336412.js → index.1ff9b360.js} +1 -1
- package/components/areas/hooks/useAreas/{index.3406a6cb.js → index.85e4b2e2.js} +1 -1
- package/components/areas/{index.6f2e5dab.js → index.d1dcccf5.js} +9 -9
- package/components/areas/types.d.ts +0 -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.6aa51705.js} +23 -12
- package/components/hook-form/RHFAutocompleteAsync/{index.8b4ccc8d.js → index.1a3dfe5f.js} +1 -1
- package/components/hook-form/RHFCheckbox/{index.acef119c.js → index.a08a65b3.js} +1 -1
- package/components/hook-form/RHFDateTime/{index.5b080342.js → index.4d671108.js} +7 -7
- package/components/hook-form/RHFPeriod/{index.5304e3bd.js → index.39b4be49.js} +2 -2
- package/components/hook-form/RHFTextField/{index.e751dca7.js → index.9004e898.js} +3 -3
- package/components/hook-form/RHFUpload/{index.25db0511.js → index.bed8573e.js} +7 -10
- package/components/modal/{WindowBase.850ea31a.js → WindowBase.a0c0b322.js} +8 -8
- package/components/modal/{WindowConfirm.cb37bc58.js → WindowConfirm.6c063f2d.js} +14 -14
- package/components/modal/{index.a0978193.js → index.00efea85.js} +11 -11
- package/components/mui_extended/Accordion/constants.d.ts +1 -0
- package/components/mui_extended/Accordion/{index.12b1339a.js → index.9877f7bf.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.7c82e43d.js} +5 -6
- package/components/mui_extended/Tab/types.d.ts +1 -0
- package/components/mui_extended/{index.83979b6a.js → index.0e2ff642.js} +6 -6
- package/contexts/ModalContext/{index.dee85a61.js → index.e9a7ba4a.js} +1 -1
- package/hooks/useModal/{index.de522a10.js → index.8e85f7ae.js} +1 -1
- package/index.js +220 -217
- package/package.json +1 -1
- package/test/getNameDataTestId.d.ts +1 -0
- package/vendor.e353394b.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
|
@@ -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';
|