@progress/kendo-react-grid 8.2.0-develop.25 → 8.2.0-develop.27
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/Grid.js +1 -1
- package/Grid.mjs +99 -111
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +8 -2
- package/index.d.ts +8 -2
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
- package/utils/index.js +1 -1
- package/utils/index.mjs +82 -82
package/Grid.mjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import * as r from "react";
|
|
10
10
|
import o from "prop-types";
|
|
11
11
|
import { RowHeightService as re, getScrollbarWidth as Pe, dispatchEvent as Ge, canUseDOM as N, getActiveElement as Ke, memoizeOne as E, validatePackage as We, shouldShowValidationUI as Ve, setScrollbarWidth as ae, getter as Be, classNames as L, kendoThemeMaps as G, WatermarkOverlay as Ue } from "@progress/kendo-react-common";
|
|
12
|
-
import {
|
|
12
|
+
import { tableKeyboardNavigation as _, getSelectionOptions as le, mapColumns as $e, ClipboardService as je, TableKeyboardNavigationContext as V, isRtl as qe, tableKeyboardNavigationTools as x, tableColumnsVirtualization as Je, Pager as Xe, tableKeyboardNavigationScopeAttributes as ne, TableSelection as he, tableKeyboardNavigationBodyAttributes as pe, DropClue as de, DragClue as ce, updateLeft as Ye, updateRight as Qe, KEYBOARD_NAV_DATA_ID as Ze } from "@progress/kendo-react-data-tools";
|
|
13
13
|
import { GridSelectionCell as et } from "./cells/GridSelectionCell.mjs";
|
|
14
14
|
import { GridHierarchyCell as tt } from "./cells/GridHierarchyCell.mjs";
|
|
15
15
|
import { GridEditCell as st } from "./cells/GridEditCell.mjs";
|
|
@@ -38,8 +38,8 @@ import { GridDetailCell as kt } from "./cells/GridDetailCell.mjs";
|
|
|
38
38
|
import { GridDetailHierarchyCell as _t } from "./cells/GridDetailHierarchyCell.mjs";
|
|
39
39
|
import { SAFARI_REGEX as xt } from "./constants/index.mjs";
|
|
40
40
|
const z = class z extends r.Component {
|
|
41
|
-
constructor(
|
|
42
|
-
super(
|
|
41
|
+
constructor(a) {
|
|
42
|
+
super(a), this._columns = [], this._columnsMap = [[]], this._columnsMutations = 0, this._resized = !1, this._focusFirst = !1, this._singleEditRow = !1, this._shouldUpdateLeftRight = !0, this._scrollbarWidth = void 0, this.contextStateRef = { current: void 0 }, this.navigationStateRef = { current: void 0 }, this._data = [], this._slicedData = void 0, this.wrapperScrollTop = 0, this.showLicenseWatermark = !1, this.headerRef = r.createRef(), this.headerElementRef = r.createRef(), this._element = null, this.tableElement = null, this.containerRef = r.createRef(), this.tableBodyRef = r.createRef(), this._footer = null, this.forceUpdateTimeout = void 0, this.isRtl = !1, this.headTable = null, this.rowsInEdit = [], this.observer = null, this.handleIntersection = (e) => {
|
|
43
43
|
const t = { rowIndex: this.rowIndex };
|
|
44
44
|
e.forEach((s) => {
|
|
45
45
|
s.isIntersecting || this.setCurrentOnTop(t);
|
|
@@ -62,28 +62,28 @@ const z = class z extends r.Component {
|
|
|
62
62
|
const { rowIndex: t } = e, s = this.element;
|
|
63
63
|
if (this.observer && s) {
|
|
64
64
|
this.observer.disconnect();
|
|
65
|
-
const
|
|
66
|
-
|
|
65
|
+
const l = s.querySelector(`[absolute-row-index="${t}"]`);
|
|
66
|
+
l ? this.observer.observe(l) : this.setCurrentOnTop(e);
|
|
67
67
|
}
|
|
68
68
|
}, this.fitColumns = (e) => {
|
|
69
69
|
this.columnResize.dblClickHandler(null, e);
|
|
70
70
|
}, this.getColumnsEssentialProps = (e) => JSON.stringify(e.map((t) => ({ id: t.id, field: t.field, title: t.title, children: t.children }))), this.checkMatchMediaColumnsDifferece = () => {
|
|
71
|
-
const e = this.childrenToArray(this.props.children)
|
|
72
|
-
return this.getColumnsEssentialProps(
|
|
71
|
+
const e = this.childrenToArray(this.props.children);
|
|
72
|
+
return this.getColumnsEssentialProps(e) === this.getColumnsEssentialProps(this._columns);
|
|
73
73
|
}, this.onContextMenu = (e, t, s) => {
|
|
74
74
|
if (this.props.onContextMenu) {
|
|
75
|
-
const
|
|
75
|
+
const l = {
|
|
76
76
|
target: this,
|
|
77
77
|
syntheticEvent: e,
|
|
78
78
|
nativeEvent: e.nativeEvent,
|
|
79
79
|
dataItem: t,
|
|
80
80
|
field: s
|
|
81
81
|
};
|
|
82
|
-
this.props.onContextMenu.call(void 0,
|
|
82
|
+
this.props.onContextMenu.call(void 0, l);
|
|
83
83
|
}
|
|
84
84
|
}, this.getVirtualScroll = (e) => {
|
|
85
|
-
const { rowHeight: t, detailRowHeight: s, detail:
|
|
86
|
-
return !f ||
|
|
85
|
+
const { rowHeight: t, detailRowHeight: s, detail: l, expandField: h, groupable: n } = e, d = this.isAllData(), f = t !== void 0 && t > 0, R = s !== void 0 && s > 0, I = n === !0 || typeof n == "object" && n.enabled !== !1;
|
|
86
|
+
return !f || I && !d || !!(l && h) && (!R || !d) ? ct : ge;
|
|
87
87
|
}, this.isAllData = () => {
|
|
88
88
|
const { data: e, total: t } = this.props;
|
|
89
89
|
return Array.isArray(e) ? e.length === t : e ? t === e.total : !1;
|
|
@@ -101,9 +101,9 @@ const z = class z extends r.Component {
|
|
|
101
101
|
} else
|
|
102
102
|
this.vs.containerHeight = 1533915;
|
|
103
103
|
if (this.vs.containerRef = this.containerRef, this.vs.tableBodyRef = this.tableBodyRef, this.vs.table = this.tableElement, this._slicedData = void 0, this.vs instanceof ge) {
|
|
104
|
-
const { rowHeight: s = 0, detail:
|
|
104
|
+
const { rowHeight: s = 0, detail: l, expandField: h } = this.props;
|
|
105
105
|
let { detailRowHeight: n = 0 } = this.props;
|
|
106
|
-
n =
|
|
106
|
+
n = l && h ? n : s, this.isAllData() ? (this.vs.total = this._data.length, this._slicedData = this._data.slice(this.vs.realSkip, this.vs.realSkip + this.vs.pageSize), this.vs.rowHeightService = this.rowHeightService(this.vs, this._data.length, s, n, this._data)) : this.vs.rowHeightService = new re(e, s, n);
|
|
107
107
|
const d = this.vs.rowHeightService.totalHeight();
|
|
108
108
|
this.vs.containerHeight = me ? Math.min(fe, d) : d;
|
|
109
109
|
}
|
|
@@ -116,14 +116,14 @@ const z = class z extends r.Component {
|
|
|
116
116
|
this.forceUpdate();
|
|
117
117
|
}, 0)), this._header && this._header.setScrollLeft(t), this._footer && this._footer.setScrollLeft(t), this.vs && s !== this.wrapperScrollTop && this.vs.scrollHandler(e), Ge(this.props.onScroll, e, this, void 0), this.wrapperScrollTop = s;
|
|
118
118
|
}, this.onKeyDown = (e) => {
|
|
119
|
-
if (
|
|
119
|
+
if (_.onKeyDown(e, {
|
|
120
120
|
navigatable: this.props.navigatable || !1,
|
|
121
121
|
contextStateRef: this.contextStateRef,
|
|
122
122
|
navigationStateRef: this.navigationStateRef,
|
|
123
123
|
onNavigationAction: this.onNavigationAction,
|
|
124
124
|
columns: this.columns
|
|
125
125
|
}), this.props.onKeyDown) {
|
|
126
|
-
const { mode: t, cell: s } = le(this.props.selectable),
|
|
126
|
+
const { mode: t, cell: s } = le(this.props.selectable), l = {
|
|
127
127
|
dataItems: this.getLeafDataItems(),
|
|
128
128
|
mode: t,
|
|
129
129
|
cell: s,
|
|
@@ -131,10 +131,10 @@ const z = class z extends r.Component {
|
|
|
131
131
|
selectedField: this.props.selectedField,
|
|
132
132
|
...this.getArguments(e)
|
|
133
133
|
};
|
|
134
|
-
this.props.onKeyDown.call(void 0,
|
|
134
|
+
this.props.onKeyDown.call(void 0, l);
|
|
135
135
|
}
|
|
136
136
|
}, this.onFocus = (e) => {
|
|
137
|
-
|
|
137
|
+
_.onFocus(e, {
|
|
138
138
|
contextStateRef: this.contextStateRef
|
|
139
139
|
});
|
|
140
140
|
}, this.onNavigationAction = (e) => {
|
|
@@ -207,7 +207,7 @@ const z = class z extends r.Component {
|
|
|
207
207
|
);
|
|
208
208
|
}, this.selectionRelease = (e) => {
|
|
209
209
|
if (this.props.onSelectionChange) {
|
|
210
|
-
const t = this.getSlicedLeafDataItems()[e.startRowIndex], s = this.getSlicedLeafDataItems()[e.endRowIndex],
|
|
210
|
+
const t = this.getSlicedLeafDataItems()[e.startRowIndex], s = this.getSlicedLeafDataItems()[e.endRowIndex], l = {
|
|
211
211
|
syntheticEvent: void 0,
|
|
212
212
|
target: this,
|
|
213
213
|
selectedField: this.props.selectedField || "",
|
|
@@ -218,7 +218,7 @@ const z = class z extends r.Component {
|
|
|
218
218
|
endDataItem: s,
|
|
219
219
|
...e
|
|
220
220
|
};
|
|
221
|
-
this.props.onSelectionChange.call(void 0,
|
|
221
|
+
this.props.onSelectionChange.call(void 0, l);
|
|
222
222
|
}
|
|
223
223
|
}, this.pageChange = (e, t, s) => {
|
|
224
224
|
this.raiseDataEvent(
|
|
@@ -232,8 +232,8 @@ const z = class z extends r.Component {
|
|
|
232
232
|
let e = this.props.total || 0;
|
|
233
233
|
return Array.isArray(this.props.data) ? e = e || this.props.data.length : this.props.data && (e = e || this.props.data.total), e;
|
|
234
234
|
}, this.moveToNextPage = (e) => {
|
|
235
|
-
const t = this.props.take || 0, s = (this.props.skip || 0) + t,
|
|
236
|
-
s <
|
|
235
|
+
const t = this.props.take || 0, s = (this.props.skip || 0) + t, l = this.getTotal();
|
|
236
|
+
s < l && this.pageChange({ skip: s, take: t }, e);
|
|
237
237
|
}, this.moveToPrevPage = (e) => {
|
|
238
238
|
const t = this.props.take || 0, s = (this.props.skip || 0) - t;
|
|
239
239
|
s >= 0 && this.pageChange({ skip: s, take: t }, e);
|
|
@@ -280,14 +280,14 @@ const z = class z extends r.Component {
|
|
|
280
280
|
var h, n, d;
|
|
281
281
|
if (!N)
|
|
282
282
|
return !1;
|
|
283
|
-
const e = Ke(this.document), t = e ? e.matches(".k-table-td") ? e : (h = this.document) == null ? void 0 : h.body : (n = this.document) == null ? void 0 : n.body, s = t.closest(".k-grid-container"),
|
|
284
|
-
return !!(t &&
|
|
285
|
-
}, this.onResize = (e, t, s,
|
|
283
|
+
const e = Ke(this.document), t = e ? e.matches(".k-table-td") ? e : (h = this.document) == null ? void 0 : h.body : (n = this.document) == null ? void 0 : n.body, s = t.closest(".k-grid-container"), l = t && ((d = this._element) == null ? void 0 : d.contains(t));
|
|
284
|
+
return !!(t && l && s);
|
|
285
|
+
}, this.onResize = (e, t, s, l, h, n) => {
|
|
286
286
|
this.resetTableWidth(), this._shouldUpdateLeftRight = !0, this._resized = !0, this._columnsMutations++, this.props.onColumnResize && this.props.onColumnResize.call(
|
|
287
287
|
void 0,
|
|
288
288
|
{
|
|
289
289
|
columns: this.columns,
|
|
290
|
-
nativeEvent:
|
|
290
|
+
nativeEvent: l,
|
|
291
291
|
targetColumnId: n,
|
|
292
292
|
index: e,
|
|
293
293
|
newWidth: t,
|
|
@@ -296,44 +296,32 @@ const z = class z extends r.Component {
|
|
|
296
296
|
target: this
|
|
297
297
|
}
|
|
298
298
|
);
|
|
299
|
-
}, this.reInitVirtualization = E((e, t, s,
|
|
299
|
+
}, this.reInitVirtualization = E((e, t, s, l, h, n) => {
|
|
300
300
|
this.vs.reset();
|
|
301
301
|
const d = this.getVirtualScroll(this.props);
|
|
302
302
|
this.vs = new d(n);
|
|
303
|
-
}), this.flatData = E((e, t, s,
|
|
303
|
+
}), this.flatData = E((e, t, s, l, h, n, d) => {
|
|
304
304
|
const f = [], R = mt(
|
|
305
305
|
f,
|
|
306
306
|
e,
|
|
307
307
|
t,
|
|
308
308
|
{ index: s },
|
|
309
|
-
|
|
309
|
+
l !== void 0,
|
|
310
310
|
h
|
|
311
311
|
);
|
|
312
312
|
return { flattedData: f, resolvedGroupsCount: R };
|
|
313
|
-
}), this.rowHeightService = E((e, t, s,
|
|
313
|
+
}), this.rowHeightService = E((e, t, s, l, h) => new re(t, s, l, h)), this.childrenToArray = E((e) => r.Children.toArray(e)), this.readColumns = E(
|
|
314
314
|
(e, t, s) => {
|
|
315
|
-
const
|
|
316
|
-
return ft(
|
|
315
|
+
const l = e.filter((h) => h && h.type && h.type.displayName === "KendoReactGridColumn");
|
|
316
|
+
return ft(l, this.columns, { prevId: 0, idPrefix: t });
|
|
317
317
|
}
|
|
318
318
|
), this.mapColumns = E(
|
|
319
319
|
(e, t) => $e(e, !0)
|
|
320
|
-
), this.
|
|
321
|
-
const t = (s) => {
|
|
322
|
-
const a = s;
|
|
323
|
-
return {
|
|
324
|
-
...a,
|
|
325
|
-
props: {
|
|
326
|
-
...a.props,
|
|
327
|
-
children: a.props.children && a.props.children.length > 0 ? this.filterHiddenColumns(a.props.children) : a.props.children
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
};
|
|
331
|
-
return [...e].filter((s) => r.isValidElement(s) && !s.props.hidden).filter((s) => N && s && r.isValidElement(s) && s.props.media ? window.matchMedia(s.props.media).matches : s).map((s) => t(s));
|
|
332
|
-
}, this.configureColumns = E((e, t, s) => {
|
|
320
|
+
), this.filterColumnsByMediaProp = (e) => e.filter((t) => N && t && t.media ? window.matchMedia(t.media).matches : t), this.configureColumns = E((e, t, s) => {
|
|
333
321
|
this.props.selectedField && e.filter((n) => n.field === this.props.selectedField).forEach((n) => {
|
|
334
322
|
n.width = n.width || "50px", n.cell = n.cell || et, n.headerCell = n.headerCell || yt;
|
|
335
323
|
});
|
|
336
|
-
const
|
|
324
|
+
const l = {
|
|
337
325
|
id: "",
|
|
338
326
|
resizable: !0,
|
|
339
327
|
width: "32px",
|
|
@@ -354,21 +342,21 @@ const z = class z extends r.Component {
|
|
|
354
342
|
};
|
|
355
343
|
let h = 0;
|
|
356
344
|
this.props.expandField && this.props.onExpandChange && this.props.detail && (e.unshift({
|
|
357
|
-
...
|
|
345
|
+
...l,
|
|
358
346
|
cell: tt,
|
|
359
347
|
field: this.props.expandField,
|
|
360
348
|
headerClassName: "k-hierarchy-cell k-header"
|
|
361
349
|
}), h++);
|
|
362
350
|
for (let n = 0; n < t; n++)
|
|
363
351
|
e.unshift({
|
|
364
|
-
...
|
|
352
|
+
...l,
|
|
365
353
|
isAccessible: !1,
|
|
366
354
|
cell: ve,
|
|
367
355
|
field: "value",
|
|
368
356
|
locked: this.props.lockGroups
|
|
369
357
|
}), h++;
|
|
370
358
|
e.slice(h).forEach((n) => n.parentIndex >= 0 && (n.parentIndex += h));
|
|
371
|
-
}), this.getHeaderRow = E((e, t, s,
|
|
359
|
+
}), this.getHeaderRow = E((e, t, s, l, h, n, d, f, R, I, T, C, M) => /* @__PURE__ */ r.createElement(
|
|
372
360
|
ot,
|
|
373
361
|
{
|
|
374
362
|
cells: this.props.cells,
|
|
@@ -376,14 +364,14 @@ const z = class z extends r.Component {
|
|
|
376
364
|
sortable: t,
|
|
377
365
|
sortChange: this.sortChange,
|
|
378
366
|
group: s || [],
|
|
379
|
-
groupable:
|
|
367
|
+
groupable: l,
|
|
380
368
|
groupChange: this.groupChange,
|
|
381
369
|
filter: h,
|
|
382
370
|
filterable: n,
|
|
383
371
|
filterOperators: d,
|
|
384
372
|
filterChange: this.filterChange,
|
|
385
373
|
columnMenu: R,
|
|
386
|
-
columnMenuIcon:
|
|
374
|
+
columnMenuIcon: I,
|
|
387
375
|
selectionChange: this.onHeaderSelectionChange,
|
|
388
376
|
columns: T,
|
|
389
377
|
columnResize: this.columnResize,
|
|
@@ -400,23 +388,23 @@ const z = class z extends r.Component {
|
|
|
400
388
|
columnGroupChange: this.columnGroupChange
|
|
401
389
|
}
|
|
402
390
|
)), this.resolveTitle = (e) => {
|
|
403
|
-
const t = this._columns.find((
|
|
391
|
+
const t = this._columns.find((l) => l.field === e), s = t && (t.title || t.field);
|
|
404
392
|
return s === void 0 ? e : s;
|
|
405
393
|
}, this.getLeafDataItems = () => this._data.filter((e) => e.rowType === "data").map((e) => e.dataItem), this.getSlicedLeafDataItems = () => (this._slicedData || this._data).filter((e) => e.rowType === "data").map((e) => e.dataItem), this.handleFocusInEditableRows = () => {
|
|
406
394
|
var e, t, s;
|
|
407
395
|
if (this.tableBodyRef.current && ((e = this.tableBodyRef.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
|
|
408
396
|
this._singleEditRow = !1, (t = document.activeElement) != null && t.closest(".k-grid-edit-row") ? this._lastActiveElement = document.activeElement : this._lastActiveElement = void 0;
|
|
409
|
-
const
|
|
410
|
-
|
|
397
|
+
const l = Array.from((s = this.tableBodyRef.current) == null ? void 0 : s.getElementsByClassName("k-grid-edit-row"));
|
|
398
|
+
l.length > this.rowsInEdit.length ? this._newEditableRow = l.filter((h) => !this.rowsInEdit.includes(h))[0] : l.length === 1 && (this._newEditableRow = l[0], this._singleEditRow = !0), this.rowsInEdit = l;
|
|
411
399
|
}
|
|
412
400
|
}, We(Re), this.showLicenseWatermark = Ve(Re);
|
|
413
|
-
const p = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(
|
|
414
|
-
this.vs = new c(p ||
|
|
401
|
+
const p = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(a);
|
|
402
|
+
this.vs = new c(p || a.rowHeight === void 0 || a.rowHeight === 0), this.dragLogic = new gt(
|
|
415
403
|
this.columnReorder.bind(this),
|
|
416
404
|
this.groupReorder.bind(this),
|
|
417
405
|
this.columnToGroup.bind(this)
|
|
418
|
-
), this.columnGroupChange = this.columnGroupChange.bind(this), this.columnResize = new ut(this.onResize), this.props.clipboard && (this.clipboardService = new je(this.onClipboard)),
|
|
419
|
-
navigatable: !!
|
|
406
|
+
), this.columnGroupChange = this.columnGroupChange.bind(this), this.columnResize = new ut(this.onResize), this.props.clipboard && (this.clipboardService = new je(this.onClipboard)), _.onConstructor({
|
|
407
|
+
navigatable: !!a.navigatable,
|
|
420
408
|
contextStateRef: this.contextStateRef,
|
|
421
409
|
navigationStateRef: this.navigationStateRef,
|
|
422
410
|
idPrefix: this._gridId
|
|
@@ -463,8 +451,8 @@ const z = class z extends r.Component {
|
|
|
463
451
|
*/
|
|
464
452
|
// tslint:enable:max-line-length
|
|
465
453
|
get columns() {
|
|
466
|
-
const
|
|
467
|
-
return bt(
|
|
454
|
+
const a = this._columns.filter((p) => p.declarationIndex >= 0 && p.parentIndex === -1);
|
|
455
|
+
return bt(a);
|
|
468
456
|
}
|
|
469
457
|
/**
|
|
470
458
|
* Returns the HTML element of the Grid component.
|
|
@@ -488,8 +476,8 @@ const z = class z extends r.Component {
|
|
|
488
476
|
componentDidMount() {
|
|
489
477
|
var c;
|
|
490
478
|
this.props.columnVirtualization && !navigator.userAgent.match(xt) && (this.headTable && (this.headTable.style.display = "block"), this.tableElement && (this.tableElement.style.display = "block")), this.resetTableWidth(), ae(this.getCachedScrollbarWidth());
|
|
491
|
-
const
|
|
492
|
-
this.isRtl =
|
|
479
|
+
const a = qe(this.element);
|
|
480
|
+
this.isRtl = a, _.onComponentDidMount({
|
|
493
481
|
scope: this.element || void 0,
|
|
494
482
|
contextStateRef: this.contextStateRef,
|
|
495
483
|
navigationStateRef: this.navigationStateRef
|
|
@@ -504,7 +492,7 @@ const z = class z extends r.Component {
|
|
|
504
492
|
* @hidden
|
|
505
493
|
*/
|
|
506
494
|
getSnapshotBeforeUpdate() {
|
|
507
|
-
return
|
|
495
|
+
return _.onGetSnapshotBeforeUpdate({
|
|
508
496
|
document: this.document,
|
|
509
497
|
contextStateRef: this.contextStateRef,
|
|
510
498
|
navigationStateRef: this.navigationStateRef
|
|
@@ -514,7 +502,7 @@ const z = class z extends r.Component {
|
|
|
514
502
|
* @hidden
|
|
515
503
|
*/
|
|
516
504
|
componentDidUpdate() {
|
|
517
|
-
this.resetTableWidth(), ae(this.getCachedScrollbarWidth()), this.vs.tableTransform && this.vs.table && (this.vs.table.style.transform = this.vs.tableTransform, this.vs.tableTransform = ""), this.handleFocusInEditableRows(),
|
|
505
|
+
this.resetTableWidth(), ae(this.getCachedScrollbarWidth()), this.vs.tableTransform && this.vs.table && (this.vs.table.style.transform = this.vs.tableTransform, this.vs.tableTransform = ""), this.handleFocusInEditableRows(), _.onComponentDidUpdate({
|
|
518
506
|
scope: this.element || void 0,
|
|
519
507
|
contextStateRef: this.contextStateRef,
|
|
520
508
|
navigationStateRef: this.navigationStateRef,
|
|
@@ -529,19 +517,19 @@ const z = class z extends r.Component {
|
|
|
529
517
|
* @hidden
|
|
530
518
|
*/
|
|
531
519
|
componentWillUnmount() {
|
|
532
|
-
var
|
|
533
|
-
clearTimeout(this.forceUpdateTimeout), this.clipboardService && this.clipboardService.removeEventListeners(this.document), (
|
|
520
|
+
var a;
|
|
521
|
+
clearTimeout(this.forceUpdateTimeout), this.clipboardService && this.clipboardService.removeEventListeners(this.document), (a = this.document) != null && a.body && this.resizeObserver && this.resizeObserver.disconnect();
|
|
534
522
|
}
|
|
535
523
|
/**
|
|
536
524
|
* @hidden
|
|
537
525
|
*/
|
|
538
526
|
render() {
|
|
539
527
|
var ie;
|
|
540
|
-
let
|
|
541
|
-
const p =
|
|
528
|
+
let a = this.props.total || 0;
|
|
529
|
+
const p = x.getIdPrefix(this.navigationStateRef), c = nt(this);
|
|
542
530
|
let e = [];
|
|
543
|
-
Array.isArray(this.props.data) ? (e = this.props.data,
|
|
544
|
-
const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", s = this.props.scrollable === "virtual", { resolvedGroupsCount:
|
|
531
|
+
Array.isArray(this.props.data) ? (e = this.props.data, a = a || this.props.data.length) : this.props.data && (e = this.props.data.data, a = a || this.props.data.total);
|
|
532
|
+
const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", s = this.props.scrollable === "virtual", { resolvedGroupsCount: l, flattedData: h } = this.flatData(
|
|
545
533
|
e,
|
|
546
534
|
t,
|
|
547
535
|
this.props.skip || 0,
|
|
@@ -554,10 +542,10 @@ const z = class z extends r.Component {
|
|
|
554
542
|
const n = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1;
|
|
555
543
|
this.columnResize.resizable = this.props.resizable || !1, this.dragLogic.reorderable = this.props.reorderable || !1, this.dragLogic.groupable = n;
|
|
556
544
|
const d = this.props.selectable && this.props.selectable.drag ? "none" : void 0;
|
|
557
|
-
this.initializeVirtualization(
|
|
545
|
+
this.initializeVirtualization(a, n);
|
|
558
546
|
const f = this.childrenToArray(this.props.children);
|
|
559
|
-
this.initColumns(f,
|
|
560
|
-
const R = f.map((i) => i && i.type && i.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(i, { ...i.props, ariaControls: this._gridId }) : null),
|
|
547
|
+
this.initColumns(f, l);
|
|
548
|
+
const R = f.map((i) => i && i.type && i.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(i, { ...i.props, ariaControls: this._gridId }) : null), I = f.filter((i) => i && i.type && i.type.displayName === "KendoReactGridNoRecords"), T = f.filter((i) => i && i.type && i.type.displayName === "KendoReactGridStatusBar"), C = this._columns.filter((i) => i.children.length === 0), M = n && /* @__PURE__ */ r.createElement(
|
|
561
549
|
at,
|
|
562
550
|
{
|
|
563
551
|
group: this.props.group || [],
|
|
@@ -625,7 +613,7 @@ const z = class z extends r.Component {
|
|
|
625
613
|
tableViewPortWidth: De,
|
|
626
614
|
scrollLeft: Te
|
|
627
615
|
}), Fe = (i, g, m) => {
|
|
628
|
-
let
|
|
616
|
+
let k = !1;
|
|
629
617
|
const S = this.props.selectedField ? be(this.props.selectedField, i.dataItem) : void 0;
|
|
630
618
|
return {
|
|
631
619
|
row: C.map((u, b) => {
|
|
@@ -635,7 +623,7 @@ const z = class z extends r.Component {
|
|
|
635
623
|
let y = !1;
|
|
636
624
|
if (u.editable && this.props.editField) {
|
|
637
625
|
const v = be(this.props.editField, i.dataItem);
|
|
638
|
-
v && (v === !0 || v === u.field) && (
|
|
626
|
+
v && (v === !0 || v === u.field) && (k = !0, y = !0);
|
|
639
627
|
}
|
|
640
628
|
const W = u.cell || y && st || Rt, F = this.props.expandField && this.props.detail && u.field === this.props.expandField;
|
|
641
629
|
return /* @__PURE__ */ r.createElement(
|
|
@@ -644,7 +632,7 @@ const z = class z extends r.Component {
|
|
|
644
632
|
onContextMenu: this.onContextMenu,
|
|
645
633
|
key: H,
|
|
646
634
|
locked: this.props.lockGroups,
|
|
647
|
-
id:
|
|
635
|
+
id: x.generateNavigatableId(
|
|
648
636
|
`${g}-${String(b)}`,
|
|
649
637
|
p,
|
|
650
638
|
F || i.rowType === "groupHeader" || i.rowType === "groupFooter" || u.field === "value" ? "nodata" : "cell"
|
|
@@ -673,7 +661,7 @@ const z = class z extends r.Component {
|
|
|
673
661
|
}
|
|
674
662
|
);
|
|
675
663
|
}),
|
|
676
|
-
isInEdit:
|
|
664
|
+
isInEdit: k,
|
|
677
665
|
isSelected: typeof S == "boolean" && S
|
|
678
666
|
};
|
|
679
667
|
};
|
|
@@ -694,9 +682,9 @@ const z = class z extends r.Component {
|
|
|
694
682
|
let D = 0;
|
|
695
683
|
if (this._data.length) {
|
|
696
684
|
let i = -1, g = 0;
|
|
697
|
-
(this._slicedData || this._data).forEach((m,
|
|
685
|
+
(this._slicedData || this._data).forEach((m, k) => {
|
|
698
686
|
m.rowType === "data" && (J++, i++);
|
|
699
|
-
const S = J % 2 === 0, u = this.props.dataItemKey && Be(this.props.dataItemKey)(m.dataItem), b =
|
|
687
|
+
const S = J % 2 === 0, u = this.props.dataItemKey && Be(this.props.dataItemKey)(m.dataItem), b = k + (this.vs.realSkip || 0), H = u || "ai" + b, A = H + "_1", w = Fe(m, H, i);
|
|
700
688
|
if (D = b + X + g, O.push(/* @__PURE__ */ r.createElement(
|
|
701
689
|
wt,
|
|
702
690
|
{
|
|
@@ -705,7 +693,7 @@ const z = class z extends r.Component {
|
|
|
705
693
|
isAltRow: S,
|
|
706
694
|
isInEdit: w.isInEdit,
|
|
707
695
|
rowType: m.rowType,
|
|
708
|
-
isHidden: q(
|
|
696
|
+
isHidden: q(k),
|
|
709
697
|
onClick: (y) => this.rowClick(y, m),
|
|
710
698
|
onDoubleClick: (y) => this.rowDblClick(y, m),
|
|
711
699
|
selectedField: this.props.selectedField,
|
|
@@ -727,7 +715,7 @@ const z = class z extends r.Component {
|
|
|
727
715
|
"k-table-row",
|
|
728
716
|
S ? "k-detail-row k-table-alt-row k-alt" : "k-detail-row"
|
|
729
717
|
),
|
|
730
|
-
style: { visibility: q(
|
|
718
|
+
style: { visibility: q(k) ? "hidden" : "", height: this.props.detailRowHeight },
|
|
731
719
|
role: "row",
|
|
732
720
|
"aria-rowindex": D
|
|
733
721
|
},
|
|
@@ -754,7 +742,7 @@ const z = class z extends r.Component {
|
|
|
754
742
|
this.props.expandField && /* @__PURE__ */ r.createElement(
|
|
755
743
|
_t,
|
|
756
744
|
{
|
|
757
|
-
id:
|
|
745
|
+
id: x.generateNavigatableId(`${A}-dhcell`, p)
|
|
758
746
|
}
|
|
759
747
|
),
|
|
760
748
|
/* @__PURE__ */ r.createElement(
|
|
@@ -766,7 +754,7 @@ const z = class z extends r.Component {
|
|
|
766
754
|
colSpan: y,
|
|
767
755
|
ariaColIndex: 2 + (this.props.group ? this.props.group.length : 0),
|
|
768
756
|
detail: this.props.detail,
|
|
769
|
-
id:
|
|
757
|
+
id: x.generateNavigatableId(`${A}-dcell`, p)
|
|
770
758
|
}
|
|
771
759
|
)
|
|
772
760
|
));
|
|
@@ -784,11 +772,11 @@ const z = class z extends r.Component {
|
|
|
784
772
|
className: "k-grid-norecords",
|
|
785
773
|
style: { width: Ne() }
|
|
786
774
|
},
|
|
787
|
-
/* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template", [Ze]:
|
|
775
|
+
/* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template", [Ze]: x.generateNavigatableId("no-records", p) }, I.length ? I : /* @__PURE__ */ r.createElement(Et, null))
|
|
788
776
|
), Q = {
|
|
789
777
|
size: this.props.size,
|
|
790
778
|
onPageChange: this.pagerPageChange,
|
|
791
|
-
total:
|
|
779
|
+
total: a,
|
|
792
780
|
dir: this.isRtl ? "rtl" : void 0,
|
|
793
781
|
skip: this.vs.propsSkip || 0,
|
|
794
782
|
take: (this.props.take !== void 0 ? this.props.take : this.props.pageSize) || 10,
|
|
@@ -927,7 +915,7 @@ const z = class z extends r.Component {
|
|
|
927
915
|
className: "k-grid-aria-root",
|
|
928
916
|
role: "grid",
|
|
929
917
|
"aria-colcount": C.length,
|
|
930
|
-
"aria-rowcount":
|
|
918
|
+
"aria-rowcount": a,
|
|
931
919
|
id: this._gridId,
|
|
932
920
|
"aria-label": c.toLanguageString(ue, dt[ue])
|
|
933
921
|
},
|
|
@@ -994,9 +982,9 @@ const z = class z extends r.Component {
|
|
|
994
982
|
calculateMedia() {
|
|
995
983
|
this.checkMatchMediaColumnsDifferece() || this.forceUpdate();
|
|
996
984
|
}
|
|
997
|
-
selectionChange(
|
|
985
|
+
selectionChange(a) {
|
|
998
986
|
if (this.props.onSelectionChange) {
|
|
999
|
-
const { event: p, dataItem: c, dataIndex: e, columnIndex: t } =
|
|
987
|
+
const { event: p, dataItem: c, dataIndex: e, columnIndex: t } = a, { mode: s, cell: l } = le(this.props.selectable), h = {
|
|
1000
988
|
...this.getArguments(p.syntheticEvent),
|
|
1001
989
|
dataItem: c,
|
|
1002
990
|
startColIndex: t,
|
|
@@ -1009,7 +997,7 @@ const z = class z extends r.Component {
|
|
|
1009
997
|
shiftKey: !1,
|
|
1010
998
|
metaKey: !1,
|
|
1011
999
|
mode: s,
|
|
1012
|
-
cell:
|
|
1000
|
+
cell: l,
|
|
1013
1001
|
isDrag: !1,
|
|
1014
1002
|
componentId: this._gridId,
|
|
1015
1003
|
selectedField: this.props.selectedField || ""
|
|
@@ -1017,11 +1005,11 @@ const z = class z extends r.Component {
|
|
|
1017
1005
|
this.props.onSelectionChange.call(void 0, h);
|
|
1018
1006
|
}
|
|
1019
1007
|
}
|
|
1020
|
-
raiseDataEvent(
|
|
1008
|
+
raiseDataEvent(a, p, c, e, t) {
|
|
1021
1009
|
const s = this.props.onDataStateChange;
|
|
1022
|
-
if (
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1010
|
+
if (a) {
|
|
1011
|
+
const l = { ...this.getArguments(e), ...p, targetEvent: t };
|
|
1012
|
+
a.call(void 0, l);
|
|
1025
1013
|
} else
|
|
1026
1014
|
s && s.call(
|
|
1027
1015
|
void 0,
|
|
@@ -1035,15 +1023,15 @@ const z = class z extends r.Component {
|
|
|
1035
1023
|
}
|
|
1036
1024
|
);
|
|
1037
1025
|
}
|
|
1038
|
-
columnReorder(
|
|
1039
|
-
const e = this._columns[
|
|
1026
|
+
columnReorder(a, p, c) {
|
|
1027
|
+
const e = this._columns[a], t = e.depth, s = (d) => {
|
|
1040
1028
|
do
|
|
1041
1029
|
d++;
|
|
1042
1030
|
while (d < this._columns.length && this._columns[d].depth > t);
|
|
1043
1031
|
return d;
|
|
1044
|
-
},
|
|
1045
|
-
this._columns.splice(
|
|
1046
|
-
const h = this._columns[
|
|
1032
|
+
}, l = this._columns.splice(a, s(a) - a);
|
|
1033
|
+
this._columns.splice(a < p ? s(p - l.length) : p, 0, ...l), this._columns.filter((d) => d.declarationIndex >= 0).forEach((d, f) => d.orderIndex = f), this._columnsMutations++;
|
|
1034
|
+
const h = this._columns[a].locked && this._columns[p].locked;
|
|
1047
1035
|
Ye(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), Qe(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), this._resized && (this._shouldUpdateLeftRight = !1, this._resized = !1);
|
|
1048
1036
|
const n = this.columns;
|
|
1049
1037
|
if (this.forceUpdate(), this.props.onColumnReorder) {
|
|
@@ -1056,25 +1044,25 @@ const z = class z extends r.Component {
|
|
|
1056
1044
|
this.props.onColumnReorder.call(void 0, d);
|
|
1057
1045
|
}
|
|
1058
1046
|
}
|
|
1059
|
-
groupReorder(
|
|
1047
|
+
groupReorder(a, p, c) {
|
|
1060
1048
|
if (this.props.group === void 0)
|
|
1061
1049
|
return;
|
|
1062
1050
|
const e = this.props.group.slice();
|
|
1063
|
-
e.splice(p, 0, ...e.splice(
|
|
1051
|
+
e.splice(p, 0, ...e.splice(a, 1)), this.groupChange(e, c);
|
|
1064
1052
|
}
|
|
1065
|
-
columnToGroup(
|
|
1066
|
-
const e = this._columns[
|
|
1053
|
+
columnToGroup(a, p, c) {
|
|
1054
|
+
const e = this._columns[a].field;
|
|
1067
1055
|
if (!e)
|
|
1068
1056
|
return;
|
|
1069
1057
|
const t = (this.props.group || []).slice();
|
|
1070
1058
|
t.splice(p, 0, { field: e }), this.groupChange(t, c);
|
|
1071
1059
|
}
|
|
1072
|
-
columnGroupChange(
|
|
1060
|
+
columnGroupChange(a, p) {
|
|
1073
1061
|
const c = this.dragLogic.getCurrentGroupsLength;
|
|
1074
|
-
this.columnToGroup(
|
|
1062
|
+
this.columnToGroup(a, c, p);
|
|
1075
1063
|
}
|
|
1076
1064
|
resetTableWidth() {
|
|
1077
|
-
let
|
|
1065
|
+
let a = 0;
|
|
1078
1066
|
if (!this.columnResize.colGroupMain)
|
|
1079
1067
|
return;
|
|
1080
1068
|
const p = this.columnResize.colGroupMain.children;
|
|
@@ -1082,12 +1070,12 @@ const z = class z extends r.Component {
|
|
|
1082
1070
|
const e = p[c].width;
|
|
1083
1071
|
if (!e)
|
|
1084
1072
|
return;
|
|
1085
|
-
|
|
1073
|
+
a += parseFloat(e.toString());
|
|
1086
1074
|
}
|
|
1087
|
-
|
|
1075
|
+
a = Math.round(a), this._header && this._header.setWidth(a), this._footer && this._footer.setWidth(a), this.tableElement && (this.tableElement.style.width = a + "px");
|
|
1088
1076
|
}
|
|
1089
|
-
initColumns(
|
|
1090
|
-
const c =
|
|
1077
|
+
initColumns(a, p) {
|
|
1078
|
+
const c = x.getIdPrefix(this.navigationStateRef), e = this.readColumns(a, c, this._columnsMutations), t = this.filterColumnsByMediaProp(e);
|
|
1091
1079
|
this._columns = t, this._columns.length === 0 && (this._columns = vt(this.props.data, this.props.group, this.props.expandField, { prevId: 0, idPrefix: c })), this.configureColumns(this._columns, p, c), this._columnsMap = this.mapColumns(this._columns, this._columnsMutations), this.columnResize.columns = this._columns, this.dragLogic.columns = this._columns;
|
|
1092
1080
|
}
|
|
1093
1081
|
getDataState() {
|
|
@@ -1099,10 +1087,10 @@ const z = class z extends r.Component {
|
|
|
1099
1087
|
group: this.props.group
|
|
1100
1088
|
};
|
|
1101
1089
|
}
|
|
1102
|
-
getArguments(
|
|
1090
|
+
getArguments(a) {
|
|
1103
1091
|
return {
|
|
1104
|
-
nativeEvent:
|
|
1105
|
-
syntheticEvent:
|
|
1092
|
+
nativeEvent: a && a.nativeEvent,
|
|
1093
|
+
syntheticEvent: a,
|
|
1106
1094
|
target: this
|
|
1107
1095
|
};
|
|
1108
1096
|
}
|