@progress/kendo-react-grid 8.1.0-develop.8 → 8.1.0-develop.9
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 +139 -119
- package/GridColumn.js +1 -1
- package/GridColumn.mjs +3 -1
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +13 -0
- package/index.d.ts +13 -0
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
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, dispatchEvent as
|
|
12
|
-
import { tableKeyboardNavigation as
|
|
11
|
+
import { RowHeightService as re, dispatchEvent as Ge, canUseDOM as L, getActiveElement as Oe, memoizeOne as S, validatePackage as Ke, shouldShowValidationUI as Ve, setScrollbarWidth as ae, getter as Ue, classNames as M, kendoThemeMaps as O, WatermarkOverlay as Be } from "@progress/kendo-react-common";
|
|
12
|
+
import { tableKeyboardNavigationTools as k, tableKeyboardNavigation as _, getSelectionOptions as le, mapColumns as We, ClipboardService as $e, TableKeyboardNavigationContext as B, isRtl as je, tableColumnsVirtualization as qe, Pager as Je, tableKeyboardNavigationScopeAttributes as ne, TableSelection as he, tableKeyboardNavigationBodyAttributes as pe, DropClue as de, DragClue as ce, updateLeft as Xe, updateRight as Ye, KEYBOARD_NAV_DATA_ID as Qe } from "@progress/kendo-react-data-tools";
|
|
13
13
|
import { GridSelectionCell as Ze } from "./cells/GridSelectionCell.mjs";
|
|
14
14
|
import { GridHierarchyCell as et } from "./cells/GridHierarchyCell.mjs";
|
|
15
15
|
import { GridEditCell as tt } from "./cells/GridEditCell.mjs";
|
|
@@ -24,7 +24,7 @@ import { VirtualScroll as dt } from "./VirtualScroll.mjs";
|
|
|
24
24
|
import { VirtualScrollFixed as ge } from "./VirtualScrollFixed.mjs";
|
|
25
25
|
import { ColumnResize as ct } from "./drag/ColumnResize.mjs";
|
|
26
26
|
import { CommonDragLogic as ut } from "./drag/CommonDragLogic.mjs";
|
|
27
|
-
import { firefox as
|
|
27
|
+
import { firefox as me, firefoxMaxHeight as fe, flatData as gt, readColumns as mt, sanitizeColumns as ft, getColumnWidth as W, autoGenerateColumns as vt, getNestedValue as ve, resolveCells as bt } from "./utils/index.mjs";
|
|
28
28
|
import { GridCell as Ct } from "./cells/GridCell.mjs";
|
|
29
29
|
import { GridGroupCell as be } from "./cells/GridGroupCell.mjs";
|
|
30
30
|
import { GridRow as Rt } from "./rows/GridRow.mjs";
|
|
@@ -37,7 +37,7 @@ import { packageMetadata as Re } from "./package-metadata.mjs";
|
|
|
37
37
|
import { GridDetailCell as kt } from "./cells/GridDetailCell.mjs";
|
|
38
38
|
import { GridDetailHierarchyCell as Et } from "./cells/GridDetailHierarchyCell.mjs";
|
|
39
39
|
import { SAFARI_REGEX as xt } from "./constants/index.mjs";
|
|
40
|
-
const
|
|
40
|
+
const z = class z extends r.Component {
|
|
41
41
|
constructor(a) {
|
|
42
42
|
super(a), this._columns = [], this._columnsMap = [[]], this._columnsMutations = 0, this._resized = !1, this._focusFirst = !1, this._shouldUpdateLeftRight = !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.observer = null, this.handleIntersection = (e) => {
|
|
43
43
|
const t = { rowIndex: this.rowIndex };
|
|
@@ -67,6 +67,9 @@ const T = class T extends r.Component {
|
|
|
67
67
|
}
|
|
68
68
|
}, this.fitColumns = (e) => {
|
|
69
69
|
this.columnResize.dblClickHandler(null, e);
|
|
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), t = k.getIdPrefix(this.navigationStateRef), s = this.filterHiddenColumns(e);
|
|
72
|
+
return this.getColumnsEssentialProps(this.readColumns(s, t, this._columnsMutations)) === this.getColumnsEssentialProps(this._columns);
|
|
70
73
|
}, this.onContextMenu = (e, t, s) => {
|
|
71
74
|
if (this.props.onContextMenu) {
|
|
72
75
|
const l = {
|
|
@@ -79,8 +82,8 @@ const T = class T extends r.Component {
|
|
|
79
82
|
this.props.onContextMenu.call(void 0, l);
|
|
80
83
|
}
|
|
81
84
|
}, this.getVirtualScroll = (e) => {
|
|
82
|
-
const { rowHeight: t, detailRowHeight: s, detail: l, expandField: p, groupable: n } = e, d = this.isAllData(),
|
|
83
|
-
return !
|
|
85
|
+
const { rowHeight: t, detailRowHeight: s, detail: l, expandField: p, groupable: n } = e, d = this.isAllData(), f = t !== void 0 && t > 0, R = s !== void 0 && s > 0, E = n === !0 || typeof n == "object" && n.enabled !== !1;
|
|
86
|
+
return !f || E && !d || !!(l && p) && (!R || !d) ? dt : ge;
|
|
84
87
|
}, this.isAllData = () => {
|
|
85
88
|
const { data: e, total: t } = this.props;
|
|
86
89
|
return Array.isArray(e) ? e.length === t : e ? t === e.total : !1;
|
|
@@ -94,7 +97,7 @@ const T = class T extends r.Component {
|
|
|
94
97
|
t || this.props.rowHeight === void 0 || this.props.rowHeight === 0
|
|
95
98
|
), this.vs.fixedScroll = this.props.fixedScroll || !1, this.vs.PageChange = this.pageChange, this.vs.realSkip = this.props.skip || 0, this.vs.pageSize = (this.props.take !== void 0 ? this.props.take : this.props.pageSize) || 0, this.vs.scrollableVirtual = this.props.scrollable === "virtual", this.vs.total = e, this.vs.propsSkip = (this.props.skip || 0) + (this.props.scrollable === "virtual" ? this.vs.topCacheCount + (this.vs.attendedSkip - (this.props.skip || 0)) : 0), this.props.rowHeight !== void 0 && this.props.rowHeight > 0 && !t) {
|
|
96
99
|
const s = this.props.rowHeight * e;
|
|
97
|
-
this.vs.containerHeight =
|
|
100
|
+
this.vs.containerHeight = me ? Math.min(fe, s) : s;
|
|
98
101
|
} else
|
|
99
102
|
this.vs.containerHeight = 1533915;
|
|
100
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) {
|
|
@@ -102,7 +105,7 @@ const T = class T extends r.Component {
|
|
|
102
105
|
let { detailRowHeight: n = 0 } = this.props;
|
|
103
106
|
n = l && p ? 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);
|
|
104
107
|
const d = this.vs.rowHeightService.totalHeight();
|
|
105
|
-
this.vs.containerHeight =
|
|
108
|
+
this.vs.containerHeight = me ? Math.min(fe, d) : d;
|
|
106
109
|
}
|
|
107
110
|
}, this.scrollHandler = (e) => {
|
|
108
111
|
if (e.target !== e.currentTarget)
|
|
@@ -111,9 +114,9 @@ const T = class T extends r.Component {
|
|
|
111
114
|
const t = e.currentTarget.scrollLeft, s = e.currentTarget.scrollTop;
|
|
112
115
|
this.props.columnVirtualization && (!this.vs.scrollableVirtual || s === this.wrapperScrollTop) && (this.forceUpdateTimeout = window.setTimeout(() => {
|
|
113
116
|
this.forceUpdate();
|
|
114
|
-
}, 0)), this._header && this._header.setScrollLeft(t), this._footer && this._footer.setScrollLeft(t), this.vs && s !== this.wrapperScrollTop && this.vs.scrollHandler(e),
|
|
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;
|
|
115
118
|
}, this.onKeyDown = (e) => {
|
|
116
|
-
if (
|
|
119
|
+
if (_.onKeyDown(e, {
|
|
117
120
|
contextStateRef: this.contextStateRef,
|
|
118
121
|
navigationStateRef: this.navigationStateRef,
|
|
119
122
|
onNavigationAction: this.onNavigationAction
|
|
@@ -129,7 +132,7 @@ const T = class T extends r.Component {
|
|
|
129
132
|
this.props.onKeyDown.call(void 0, l);
|
|
130
133
|
}
|
|
131
134
|
}, this.onFocus = (e) => {
|
|
132
|
-
|
|
135
|
+
_.onFocus(e, {
|
|
133
136
|
contextStateRef: this.contextStateRef
|
|
134
137
|
});
|
|
135
138
|
}, this.onNavigationAction = (e) => {
|
|
@@ -273,9 +276,9 @@ const T = class T extends r.Component {
|
|
|
273
276
|
}
|
|
274
277
|
}, this.inActiveElement = () => {
|
|
275
278
|
var p, n, d;
|
|
276
|
-
if (!
|
|
279
|
+
if (!L)
|
|
277
280
|
return !1;
|
|
278
|
-
const e =
|
|
281
|
+
const e = Oe(this.document), t = e ? e.matches(".k-table-td") ? e : (p = this.document) == null ? void 0 : p.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));
|
|
279
282
|
return !!(t && l && s);
|
|
280
283
|
}, this.onResize = (e, t, s, l, p, n) => {
|
|
281
284
|
this.resetTableWidth(), this._shouldUpdateLeftRight = !0, this._resized = !0, this._columnsMutations++, this.props.onColumnResize && this.props.onColumnResize.call(
|
|
@@ -296,23 +299,35 @@ const T = class T extends r.Component {
|
|
|
296
299
|
const d = this.getVirtualScroll(this.props);
|
|
297
300
|
this.vs = new d(n);
|
|
298
301
|
}), this.flatData = S((e, t, s, l, p, n, d) => {
|
|
299
|
-
const
|
|
300
|
-
|
|
302
|
+
const f = [], R = gt(
|
|
303
|
+
f,
|
|
301
304
|
e,
|
|
302
305
|
t,
|
|
303
306
|
{ index: s },
|
|
304
307
|
l !== void 0,
|
|
305
308
|
p
|
|
306
309
|
);
|
|
307
|
-
return { flattedData:
|
|
310
|
+
return { flattedData: f, resolvedGroupsCount: R };
|
|
308
311
|
}), this.rowHeightService = S((e, t, s, l, p) => new re(t, s, l, p)), this.childrenToArray = S((e) => r.Children.toArray(e)), this.readColumns = S(
|
|
309
312
|
(e, t, s) => {
|
|
310
313
|
const l = e.filter((p) => p && p.type && p.type.displayName === "KendoReactGridColumn");
|
|
311
|
-
return
|
|
314
|
+
return mt(l, this.columns, { prevId: 0, idPrefix: t });
|
|
312
315
|
}
|
|
313
316
|
), this.mapColumns = S(
|
|
314
|
-
(e, t) =>
|
|
315
|
-
), this.
|
|
317
|
+
(e, t) => We(e, !0)
|
|
318
|
+
), this.filterHiddenColumns = (e) => {
|
|
319
|
+
const t = (s) => {
|
|
320
|
+
const l = s;
|
|
321
|
+
return {
|
|
322
|
+
...l,
|
|
323
|
+
props: {
|
|
324
|
+
...l.props,
|
|
325
|
+
children: l.props.children && l.props.children.length > 0 ? this.filterHiddenColumns(l.props.children) : l.props.children
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
return [...e].filter((s) => r.isValidElement(s) && !s.props.hidden).filter((s) => L && s && r.isValidElement(s) && s.props.media ? window.matchMedia(s.props.media).matches : s).map((s) => t(s));
|
|
330
|
+
}, this.configureColumns = S((e, t, s) => {
|
|
316
331
|
this.props.selectedField && e.filter((n) => n.field === this.props.selectedField).forEach((n) => {
|
|
317
332
|
n.width = n.width || "50px", n.cell = n.cell || Ze, n.headerCell = n.headerCell || yt;
|
|
318
333
|
});
|
|
@@ -351,7 +366,7 @@ const T = class T extends r.Component {
|
|
|
351
366
|
locked: this.props.lockGroups
|
|
352
367
|
}), p++;
|
|
353
368
|
e.slice(p).forEach((n) => n.parentIndex >= 0 && (n.parentIndex += p));
|
|
354
|
-
}), this.getHeaderRow = S((e, t, s, l, p, n, d,
|
|
369
|
+
}), this.getHeaderRow = S((e, t, s, l, p, n, d, f, R, E, D, C, A) => /* @__PURE__ */ r.createElement(
|
|
355
370
|
it,
|
|
356
371
|
{
|
|
357
372
|
cells: this.props.cells,
|
|
@@ -366,15 +381,15 @@ const T = class T extends r.Component {
|
|
|
366
381
|
filterOperators: d,
|
|
367
382
|
filterChange: this.filterChange,
|
|
368
383
|
columnMenu: R,
|
|
369
|
-
columnMenuIcon:
|
|
384
|
+
columnMenuIcon: E,
|
|
370
385
|
selectionChange: this.onHeaderSelectionChange,
|
|
371
|
-
columns:
|
|
386
|
+
columns: D,
|
|
372
387
|
columnResize: this.columnResize,
|
|
373
388
|
pressHandler: this.dragLogic.pressHandler,
|
|
374
389
|
dragHandler: this.dragLogic.dragHandler,
|
|
375
390
|
releaseHandler: this.dragLogic.releaseHandler,
|
|
376
391
|
columnsMap: C,
|
|
377
|
-
cellRender:
|
|
392
|
+
cellRender: f,
|
|
378
393
|
isRtl: A,
|
|
379
394
|
dragClue: this.dragLogic.dragClueRef,
|
|
380
395
|
headerRef: this.headerElementRef,
|
|
@@ -385,13 +400,13 @@ const T = class T extends r.Component {
|
|
|
385
400
|
)), this.resolveTitle = (e) => {
|
|
386
401
|
const t = this._columns.find((l) => l.field === e), s = t && (t.title || t.field);
|
|
387
402
|
return s === void 0 ? e : s;
|
|
388
|
-
}, 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),
|
|
403
|
+
}, 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), Ke(Re), this.showLicenseWatermark = Ve(Re);
|
|
389
404
|
const h = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(a);
|
|
390
405
|
this.vs = new c(h || a.rowHeight === void 0 || a.rowHeight === 0), this.dragLogic = new ut(
|
|
391
406
|
this.columnReorder.bind(this),
|
|
392
407
|
this.groupReorder.bind(this),
|
|
393
408
|
this.columnToGroup.bind(this)
|
|
394
|
-
), this.columnGroupChange = this.columnGroupChange.bind(this), this.columnResize = new ct(this.onResize), this.props.clipboard && (this.clipboardService = new $e(this.onClipboard)),
|
|
409
|
+
), this.columnGroupChange = this.columnGroupChange.bind(this), this.columnResize = new ct(this.onResize), this.props.clipboard && (this.clipboardService = new $e(this.onClipboard)), _.onConstructor({
|
|
395
410
|
navigatable: !!a.navigatable,
|
|
396
411
|
contextStateRef: this.contextStateRef,
|
|
397
412
|
navigationStateRef: this.navigationStateRef,
|
|
@@ -440,7 +455,7 @@ const T = class T extends r.Component {
|
|
|
440
455
|
// tslint:enable:max-line-length
|
|
441
456
|
get columns() {
|
|
442
457
|
const a = this._columns.filter((h) => h.declarationIndex >= 0 && h.parentIndex === -1);
|
|
443
|
-
return
|
|
458
|
+
return ft(a);
|
|
444
459
|
}
|
|
445
460
|
/**
|
|
446
461
|
* Returns the HTML element of the Grid component.
|
|
@@ -449,7 +464,7 @@ const T = class T extends r.Component {
|
|
|
449
464
|
return this._element;
|
|
450
465
|
}
|
|
451
466
|
get document() {
|
|
452
|
-
if (
|
|
467
|
+
if (L)
|
|
453
468
|
return this.element && this.element.ownerDocument || document;
|
|
454
469
|
}
|
|
455
470
|
get _header() {
|
|
@@ -462,9 +477,10 @@ const T = class T extends r.Component {
|
|
|
462
477
|
* @hidden
|
|
463
478
|
*/
|
|
464
479
|
componentDidMount() {
|
|
480
|
+
var c;
|
|
465
481
|
this.props.columnVirtualization && !navigator.userAgent.match(xt) && (this.headTable && (this.headTable.style.display = "block"), this.tableElement && (this.tableElement.style.display = "block")), this.resetTableWidth(), ae();
|
|
466
482
|
const a = je(this.element);
|
|
467
|
-
this.isRtl = a,
|
|
483
|
+
this.isRtl = a, _.onComponentDidMount({
|
|
468
484
|
scope: this.element || void 0,
|
|
469
485
|
contextStateRef: this.contextStateRef,
|
|
470
486
|
navigationStateRef: this.navigationStateRef
|
|
@@ -473,13 +489,13 @@ const T = class T extends r.Component {
|
|
|
473
489
|
rootMargin: "0px",
|
|
474
490
|
threshold: 0.9
|
|
475
491
|
};
|
|
476
|
-
this.clipboardService && this.clipboardService.addEventListeners(this.document), this.observer =
|
|
492
|
+
this.clipboardService && this.clipboardService.addEventListeners(this.document), this.observer = L && window.IntersectionObserver && new window.IntersectionObserver(this.handleIntersection, h) || null, this.resizeObserver = L && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), (c = this.document) != null && c.body && this.resizeObserver && this.resizeObserver.observe(this.document.body);
|
|
477
493
|
}
|
|
478
494
|
/**
|
|
479
495
|
* @hidden
|
|
480
496
|
*/
|
|
481
497
|
getSnapshotBeforeUpdate() {
|
|
482
|
-
return
|
|
498
|
+
return _.onGetSnapshotBeforeUpdate({
|
|
483
499
|
document: this.document,
|
|
484
500
|
contextStateRef: this.contextStateRef,
|
|
485
501
|
navigationStateRef: this.navigationStateRef
|
|
@@ -489,7 +505,7 @@ const T = class T extends r.Component {
|
|
|
489
505
|
* @hidden
|
|
490
506
|
*/
|
|
491
507
|
componentDidUpdate() {
|
|
492
|
-
this.resetTableWidth(), ae(), this.vs.tableTransform && this.vs.table && (this.vs.table.style.transform = this.vs.tableTransform, this.vs.tableTransform = ""),
|
|
508
|
+
this.resetTableWidth(), ae(), this.vs.tableTransform && this.vs.table && (this.vs.table.style.transform = this.vs.tableTransform, this.vs.tableTransform = ""), _.onComponentDidUpdate({
|
|
493
509
|
scope: this.element || void 0,
|
|
494
510
|
contextStateRef: this.contextStateRef,
|
|
495
511
|
navigationStateRef: this.navigationStateRef,
|
|
@@ -500,7 +516,8 @@ const T = class T extends r.Component {
|
|
|
500
516
|
* @hidden
|
|
501
517
|
*/
|
|
502
518
|
componentWillUnmount() {
|
|
503
|
-
|
|
519
|
+
var a;
|
|
520
|
+
clearTimeout(this.forceUpdateTimeout), this.clipboardService && this.clipboardService.removeEventListeners(this.document), (a = this.document) != null && a.body && this.resizeObserver && this.resizeObserver.disconnect();
|
|
504
521
|
}
|
|
505
522
|
/**
|
|
506
523
|
* @hidden
|
|
@@ -508,7 +525,7 @@ const T = class T extends r.Component {
|
|
|
508
525
|
render() {
|
|
509
526
|
var ie;
|
|
510
527
|
let a = this.props.total || 0;
|
|
511
|
-
const h =
|
|
528
|
+
const h = k.getIdPrefix(this.navigationStateRef), c = lt(this);
|
|
512
529
|
let e = [];
|
|
513
530
|
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);
|
|
514
531
|
const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", s = this.props.scrollable === "virtual", { resolvedGroupsCount: l, flattedData: p } = this.flatData(
|
|
@@ -525,9 +542,9 @@ const T = class T extends r.Component {
|
|
|
525
542
|
this.columnResize.resizable = this.props.resizable || !1, this.dragLogic.reorderable = this.props.reorderable || !1, this.dragLogic.groupable = n;
|
|
526
543
|
const d = this.props.selectable && this.props.selectable.drag ? "none" : void 0;
|
|
527
544
|
this.initializeVirtualization(a, n);
|
|
528
|
-
const
|
|
529
|
-
this.initColumns(
|
|
530
|
-
const R =
|
|
545
|
+
const f = this.childrenToArray(this.props.children);
|
|
546
|
+
this.initColumns(f, l);
|
|
547
|
+
const R = f.map((i) => i && i.type && i.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(i, { ...i.props, ariaControls: this._gridId }) : null), E = f.filter((i) => i && i.type && i.type.displayName === "KendoReactGridNoRecords"), D = f.filter((i) => i && i.type && i.type.displayName === "KendoReactGridStatusBar"), C = this._columns.filter((i) => i.children.length === 0), A = n && /* @__PURE__ */ r.createElement(
|
|
531
548
|
rt,
|
|
532
549
|
{
|
|
533
550
|
group: this.props.group || [],
|
|
@@ -540,7 +557,7 @@ const T = class T extends r.Component {
|
|
|
540
557
|
ariaControls: this._gridId,
|
|
541
558
|
onContextMenu: this.onContextMenu
|
|
542
559
|
}
|
|
543
|
-
), { sort: ye, sortable: we, group: Se, filter: Ie, filterable: ke, filterOperators: Ee = Ce, headerCellRender: xe, columnMenu: _e, columnMenuIcon:
|
|
560
|
+
), { sort: ye, sortable: we, group: Se, filter: Ie, filterable: ke, filterOperators: Ee = Ce, headerCellRender: xe, columnMenu: _e, columnMenuIcon: ze } = this.props, j = /* @__PURE__ */ r.createElement(
|
|
544
561
|
st,
|
|
545
562
|
{
|
|
546
563
|
size: this.props.size,
|
|
@@ -560,7 +577,7 @@ const T = class T extends r.Component {
|
|
|
560
577
|
Ee,
|
|
561
578
|
xe,
|
|
562
579
|
_e,
|
|
563
|
-
|
|
580
|
+
ze,
|
|
564
581
|
this._columns,
|
|
565
582
|
this._columnsMap,
|
|
566
583
|
this.isRtl
|
|
@@ -584,17 +601,17 @@ const T = class T extends r.Component {
|
|
|
584
601
|
"col",
|
|
585
602
|
{
|
|
586
603
|
key: g.toString(),
|
|
587
|
-
width:
|
|
604
|
+
width: W(i)
|
|
588
605
|
}
|
|
589
606
|
))
|
|
590
607
|
}
|
|
591
|
-
),
|
|
608
|
+
), De = this.vs && this.vs.container && this.vs.container.scrollLeft || 0, Te = parseFloat(((this.props.style || {}).width || "").toString()), { colSpans: He, hiddenColumns: Fe } = qe({
|
|
592
609
|
enabled: this.props.columnVirtualization,
|
|
593
610
|
columns: C,
|
|
594
|
-
tableViewPortWidth:
|
|
595
|
-
scrollLeft:
|
|
596
|
-
}),
|
|
597
|
-
let
|
|
611
|
+
tableViewPortWidth: Te,
|
|
612
|
+
scrollLeft: De
|
|
613
|
+
}), Ne = (i, g, m) => {
|
|
614
|
+
let x = !1;
|
|
598
615
|
const I = this.props.selectedField ? ve(this.props.selectedField, i.dataItem) : void 0;
|
|
599
616
|
return {
|
|
600
617
|
row: C.map((u, v) => {
|
|
@@ -604,19 +621,19 @@ const T = class T extends r.Component {
|
|
|
604
621
|
let w = !1;
|
|
605
622
|
if (u.editable && this.props.editField) {
|
|
606
623
|
const b = ve(this.props.editField, i.dataItem);
|
|
607
|
-
b && (b === !0 || b === u.field) && (
|
|
624
|
+
b && (b === !0 || b === u.field) && (x = !0, w = !0);
|
|
608
625
|
}
|
|
609
|
-
const
|
|
626
|
+
const U = u.cell || w && tt || Ct, N = this.props.expandField && this.props.detail && u.field === this.props.expandField;
|
|
610
627
|
return /* @__PURE__ */ r.createElement(
|
|
611
|
-
|
|
628
|
+
U,
|
|
612
629
|
{
|
|
613
630
|
onContextMenu: this.onContextMenu,
|
|
614
631
|
key: H,
|
|
615
632
|
locked: this.props.lockGroups,
|
|
616
|
-
id:
|
|
633
|
+
id: k.generateNavigatableId(
|
|
617
634
|
`${g}-${String(v)}`,
|
|
618
635
|
h,
|
|
619
|
-
|
|
636
|
+
N || i.rowType === "groupHeader" || i.rowType === "groupFooter" || u.field === "value" ? "nodata" : "cell"
|
|
620
637
|
),
|
|
621
638
|
colSpan: He[v],
|
|
622
639
|
dataItem: i.dataItem,
|
|
@@ -628,7 +645,7 @@ const T = class T extends r.Component {
|
|
|
628
645
|
cells: bt(this.props.cells, u.cells),
|
|
629
646
|
onChange: this.itemChange,
|
|
630
647
|
selectionChange: this.props.onSelectionChange ? (b) => {
|
|
631
|
-
this.selectionChange({ event: b, dataItem: i.dataItem, dataIndex:
|
|
648
|
+
this.selectionChange({ event: b, dataItem: i.dataItem, dataIndex: m, columnIndex: v });
|
|
632
649
|
} : void 0,
|
|
633
650
|
columnIndex: v,
|
|
634
651
|
columnsCount: C.length,
|
|
@@ -642,7 +659,7 @@ const T = class T extends r.Component {
|
|
|
642
659
|
}
|
|
643
660
|
);
|
|
644
661
|
}),
|
|
645
|
-
isInEdit:
|
|
662
|
+
isInEdit: x,
|
|
646
663
|
isSelected: typeof I == "boolean" && I
|
|
647
664
|
};
|
|
648
665
|
};
|
|
@@ -655,64 +672,64 @@ const T = class T extends r.Component {
|
|
|
655
672
|
else
|
|
656
673
|
break;
|
|
657
674
|
}
|
|
658
|
-
const
|
|
659
|
-
let
|
|
660
|
-
const
|
|
675
|
+
const J = (i) => i >= this._data.length - q;
|
|
676
|
+
let X = this.vs.realSkip || 0;
|
|
677
|
+
const P = [];
|
|
661
678
|
let K = !1;
|
|
662
|
-
const
|
|
663
|
-
let
|
|
679
|
+
const V = this._columnsMap.length + (this.props.filterable ? 1 : 0) + 1;
|
|
680
|
+
let T = 0;
|
|
664
681
|
if (this._data.length) {
|
|
665
682
|
let i = -1, g = 0;
|
|
666
|
-
(this._slicedData || this._data).forEach((
|
|
667
|
-
|
|
668
|
-
const I =
|
|
669
|
-
if (
|
|
683
|
+
(this._slicedData || this._data).forEach((m, x) => {
|
|
684
|
+
m.rowType === "data" && (X++, i++);
|
|
685
|
+
const I = X % 2 === 0, u = this.props.dataItemKey && Ue(this.props.dataItemKey)(m.dataItem), v = x + (this.vs.realSkip || 0), H = u || "ai" + v, F = H + "_1", y = Ne(m, H, i);
|
|
686
|
+
if (T = v + V + g, P.push(/* @__PURE__ */ r.createElement(
|
|
670
687
|
Rt,
|
|
671
688
|
{
|
|
672
689
|
key: H,
|
|
673
|
-
dataItem:
|
|
690
|
+
dataItem: m.dataItem,
|
|
674
691
|
isAltRow: I,
|
|
675
692
|
isInEdit: y.isInEdit,
|
|
676
|
-
rowType:
|
|
677
|
-
isHidden:
|
|
678
|
-
onClick: (w) => this.rowClick(w,
|
|
679
|
-
onDoubleClick: (w) => this.rowDblClick(w,
|
|
693
|
+
rowType: m.rowType,
|
|
694
|
+
isHidden: J(x),
|
|
695
|
+
onClick: (w) => this.rowClick(w, m),
|
|
696
|
+
onDoubleClick: (w) => this.rowDblClick(w, m),
|
|
680
697
|
selectedField: this.props.selectedField,
|
|
681
698
|
rowHeight: this.props.rowHeight,
|
|
682
699
|
render: this.props.rowRender,
|
|
683
|
-
ariaRowIndex:
|
|
700
|
+
ariaRowIndex: T,
|
|
684
701
|
absoluteRowIndex: v,
|
|
685
702
|
dataIndex: this.vs.scrollableVirtual ? v : i,
|
|
686
703
|
isSelected: y.isSelected
|
|
687
704
|
},
|
|
688
705
|
y.row
|
|
689
|
-
)), this.props.detail &&
|
|
706
|
+
)), this.props.detail && m.rowType === "data" && m.expanded) {
|
|
690
707
|
const w = C.length - (this.props.expandField ? 1 : 0) - (this.props.group ? this.props.group.length : 0) || 1;
|
|
691
|
-
g++,
|
|
708
|
+
g++, T = v + V + g, P.push(/* @__PURE__ */ r.createElement(
|
|
692
709
|
"tr",
|
|
693
710
|
{
|
|
694
711
|
key: F,
|
|
695
|
-
className:
|
|
712
|
+
className: M(
|
|
696
713
|
"k-table-row",
|
|
697
714
|
I ? "k-detail-row k-table-alt-row k-alt" : "k-detail-row"
|
|
698
715
|
),
|
|
699
|
-
style: { visibility:
|
|
716
|
+
style: { visibility: J(x) ? "hidden" : "", height: this.props.detailRowHeight },
|
|
700
717
|
role: "row",
|
|
701
|
-
"aria-rowindex":
|
|
718
|
+
"aria-rowindex": T
|
|
702
719
|
},
|
|
703
|
-
this.props.group && this.props.group.map((
|
|
720
|
+
this.props.group && this.props.group.map((U, N) => {
|
|
704
721
|
var oe;
|
|
705
|
-
const b = (oe = y == null ? void 0 : y.row[
|
|
722
|
+
const b = (oe = y == null ? void 0 : y.row[N]) == null ? void 0 : oe.props.style, Pe = b ? this.isRtl ? { left: b.right, right: b.left } : { left: b.left, right: b.right } : {};
|
|
706
723
|
return /* @__PURE__ */ r.createElement(
|
|
707
724
|
be,
|
|
708
725
|
{
|
|
709
726
|
id: "",
|
|
710
|
-
dataIndex:
|
|
711
|
-
field:
|
|
712
|
-
dataItem:
|
|
713
|
-
key:
|
|
714
|
-
style:
|
|
715
|
-
ariaColumnIndex: 1 +
|
|
727
|
+
dataIndex: m.dataIndex,
|
|
728
|
+
field: U.field,
|
|
729
|
+
dataItem: m.dataItem,
|
|
730
|
+
key: N,
|
|
731
|
+
style: Pe,
|
|
732
|
+
ariaColumnIndex: 1 + N,
|
|
716
733
|
isSelected: !1,
|
|
717
734
|
locked: this.props.lockGroups,
|
|
718
735
|
isRtl: this.isRtl,
|
|
@@ -723,19 +740,19 @@ const T = class T extends r.Component {
|
|
|
723
740
|
this.props.expandField && /* @__PURE__ */ r.createElement(
|
|
724
741
|
Et,
|
|
725
742
|
{
|
|
726
|
-
id:
|
|
743
|
+
id: k.generateNavigatableId(`${F}-dhcell`, h)
|
|
727
744
|
}
|
|
728
745
|
),
|
|
729
746
|
/* @__PURE__ */ r.createElement(
|
|
730
747
|
kt,
|
|
731
748
|
{
|
|
732
749
|
onContextMenu: this.onContextMenu,
|
|
733
|
-
dataItem:
|
|
734
|
-
dataIndex:
|
|
750
|
+
dataItem: m.dataItem,
|
|
751
|
+
dataIndex: m.dataIndex,
|
|
735
752
|
colSpan: w,
|
|
736
753
|
ariaColIndex: 2 + (this.props.group ? this.props.group.length : 0),
|
|
737
754
|
detail: this.props.detail,
|
|
738
|
-
id:
|
|
755
|
+
id: k.generateNavigatableId(`${F}-dcell`, h)
|
|
739
756
|
}
|
|
740
757
|
)
|
|
741
758
|
));
|
|
@@ -743,18 +760,18 @@ const T = class T extends r.Component {
|
|
|
743
760
|
});
|
|
744
761
|
} else
|
|
745
762
|
K = !0;
|
|
746
|
-
const
|
|
763
|
+
const Le = () => {
|
|
747
764
|
const i = this._header;
|
|
748
765
|
return i && i.table.clientWidth;
|
|
749
|
-
},
|
|
766
|
+
}, Y = () => /* @__PURE__ */ r.createElement(
|
|
750
767
|
"div",
|
|
751
768
|
{
|
|
752
769
|
key: "no-records",
|
|
753
770
|
className: "k-grid-norecords",
|
|
754
|
-
"aria-rowindex":
|
|
755
|
-
style: { width:
|
|
771
|
+
"aria-rowindex": V,
|
|
772
|
+
style: { width: Le() }
|
|
756
773
|
},
|
|
757
|
-
/* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template", [Qe]:
|
|
774
|
+
/* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template", [Qe]: k.generateNavigatableId("no-records", h) }, E.length ? E : /* @__PURE__ */ r.createElement(wt, null))
|
|
758
775
|
), Q = {
|
|
759
776
|
size: this.props.size,
|
|
760
777
|
onPageChange: this.pagerPageChange,
|
|
@@ -765,11 +782,11 @@ const T = class T extends r.Component {
|
|
|
765
782
|
messagesMap: ht,
|
|
766
783
|
navigatable: this.props.navigatable,
|
|
767
784
|
...It(this.props.pageable || {})
|
|
768
|
-
}, Z = this.props.pager ? /* @__PURE__ */ r.createElement(this.props.pager, { ...Q }) : /* @__PURE__ */ r.createElement(
|
|
785
|
+
}, Z = this.props.pager ? /* @__PURE__ */ r.createElement(this.props.pager, { ...Q }) : /* @__PURE__ */ r.createElement(Je, { className: "k-grid-pager", ...Q }), Me = (i) => this.props.sort && this.props.sort.filter((g) => g.field === i).length > 0, Ae = (i, g) => /* @__PURE__ */ r.createElement(
|
|
769
786
|
"col",
|
|
770
787
|
{
|
|
771
788
|
key: g.toString(),
|
|
772
|
-
width:
|
|
789
|
+
width: W(i)
|
|
773
790
|
}
|
|
774
791
|
), ee = (ie = this.props.cells) != null && ie.footerCell || this._columns.some(
|
|
775
792
|
(i) => {
|
|
@@ -790,10 +807,10 @@ const T = class T extends r.Component {
|
|
|
790
807
|
idPrefix: h,
|
|
791
808
|
columns: this._columns,
|
|
792
809
|
isRtl: this.isRtl,
|
|
793
|
-
ariaRowIndex:
|
|
810
|
+
ariaRowIndex: T + 1
|
|
794
811
|
}
|
|
795
812
|
),
|
|
796
|
-
cols: C.map(
|
|
813
|
+
cols: C.map(Ae)
|
|
797
814
|
}
|
|
798
815
|
) : null, te = /* @__PURE__ */ r.createElement(
|
|
799
816
|
"colgroup",
|
|
@@ -807,23 +824,23 @@ const T = class T extends r.Component {
|
|
|
807
824
|
"col",
|
|
808
825
|
{
|
|
809
826
|
key: g.toString(),
|
|
810
|
-
className:
|
|
811
|
-
width:
|
|
827
|
+
className: Me(i.field) ? "k-sorted" : void 0,
|
|
828
|
+
width: W(i)
|
|
812
829
|
}
|
|
813
830
|
)
|
|
814
831
|
)
|
|
815
832
|
), se = this.dragLogic.reorderable || this.dragLogic.groupable;
|
|
816
833
|
if (this.props.scrollable === "none")
|
|
817
|
-
return /* @__PURE__ */ r.createElement(
|
|
834
|
+
return /* @__PURE__ */ r.createElement(B.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
|
|
818
835
|
"div",
|
|
819
836
|
{
|
|
820
837
|
id: this.props.id,
|
|
821
838
|
style: this.props.style,
|
|
822
|
-
className:
|
|
839
|
+
className: M(
|
|
823
840
|
"k-grid",
|
|
824
841
|
{
|
|
825
842
|
"k-grid-md": !this.props.size,
|
|
826
|
-
[`k-grid-${
|
|
843
|
+
[`k-grid-${O.sizeMap[this.props.size] || this.props.size}`]: this.props.size
|
|
827
844
|
},
|
|
828
845
|
this.props.className
|
|
829
846
|
),
|
|
@@ -850,32 +867,32 @@ const T = class T extends r.Component {
|
|
|
850
867
|
"table",
|
|
851
868
|
{
|
|
852
869
|
ref: (i) => this.headTable = i,
|
|
853
|
-
className:
|
|
870
|
+
className: M(
|
|
854
871
|
"k-table k-grid-table",
|
|
855
|
-
{ [`k-table-${
|
|
872
|
+
{ [`k-table-${O.sizeMap[this.props.size] || this.props.size}`]: this.props.size }
|
|
856
873
|
),
|
|
857
874
|
style: { userSelect: d }
|
|
858
875
|
},
|
|
859
876
|
te,
|
|
860
877
|
j,
|
|
861
|
-
/* @__PURE__ */ r.createElement("tbody", { role: "rowgroup", className: "k-table-tbody", ...pe },
|
|
878
|
+
/* @__PURE__ */ r.createElement("tbody", { role: "rowgroup", className: "k-table-tbody", ...pe }, P),
|
|
862
879
|
ee
|
|
863
880
|
)
|
|
864
881
|
),
|
|
865
|
-
K &&
|
|
882
|
+
K && Y(),
|
|
866
883
|
se && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(de, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(ce, { ref: this.dragLogic.refDragElementClue }))
|
|
867
|
-
),
|
|
884
|
+
), D, this.props.pageable && Z);
|
|
868
885
|
let G = this.props.style || {};
|
|
869
|
-
return s && (G.height || (G = Object.assign({}, G, { height: "450px" }))), /* @__PURE__ */ r.createElement(
|
|
886
|
+
return s && (G.height || (G = Object.assign({}, G, { height: "450px" }))), /* @__PURE__ */ r.createElement(B.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
|
|
870
887
|
"div",
|
|
871
888
|
{
|
|
872
889
|
id: this.props.id,
|
|
873
890
|
style: G,
|
|
874
|
-
className:
|
|
891
|
+
className: M(
|
|
875
892
|
"k-grid",
|
|
876
893
|
{
|
|
877
894
|
"k-grid-md": !this.props.size,
|
|
878
|
-
[`k-grid-${
|
|
895
|
+
[`k-grid-${O.sizeMap[this.props.size] || this.props.size}`]: this.props.size,
|
|
879
896
|
"k-grid-virtual": s
|
|
880
897
|
},
|
|
881
898
|
this.props.className
|
|
@@ -922,11 +939,11 @@ const T = class T extends r.Component {
|
|
|
922
939
|
"table",
|
|
923
940
|
{
|
|
924
941
|
ref: (i) => this.tableElement = i,
|
|
925
|
-
className:
|
|
942
|
+
className: M(
|
|
926
943
|
"k-table k-grid-table",
|
|
927
944
|
{
|
|
928
945
|
"k-table-md": !this.props.size,
|
|
929
|
-
[`k-table-${
|
|
946
|
+
[`k-table-${O.sizeMap[this.props.size] || this.props.size}`]: this.props.size
|
|
930
947
|
}
|
|
931
948
|
),
|
|
932
949
|
role: "presentation",
|
|
@@ -941,10 +958,10 @@ const T = class T extends r.Component {
|
|
|
941
958
|
role: "rowgroup",
|
|
942
959
|
...pe
|
|
943
960
|
},
|
|
944
|
-
|
|
961
|
+
P
|
|
945
962
|
)
|
|
946
963
|
)
|
|
947
|
-
), K &&
|
|
964
|
+
), K && Y()),
|
|
948
965
|
s && /* @__PURE__ */ r.createElement("div", { className: "k-height-container", role: "presentation" }, /* @__PURE__ */ r.createElement(
|
|
949
966
|
"div",
|
|
950
967
|
{
|
|
@@ -954,12 +971,15 @@ const T = class T extends r.Component {
|
|
|
954
971
|
)),
|
|
955
972
|
ee,
|
|
956
973
|
se && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(de, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(ce, { ref: this.dragLogic.refDragElementClue })),
|
|
957
|
-
this.showLicenseWatermark && /* @__PURE__ */ r.createElement(
|
|
974
|
+
this.showLicenseWatermark && /* @__PURE__ */ r.createElement(Be, null)
|
|
958
975
|
),
|
|
959
|
-
|
|
976
|
+
D,
|
|
960
977
|
this.props.pageable && Z
|
|
961
978
|
));
|
|
962
979
|
}
|
|
980
|
+
calculateMedia() {
|
|
981
|
+
this.checkMatchMediaColumnsDifferece() || this.forceUpdate();
|
|
982
|
+
}
|
|
963
983
|
selectionChange(a) {
|
|
964
984
|
if (this.props.onSelectionChange) {
|
|
965
985
|
const { event: h, dataItem: c, dataIndex: e, columnIndex: t } = a, { mode: s, cell: l } = le(this.props.selectable), p = {
|
|
@@ -1008,9 +1028,9 @@ const T = class T extends r.Component {
|
|
|
1008
1028
|
while (d < this._columns.length && this._columns[d].depth > t);
|
|
1009
1029
|
return d;
|
|
1010
1030
|
}, l = this._columns.splice(a, s(a) - a);
|
|
1011
|
-
this._columns.splice(a < h ? s(h - l.length) : h, 0, ...l), this._columns.filter((d) => d.declarationIndex >= 0).forEach((d,
|
|
1031
|
+
this._columns.splice(a < h ? s(h - l.length) : h, 0, ...l), this._columns.filter((d) => d.declarationIndex >= 0).forEach((d, f) => d.orderIndex = f), this._columnsMutations++;
|
|
1012
1032
|
const p = this._columns[a].locked && this._columns[h].locked;
|
|
1013
|
-
|
|
1033
|
+
Xe(this._columnsMap, this._columns, p || this._shouldUpdateLeftRight), Ye(this._columnsMap, this._columns, p || this._shouldUpdateLeftRight), this._resized && (this._shouldUpdateLeftRight = !1, this._resized = !1);
|
|
1014
1034
|
const n = this.columns;
|
|
1015
1035
|
if (this.forceUpdate(), this.props.onColumnReorder) {
|
|
1016
1036
|
const d = {
|
|
@@ -1053,8 +1073,8 @@ const T = class T extends r.Component {
|
|
|
1053
1073
|
a = Math.round(a), this._header && this._header.setWidth(a), this._footer && this._footer.setWidth(a), this.tableElement && (this.tableElement.style.width = a + "px");
|
|
1054
1074
|
}
|
|
1055
1075
|
initColumns(a, h) {
|
|
1056
|
-
const c =
|
|
1057
|
-
this._columns =
|
|
1076
|
+
const c = k.getIdPrefix(this.navigationStateRef), e = this.filterHiddenColumns(a), t = this.readColumns(e, c, this._columnsMutations);
|
|
1077
|
+
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, h, c), this._columnsMap = this.mapColumns(this._columns, this._columnsMutations), this.columnResize.columns = this._columns, this.dragLogic.columns = this._columns;
|
|
1058
1078
|
}
|
|
1059
1079
|
getDataState() {
|
|
1060
1080
|
return {
|
|
@@ -1073,9 +1093,9 @@ const T = class T extends r.Component {
|
|
|
1073
1093
|
};
|
|
1074
1094
|
}
|
|
1075
1095
|
};
|
|
1076
|
-
|
|
1096
|
+
z.displayName = "KendoReactGrid", z.defaultProps = {
|
|
1077
1097
|
// never use this
|
|
1078
|
-
},
|
|
1098
|
+
}, z.propTypes = {
|
|
1079
1099
|
data: o.oneOfType([
|
|
1080
1100
|
o.array,
|
|
1081
1101
|
o.shape({
|
|
@@ -1151,8 +1171,8 @@ T.displayName = "KendoReactGrid", T.defaultProps = {
|
|
|
1151
1171
|
dataItemKey: o.string,
|
|
1152
1172
|
navigatable: o.bool,
|
|
1153
1173
|
size: o.oneOf(["small", "medium"])
|
|
1154
|
-
},
|
|
1155
|
-
let $ =
|
|
1174
|
+
}, z.contextType = B;
|
|
1175
|
+
let $ = z;
|
|
1156
1176
|
nt($);
|
|
1157
1177
|
export {
|
|
1158
1178
|
$ as Grid
|