@dmsi/wedgekit-react 0.0.162 → 0.0.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-SBSHZ327.js → chunk-O4JGGMFE.js} +3 -7
- package/dist/{chunk-RLK4TBXR.js → chunk-UBU6IJML.js} +20 -4
- package/dist/components/DataGridCell.cjs +22 -10
- package/dist/components/DataGridCell.js +2 -2
- package/dist/components/Menu.cjs +20 -4
- package/dist/components/Menu.js +1 -1
- package/dist/components/index.cjs +23 -10
- package/dist/components/index.js +3 -2
- package/package.json +1 -1
- package/src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx +1 -0
- package/src/components/DataGridCell.tsx +1 -1
- package/src/components/Menu.tsx +25 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Menu
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UBU6IJML.js";
|
|
4
4
|
import {
|
|
5
5
|
useSubMenuSystem
|
|
6
6
|
} from "./chunk-5GUW4DUY.js";
|
|
@@ -323,7 +323,7 @@ function DataCellHeader(_a) {
|
|
|
323
323
|
children: "Filter"
|
|
324
324
|
})
|
|
325
325
|
),
|
|
326
|
-
!predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */
|
|
326
|
+
!predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ jsx(
|
|
327
327
|
MenuOption,
|
|
328
328
|
__spreadProps(__spreadValues({
|
|
329
329
|
onClick: () => {
|
|
@@ -374,11 +374,7 @@ function DataCellHeader(_a) {
|
|
|
374
374
|
})
|
|
375
375
|
);
|
|
376
376
|
},
|
|
377
|
-
children: [
|
|
378
|
-
"Freeze [",
|
|
379
|
-
header.column.columnDef.header,
|
|
380
|
-
"]"
|
|
381
|
-
]
|
|
377
|
+
children: `Freeze [${header.column.columnDef.header}]`
|
|
382
378
|
})
|
|
383
379
|
)
|
|
384
380
|
]
|
|
@@ -40,7 +40,8 @@ var Menu = (_a) => {
|
|
|
40
40
|
mobileHide,
|
|
41
41
|
useDefaultMinWidth,
|
|
42
42
|
autoFocusOff,
|
|
43
|
-
menuName
|
|
43
|
+
menuName,
|
|
44
|
+
calculateMinMaxHeight
|
|
44
45
|
} = _b, props = __objRest(_b, [
|
|
45
46
|
"id",
|
|
46
47
|
"testid",
|
|
@@ -58,7 +59,8 @@ var Menu = (_a) => {
|
|
|
58
59
|
"mobileHide",
|
|
59
60
|
"useDefaultMinWidth",
|
|
60
61
|
"autoFocusOff",
|
|
61
|
-
"menuName"
|
|
62
|
+
"menuName",
|
|
63
|
+
"calculateMinMaxHeight"
|
|
62
64
|
]);
|
|
63
65
|
const internalRef = useRef(null);
|
|
64
66
|
const actualRef = ref || internalRef;
|
|
@@ -75,8 +77,11 @@ var Menu = (_a) => {
|
|
|
75
77
|
}
|
|
76
78
|
);
|
|
77
79
|
useEffect(() => {
|
|
80
|
+
if (calculateMinMaxHeight) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
78
83
|
const raf = requestAnimationFrame(() => {
|
|
79
|
-
if (!actualRef
|
|
84
|
+
if (!actualRef.current || customMaxHeight) {
|
|
80
85
|
return;
|
|
81
86
|
}
|
|
82
87
|
if (actualRef.current.childElementCount > 4) {
|
|
@@ -94,7 +99,18 @@ var Menu = (_a) => {
|
|
|
94
99
|
return () => {
|
|
95
100
|
cancelAnimationFrame(raf);
|
|
96
101
|
};
|
|
97
|
-
}, [actualRef, customMaxHeight]);
|
|
102
|
+
}, [actualRef.current, customMaxHeight, calculateMinMaxHeight]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!calculateMinMaxHeight) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if ((positionTo == null ? void 0 : positionTo.current) && actualRef.current) {
|
|
108
|
+
const positionToRect = positionTo.current.getBoundingClientRect();
|
|
109
|
+
const offsetInPx = 16;
|
|
110
|
+
const calculatedMaxHeight = window.innerHeight - positionToRect.bottom - offsetInPx;
|
|
111
|
+
setMaxHeight(`${calculatedMaxHeight}px`);
|
|
112
|
+
}
|
|
113
|
+
}, [actualRef.current, positionTo == null ? void 0 : positionTo.current, calculateMinMaxHeight]);
|
|
98
114
|
useEffect(() => {
|
|
99
115
|
if (!show) {
|
|
100
116
|
return;
|
|
@@ -1228,7 +1228,8 @@ var Menu = (_a) => {
|
|
|
1228
1228
|
mobileHide,
|
|
1229
1229
|
useDefaultMinWidth,
|
|
1230
1230
|
autoFocusOff,
|
|
1231
|
-
menuName
|
|
1231
|
+
menuName,
|
|
1232
|
+
calculateMinMaxHeight
|
|
1232
1233
|
} = _b, props = __objRest(_b, [
|
|
1233
1234
|
"id",
|
|
1234
1235
|
"testid",
|
|
@@ -1246,7 +1247,8 @@ var Menu = (_a) => {
|
|
|
1246
1247
|
"mobileHide",
|
|
1247
1248
|
"useDefaultMinWidth",
|
|
1248
1249
|
"autoFocusOff",
|
|
1249
|
-
"menuName"
|
|
1250
|
+
"menuName",
|
|
1251
|
+
"calculateMinMaxHeight"
|
|
1250
1252
|
]);
|
|
1251
1253
|
const internalRef = (0, import_react8.useRef)(null);
|
|
1252
1254
|
const actualRef = ref || internalRef;
|
|
@@ -1263,8 +1265,11 @@ var Menu = (_a) => {
|
|
|
1263
1265
|
}
|
|
1264
1266
|
);
|
|
1265
1267
|
(0, import_react8.useEffect)(() => {
|
|
1268
|
+
if (calculateMinMaxHeight) {
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1266
1271
|
const raf = requestAnimationFrame(() => {
|
|
1267
|
-
if (!actualRef
|
|
1272
|
+
if (!actualRef.current || customMaxHeight) {
|
|
1268
1273
|
return;
|
|
1269
1274
|
}
|
|
1270
1275
|
if (actualRef.current.childElementCount > 4) {
|
|
@@ -1282,7 +1287,18 @@ var Menu = (_a) => {
|
|
|
1282
1287
|
return () => {
|
|
1283
1288
|
cancelAnimationFrame(raf);
|
|
1284
1289
|
};
|
|
1285
|
-
}, [actualRef, customMaxHeight]);
|
|
1290
|
+
}, [actualRef.current, customMaxHeight, calculateMinMaxHeight]);
|
|
1291
|
+
(0, import_react8.useEffect)(() => {
|
|
1292
|
+
if (!calculateMinMaxHeight) {
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1295
|
+
if ((positionTo == null ? void 0 : positionTo.current) && actualRef.current) {
|
|
1296
|
+
const positionToRect = positionTo.current.getBoundingClientRect();
|
|
1297
|
+
const offsetInPx = 16;
|
|
1298
|
+
const calculatedMaxHeight = window.innerHeight - positionToRect.bottom - offsetInPx;
|
|
1299
|
+
setMaxHeight(`${calculatedMaxHeight}px`);
|
|
1300
|
+
}
|
|
1301
|
+
}, [actualRef.current, positionTo == null ? void 0 : positionTo.current, calculateMinMaxHeight]);
|
|
1286
1302
|
(0, import_react8.useEffect)(() => {
|
|
1287
1303
|
if (!show) {
|
|
1288
1304
|
return;
|
|
@@ -1961,7 +1977,7 @@ function DataCellHeader(_a) {
|
|
|
1961
1977
|
children: "Filter"
|
|
1962
1978
|
})
|
|
1963
1979
|
),
|
|
1964
|
-
!predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ (0, import_jsx_runtime8.
|
|
1980
|
+
!predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1965
1981
|
MenuOption,
|
|
1966
1982
|
__spreadProps(__spreadValues({
|
|
1967
1983
|
onClick: () => {
|
|
@@ -2012,11 +2028,7 @@ function DataCellHeader(_a) {
|
|
|
2012
2028
|
})
|
|
2013
2029
|
);
|
|
2014
2030
|
},
|
|
2015
|
-
children: [
|
|
2016
|
-
"Freeze [",
|
|
2017
|
-
header.column.columnDef.header,
|
|
2018
|
-
"]"
|
|
2019
|
-
]
|
|
2031
|
+
children: `Freeze [${header.column.columnDef.header}]`
|
|
2020
2032
|
})
|
|
2021
2033
|
)
|
|
2022
2034
|
]
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
DataGridCell,
|
|
5
5
|
DragAlongCell,
|
|
6
6
|
DraggableCellHeader
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-O4JGGMFE.js";
|
|
8
|
+
import "../chunk-UBU6IJML.js";
|
|
9
9
|
import "../chunk-5GUW4DUY.js";
|
|
10
10
|
import "../chunk-FFU6FB3K.js";
|
|
11
11
|
import "../chunk-WNQ53SVY.js";
|
package/dist/components/Menu.cjs
CHANGED
|
@@ -221,7 +221,8 @@ var Menu = (_a) => {
|
|
|
221
221
|
mobileHide,
|
|
222
222
|
useDefaultMinWidth,
|
|
223
223
|
autoFocusOff,
|
|
224
|
-
menuName
|
|
224
|
+
menuName,
|
|
225
|
+
calculateMinMaxHeight
|
|
225
226
|
} = _b, props = __objRest(_b, [
|
|
226
227
|
"id",
|
|
227
228
|
"testid",
|
|
@@ -239,7 +240,8 @@ var Menu = (_a) => {
|
|
|
239
240
|
"mobileHide",
|
|
240
241
|
"useDefaultMinWidth",
|
|
241
242
|
"autoFocusOff",
|
|
242
|
-
"menuName"
|
|
243
|
+
"menuName",
|
|
244
|
+
"calculateMinMaxHeight"
|
|
243
245
|
]);
|
|
244
246
|
const internalRef = (0, import_react5.useRef)(null);
|
|
245
247
|
const actualRef = ref || internalRef;
|
|
@@ -256,8 +258,11 @@ var Menu = (_a) => {
|
|
|
256
258
|
}
|
|
257
259
|
);
|
|
258
260
|
(0, import_react5.useEffect)(() => {
|
|
261
|
+
if (calculateMinMaxHeight) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
259
264
|
const raf = requestAnimationFrame(() => {
|
|
260
|
-
if (!actualRef
|
|
265
|
+
if (!actualRef.current || customMaxHeight) {
|
|
261
266
|
return;
|
|
262
267
|
}
|
|
263
268
|
if (actualRef.current.childElementCount > 4) {
|
|
@@ -275,7 +280,18 @@ var Menu = (_a) => {
|
|
|
275
280
|
return () => {
|
|
276
281
|
cancelAnimationFrame(raf);
|
|
277
282
|
};
|
|
278
|
-
}, [actualRef, customMaxHeight]);
|
|
283
|
+
}, [actualRef.current, customMaxHeight, calculateMinMaxHeight]);
|
|
284
|
+
(0, import_react5.useEffect)(() => {
|
|
285
|
+
if (!calculateMinMaxHeight) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if ((positionTo == null ? void 0 : positionTo.current) && actualRef.current) {
|
|
289
|
+
const positionToRect = positionTo.current.getBoundingClientRect();
|
|
290
|
+
const offsetInPx = 16;
|
|
291
|
+
const calculatedMaxHeight = window.innerHeight - positionToRect.bottom - offsetInPx;
|
|
292
|
+
setMaxHeight(`${calculatedMaxHeight}px`);
|
|
293
|
+
}
|
|
294
|
+
}, [actualRef.current, positionTo == null ? void 0 : positionTo.current, calculateMinMaxHeight]);
|
|
279
295
|
(0, import_react5.useEffect)(() => {
|
|
280
296
|
if (!show) {
|
|
281
297
|
return;
|
package/dist/components/Menu.js
CHANGED
|
@@ -1270,7 +1270,8 @@ var Menu = (_a) => {
|
|
|
1270
1270
|
mobileHide,
|
|
1271
1271
|
useDefaultMinWidth,
|
|
1272
1272
|
autoFocusOff,
|
|
1273
|
-
menuName
|
|
1273
|
+
menuName,
|
|
1274
|
+
calculateMinMaxHeight
|
|
1274
1275
|
} = _b, props = __objRest(_b, [
|
|
1275
1276
|
"id",
|
|
1276
1277
|
"testid",
|
|
@@ -1288,7 +1289,8 @@ var Menu = (_a) => {
|
|
|
1288
1289
|
"mobileHide",
|
|
1289
1290
|
"useDefaultMinWidth",
|
|
1290
1291
|
"autoFocusOff",
|
|
1291
|
-
"menuName"
|
|
1292
|
+
"menuName",
|
|
1293
|
+
"calculateMinMaxHeight"
|
|
1292
1294
|
]);
|
|
1293
1295
|
const internalRef = (0, import_react8.useRef)(null);
|
|
1294
1296
|
const actualRef = ref || internalRef;
|
|
@@ -1305,8 +1307,11 @@ var Menu = (_a) => {
|
|
|
1305
1307
|
}
|
|
1306
1308
|
);
|
|
1307
1309
|
(0, import_react8.useEffect)(() => {
|
|
1310
|
+
if (calculateMinMaxHeight) {
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1308
1313
|
const raf = requestAnimationFrame(() => {
|
|
1309
|
-
if (!actualRef
|
|
1314
|
+
if (!actualRef.current || customMaxHeight) {
|
|
1310
1315
|
return;
|
|
1311
1316
|
}
|
|
1312
1317
|
if (actualRef.current.childElementCount > 4) {
|
|
@@ -1324,7 +1329,18 @@ var Menu = (_a) => {
|
|
|
1324
1329
|
return () => {
|
|
1325
1330
|
cancelAnimationFrame(raf);
|
|
1326
1331
|
};
|
|
1327
|
-
}, [actualRef, customMaxHeight]);
|
|
1332
|
+
}, [actualRef.current, customMaxHeight, calculateMinMaxHeight]);
|
|
1333
|
+
(0, import_react8.useEffect)(() => {
|
|
1334
|
+
if (!calculateMinMaxHeight) {
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
if ((positionTo == null ? void 0 : positionTo.current) && actualRef.current) {
|
|
1338
|
+
const positionToRect = positionTo.current.getBoundingClientRect();
|
|
1339
|
+
const offsetInPx = 16;
|
|
1340
|
+
const calculatedMaxHeight = window.innerHeight - positionToRect.bottom - offsetInPx;
|
|
1341
|
+
setMaxHeight(`${calculatedMaxHeight}px`);
|
|
1342
|
+
}
|
|
1343
|
+
}, [actualRef.current, positionTo == null ? void 0 : positionTo.current, calculateMinMaxHeight]);
|
|
1328
1344
|
(0, import_react8.useEffect)(() => {
|
|
1329
1345
|
if (!show) {
|
|
1330
1346
|
return;
|
|
@@ -2003,7 +2019,7 @@ function DataCellHeader(_a) {
|
|
|
2003
2019
|
children: "Filter"
|
|
2004
2020
|
})
|
|
2005
2021
|
),
|
|
2006
|
-
!predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ (0, import_jsx_runtime8.
|
|
2022
|
+
!predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2007
2023
|
MenuOption,
|
|
2008
2024
|
__spreadProps(__spreadValues({
|
|
2009
2025
|
onClick: () => {
|
|
@@ -2054,11 +2070,7 @@ function DataCellHeader(_a) {
|
|
|
2054
2070
|
})
|
|
2055
2071
|
);
|
|
2056
2072
|
},
|
|
2057
|
-
children: [
|
|
2058
|
-
"Freeze [",
|
|
2059
|
-
header.column.columnDef.header,
|
|
2060
|
-
"]"
|
|
2061
|
-
]
|
|
2073
|
+
children: `Freeze [${header.column.columnDef.header}]`
|
|
2062
2074
|
})
|
|
2063
2075
|
)
|
|
2064
2076
|
]
|
|
@@ -2632,6 +2644,7 @@ function ColumnSelectorHeaderCell({
|
|
|
2632
2644
|
position: "bottom-right",
|
|
2633
2645
|
show,
|
|
2634
2646
|
setShow,
|
|
2647
|
+
calculateMinMaxHeight: true,
|
|
2635
2648
|
children: [
|
|
2636
2649
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2637
2650
|
Button,
|
package/dist/components/index.js
CHANGED
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
DataGridCell,
|
|
13
13
|
DragAlongCell,
|
|
14
14
|
DraggableCellHeader
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-O4JGGMFE.js";
|
|
16
16
|
import {
|
|
17
17
|
Menu
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-UBU6IJML.js";
|
|
19
19
|
import "../chunk-5GUW4DUY.js";
|
|
20
20
|
import {
|
|
21
21
|
MenuOption
|
|
@@ -560,6 +560,7 @@ function ColumnSelectorHeaderCell({
|
|
|
560
560
|
position: "bottom-right",
|
|
561
561
|
show,
|
|
562
562
|
setShow,
|
|
563
|
+
calculateMinMaxHeight: true,
|
|
563
564
|
children: [
|
|
564
565
|
/* @__PURE__ */ jsx7(
|
|
565
566
|
Button,
|
package/package.json
CHANGED
package/src/components/Menu.tsx
CHANGED
|
@@ -31,6 +31,7 @@ type MenuProps = {
|
|
|
31
31
|
useDefaultMinWidth?: boolean;
|
|
32
32
|
autoFocusOff?: boolean;
|
|
33
33
|
menuName?: string;
|
|
34
|
+
calculateMinMaxHeight?: boolean;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
export const Menu = ({
|
|
@@ -51,6 +52,7 @@ export const Menu = ({
|
|
|
51
52
|
useDefaultMinWidth,
|
|
52
53
|
autoFocusOff,
|
|
53
54
|
menuName,
|
|
55
|
+
calculateMinMaxHeight,
|
|
54
56
|
...props
|
|
55
57
|
}: ComponentProps<"div"> & MenuProps) => {
|
|
56
58
|
const internalRef = useRef<HTMLDivElement>(null);
|
|
@@ -69,8 +71,12 @@ export const Menu = ({
|
|
|
69
71
|
);
|
|
70
72
|
|
|
71
73
|
useEffect(() => {
|
|
74
|
+
if (calculateMinMaxHeight) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
72
78
|
const raf = requestAnimationFrame(() => {
|
|
73
|
-
if (!actualRef
|
|
79
|
+
if (!actualRef.current || customMaxHeight) {
|
|
74
80
|
return;
|
|
75
81
|
}
|
|
76
82
|
|
|
@@ -85,15 +91,31 @@ export const Menu = ({
|
|
|
85
91
|
accumulatedHeight += child.clientHeight;
|
|
86
92
|
});
|
|
87
93
|
|
|
88
|
-
accumulatedHeight = (accumulatedHeight / 5) * 4.5;
|
|
94
|
+
accumulatedHeight = (accumulatedHeight / 5) * 4.5; // default max height is set to 4.5 times of the first 5 child height of the menu
|
|
89
95
|
|
|
90
96
|
setMaxHeight(`${accumulatedHeight}px`);
|
|
91
97
|
}
|
|
92
98
|
});
|
|
99
|
+
|
|
93
100
|
return () => {
|
|
94
101
|
cancelAnimationFrame(raf);
|
|
95
102
|
};
|
|
96
|
-
}, [actualRef, customMaxHeight]);
|
|
103
|
+
}, [actualRef.current, customMaxHeight, calculateMinMaxHeight]);
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (!calculateMinMaxHeight) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (positionTo?.current && actualRef.current) {
|
|
111
|
+
const positionToRect = positionTo.current.getBoundingClientRect();
|
|
112
|
+
const offsetInPx = 16;
|
|
113
|
+
|
|
114
|
+
const calculatedMaxHeight = window.innerHeight - positionToRect.bottom - offsetInPx;
|
|
115
|
+
|
|
116
|
+
setMaxHeight(`${calculatedMaxHeight}px`);
|
|
117
|
+
}
|
|
118
|
+
}, [actualRef.current, positionTo?.current, calculateMinMaxHeight])
|
|
97
119
|
|
|
98
120
|
useEffect(() => {
|
|
99
121
|
if (!show) {
|