@progress/kendo-react-grid 8.2.0-develop.24 → 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 +103 -113
- 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,13 +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
|
-
onNavigationAction: this.onNavigationAction
|
|
123
|
+
onNavigationAction: this.onNavigationAction,
|
|
124
|
+
columns: this.columns
|
|
124
125
|
}), this.props.onKeyDown) {
|
|
125
|
-
const { mode: t, cell: s } = le(this.props.selectable),
|
|
126
|
+
const { mode: t, cell: s } = le(this.props.selectable), l = {
|
|
126
127
|
dataItems: this.getLeafDataItems(),
|
|
127
128
|
mode: t,
|
|
128
129
|
cell: s,
|
|
@@ -130,10 +131,10 @@ const z = class z extends r.Component {
|
|
|
130
131
|
selectedField: this.props.selectedField,
|
|
131
132
|
...this.getArguments(e)
|
|
132
133
|
};
|
|
133
|
-
this.props.onKeyDown.call(void 0,
|
|
134
|
+
this.props.onKeyDown.call(void 0, l);
|
|
134
135
|
}
|
|
135
136
|
}, this.onFocus = (e) => {
|
|
136
|
-
|
|
137
|
+
_.onFocus(e, {
|
|
137
138
|
contextStateRef: this.contextStateRef
|
|
138
139
|
});
|
|
139
140
|
}, this.onNavigationAction = (e) => {
|
|
@@ -206,7 +207,7 @@ const z = class z extends r.Component {
|
|
|
206
207
|
);
|
|
207
208
|
}, this.selectionRelease = (e) => {
|
|
208
209
|
if (this.props.onSelectionChange) {
|
|
209
|
-
const t = this.getSlicedLeafDataItems()[e.startRowIndex], s = this.getSlicedLeafDataItems()[e.endRowIndex],
|
|
210
|
+
const t = this.getSlicedLeafDataItems()[e.startRowIndex], s = this.getSlicedLeafDataItems()[e.endRowIndex], l = {
|
|
210
211
|
syntheticEvent: void 0,
|
|
211
212
|
target: this,
|
|
212
213
|
selectedField: this.props.selectedField || "",
|
|
@@ -217,7 +218,7 @@ const z = class z extends r.Component {
|
|
|
217
218
|
endDataItem: s,
|
|
218
219
|
...e
|
|
219
220
|
};
|
|
220
|
-
this.props.onSelectionChange.call(void 0,
|
|
221
|
+
this.props.onSelectionChange.call(void 0, l);
|
|
221
222
|
}
|
|
222
223
|
}, this.pageChange = (e, t, s) => {
|
|
223
224
|
this.raiseDataEvent(
|
|
@@ -231,8 +232,8 @@ const z = class z extends r.Component {
|
|
|
231
232
|
let e = this.props.total || 0;
|
|
232
233
|
return Array.isArray(this.props.data) ? e = e || this.props.data.length : this.props.data && (e = e || this.props.data.total), e;
|
|
233
234
|
}, this.moveToNextPage = (e) => {
|
|
234
|
-
const t = this.props.take || 0, s = (this.props.skip || 0) + t,
|
|
235
|
-
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);
|
|
236
237
|
}, this.moveToPrevPage = (e) => {
|
|
237
238
|
const t = this.props.take || 0, s = (this.props.skip || 0) - t;
|
|
238
239
|
s >= 0 && this.pageChange({ skip: s, take: t }, e);
|
|
@@ -279,14 +280,14 @@ const z = class z extends r.Component {
|
|
|
279
280
|
var h, n, d;
|
|
280
281
|
if (!N)
|
|
281
282
|
return !1;
|
|
282
|
-
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"),
|
|
283
|
-
return !!(t &&
|
|
284
|
-
}, 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) => {
|
|
285
286
|
this.resetTableWidth(), this._shouldUpdateLeftRight = !0, this._resized = !0, this._columnsMutations++, this.props.onColumnResize && this.props.onColumnResize.call(
|
|
286
287
|
void 0,
|
|
287
288
|
{
|
|
288
289
|
columns: this.columns,
|
|
289
|
-
nativeEvent:
|
|
290
|
+
nativeEvent: l,
|
|
290
291
|
targetColumnId: n,
|
|
291
292
|
index: e,
|
|
292
293
|
newWidth: t,
|
|
@@ -295,44 +296,32 @@ const z = class z extends r.Component {
|
|
|
295
296
|
target: this
|
|
296
297
|
}
|
|
297
298
|
);
|
|
298
|
-
}, this.reInitVirtualization = E((e, t, s,
|
|
299
|
+
}, this.reInitVirtualization = E((e, t, s, l, h, n) => {
|
|
299
300
|
this.vs.reset();
|
|
300
301
|
const d = this.getVirtualScroll(this.props);
|
|
301
302
|
this.vs = new d(n);
|
|
302
|
-
}), this.flatData = E((e, t, s,
|
|
303
|
+
}), this.flatData = E((e, t, s, l, h, n, d) => {
|
|
303
304
|
const f = [], R = mt(
|
|
304
305
|
f,
|
|
305
306
|
e,
|
|
306
307
|
t,
|
|
307
308
|
{ index: s },
|
|
308
|
-
|
|
309
|
+
l !== void 0,
|
|
309
310
|
h
|
|
310
311
|
);
|
|
311
312
|
return { flattedData: f, resolvedGroupsCount: R };
|
|
312
|
-
}), 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(
|
|
313
314
|
(e, t, s) => {
|
|
314
|
-
const
|
|
315
|
-
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 });
|
|
316
317
|
}
|
|
317
318
|
), this.mapColumns = E(
|
|
318
319
|
(e, t) => $e(e, !0)
|
|
319
|
-
), this.
|
|
320
|
-
const t = (s) => {
|
|
321
|
-
const a = s;
|
|
322
|
-
return {
|
|
323
|
-
...a,
|
|
324
|
-
props: {
|
|
325
|
-
...a.props,
|
|
326
|
-
children: a.props.children && a.props.children.length > 0 ? this.filterHiddenColumns(a.props.children) : a.props.children
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
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));
|
|
331
|
-
}, 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) => {
|
|
332
321
|
this.props.selectedField && e.filter((n) => n.field === this.props.selectedField).forEach((n) => {
|
|
333
322
|
n.width = n.width || "50px", n.cell = n.cell || et, n.headerCell = n.headerCell || yt;
|
|
334
323
|
});
|
|
335
|
-
const
|
|
324
|
+
const l = {
|
|
336
325
|
id: "",
|
|
337
326
|
resizable: !0,
|
|
338
327
|
width: "32px",
|
|
@@ -353,21 +342,21 @@ const z = class z extends r.Component {
|
|
|
353
342
|
};
|
|
354
343
|
let h = 0;
|
|
355
344
|
this.props.expandField && this.props.onExpandChange && this.props.detail && (e.unshift({
|
|
356
|
-
...
|
|
345
|
+
...l,
|
|
357
346
|
cell: tt,
|
|
358
347
|
field: this.props.expandField,
|
|
359
348
|
headerClassName: "k-hierarchy-cell k-header"
|
|
360
349
|
}), h++);
|
|
361
350
|
for (let n = 0; n < t; n++)
|
|
362
351
|
e.unshift({
|
|
363
|
-
...
|
|
352
|
+
...l,
|
|
364
353
|
isAccessible: !1,
|
|
365
354
|
cell: ve,
|
|
366
355
|
field: "value",
|
|
367
356
|
locked: this.props.lockGroups
|
|
368
357
|
}), h++;
|
|
369
358
|
e.slice(h).forEach((n) => n.parentIndex >= 0 && (n.parentIndex += h));
|
|
370
|
-
}), 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(
|
|
371
360
|
ot,
|
|
372
361
|
{
|
|
373
362
|
cells: this.props.cells,
|
|
@@ -375,14 +364,14 @@ const z = class z extends r.Component {
|
|
|
375
364
|
sortable: t,
|
|
376
365
|
sortChange: this.sortChange,
|
|
377
366
|
group: s || [],
|
|
378
|
-
groupable:
|
|
367
|
+
groupable: l,
|
|
379
368
|
groupChange: this.groupChange,
|
|
380
369
|
filter: h,
|
|
381
370
|
filterable: n,
|
|
382
371
|
filterOperators: d,
|
|
383
372
|
filterChange: this.filterChange,
|
|
384
373
|
columnMenu: R,
|
|
385
|
-
columnMenuIcon:
|
|
374
|
+
columnMenuIcon: I,
|
|
386
375
|
selectionChange: this.onHeaderSelectionChange,
|
|
387
376
|
columns: T,
|
|
388
377
|
columnResize: this.columnResize,
|
|
@@ -399,23 +388,23 @@ const z = class z extends r.Component {
|
|
|
399
388
|
columnGroupChange: this.columnGroupChange
|
|
400
389
|
}
|
|
401
390
|
)), this.resolveTitle = (e) => {
|
|
402
|
-
const t = this._columns.find((
|
|
391
|
+
const t = this._columns.find((l) => l.field === e), s = t && (t.title || t.field);
|
|
403
392
|
return s === void 0 ? e : s;
|
|
404
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 = () => {
|
|
405
394
|
var e, t, s;
|
|
406
395
|
if (this.tableBodyRef.current && ((e = this.tableBodyRef.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
|
|
407
396
|
this._singleEditRow = !1, (t = document.activeElement) != null && t.closest(".k-grid-edit-row") ? this._lastActiveElement = document.activeElement : this._lastActiveElement = void 0;
|
|
408
|
-
const
|
|
409
|
-
|
|
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;
|
|
410
399
|
}
|
|
411
400
|
}, We(Re), this.showLicenseWatermark = Ve(Re);
|
|
412
|
-
const p = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(
|
|
413
|
-
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(
|
|
414
403
|
this.columnReorder.bind(this),
|
|
415
404
|
this.groupReorder.bind(this),
|
|
416
405
|
this.columnToGroup.bind(this)
|
|
417
|
-
), this.columnGroupChange = this.columnGroupChange.bind(this), this.columnResize = new ut(this.onResize), this.props.clipboard && (this.clipboardService = new je(this.onClipboard)),
|
|
418
|
-
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,
|
|
419
408
|
contextStateRef: this.contextStateRef,
|
|
420
409
|
navigationStateRef: this.navigationStateRef,
|
|
421
410
|
idPrefix: this._gridId
|
|
@@ -462,8 +451,8 @@ const z = class z extends r.Component {
|
|
|
462
451
|
*/
|
|
463
452
|
// tslint:enable:max-line-length
|
|
464
453
|
get columns() {
|
|
465
|
-
const
|
|
466
|
-
return bt(
|
|
454
|
+
const a = this._columns.filter((p) => p.declarationIndex >= 0 && p.parentIndex === -1);
|
|
455
|
+
return bt(a);
|
|
467
456
|
}
|
|
468
457
|
/**
|
|
469
458
|
* Returns the HTML element of the Grid component.
|
|
@@ -487,8 +476,8 @@ const z = class z extends r.Component {
|
|
|
487
476
|
componentDidMount() {
|
|
488
477
|
var c;
|
|
489
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());
|
|
490
|
-
const
|
|
491
|
-
this.isRtl =
|
|
479
|
+
const a = qe(this.element);
|
|
480
|
+
this.isRtl = a, _.onComponentDidMount({
|
|
492
481
|
scope: this.element || void 0,
|
|
493
482
|
contextStateRef: this.contextStateRef,
|
|
494
483
|
navigationStateRef: this.navigationStateRef
|
|
@@ -503,7 +492,7 @@ const z = class z extends r.Component {
|
|
|
503
492
|
* @hidden
|
|
504
493
|
*/
|
|
505
494
|
getSnapshotBeforeUpdate() {
|
|
506
|
-
return
|
|
495
|
+
return _.onGetSnapshotBeforeUpdate({
|
|
507
496
|
document: this.document,
|
|
508
497
|
contextStateRef: this.contextStateRef,
|
|
509
498
|
navigationStateRef: this.navigationStateRef
|
|
@@ -513,33 +502,34 @@ const z = class z extends r.Component {
|
|
|
513
502
|
* @hidden
|
|
514
503
|
*/
|
|
515
504
|
componentDidUpdate() {
|
|
516
|
-
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({
|
|
517
506
|
scope: this.element || void 0,
|
|
518
507
|
contextStateRef: this.contextStateRef,
|
|
519
508
|
navigationStateRef: this.navigationStateRef,
|
|
520
509
|
focusFirst: this._focusFirst,
|
|
521
510
|
newEditableRow: this._newEditableRow,
|
|
522
511
|
singleEditRow: this._singleEditRow,
|
|
523
|
-
lastActiveElement: this._lastActiveElement
|
|
512
|
+
lastActiveElement: this._lastActiveElement,
|
|
513
|
+
navigatable: this.props.navigatable
|
|
524
514
|
}), this._focusFirst = !1, this._newEditableRow = void 0;
|
|
525
515
|
}
|
|
526
516
|
/**
|
|
527
517
|
* @hidden
|
|
528
518
|
*/
|
|
529
519
|
componentWillUnmount() {
|
|
530
|
-
var
|
|
531
|
-
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();
|
|
532
522
|
}
|
|
533
523
|
/**
|
|
534
524
|
* @hidden
|
|
535
525
|
*/
|
|
536
526
|
render() {
|
|
537
527
|
var ie;
|
|
538
|
-
let
|
|
539
|
-
const p =
|
|
528
|
+
let a = this.props.total || 0;
|
|
529
|
+
const p = x.getIdPrefix(this.navigationStateRef), c = nt(this);
|
|
540
530
|
let e = [];
|
|
541
|
-
Array.isArray(this.props.data) ? (e = this.props.data,
|
|
542
|
-
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(
|
|
543
533
|
e,
|
|
544
534
|
t,
|
|
545
535
|
this.props.skip || 0,
|
|
@@ -552,10 +542,10 @@ const z = class z extends r.Component {
|
|
|
552
542
|
const n = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1;
|
|
553
543
|
this.columnResize.resizable = this.props.resizable || !1, this.dragLogic.reorderable = this.props.reorderable || !1, this.dragLogic.groupable = n;
|
|
554
544
|
const d = this.props.selectable && this.props.selectable.drag ? "none" : void 0;
|
|
555
|
-
this.initializeVirtualization(
|
|
545
|
+
this.initializeVirtualization(a, n);
|
|
556
546
|
const f = this.childrenToArray(this.props.children);
|
|
557
|
-
this.initColumns(f,
|
|
558
|
-
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(
|
|
559
549
|
at,
|
|
560
550
|
{
|
|
561
551
|
group: this.props.group || [],
|
|
@@ -623,7 +613,7 @@ const z = class z extends r.Component {
|
|
|
623
613
|
tableViewPortWidth: De,
|
|
624
614
|
scrollLeft: Te
|
|
625
615
|
}), Fe = (i, g, m) => {
|
|
626
|
-
let
|
|
616
|
+
let k = !1;
|
|
627
617
|
const S = this.props.selectedField ? be(this.props.selectedField, i.dataItem) : void 0;
|
|
628
618
|
return {
|
|
629
619
|
row: C.map((u, b) => {
|
|
@@ -633,7 +623,7 @@ const z = class z extends r.Component {
|
|
|
633
623
|
let y = !1;
|
|
634
624
|
if (u.editable && this.props.editField) {
|
|
635
625
|
const v = be(this.props.editField, i.dataItem);
|
|
636
|
-
v && (v === !0 || v === u.field) && (
|
|
626
|
+
v && (v === !0 || v === u.field) && (k = !0, y = !0);
|
|
637
627
|
}
|
|
638
628
|
const W = u.cell || y && st || Rt, F = this.props.expandField && this.props.detail && u.field === this.props.expandField;
|
|
639
629
|
return /* @__PURE__ */ r.createElement(
|
|
@@ -642,7 +632,7 @@ const z = class z extends r.Component {
|
|
|
642
632
|
onContextMenu: this.onContextMenu,
|
|
643
633
|
key: H,
|
|
644
634
|
locked: this.props.lockGroups,
|
|
645
|
-
id:
|
|
635
|
+
id: x.generateNavigatableId(
|
|
646
636
|
`${g}-${String(b)}`,
|
|
647
637
|
p,
|
|
648
638
|
F || i.rowType === "groupHeader" || i.rowType === "groupFooter" || u.field === "value" ? "nodata" : "cell"
|
|
@@ -671,7 +661,7 @@ const z = class z extends r.Component {
|
|
|
671
661
|
}
|
|
672
662
|
);
|
|
673
663
|
}),
|
|
674
|
-
isInEdit:
|
|
664
|
+
isInEdit: k,
|
|
675
665
|
isSelected: typeof S == "boolean" && S
|
|
676
666
|
};
|
|
677
667
|
};
|
|
@@ -692,9 +682,9 @@ const z = class z extends r.Component {
|
|
|
692
682
|
let D = 0;
|
|
693
683
|
if (this._data.length) {
|
|
694
684
|
let i = -1, g = 0;
|
|
695
|
-
(this._slicedData || this._data).forEach((m,
|
|
685
|
+
(this._slicedData || this._data).forEach((m, k) => {
|
|
696
686
|
m.rowType === "data" && (J++, i++);
|
|
697
|
-
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);
|
|
698
688
|
if (D = b + X + g, O.push(/* @__PURE__ */ r.createElement(
|
|
699
689
|
wt,
|
|
700
690
|
{
|
|
@@ -703,7 +693,7 @@ const z = class z extends r.Component {
|
|
|
703
693
|
isAltRow: S,
|
|
704
694
|
isInEdit: w.isInEdit,
|
|
705
695
|
rowType: m.rowType,
|
|
706
|
-
isHidden: q(
|
|
696
|
+
isHidden: q(k),
|
|
707
697
|
onClick: (y) => this.rowClick(y, m),
|
|
708
698
|
onDoubleClick: (y) => this.rowDblClick(y, m),
|
|
709
699
|
selectedField: this.props.selectedField,
|
|
@@ -725,7 +715,7 @@ const z = class z extends r.Component {
|
|
|
725
715
|
"k-table-row",
|
|
726
716
|
S ? "k-detail-row k-table-alt-row k-alt" : "k-detail-row"
|
|
727
717
|
),
|
|
728
|
-
style: { visibility: q(
|
|
718
|
+
style: { visibility: q(k) ? "hidden" : "", height: this.props.detailRowHeight },
|
|
729
719
|
role: "row",
|
|
730
720
|
"aria-rowindex": D
|
|
731
721
|
},
|
|
@@ -752,7 +742,7 @@ const z = class z extends r.Component {
|
|
|
752
742
|
this.props.expandField && /* @__PURE__ */ r.createElement(
|
|
753
743
|
_t,
|
|
754
744
|
{
|
|
755
|
-
id:
|
|
745
|
+
id: x.generateNavigatableId(`${A}-dhcell`, p)
|
|
756
746
|
}
|
|
757
747
|
),
|
|
758
748
|
/* @__PURE__ */ r.createElement(
|
|
@@ -764,7 +754,7 @@ const z = class z extends r.Component {
|
|
|
764
754
|
colSpan: y,
|
|
765
755
|
ariaColIndex: 2 + (this.props.group ? this.props.group.length : 0),
|
|
766
756
|
detail: this.props.detail,
|
|
767
|
-
id:
|
|
757
|
+
id: x.generateNavigatableId(`${A}-dcell`, p)
|
|
768
758
|
}
|
|
769
759
|
)
|
|
770
760
|
));
|
|
@@ -782,11 +772,11 @@ const z = class z extends r.Component {
|
|
|
782
772
|
className: "k-grid-norecords",
|
|
783
773
|
style: { width: Ne() }
|
|
784
774
|
},
|
|
785
|
-
/* @__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))
|
|
786
776
|
), Q = {
|
|
787
777
|
size: this.props.size,
|
|
788
778
|
onPageChange: this.pagerPageChange,
|
|
789
|
-
total:
|
|
779
|
+
total: a,
|
|
790
780
|
dir: this.isRtl ? "rtl" : void 0,
|
|
791
781
|
skip: this.vs.propsSkip || 0,
|
|
792
782
|
take: (this.props.take !== void 0 ? this.props.take : this.props.pageSize) || 10,
|
|
@@ -925,7 +915,7 @@ const z = class z extends r.Component {
|
|
|
925
915
|
className: "k-grid-aria-root",
|
|
926
916
|
role: "grid",
|
|
927
917
|
"aria-colcount": C.length,
|
|
928
|
-
"aria-rowcount":
|
|
918
|
+
"aria-rowcount": a,
|
|
929
919
|
id: this._gridId,
|
|
930
920
|
"aria-label": c.toLanguageString(ue, dt[ue])
|
|
931
921
|
},
|
|
@@ -992,9 +982,9 @@ const z = class z extends r.Component {
|
|
|
992
982
|
calculateMedia() {
|
|
993
983
|
this.checkMatchMediaColumnsDifferece() || this.forceUpdate();
|
|
994
984
|
}
|
|
995
|
-
selectionChange(
|
|
985
|
+
selectionChange(a) {
|
|
996
986
|
if (this.props.onSelectionChange) {
|
|
997
|
-
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 = {
|
|
998
988
|
...this.getArguments(p.syntheticEvent),
|
|
999
989
|
dataItem: c,
|
|
1000
990
|
startColIndex: t,
|
|
@@ -1007,7 +997,7 @@ const z = class z extends r.Component {
|
|
|
1007
997
|
shiftKey: !1,
|
|
1008
998
|
metaKey: !1,
|
|
1009
999
|
mode: s,
|
|
1010
|
-
cell:
|
|
1000
|
+
cell: l,
|
|
1011
1001
|
isDrag: !1,
|
|
1012
1002
|
componentId: this._gridId,
|
|
1013
1003
|
selectedField: this.props.selectedField || ""
|
|
@@ -1015,11 +1005,11 @@ const z = class z extends r.Component {
|
|
|
1015
1005
|
this.props.onSelectionChange.call(void 0, h);
|
|
1016
1006
|
}
|
|
1017
1007
|
}
|
|
1018
|
-
raiseDataEvent(
|
|
1008
|
+
raiseDataEvent(a, p, c, e, t) {
|
|
1019
1009
|
const s = this.props.onDataStateChange;
|
|
1020
|
-
if (
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1010
|
+
if (a) {
|
|
1011
|
+
const l = { ...this.getArguments(e), ...p, targetEvent: t };
|
|
1012
|
+
a.call(void 0, l);
|
|
1023
1013
|
} else
|
|
1024
1014
|
s && s.call(
|
|
1025
1015
|
void 0,
|
|
@@ -1033,15 +1023,15 @@ const z = class z extends r.Component {
|
|
|
1033
1023
|
}
|
|
1034
1024
|
);
|
|
1035
1025
|
}
|
|
1036
|
-
columnReorder(
|
|
1037
|
-
const e = this._columns[
|
|
1026
|
+
columnReorder(a, p, c) {
|
|
1027
|
+
const e = this._columns[a], t = e.depth, s = (d) => {
|
|
1038
1028
|
do
|
|
1039
1029
|
d++;
|
|
1040
1030
|
while (d < this._columns.length && this._columns[d].depth > t);
|
|
1041
1031
|
return d;
|
|
1042
|
-
},
|
|
1043
|
-
this._columns.splice(
|
|
1044
|
-
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;
|
|
1045
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);
|
|
1046
1036
|
const n = this.columns;
|
|
1047
1037
|
if (this.forceUpdate(), this.props.onColumnReorder) {
|
|
@@ -1054,25 +1044,25 @@ const z = class z extends r.Component {
|
|
|
1054
1044
|
this.props.onColumnReorder.call(void 0, d);
|
|
1055
1045
|
}
|
|
1056
1046
|
}
|
|
1057
|
-
groupReorder(
|
|
1047
|
+
groupReorder(a, p, c) {
|
|
1058
1048
|
if (this.props.group === void 0)
|
|
1059
1049
|
return;
|
|
1060
1050
|
const e = this.props.group.slice();
|
|
1061
|
-
e.splice(p, 0, ...e.splice(
|
|
1051
|
+
e.splice(p, 0, ...e.splice(a, 1)), this.groupChange(e, c);
|
|
1062
1052
|
}
|
|
1063
|
-
columnToGroup(
|
|
1064
|
-
const e = this._columns[
|
|
1053
|
+
columnToGroup(a, p, c) {
|
|
1054
|
+
const e = this._columns[a].field;
|
|
1065
1055
|
if (!e)
|
|
1066
1056
|
return;
|
|
1067
1057
|
const t = (this.props.group || []).slice();
|
|
1068
1058
|
t.splice(p, 0, { field: e }), this.groupChange(t, c);
|
|
1069
1059
|
}
|
|
1070
|
-
columnGroupChange(
|
|
1060
|
+
columnGroupChange(a, p) {
|
|
1071
1061
|
const c = this.dragLogic.getCurrentGroupsLength;
|
|
1072
|
-
this.columnToGroup(
|
|
1062
|
+
this.columnToGroup(a, c, p);
|
|
1073
1063
|
}
|
|
1074
1064
|
resetTableWidth() {
|
|
1075
|
-
let
|
|
1065
|
+
let a = 0;
|
|
1076
1066
|
if (!this.columnResize.colGroupMain)
|
|
1077
1067
|
return;
|
|
1078
1068
|
const p = this.columnResize.colGroupMain.children;
|
|
@@ -1080,12 +1070,12 @@ const z = class z extends r.Component {
|
|
|
1080
1070
|
const e = p[c].width;
|
|
1081
1071
|
if (!e)
|
|
1082
1072
|
return;
|
|
1083
|
-
|
|
1073
|
+
a += parseFloat(e.toString());
|
|
1084
1074
|
}
|
|
1085
|
-
|
|
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");
|
|
1086
1076
|
}
|
|
1087
|
-
initColumns(
|
|
1088
|
-
const c =
|
|
1077
|
+
initColumns(a, p) {
|
|
1078
|
+
const c = x.getIdPrefix(this.navigationStateRef), e = this.readColumns(a, c, this._columnsMutations), t = this.filterColumnsByMediaProp(e);
|
|
1089
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;
|
|
1090
1080
|
}
|
|
1091
1081
|
getDataState() {
|
|
@@ -1097,10 +1087,10 @@ const z = class z extends r.Component {
|
|
|
1097
1087
|
group: this.props.group
|
|
1098
1088
|
};
|
|
1099
1089
|
}
|
|
1100
|
-
getArguments(
|
|
1090
|
+
getArguments(a) {
|
|
1101
1091
|
return {
|
|
1102
|
-
nativeEvent:
|
|
1103
|
-
syntheticEvent:
|
|
1092
|
+
nativeEvent: a && a.nativeEvent,
|
|
1093
|
+
syntheticEvent: a,
|
|
1104
1094
|
target: this
|
|
1105
1095
|
};
|
|
1106
1096
|
}
|