@progress/kendo-react-grid 8.2.0-develop.25 → 8.2.0-develop.28
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 +110 -121
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/header/FilterRow.js +1 -1
- package/header/FilterRow.mjs +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
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as r from "react";
|
|
10
10
|
import o from "prop-types";
|
|
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
|
|
12
|
-
import {
|
|
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 Be, setScrollbarWidth as ae, getter as Ve, classNames as L, kendoThemeMaps as G, WatermarkOverlay as Ue } from "@progress/kendo-react-common";
|
|
12
|
+
import { tableKeyboardNavigation as _, getSelectionOptions as le, mapColumns as $e, ClipboardService as je, TableKeyboardNavigationContext as B, 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";
|
|
@@ -24,7 +24,7 @@ import { VirtualScroll as ct } from "./VirtualScroll.mjs";
|
|
|
24
24
|
import { VirtualScrollFixed as ge } from "./VirtualScrollFixed.mjs";
|
|
25
25
|
import { ColumnResize as ut } from "./drag/ColumnResize.mjs";
|
|
26
26
|
import { CommonDragLogic as gt } from "./drag/CommonDragLogic.mjs";
|
|
27
|
-
import { firefox as me, firefoxMaxHeight as fe, flatData as mt, readColumns as ft, sanitizeColumns as bt, getColumnWidth as
|
|
27
|
+
import { firefox as me, firefoxMaxHeight as fe, flatData as mt, readColumns as ft, sanitizeColumns as bt, getColumnWidth as V, autoGenerateColumns as vt, getNestedValue as be, resolveCells as Ct } from "./utils/index.mjs";
|
|
28
28
|
import { GridCell as Rt } from "./cells/GridCell.mjs";
|
|
29
29
|
import { GridGroupCell as ve } from "./cells/GridGroupCell.mjs";
|
|
30
30
|
import { GridRow as wt } from "./rows/GridRow.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,11 @@ 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
|
+
navigatable: !!this.props.navigatable,
|
|
138
139
|
contextStateRef: this.contextStateRef
|
|
139
140
|
});
|
|
140
141
|
}, this.onNavigationAction = (e) => {
|
|
@@ -207,7 +208,7 @@ const z = class z extends r.Component {
|
|
|
207
208
|
);
|
|
208
209
|
}, this.selectionRelease = (e) => {
|
|
209
210
|
if (this.props.onSelectionChange) {
|
|
210
|
-
const t = this.getSlicedLeafDataItems()[e.startRowIndex], s = this.getSlicedLeafDataItems()[e.endRowIndex],
|
|
211
|
+
const t = this.getSlicedLeafDataItems()[e.startRowIndex], s = this.getSlicedLeafDataItems()[e.endRowIndex], l = {
|
|
211
212
|
syntheticEvent: void 0,
|
|
212
213
|
target: this,
|
|
213
214
|
selectedField: this.props.selectedField || "",
|
|
@@ -218,7 +219,7 @@ const z = class z extends r.Component {
|
|
|
218
219
|
endDataItem: s,
|
|
219
220
|
...e
|
|
220
221
|
};
|
|
221
|
-
this.props.onSelectionChange.call(void 0,
|
|
222
|
+
this.props.onSelectionChange.call(void 0, l);
|
|
222
223
|
}
|
|
223
224
|
}, this.pageChange = (e, t, s) => {
|
|
224
225
|
this.raiseDataEvent(
|
|
@@ -232,8 +233,8 @@ const z = class z extends r.Component {
|
|
|
232
233
|
let e = this.props.total || 0;
|
|
233
234
|
return Array.isArray(this.props.data) ? e = e || this.props.data.length : this.props.data && (e = e || this.props.data.total), e;
|
|
234
235
|
}, this.moveToNextPage = (e) => {
|
|
235
|
-
const t = this.props.take || 0, s = (this.props.skip || 0) + t,
|
|
236
|
-
s <
|
|
236
|
+
const t = this.props.take || 0, s = (this.props.skip || 0) + t, l = this.getTotal();
|
|
237
|
+
s < l && this.pageChange({ skip: s, take: t }, e);
|
|
237
238
|
}, this.moveToPrevPage = (e) => {
|
|
238
239
|
const t = this.props.take || 0, s = (this.props.skip || 0) - t;
|
|
239
240
|
s >= 0 && this.pageChange({ skip: s, take: t }, e);
|
|
@@ -280,14 +281,14 @@ const z = class z extends r.Component {
|
|
|
280
281
|
var h, n, d;
|
|
281
282
|
if (!N)
|
|
282
283
|
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,
|
|
284
|
+
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));
|
|
285
|
+
return !!(t && l && s);
|
|
286
|
+
}, this.onResize = (e, t, s, l, h, n) => {
|
|
286
287
|
this.resetTableWidth(), this._shouldUpdateLeftRight = !0, this._resized = !0, this._columnsMutations++, this.props.onColumnResize && this.props.onColumnResize.call(
|
|
287
288
|
void 0,
|
|
288
289
|
{
|
|
289
290
|
columns: this.columns,
|
|
290
|
-
nativeEvent:
|
|
291
|
+
nativeEvent: l,
|
|
291
292
|
targetColumnId: n,
|
|
292
293
|
index: e,
|
|
293
294
|
newWidth: t,
|
|
@@ -296,44 +297,32 @@ const z = class z extends r.Component {
|
|
|
296
297
|
target: this
|
|
297
298
|
}
|
|
298
299
|
);
|
|
299
|
-
}, this.reInitVirtualization = E((e, t, s,
|
|
300
|
+
}, this.reInitVirtualization = E((e, t, s, l, h, n) => {
|
|
300
301
|
this.vs.reset();
|
|
301
302
|
const d = this.getVirtualScroll(this.props);
|
|
302
303
|
this.vs = new d(n);
|
|
303
|
-
}), this.flatData = E((e, t, s,
|
|
304
|
+
}), this.flatData = E((e, t, s, l, h, n, d) => {
|
|
304
305
|
const f = [], R = mt(
|
|
305
306
|
f,
|
|
306
307
|
e,
|
|
307
308
|
t,
|
|
308
309
|
{ index: s },
|
|
309
|
-
|
|
310
|
+
l !== void 0,
|
|
310
311
|
h
|
|
311
312
|
);
|
|
312
313
|
return { flattedData: f, resolvedGroupsCount: R };
|
|
313
|
-
}), this.rowHeightService = E((e, t, s,
|
|
314
|
+
}), 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
315
|
(e, t, s) => {
|
|
315
|
-
const
|
|
316
|
-
return ft(
|
|
316
|
+
const l = e.filter((h) => h && h.type && h.type.displayName === "KendoReactGridColumn");
|
|
317
|
+
return ft(l, this.columns, { prevId: 0, idPrefix: t });
|
|
317
318
|
}
|
|
318
319
|
), this.mapColumns = E(
|
|
319
320
|
(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) => {
|
|
321
|
+
), this.filterColumnsByMediaProp = (e) => e.filter((t) => N && t && t.media ? window.matchMedia(t.media).matches : t), this.configureColumns = E((e, t, s) => {
|
|
333
322
|
this.props.selectedField && e.filter((n) => n.field === this.props.selectedField).forEach((n) => {
|
|
334
323
|
n.width = n.width || "50px", n.cell = n.cell || et, n.headerCell = n.headerCell || yt;
|
|
335
324
|
});
|
|
336
|
-
const
|
|
325
|
+
const l = {
|
|
337
326
|
id: "",
|
|
338
327
|
resizable: !0,
|
|
339
328
|
width: "32px",
|
|
@@ -354,21 +343,21 @@ const z = class z extends r.Component {
|
|
|
354
343
|
};
|
|
355
344
|
let h = 0;
|
|
356
345
|
this.props.expandField && this.props.onExpandChange && this.props.detail && (e.unshift({
|
|
357
|
-
...
|
|
346
|
+
...l,
|
|
358
347
|
cell: tt,
|
|
359
348
|
field: this.props.expandField,
|
|
360
349
|
headerClassName: "k-hierarchy-cell k-header"
|
|
361
350
|
}), h++);
|
|
362
351
|
for (let n = 0; n < t; n++)
|
|
363
352
|
e.unshift({
|
|
364
|
-
...
|
|
353
|
+
...l,
|
|
365
354
|
isAccessible: !1,
|
|
366
355
|
cell: ve,
|
|
367
356
|
field: "value",
|
|
368
357
|
locked: this.props.lockGroups
|
|
369
358
|
}), h++;
|
|
370
359
|
e.slice(h).forEach((n) => n.parentIndex >= 0 && (n.parentIndex += h));
|
|
371
|
-
}), this.getHeaderRow = E((e, t, s,
|
|
360
|
+
}), this.getHeaderRow = E((e, t, s, l, h, n, d, f, R, I, T, C, M) => /* @__PURE__ */ r.createElement(
|
|
372
361
|
ot,
|
|
373
362
|
{
|
|
374
363
|
cells: this.props.cells,
|
|
@@ -376,14 +365,14 @@ const z = class z extends r.Component {
|
|
|
376
365
|
sortable: t,
|
|
377
366
|
sortChange: this.sortChange,
|
|
378
367
|
group: s || [],
|
|
379
|
-
groupable:
|
|
368
|
+
groupable: l,
|
|
380
369
|
groupChange: this.groupChange,
|
|
381
370
|
filter: h,
|
|
382
371
|
filterable: n,
|
|
383
372
|
filterOperators: d,
|
|
384
373
|
filterChange: this.filterChange,
|
|
385
374
|
columnMenu: R,
|
|
386
|
-
columnMenuIcon:
|
|
375
|
+
columnMenuIcon: I,
|
|
387
376
|
selectionChange: this.onHeaderSelectionChange,
|
|
388
377
|
columns: T,
|
|
389
378
|
columnResize: this.columnResize,
|
|
@@ -400,23 +389,23 @@ const z = class z extends r.Component {
|
|
|
400
389
|
columnGroupChange: this.columnGroupChange
|
|
401
390
|
}
|
|
402
391
|
)), this.resolveTitle = (e) => {
|
|
403
|
-
const t = this._columns.find((
|
|
392
|
+
const t = this._columns.find((l) => l.field === e), s = t && (t.title || t.field);
|
|
404
393
|
return s === void 0 ? e : s;
|
|
405
394
|
}, 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
395
|
var e, t, s;
|
|
407
396
|
if (this.tableBodyRef.current && ((e = this.tableBodyRef.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
|
|
408
397
|
this._singleEditRow = !1, (t = document.activeElement) != null && t.closest(".k-grid-edit-row") ? this._lastActiveElement = document.activeElement : this._lastActiveElement = void 0;
|
|
409
|
-
const
|
|
410
|
-
|
|
398
|
+
const l = Array.from((s = this.tableBodyRef.current) == null ? void 0 : s.getElementsByClassName("k-grid-edit-row"));
|
|
399
|
+
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
400
|
}
|
|
412
|
-
}, We(Re), this.showLicenseWatermark =
|
|
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
|
+
}, We(Re), this.showLicenseWatermark = Be(Re);
|
|
402
|
+
const p = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(a);
|
|
403
|
+
this.vs = new c(p || a.rowHeight === void 0 || a.rowHeight === 0), this.dragLogic = new gt(
|
|
415
404
|
this.columnReorder.bind(this),
|
|
416
405
|
this.groupReorder.bind(this),
|
|
417
406
|
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: !!
|
|
407
|
+
), this.columnGroupChange = this.columnGroupChange.bind(this), this.columnResize = new ut(this.onResize), this.props.clipboard && (this.clipboardService = new je(this.onClipboard)), _.onConstructor({
|
|
408
|
+
navigatable: !!a.navigatable,
|
|
420
409
|
contextStateRef: this.contextStateRef,
|
|
421
410
|
navigationStateRef: this.navigationStateRef,
|
|
422
411
|
idPrefix: this._gridId
|
|
@@ -463,8 +452,8 @@ const z = class z extends r.Component {
|
|
|
463
452
|
*/
|
|
464
453
|
// tslint:enable:max-line-length
|
|
465
454
|
get columns() {
|
|
466
|
-
const
|
|
467
|
-
return bt(
|
|
455
|
+
const a = this._columns.filter((p) => p.declarationIndex >= 0 && p.parentIndex === -1);
|
|
456
|
+
return bt(a);
|
|
468
457
|
}
|
|
469
458
|
/**
|
|
470
459
|
* Returns the HTML element of the Grid component.
|
|
@@ -488,8 +477,8 @@ const z = class z extends r.Component {
|
|
|
488
477
|
componentDidMount() {
|
|
489
478
|
var c;
|
|
490
479
|
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 =
|
|
480
|
+
const a = qe(this.element);
|
|
481
|
+
this.isRtl = a, _.onComponentDidMount({
|
|
493
482
|
scope: this.element || void 0,
|
|
494
483
|
contextStateRef: this.contextStateRef,
|
|
495
484
|
navigationStateRef: this.navigationStateRef
|
|
@@ -504,7 +493,7 @@ const z = class z extends r.Component {
|
|
|
504
493
|
* @hidden
|
|
505
494
|
*/
|
|
506
495
|
getSnapshotBeforeUpdate() {
|
|
507
|
-
return
|
|
496
|
+
return _.onGetSnapshotBeforeUpdate({
|
|
508
497
|
document: this.document,
|
|
509
498
|
contextStateRef: this.contextStateRef,
|
|
510
499
|
navigationStateRef: this.navigationStateRef
|
|
@@ -514,7 +503,7 @@ const z = class z extends r.Component {
|
|
|
514
503
|
* @hidden
|
|
515
504
|
*/
|
|
516
505
|
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(),
|
|
506
|
+
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
507
|
scope: this.element || void 0,
|
|
519
508
|
contextStateRef: this.contextStateRef,
|
|
520
509
|
navigationStateRef: this.navigationStateRef,
|
|
@@ -529,19 +518,19 @@ const z = class z extends r.Component {
|
|
|
529
518
|
* @hidden
|
|
530
519
|
*/
|
|
531
520
|
componentWillUnmount() {
|
|
532
|
-
var
|
|
533
|
-
clearTimeout(this.forceUpdateTimeout), this.clipboardService && this.clipboardService.removeEventListeners(this.document), (
|
|
521
|
+
var a;
|
|
522
|
+
clearTimeout(this.forceUpdateTimeout), this.clipboardService && this.clipboardService.removeEventListeners(this.document), (a = this.document) != null && a.body && this.resizeObserver && this.resizeObserver.disconnect();
|
|
534
523
|
}
|
|
535
524
|
/**
|
|
536
525
|
* @hidden
|
|
537
526
|
*/
|
|
538
527
|
render() {
|
|
539
528
|
var ie;
|
|
540
|
-
let
|
|
541
|
-
const p =
|
|
529
|
+
let a = this.props.total || 0;
|
|
530
|
+
const p = x.getIdPrefix(this.navigationStateRef), c = nt(this);
|
|
542
531
|
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:
|
|
532
|
+
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);
|
|
533
|
+
const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", s = this.props.scrollable === "virtual", { resolvedGroupsCount: l, flattedData: h } = this.flatData(
|
|
545
534
|
e,
|
|
546
535
|
t,
|
|
547
536
|
this.props.skip || 0,
|
|
@@ -554,10 +543,10 @@ const z = class z extends r.Component {
|
|
|
554
543
|
const n = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1;
|
|
555
544
|
this.columnResize.resizable = this.props.resizable || !1, this.dragLogic.reorderable = this.props.reorderable || !1, this.dragLogic.groupable = n;
|
|
556
545
|
const d = this.props.selectable && this.props.selectable.drag ? "none" : void 0;
|
|
557
|
-
this.initializeVirtualization(
|
|
546
|
+
this.initializeVirtualization(a, n);
|
|
558
547
|
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),
|
|
548
|
+
this.initColumns(f, l);
|
|
549
|
+
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
550
|
at,
|
|
562
551
|
{
|
|
563
552
|
group: this.props.group || [],
|
|
@@ -608,6 +597,7 @@ const z = class z extends r.Component {
|
|
|
608
597
|
sort: this.props.sort,
|
|
609
598
|
cellRender: this.props.filterCellRender,
|
|
610
599
|
isRtl: this.isRtl,
|
|
600
|
+
navigatable: !!this.props.navigatable,
|
|
611
601
|
ariaRowIndex: this._columnsMap.length + 1
|
|
612
602
|
}
|
|
613
603
|
) || void 0,
|
|
@@ -615,7 +605,7 @@ const z = class z extends r.Component {
|
|
|
615
605
|
"col",
|
|
616
606
|
{
|
|
617
607
|
key: g.toString(),
|
|
618
|
-
width:
|
|
608
|
+
width: V(i)
|
|
619
609
|
}
|
|
620
610
|
))
|
|
621
611
|
}
|
|
@@ -625,7 +615,7 @@ const z = class z extends r.Component {
|
|
|
625
615
|
tableViewPortWidth: De,
|
|
626
616
|
scrollLeft: Te
|
|
627
617
|
}), Fe = (i, g, m) => {
|
|
628
|
-
let
|
|
618
|
+
let k = !1;
|
|
629
619
|
const S = this.props.selectedField ? be(this.props.selectedField, i.dataItem) : void 0;
|
|
630
620
|
return {
|
|
631
621
|
row: C.map((u, b) => {
|
|
@@ -635,7 +625,7 @@ const z = class z extends r.Component {
|
|
|
635
625
|
let y = !1;
|
|
636
626
|
if (u.editable && this.props.editField) {
|
|
637
627
|
const v = be(this.props.editField, i.dataItem);
|
|
638
|
-
v && (v === !0 || v === u.field) && (
|
|
628
|
+
v && (v === !0 || v === u.field) && (k = !0, y = !0);
|
|
639
629
|
}
|
|
640
630
|
const W = u.cell || y && st || Rt, F = this.props.expandField && this.props.detail && u.field === this.props.expandField;
|
|
641
631
|
return /* @__PURE__ */ r.createElement(
|
|
@@ -644,7 +634,7 @@ const z = class z extends r.Component {
|
|
|
644
634
|
onContextMenu: this.onContextMenu,
|
|
645
635
|
key: H,
|
|
646
636
|
locked: this.props.lockGroups,
|
|
647
|
-
id:
|
|
637
|
+
id: x.generateNavigatableId(
|
|
648
638
|
`${g}-${String(b)}`,
|
|
649
639
|
p,
|
|
650
640
|
F || i.rowType === "groupHeader" || i.rowType === "groupFooter" || u.field === "value" ? "nodata" : "cell"
|
|
@@ -673,7 +663,7 @@ const z = class z extends r.Component {
|
|
|
673
663
|
}
|
|
674
664
|
);
|
|
675
665
|
}),
|
|
676
|
-
isInEdit:
|
|
666
|
+
isInEdit: k,
|
|
677
667
|
isSelected: typeof S == "boolean" && S
|
|
678
668
|
};
|
|
679
669
|
};
|
|
@@ -694,9 +684,9 @@ const z = class z extends r.Component {
|
|
|
694
684
|
let D = 0;
|
|
695
685
|
if (this._data.length) {
|
|
696
686
|
let i = -1, g = 0;
|
|
697
|
-
(this._slicedData || this._data).forEach((m,
|
|
687
|
+
(this._slicedData || this._data).forEach((m, k) => {
|
|
698
688
|
m.rowType === "data" && (J++, i++);
|
|
699
|
-
const S = J % 2 === 0, u = this.props.dataItemKey &&
|
|
689
|
+
const S = J % 2 === 0, u = this.props.dataItemKey && Ve(this.props.dataItemKey)(m.dataItem), b = k + (this.vs.realSkip || 0), H = u || "ai" + b, A = H + "_1", w = Fe(m, H, i);
|
|
700
690
|
if (D = b + X + g, O.push(/* @__PURE__ */ r.createElement(
|
|
701
691
|
wt,
|
|
702
692
|
{
|
|
@@ -705,7 +695,7 @@ const z = class z extends r.Component {
|
|
|
705
695
|
isAltRow: S,
|
|
706
696
|
isInEdit: w.isInEdit,
|
|
707
697
|
rowType: m.rowType,
|
|
708
|
-
isHidden: q(
|
|
698
|
+
isHidden: q(k),
|
|
709
699
|
onClick: (y) => this.rowClick(y, m),
|
|
710
700
|
onDoubleClick: (y) => this.rowDblClick(y, m),
|
|
711
701
|
selectedField: this.props.selectedField,
|
|
@@ -727,7 +717,7 @@ const z = class z extends r.Component {
|
|
|
727
717
|
"k-table-row",
|
|
728
718
|
S ? "k-detail-row k-table-alt-row k-alt" : "k-detail-row"
|
|
729
719
|
),
|
|
730
|
-
style: { visibility: q(
|
|
720
|
+
style: { visibility: q(k) ? "hidden" : "", height: this.props.detailRowHeight },
|
|
731
721
|
role: "row",
|
|
732
722
|
"aria-rowindex": D
|
|
733
723
|
},
|
|
@@ -754,7 +744,7 @@ const z = class z extends r.Component {
|
|
|
754
744
|
this.props.expandField && /* @__PURE__ */ r.createElement(
|
|
755
745
|
_t,
|
|
756
746
|
{
|
|
757
|
-
id:
|
|
747
|
+
id: x.generateNavigatableId(`${A}-dhcell`, p)
|
|
758
748
|
}
|
|
759
749
|
),
|
|
760
750
|
/* @__PURE__ */ r.createElement(
|
|
@@ -766,7 +756,7 @@ const z = class z extends r.Component {
|
|
|
766
756
|
colSpan: y,
|
|
767
757
|
ariaColIndex: 2 + (this.props.group ? this.props.group.length : 0),
|
|
768
758
|
detail: this.props.detail,
|
|
769
|
-
id:
|
|
759
|
+
id: x.generateNavigatableId(`${A}-dcell`, p)
|
|
770
760
|
}
|
|
771
761
|
)
|
|
772
762
|
));
|
|
@@ -784,22 +774,21 @@ const z = class z extends r.Component {
|
|
|
784
774
|
className: "k-grid-norecords",
|
|
785
775
|
style: { width: Ne() }
|
|
786
776
|
},
|
|
787
|
-
/* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template", [Ze]:
|
|
777
|
+
/* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template", [Ze]: x.generateNavigatableId("no-records", p) }, I.length ? I : /* @__PURE__ */ r.createElement(Et, null))
|
|
788
778
|
), Q = {
|
|
789
779
|
size: this.props.size,
|
|
790
780
|
onPageChange: this.pagerPageChange,
|
|
791
|
-
total:
|
|
781
|
+
total: a,
|
|
792
782
|
dir: this.isRtl ? "rtl" : void 0,
|
|
793
783
|
skip: this.vs.propsSkip || 0,
|
|
794
784
|
take: (this.props.take !== void 0 ? this.props.take : this.props.pageSize) || 10,
|
|
795
785
|
messagesMap: pt,
|
|
796
|
-
navigatable: this.props.navigatable,
|
|
797
786
|
...It(this.props.pageable || {})
|
|
798
787
|
}, Z = this.props.pager ? /* @__PURE__ */ r.createElement(this.props.pager, { ...Q }) : /* @__PURE__ */ r.createElement(Xe, { className: "k-grid-pager", ...Q }), Le = (i) => this.props.sort && this.props.sort.filter((g) => g.field === i).length > 0, Me = (i, g) => /* @__PURE__ */ r.createElement(
|
|
799
788
|
"col",
|
|
800
789
|
{
|
|
801
790
|
key: g.toString(),
|
|
802
|
-
width:
|
|
791
|
+
width: V(i)
|
|
803
792
|
}
|
|
804
793
|
), ee = (ie = this.props.cells) != null && ie.footerCell || this._columns.some(
|
|
805
794
|
(i) => {
|
|
@@ -839,13 +828,13 @@ const z = class z extends r.Component {
|
|
|
839
828
|
{
|
|
840
829
|
key: g.toString(),
|
|
841
830
|
className: Le(i.field) ? "k-sorted" : void 0,
|
|
842
|
-
width:
|
|
831
|
+
width: V(i)
|
|
843
832
|
}
|
|
844
833
|
)
|
|
845
834
|
)
|
|
846
835
|
), se = this.dragLogic.reorderable || this.dragLogic.groupable;
|
|
847
836
|
if (this.props.scrollable === "none")
|
|
848
|
-
return /* @__PURE__ */ r.createElement(
|
|
837
|
+
return /* @__PURE__ */ r.createElement(B.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
|
|
849
838
|
"div",
|
|
850
839
|
{
|
|
851
840
|
id: this.props.id,
|
|
@@ -897,7 +886,7 @@ const z = class z extends r.Component {
|
|
|
897
886
|
se && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(de, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(ce, { ref: this.dragLogic.refDragElementClue }))
|
|
898
887
|
), T, this.props.pageable && Z);
|
|
899
888
|
let P = this.props.style || {};
|
|
900
|
-
return s && (P.height || (P = Object.assign({}, P, { height: "450px" }))), /* @__PURE__ */ r.createElement(
|
|
889
|
+
return s && (P.height || (P = Object.assign({}, P, { height: "450px" }))), /* @__PURE__ */ r.createElement(B.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
|
|
901
890
|
"div",
|
|
902
891
|
{
|
|
903
892
|
id: this.props.id,
|
|
@@ -927,7 +916,7 @@ const z = class z extends r.Component {
|
|
|
927
916
|
className: "k-grid-aria-root",
|
|
928
917
|
role: "grid",
|
|
929
918
|
"aria-colcount": C.length,
|
|
930
|
-
"aria-rowcount":
|
|
919
|
+
"aria-rowcount": a,
|
|
931
920
|
id: this._gridId,
|
|
932
921
|
"aria-label": c.toLanguageString(ue, dt[ue])
|
|
933
922
|
},
|
|
@@ -994,9 +983,9 @@ const z = class z extends r.Component {
|
|
|
994
983
|
calculateMedia() {
|
|
995
984
|
this.checkMatchMediaColumnsDifferece() || this.forceUpdate();
|
|
996
985
|
}
|
|
997
|
-
selectionChange(
|
|
986
|
+
selectionChange(a) {
|
|
998
987
|
if (this.props.onSelectionChange) {
|
|
999
|
-
const { event: p, dataItem: c, dataIndex: e, columnIndex: t } =
|
|
988
|
+
const { event: p, dataItem: c, dataIndex: e, columnIndex: t } = a, { mode: s, cell: l } = le(this.props.selectable), h = {
|
|
1000
989
|
...this.getArguments(p.syntheticEvent),
|
|
1001
990
|
dataItem: c,
|
|
1002
991
|
startColIndex: t,
|
|
@@ -1009,7 +998,7 @@ const z = class z extends r.Component {
|
|
|
1009
998
|
shiftKey: !1,
|
|
1010
999
|
metaKey: !1,
|
|
1011
1000
|
mode: s,
|
|
1012
|
-
cell:
|
|
1001
|
+
cell: l,
|
|
1013
1002
|
isDrag: !1,
|
|
1014
1003
|
componentId: this._gridId,
|
|
1015
1004
|
selectedField: this.props.selectedField || ""
|
|
@@ -1017,11 +1006,11 @@ const z = class z extends r.Component {
|
|
|
1017
1006
|
this.props.onSelectionChange.call(void 0, h);
|
|
1018
1007
|
}
|
|
1019
1008
|
}
|
|
1020
|
-
raiseDataEvent(
|
|
1009
|
+
raiseDataEvent(a, p, c, e, t) {
|
|
1021
1010
|
const s = this.props.onDataStateChange;
|
|
1022
|
-
if (
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1011
|
+
if (a) {
|
|
1012
|
+
const l = { ...this.getArguments(e), ...p, targetEvent: t };
|
|
1013
|
+
a.call(void 0, l);
|
|
1025
1014
|
} else
|
|
1026
1015
|
s && s.call(
|
|
1027
1016
|
void 0,
|
|
@@ -1035,15 +1024,15 @@ const z = class z extends r.Component {
|
|
|
1035
1024
|
}
|
|
1036
1025
|
);
|
|
1037
1026
|
}
|
|
1038
|
-
columnReorder(
|
|
1039
|
-
const e = this._columns[
|
|
1027
|
+
columnReorder(a, p, c) {
|
|
1028
|
+
const e = this._columns[a], t = e.depth, s = (d) => {
|
|
1040
1029
|
do
|
|
1041
1030
|
d++;
|
|
1042
1031
|
while (d < this._columns.length && this._columns[d].depth > t);
|
|
1043
1032
|
return d;
|
|
1044
|
-
},
|
|
1045
|
-
this._columns.splice(
|
|
1046
|
-
const h = this._columns[
|
|
1033
|
+
}, l = this._columns.splice(a, s(a) - a);
|
|
1034
|
+
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++;
|
|
1035
|
+
const h = this._columns[a].locked && this._columns[p].locked;
|
|
1047
1036
|
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
1037
|
const n = this.columns;
|
|
1049
1038
|
if (this.forceUpdate(), this.props.onColumnReorder) {
|
|
@@ -1056,25 +1045,25 @@ const z = class z extends r.Component {
|
|
|
1056
1045
|
this.props.onColumnReorder.call(void 0, d);
|
|
1057
1046
|
}
|
|
1058
1047
|
}
|
|
1059
|
-
groupReorder(
|
|
1048
|
+
groupReorder(a, p, c) {
|
|
1060
1049
|
if (this.props.group === void 0)
|
|
1061
1050
|
return;
|
|
1062
1051
|
const e = this.props.group.slice();
|
|
1063
|
-
e.splice(p, 0, ...e.splice(
|
|
1052
|
+
e.splice(p, 0, ...e.splice(a, 1)), this.groupChange(e, c);
|
|
1064
1053
|
}
|
|
1065
|
-
columnToGroup(
|
|
1066
|
-
const e = this._columns[
|
|
1054
|
+
columnToGroup(a, p, c) {
|
|
1055
|
+
const e = this._columns[a].field;
|
|
1067
1056
|
if (!e)
|
|
1068
1057
|
return;
|
|
1069
1058
|
const t = (this.props.group || []).slice();
|
|
1070
1059
|
t.splice(p, 0, { field: e }), this.groupChange(t, c);
|
|
1071
1060
|
}
|
|
1072
|
-
columnGroupChange(
|
|
1061
|
+
columnGroupChange(a, p) {
|
|
1073
1062
|
const c = this.dragLogic.getCurrentGroupsLength;
|
|
1074
|
-
this.columnToGroup(
|
|
1063
|
+
this.columnToGroup(a, c, p);
|
|
1075
1064
|
}
|
|
1076
1065
|
resetTableWidth() {
|
|
1077
|
-
let
|
|
1066
|
+
let a = 0;
|
|
1078
1067
|
if (!this.columnResize.colGroupMain)
|
|
1079
1068
|
return;
|
|
1080
1069
|
const p = this.columnResize.colGroupMain.children;
|
|
@@ -1082,12 +1071,12 @@ const z = class z extends r.Component {
|
|
|
1082
1071
|
const e = p[c].width;
|
|
1083
1072
|
if (!e)
|
|
1084
1073
|
return;
|
|
1085
|
-
|
|
1074
|
+
a += parseFloat(e.toString());
|
|
1086
1075
|
}
|
|
1087
|
-
|
|
1076
|
+
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
1077
|
}
|
|
1089
|
-
initColumns(
|
|
1090
|
-
const c =
|
|
1078
|
+
initColumns(a, p) {
|
|
1079
|
+
const c = x.getIdPrefix(this.navigationStateRef), e = this.readColumns(a, c, this._columnsMutations), t = this.filterColumnsByMediaProp(e);
|
|
1091
1080
|
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
1081
|
}
|
|
1093
1082
|
getDataState() {
|
|
@@ -1099,10 +1088,10 @@ const z = class z extends r.Component {
|
|
|
1099
1088
|
group: this.props.group
|
|
1100
1089
|
};
|
|
1101
1090
|
}
|
|
1102
|
-
getArguments(
|
|
1091
|
+
getArguments(a) {
|
|
1103
1092
|
return {
|
|
1104
|
-
nativeEvent:
|
|
1105
|
-
syntheticEvent:
|
|
1093
|
+
nativeEvent: a && a.nativeEvent,
|
|
1094
|
+
syntheticEvent: a,
|
|
1106
1095
|
target: this
|
|
1107
1096
|
};
|
|
1108
1097
|
}
|
|
@@ -1190,7 +1179,7 @@ z.displayName = "KendoReactGrid", z.defaultProps = {
|
|
|
1190
1179
|
})
|
|
1191
1180
|
]),
|
|
1192
1181
|
size: o.oneOf(["small", "medium"])
|
|
1193
|
-
}, z.contextType =
|
|
1182
|
+
}, z.contextType = B;
|
|
1194
1183
|
let U = z;
|
|
1195
1184
|
ht(U);
|
|
1196
1185
|
export {
|