@progress/kendo-react-grid 13.2.0-develop.4 → 13.2.0-develop.6
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/GridColumn.js +1 -1
- package/GridColumn.mjs +6 -4
- package/GridComponent.js +1 -1
- package/GridComponent.mjs +248 -248
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/drag/ColumnResize.js +1 -1
- package/drag/ColumnResize.mjs +114 -105
- package/index.d.mts +23 -1
- package/index.d.ts +23 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +17 -17
- package/utils/index.js +1 -1
- package/utils/index.mjs +169 -164
package/utils/index.mjs
CHANGED
|
@@ -5,161 +5,161 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { gridDefaultProps as
|
|
10
|
-
import { getter as
|
|
11
|
-
import { findGroupExpand as
|
|
12
|
-
import { ServerFragment as
|
|
13
|
-
import { ClientFragment as
|
|
14
|
-
import { GridContextMenuItemNames as
|
|
15
|
-
import { canUseDOM as
|
|
16
|
-
function
|
|
8
|
+
import * as C from "react";
|
|
9
|
+
import { gridDefaultProps as p } from "../GridColumn.mjs";
|
|
10
|
+
import { getter as S } from "@progress/kendo-data-query";
|
|
11
|
+
import { findGroupExpand as W, updateLeft as F, updateRight as R, tableKeyboardNavigationTools as b } from "@progress/kendo-react-data-tools";
|
|
12
|
+
import { ServerFragment as D } from "./_serverModule.mjs";
|
|
13
|
+
import { ClientFragment as E } from "./_clientModule.mjs";
|
|
14
|
+
import { GridContextMenuItemNames as o } from "../contextMenu/enums.mjs";
|
|
15
|
+
import { canUseDOM as M } from "@progress/kendo-react-common";
|
|
16
|
+
function X(e, t) {
|
|
17
17
|
const r = (e != null ? e : "").split(".");
|
|
18
|
-
let
|
|
19
|
-
return r.forEach((
|
|
20
|
-
|
|
21
|
-
}),
|
|
18
|
+
let a = t;
|
|
19
|
+
return r.forEach((d) => {
|
|
20
|
+
a = a ? a[d] : void 0;
|
|
21
|
+
}), a;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
var
|
|
25
|
-
let g =
|
|
26
|
-
for (let
|
|
23
|
+
function A(e, t, r, a, d, n, l, i, h, s = 0, f) {
|
|
24
|
+
var c;
|
|
25
|
+
let g = s;
|
|
26
|
+
for (let x = 0; x < t.length; x++) {
|
|
27
27
|
let I;
|
|
28
|
-
if (!
|
|
28
|
+
if (!d || t[x].value === void 0 || t[x].items === void 0) {
|
|
29
29
|
e[e.length] = {
|
|
30
|
-
dataIndex:
|
|
31
|
-
dataItem: t[
|
|
30
|
+
dataIndex: a.index,
|
|
31
|
+
dataItem: t[x],
|
|
32
32
|
rowType: "data",
|
|
33
|
-
level:
|
|
34
|
-
group:
|
|
33
|
+
level: s,
|
|
34
|
+
group: f,
|
|
35
35
|
// This is related to detail-row expansion
|
|
36
|
-
expanded: (
|
|
37
|
-
},
|
|
36
|
+
expanded: (c = h ? !!(n != null && n[S(h)(t[x])]) : !1) != null ? c : !1
|
|
37
|
+
}, a.index++;
|
|
38
38
|
continue;
|
|
39
39
|
} else {
|
|
40
40
|
let y;
|
|
41
|
-
|
|
42
|
-
field: t[
|
|
43
|
-
value: t[
|
|
41
|
+
f != null && f.parents ? y = [{ field: f.field, value: f.value }, ...f.parents] : f ? y = [f] : y = [], I = {
|
|
42
|
+
field: t[x].field,
|
|
43
|
+
value: t[x].value,
|
|
44
44
|
parents: y
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
g = Math.max(g,
|
|
48
|
-
let
|
|
49
|
-
const
|
|
50
|
-
|
|
47
|
+
g = Math.max(g, s + 1);
|
|
48
|
+
let w = !1;
|
|
49
|
+
const v = W(l || [], I);
|
|
50
|
+
v ? w = v.expanded !== !1 : w = i !== !1, e[e.length] = {
|
|
51
51
|
dataIndex: -1,
|
|
52
|
-
dataItem: t[
|
|
53
|
-
level:
|
|
52
|
+
dataItem: t[x],
|
|
53
|
+
level: s,
|
|
54
54
|
group: I,
|
|
55
55
|
rowType: "groupHeader",
|
|
56
|
-
expanded:
|
|
57
|
-
},
|
|
58
|
-
|
|
56
|
+
expanded: w
|
|
57
|
+
}, w && (I.expanded = w, g = Math.max(
|
|
58
|
+
A(
|
|
59
59
|
e,
|
|
60
|
-
t[
|
|
60
|
+
t[x].items,
|
|
61
61
|
r,
|
|
62
|
-
i,
|
|
63
62
|
a,
|
|
64
63
|
d,
|
|
65
|
-
f,
|
|
66
64
|
n,
|
|
67
65
|
l,
|
|
68
|
-
|
|
66
|
+
i,
|
|
67
|
+
h,
|
|
68
|
+
s + 1,
|
|
69
69
|
I
|
|
70
70
|
),
|
|
71
71
|
g
|
|
72
|
-
)), (r === "always" ||
|
|
72
|
+
)), (r === "always" || w && r === "visible") && (e[e.length] = {
|
|
73
73
|
dataIndex: -1,
|
|
74
|
-
dataItem: t[
|
|
74
|
+
dataItem: t[x],
|
|
75
75
|
rowType: "groupFooter",
|
|
76
|
-
level:
|
|
77
|
-
expanded:
|
|
76
|
+
level: s,
|
|
77
|
+
expanded: w
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
return g;
|
|
81
81
|
}
|
|
82
82
|
function H(e, t) {
|
|
83
83
|
for (let r = 0; r < e.length; r++) {
|
|
84
|
-
const
|
|
85
|
-
if (!
|
|
86
|
-
const
|
|
87
|
-
|
|
84
|
+
const a = e[r];
|
|
85
|
+
if (!a.locked) {
|
|
86
|
+
const d = t[a.index];
|
|
87
|
+
d && (a.locked = d.locked);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
-
const
|
|
94
|
-
let
|
|
95
|
-
for (let
|
|
96
|
-
|
|
97
|
-
(
|
|
91
|
+
const Y = (e, t) => typeof e.colSpan == "function" ? e.colSpan({ dataItem: t, column: e }) : e.colSpan || 1;
|
|
92
|
+
function Z(e, t, r) {
|
|
93
|
+
const a = [[]];
|
|
94
|
+
let d = 0;
|
|
95
|
+
for (let i = e.length - 1; i >= 0; i--)
|
|
96
|
+
d = Math.max(d, e[i].depth), e[i].headerColSpan = e[i].headerColSpan || 1, e[i].children.length > 0 && (e[i].headerColSpan = e[i].children.reduce(
|
|
97
|
+
(h, s) => s.hidden ? h : h + s.headerColSpan,
|
|
98
98
|
0
|
|
99
99
|
));
|
|
100
|
-
const
|
|
101
|
-
let
|
|
102
|
-
return e.forEach((
|
|
103
|
-
i
|
|
104
|
-
let
|
|
105
|
-
i
|
|
106
|
-
for (let
|
|
107
|
-
|
|
108
|
-
}), H(e, t),
|
|
100
|
+
const n = [];
|
|
101
|
+
let l = 1;
|
|
102
|
+
return e.forEach((i, h) => {
|
|
103
|
+
a[i.depth] = a[i.depth] || [];
|
|
104
|
+
let s = !1;
|
|
105
|
+
a[i.depth].length === 0 && (l <= 1 ? l = 1 + (i.children.length > 0 ? 0 : d - i.depth) : (l--, s = !0)), i.rowSpan = 1 + (i.children.length > 0 ? 0 : d - i.depth), i.kFirst = s, i.index = a[i.depth].length, a[i.depth].push(h), i.ariaColumnIndex = n[i.depth] ? n[i.depth] + 1 : 1;
|
|
106
|
+
for (let f = i.depth; f < i.depth + i.rowSpan; f++)
|
|
107
|
+
n[f] = (n[f] || 0) + i.headerColSpan;
|
|
108
|
+
}), H(e, t), F(a, e, r), R(a, e, r), a;
|
|
109
109
|
}
|
|
110
|
-
function T(e, t, r,
|
|
111
|
-
const
|
|
110
|
+
function T(e, t, r, a = 0, d = !1) {
|
|
111
|
+
const n = [];
|
|
112
112
|
if (!e)
|
|
113
113
|
return [];
|
|
114
|
-
e && e.length === void 0 && (e = [e]), e.forEach((
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
114
|
+
e && e.length === void 0 && (e = [e]), e.forEach((i, h) => {
|
|
115
|
+
i = i.props ? i.props : i;
|
|
116
|
+
const s = i.id ? i.id : b.generateNavigatableId(`${r.prevId++}`, r.idPrefix, "column"), f = M && i.media && window.matchMedia ? !window.matchMedia(i.media).matches : !1, g = d || f || i.hidden, c = t == null ? void 0 : t.find((I) => I.id === s), x = T(i.children, (c == null ? void 0 : c.children) || [], r, a + 1, g);
|
|
117
|
+
n.push(
|
|
118
118
|
Object.assign(
|
|
119
|
-
{ depth:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
{ depth: a },
|
|
120
|
+
p,
|
|
121
|
+
x.length ? { cell: () => null, filterCell: () => null } : {},
|
|
122
|
+
i,
|
|
123
123
|
{
|
|
124
|
-
id:
|
|
125
|
-
declarationIndex:
|
|
126
|
-
children:
|
|
124
|
+
id: s,
|
|
125
|
+
declarationIndex: n.length,
|
|
126
|
+
children: x,
|
|
127
127
|
headerColSpan: 0,
|
|
128
128
|
rowSpan: 0,
|
|
129
|
-
columnType:
|
|
130
|
-
colSpan:
|
|
129
|
+
columnType: i.columnType || "data",
|
|
130
|
+
colSpan: i.colSpan || 1,
|
|
131
131
|
isAccessible: !0,
|
|
132
132
|
hidden: g,
|
|
133
133
|
left: null,
|
|
134
134
|
right: null,
|
|
135
|
-
rowSpannable:
|
|
135
|
+
rowSpannable: i.rowSpannable
|
|
136
136
|
},
|
|
137
|
-
|
|
137
|
+
c ? { width: c.width, orderIndex: c.orderIndex } : {}
|
|
138
138
|
)
|
|
139
139
|
);
|
|
140
140
|
});
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
144
|
-
g.parentIndex =
|
|
141
|
+
const l = (i, h) => i.orderIndex === h.orderIndex ? i.declarationIndex - h.declarationIndex : (i.orderIndex || 0) - (h.orderIndex || 0);
|
|
142
|
+
if (n.sort(l), a === 0) {
|
|
143
|
+
const i = [], h = (s, f) => s.forEach((g) => {
|
|
144
|
+
g.parentIndex = f, h(g.children, i.push(g) - 1);
|
|
145
145
|
});
|
|
146
|
-
return
|
|
146
|
+
return h(n, -1), i;
|
|
147
147
|
}
|
|
148
|
-
return
|
|
148
|
+
return n;
|
|
149
149
|
}
|
|
150
150
|
const k = (e) => Array.isArray(e) ? e : e ? e.data : [];
|
|
151
|
-
function
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
let
|
|
151
|
+
function _(e, t, r, a) {
|
|
152
|
+
const d = k(e), n = [];
|
|
153
|
+
if (d.length > 0) {
|
|
154
|
+
let l = d[0];
|
|
155
155
|
if (t)
|
|
156
|
-
for (let
|
|
157
|
-
|
|
158
|
-
Object.getOwnPropertyNames(
|
|
159
|
-
|
|
156
|
+
for (let h = 0; h < t.length; h++)
|
|
157
|
+
l = l.items && l.items[0];
|
|
158
|
+
Object.getOwnPropertyNames(l).forEach((h) => {
|
|
159
|
+
h !== r.column && n.push(
|
|
160
160
|
Object.assign(
|
|
161
161
|
{
|
|
162
|
-
id:
|
|
162
|
+
id: b.generateNavigatableId(`${a.prevId++}`, a.idPrefix, "column"),
|
|
163
163
|
declarationIndex: -1,
|
|
164
164
|
parentIndex: -1,
|
|
165
165
|
depth: 0,
|
|
@@ -175,66 +175,71 @@ function Y(e, t, r, i) {
|
|
|
175
175
|
ariaColumnIndex: 0,
|
|
176
176
|
isAccessible: !0
|
|
177
177
|
},
|
|
178
|
-
|
|
179
|
-
{ field:
|
|
178
|
+
p,
|
|
179
|
+
{ field: h }
|
|
180
180
|
)
|
|
181
181
|
);
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
-
return
|
|
184
|
+
return n;
|
|
185
185
|
}
|
|
186
|
-
const
|
|
187
|
-
var
|
|
186
|
+
const j = (e, t) => {
|
|
187
|
+
var a;
|
|
188
188
|
let r = e[t.parentIndex];
|
|
189
189
|
for (; r; ) {
|
|
190
|
-
if ((
|
|
190
|
+
if ((a = r.cells) != null && a.footerCell)
|
|
191
191
|
return !0;
|
|
192
192
|
r = e[r.parentIndex];
|
|
193
193
|
}
|
|
194
194
|
return !1;
|
|
195
|
-
},
|
|
195
|
+
}, P = (e) => e.filter((t) => {
|
|
196
196
|
var r;
|
|
197
|
-
return
|
|
198
|
-
}),
|
|
199
|
-
|
|
200
|
-
return
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
197
|
+
return j(e, t) ? !1 : !!((r = t.cells) != null && r.footerCell) || !(t.children && t.children.length > 0);
|
|
198
|
+
}), G = (e) => {
|
|
199
|
+
let t = e.width;
|
|
200
|
+
return typeof (e == null ? void 0 : e.width) == "number" && (e != null && e.minResizableWidth) && (e == null ? void 0 : e.width) < (e == null ? void 0 : e.minResizableWidth) && (t = e == null ? void 0 : e.minResizableWidth), typeof (e == null ? void 0 : e.width) == "number" && (e != null && e.minWidth) && (e == null ? void 0 : e.width) < (e == null ? void 0 : e.minWidth) ? t = e == null ? void 0 : e.minWidth : typeof (e == null ? void 0 : e.width) == "number" && (e != null && e.maxWidth) && (e == null ? void 0 : e.width) > (e == null ? void 0 : e.maxWidth) && (t = e == null ? void 0 : e.maxWidth), t !== void 0 ? Math.floor(parseFloat(t.toString())) + "px" : void 0;
|
|
201
|
+
}, u = (e, t) => t && t.filter((r) => r.field === e).length > 0, B = (e) => (e.sort((t, r) => t.declarationIndex - r.declarationIndex), e.map((t) => {
|
|
202
|
+
const { declarationIndex: r, parentIndex: a, depth: d, headerColSpan: n, rowSpan: l, index: i, kFirst: h, children: s, ...f } = t;
|
|
203
|
+
return s.length ? {
|
|
204
|
+
children: B(s),
|
|
205
|
+
...f
|
|
206
|
+
} : f;
|
|
207
|
+
})), O = (e) => {
|
|
208
|
+
const { cells: t, rowSpannable: r, defaultCell: a, ...d } = e;
|
|
206
209
|
return e.children.length ? {
|
|
207
|
-
...
|
|
208
|
-
children: e.children.map(
|
|
209
|
-
} :
|
|
210
|
-
},
|
|
210
|
+
...d,
|
|
211
|
+
children: e.children.map(O)
|
|
212
|
+
} : d;
|
|
213
|
+
}, N = (e) => ({
|
|
211
214
|
id: e.id,
|
|
212
215
|
field: e.field,
|
|
213
216
|
title: e.title,
|
|
214
217
|
width: e.width,
|
|
215
218
|
orderIndex: e.orderIndex,
|
|
216
219
|
hidden: !1,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
minWidth: e.minWidth,
|
|
221
|
+
maxWidth: e.maxWidth,
|
|
222
|
+
children: e.children ? z(e.children) : null
|
|
223
|
+
}), z = (e) => e.map(N), m = (e) => {
|
|
224
|
+
const t = [], r = (a) => a == null ? void 0 : a.forEach((d) => {
|
|
225
|
+
t.push(d), r(d.children);
|
|
221
226
|
});
|
|
222
227
|
return r(e), t;
|
|
223
|
-
}, ee = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), te = 17895697,
|
|
228
|
+
}, ee = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), te = 17895697, ie = (e) => {
|
|
224
229
|
let t = [];
|
|
225
|
-
return e.sortable && (t = t.concat([
|
|
230
|
+
return e.sortable && (t = t.concat([o.sortAsc, o.sortDesc])), e.pdf && (t.length && (t = t.concat([o.separator])), t = t.concat([o.exportPDF])), t;
|
|
226
231
|
}, re = (e) => {
|
|
227
232
|
let t = [];
|
|
228
233
|
return e.clipboard && (t = t.concat([
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
])), e.editable && (t.length && (t = t.concat([
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
])), e.selectable && (t.length && (t = t.concat([
|
|
237
|
-
},
|
|
234
|
+
o.copySelection,
|
|
235
|
+
o.copySelectionNoHeaders,
|
|
236
|
+
o.paste
|
|
237
|
+
])), e.editable && (t.length && (t = t.concat([o.separator])), t = t.concat([
|
|
238
|
+
o.create,
|
|
239
|
+
o.edit,
|
|
240
|
+
o.delete
|
|
241
|
+
])), e.selectable && (t.length && (t = t.concat([o.separator])), t = t.concat([o.select])), e.rowReorderable && (t.length && (t = t.concat([o.separator])), t = t.concat([o.reorderRow])), e.pdf && (t.length && (t = t.concat([o.separator])), t = t.concat([o.exportPDF])), t;
|
|
242
|
+
}, ae = (e, t) => {
|
|
238
243
|
if (!(!e && !t))
|
|
239
244
|
return t ? e ? {
|
|
240
245
|
...e,
|
|
@@ -256,10 +261,10 @@ const m = (e, t) => {
|
|
|
256
261
|
...t.edit || {}
|
|
257
262
|
}
|
|
258
263
|
} : t : e;
|
|
259
|
-
},
|
|
264
|
+
}, de = (e) => {
|
|
260
265
|
var r;
|
|
261
266
|
return typeof e == "object" ? (r = e.enabled) != null ? r : !0 : e != null ? e : !1;
|
|
262
|
-
},
|
|
267
|
+
}, ne = () => D === E, he = (e) => !!(e && e.$$typeof === Symbol.for("react.client.reference")), fe = (e) => ({
|
|
263
268
|
id: e.id,
|
|
264
269
|
ariaColumnIndex: e.ariaColumnIndex,
|
|
265
270
|
isSelected: e.isSelected,
|
|
@@ -285,52 +290,52 @@ const m = (e, t) => {
|
|
|
285
290
|
rowDataIndex: e.rowDataIndex,
|
|
286
291
|
columnPosition: e.columnPosition,
|
|
287
292
|
group: e.group
|
|
288
|
-
}),
|
|
289
|
-
var
|
|
290
|
-
const t = typeof e == "object" ? (
|
|
293
|
+
}), se = (e) => {
|
|
294
|
+
var a, d;
|
|
295
|
+
const t = typeof e == "object" ? (a = e.enabled) != null ? a : !0 : e != null ? e : !1, r = typeof e == "object" ? (d = e.valueGetter) != null ? d : (n, l) => S(l)(n) : (n, l) => S(l)(n);
|
|
291
296
|
return { enabled: t, valueGetter: r };
|
|
292
297
|
}, $ = (e) => {
|
|
293
298
|
var t;
|
|
294
|
-
return
|
|
295
|
-
},
|
|
299
|
+
return C.isValidElement(e) ? e : (t = C.Children.toArray(e)) == null ? void 0 : t[0];
|
|
300
|
+
}, le = (e, t) => {
|
|
296
301
|
const r = $(e);
|
|
297
|
-
return r ?
|
|
298
|
-
},
|
|
302
|
+
return r ? C.cloneElement(r, t) : null;
|
|
303
|
+
}, oe = (e) => {
|
|
299
304
|
let t = 0;
|
|
300
305
|
if (e) {
|
|
301
|
-
const r = e.insertRow(0),
|
|
302
|
-
|
|
306
|
+
const r = e.insertRow(0), a = r.insertCell(0);
|
|
307
|
+
a.textContent = " ", t = r.getBoundingClientRect().height, e.deleteRow(0);
|
|
303
308
|
}
|
|
304
309
|
return t;
|
|
305
310
|
};
|
|
306
311
|
export {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
312
|
+
_ as autoGenerateColumns,
|
|
313
|
+
oe as calcRowHeight,
|
|
314
|
+
O as clientColumn,
|
|
315
|
+
le as cloneReactElement,
|
|
311
316
|
ee as firefox,
|
|
312
317
|
te as firefoxMaxHeight,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
A as flatData,
|
|
319
|
+
P as footerColumns,
|
|
320
|
+
fe as getClientCellProps,
|
|
321
|
+
Y as getColSpan,
|
|
322
|
+
N as getColumnState,
|
|
323
|
+
G as getColumnWidth,
|
|
324
|
+
z as getColumnsState,
|
|
320
325
|
k as getDataAsArray,
|
|
321
326
|
re as getDefaultBodyContextMenuItems,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
327
|
+
ie as getDefaultHeadContextMenuItems,
|
|
328
|
+
m as getFlatColumnsState,
|
|
329
|
+
X as getNestedValue,
|
|
325
330
|
$ as getReactElement,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
331
|
+
se as getRowSpanOptions,
|
|
332
|
+
ne as isClient,
|
|
333
|
+
he as isClientReference,
|
|
334
|
+
de as isRowReorderEnabled,
|
|
335
|
+
u as isSorted,
|
|
336
|
+
Z as mapColumns,
|
|
332
337
|
T as readColumns,
|
|
333
|
-
|
|
334
|
-
|
|
338
|
+
ae as resolveCells,
|
|
339
|
+
B as sanitizeColumns,
|
|
335
340
|
H as syncLockedColumns
|
|
336
341
|
};
|