@progress/kendo-react-grid 7.2.4-develop.3 → 7.2.4-develop.4

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.
Files changed (174) hide show
  1. package/Grid.js +8 -0
  2. package/Grid.mjs +1108 -0
  3. package/GridColumn.js +8 -0
  4. package/GridColumn.mjs +53 -0
  5. package/GridNoRecords.js +8 -0
  6. package/GridNoRecords.mjs +25 -0
  7. package/GridToolbar.js +8 -0
  8. package/GridToolbar.mjs +39 -0
  9. package/StatusBar.js +8 -0
  10. package/StatusBar.mjs +53 -0
  11. package/VirtualScroll.js +8 -0
  12. package/VirtualScroll.mjs +128 -0
  13. package/VirtualScrollFixed.js +8 -0
  14. package/VirtualScrollFixed.mjs +86 -0
  15. package/cells/GridCell.js +8 -0
  16. package/cells/GridCell.mjs +57 -0
  17. package/cells/GridDetailCell.js +8 -0
  18. package/cells/GridDetailCell.mjs +30 -0
  19. package/cells/GridDetailHierarchyCell.js +8 -0
  20. package/cells/GridDetailHierarchyCell.mjs +17 -0
  21. package/cells/GridEditCell.js +8 -0
  22. package/cells/GridEditCell.mjs +172 -0
  23. package/cells/GridFilterCell.js +8 -0
  24. package/cells/GridFilterCell.mjs +145 -0
  25. package/cells/GridGroupCell.js +8 -0
  26. package/cells/GridGroupCell.mjs +115 -0
  27. package/cells/GridHierarchyCell.js +8 -0
  28. package/cells/GridHierarchyCell.mjs +84 -0
  29. package/cells/GridSelectionCell.js +8 -0
  30. package/cells/GridSelectionCell.mjs +54 -0
  31. package/columnMenu/GridColumnMenuCheckboxFilter.js +8 -0
  32. package/columnMenu/GridColumnMenuCheckboxFilter.mjs +199 -0
  33. package/columnMenu/GridColumnMenuColumnsList.js +8 -0
  34. package/columnMenu/GridColumnMenuColumnsList.mjs +60 -0
  35. package/columnMenu/GridColumnMenuFilter.js +8 -0
  36. package/columnMenu/GridColumnMenuFilter.mjs +188 -0
  37. package/columnMenu/GridColumnMenuFilterCell.js +8 -0
  38. package/columnMenu/GridColumnMenuFilterCell.mjs +96 -0
  39. package/columnMenu/GridColumnMenuFilterUI.js +8 -0
  40. package/columnMenu/GridColumnMenuFilterUI.mjs +36 -0
  41. package/columnMenu/GridColumnMenuGroup.js +8 -0
  42. package/columnMenu/GridColumnMenuGroup.mjs +50 -0
  43. package/columnMenu/GridColumnMenuItem.js +8 -0
  44. package/columnMenu/GridColumnMenuItem.mjs +22 -0
  45. package/columnMenu/GridColumnMenuItemContent.js +8 -0
  46. package/columnMenu/GridColumnMenuItemContent.mjs +30 -0
  47. package/columnMenu/GridColumnMenuItemGroup.js +8 -0
  48. package/columnMenu/GridColumnMenuItemGroup.mjs +30 -0
  49. package/columnMenu/GridColumnMenuSort.js +8 -0
  50. package/columnMenu/GridColumnMenuSort.mjs +75 -0
  51. package/columnMenu/GridColumnMenuWrapper.js +8 -0
  52. package/columnMenu/GridColumnMenuWrapper.mjs +91 -0
  53. package/constants/index.js +8 -0
  54. package/constants/index.mjs +15 -0
  55. package/dist/cdn/js/kendo-react-grid.js +8 -5
  56. package/drag/ColumnDraggable.js +8 -0
  57. package/drag/ColumnDraggable.mjs +43 -0
  58. package/drag/ColumnResize.js +8 -0
  59. package/drag/ColumnResize.mjs +128 -0
  60. package/drag/CommonDragLogic.js +8 -0
  61. package/drag/CommonDragLogic.mjs +104 -0
  62. package/drag/GroupingIndicator.js +8 -0
  63. package/drag/GroupingIndicator.mjs +91 -0
  64. package/filterCommon.js +8 -0
  65. package/filterCommon.mjs +103 -0
  66. package/footer/Footer.js +8 -0
  67. package/footer/Footer.mjs +76 -0
  68. package/footer/FooterRow.js +8 -0
  69. package/footer/FooterRow.mjs +46 -0
  70. package/header/FilterRow.js +8 -0
  71. package/header/FilterRow.mjs +96 -0
  72. package/header/GridHeaderCell.js +8 -0
  73. package/header/GridHeaderCell.mjs +38 -0
  74. package/header/GridHeaderSelectionCell.js +8 -0
  75. package/header/GridHeaderSelectionCell.mjs +44 -0
  76. package/header/GroupPanel.js +8 -0
  77. package/header/GroupPanel.mjs +60 -0
  78. package/header/Header.js +8 -0
  79. package/header/Header.mjs +107 -0
  80. package/header/HeaderRow.js +8 -0
  81. package/header/HeaderRow.mjs +155 -0
  82. package/index.d.mts +2771 -5
  83. package/index.d.ts +2771 -57
  84. package/index.js +8 -5
  85. package/index.mjs +89 -3845
  86. package/interfaces/GridSortSettings.js +8 -0
  87. package/interfaces/GridSortSettings.mjs +12 -0
  88. package/messages/index.js +8 -0
  89. package/messages/index.mjs +105 -0
  90. package/package-metadata.js +8 -0
  91. package/package-metadata.mjs +19 -0
  92. package/package.json +10 -10
  93. package/paging/GridPagerSettings.js +8 -0
  94. package/paging/GridPagerSettings.mjs +28 -0
  95. package/rows/GridDetailRow.js +8 -0
  96. package/rows/GridDetailRow.mjs +20 -0
  97. package/rows/GridRow.js +8 -0
  98. package/rows/GridRow.mjs +51 -0
  99. package/utils/index.js +8 -0
  100. package/utils/index.mjs +180 -0
  101. package/Grid.d.ts +0 -267
  102. package/GridColumn.d.ts +0 -28
  103. package/GridNoRecords.d.ts +0 -40
  104. package/GridToolbar.d.ts +0 -54
  105. package/ScrollMode.d.ts +0 -5
  106. package/StatusBar.d.ts +0 -51
  107. package/VirtualScroll.d.ts +0 -51
  108. package/VirtualScrollFixed.d.ts +0 -53
  109. package/cells/GridCell.d.ts +0 -6
  110. package/cells/GridDetailCell.d.ts +0 -18
  111. package/cells/GridDetailHierarchyCell.d.ts +0 -10
  112. package/cells/GridEditCell.d.ts +0 -9
  113. package/cells/GridFilterCell.d.ts +0 -20
  114. package/cells/GridGroupCell.d.ts +0 -9
  115. package/cells/GridHierarchyCell.d.ts +0 -9
  116. package/cells/GridSelectionCell.d.ts +0 -9
  117. package/columnMenu/GridColumnMenuCheckboxFilter.d.ts +0 -122
  118. package/columnMenu/GridColumnMenuColumnsList.d.ts +0 -31
  119. package/columnMenu/GridColumnMenuFilter.d.ts +0 -165
  120. package/columnMenu/GridColumnMenuFilterCell.d.ts +0 -37
  121. package/columnMenu/GridColumnMenuFilterUI.d.ts +0 -12
  122. package/columnMenu/GridColumnMenuGroup.d.ts +0 -77
  123. package/columnMenu/GridColumnMenuItem.d.ts +0 -40
  124. package/columnMenu/GridColumnMenuItemContent.d.ts +0 -24
  125. package/columnMenu/GridColumnMenuItemGroup.d.ts +0 -20
  126. package/columnMenu/GridColumnMenuSort.d.ts +0 -89
  127. package/columnMenu/GridColumnMenuWrapper.d.ts +0 -49
  128. package/constants/index.d.ts +0 -10
  129. package/drag/ColumnDraggable.d.ts +0 -38
  130. package/drag/ColumnResize.d.ts +0 -37
  131. package/drag/CommonDragLogic.d.ts +0 -44
  132. package/drag/GroupingIndicator.d.ts +0 -41
  133. package/filterCommon.d.ts +0 -73
  134. package/footer/Footer.d.ts +0 -38
  135. package/footer/FooterRow.d.ts +0 -25
  136. package/header/FilterRow.d.ts +0 -38
  137. package/header/GridHeaderCell.d.ts +0 -56
  138. package/header/GridHeaderSelectionCell.d.ts +0 -10
  139. package/header/GroupPanel.d.ts +0 -26
  140. package/header/Header.d.ts +0 -46
  141. package/header/HeaderRow.d.ts +0 -51
  142. package/interfaces/GridCellProps.d.ts +0 -73
  143. package/interfaces/GridCellsSettings.d.ts +0 -115
  144. package/interfaces/GridColumnMenuBaseProps.d.ts +0 -18
  145. package/interfaces/GridColumnMenuColumnProps.d.ts +0 -29
  146. package/interfaces/GridColumnMenuFilterBaseProps.d.ts +0 -28
  147. package/interfaces/GridColumnMenuFilterUIProps.d.ts +0 -35
  148. package/interfaces/GridColumnMenuGroupBaseProps.d.ts +0 -23
  149. package/interfaces/GridColumnMenuProps.d.ts +0 -12
  150. package/interfaces/GridColumnMenuSortBaseProps.d.ts +0 -24
  151. package/interfaces/GridColumnProps.d.ts +0 -92
  152. package/interfaces/GridDetailRowProps.d.ts +0 -17
  153. package/interfaces/GridFilterCellProps.d.ts +0 -68
  154. package/interfaces/GridFilterOperator.d.ts +0 -10
  155. package/interfaces/GridFilterOperators.d.ts +0 -53
  156. package/interfaces/GridFooterCellProps.d.ts +0 -26
  157. package/interfaces/GridGroupableSettings.d.ts +0 -17
  158. package/interfaces/GridHeaderCellProps.d.ts +0 -24
  159. package/interfaces/GridNoRecordsProps.d.ts +0 -13
  160. package/interfaces/GridProps.d.ts +0 -333
  161. package/interfaces/GridRowProps.d.ts +0 -67
  162. package/interfaces/GridRowType.d.ts +0 -13
  163. package/interfaces/GridSelectableSettings.d.ts +0 -22
  164. package/interfaces/GridSortSettings.d.ts +0 -17
  165. package/interfaces/GridToolbarProps.d.ts +0 -37
  166. package/interfaces/VirtualScrollInterface.d.ts +0 -31
  167. package/interfaces/events.d.ts +0 -232
  168. package/messages/index.d.ts +0 -199
  169. package/package-metadata.d.ts +0 -9
  170. package/paging/GridPagerSettings.d.ts +0 -71
  171. package/paging/Page.d.ts +0 -17
  172. package/rows/GridDetailRow.d.ts +0 -55
  173. package/rows/GridRow.d.ts +0 -15
  174. package/utils/index.d.ts +0 -73
package/Grid.mjs ADDED
@@ -0,0 +1,1108 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as r from "react";
10
+ import s from "prop-types";
11
+ import { dispatchEvent as Le, canUseDOM as U, getActiveElement as Me, memoizeOne as S, validatePackage as Ae, shouldShowValidationUI as Ge, setScrollbarWidth as oe, getter as Ke, classNames as F, kendoThemeMaps as A, WatermarkOverlay as Oe } from "@progress/kendo-react-common";
12
+ import { tableKeyboardNavigation as E, getSelectionOptions as re, mapColumns as Pe, tableKeyboardNavigationTools as x, ClipboardService as Ue, TableKeyboardNavigationContext as V, isRtl as Ve, tableColumnsVirtualization as We, Pager as Be, tableKeyboardNavigationScopeAttributes as ae, TableSelection as le, tableKeyboardNavigationBodyAttributes as ne, DropClue as he, DragClue as pe, updateLeft as $e, updateRight as je } from "@progress/kendo-react-data-tools";
13
+ import { GridSelectionCell as qe } from "./cells/GridSelectionCell.mjs";
14
+ import { GridHierarchyCell as Je } from "./cells/GridHierarchyCell.mjs";
15
+ import { GridEditCell as Qe } from "./cells/GridEditCell.mjs";
16
+ import { Header as Xe } from "./header/Header.mjs";
17
+ import { HeaderRow as Ye } from "./header/HeaderRow.mjs";
18
+ import { FilterRow as Ze } from "./header/FilterRow.mjs";
19
+ import { GroupPanel as et } from "./header/GroupPanel.mjs";
20
+ import { Footer as tt } from "./footer/Footer.mjs";
21
+ import { VirtualScroll as st } from "./VirtualScroll.mjs";
22
+ import { VirtualScrollFixed as de, RowHeightService as ce } from "./VirtualScrollFixed.mjs";
23
+ import { ColumnResize as it } from "./drag/ColumnResize.mjs";
24
+ import { CommonDragLogic as ot } from "./drag/CommonDragLogic.mjs";
25
+ import { firefox as ue, firefoxMaxHeight as ge, flatData as rt, readColumns as at, sanitizeColumns as lt, getColumnWidth as W, autoGenerateColumns as nt, getNestedValue as me, resolveCells as ht } from "./utils/index.mjs";
26
+ import { GridCell as pt } from "./cells/GridCell.mjs";
27
+ import { GridGroupCell as fe } from "./cells/GridGroupCell.mjs";
28
+ import { GridRow as dt } from "./rows/GridRow.mjs";
29
+ import { GridHeaderSelectionCell as ct } from "./header/GridHeaderSelectionCell.mjs";
30
+ import { GridNoRecords as ut } from "./GridNoRecords.mjs";
31
+ import { operators as ve } from "./filterCommon.mjs";
32
+ import { FooterRow as gt } from "./footer/FooterRow.mjs";
33
+ import { normalize as mt } from "./paging/GridPagerSettings.mjs";
34
+ import { pagerMessagesMap as ft } from "./messages/index.mjs";
35
+ import { packageMetadata as be } from "./package-metadata.mjs";
36
+ import { GridDetailCell as vt } from "./cells/GridDetailCell.mjs";
37
+ import { GridDetailHierarchyCell as bt } from "./cells/GridDetailHierarchyCell.mjs";
38
+ const _ = class _ extends r.Component {
39
+ constructor(a) {
40
+ 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.observer = null, this.handleIntersection = (e) => {
41
+ const t = { rowIndex: this.rowIndex };
42
+ e.forEach((i) => {
43
+ i.isIntersecting || this.setCurrentOnTop(t);
44
+ });
45
+ }, this.setCurrentOnTop = (e) => {
46
+ if (!this.vs.container || this.props.scrollable === "none")
47
+ return;
48
+ this.observer && this.observer.disconnect();
49
+ const { rowIndex: t } = e;
50
+ if (this.props.scrollable === "virtual")
51
+ this.vs.askedSkip = t, this.vs.container.scroll(0, Math.round(this.vs.askedSkip / this.vs.total * this.vs.container.scrollHeight));
52
+ else if (this.element) {
53
+ const i = t < 1 ? this.element.querySelector("tbody > tr:nth-child(1)") : this.element.querySelector(`tbody > tr:nth-child(${t + 1})`);
54
+ i && this.containerRef.current && (this.containerRef.current.scrollTop = i.offsetTop);
55
+ }
56
+ }, this.scrollIntoView = (e) => {
57
+ if (!this.vs.container || this.props.scrollable === "none")
58
+ return;
59
+ this.rowIndex = e.rowIndex;
60
+ const { rowIndex: t } = e, i = this.element;
61
+ if (this.observer && i) {
62
+ this.observer.disconnect();
63
+ const l = i.querySelector(`[absolute-row-index="${t}"]`);
64
+ l ? this.observer.observe(l) : this.setCurrentOnTop(e);
65
+ }
66
+ }, this.fitColumns = (e) => {
67
+ this.columnResize.dblClickHandler(null, e);
68
+ }, this.onContextMenu = (e, t, i) => {
69
+ if (this.props.onContextMenu) {
70
+ const l = {
71
+ target: this,
72
+ syntheticEvent: e,
73
+ nativeEvent: e.nativeEvent,
74
+ dataItem: t,
75
+ field: i
76
+ };
77
+ this.props.onContextMenu.call(void 0, l);
78
+ }
79
+ }, this.getVirtualScroll = (e) => {
80
+ const { rowHeight: t, detailRowHeight: i, detail: l, expandField: h, groupable: n } = e, d = this.isAllData(), b = t !== void 0 && t > 0, R = i !== void 0 && i > 0, f = n === !0 || typeof n == "object" && n.enabled !== !1;
81
+ return !b || f && !d || !!(l && h) && (!R || !d) ? st : de;
82
+ }, this.isAllData = () => {
83
+ const { data: e, total: t } = this.props;
84
+ return Array.isArray(e) ? e.length === t : e ? t === e.total : !1;
85
+ }, this.initializeVirtualization = (e, t) => {
86
+ if (this.reInitVirtualization(
87
+ this.props.scrollable === "virtual",
88
+ this.props.total,
89
+ this.props.filter,
90
+ this.props.group,
91
+ this.props.sort,
92
+ t || this.props.rowHeight === void 0 || this.props.rowHeight === 0
93
+ ), 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) {
94
+ const i = this.props.rowHeight * e;
95
+ this.vs.containerHeight = ue ? Math.min(ge, i) : i;
96
+ } else
97
+ this.vs.containerHeight = 1533915;
98
+ if (this.vs.containerRef = this.containerRef, this.vs.tableBodyRef = this.tableBodyRef, this.vs.table = this.tableElement, this._slicedData = void 0, this.vs instanceof de) {
99
+ const { rowHeight: i = 0, detail: l, expandField: h } = this.props;
100
+ let { detailRowHeight: n = 0 } = this.props;
101
+ n = l && h ? n : 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, n, this._data)) : this.vs.rowHeightService = new ce(e, i, n);
102
+ const d = this.vs.rowHeightService.totalHeight();
103
+ this.vs.containerHeight = ue ? Math.min(ge, d) : d;
104
+ }
105
+ }, this.scrollHandler = (e) => {
106
+ if (e.target !== e.currentTarget)
107
+ return;
108
+ clearTimeout(this.forceUpdateTimeout), this.vs.table = this.tableElement;
109
+ const t = e.currentTarget.scrollLeft, i = e.currentTarget.scrollTop;
110
+ this.props.columnVirtualization && (!this.vs.scrollableVirtual || i === this.wrapperScrollTop) && (this.forceUpdateTimeout = window.setTimeout(() => {
111
+ this.forceUpdate();
112
+ }, 0)), this._header && this._header.setScrollLeft(t), this._footer && this._footer.setScrollLeft(t), this.vs && i !== this.wrapperScrollTop && this.vs.scrollHandler(e), Le(this.props.onScroll, e, this, void 0), this.wrapperScrollTop = i;
113
+ }, this.onKeyDown = (e) => {
114
+ if (E.onKeyDown(e, {
115
+ contextStateRef: this.contextStateRef,
116
+ navigationStateRef: this.navigationStateRef,
117
+ onNavigationAction: this.onNavigationAction
118
+ }), this.props.onKeyDown) {
119
+ const { mode: t, cell: i } = re(this.props.selectable), l = {
120
+ dataItems: this.getLeafDataItems(),
121
+ mode: t,
122
+ cell: i,
123
+ componentId: this._gridId,
124
+ selectedField: this.props.selectedField,
125
+ ...this.getArguments(e)
126
+ };
127
+ this.props.onKeyDown.call(void 0, l);
128
+ }
129
+ }, this.onFocus = (e) => {
130
+ E.onFocus(e, {
131
+ contextStateRef: this.contextStateRef
132
+ });
133
+ }, this.onNavigationAction = (e) => {
134
+ if (this.props.onNavigationAction) {
135
+ const t = {
136
+ focusElement: e.focusElement,
137
+ ...this.getArguments(e.event)
138
+ };
139
+ this.props.onNavigationAction.call(void 0, t);
140
+ }
141
+ }, this.rowClick = (e, t) => {
142
+ this.props.onRowClick && e.target.nodeName === "TD" && this.props.onRowClick.call(
143
+ void 0,
144
+ {
145
+ dataItem: t.dataItem,
146
+ ...this.getArguments(e)
147
+ }
148
+ );
149
+ }, this.rowDblClick = (e, t) => {
150
+ this.props.onRowDoubleClick && e.target.nodeName === "TD" && this.props.onRowDoubleClick.call(
151
+ void 0,
152
+ {
153
+ dataItem: t.dataItem,
154
+ ...this.getArguments(e)
155
+ }
156
+ );
157
+ }, this.itemChange = (e) => {
158
+ const t = this.props.onItemChange;
159
+ if (e.field === this.props.expandField || this.props.group && e.field === void 0) {
160
+ const i = this.props.onExpandChange;
161
+ i && i.call(
162
+ void 0,
163
+ {
164
+ ...this.getArguments(e.syntheticEvent),
165
+ dataItem: e.dataItem,
166
+ dataIndex: e.dataIndex,
167
+ value: e.value
168
+ }
169
+ );
170
+ return;
171
+ }
172
+ t && t.call(
173
+ void 0,
174
+ {
175
+ ...this.getArguments(e.syntheticEvent),
176
+ dataItem: e.dataItem,
177
+ field: e.field,
178
+ value: e.value
179
+ }
180
+ );
181
+ }, this.onHeaderSelectionChange = (e) => {
182
+ this.props.onHeaderSelectionChange && this.props.onHeaderSelectionChange.call(
183
+ void 0,
184
+ {
185
+ field: e.field,
186
+ nativeEvent: e.syntheticEvent && e.syntheticEvent.nativeEvent,
187
+ syntheticEvent: e.syntheticEvent,
188
+ target: this,
189
+ dataItems: this.getLeafDataItems(),
190
+ selectedField: this.props.selectedField
191
+ }
192
+ );
193
+ }, this.selectionRelease = (e) => {
194
+ if (this.props.onSelectionChange) {
195
+ const t = {
196
+ syntheticEvent: void 0,
197
+ target: this,
198
+ selectedField: this.props.selectedField || "",
199
+ componentId: this._gridId,
200
+ dataItems: this.getLeafDataItems(),
201
+ dataItem: null,
202
+ ...e
203
+ };
204
+ this.props.onSelectionChange.call(void 0, t);
205
+ }
206
+ }, this.pageChange = (e, t, i) => {
207
+ this.raiseDataEvent(
208
+ this.props.onPageChange,
209
+ { page: e },
210
+ { skip: e.skip, take: e.take },
211
+ t,
212
+ i
213
+ );
214
+ }, this.pagerPageChange = (e) => {
215
+ this.pageChange({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
216
+ }, this.sortChange = (e, t) => {
217
+ this.raiseDataEvent(
218
+ this.props.onSortChange,
219
+ { sort: e },
220
+ { sort: e, ...this.props.scrollable === "virtual" ? { skip: 0 } : {} },
221
+ t
222
+ );
223
+ }, this.filterChange = (e, t) => {
224
+ this.raiseDataEvent(
225
+ this.props.onFilterChange,
226
+ { filter: e },
227
+ { filter: e || void 0, skip: 0 },
228
+ t
229
+ );
230
+ }, this.groupChange = (e, t) => {
231
+ const i = t.nativeEvent ? t : { nativeEvent: t.nativeEvent || t.originalEvent };
232
+ this.raiseDataEvent(
233
+ this.props.onGroupChange,
234
+ { group: e },
235
+ { group: e, skip: 0 },
236
+ i
237
+ );
238
+ }, this.onClipboard = (e, t) => {
239
+ if (this.props.onClipboard) {
240
+ if (!this.inActiveElement() || !e)
241
+ return;
242
+ this.props.onClipboard.call(
243
+ void 0,
244
+ {
245
+ type: e,
246
+ nativeEvent: t,
247
+ columns: this._columns,
248
+ dataItemKey: this.props.dataItemKey || "",
249
+ ...typeof this.props.clipboard != "boolean" ? this.props.clipboard : {}
250
+ }
251
+ );
252
+ }
253
+ }, this.inActiveElement = () => {
254
+ var h, n, d;
255
+ if (!U)
256
+ return !1;
257
+ const e = Me(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, i = t.closest(".k-grid-container"), l = t && ((d = this._element) == null ? void 0 : d.contains(t));
258
+ return !!(t && l && i);
259
+ }, this.onResize = (e, t, i, l, h, n) => {
260
+ this.resetTableWidth(), this._shouldUpdateLeftRight = !0, this._resized = !0, this._columnsMutations++, this.props.onColumnResize && this.props.onColumnResize.call(
261
+ void 0,
262
+ {
263
+ columns: this.columns,
264
+ nativeEvent: l,
265
+ targetColumnId: n,
266
+ index: e,
267
+ newWidth: t,
268
+ oldWidth: i,
269
+ end: h,
270
+ target: this
271
+ }
272
+ );
273
+ }, this.reInitVirtualization = S((e, t, i, l, h, n) => {
274
+ this.vs.reset();
275
+ const d = this.getVirtualScroll(this.props);
276
+ this.vs = new d(n);
277
+ }), this.flatData = S((e, t, i, l, h, n, d) => {
278
+ const b = [], R = rt(
279
+ b,
280
+ e,
281
+ t,
282
+ { index: i },
283
+ l !== void 0,
284
+ h
285
+ );
286
+ return { flattedData: b, resolvedGroupsCount: R };
287
+ }), this.rowHeightService = S((e, t, i, l, h) => new ce(t, i, l, h)), this.childrenToArray = S((e) => r.Children.toArray(e)), this.readColumns = S(
288
+ (e, t, i) => {
289
+ const l = e.filter((h) => h && h.type && h.type.displayName === "KendoReactGridColumn");
290
+ return at(l, this.columns, { prevId: 0, idPrefix: t });
291
+ }
292
+ ), this.mapColumns = S(
293
+ (e) => Pe(e)
294
+ ), this.configureColumns = S((e, t, i) => {
295
+ this.props.selectedField && e.forEach((n) => {
296
+ n.field === this.props.selectedField ? (n.width = n.width || "50px", n.cell = n.cell || qe, n.headerCell = n.headerCell || ct) : n.width = void 0;
297
+ });
298
+ const l = {
299
+ id: "",
300
+ resizable: !0,
301
+ width: "32px",
302
+ title: " ",
303
+ declarationIndex: -1,
304
+ orderIndex: -1,
305
+ children: [],
306
+ parentIndex: -1,
307
+ depth: 0,
308
+ colSpan: 0,
309
+ rowSpan: 0,
310
+ left: 0,
311
+ right: 0,
312
+ index: 0,
313
+ rightBorder: !1,
314
+ ariaColumnIndex: 0,
315
+ isAccessible: !0
316
+ };
317
+ let h = 0;
318
+ this.props.expandField && this.props.onExpandChange && this.props.detail && (e.unshift({
319
+ ...l,
320
+ cell: Je,
321
+ field: this.props.expandField,
322
+ headerClassName: "k-hierarchy-cell k-header",
323
+ id: x.generateNavigatableId(`${this._columns.length}`, i, "column")
324
+ }), h++);
325
+ for (let n = 0; n < t; n++)
326
+ e.unshift({
327
+ ...l,
328
+ isAccessible: !1,
329
+ cell: fe,
330
+ field: "value",
331
+ locked: this.props.lockGroups
332
+ }), h++;
333
+ e.slice(h).forEach((n) => n.parentIndex >= 0 && (n.parentIndex += h));
334
+ }), this.getHeaderRow = S((e, t, i, l, h, n, d, b, R, f, z, G) => /* @__PURE__ */ r.createElement(
335
+ Ye,
336
+ {
337
+ cells: this.props.cells,
338
+ sort: e,
339
+ sortable: t,
340
+ sortChange: this.sortChange,
341
+ group: i || [],
342
+ groupable: l,
343
+ groupChange: this.groupChange,
344
+ filter: h,
345
+ filterable: n,
346
+ filterOperators: d,
347
+ filterChange: this.filterChange,
348
+ columnMenu: R,
349
+ selectionChange: this.onHeaderSelectionChange,
350
+ columns: f,
351
+ columnResize: this.columnResize,
352
+ pressHandler: this.dragLogic.pressHandler,
353
+ dragHandler: this.dragLogic.dragHandler,
354
+ releaseHandler: this.dragLogic.releaseHandler,
355
+ columnsMap: z,
356
+ cellRender: b,
357
+ isRtl: G,
358
+ dragClue: this.dragLogic.dragClueRef,
359
+ headerRef: this.headerElementRef,
360
+ containerRef: this.containerRef
361
+ }
362
+ )), this.resolveTitle = (e) => {
363
+ const t = this._columns.find((l) => l.field === e), i = t && (t.title || t.field);
364
+ return i === void 0 ? e : i;
365
+ }, this.getLeafDataItems = () => this._data.filter((e) => e.rowType === "data").map((e) => e.dataItem), Ae(be), this.showLicenseWatermark = Ge(be);
366
+ const p = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(a);
367
+ this.vs = new c(p || a.rowHeight === void 0 || a.rowHeight === 0), this.dragLogic = new ot(
368
+ this.columnReorder.bind(this),
369
+ this.groupReorder.bind(this),
370
+ this.columnToGroup.bind(this)
371
+ ), this.columnResize = new it(this.onResize), this.props.clipboard && (this.clipboardService = new Ue(this.onClipboard)), E.onConstructor({
372
+ navigatable: !!a.navigatable,
373
+ contextStateRef: this.contextStateRef,
374
+ navigationStateRef: this.navigationStateRef,
375
+ idPrefix: this._gridId
376
+ });
377
+ }
378
+ /* eslint-disable max-len */
379
+ /**
380
+ * A getter of the current columns. Gets the current column width or current columns, or any other [`GridColumnProps`]({% slug api_grid_gridcolumnprops %}) for each defined column. Can be used on each Grid instance. To obtain the instance of the rendered Grid, use the `ref` callback. The following example demonstrates how to reorder the columns by dragging their handlers and check the properties afterwards. You can check the result in the browser console.
381
+ *
382
+ * @example
383
+ * ```jsx
384
+ * class App extends React.Component {
385
+ * constructor(props) {
386
+ * super(props);
387
+ * this.state = {
388
+ * data: [
389
+ * { 'foo': 'A1', 'bar': 'B1' },
390
+ * { 'foo': 'A2', 'bar': 'B2' },
391
+ * { 'foo': 'A3', 'bar': 'B2' }
392
+ * ]
393
+ * };
394
+ * this.grid = null;
395
+ * }
396
+ * render() {
397
+ * return (
398
+ * <div>
399
+ * <Grid
400
+ * data={this.state.data}
401
+ * reorderable={true}
402
+ * ref={(g) => { this.grid = g; }}
403
+ * >
404
+ * <GridColumn field="foo" />
405
+ * <GridColumn field="bar" />
406
+ * </Grid>
407
+ * <button onClick={() => console.log(JSON.stringify(this.grid.columns))}>
408
+ * log current properties into browser console.
409
+ * </button>
410
+ * </div>
411
+ * );
412
+ * }
413
+ * }
414
+ * ReactDOM.render(<App />, document.querySelector('my-app'));
415
+ * ```
416
+ */
417
+ // tslint:enable:max-line-length
418
+ get columns() {
419
+ const a = this._columns.filter((p) => p.declarationIndex >= 0 && p.parentIndex === -1);
420
+ return lt(a);
421
+ }
422
+ /**
423
+ * Returns the HTML element of the Grid component.
424
+ */
425
+ get element() {
426
+ return this._element;
427
+ }
428
+ get document() {
429
+ if (U)
430
+ return this.element && this.element.ownerDocument || document;
431
+ }
432
+ get _header() {
433
+ return this.headerRef.current;
434
+ }
435
+ get _gridId() {
436
+ return this.props.id + "-role-element-id";
437
+ }
438
+ /**
439
+ * @hidden
440
+ */
441
+ componentDidMount() {
442
+ this.resetTableWidth(), oe();
443
+ const a = Ve(this.element);
444
+ this.isRtl = a, E.onComponentDidMount({
445
+ scope: this.element || void 0,
446
+ contextStateRef: this.contextStateRef,
447
+ navigationStateRef: this.navigationStateRef
448
+ }), this.isRtl && this.forceUpdate();
449
+ const p = {
450
+ rootMargin: "0px",
451
+ threshold: 0.9
452
+ };
453
+ this.clipboardService && this.clipboardService.addEventListeners(this.document), this.observer = U && window.IntersectionObserver && new window.IntersectionObserver(this.handleIntersection, p) || null;
454
+ }
455
+ /**
456
+ * @hidden
457
+ */
458
+ getSnapshotBeforeUpdate() {
459
+ return E.onGetSnapshotBeforeUpdate({
460
+ document: this.document,
461
+ contextStateRef: this.contextStateRef,
462
+ navigationStateRef: this.navigationStateRef
463
+ }), null;
464
+ }
465
+ /**
466
+ * @hidden
467
+ */
468
+ componentDidUpdate() {
469
+ this.resetTableWidth(), oe(), this.vs.tableTransform && this.vs.table && (this.vs.table.style.transform = this.vs.tableTransform, this.vs.tableTransform = ""), E.onComponentDidUpdate({
470
+ scope: this.element || void 0,
471
+ contextStateRef: this.contextStateRef,
472
+ navigationStateRef: this.navigationStateRef
473
+ });
474
+ }
475
+ /**
476
+ * @hidden
477
+ */
478
+ componentWillUnmount() {
479
+ clearTimeout(this.forceUpdateTimeout), this.clipboardService && this.clipboardService.removeEventListeners(this.document);
480
+ }
481
+ /**
482
+ * @hidden
483
+ */
484
+ render() {
485
+ var se;
486
+ let a = this.props.total || 0;
487
+ const p = x.getIdPrefix(this.navigationStateRef);
488
+ let c = [];
489
+ Array.isArray(this.props.data) ? (c = this.props.data, a = a || this.props.data.length) : this.props.data && (c = this.props.data.data, a = a || this.props.data.total);
490
+ const e = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", { resolvedGroupsCount: t, flattedData: i } = this.flatData(
491
+ c,
492
+ e,
493
+ this.props.skip || 0,
494
+ this.props.group,
495
+ this.props.expandField,
496
+ this.props.filter,
497
+ this.props.sort
498
+ );
499
+ this._data = i;
500
+ const l = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1;
501
+ this.columnResize.resizable = this.props.resizable || !1, this.dragLogic.reorderable = this.props.reorderable || !1, this.dragLogic.groupable = l;
502
+ const h = this.props.selectable && this.props.selectable.drag ? "none" : void 0;
503
+ this.initializeVirtualization(a, l);
504
+ const n = this.childrenToArray(this.props.children);
505
+ this.initColumns(n, t);
506
+ const d = n.map((o) => o && o.type && o.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(o, { ...o.props, ariaControls: this._gridId }) : null), b = n.filter((o) => o && o.type && o.type.displayName === "KendoReactGridNoRecords"), R = n.filter((o) => o && o.type && o.type.displayName === "KendoReactGridStatusBar"), f = this._columns.filter((o) => o.children.length === 0), z = l && /* @__PURE__ */ r.createElement(
507
+ et,
508
+ {
509
+ group: this.props.group || [],
510
+ groupChange: this.groupChange,
511
+ pressHandler: this.dragLogic.pressHandler,
512
+ dragHandler: this.dragLogic.dragHandler,
513
+ releaseHandler: this.dragLogic.releaseHandler,
514
+ refCallback: this.dragLogic.refGroupPanelDiv,
515
+ resolveTitle: this.resolveTitle,
516
+ ariaControls: this._gridId,
517
+ onContextMenu: this.onContextMenu
518
+ }
519
+ ), { sort: G, sortable: Re, group: ye, filter: we, filterable: Se, filterOperators: ke = ve, headerCellRender: Ie, columnMenu: Ee } = this.props, B = /* @__PURE__ */ r.createElement(
520
+ Xe,
521
+ {
522
+ size: this.props.size,
523
+ columnResize: this.columnResize,
524
+ staticHeaders: this.props.scrollable !== "none",
525
+ scrollableDataElement: () => this.vs.container,
526
+ draggable: this.props.reorderable || l,
527
+ ref: this.headerRef,
528
+ elemRef: this.headerElementRef,
529
+ headerRow: this.getHeaderRow(
530
+ G,
531
+ Re,
532
+ ye,
533
+ l,
534
+ we,
535
+ Se,
536
+ ke,
537
+ Ie,
538
+ Ee,
539
+ this._columns,
540
+ this._columnsMap,
541
+ this.isRtl
542
+ ),
543
+ filterRow: this.props.filterable && /* @__PURE__ */ r.createElement(
544
+ Ze,
545
+ {
546
+ cells: this.props.cells,
547
+ size: this.props.size,
548
+ columns: this._columns,
549
+ filter: this.props.filter,
550
+ filterOperators: this.props.filterOperators || ve,
551
+ filterChange: this.filterChange,
552
+ sort: this.props.sort,
553
+ cellRender: this.props.filterCellRender,
554
+ isRtl: this.isRtl,
555
+ ariaRowIndex: this._columnsMap.length + 1
556
+ }
557
+ ) || void 0,
558
+ cols: f.map((o, g) => /* @__PURE__ */ r.createElement(
559
+ "col",
560
+ {
561
+ key: g.toString(),
562
+ width: W(o)
563
+ }
564
+ ))
565
+ }
566
+ ), xe = this.vs && this.vs.container && this.vs.container.scrollLeft || 0, _e = parseFloat(((this.props.style || {}).width || "").toString()), { colSpans: ze, hiddenColumns: De } = We({
567
+ enabled: this.props.columnVirtualization,
568
+ columns: f,
569
+ tableViewPortWidth: _e,
570
+ scrollLeft: xe
571
+ }), He = (o, g, m) => {
572
+ let I = !1;
573
+ const k = this.props.selectedField ? me(this.props.selectedField, o.dataItem) : void 0;
574
+ return {
575
+ row: f.map((u, v) => {
576
+ if (De[v])
577
+ return null;
578
+ const H = u.id ? u.id : v, T = `${u.className ? u.className + " " : ""}${u.locked ? "k-grid-content-sticky" : ""}`, y = u.left !== void 0 ? this.isRtl ? { left: u.right, right: u.left } : { left: u.left, right: u.right } : {};
579
+ let w = !1;
580
+ if (u.editable && this.props.editField) {
581
+ const C = me(this.props.editField, o.dataItem);
582
+ C && (C === !0 || C === u.field) && (I = !0, w = !0);
583
+ }
584
+ const P = u.cell || w && Qe || pt;
585
+ return /* @__PURE__ */ r.createElement(
586
+ P,
587
+ {
588
+ onContextMenu: this.onContextMenu,
589
+ key: H,
590
+ locked: this.props.lockGroups,
591
+ id: x.generateNavigatableId(`${g}-${String(v)}`, p),
592
+ colSpan: ze[v],
593
+ dataItem: o.dataItem,
594
+ field: u.field,
595
+ editor: u.editor,
596
+ format: u.format,
597
+ className: T,
598
+ render: this.props.cellRender,
599
+ cells: ht(this.props.cells, u.cells),
600
+ onChange: this.itemChange,
601
+ selectionChange: this.props.onSelectionChange ? (C) => {
602
+ this.selectionChange({ event: C, dataItem: o.dataItem, dataIndex: m, columnIndex: v });
603
+ } : void 0,
604
+ columnIndex: v,
605
+ columnsCount: f.length,
606
+ rowType: o.rowType,
607
+ level: o.level,
608
+ expanded: o.expanded,
609
+ dataIndex: o.dataIndex,
610
+ style: y,
611
+ ariaColumnIndex: u.ariaColumnIndex,
612
+ isSelected: Array.isArray(k) && k.indexOf(v) > -1
613
+ }
614
+ );
615
+ }),
616
+ isInEdit: I,
617
+ isSelected: typeof k == "boolean" && k
618
+ };
619
+ };
620
+ let $ = 0;
621
+ if (this.props.scrollable === "virtual")
622
+ for (let o = 0; o < this.vs.topCacheCount + this.vs.attendedSkip - (this.props.skip || 0); o++) {
623
+ const g = this._data.shift();
624
+ if (g)
625
+ this._data.push(g), $++, g.rowType === "groupHeader" && o--;
626
+ else
627
+ break;
628
+ }
629
+ const j = (o) => o >= this._data.length - $;
630
+ let q = this.vs.realSkip || 0;
631
+ const L = [];
632
+ let K = !1;
633
+ const O = this._columnsMap.length + (this.props.filterable ? 1 : 0) + 1, J = /* @__PURE__ */ r.createElement("div", { key: "no-records", className: "k-grid-norecords", "aria-rowindex": O }, /* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template" }, b.length ? b : /* @__PURE__ */ r.createElement(ut, null)));
634
+ let D = 0;
635
+ if (this._data.length) {
636
+ let o = -1, g = 0;
637
+ (this._slicedData || this._data).forEach((m, I) => {
638
+ m.rowType === "data" && (q++, o++);
639
+ const k = q % 2 === 0, u = this.props.dataItemKey && Ke(this.props.dataItemKey)(m.dataItem), v = I + (this.vs.realSkip || 0), H = u || "ai" + v, T = H + "_1", y = He(m, H, o);
640
+ if (D = v + O + g, L.push(/* @__PURE__ */ r.createElement(
641
+ dt,
642
+ {
643
+ key: H,
644
+ dataItem: m.dataItem,
645
+ isAltRow: k,
646
+ isInEdit: y.isInEdit,
647
+ rowType: m.rowType,
648
+ isHidden: j(I),
649
+ onClick: (w) => this.rowClick(w, m),
650
+ onDoubleClick: (w) => this.rowDblClick(w, m),
651
+ selectedField: this.props.selectedField,
652
+ rowHeight: this.props.rowHeight,
653
+ render: this.props.rowRender,
654
+ ariaRowIndex: D,
655
+ absoluteRowIndex: v,
656
+ dataIndex: o,
657
+ isSelected: y.isSelected
658
+ },
659
+ y.row
660
+ )), this.props.detail && m.rowType === "data" && m.expanded) {
661
+ const w = f.length - (this.props.expandField ? 1 : 0) - (this.props.group ? this.props.group.length : 0) || 1;
662
+ g++, D = v + O + g, L.push(/* @__PURE__ */ r.createElement(
663
+ "tr",
664
+ {
665
+ key: T,
666
+ className: F(
667
+ "k-table-row",
668
+ k ? "k-detail-row k-table-alt-row k-alt" : "k-detail-row"
669
+ ),
670
+ style: { visibility: j(I) ? "hidden" : "", height: this.props.detailRowHeight },
671
+ role: "row",
672
+ "aria-rowindex": D
673
+ },
674
+ this.props.group && this.props.group.map((P, C) => {
675
+ var ie;
676
+ const N = (ie = y == null ? void 0 : y.row[C]) == null ? void 0 : ie.props.style, Fe = N ? this.isRtl ? { left: N.right, right: N.left } : { left: N.left, right: N.right } : {};
677
+ return /* @__PURE__ */ r.createElement(
678
+ fe,
679
+ {
680
+ id: "",
681
+ dataIndex: m.dataIndex,
682
+ field: P.field,
683
+ dataItem: m.dataItem,
684
+ key: C,
685
+ style: Fe,
686
+ ariaColumnIndex: 1 + C,
687
+ isSelected: !1,
688
+ locked: this.props.lockGroups,
689
+ isRtl: this.isRtl,
690
+ cells: this.props.cells
691
+ }
692
+ );
693
+ }),
694
+ this.props.expandField && /* @__PURE__ */ r.createElement(
695
+ bt,
696
+ {
697
+ id: x.generateNavigatableId(`${T}-dhcell`, p)
698
+ }
699
+ ),
700
+ /* @__PURE__ */ r.createElement(
701
+ vt,
702
+ {
703
+ onContextMenu: this.onContextMenu,
704
+ dataItem: m.dataItem,
705
+ dataIndex: m.dataIndex,
706
+ colSpan: w,
707
+ ariaColIndex: 2 + (this.props.group ? this.props.group.length : 0),
708
+ detail: this.props.detail,
709
+ id: x.generateNavigatableId(`${T}-dcell`, p)
710
+ }
711
+ )
712
+ ));
713
+ }
714
+ });
715
+ } else
716
+ K = !0;
717
+ const Q = {
718
+ size: this.props.size,
719
+ onPageChange: this.pagerPageChange,
720
+ total: a,
721
+ dir: this.isRtl ? "rtl" : void 0,
722
+ skip: this.vs.propsSkip || 0,
723
+ take: (this.props.take !== void 0 ? this.props.take : this.props.pageSize) || 10,
724
+ messagesMap: ft,
725
+ ...mt(this.props.pageable || {})
726
+ }, X = this.props.pager ? /* @__PURE__ */ r.createElement(this.props.pager, { ...Q }) : /* @__PURE__ */ r.createElement(Be, { className: "k-grid-pager", ...Q }), Te = (o) => this.props.sort && this.props.sort.filter((g) => g.field === o).length > 0, Ne = (o, g) => /* @__PURE__ */ r.createElement(
727
+ "col",
728
+ {
729
+ key: g.toString(),
730
+ width: W(o)
731
+ }
732
+ ), Y = (se = this.props.cells) != null && se.footerCell || this._columns.some(
733
+ (o) => {
734
+ var g;
735
+ return !!(o.footerCell || (g = o.cells) != null && g.footerCell);
736
+ }
737
+ ) ? /* @__PURE__ */ r.createElement(
738
+ tt,
739
+ {
740
+ size: this.props.size,
741
+ columnResize: this.columnResize,
742
+ staticHeaders: this.props.scrollable !== "none",
743
+ ref: (o) => this._footer = o,
744
+ row: /* @__PURE__ */ r.createElement(
745
+ gt,
746
+ {
747
+ cells: this.props.cells,
748
+ columns: this._columns,
749
+ isRtl: this.isRtl,
750
+ ariaRowIndex: D + 1
751
+ }
752
+ ),
753
+ cols: f.map(Ne)
754
+ }
755
+ ) : null, Z = /* @__PURE__ */ r.createElement(
756
+ "colgroup",
757
+ {
758
+ ref: (o) => {
759
+ this.columnResize.colGroupMain = o;
760
+ }
761
+ },
762
+ f.map(
763
+ (o, g) => /* @__PURE__ */ r.createElement(
764
+ "col",
765
+ {
766
+ key: g.toString(),
767
+ className: Te(o.field) ? "k-sorted" : void 0,
768
+ width: W(o)
769
+ }
770
+ )
771
+ )
772
+ ), ee = this.dragLogic.reorderable || this.dragLogic.groupable, te = this.props.columnVirtualization ? "block" : "table";
773
+ if (this.props.scrollable === "none")
774
+ return /* @__PURE__ */ r.createElement(V.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
775
+ "div",
776
+ {
777
+ id: this.props.id,
778
+ style: this.props.style,
779
+ className: F(
780
+ "k-grid",
781
+ {
782
+ "k-grid-md": !this.props.size,
783
+ [`k-grid-${A.sizeMap[this.props.size] || this.props.size}`]: this.props.size
784
+ },
785
+ this.props.className
786
+ ),
787
+ ref: (o) => {
788
+ this._element = o;
789
+ },
790
+ "aria-label": this.props.ariaLabel,
791
+ onKeyDown: this.onKeyDown,
792
+ onFocus: this.onFocus,
793
+ ...ae
794
+ },
795
+ d,
796
+ z,
797
+ /* @__PURE__ */ r.createElement(
798
+ le,
799
+ {
800
+ selectable: this.props.selectable,
801
+ onRelease: this.selectionRelease,
802
+ childRef: (o) => {
803
+ this.tableElement = o;
804
+ }
805
+ },
806
+ /* @__PURE__ */ r.createElement(
807
+ "table",
808
+ {
809
+ className: F(
810
+ "k-table k-grid-table",
811
+ { [`k-table-${A.sizeMap[this.props.size] || this.props.size}`]: this.props.size }
812
+ ),
813
+ style: { userSelect: h, display: te }
814
+ },
815
+ Z,
816
+ B,
817
+ /* @__PURE__ */ r.createElement("tbody", { role: "rowgroup", className: "k-table-tbody", ...ne }, L),
818
+ Y
819
+ )
820
+ ),
821
+ K && J,
822
+ ee && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(he, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(pe, { ref: this.dragLogic.refDragElementClue }))
823
+ ), R, this.props.pageable && X);
824
+ let M = this.props.style || {};
825
+ return this.props.scrollable === "virtual" && (M.height || (M = Object.assign({}, M, { height: "450px" }))), /* @__PURE__ */ r.createElement(V.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
826
+ "div",
827
+ {
828
+ id: this.props.id,
829
+ style: M,
830
+ className: F(
831
+ "k-grid",
832
+ {
833
+ "k-grid-md": !this.props.size,
834
+ [`k-grid-${A.sizeMap[this.props.size] || this.props.size}`]: this.props.size,
835
+ "k-grid-virtual": this.props.scrollable === "virtual"
836
+ },
837
+ this.props.className
838
+ ),
839
+ ref: (o) => {
840
+ this._element = o;
841
+ },
842
+ "aria-label": this.props.ariaLabel,
843
+ onKeyDown: this.onKeyDown,
844
+ onFocus: this.onFocus,
845
+ ...ae
846
+ },
847
+ d,
848
+ z,
849
+ /* @__PURE__ */ r.createElement(
850
+ "div",
851
+ {
852
+ className: "k-grid-aria-root",
853
+ role: "grid",
854
+ "aria-colcount": f.length,
855
+ "aria-rowcount": a,
856
+ id: this._gridId
857
+ },
858
+ B,
859
+ /* @__PURE__ */ r.createElement("div", { className: "k-grid-container", role: "presentation" }, /* @__PURE__ */ r.createElement(
860
+ "div",
861
+ {
862
+ ref: this.containerRef,
863
+ className: "k-grid-content k-virtual-content",
864
+ onScroll: this.scrollHandler,
865
+ role: "presentation"
866
+ },
867
+ /* @__PURE__ */ r.createElement("div", { className: "k-grid-table-wrap", role: "presentation" }, /* @__PURE__ */ r.createElement(
868
+ le,
869
+ {
870
+ selectable: this.props.selectable,
871
+ onRelease: this.selectionRelease,
872
+ childRef: (o) => {
873
+ this.tableElement = o;
874
+ }
875
+ },
876
+ /* @__PURE__ */ r.createElement(
877
+ "table",
878
+ {
879
+ className: F(
880
+ "k-table k-grid-table",
881
+ {
882
+ "k-table-md": !this.props.size,
883
+ [`k-table-${A.sizeMap[this.props.size] || this.props.size}`]: this.props.size
884
+ }
885
+ ),
886
+ role: "presentation",
887
+ style: { userSelect: h, display: te }
888
+ },
889
+ Z,
890
+ /* @__PURE__ */ r.createElement(
891
+ "tbody",
892
+ {
893
+ className: "k-table-tbody",
894
+ ref: this.tableBodyRef,
895
+ role: "rowgroup",
896
+ ...ne
897
+ },
898
+ L
899
+ )
900
+ )
901
+ ), K && J),
902
+ /* @__PURE__ */ r.createElement("div", { className: "k-height-container", role: "presentation" }, /* @__PURE__ */ r.createElement(
903
+ "div",
904
+ {
905
+ style: this.props.scrollable === "virtual" ? { height: this.vs.containerHeight + "px" } : {}
906
+ }
907
+ ))
908
+ )),
909
+ Y,
910
+ ee && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(he, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(pe, { ref: this.dragLogic.refDragElementClue })),
911
+ this.showLicenseWatermark && /* @__PURE__ */ r.createElement(Oe, null)
912
+ ),
913
+ R,
914
+ this.props.pageable && X
915
+ ));
916
+ }
917
+ selectionChange(a) {
918
+ if (this.props.onSelectionChange) {
919
+ const { event: p, dataItem: c, dataIndex: e, columnIndex: t } = a, { mode: i, cell: l } = re(this.props.selectable), h = {
920
+ ...this.getArguments(p.syntheticEvent),
921
+ dataItem: c,
922
+ startColIndex: t,
923
+ endColIndex: t,
924
+ startRowIndex: e,
925
+ endRowIndex: e,
926
+ dataItems: this.getLeafDataItems(),
927
+ altKey: !1,
928
+ ctrlKey: !1,
929
+ shiftKey: !1,
930
+ metaKey: !1,
931
+ mode: i,
932
+ cell: l,
933
+ isDrag: !1,
934
+ componentId: this._gridId,
935
+ selectedField: this.props.selectedField || ""
936
+ };
937
+ this.props.onSelectionChange.call(void 0, h);
938
+ }
939
+ }
940
+ raiseDataEvent(a, p, c, e, t) {
941
+ const i = this.props.onDataStateChange;
942
+ if (a) {
943
+ const l = { ...this.getArguments(e), ...p, targetEvent: t };
944
+ a.call(void 0, l);
945
+ } else
946
+ i && i.call(
947
+ void 0,
948
+ {
949
+ ...this.getArguments(e),
950
+ targetEvent: t || {},
951
+ dataState: {
952
+ ...this.getDataState(),
953
+ ...c
954
+ }
955
+ }
956
+ );
957
+ }
958
+ columnReorder(a, p, c) {
959
+ const e = this._columns[a], t = e.depth, i = (d) => {
960
+ do
961
+ d++;
962
+ while (d < this._columns.length && this._columns[d].depth > t);
963
+ return d;
964
+ }, l = this._columns.splice(a, i(a) - a);
965
+ this._columns.splice(a < p ? i(p - l.length) : p, 0, ...l), this._columns.filter((d) => d.declarationIndex >= 0).forEach((d, b) => d.orderIndex = b), this._columnsMutations++;
966
+ const h = this._columns[a].locked && this._columns[p].locked;
967
+ $e(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), je(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), this._resized && (this._shouldUpdateLeftRight = !1, this._resized = !1);
968
+ const n = this.columns;
969
+ if (this.forceUpdate(), this.props.onColumnReorder) {
970
+ const d = {
971
+ target: this,
972
+ columns: n,
973
+ columnId: e.id,
974
+ nativeEvent: c
975
+ };
976
+ this.props.onColumnReorder.call(void 0, d);
977
+ }
978
+ }
979
+ groupReorder(a, p, c) {
980
+ if (this.props.group === void 0)
981
+ return;
982
+ const e = this.props.group.slice();
983
+ e.splice(p, 0, ...e.splice(a, 1)), this.groupChange(e, c);
984
+ }
985
+ columnToGroup(a, p, c) {
986
+ const e = this._columns[a].field;
987
+ if (!e)
988
+ return;
989
+ const t = (this.props.group || []).slice();
990
+ t.splice(p, 0, { field: e }), this.groupChange(t, c);
991
+ }
992
+ resetTableWidth() {
993
+ let a = 0;
994
+ if (!this.columnResize.colGroupMain)
995
+ return;
996
+ const p = this.columnResize.colGroupMain.children;
997
+ for (let c = 0; c < p.length; c++) {
998
+ const e = p[c].width;
999
+ if (!e)
1000
+ return;
1001
+ a += parseFloat(e.toString());
1002
+ }
1003
+ a = Math.round(a), this._header && this._header.setWidth(a), this._footer && this._footer.setWidth(a), this.tableElement && (this.tableElement.style.width = a + "px");
1004
+ }
1005
+ initColumns(a, p) {
1006
+ const c = x.getIdPrefix(this.navigationStateRef);
1007
+ this._columns = this.readColumns(a, c, this._columnsMutations), this._columns.length === 0 && (this._columns = nt(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.columnResize.columns = this._columns, this.dragLogic.columns = this._columns;
1008
+ }
1009
+ getDataState() {
1010
+ return {
1011
+ filter: this.props.filter,
1012
+ sort: this.props.sort,
1013
+ skip: this.props.skip,
1014
+ take: this.props.take !== void 0 ? this.props.take : this.props.pageSize,
1015
+ group: this.props.group
1016
+ };
1017
+ }
1018
+ getArguments(a) {
1019
+ return {
1020
+ nativeEvent: a && a.nativeEvent,
1021
+ syntheticEvent: a,
1022
+ target: this
1023
+ };
1024
+ }
1025
+ };
1026
+ _.displayName = "KendoReactGrid", _.defaultProps = {
1027
+ // never use this
1028
+ }, _.propTypes = {
1029
+ data: s.oneOfType([
1030
+ s.array,
1031
+ s.shape({
1032
+ data: s.array,
1033
+ total: s.number
1034
+ })
1035
+ ]),
1036
+ sortable: s.oneOfType([
1037
+ s.bool,
1038
+ s.shape({
1039
+ mode: s.oneOf(["single", "multiple"]),
1040
+ allowUnsort: s.bool
1041
+ })
1042
+ ]),
1043
+ onSortChange: s.func,
1044
+ sort: s.array,
1045
+ filterable: s.bool,
1046
+ filter: s.any,
1047
+ onFilterChange: s.func,
1048
+ pageable: s.oneOfType([
1049
+ s.bool,
1050
+ s.shape({
1051
+ buttonCount: s.number,
1052
+ responsive: s.bool,
1053
+ info: s.bool,
1054
+ type: s.oneOf(["numeric", "input"]),
1055
+ pageSizes: s.oneOfType(
1056
+ [
1057
+ s.bool,
1058
+ s.arrayOf(s.oneOfType([
1059
+ s.string,
1060
+ s.number
1061
+ ]))
1062
+ ]
1063
+ ),
1064
+ previousNext: s.bool
1065
+ })
1066
+ ]),
1067
+ pageSize: s.number,
1068
+ onPageChange: s.func,
1069
+ total: s.number,
1070
+ skip: s.number,
1071
+ take: s.number,
1072
+ fixedScroll: s.bool,
1073
+ onExpandChange: s.func,
1074
+ expandField: s.string,
1075
+ selectedField: s.string,
1076
+ onSelectionChange: s.func,
1077
+ onHeaderSelectionChange: s.func,
1078
+ resizable: s.bool,
1079
+ reorderable: s.bool,
1080
+ group: s.any,
1081
+ groupable: s.oneOfType([
1082
+ s.bool,
1083
+ s.shape({
1084
+ enabled: s.bool,
1085
+ footer: s.oneOf(["always", "visible", "none"])
1086
+ })
1087
+ ]),
1088
+ onGroupChange: s.func,
1089
+ onRowClick: s.func,
1090
+ onRowDoubleClick: s.func,
1091
+ onItemChange: s.func,
1092
+ editField: s.string,
1093
+ scrollable: s.oneOf(["none", "scrollable", "virtual"]),
1094
+ rowHeight: s.number,
1095
+ detailRowHeight: s.number,
1096
+ detail: s.any,
1097
+ style: s.object,
1098
+ onDataStateChange: s.func,
1099
+ onColumnResize: s.func,
1100
+ onColumnReorder: s.func,
1101
+ dataItemKey: s.string,
1102
+ navigatable: s.bool,
1103
+ size: s.oneOf(["small", "medium"])
1104
+ }, _.contextType = V;
1105
+ let Ce = _;
1106
+ export {
1107
+ Ce as Grid
1108
+ };