@progress/kendo-react-grid 7.5.0-develop.13 → 7.5.0-develop.14
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 +143 -141
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +9 -0
- package/index.d.ts +9 -0
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
package/Grid.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as r from "react";
|
|
10
|
-
import
|
|
10
|
+
import o from "prop-types";
|
|
11
11
|
import { RowHeightService as re, dispatchEvent as Ge, canUseDOM as V, getActiveElement as Ke, memoizeOne as S, validatePackage as Oe, shouldShowValidationUI as Pe, setScrollbarWidth as ae, getter as Ve, classNames as F, kendoThemeMaps as G, WatermarkOverlay as Ue } from "@progress/kendo-react-common";
|
|
12
12
|
import { tableKeyboardNavigation as x, getSelectionOptions as le, mapColumns as We, ClipboardService as Be, TableKeyboardNavigationContext as U, isRtl as $e, tableKeyboardNavigationTools as N, tableColumnsVirtualization as je, Pager as qe, tableKeyboardNavigationScopeAttributes as ne, TableSelection as he, tableKeyboardNavigationBodyAttributes as pe, DropClue as de, DragClue as ce, updateLeft as Xe, updateRight as Je } from "@progress/kendo-react-data-tools";
|
|
13
13
|
import { GridSelectionCell as Qe } from "./cells/GridSelectionCell.mjs";
|
|
@@ -35,14 +35,14 @@ import { FooterRow as yt } from "./footer/FooterRow.mjs";
|
|
|
35
35
|
import { normalize as wt } from "./paging/GridPagerSettings.mjs";
|
|
36
36
|
import { packageMetadata as Re } from "./package-metadata.mjs";
|
|
37
37
|
import { GridDetailCell as St } from "./cells/GridDetailCell.mjs";
|
|
38
|
-
import { GridDetailHierarchyCell as
|
|
39
|
-
import { SAFARI_REGEX as
|
|
38
|
+
import { GridDetailHierarchyCell as It } from "./cells/GridDetailHierarchyCell.mjs";
|
|
39
|
+
import { SAFARI_REGEX as kt } from "./constants/index.mjs";
|
|
40
40
|
const _ = class _ extends r.Component {
|
|
41
41
|
constructor(a) {
|
|
42
42
|
super(a), this._columns = [], this._columnsMap = [[]], this._columnsMutations = 0, this._resized = !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 };
|
|
44
|
-
e.forEach((
|
|
45
|
-
|
|
44
|
+
e.forEach((i) => {
|
|
45
|
+
i.isIntersecting || this.setCurrentOnTop(t);
|
|
46
46
|
});
|
|
47
47
|
}, this.setCurrentOnTop = (e) => {
|
|
48
48
|
if (!this.vs.container || this.props.scrollable === "none")
|
|
@@ -52,35 +52,35 @@ const _ = class _ extends r.Component {
|
|
|
52
52
|
if (this.props.scrollable === "virtual")
|
|
53
53
|
this.vs.askedSkip = t, this.vs.container.scroll(0, Math.round(this.vs.askedSkip / this.vs.total * this.vs.container.scrollHeight));
|
|
54
54
|
else if (this.element) {
|
|
55
|
-
const
|
|
56
|
-
|
|
55
|
+
const i = t < 1 ? this.element.querySelector("tbody > tr:nth-child(1)") : this.element.querySelector(`tbody > tr:nth-child(${t + 1})`);
|
|
56
|
+
i && this.containerRef.current && (this.containerRef.current.scrollTop = i.offsetTop);
|
|
57
57
|
}
|
|
58
58
|
}, this.scrollIntoView = (e) => {
|
|
59
59
|
if (!this.vs.container || this.props.scrollable === "none")
|
|
60
60
|
return;
|
|
61
61
|
this.rowIndex = e.rowIndex;
|
|
62
|
-
const { rowIndex: t } = e,
|
|
63
|
-
if (this.observer &&
|
|
62
|
+
const { rowIndex: t } = e, i = this.element;
|
|
63
|
+
if (this.observer && i) {
|
|
64
64
|
this.observer.disconnect();
|
|
65
|
-
const n =
|
|
65
|
+
const n = i.querySelector(`[absolute-row-index="${t}"]`);
|
|
66
66
|
n ? this.observer.observe(n) : this.setCurrentOnTop(e);
|
|
67
67
|
}
|
|
68
68
|
}, this.fitColumns = (e) => {
|
|
69
69
|
this.columnResize.dblClickHandler(null, e);
|
|
70
|
-
}, this.onContextMenu = (e, t,
|
|
70
|
+
}, this.onContextMenu = (e, t, i) => {
|
|
71
71
|
if (this.props.onContextMenu) {
|
|
72
72
|
const n = {
|
|
73
73
|
target: this,
|
|
74
74
|
syntheticEvent: e,
|
|
75
75
|
nativeEvent: e.nativeEvent,
|
|
76
76
|
dataItem: t,
|
|
77
|
-
field:
|
|
77
|
+
field: i
|
|
78
78
|
};
|
|
79
79
|
this.props.onContextMenu.call(void 0, n);
|
|
80
80
|
}
|
|
81
81
|
}, this.getVirtualScroll = (e) => {
|
|
82
|
-
const { rowHeight: t, detailRowHeight:
|
|
83
|
-
return !f ||
|
|
82
|
+
const { rowHeight: t, detailRowHeight: i, detail: n, expandField: h, groupable: l } = e, d = this.isAllData(), f = t !== void 0 && t > 0, R = i !== void 0 && i > 0, k = l === !0 || typeof l == "object" && l.enabled !== !1;
|
|
83
|
+
return !f || k && !d || !!(n && h) && (!R || !d) ? ht : ge;
|
|
84
84
|
}, this.isAllData = () => {
|
|
85
85
|
const { data: e, total: t } = this.props;
|
|
86
86
|
return Array.isArray(e) ? e.length === t : e ? t === e.total : !1;
|
|
@@ -93,14 +93,14 @@ const _ = class _ extends r.Component {
|
|
|
93
93
|
this.props.sort,
|
|
94
94
|
t || this.props.rowHeight === void 0 || this.props.rowHeight === 0
|
|
95
95
|
), 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
|
-
const
|
|
97
|
-
this.vs.containerHeight = me ? Math.min(fe,
|
|
96
|
+
const i = this.props.rowHeight * e;
|
|
97
|
+
this.vs.containerHeight = me ? Math.min(fe, i) : i;
|
|
98
98
|
} else
|
|
99
99
|
this.vs.containerHeight = 1533915;
|
|
100
100
|
if (this.vs.containerRef = this.containerRef, this.vs.tableBodyRef = this.tableBodyRef, this.vs.table = this.tableElement, this._slicedData = void 0, this.vs instanceof ge) {
|
|
101
|
-
const { rowHeight:
|
|
101
|
+
const { rowHeight: i = 0, detail: n, expandField: h } = this.props;
|
|
102
102
|
let { detailRowHeight: l = 0 } = this.props;
|
|
103
|
-
l = n && h ? l :
|
|
103
|
+
l = n && h ? l : i, 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, i, l, this._data)) : this.vs.rowHeightService = new re(e, i, l);
|
|
104
104
|
const d = this.vs.rowHeightService.totalHeight();
|
|
105
105
|
this.vs.containerHeight = me ? Math.min(fe, d) : d;
|
|
106
106
|
}
|
|
@@ -108,20 +108,20 @@ const _ = class _ extends r.Component {
|
|
|
108
108
|
if (e.target !== e.currentTarget)
|
|
109
109
|
return;
|
|
110
110
|
clearTimeout(this.forceUpdateTimeout), this.vs.table = this.tableElement;
|
|
111
|
-
const t = e.currentTarget.scrollLeft,
|
|
112
|
-
this.props.columnVirtualization && (!this.vs.scrollableVirtual ||
|
|
111
|
+
const t = e.currentTarget.scrollLeft, i = e.currentTarget.scrollTop;
|
|
112
|
+
this.props.columnVirtualization && (!this.vs.scrollableVirtual || i === this.wrapperScrollTop) && (this.forceUpdateTimeout = window.setTimeout(() => {
|
|
113
113
|
this.forceUpdate();
|
|
114
|
-
}, 0)), this._header && this._header.setScrollLeft(t), this._footer && this._footer.setScrollLeft(t), this.vs &&
|
|
114
|
+
}, 0)), this._header && this._header.setScrollLeft(t), this._footer && this._footer.setScrollLeft(t), this.vs && i !== this.wrapperScrollTop && this.vs.scrollHandler(e), Ge(this.props.onScroll, e, this, void 0), this.wrapperScrollTop = i;
|
|
115
115
|
}, this.onKeyDown = (e) => {
|
|
116
116
|
if (x.onKeyDown(e, {
|
|
117
117
|
contextStateRef: this.contextStateRef,
|
|
118
118
|
navigationStateRef: this.navigationStateRef,
|
|
119
119
|
onNavigationAction: this.onNavigationAction
|
|
120
120
|
}), this.props.onKeyDown) {
|
|
121
|
-
const { mode: t, cell:
|
|
121
|
+
const { mode: t, cell: i } = le(this.props.selectable), n = {
|
|
122
122
|
dataItems: this.getLeafDataItems(),
|
|
123
123
|
mode: t,
|
|
124
|
-
cell:
|
|
124
|
+
cell: i,
|
|
125
125
|
componentId: this._gridId,
|
|
126
126
|
selectedField: this.props.selectedField,
|
|
127
127
|
...this.getArguments(e)
|
|
@@ -159,8 +159,8 @@ const _ = class _ extends r.Component {
|
|
|
159
159
|
}, this.itemChange = (e) => {
|
|
160
160
|
const t = this.props.onItemChange;
|
|
161
161
|
if (e.field === this.props.expandField || this.props.group && e.field === void 0) {
|
|
162
|
-
const
|
|
163
|
-
|
|
162
|
+
const i = this.props.onExpandChange;
|
|
163
|
+
i && i.call(
|
|
164
164
|
void 0,
|
|
165
165
|
{
|
|
166
166
|
...this.getArguments(e.syntheticEvent),
|
|
@@ -194,24 +194,26 @@ const _ = class _ extends r.Component {
|
|
|
194
194
|
);
|
|
195
195
|
}, this.selectionRelease = (e) => {
|
|
196
196
|
if (this.props.onSelectionChange) {
|
|
197
|
-
const t = {
|
|
197
|
+
const t = this.getSlicedLeafDataItems()[e.startRowIndex], i = this.getSlicedLeafDataItems()[e.endRowIndex], n = {
|
|
198
198
|
syntheticEvent: void 0,
|
|
199
199
|
target: this,
|
|
200
200
|
selectedField: this.props.selectedField || "",
|
|
201
201
|
componentId: this._gridId,
|
|
202
202
|
dataItems: this.getLeafDataItems(),
|
|
203
203
|
dataItem: null,
|
|
204
|
+
startDataItem: t,
|
|
205
|
+
endDataItem: i,
|
|
204
206
|
...e
|
|
205
207
|
};
|
|
206
|
-
this.props.onSelectionChange.call(void 0,
|
|
208
|
+
this.props.onSelectionChange.call(void 0, n);
|
|
207
209
|
}
|
|
208
|
-
}, this.pageChange = (e, t,
|
|
210
|
+
}, this.pageChange = (e, t, i) => {
|
|
209
211
|
this.raiseDataEvent(
|
|
210
212
|
this.props.onPageChange,
|
|
211
213
|
{ page: e },
|
|
212
214
|
{ skip: e.skip, take: e.take },
|
|
213
215
|
t,
|
|
214
|
-
|
|
216
|
+
i
|
|
215
217
|
);
|
|
216
218
|
}, this.pagerPageChange = (e) => {
|
|
217
219
|
this.pageChange({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
|
|
@@ -230,12 +232,12 @@ const _ = class _ extends r.Component {
|
|
|
230
232
|
t
|
|
231
233
|
);
|
|
232
234
|
}, this.groupChange = (e, t) => {
|
|
233
|
-
const
|
|
235
|
+
const i = t.nativeEvent ? t : { nativeEvent: t.nativeEvent || t.originalEvent };
|
|
234
236
|
this.raiseDataEvent(
|
|
235
237
|
this.props.onGroupChange,
|
|
236
238
|
{ group: e },
|
|
237
239
|
{ group: e, skip: 0 },
|
|
238
|
-
|
|
240
|
+
i
|
|
239
241
|
);
|
|
240
242
|
}, this.onClipboard = (e, t) => {
|
|
241
243
|
if (this.props.onClipboard) {
|
|
@@ -256,9 +258,9 @@ const _ = class _ extends r.Component {
|
|
|
256
258
|
var h, l, d;
|
|
257
259
|
if (!V)
|
|
258
260
|
return !1;
|
|
259
|
-
const e = Ke(this.document), t = e ? e.matches(".k-table-td") ? e : (h = this.document) == null ? void 0 : h.body : (l = this.document) == null ? void 0 : l.body,
|
|
260
|
-
return !!(t && n &&
|
|
261
|
-
}, this.onResize = (e, t,
|
|
261
|
+
const e = Ke(this.document), t = e ? e.matches(".k-table-td") ? e : (h = this.document) == null ? void 0 : h.body : (l = this.document) == null ? void 0 : l.body, i = t.closest(".k-grid-container"), n = t && ((d = this._element) == null ? void 0 : d.contains(t));
|
|
262
|
+
return !!(t && n && i);
|
|
263
|
+
}, this.onResize = (e, t, i, n, h, l) => {
|
|
262
264
|
this.resetTableWidth(), this._shouldUpdateLeftRight = !0, this._resized = !0, this._columnsMutations++, this.props.onColumnResize && this.props.onColumnResize.call(
|
|
263
265
|
void 0,
|
|
264
266
|
{
|
|
@@ -267,33 +269,33 @@ const _ = class _ extends r.Component {
|
|
|
267
269
|
targetColumnId: l,
|
|
268
270
|
index: e,
|
|
269
271
|
newWidth: t,
|
|
270
|
-
oldWidth:
|
|
272
|
+
oldWidth: i,
|
|
271
273
|
end: h,
|
|
272
274
|
target: this
|
|
273
275
|
}
|
|
274
276
|
);
|
|
275
|
-
}, this.reInitVirtualization = S((e, t,
|
|
277
|
+
}, this.reInitVirtualization = S((e, t, i, n, h, l) => {
|
|
276
278
|
this.vs.reset();
|
|
277
279
|
const d = this.getVirtualScroll(this.props);
|
|
278
280
|
this.vs = new d(l);
|
|
279
|
-
}), this.flatData = S((e, t,
|
|
281
|
+
}), this.flatData = S((e, t, i, n, h, l, d) => {
|
|
280
282
|
const f = [], R = ct(
|
|
281
283
|
f,
|
|
282
284
|
e,
|
|
283
285
|
t,
|
|
284
|
-
{ index:
|
|
286
|
+
{ index: i },
|
|
285
287
|
n !== void 0,
|
|
286
288
|
h
|
|
287
289
|
);
|
|
288
290
|
return { flattedData: f, resolvedGroupsCount: R };
|
|
289
|
-
}), this.rowHeightService = S((e, t,
|
|
290
|
-
(e, t,
|
|
291
|
+
}), this.rowHeightService = S((e, t, i, n, h) => new re(t, i, n, h)), this.childrenToArray = S((e) => r.Children.toArray(e)), this.readColumns = S(
|
|
292
|
+
(e, t, i) => {
|
|
291
293
|
const n = e.filter((h) => h && h.type && h.type.displayName === "KendoReactGridColumn");
|
|
292
294
|
return ut(n, this.columns, { prevId: 0, idPrefix: t });
|
|
293
295
|
}
|
|
294
296
|
), this.mapColumns = S(
|
|
295
297
|
(e, t) => We(e, t)
|
|
296
|
-
), this.configureColumns = S((e, t,
|
|
298
|
+
), this.configureColumns = S((e, t, i) => {
|
|
297
299
|
this.props.selectedField && e.filter((l) => l.field === this.props.selectedField).forEach((l) => {
|
|
298
300
|
l.width = l.width || "50px", l.cell = l.cell || Qe, l.headerCell = l.headerCell || Ct;
|
|
299
301
|
});
|
|
@@ -332,14 +334,14 @@ const _ = class _ extends r.Component {
|
|
|
332
334
|
locked: this.props.lockGroups
|
|
333
335
|
}), h++;
|
|
334
336
|
e.slice(h).forEach((l) => l.parentIndex >= 0 && (l.parentIndex += h));
|
|
335
|
-
}), this.getHeaderRow = S((e, t,
|
|
337
|
+
}), this.getHeaderRow = S((e, t, i, n, h, l, d, f, R, k, z, C) => /* @__PURE__ */ r.createElement(
|
|
336
338
|
tt,
|
|
337
339
|
{
|
|
338
340
|
cells: this.props.cells,
|
|
339
341
|
sort: e,
|
|
340
342
|
sortable: t,
|
|
341
343
|
sortChange: this.sortChange,
|
|
342
|
-
group:
|
|
344
|
+
group: i || [],
|
|
343
345
|
groupable: n,
|
|
344
346
|
groupChange: this.groupChange,
|
|
345
347
|
filter: h,
|
|
@@ -348,7 +350,7 @@ const _ = class _ extends r.Component {
|
|
|
348
350
|
filterChange: this.filterChange,
|
|
349
351
|
columnMenu: R,
|
|
350
352
|
selectionChange: this.onHeaderSelectionChange,
|
|
351
|
-
columns:
|
|
353
|
+
columns: k,
|
|
352
354
|
columnResize: this.columnResize,
|
|
353
355
|
pressHandler: this.dragLogic.pressHandler,
|
|
354
356
|
dragHandler: this.dragLogic.dragHandler,
|
|
@@ -363,9 +365,9 @@ const _ = class _ extends r.Component {
|
|
|
363
365
|
columnGroupChange: this.columnGroupChange
|
|
364
366
|
}
|
|
365
367
|
)), this.resolveTitle = (e) => {
|
|
366
|
-
const t = this._columns.find((n) => n.field === e),
|
|
367
|
-
return
|
|
368
|
-
}, this.getLeafDataItems = () => this._data.filter((e) => e.rowType === "data").map((e) => e.dataItem), Oe(Re), this.showLicenseWatermark = Pe(Re);
|
|
368
|
+
const t = this._columns.find((n) => n.field === e), i = t && (t.title || t.field);
|
|
369
|
+
return i === void 0 ? e : i;
|
|
370
|
+
}, 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), Oe(Re), this.showLicenseWatermark = Pe(Re);
|
|
369
371
|
const p = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(a);
|
|
370
372
|
this.vs = new c(p || a.rowHeight === void 0 || a.rowHeight === 0), this.dragLogic = new dt(
|
|
371
373
|
this.columnReorder.bind(this),
|
|
@@ -442,7 +444,7 @@ const _ = class _ extends r.Component {
|
|
|
442
444
|
* @hidden
|
|
443
445
|
*/
|
|
444
446
|
componentDidMount() {
|
|
445
|
-
navigator.userAgent.match(
|
|
447
|
+
navigator.userAgent.match(kt) || (this.headTable && (this.headTable.style.display = "block"), this.tableElement && (this.tableElement.style.display = "block")), this.resetTableWidth(), ae();
|
|
446
448
|
const a = $e(this.element);
|
|
447
449
|
this.isRtl = a, x.onComponentDidMount({
|
|
448
450
|
scope: this.element || void 0,
|
|
@@ -490,7 +492,7 @@ const _ = class _ extends r.Component {
|
|
|
490
492
|
const p = N.getIdPrefix(this.navigationStateRef), c = rt(this);
|
|
491
493
|
let e = [];
|
|
492
494
|
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);
|
|
493
|
-
const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none",
|
|
495
|
+
const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", i = this.props.scrollable === "virtual", { resolvedGroupsCount: n, flattedData: h } = this.flatData(
|
|
494
496
|
e,
|
|
495
497
|
t,
|
|
496
498
|
this.props.skip || 0,
|
|
@@ -506,7 +508,7 @@ const _ = class _ extends r.Component {
|
|
|
506
508
|
this.initializeVirtualization(a, l);
|
|
507
509
|
const f = this.childrenToArray(this.props.children);
|
|
508
510
|
this.initColumns(f, n);
|
|
509
|
-
const R = f.map((s) => s && s.type && s.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(s, { ...s.props, ariaControls: this._gridId }) : null),
|
|
511
|
+
const R = f.map((s) => s && s.type && s.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(s, { ...s.props, ariaControls: this._gridId }) : null), k = f.filter((s) => s && s.type && s.type.displayName === "KendoReactGridNoRecords"), z = f.filter((s) => s && s.type && s.type.displayName === "KendoReactGridStatusBar"), C = this._columns.filter((s) => s.children.length === 0), $ = l && /* @__PURE__ */ r.createElement(
|
|
510
512
|
it,
|
|
511
513
|
{
|
|
512
514
|
group: this.props.group || [],
|
|
@@ -519,7 +521,7 @@ const _ = class _ extends r.Component {
|
|
|
519
521
|
ariaControls: this._gridId,
|
|
520
522
|
onContextMenu: this.onContextMenu
|
|
521
523
|
}
|
|
522
|
-
), { sort: ye, sortable: we, group: Se, filter:
|
|
524
|
+
), { sort: ye, sortable: we, group: Se, filter: Ie, filterable: ke, filterOperators: Ee = Ce, headerCellRender: xe, columnMenu: _e } = this.props, j = /* @__PURE__ */ r.createElement(
|
|
523
525
|
et,
|
|
524
526
|
{
|
|
525
527
|
size: this.props.size,
|
|
@@ -534,9 +536,9 @@ const _ = class _ extends r.Component {
|
|
|
534
536
|
we,
|
|
535
537
|
Se,
|
|
536
538
|
l,
|
|
539
|
+
Ie,
|
|
537
540
|
ke,
|
|
538
541
|
Ee,
|
|
539
|
-
Ie,
|
|
540
542
|
xe,
|
|
541
543
|
_e,
|
|
542
544
|
this._columns,
|
|
@@ -572,8 +574,8 @@ const _ = class _ extends r.Component {
|
|
|
572
574
|
tableViewPortWidth: De,
|
|
573
575
|
scrollLeft: ze
|
|
574
576
|
}), Le = (s, g, m) => {
|
|
575
|
-
let
|
|
576
|
-
const
|
|
577
|
+
let E = !1;
|
|
578
|
+
const I = this.props.selectedField ? be(this.props.selectedField, s.dataItem) : void 0;
|
|
577
579
|
return {
|
|
578
580
|
row: C.map((u, b) => {
|
|
579
581
|
if (Te[b])
|
|
@@ -582,7 +584,7 @@ const _ = class _ extends r.Component {
|
|
|
582
584
|
let w = !1;
|
|
583
585
|
if (u.editable && this.props.editField) {
|
|
584
586
|
const v = be(this.props.editField, s.dataItem);
|
|
585
|
-
v && (v === !0 || v === u.field) && (
|
|
587
|
+
v && (v === !0 || v === u.field) && (E = !0, w = !0);
|
|
586
588
|
}
|
|
587
589
|
const P = u.cell || w && Ze || bt, L = this.props.expandField && this.props.detail && u.field === this.props.expandField;
|
|
588
590
|
return /* @__PURE__ */ r.createElement(
|
|
@@ -616,16 +618,16 @@ const _ = class _ extends r.Component {
|
|
|
616
618
|
dataIndex: s.dataIndex,
|
|
617
619
|
style: y,
|
|
618
620
|
ariaColumnIndex: u.ariaColumnIndex,
|
|
619
|
-
isSelected: Array.isArray(
|
|
621
|
+
isSelected: Array.isArray(I) && I.indexOf(b) > -1
|
|
620
622
|
}
|
|
621
623
|
);
|
|
622
624
|
}),
|
|
623
|
-
isInEdit:
|
|
624
|
-
isSelected: typeof
|
|
625
|
+
isInEdit: E,
|
|
626
|
+
isSelected: typeof I == "boolean" && I
|
|
625
627
|
};
|
|
626
628
|
};
|
|
627
629
|
let q = 0;
|
|
628
|
-
if (
|
|
630
|
+
if (i)
|
|
629
631
|
for (let s = 0; s < this.vs.topCacheCount + this.vs.attendedSkip - (this.props.skip || 0); s++) {
|
|
630
632
|
const g = this._data.shift();
|
|
631
633
|
if (g)
|
|
@@ -641,18 +643,18 @@ const _ = class _ extends r.Component {
|
|
|
641
643
|
let D = 0;
|
|
642
644
|
if (this._data.length) {
|
|
643
645
|
let s = -1, g = 0;
|
|
644
|
-
(this._slicedData || this._data).forEach((m,
|
|
646
|
+
(this._slicedData || this._data).forEach((m, E) => {
|
|
645
647
|
m.rowType === "data" && (J++, s++);
|
|
646
|
-
const
|
|
648
|
+
const I = J % 2 === 0, u = this.props.dataItemKey && Ve(this.props.dataItemKey)(m.dataItem), b = E + (this.vs.realSkip || 0), H = u || "ai" + b, T = H + "_1", y = Le(m, H, s);
|
|
647
649
|
if (D = b + O + g, A.push(/* @__PURE__ */ r.createElement(
|
|
648
650
|
vt,
|
|
649
651
|
{
|
|
650
652
|
key: H,
|
|
651
653
|
dataItem: m.dataItem,
|
|
652
|
-
isAltRow:
|
|
654
|
+
isAltRow: I,
|
|
653
655
|
isInEdit: y.isInEdit,
|
|
654
656
|
rowType: m.rowType,
|
|
655
|
-
isHidden: X(
|
|
657
|
+
isHidden: X(E),
|
|
656
658
|
onClick: (w) => this.rowClick(w, m),
|
|
657
659
|
onDoubleClick: (w) => this.rowDblClick(w, m),
|
|
658
660
|
selectedField: this.props.selectedField,
|
|
@@ -672,9 +674,9 @@ const _ = class _ extends r.Component {
|
|
|
672
674
|
key: T,
|
|
673
675
|
className: F(
|
|
674
676
|
"k-table-row",
|
|
675
|
-
|
|
677
|
+
I ? "k-detail-row k-table-alt-row k-alt" : "k-detail-row"
|
|
676
678
|
),
|
|
677
|
-
style: { visibility: X(
|
|
679
|
+
style: { visibility: X(E) ? "hidden" : "", height: this.props.detailRowHeight },
|
|
678
680
|
role: "row",
|
|
679
681
|
"aria-rowindex": D
|
|
680
682
|
},
|
|
@@ -699,7 +701,7 @@ const _ = class _ extends r.Component {
|
|
|
699
701
|
);
|
|
700
702
|
}),
|
|
701
703
|
this.props.expandField && /* @__PURE__ */ r.createElement(
|
|
702
|
-
|
|
704
|
+
It,
|
|
703
705
|
{
|
|
704
706
|
id: N.generateNavigatableId(`${T}-dhcell`, p)
|
|
705
707
|
}
|
|
@@ -724,7 +726,7 @@ const _ = class _ extends r.Component {
|
|
|
724
726
|
const Fe = () => {
|
|
725
727
|
const s = this._header;
|
|
726
728
|
return s && s.table.clientWidth;
|
|
727
|
-
}, Q = () => /* @__PURE__ */ r.createElement("div", { key: "no-records", className: "k-grid-norecords", "aria-rowindex": O, style: { width: Fe() } }, /* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template" },
|
|
729
|
+
}, Q = () => /* @__PURE__ */ r.createElement("div", { key: "no-records", className: "k-grid-norecords", "aria-rowindex": O, style: { width: Fe() } }, /* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template" }, k.length ? k : /* @__PURE__ */ r.createElement(Rt, null))), Y = {
|
|
728
730
|
size: this.props.size,
|
|
729
731
|
onPageChange: this.pagerPageChange,
|
|
730
732
|
total: a,
|
|
@@ -833,7 +835,7 @@ const _ = class _ extends r.Component {
|
|
|
833
835
|
se && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(de, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(ce, { ref: this.dragLogic.refDragElementClue }))
|
|
834
836
|
), z, this.props.pageable && Z);
|
|
835
837
|
let M = this.props.style || {};
|
|
836
|
-
return
|
|
838
|
+
return i && (M.height || (M = Object.assign({}, M, { height: "450px" }))), /* @__PURE__ */ r.createElement(U.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
|
|
837
839
|
"div",
|
|
838
840
|
{
|
|
839
841
|
id: this.props.id,
|
|
@@ -843,7 +845,7 @@ const _ = class _ extends r.Component {
|
|
|
843
845
|
{
|
|
844
846
|
"k-grid-md": !this.props.size,
|
|
845
847
|
[`k-grid-${G.sizeMap[this.props.size] || this.props.size}`]: this.props.size,
|
|
846
|
-
"k-grid-virtual":
|
|
848
|
+
"k-grid-virtual": i
|
|
847
849
|
},
|
|
848
850
|
this.props.className
|
|
849
851
|
),
|
|
@@ -912,10 +914,10 @@ const _ = class _ extends r.Component {
|
|
|
912
914
|
)
|
|
913
915
|
)
|
|
914
916
|
), K && Q()),
|
|
915
|
-
|
|
917
|
+
i && /* @__PURE__ */ r.createElement("div", { className: "k-height-container", role: "presentation" }, /* @__PURE__ */ r.createElement(
|
|
916
918
|
"div",
|
|
917
919
|
{
|
|
918
|
-
style:
|
|
920
|
+
style: i ? { height: this.vs.containerHeight + "px" } : {}
|
|
919
921
|
}
|
|
920
922
|
))
|
|
921
923
|
)),
|
|
@@ -929,7 +931,7 @@ const _ = class _ extends r.Component {
|
|
|
929
931
|
}
|
|
930
932
|
selectionChange(a) {
|
|
931
933
|
if (this.props.onSelectionChange) {
|
|
932
|
-
const { event: p, dataItem: c, dataIndex: e, columnIndex: t } = a, { mode:
|
|
934
|
+
const { event: p, dataItem: c, dataIndex: e, columnIndex: t } = a, { mode: i, cell: n } = le(this.props.selectable), h = {
|
|
933
935
|
...this.getArguments(p.syntheticEvent),
|
|
934
936
|
dataItem: c,
|
|
935
937
|
startColIndex: t,
|
|
@@ -941,7 +943,7 @@ const _ = class _ extends r.Component {
|
|
|
941
943
|
ctrlKey: !1,
|
|
942
944
|
shiftKey: !1,
|
|
943
945
|
metaKey: !1,
|
|
944
|
-
mode:
|
|
946
|
+
mode: i,
|
|
945
947
|
cell: n,
|
|
946
948
|
isDrag: !1,
|
|
947
949
|
componentId: this._gridId,
|
|
@@ -951,12 +953,12 @@ const _ = class _ extends r.Component {
|
|
|
951
953
|
}
|
|
952
954
|
}
|
|
953
955
|
raiseDataEvent(a, p, c, e, t) {
|
|
954
|
-
const
|
|
956
|
+
const i = this.props.onDataStateChange;
|
|
955
957
|
if (a) {
|
|
956
958
|
const n = { ...this.getArguments(e), ...p, targetEvent: t };
|
|
957
959
|
a.call(void 0, n);
|
|
958
960
|
} else
|
|
959
|
-
|
|
961
|
+
i && i.call(
|
|
960
962
|
void 0,
|
|
961
963
|
{
|
|
962
964
|
...this.getArguments(e),
|
|
@@ -969,13 +971,13 @@ const _ = class _ extends r.Component {
|
|
|
969
971
|
);
|
|
970
972
|
}
|
|
971
973
|
columnReorder(a, p, c) {
|
|
972
|
-
const e = this._columns[a], t = e.depth,
|
|
974
|
+
const e = this._columns[a], t = e.depth, i = (d) => {
|
|
973
975
|
do
|
|
974
976
|
d++;
|
|
975
977
|
while (d < this._columns.length && this._columns[d].depth > t);
|
|
976
978
|
return d;
|
|
977
|
-
}, n = this._columns.splice(a,
|
|
978
|
-
this._columns.splice(a < p ?
|
|
979
|
+
}, n = this._columns.splice(a, i(a) - a);
|
|
980
|
+
this._columns.splice(a < p ? i(p - n.length) : p, 0, ...n), this._columns.filter((d) => d.declarationIndex >= 0).forEach((d, f) => d.orderIndex = f), this._columnsMutations++;
|
|
979
981
|
const h = this._columns[a].locked && this._columns[p].locked;
|
|
980
982
|
Xe(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), Je(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), this._resized && (this._shouldUpdateLeftRight = !1, this._resized = !1);
|
|
981
983
|
const l = this.columns;
|
|
@@ -1043,81 +1045,81 @@ const _ = class _ extends r.Component {
|
|
|
1043
1045
|
_.displayName = "KendoReactGrid", _.defaultProps = {
|
|
1044
1046
|
// never use this
|
|
1045
1047
|
}, _.propTypes = {
|
|
1046
|
-
data:
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
data:
|
|
1050
|
-
total:
|
|
1048
|
+
data: o.oneOfType([
|
|
1049
|
+
o.array,
|
|
1050
|
+
o.shape({
|
|
1051
|
+
data: o.array,
|
|
1052
|
+
total: o.number
|
|
1051
1053
|
})
|
|
1052
1054
|
]),
|
|
1053
|
-
sortable:
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
mode:
|
|
1057
|
-
allowUnsort:
|
|
1055
|
+
sortable: o.oneOfType([
|
|
1056
|
+
o.bool,
|
|
1057
|
+
o.shape({
|
|
1058
|
+
mode: o.oneOf(["single", "multiple"]),
|
|
1059
|
+
allowUnsort: o.bool
|
|
1058
1060
|
})
|
|
1059
1061
|
]),
|
|
1060
|
-
onSortChange:
|
|
1061
|
-
sort:
|
|
1062
|
-
filterable:
|
|
1063
|
-
filter:
|
|
1064
|
-
onFilterChange:
|
|
1065
|
-
pageable:
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
buttonCount:
|
|
1069
|
-
responsive:
|
|
1070
|
-
info:
|
|
1071
|
-
type:
|
|
1072
|
-
pageSizes:
|
|
1062
|
+
onSortChange: o.func,
|
|
1063
|
+
sort: o.array,
|
|
1064
|
+
filterable: o.bool,
|
|
1065
|
+
filter: o.any,
|
|
1066
|
+
onFilterChange: o.func,
|
|
1067
|
+
pageable: o.oneOfType([
|
|
1068
|
+
o.bool,
|
|
1069
|
+
o.shape({
|
|
1070
|
+
buttonCount: o.number,
|
|
1071
|
+
responsive: o.bool,
|
|
1072
|
+
info: o.bool,
|
|
1073
|
+
type: o.oneOf(["numeric", "input"]),
|
|
1074
|
+
pageSizes: o.oneOfType(
|
|
1073
1075
|
[
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1076
|
+
o.bool,
|
|
1077
|
+
o.arrayOf(o.oneOfType([
|
|
1078
|
+
o.string,
|
|
1079
|
+
o.number
|
|
1078
1080
|
]))
|
|
1079
1081
|
]
|
|
1080
1082
|
),
|
|
1081
|
-
previousNext:
|
|
1083
|
+
previousNext: o.bool
|
|
1082
1084
|
})
|
|
1083
1085
|
]),
|
|
1084
|
-
pageSize:
|
|
1085
|
-
onPageChange:
|
|
1086
|
-
total:
|
|
1087
|
-
skip:
|
|
1088
|
-
take:
|
|
1089
|
-
fixedScroll:
|
|
1090
|
-
onExpandChange:
|
|
1091
|
-
expandField:
|
|
1092
|
-
selectedField:
|
|
1093
|
-
onSelectionChange:
|
|
1094
|
-
onHeaderSelectionChange:
|
|
1095
|
-
resizable:
|
|
1096
|
-
reorderable:
|
|
1097
|
-
group:
|
|
1098
|
-
groupable:
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
enabled:
|
|
1102
|
-
footer:
|
|
1086
|
+
pageSize: o.number,
|
|
1087
|
+
onPageChange: o.func,
|
|
1088
|
+
total: o.number,
|
|
1089
|
+
skip: o.number,
|
|
1090
|
+
take: o.number,
|
|
1091
|
+
fixedScroll: o.bool,
|
|
1092
|
+
onExpandChange: o.func,
|
|
1093
|
+
expandField: o.string,
|
|
1094
|
+
selectedField: o.string,
|
|
1095
|
+
onSelectionChange: o.func,
|
|
1096
|
+
onHeaderSelectionChange: o.func,
|
|
1097
|
+
resizable: o.bool,
|
|
1098
|
+
reorderable: o.bool,
|
|
1099
|
+
group: o.any,
|
|
1100
|
+
groupable: o.oneOfType([
|
|
1101
|
+
o.bool,
|
|
1102
|
+
o.shape({
|
|
1103
|
+
enabled: o.bool,
|
|
1104
|
+
footer: o.oneOf(["always", "visible", "none"])
|
|
1103
1105
|
})
|
|
1104
1106
|
]),
|
|
1105
|
-
onGroupChange:
|
|
1106
|
-
onRowClick:
|
|
1107
|
-
onRowDoubleClick:
|
|
1108
|
-
onItemChange:
|
|
1109
|
-
editField:
|
|
1110
|
-
scrollable:
|
|
1111
|
-
rowHeight:
|
|
1112
|
-
detailRowHeight:
|
|
1113
|
-
detail:
|
|
1114
|
-
style:
|
|
1115
|
-
onDataStateChange:
|
|
1116
|
-
onColumnResize:
|
|
1117
|
-
onColumnReorder:
|
|
1118
|
-
dataItemKey:
|
|
1119
|
-
navigatable:
|
|
1120
|
-
size:
|
|
1107
|
+
onGroupChange: o.func,
|
|
1108
|
+
onRowClick: o.func,
|
|
1109
|
+
onRowDoubleClick: o.func,
|
|
1110
|
+
onItemChange: o.func,
|
|
1111
|
+
editField: o.string,
|
|
1112
|
+
scrollable: o.oneOf(["none", "scrollable", "virtual"]),
|
|
1113
|
+
rowHeight: o.number,
|
|
1114
|
+
detailRowHeight: o.number,
|
|
1115
|
+
detail: o.any,
|
|
1116
|
+
style: o.object,
|
|
1117
|
+
onDataStateChange: o.func,
|
|
1118
|
+
onColumnResize: o.func,
|
|
1119
|
+
onColumnReorder: o.func,
|
|
1120
|
+
dataItemKey: o.string,
|
|
1121
|
+
navigatable: o.bool,
|
|
1122
|
+
size: o.oneOf(["small", "medium"])
|
|
1121
1123
|
}, _.contextType = U;
|
|
1122
1124
|
let B = _;
|
|
1123
1125
|
at(B);
|