@progress/kendo-react-grid 8.1.1 → 8.2.0-develop.10
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 +280 -263
- package/cells/GridEditCell.js +1 -1
- package/cells/GridEditCell.mjs +27 -27
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/footer/Footer.js +1 -1
- package/footer/Footer.mjs +7 -7
- package/header/Header.js +1 -1
- package/header/Header.mjs +1 -1
- package/index.d.mts +12 -2
- package/index.d.ts +12 -2
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
package/Grid.mjs
CHANGED
|
@@ -8,38 +8,38 @@
|
|
|
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 Ge, canUseDOM as
|
|
12
|
-
import { tableKeyboardNavigationTools as
|
|
13
|
-
import { GridSelectionCell as
|
|
14
|
-
import { GridHierarchyCell as
|
|
15
|
-
import { GridEditCell as
|
|
16
|
-
import { Header as
|
|
17
|
-
import { HeaderRow as
|
|
18
|
-
import { FilterRow as
|
|
19
|
-
import { GroupPanel as
|
|
20
|
-
import { Footer as
|
|
21
|
-
import { provideLocalizationService as
|
|
22
|
-
import { pagerMessagesMap as
|
|
23
|
-
import { VirtualScroll as
|
|
11
|
+
import { RowHeightService as re, getScrollbarWidth as Pe, dispatchEvent as Ge, canUseDOM as N, getActiveElement as Ke, memoizeOne as E, validatePackage as We, shouldShowValidationUI as Ve, setScrollbarWidth as ae, getter as Be, classNames as L, kendoThemeMaps as G, WatermarkOverlay as Ue } from "@progress/kendo-react-common";
|
|
12
|
+
import { tableKeyboardNavigationTools as I, tableKeyboardNavigation as x, getSelectionOptions as le, mapColumns as $e, ClipboardService as je, TableKeyboardNavigationContext as V, isRtl as qe, 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
|
+
import { GridSelectionCell as et } from "./cells/GridSelectionCell.mjs";
|
|
14
|
+
import { GridHierarchyCell as tt } from "./cells/GridHierarchyCell.mjs";
|
|
15
|
+
import { GridEditCell as st } from "./cells/GridEditCell.mjs";
|
|
16
|
+
import { Header as it } from "./header/Header.mjs";
|
|
17
|
+
import { HeaderRow as ot } from "./header/HeaderRow.mjs";
|
|
18
|
+
import { FilterRow as rt } from "./header/FilterRow.mjs";
|
|
19
|
+
import { GroupPanel as at } from "./header/GroupPanel.mjs";
|
|
20
|
+
import { Footer as lt } from "./footer/Footer.mjs";
|
|
21
|
+
import { provideLocalizationService as nt, registerForLocalization as ht } from "@progress/kendo-react-intl";
|
|
22
|
+
import { pagerMessagesMap as pt, gridAriaLabel as ue, messages as dt } from "./messages/index.mjs";
|
|
23
|
+
import { VirtualScroll as ct } from "./VirtualScroll.mjs";
|
|
24
24
|
import { VirtualScrollFixed as ge } from "./VirtualScrollFixed.mjs";
|
|
25
|
-
import { ColumnResize as
|
|
26
|
-
import { CommonDragLogic as
|
|
27
|
-
import { firefox as me, firefoxMaxHeight as fe, flatData as
|
|
28
|
-
import { GridCell as
|
|
29
|
-
import { GridGroupCell as
|
|
30
|
-
import { GridRow as
|
|
25
|
+
import { ColumnResize as ut } from "./drag/ColumnResize.mjs";
|
|
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 B, autoGenerateColumns as vt, getNestedValue as be, resolveCells as Ct } from "./utils/index.mjs";
|
|
28
|
+
import { GridCell as Rt } from "./cells/GridCell.mjs";
|
|
29
|
+
import { GridGroupCell as ve } from "./cells/GridGroupCell.mjs";
|
|
30
|
+
import { GridRow as wt } from "./rows/GridRow.mjs";
|
|
31
31
|
import { GridHeaderSelectionCell as yt } from "./header/GridHeaderSelectionCell.mjs";
|
|
32
|
-
import { GridNoRecords as
|
|
32
|
+
import { GridNoRecords as Et } from "./GridNoRecords.mjs";
|
|
33
33
|
import { operators as Ce } from "./filterCommon.mjs";
|
|
34
34
|
import { FooterRow as St } from "./footer/FooterRow.mjs";
|
|
35
35
|
import { normalize as It } from "./paging/GridPagerSettings.mjs";
|
|
36
36
|
import { packageMetadata as Re } from "./package-metadata.mjs";
|
|
37
37
|
import { GridDetailCell as kt } from "./cells/GridDetailCell.mjs";
|
|
38
|
-
import { GridDetailHierarchyCell as
|
|
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(l) {
|
|
42
|
+
super(l), 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 a = s.querySelector(`[absolute-row-index="${t}"]`);
|
|
66
|
+
a ? this.observer.observe(a) : 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), t =
|
|
71
|
+
const e = this.childrenToArray(this.props.children), t = I.getIdPrefix(this.navigationStateRef), s = this.filterHiddenColumns(e);
|
|
72
72
|
return this.getColumnsEssentialProps(this.readColumns(s, t, this._columnsMutations)) === this.getColumnsEssentialProps(this._columns);
|
|
73
73
|
}, this.onContextMenu = (e, t, s) => {
|
|
74
74
|
if (this.props.onContextMenu) {
|
|
75
|
-
const
|
|
75
|
+
const a = {
|
|
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, a);
|
|
83
83
|
}
|
|
84
84
|
}, this.getVirtualScroll = (e) => {
|
|
85
|
-
const { rowHeight: t, detailRowHeight: s, detail:
|
|
86
|
-
return !f ||
|
|
85
|
+
const { rowHeight: t, detailRowHeight: s, detail: a, expandField: h, groupable: n } = e, d = this.isAllData(), f = t !== void 0 && t > 0, R = s !== void 0 && s > 0, k = n === !0 || typeof n == "object" && n.enabled !== !1;
|
|
86
|
+
return !f || k && !d || !!(a && 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,13 +101,13 @@ 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: a, expandField: h } = this.props;
|
|
105
105
|
let { detailRowHeight: n = 0 } = this.props;
|
|
106
|
-
n =
|
|
106
|
+
n = a && 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
|
}
|
|
110
|
-
}, this.scrollHandler = (e) => {
|
|
110
|
+
}, this.getCachedScrollbarWidth = () => (this._scrollbarWidth || (this._scrollbarWidth = Pe() || void 0), this._scrollbarWidth), this.scrollHandler = (e) => {
|
|
111
111
|
if (e.target !== e.currentTarget)
|
|
112
112
|
return;
|
|
113
113
|
clearTimeout(this.forceUpdateTimeout), this.vs.table = this.tableElement;
|
|
@@ -116,12 +116,13 @@ 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 (x.onKeyDown(e, {
|
|
120
|
+
navigatable: this.props.navigatable || !1,
|
|
120
121
|
contextStateRef: this.contextStateRef,
|
|
121
122
|
navigationStateRef: this.navigationStateRef,
|
|
122
123
|
onNavigationAction: this.onNavigationAction
|
|
123
124
|
}), this.props.onKeyDown) {
|
|
124
|
-
const { mode: t, cell: s } = le(this.props.selectable),
|
|
125
|
+
const { mode: t, cell: s } = le(this.props.selectable), a = {
|
|
125
126
|
dataItems: this.getLeafDataItems(),
|
|
126
127
|
mode: t,
|
|
127
128
|
cell: s,
|
|
@@ -129,10 +130,10 @@ const z = class z extends r.Component {
|
|
|
129
130
|
selectedField: this.props.selectedField,
|
|
130
131
|
...this.getArguments(e)
|
|
131
132
|
};
|
|
132
|
-
this.props.onKeyDown.call(void 0,
|
|
133
|
+
this.props.onKeyDown.call(void 0, a);
|
|
133
134
|
}
|
|
134
135
|
}, this.onFocus = (e) => {
|
|
135
|
-
|
|
136
|
+
x.onFocus(e, {
|
|
136
137
|
contextStateRef: this.contextStateRef
|
|
137
138
|
});
|
|
138
139
|
}, this.onNavigationAction = (e) => {
|
|
@@ -205,7 +206,7 @@ const z = class z extends r.Component {
|
|
|
205
206
|
);
|
|
206
207
|
}, this.selectionRelease = (e) => {
|
|
207
208
|
if (this.props.onSelectionChange) {
|
|
208
|
-
const t = this.getSlicedLeafDataItems()[e.startRowIndex], s = this.getSlicedLeafDataItems()[e.endRowIndex],
|
|
209
|
+
const t = this.getSlicedLeafDataItems()[e.startRowIndex], s = this.getSlicedLeafDataItems()[e.endRowIndex], a = {
|
|
209
210
|
syntheticEvent: void 0,
|
|
210
211
|
target: this,
|
|
211
212
|
selectedField: this.props.selectedField || "",
|
|
@@ -216,7 +217,7 @@ const z = class z extends r.Component {
|
|
|
216
217
|
endDataItem: s,
|
|
217
218
|
...e
|
|
218
219
|
};
|
|
219
|
-
this.props.onSelectionChange.call(void 0,
|
|
220
|
+
this.props.onSelectionChange.call(void 0, a);
|
|
220
221
|
}
|
|
221
222
|
}, this.pageChange = (e, t, s) => {
|
|
222
223
|
this.raiseDataEvent(
|
|
@@ -230,8 +231,8 @@ const z = class z extends r.Component {
|
|
|
230
231
|
let e = this.props.total || 0;
|
|
231
232
|
return Array.isArray(this.props.data) ? e = e || this.props.data.length : this.props.data && (e = e || this.props.data.total), e;
|
|
232
233
|
}, this.moveToNextPage = (e) => {
|
|
233
|
-
const t = this.props.take || 0, s = (this.props.skip || 0) + t,
|
|
234
|
-
s <
|
|
234
|
+
const t = this.props.take || 0, s = (this.props.skip || 0) + t, a = this.getTotal();
|
|
235
|
+
s < a && this.pageChange({ skip: s, take: t }, e);
|
|
235
236
|
}, this.moveToPrevPage = (e) => {
|
|
236
237
|
const t = this.props.take || 0, s = (this.props.skip || 0) - t;
|
|
237
238
|
s >= 0 && this.pageChange({ skip: s, take: t }, e);
|
|
@@ -275,63 +276,63 @@ const z = class z extends r.Component {
|
|
|
275
276
|
);
|
|
276
277
|
}
|
|
277
278
|
}, this.inActiveElement = () => {
|
|
278
|
-
var
|
|
279
|
-
if (!
|
|
279
|
+
var h, n, d;
|
|
280
|
+
if (!N)
|
|
280
281
|
return !1;
|
|
281
|
-
const e =
|
|
282
|
-
return !!(t &&
|
|
283
|
-
}, this.onResize = (e, t, s,
|
|
282
|
+
const e = Ke(this.document), t = e ? e.matches(".k-table-td") ? e : (h = this.document) == null ? void 0 : h.body : (n = this.document) == null ? void 0 : n.body, s = t.closest(".k-grid-container"), a = t && ((d = this._element) == null ? void 0 : d.contains(t));
|
|
283
|
+
return !!(t && a && s);
|
|
284
|
+
}, this.onResize = (e, t, s, a, h, n) => {
|
|
284
285
|
this.resetTableWidth(), this._shouldUpdateLeftRight = !0, this._resized = !0, this._columnsMutations++, this.props.onColumnResize && this.props.onColumnResize.call(
|
|
285
286
|
void 0,
|
|
286
287
|
{
|
|
287
288
|
columns: this.columns,
|
|
288
|
-
nativeEvent:
|
|
289
|
+
nativeEvent: a,
|
|
289
290
|
targetColumnId: n,
|
|
290
291
|
index: e,
|
|
291
292
|
newWidth: t,
|
|
292
293
|
oldWidth: s,
|
|
293
|
-
end:
|
|
294
|
+
end: h,
|
|
294
295
|
target: this
|
|
295
296
|
}
|
|
296
297
|
);
|
|
297
|
-
}, this.reInitVirtualization =
|
|
298
|
+
}, this.reInitVirtualization = E((e, t, s, a, h, n) => {
|
|
298
299
|
this.vs.reset();
|
|
299
300
|
const d = this.getVirtualScroll(this.props);
|
|
300
301
|
this.vs = new d(n);
|
|
301
|
-
}), this.flatData =
|
|
302
|
-
const f = [], R =
|
|
302
|
+
}), this.flatData = E((e, t, s, a, h, n, d) => {
|
|
303
|
+
const f = [], R = mt(
|
|
303
304
|
f,
|
|
304
305
|
e,
|
|
305
306
|
t,
|
|
306
307
|
{ index: s },
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
a !== void 0,
|
|
309
|
+
h
|
|
309
310
|
);
|
|
310
311
|
return { flattedData: f, resolvedGroupsCount: R };
|
|
311
|
-
}), this.rowHeightService =
|
|
312
|
+
}), this.rowHeightService = E((e, t, s, a, h) => new re(t, s, a, h)), this.childrenToArray = E((e) => r.Children.toArray(e)), this.readColumns = E(
|
|
312
313
|
(e, t, s) => {
|
|
313
|
-
const
|
|
314
|
-
return
|
|
314
|
+
const a = e.filter((h) => h && h.type && h.type.displayName === "KendoReactGridColumn");
|
|
315
|
+
return ft(a, this.columns, { prevId: 0, idPrefix: t });
|
|
315
316
|
}
|
|
316
|
-
), this.mapColumns =
|
|
317
|
-
(e, t) =>
|
|
317
|
+
), this.mapColumns = E(
|
|
318
|
+
(e, t) => $e(e, !0)
|
|
318
319
|
), this.filterHiddenColumns = (e) => {
|
|
319
320
|
const t = (s) => {
|
|
320
|
-
const
|
|
321
|
+
const a = s;
|
|
321
322
|
return {
|
|
322
|
-
...
|
|
323
|
+
...a,
|
|
323
324
|
props: {
|
|
324
|
-
...
|
|
325
|
-
children:
|
|
325
|
+
...a.props,
|
|
326
|
+
children: a.props.children && a.props.children.length > 0 ? this.filterHiddenColumns(a.props.children) : a.props.children
|
|
326
327
|
}
|
|
327
328
|
};
|
|
328
329
|
};
|
|
329
|
-
return [...e].filter((s) => r.isValidElement(s) && !s.props.hidden).filter((s) =>
|
|
330
|
-
}, this.configureColumns =
|
|
330
|
+
return [...e].filter((s) => r.isValidElement(s) && !s.props.hidden).filter((s) => N && s && r.isValidElement(s) && s.props.media ? window.matchMedia(s.props.media).matches : s).map((s) => t(s));
|
|
331
|
+
}, this.configureColumns = E((e, t, s) => {
|
|
331
332
|
this.props.selectedField && e.filter((n) => n.field === this.props.selectedField).forEach((n) => {
|
|
332
|
-
n.width = n.width || "50px", n.cell = n.cell ||
|
|
333
|
+
n.width = n.width || "50px", n.cell = n.cell || et, n.headerCell = n.headerCell || yt;
|
|
333
334
|
});
|
|
334
|
-
const
|
|
335
|
+
const a = {
|
|
335
336
|
id: "",
|
|
336
337
|
resizable: !0,
|
|
337
338
|
width: "32px",
|
|
@@ -350,64 +351,71 @@ const z = class z extends r.Component {
|
|
|
350
351
|
ariaColumnIndex: 0,
|
|
351
352
|
isAccessible: !0
|
|
352
353
|
};
|
|
353
|
-
let
|
|
354
|
+
let h = 0;
|
|
354
355
|
this.props.expandField && this.props.onExpandChange && this.props.detail && (e.unshift({
|
|
355
|
-
...
|
|
356
|
-
cell:
|
|
356
|
+
...a,
|
|
357
|
+
cell: tt,
|
|
357
358
|
field: this.props.expandField,
|
|
358
359
|
headerClassName: "k-hierarchy-cell k-header"
|
|
359
|
-
}),
|
|
360
|
+
}), h++);
|
|
360
361
|
for (let n = 0; n < t; n++)
|
|
361
362
|
e.unshift({
|
|
362
|
-
...
|
|
363
|
+
...a,
|
|
363
364
|
isAccessible: !1,
|
|
364
|
-
cell:
|
|
365
|
+
cell: ve,
|
|
365
366
|
field: "value",
|
|
366
367
|
locked: this.props.lockGroups
|
|
367
|
-
}),
|
|
368
|
-
e.slice(
|
|
369
|
-
}), this.getHeaderRow =
|
|
370
|
-
|
|
368
|
+
}), h++;
|
|
369
|
+
e.slice(h).forEach((n) => n.parentIndex >= 0 && (n.parentIndex += h));
|
|
370
|
+
}), this.getHeaderRow = E((e, t, s, a, h, n, d, f, R, k, T, C, M) => /* @__PURE__ */ r.createElement(
|
|
371
|
+
ot,
|
|
371
372
|
{
|
|
372
373
|
cells: this.props.cells,
|
|
373
374
|
sort: e,
|
|
374
375
|
sortable: t,
|
|
375
376
|
sortChange: this.sortChange,
|
|
376
377
|
group: s || [],
|
|
377
|
-
groupable:
|
|
378
|
+
groupable: a,
|
|
378
379
|
groupChange: this.groupChange,
|
|
379
|
-
filter:
|
|
380
|
+
filter: h,
|
|
380
381
|
filterable: n,
|
|
381
382
|
filterOperators: d,
|
|
382
383
|
filterChange: this.filterChange,
|
|
383
384
|
columnMenu: R,
|
|
384
|
-
columnMenuIcon:
|
|
385
|
+
columnMenuIcon: k,
|
|
385
386
|
selectionChange: this.onHeaderSelectionChange,
|
|
386
|
-
columns:
|
|
387
|
+
columns: T,
|
|
387
388
|
columnResize: this.columnResize,
|
|
388
389
|
pressHandler: this.dragLogic.pressHandler,
|
|
389
390
|
dragHandler: this.dragLogic.dragHandler,
|
|
390
391
|
releaseHandler: this.dragLogic.releaseHandler,
|
|
391
392
|
columnsMap: C,
|
|
392
393
|
cellRender: f,
|
|
393
|
-
isRtl:
|
|
394
|
+
isRtl: M,
|
|
394
395
|
dragClue: this.dragLogic.dragClueRef,
|
|
395
396
|
headerRef: this.headerElementRef,
|
|
396
397
|
containerRef: this.containerRef,
|
|
397
|
-
navigatable: this.props.navigatable,
|
|
398
|
+
navigatable: !!this.props.navigatable,
|
|
398
399
|
columnGroupChange: this.columnGroupChange
|
|
399
400
|
}
|
|
400
401
|
)), this.resolveTitle = (e) => {
|
|
401
|
-
const t = this._columns.find((
|
|
402
|
+
const t = this._columns.find((a) => a.field === e), s = t && (t.title || t.field);
|
|
402
403
|
return s === void 0 ? e : s;
|
|
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),
|
|
404
|
-
|
|
405
|
-
|
|
404
|
+
}, this.getLeafDataItems = () => this._data.filter((e) => e.rowType === "data").map((e) => e.dataItem), this.getSlicedLeafDataItems = () => (this._slicedData || this._data).filter((e) => e.rowType === "data").map((e) => e.dataItem), this.handleFocusInEditableRows = () => {
|
|
405
|
+
var e, t, s;
|
|
406
|
+
if (this.tableBodyRef.current && ((e = this.tableBodyRef.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
|
|
407
|
+
this._singleEditRow = !1, (t = document.activeElement) != null && t.closest(".k-grid-edit-row") ? this._lastActiveElement = document.activeElement : this._lastActiveElement = void 0;
|
|
408
|
+
const a = Array.from((s = this.tableBodyRef.current) == null ? void 0 : s.getElementsByClassName("k-grid-edit-row"));
|
|
409
|
+
a.length > this.rowsInEdit.length ? this._newEditableRow = a.filter((h) => !this.rowsInEdit.includes(h))[0] : a.length === 1 && (this._newEditableRow = a[0], this._singleEditRow = !0), this.rowsInEdit = a;
|
|
410
|
+
}
|
|
411
|
+
}, We(Re), this.showLicenseWatermark = Ve(Re);
|
|
412
|
+
const p = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(l);
|
|
413
|
+
this.vs = new c(p || l.rowHeight === void 0 || l.rowHeight === 0), this.dragLogic = new gt(
|
|
406
414
|
this.columnReorder.bind(this),
|
|
407
415
|
this.groupReorder.bind(this),
|
|
408
416
|
this.columnToGroup.bind(this)
|
|
409
|
-
), this.columnGroupChange = this.columnGroupChange.bind(this), this.columnResize = new
|
|
410
|
-
navigatable: !!
|
|
417
|
+
), this.columnGroupChange = this.columnGroupChange.bind(this), this.columnResize = new ut(this.onResize), this.props.clipboard && (this.clipboardService = new je(this.onClipboard)), x.onConstructor({
|
|
418
|
+
navigatable: !!l.navigatable,
|
|
411
419
|
contextStateRef: this.contextStateRef,
|
|
412
420
|
navigationStateRef: this.navigationStateRef,
|
|
413
421
|
idPrefix: this._gridId
|
|
@@ -454,8 +462,8 @@ const z = class z extends r.Component {
|
|
|
454
462
|
*/
|
|
455
463
|
// tslint:enable:max-line-length
|
|
456
464
|
get columns() {
|
|
457
|
-
const
|
|
458
|
-
return
|
|
465
|
+
const l = this._columns.filter((p) => p.declarationIndex >= 0 && p.parentIndex === -1);
|
|
466
|
+
return bt(l);
|
|
459
467
|
}
|
|
460
468
|
/**
|
|
461
469
|
* Returns the HTML element of the Grid component.
|
|
@@ -464,7 +472,7 @@ const z = class z extends r.Component {
|
|
|
464
472
|
return this._element;
|
|
465
473
|
}
|
|
466
474
|
get document() {
|
|
467
|
-
if (
|
|
475
|
+
if (N)
|
|
468
476
|
return this.element && this.element.ownerDocument || document;
|
|
469
477
|
}
|
|
470
478
|
get _header() {
|
|
@@ -478,24 +486,24 @@ const z = class z extends r.Component {
|
|
|
478
486
|
*/
|
|
479
487
|
componentDidMount() {
|
|
480
488
|
var c;
|
|
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();
|
|
482
|
-
const
|
|
483
|
-
this.isRtl =
|
|
489
|
+
this.props.columnVirtualization && !navigator.userAgent.match(xt) && (this.headTable && (this.headTable.style.display = "block"), this.tableElement && (this.tableElement.style.display = "block")), this.resetTableWidth(), ae(this.getCachedScrollbarWidth());
|
|
490
|
+
const l = qe(this.element);
|
|
491
|
+
this.isRtl = l, x.onComponentDidMount({
|
|
484
492
|
scope: this.element || void 0,
|
|
485
493
|
contextStateRef: this.contextStateRef,
|
|
486
494
|
navigationStateRef: this.navigationStateRef
|
|
487
495
|
}), this.isRtl && this.forceUpdate();
|
|
488
|
-
const
|
|
496
|
+
const p = {
|
|
489
497
|
rootMargin: "0px",
|
|
490
498
|
threshold: 0.9
|
|
491
499
|
};
|
|
492
|
-
this.clipboardService && this.clipboardService.addEventListeners(this.document), this.observer =
|
|
500
|
+
this.clipboardService && this.clipboardService.addEventListeners(this.document), this.observer = N && window.IntersectionObserver && new window.IntersectionObserver(this.handleIntersection, p) || null, this.resizeObserver = N && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), (c = this.document) != null && c.body && this.resizeObserver && this.resizeObserver.observe(this.document.body);
|
|
493
501
|
}
|
|
494
502
|
/**
|
|
495
503
|
* @hidden
|
|
496
504
|
*/
|
|
497
505
|
getSnapshotBeforeUpdate() {
|
|
498
|
-
return
|
|
506
|
+
return x.onGetSnapshotBeforeUpdate({
|
|
499
507
|
document: this.document,
|
|
500
508
|
contextStateRef: this.contextStateRef,
|
|
501
509
|
navigationStateRef: this.navigationStateRef
|
|
@@ -505,30 +513,33 @@ const z = class z extends r.Component {
|
|
|
505
513
|
* @hidden
|
|
506
514
|
*/
|
|
507
515
|
componentDidUpdate() {
|
|
508
|
-
this.resetTableWidth(), ae(), this.vs.tableTransform && this.vs.table && (this.vs.table.style.transform = this.vs.tableTransform, this.vs.tableTransform = ""),
|
|
516
|
+
this.resetTableWidth(), ae(this.getCachedScrollbarWidth()), this.vs.tableTransform && this.vs.table && (this.vs.table.style.transform = this.vs.tableTransform, this.vs.tableTransform = ""), this.handleFocusInEditableRows(), x.onComponentDidUpdate({
|
|
509
517
|
scope: this.element || void 0,
|
|
510
518
|
contextStateRef: this.contextStateRef,
|
|
511
519
|
navigationStateRef: this.navigationStateRef,
|
|
512
|
-
focusFirst: this._focusFirst
|
|
513
|
-
|
|
520
|
+
focusFirst: this._focusFirst,
|
|
521
|
+
newEditableRow: this._newEditableRow,
|
|
522
|
+
singleEditRow: this._singleEditRow,
|
|
523
|
+
lastActiveElement: this._lastActiveElement
|
|
524
|
+
}), this._focusFirst = !1, this._newEditableRow = void 0;
|
|
514
525
|
}
|
|
515
526
|
/**
|
|
516
527
|
* @hidden
|
|
517
528
|
*/
|
|
518
529
|
componentWillUnmount() {
|
|
519
|
-
var
|
|
520
|
-
clearTimeout(this.forceUpdateTimeout), this.clipboardService && this.clipboardService.removeEventListeners(this.document), (
|
|
530
|
+
var l;
|
|
531
|
+
clearTimeout(this.forceUpdateTimeout), this.clipboardService && this.clipboardService.removeEventListeners(this.document), (l = this.document) != null && l.body && this.resizeObserver && this.resizeObserver.disconnect();
|
|
521
532
|
}
|
|
522
533
|
/**
|
|
523
534
|
* @hidden
|
|
524
535
|
*/
|
|
525
536
|
render() {
|
|
526
537
|
var ie;
|
|
527
|
-
let
|
|
528
|
-
const
|
|
538
|
+
let l = this.props.total || 0;
|
|
539
|
+
const p = I.getIdPrefix(this.navigationStateRef), c = nt(this);
|
|
529
540
|
let e = [];
|
|
530
|
-
Array.isArray(this.props.data) ? (e = this.props.data,
|
|
531
|
-
const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", s = this.props.scrollable === "virtual", { resolvedGroupsCount:
|
|
541
|
+
Array.isArray(this.props.data) ? (e = this.props.data, l = l || this.props.data.length) : this.props.data && (e = this.props.data.data, l = l || this.props.data.total);
|
|
542
|
+
const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", s = this.props.scrollable === "virtual", { resolvedGroupsCount: a, flattedData: h } = this.flatData(
|
|
532
543
|
e,
|
|
533
544
|
t,
|
|
534
545
|
this.props.skip || 0,
|
|
@@ -537,15 +548,15 @@ const z = class z extends r.Component {
|
|
|
537
548
|
this.props.filter,
|
|
538
549
|
this.props.sort
|
|
539
550
|
);
|
|
540
|
-
this._data =
|
|
551
|
+
this._data = h;
|
|
541
552
|
const n = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1;
|
|
542
553
|
this.columnResize.resizable = this.props.resizable || !1, this.dragLogic.reorderable = this.props.reorderable || !1, this.dragLogic.groupable = n;
|
|
543
554
|
const d = this.props.selectable && this.props.selectable.drag ? "none" : void 0;
|
|
544
|
-
this.initializeVirtualization(
|
|
555
|
+
this.initializeVirtualization(l, n);
|
|
545
556
|
const f = this.childrenToArray(this.props.children);
|
|
546
|
-
this.initColumns(f,
|
|
547
|
-
const R = f.map((i) => i && i.type && i.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(i, { ...i.props, ariaControls: this._gridId }) : null),
|
|
548
|
-
|
|
557
|
+
this.initColumns(f, a);
|
|
558
|
+
const R = f.map((i) => i && i.type && i.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(i, { ...i.props, ariaControls: this._gridId }) : null), k = f.filter((i) => i && i.type && i.type.displayName === "KendoReactGridNoRecords"), T = f.filter((i) => i && i.type && i.type.displayName === "KendoReactGridStatusBar"), C = this._columns.filter((i) => i.children.length === 0), M = n && /* @__PURE__ */ r.createElement(
|
|
559
|
+
at,
|
|
549
560
|
{
|
|
550
561
|
group: this.props.group || [],
|
|
551
562
|
groupChange: this.groupChange,
|
|
@@ -557,33 +568,34 @@ const z = class z extends r.Component {
|
|
|
557
568
|
ariaControls: this._gridId,
|
|
558
569
|
onContextMenu: this.onContextMenu
|
|
559
570
|
}
|
|
560
|
-
), { sort:
|
|
561
|
-
|
|
571
|
+
), { sort: we, sortable: ye, group: Ee, filter: Se, filterable: Ie, filterOperators: ke = Ce, headerCellRender: _e, columnMenu: xe, columnMenuIcon: ze } = this.props, $ = /* @__PURE__ */ r.createElement(
|
|
572
|
+
it,
|
|
562
573
|
{
|
|
563
574
|
size: this.props.size,
|
|
564
575
|
columnResize: this.columnResize,
|
|
565
576
|
staticHeaders: this.props.scrollable !== "none",
|
|
566
577
|
scrollableDataElement: () => this.vs.container,
|
|
578
|
+
hasScrollbarWidth: !!this.getCachedScrollbarWidth(),
|
|
567
579
|
draggable: this.props.reorderable || n,
|
|
568
580
|
ref: this.headerRef,
|
|
569
581
|
elemRef: this.headerElementRef,
|
|
570
582
|
headerRow: this.getHeaderRow(
|
|
571
|
-
ye,
|
|
572
583
|
we,
|
|
573
|
-
|
|
584
|
+
ye,
|
|
585
|
+
Ee,
|
|
574
586
|
n,
|
|
587
|
+
Se,
|
|
575
588
|
Ie,
|
|
576
589
|
ke,
|
|
577
|
-
Ee,
|
|
578
|
-
xe,
|
|
579
590
|
_e,
|
|
591
|
+
xe,
|
|
580
592
|
ze,
|
|
581
593
|
this._columns,
|
|
582
594
|
this._columnsMap,
|
|
583
595
|
this.isRtl
|
|
584
596
|
),
|
|
585
597
|
filterRow: this.props.filterable && /* @__PURE__ */ r.createElement(
|
|
586
|
-
|
|
598
|
+
rt,
|
|
587
599
|
{
|
|
588
600
|
cells: this.props.cells,
|
|
589
601
|
size: this.props.size,
|
|
@@ -601,135 +613,135 @@ const z = class z extends r.Component {
|
|
|
601
613
|
"col",
|
|
602
614
|
{
|
|
603
615
|
key: g.toString(),
|
|
604
|
-
width:
|
|
616
|
+
width: B(i)
|
|
605
617
|
}
|
|
606
618
|
))
|
|
607
619
|
}
|
|
608
|
-
),
|
|
620
|
+
), Te = this.vs && this.vs.container && this.vs.container.scrollLeft || 0, De = parseFloat(((this.props.style || {}).width || "").toString()), { colSpans: He, hiddenColumns: Ae } = Je({
|
|
609
621
|
enabled: this.props.columnVirtualization,
|
|
610
622
|
columns: C,
|
|
611
|
-
tableViewPortWidth:
|
|
612
|
-
scrollLeft:
|
|
613
|
-
}),
|
|
614
|
-
let
|
|
615
|
-
const
|
|
623
|
+
tableViewPortWidth: De,
|
|
624
|
+
scrollLeft: Te
|
|
625
|
+
}), Fe = (i, g, m) => {
|
|
626
|
+
let _ = !1;
|
|
627
|
+
const S = this.props.selectedField ? be(this.props.selectedField, i.dataItem) : void 0;
|
|
616
628
|
return {
|
|
617
|
-
row: C.map((u,
|
|
618
|
-
if (
|
|
629
|
+
row: C.map((u, b) => {
|
|
630
|
+
if (Ae[b])
|
|
619
631
|
return null;
|
|
620
|
-
const H = u.id ? u.id :
|
|
621
|
-
let
|
|
632
|
+
const H = u.id ? u.id : b, A = `${u.className ? u.className + " " : ""}${u.locked ? "k-grid-content-sticky" : ""}`, w = u.left !== void 0 ? this.isRtl ? { left: u.right, right: u.left } : { left: u.left, right: u.right } : {};
|
|
633
|
+
let y = !1;
|
|
622
634
|
if (u.editable && this.props.editField) {
|
|
623
|
-
const
|
|
624
|
-
|
|
635
|
+
const v = be(this.props.editField, i.dataItem);
|
|
636
|
+
v && (v === !0 || v === u.field) && (_ = !0, y = !0);
|
|
625
637
|
}
|
|
626
|
-
const
|
|
638
|
+
const W = u.cell || y && st || Rt, F = this.props.expandField && this.props.detail && u.field === this.props.expandField;
|
|
627
639
|
return /* @__PURE__ */ r.createElement(
|
|
628
|
-
|
|
640
|
+
W,
|
|
629
641
|
{
|
|
630
642
|
onContextMenu: this.onContextMenu,
|
|
631
643
|
key: H,
|
|
632
644
|
locked: this.props.lockGroups,
|
|
633
|
-
id:
|
|
634
|
-
`${g}-${String(
|
|
635
|
-
|
|
636
|
-
|
|
645
|
+
id: I.generateNavigatableId(
|
|
646
|
+
`${g}-${String(b)}`,
|
|
647
|
+
p,
|
|
648
|
+
F || i.rowType === "groupHeader" || i.rowType === "groupFooter" || u.field === "value" ? "nodata" : "cell"
|
|
637
649
|
),
|
|
638
|
-
colSpan: He[
|
|
650
|
+
colSpan: He[b],
|
|
639
651
|
dataItem: i.dataItem,
|
|
640
652
|
field: u.field,
|
|
641
653
|
editor: u.editor,
|
|
642
654
|
format: u.format,
|
|
643
|
-
className:
|
|
655
|
+
className: A,
|
|
644
656
|
render: this.props.cellRender,
|
|
645
|
-
cells:
|
|
657
|
+
cells: Ct(this.props.cells, u.cells),
|
|
646
658
|
onChange: this.itemChange,
|
|
647
|
-
selectionChange: this.props.onSelectionChange ? (
|
|
648
|
-
this.selectionChange({ event:
|
|
659
|
+
selectionChange: this.props.onSelectionChange ? (v) => {
|
|
660
|
+
this.selectionChange({ event: v, dataItem: i.dataItem, dataIndex: m, columnIndex: b });
|
|
649
661
|
} : void 0,
|
|
650
|
-
columnIndex:
|
|
662
|
+
columnIndex: b,
|
|
651
663
|
columnsCount: C.length,
|
|
652
664
|
rowType: i.rowType,
|
|
653
665
|
level: i.level,
|
|
654
666
|
expanded: i.expanded,
|
|
655
667
|
dataIndex: i.dataIndex,
|
|
656
|
-
style:
|
|
668
|
+
style: w,
|
|
657
669
|
ariaColumnIndex: u.ariaColumnIndex,
|
|
658
|
-
isSelected: Array.isArray(
|
|
670
|
+
isSelected: Array.isArray(S) && S.indexOf(b) > -1
|
|
659
671
|
}
|
|
660
672
|
);
|
|
661
673
|
}),
|
|
662
|
-
isInEdit:
|
|
663
|
-
isSelected: typeof
|
|
674
|
+
isInEdit: _,
|
|
675
|
+
isSelected: typeof S == "boolean" && S
|
|
664
676
|
};
|
|
665
677
|
};
|
|
666
|
-
let
|
|
678
|
+
let j = 0;
|
|
667
679
|
if (s)
|
|
668
680
|
for (let i = 0; i < this.vs.topCacheCount + this.vs.attendedSkip - (this.props.skip || 0); i++) {
|
|
669
681
|
const g = this._data.shift();
|
|
670
682
|
if (g)
|
|
671
|
-
this._data.push(g),
|
|
683
|
+
this._data.push(g), j++, g.rowType === "groupHeader" && i--;
|
|
672
684
|
else
|
|
673
685
|
break;
|
|
674
686
|
}
|
|
675
|
-
const
|
|
676
|
-
let
|
|
677
|
-
const
|
|
687
|
+
const q = (i) => i >= this._data.length - j;
|
|
688
|
+
let J = this.vs.realSkip || 0;
|
|
689
|
+
const O = [];
|
|
678
690
|
let K = !1;
|
|
679
|
-
const
|
|
680
|
-
let
|
|
691
|
+
const X = this._columnsMap.length + (this.props.filterable ? 1 : 0) + 1;
|
|
692
|
+
let D = 0;
|
|
681
693
|
if (this._data.length) {
|
|
682
694
|
let i = -1, g = 0;
|
|
683
|
-
(this._slicedData || this._data).forEach((m,
|
|
684
|
-
m.rowType === "data" && (
|
|
685
|
-
const
|
|
686
|
-
if (
|
|
687
|
-
|
|
695
|
+
(this._slicedData || this._data).forEach((m, _) => {
|
|
696
|
+
m.rowType === "data" && (J++, i++);
|
|
697
|
+
const S = J % 2 === 0, u = this.props.dataItemKey && Be(this.props.dataItemKey)(m.dataItem), b = _ + (this.vs.realSkip || 0), H = u || "ai" + b, A = H + "_1", w = Fe(m, H, i);
|
|
698
|
+
if (D = b + X + g, O.push(/* @__PURE__ */ r.createElement(
|
|
699
|
+
wt,
|
|
688
700
|
{
|
|
689
701
|
key: H,
|
|
690
702
|
dataItem: m.dataItem,
|
|
691
|
-
isAltRow:
|
|
692
|
-
isInEdit:
|
|
703
|
+
isAltRow: S,
|
|
704
|
+
isInEdit: w.isInEdit,
|
|
693
705
|
rowType: m.rowType,
|
|
694
|
-
isHidden:
|
|
695
|
-
onClick: (
|
|
696
|
-
onDoubleClick: (
|
|
706
|
+
isHidden: q(_),
|
|
707
|
+
onClick: (y) => this.rowClick(y, m),
|
|
708
|
+
onDoubleClick: (y) => this.rowDblClick(y, m),
|
|
697
709
|
selectedField: this.props.selectedField,
|
|
698
710
|
rowHeight: this.props.rowHeight,
|
|
699
711
|
render: this.props.rowRender,
|
|
700
|
-
ariaRowIndex:
|
|
701
|
-
absoluteRowIndex:
|
|
702
|
-
dataIndex: this.vs.scrollableVirtual && !this.props.groupable ?
|
|
703
|
-
isSelected:
|
|
712
|
+
ariaRowIndex: D,
|
|
713
|
+
absoluteRowIndex: b,
|
|
714
|
+
dataIndex: this.vs.scrollableVirtual && !this.props.groupable ? b : i,
|
|
715
|
+
isSelected: w.isSelected
|
|
704
716
|
},
|
|
705
|
-
|
|
717
|
+
w.row
|
|
706
718
|
)), this.props.detail && m.rowType === "data" && m.expanded) {
|
|
707
|
-
const
|
|
708
|
-
g++,
|
|
719
|
+
const y = C.length - (this.props.expandField ? 1 : 0) - (this.props.group ? this.props.group.length : 0) || 1;
|
|
720
|
+
g++, D = b + X + g, O.push(/* @__PURE__ */ r.createElement(
|
|
709
721
|
"tr",
|
|
710
722
|
{
|
|
711
|
-
key:
|
|
712
|
-
className:
|
|
723
|
+
key: A,
|
|
724
|
+
className: L(
|
|
713
725
|
"k-table-row",
|
|
714
|
-
|
|
726
|
+
S ? "k-detail-row k-table-alt-row k-alt" : "k-detail-row"
|
|
715
727
|
),
|
|
716
|
-
style: { visibility:
|
|
728
|
+
style: { visibility: q(_) ? "hidden" : "", height: this.props.detailRowHeight },
|
|
717
729
|
role: "row",
|
|
718
|
-
"aria-rowindex":
|
|
730
|
+
"aria-rowindex": D
|
|
719
731
|
},
|
|
720
|
-
this.props.group && this.props.group.map((
|
|
732
|
+
this.props.group && this.props.group.map((W, F) => {
|
|
721
733
|
var oe;
|
|
722
|
-
const
|
|
734
|
+
const v = (oe = w == null ? void 0 : w.row[F]) == null ? void 0 : oe.props.style, Oe = v ? this.isRtl ? { left: v.right, right: v.left } : { left: v.left, right: v.right } : {};
|
|
723
735
|
return /* @__PURE__ */ r.createElement(
|
|
724
|
-
|
|
736
|
+
ve,
|
|
725
737
|
{
|
|
726
738
|
id: "",
|
|
727
739
|
dataIndex: m.dataIndex,
|
|
728
|
-
field:
|
|
740
|
+
field: W.field,
|
|
729
741
|
dataItem: m.dataItem,
|
|
730
|
-
key:
|
|
731
|
-
style:
|
|
732
|
-
ariaColumnIndex: 1 +
|
|
742
|
+
key: F,
|
|
743
|
+
style: Oe,
|
|
744
|
+
ariaColumnIndex: 1 + F,
|
|
733
745
|
isSelected: !1,
|
|
734
746
|
locked: this.props.lockGroups,
|
|
735
747
|
isRtl: this.isRtl,
|
|
@@ -738,9 +750,9 @@ const z = class z extends r.Component {
|
|
|
738
750
|
);
|
|
739
751
|
}),
|
|
740
752
|
this.props.expandField && /* @__PURE__ */ r.createElement(
|
|
741
|
-
|
|
753
|
+
_t,
|
|
742
754
|
{
|
|
743
|
-
id:
|
|
755
|
+
id: I.generateNavigatableId(`${A}-dhcell`, p)
|
|
744
756
|
}
|
|
745
757
|
),
|
|
746
758
|
/* @__PURE__ */ r.createElement(
|
|
@@ -749,10 +761,10 @@ const z = class z extends r.Component {
|
|
|
749
761
|
onContextMenu: this.onContextMenu,
|
|
750
762
|
dataItem: m.dataItem,
|
|
751
763
|
dataIndex: m.dataIndex,
|
|
752
|
-
colSpan:
|
|
764
|
+
colSpan: y,
|
|
753
765
|
ariaColIndex: 2 + (this.props.group ? this.props.group.length : 0),
|
|
754
766
|
detail: this.props.detail,
|
|
755
|
-
id:
|
|
767
|
+
id: I.generateNavigatableId(`${A}-dcell`, p)
|
|
756
768
|
}
|
|
757
769
|
)
|
|
758
770
|
));
|
|
@@ -760,7 +772,7 @@ const z = class z extends r.Component {
|
|
|
760
772
|
});
|
|
761
773
|
} else
|
|
762
774
|
K = !0;
|
|
763
|
-
const
|
|
775
|
+
const Ne = () => {
|
|
764
776
|
const i = this._header;
|
|
765
777
|
return i && i.table && i.table.clientWidth;
|
|
766
778
|
}, Y = () => /* @__PURE__ */ r.createElement(
|
|
@@ -768,25 +780,24 @@ const z = class z extends r.Component {
|
|
|
768
780
|
{
|
|
769
781
|
key: "no-records",
|
|
770
782
|
className: "k-grid-norecords",
|
|
771
|
-
|
|
772
|
-
style: { width: Le() }
|
|
783
|
+
style: { width: Ne() }
|
|
773
784
|
},
|
|
774
|
-
/* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template", [
|
|
785
|
+
/* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template", [Ze]: I.generateNavigatableId("no-records", p) }, k.length ? k : /* @__PURE__ */ r.createElement(Et, null))
|
|
775
786
|
), Q = {
|
|
776
787
|
size: this.props.size,
|
|
777
788
|
onPageChange: this.pagerPageChange,
|
|
778
|
-
total:
|
|
789
|
+
total: l,
|
|
779
790
|
dir: this.isRtl ? "rtl" : void 0,
|
|
780
791
|
skip: this.vs.propsSkip || 0,
|
|
781
792
|
take: (this.props.take !== void 0 ? this.props.take : this.props.pageSize) || 10,
|
|
782
|
-
messagesMap:
|
|
793
|
+
messagesMap: pt,
|
|
783
794
|
navigatable: this.props.navigatable,
|
|
784
795
|
...It(this.props.pageable || {})
|
|
785
|
-
}, Z = this.props.pager ? /* @__PURE__ */ r.createElement(this.props.pager, { ...Q }) : /* @__PURE__ */ r.createElement(
|
|
796
|
+
}, 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(
|
|
786
797
|
"col",
|
|
787
798
|
{
|
|
788
799
|
key: g.toString(),
|
|
789
|
-
width:
|
|
800
|
+
width: B(i)
|
|
790
801
|
}
|
|
791
802
|
), ee = (ie = this.props.cells) != null && ie.footerCell || this._columns.some(
|
|
792
803
|
(i) => {
|
|
@@ -794,23 +805,24 @@ const z = class z extends r.Component {
|
|
|
794
805
|
return !!(i.footerCell || (g = i.cells) != null && g.footerCell);
|
|
795
806
|
}
|
|
796
807
|
) ? /* @__PURE__ */ r.createElement(
|
|
797
|
-
|
|
808
|
+
lt,
|
|
798
809
|
{
|
|
799
810
|
size: this.props.size,
|
|
800
811
|
columnResize: this.columnResize,
|
|
801
812
|
staticHeaders: this.props.scrollable !== "none",
|
|
813
|
+
hasScrollbarWidth: !!this.getCachedScrollbarWidth(),
|
|
802
814
|
ref: (i) => this._footer = i,
|
|
803
815
|
row: /* @__PURE__ */ r.createElement(
|
|
804
816
|
St,
|
|
805
817
|
{
|
|
806
818
|
cells: this.props.cells,
|
|
807
|
-
idPrefix:
|
|
819
|
+
idPrefix: p,
|
|
808
820
|
columns: this._columns,
|
|
809
821
|
isRtl: this.isRtl,
|
|
810
|
-
ariaRowIndex:
|
|
822
|
+
ariaRowIndex: D + 1
|
|
811
823
|
}
|
|
812
824
|
),
|
|
813
|
-
cols: C.map(
|
|
825
|
+
cols: C.map(Me)
|
|
814
826
|
}
|
|
815
827
|
) : null, te = /* @__PURE__ */ r.createElement(
|
|
816
828
|
"colgroup",
|
|
@@ -824,23 +836,23 @@ const z = class z extends r.Component {
|
|
|
824
836
|
"col",
|
|
825
837
|
{
|
|
826
838
|
key: g.toString(),
|
|
827
|
-
className:
|
|
828
|
-
width:
|
|
839
|
+
className: Le(i.field) ? "k-sorted" : void 0,
|
|
840
|
+
width: B(i)
|
|
829
841
|
}
|
|
830
842
|
)
|
|
831
843
|
)
|
|
832
844
|
), se = this.dragLogic.reorderable || this.dragLogic.groupable;
|
|
833
845
|
if (this.props.scrollable === "none")
|
|
834
|
-
return /* @__PURE__ */ r.createElement(
|
|
846
|
+
return /* @__PURE__ */ r.createElement(V.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
|
|
835
847
|
"div",
|
|
836
848
|
{
|
|
837
849
|
id: this.props.id,
|
|
838
850
|
style: this.props.style,
|
|
839
|
-
className:
|
|
851
|
+
className: L(
|
|
840
852
|
"k-grid",
|
|
841
853
|
{
|
|
842
854
|
"k-grid-md": !this.props.size,
|
|
843
|
-
[`k-grid-${
|
|
855
|
+
[`k-grid-${G.sizeMap[this.props.size] || this.props.size}`]: this.props.size
|
|
844
856
|
},
|
|
845
857
|
this.props.className
|
|
846
858
|
),
|
|
@@ -853,7 +865,7 @@ const z = class z extends r.Component {
|
|
|
853
865
|
...ne
|
|
854
866
|
},
|
|
855
867
|
R,
|
|
856
|
-
|
|
868
|
+
M,
|
|
857
869
|
/* @__PURE__ */ r.createElement(
|
|
858
870
|
he,
|
|
859
871
|
{
|
|
@@ -867,32 +879,32 @@ const z = class z extends r.Component {
|
|
|
867
879
|
"table",
|
|
868
880
|
{
|
|
869
881
|
ref: (i) => this.headTable = i,
|
|
870
|
-
className:
|
|
882
|
+
className: L(
|
|
871
883
|
"k-table k-grid-table",
|
|
872
|
-
{ [`k-table-${
|
|
884
|
+
{ [`k-table-${G.sizeMap[this.props.size] || this.props.size}`]: this.props.size }
|
|
873
885
|
),
|
|
874
886
|
style: { userSelect: d }
|
|
875
887
|
},
|
|
876
888
|
te,
|
|
877
|
-
|
|
878
|
-
/* @__PURE__ */ r.createElement("tbody", { role: "rowgroup", className: "k-table-tbody", ...pe },
|
|
889
|
+
$,
|
|
890
|
+
/* @__PURE__ */ r.createElement("tbody", { role: "rowgroup", className: "k-table-tbody", ...pe }, O),
|
|
879
891
|
ee
|
|
880
892
|
)
|
|
881
893
|
),
|
|
882
894
|
K && Y(),
|
|
883
895
|
se && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(de, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(ce, { ref: this.dragLogic.refDragElementClue }))
|
|
884
|
-
),
|
|
885
|
-
let
|
|
886
|
-
return s && (
|
|
896
|
+
), T, this.props.pageable && Z);
|
|
897
|
+
let P = this.props.style || {};
|
|
898
|
+
return s && (P.height || (P = Object.assign({}, P, { height: "450px" }))), /* @__PURE__ */ r.createElement(V.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
|
|
887
899
|
"div",
|
|
888
900
|
{
|
|
889
901
|
id: this.props.id,
|
|
890
|
-
style:
|
|
891
|
-
className:
|
|
902
|
+
style: P,
|
|
903
|
+
className: L(
|
|
892
904
|
"k-grid",
|
|
893
905
|
{
|
|
894
906
|
"k-grid-md": !this.props.size,
|
|
895
|
-
[`k-grid-${
|
|
907
|
+
[`k-grid-${G.sizeMap[this.props.size] || this.props.size}`]: this.props.size,
|
|
896
908
|
"k-grid-virtual": s
|
|
897
909
|
},
|
|
898
910
|
this.props.className
|
|
@@ -906,18 +918,18 @@ const z = class z extends r.Component {
|
|
|
906
918
|
...ne
|
|
907
919
|
},
|
|
908
920
|
R,
|
|
909
|
-
|
|
921
|
+
M,
|
|
910
922
|
/* @__PURE__ */ r.createElement(
|
|
911
923
|
"div",
|
|
912
924
|
{
|
|
913
925
|
className: "k-grid-aria-root",
|
|
914
926
|
role: "grid",
|
|
915
927
|
"aria-colcount": C.length,
|
|
916
|
-
"aria-rowcount":
|
|
928
|
+
"aria-rowcount": l,
|
|
917
929
|
id: this._gridId,
|
|
918
|
-
"aria-label": c.toLanguageString(ue,
|
|
930
|
+
"aria-label": c.toLanguageString(ue, dt[ue])
|
|
919
931
|
},
|
|
920
|
-
|
|
932
|
+
$,
|
|
921
933
|
/* @__PURE__ */ r.createElement("div", { className: "k-grid-container", role: "presentation" }, /* @__PURE__ */ r.createElement(
|
|
922
934
|
"div",
|
|
923
935
|
{
|
|
@@ -939,11 +951,11 @@ const z = class z extends r.Component {
|
|
|
939
951
|
"table",
|
|
940
952
|
{
|
|
941
953
|
ref: (i) => this.tableElement = i,
|
|
942
|
-
className:
|
|
954
|
+
className: L(
|
|
943
955
|
"k-table k-grid-table",
|
|
944
956
|
{
|
|
945
957
|
"k-table-md": !this.props.size,
|
|
946
|
-
[`k-table-${
|
|
958
|
+
[`k-table-${G.sizeMap[this.props.size] || this.props.size}`]: this.props.size
|
|
947
959
|
}
|
|
948
960
|
),
|
|
949
961
|
role: "presentation",
|
|
@@ -958,7 +970,7 @@ const z = class z extends r.Component {
|
|
|
958
970
|
role: "rowgroup",
|
|
959
971
|
...pe
|
|
960
972
|
},
|
|
961
|
-
|
|
973
|
+
O
|
|
962
974
|
)
|
|
963
975
|
)
|
|
964
976
|
), K && Y()),
|
|
@@ -971,19 +983,19 @@ const z = class z extends r.Component {
|
|
|
971
983
|
)),
|
|
972
984
|
ee,
|
|
973
985
|
se && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(de, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(ce, { ref: this.dragLogic.refDragElementClue })),
|
|
974
|
-
this.showLicenseWatermark && /* @__PURE__ */ r.createElement(
|
|
986
|
+
this.showLicenseWatermark && /* @__PURE__ */ r.createElement(Ue, null)
|
|
975
987
|
),
|
|
976
|
-
|
|
988
|
+
T,
|
|
977
989
|
this.props.pageable && Z
|
|
978
990
|
));
|
|
979
991
|
}
|
|
980
992
|
calculateMedia() {
|
|
981
993
|
this.checkMatchMediaColumnsDifferece() || this.forceUpdate();
|
|
982
994
|
}
|
|
983
|
-
selectionChange(
|
|
995
|
+
selectionChange(l) {
|
|
984
996
|
if (this.props.onSelectionChange) {
|
|
985
|
-
const { event:
|
|
986
|
-
...this.getArguments(
|
|
997
|
+
const { event: p, dataItem: c, dataIndex: e, columnIndex: t } = l, { mode: s, cell: a } = le(this.props.selectable), h = {
|
|
998
|
+
...this.getArguments(p.syntheticEvent),
|
|
987
999
|
dataItem: c,
|
|
988
1000
|
startColIndex: t,
|
|
989
1001
|
endColIndex: t,
|
|
@@ -995,19 +1007,19 @@ const z = class z extends r.Component {
|
|
|
995
1007
|
shiftKey: !1,
|
|
996
1008
|
metaKey: !1,
|
|
997
1009
|
mode: s,
|
|
998
|
-
cell:
|
|
1010
|
+
cell: a,
|
|
999
1011
|
isDrag: !1,
|
|
1000
1012
|
componentId: this._gridId,
|
|
1001
1013
|
selectedField: this.props.selectedField || ""
|
|
1002
1014
|
};
|
|
1003
|
-
this.props.onSelectionChange.call(void 0,
|
|
1015
|
+
this.props.onSelectionChange.call(void 0, h);
|
|
1004
1016
|
}
|
|
1005
1017
|
}
|
|
1006
|
-
raiseDataEvent(
|
|
1018
|
+
raiseDataEvent(l, p, c, e, t) {
|
|
1007
1019
|
const s = this.props.onDataStateChange;
|
|
1008
|
-
if (
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1020
|
+
if (l) {
|
|
1021
|
+
const a = { ...this.getArguments(e), ...p, targetEvent: t };
|
|
1022
|
+
l.call(void 0, a);
|
|
1011
1023
|
} else
|
|
1012
1024
|
s && s.call(
|
|
1013
1025
|
void 0,
|
|
@@ -1021,16 +1033,16 @@ const z = class z extends r.Component {
|
|
|
1021
1033
|
}
|
|
1022
1034
|
);
|
|
1023
1035
|
}
|
|
1024
|
-
columnReorder(
|
|
1025
|
-
const e = this._columns[
|
|
1036
|
+
columnReorder(l, p, c) {
|
|
1037
|
+
const e = this._columns[l], t = e.depth, s = (d) => {
|
|
1026
1038
|
do
|
|
1027
1039
|
d++;
|
|
1028
1040
|
while (d < this._columns.length && this._columns[d].depth > t);
|
|
1029
1041
|
return d;
|
|
1030
|
-
},
|
|
1031
|
-
this._columns.splice(
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1042
|
+
}, a = this._columns.splice(l, s(l) - l);
|
|
1043
|
+
this._columns.splice(l < p ? s(p - a.length) : p, 0, ...a), this._columns.filter((d) => d.declarationIndex >= 0).forEach((d, f) => d.orderIndex = f), this._columnsMutations++;
|
|
1044
|
+
const h = this._columns[l].locked && this._columns[p].locked;
|
|
1045
|
+
Ye(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), Qe(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), this._resized && (this._shouldUpdateLeftRight = !1, this._resized = !1);
|
|
1034
1046
|
const n = this.columns;
|
|
1035
1047
|
if (this.forceUpdate(), this.props.onColumnReorder) {
|
|
1036
1048
|
const d = {
|
|
@@ -1042,39 +1054,39 @@ const z = class z extends r.Component {
|
|
|
1042
1054
|
this.props.onColumnReorder.call(void 0, d);
|
|
1043
1055
|
}
|
|
1044
1056
|
}
|
|
1045
|
-
groupReorder(
|
|
1057
|
+
groupReorder(l, p, c) {
|
|
1046
1058
|
if (this.props.group === void 0)
|
|
1047
1059
|
return;
|
|
1048
1060
|
const e = this.props.group.slice();
|
|
1049
|
-
e.splice(
|
|
1061
|
+
e.splice(p, 0, ...e.splice(l, 1)), this.groupChange(e, c);
|
|
1050
1062
|
}
|
|
1051
|
-
columnToGroup(
|
|
1052
|
-
const e = this._columns[
|
|
1063
|
+
columnToGroup(l, p, c) {
|
|
1064
|
+
const e = this._columns[l].field;
|
|
1053
1065
|
if (!e)
|
|
1054
1066
|
return;
|
|
1055
1067
|
const t = (this.props.group || []).slice();
|
|
1056
|
-
t.splice(
|
|
1068
|
+
t.splice(p, 0, { field: e }), this.groupChange(t, c);
|
|
1057
1069
|
}
|
|
1058
|
-
columnGroupChange(
|
|
1070
|
+
columnGroupChange(l, p) {
|
|
1059
1071
|
const c = this.dragLogic.getCurrentGroupsLength;
|
|
1060
|
-
this.columnToGroup(
|
|
1072
|
+
this.columnToGroup(l, c, p);
|
|
1061
1073
|
}
|
|
1062
1074
|
resetTableWidth() {
|
|
1063
|
-
let
|
|
1075
|
+
let l = 0;
|
|
1064
1076
|
if (!this.columnResize.colGroupMain)
|
|
1065
1077
|
return;
|
|
1066
|
-
const
|
|
1067
|
-
for (let c = 0; c <
|
|
1068
|
-
const e =
|
|
1078
|
+
const p = this.columnResize.colGroupMain.children;
|
|
1079
|
+
for (let c = 0; c < p.length; c++) {
|
|
1080
|
+
const e = p[c].width;
|
|
1069
1081
|
if (!e)
|
|
1070
1082
|
return;
|
|
1071
|
-
|
|
1083
|
+
l += parseFloat(e.toString());
|
|
1072
1084
|
}
|
|
1073
|
-
|
|
1085
|
+
l = Math.round(l), this._header && this._header.setWidth(l), this._footer && this._footer.setWidth(l), this.tableElement && (this.tableElement.style.width = l + "px");
|
|
1074
1086
|
}
|
|
1075
|
-
initColumns(
|
|
1076
|
-
const c =
|
|
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,
|
|
1087
|
+
initColumns(l, p) {
|
|
1088
|
+
const c = I.getIdPrefix(this.navigationStateRef), e = this.filterHiddenColumns(l), t = this.readColumns(e, c, this._columnsMutations);
|
|
1089
|
+
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;
|
|
1078
1090
|
}
|
|
1079
1091
|
getDataState() {
|
|
1080
1092
|
return {
|
|
@@ -1085,10 +1097,10 @@ const z = class z extends r.Component {
|
|
|
1085
1097
|
group: this.props.group
|
|
1086
1098
|
};
|
|
1087
1099
|
}
|
|
1088
|
-
getArguments(
|
|
1100
|
+
getArguments(l) {
|
|
1089
1101
|
return {
|
|
1090
|
-
nativeEvent:
|
|
1091
|
-
syntheticEvent:
|
|
1102
|
+
nativeEvent: l && l.nativeEvent,
|
|
1103
|
+
syntheticEvent: l,
|
|
1092
1104
|
target: this
|
|
1093
1105
|
};
|
|
1094
1106
|
}
|
|
@@ -1169,11 +1181,16 @@ z.displayName = "KendoReactGrid", z.defaultProps = {
|
|
|
1169
1181
|
onColumnResize: o.func,
|
|
1170
1182
|
onColumnReorder: o.func,
|
|
1171
1183
|
dataItemKey: o.string,
|
|
1172
|
-
navigatable: o.
|
|
1184
|
+
navigatable: o.oneOfType([
|
|
1185
|
+
o.bool,
|
|
1186
|
+
o.shape({
|
|
1187
|
+
mode: o.oneOf(["incell", "inline", "popup"])
|
|
1188
|
+
})
|
|
1189
|
+
]),
|
|
1173
1190
|
size: o.oneOf(["small", "medium"])
|
|
1174
|
-
}, z.contextType =
|
|
1175
|
-
let
|
|
1176
|
-
|
|
1191
|
+
}, z.contextType = V;
|
|
1192
|
+
let U = z;
|
|
1193
|
+
ht(U);
|
|
1177
1194
|
export {
|
|
1178
|
-
|
|
1195
|
+
U as Grid
|
|
1179
1196
|
};
|