beautiful-grid 1.0.10 → 1.0.11

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/cjs/BGrid.js CHANGED
@@ -387,13 +387,11 @@ function BGrid(_a) {
387
387
  includeRows: false,
388
388
  });
389
389
  }
390
- var sourceIndexByVisibleIndex = resolvedData.map(function (_, i) { return i; });
391
- var visibleIndexBySourceIndex = new Map(resolvedData.map(function (_, i) { return [i, i]; }));
392
390
  return {
393
391
  rows: [],
394
392
  data: resolvedData,
395
- sourceIndexByVisibleIndex: sourceIndexByVisibleIndex,
396
- visibleIndexBySourceIndex: visibleIndexBySourceIndex,
393
+ sourceIndexByVisibleIndex: undefined,
394
+ visibleIndexBySourceIndex: undefined,
397
395
  };
398
396
  }, [queryColumns, resolvedData, resolvedDataControl === null || resolvedDataControl === void 0 ? void 0 : resolvedDataControl.mode, resolvedDataQuery, resolvedRowKey]);
399
397
  var displayData = processedResult.data;
@@ -403,16 +401,20 @@ function BGrid(_a) {
403
401
  : Math.min(Math.max(Math.floor(frozenRowCount), 0), displayData.length);
404
402
  var checkedIndexesMap = React.useMemo(function () {
405
403
  if ((resolvedRowChecked === null || resolvedRowChecked === void 0 ? void 0 : resolvedRowChecked.checkedRowKeys) && resolvedRowKey) {
406
- var map_1 = new Map();
407
- resolvedRowChecked.checkedRowKeys.forEach(function (key) {
408
- var fIndex = resolvedData === null || resolvedData === void 0 ? void 0 : resolvedData.findIndex(function (item, index, obj) {
409
- return (0, utils_1.getCellValueByRowKey)(resolvedRowKey, item.values) === key;
410
- });
411
- if (fIndex > -1) {
412
- map_1.set(fIndex, true);
404
+ var remainingKeys = new Set(resolvedRowChecked.checkedRowKeys);
405
+ var map = new Map();
406
+ if (remainingKeys.size > 0 && resolvedData) {
407
+ for (var i = 0; i < resolvedData.length; i++) {
408
+ var itemKey = (0, utils_1.getCellValueByRowKey)(resolvedRowKey, resolvedData[i].values);
409
+ if (remainingKeys.has(itemKey)) {
410
+ map.set(i, true);
411
+ remainingKeys.delete(itemKey);
412
+ if (remainingKeys.size === 0)
413
+ break;
414
+ }
413
415
  }
414
- });
415
- return map_1;
416
+ }
417
+ return map;
416
418
  }
417
419
  if (resolvedRowChecked === null || resolvedRowChecked === void 0 ? void 0 : resolvedRowChecked.checkedIndexes) {
418
420
  return new Map(resolvedRowChecked === null || resolvedRowChecked === void 0 ? void 0 : resolvedRowChecked.checkedIndexes.map(function (id) { return [id, true]; }));
@@ -468,7 +470,7 @@ function BGrid(_a) {
468
470
  containerBorderWidth * 2, 0)
469
471
  : 0;
470
472
  var displayItemCount = contentBodyHeight > 0 ? Math.ceil(contentBodyHeight / (itemHeight + itemPadding * 2)) : 0;
471
- var visibleCheckedCount = processedResult.sourceIndexByVisibleIndex.reduce(function (count, sourceIndex) { return count + (checkedIndexesMap.has(sourceIndex) ? 1 : 0); }, 0);
473
+ var visibleCheckedCount = (0, utils_1.countVisibleCheckedIndexes)(displayData.length, checkedIndexesMap, processedResult.sourceIndexByVisibleIndex);
472
474
  var checkedAll = displayData.length === 0
473
475
  ? false
474
476
  : visibleCheckedCount === displayData.length
@@ -138,7 +138,7 @@ var types_1 = require("../types");
138
138
  var utils_1 = require("../utils");
139
139
  var coordinate_1 = require("../utils/coordinate");
140
140
  var Loading_1 = __importDefault(require("./Loading"));
141
- var TableBody_1 = __importDefault(require("./TableBody"));
141
+ var TableBody_1 = __importStar(require("./TableBody"));
142
142
  var TableBodyFrozen_1 = __importDefault(require("./TableBodyFrozen"));
143
143
  var TableFooter_1 = __importDefault(require("./TableFooter"));
144
144
  var scrollbar_1 = require("./scrollbar");
@@ -165,11 +165,26 @@ var LazyGridOptionalSurfaces = React.lazy(function () {
165
165
  function Table(props) {
166
166
  var _a;
167
167
  var _this = this;
168
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
168
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
169
169
  var cellSelectionOptions = props.cellSelectionOptions, onChangeData = props.onChangeData, sourceIndexByVisibleIndex = props.sourceIndexByVisibleIndex;
170
170
  var cellSelectionEnabled = (_b = cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.enabled) !== null && _b !== void 0 ? _b : true;
171
+ var rowKeyRegistryState = (0, react_1.useRef)({
172
+ sourceData: (_c = props.sourceData) !== null && _c !== void 0 ? _c : props.data,
173
+ rowKey: props.rowKey,
174
+ registry: (0, TableBody_1.createRowKeyRegistry)(),
175
+ });
176
+ var currentSourceData = (_d = props.sourceData) !== null && _d !== void 0 ? _d : props.data;
177
+ if (rowKeyRegistryState.current.sourceData !== currentSourceData ||
178
+ rowKeyRegistryState.current.rowKey !== props.rowKey) {
179
+ rowKeyRegistryState.current = {
180
+ sourceData: currentSourceData,
181
+ rowKey: props.rowKey,
182
+ registry: (0, TableBody_1.createRowKeyRegistry)(),
183
+ };
184
+ }
185
+ var rowKeyRegistry = rowKeyRegistryState.current.registry;
171
186
  // [Selector Group 1] Layout & Dimensions - 레이아웃 차원
172
- var _7 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
187
+ var _9 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
173
188
  width: s.width,
174
189
  height: s.height,
175
190
  containerBorderWidth: s.containerBorderWidth,
@@ -177,30 +192,30 @@ function Table(props) {
177
192
  style: s.style,
178
193
  itemHeight: s.itemHeight,
179
194
  itemPadding: s.itemPadding,
180
- }); })), width = _7.width, height = _7.height, containerBorderWidth = _7.containerBorderWidth, className = _7.className, style = _7.style, itemHeight = _7.itemHeight, itemPadding = _7.itemPadding;
195
+ }); })), width = _9.width, height = _9.height, containerBorderWidth = _9.containerBorderWidth, className = _9.className, style = _9.style, itemHeight = _9.itemHeight, itemPadding = _9.itemPadding;
181
196
  // [Selector Group 2] Header, Footer, Summary - 헤더/푸터/요약
182
- var _8 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
197
+ var _10 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
183
198
  headerHeight: s.headerHeight,
184
199
  footerHeight: s.footerHeight,
185
200
  bottomBarHeight: s.bottomBarHeight,
186
201
  summaryHeight: s.summaryHeight,
187
- }); })), headerHeight = _8.headerHeight, footerHeight = _8.footerHeight, bottomBarHeight = _8.bottomBarHeight, summaryHeight = _8.summaryHeight;
202
+ }); })), headerHeight = _10.headerHeight, footerHeight = _10.footerHeight, bottomBarHeight = _10.bottomBarHeight, summaryHeight = _10.summaryHeight;
188
203
  // [Selector Group 3] Scroll State - 스크롤 상태
189
- var _9 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
204
+ var _11 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
190
205
  scrollLeft: s.scrollLeft,
191
206
  scrollTop: s.scrollTop,
192
- }); })), scrollLeft = _9.scrollLeft, scrollTop = _9.scrollTop;
207
+ }); })), scrollLeft = _11.scrollLeft, scrollTop = _11.scrollTop;
193
208
  // [Selector Group 4] Content, Columns, Data - 컨텐츠 관련
194
- var _10 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
209
+ var _12 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
195
210
  contentBodyHeight: s.contentBodyHeight,
196
211
  columns: s.columns,
197
212
  data: s.data,
198
213
  frozenColumnsWidth: s.frozenColumnsWidth,
199
214
  frozenRowCount: s.frozenRowCount,
200
215
  frozenRowsHeight: s.frozenRowsHeight,
201
- }); })), contentBodyHeight = _10.contentBodyHeight, columns = _10.columns, data = _10.data, frozenColumnsWidth = _10.frozenColumnsWidth, frozenRowCount = _10.frozenRowCount, frozenRowsHeight = _10.frozenRowsHeight;
216
+ }); })), contentBodyHeight = _12.contentBodyHeight, columns = _12.columns, data = _12.data, frozenColumnsWidth = _12.frozenColumnsWidth, frozenRowCount = _12.frozenRowCount, frozenRowsHeight = _12.frozenRowsHeight;
202
217
  // [Selector Group 4-1] Cell selection & navigation - 셀 선택 및 내비게이션
203
- var _11 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
218
+ var _13 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
204
219
  cellSelectionRange: s.cellSelectionRange,
205
220
  cellSelectionRanges: s.cellSelectionRanges,
206
221
  activeCell: s.activeCell,
@@ -209,9 +224,9 @@ function Table(props) {
209
224
  editItemIndex: s.editItemIndex,
210
225
  editable: s.editable,
211
226
  handleClick: s.handleClick,
212
- }); })), cellSelectionRange = _11.cellSelectionRange, cellSelectionRanges = _11.cellSelectionRanges, activeCell = _11.activeCell, activeCellHost = _11.activeCellHost, cellNavigationOptions = _11.cellNavigationOptions, editItemIndex = _11.editItemIndex, editable = _11.editable, handleClick = _11.handleClick;
227
+ }); })), cellSelectionRange = _13.cellSelectionRange, cellSelectionRanges = _13.cellSelectionRanges, activeCell = _13.activeCell, activeCellHost = _13.activeCellHost, cellNavigationOptions = _13.cellNavigationOptions, editItemIndex = _13.editItemIndex, editable = _13.editable, handleClick = _13.handleClick;
213
228
  // [Selector Group 5] State - 상태
214
- var _12 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
229
+ var _14 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
215
230
  rowChecked: s.rowChecked,
216
231
  page: s.page,
217
232
  loading: s.loading,
@@ -222,8 +237,8 @@ function Table(props) {
222
237
  scrollbar: s.scrollbar,
223
238
  status: s.status,
224
239
  pagination: s.pagination,
225
- }); })), rowChecked = _12.rowChecked, page = _12.page, loading = _12.loading, spinning = _12.spinning, disabled = _12.disabled, showLineNumber = _12.showLineNumber, summary = _12.summary, scrollbar = _12.scrollbar, status = _12.status, pagination = _12.pagination;
226
- var _13 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
240
+ }); })), rowChecked = _14.rowChecked, page = _14.page, loading = _14.loading, spinning = _14.spinning, disabled = _14.disabled, showLineNumber = _14.showLineNumber, summary = _14.summary, scrollbar = _14.scrollbar, status = _14.status, pagination = _14.pagination;
241
+ var _15 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
227
242
  searchOpen: s.searchOpen,
228
243
  searchOptions: s.searchOptions,
229
244
  contextMenuOptions: s.contextMenuOptions,
@@ -232,9 +247,9 @@ function Table(props) {
232
247
  storeSourceIndexByVisibleIndex: s.sourceIndexByVisibleIndex,
233
248
  storeRowKey: s.rowKey,
234
249
  cellInteractionSession: s.cellInteractionSession,
235
- }); })), searchOpen = _13.searchOpen, searchOptions = _13.searchOptions, contextMenuOptions = _13.contextMenuOptions, activeSearchMatchIndex = _13.activeSearchMatchIndex, searchMatches = _13.searchMatches, storeSourceIndexByVisibleIndex = _13.storeSourceIndexByVisibleIndex, storeRowKey = _13.storeRowKey, cellInteractionSession = _13.cellInteractionSession;
250
+ }); })), searchOpen = _15.searchOpen, searchOptions = _15.searchOptions, contextMenuOptions = _15.contextMenuOptions, activeSearchMatchIndex = _15.activeSearchMatchIndex, searchMatches = _15.searchMatches, storeSourceIndexByVisibleIndex = _15.storeSourceIndexByVisibleIndex, storeRowKey = _15.storeRowKey, cellInteractionSession = _15.cellInteractionSession;
236
251
  // [Selector Group 6] State Setters - 차원 설정자
237
- var _14 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
252
+ var _16 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
238
253
  setHeight: s.setHeight,
239
254
  setWidth: s.setWidth,
240
255
  setContentBodyHeight: s.setContentBodyHeight,
@@ -248,9 +263,9 @@ function Table(props) {
248
263
  setLoading: s.setLoading,
249
264
  setSpinning: s.setSpinning,
250
265
  setDisabled: s.setDisabled,
251
- }); })), setHeight = _14.setHeight, setWidth = _14.setWidth, setContentBodyHeight = _14.setContentBodyHeight, setDisplayItemCount = _14.setDisplayItemCount, setHeaderHeight = _14.setHeaderHeight, setFooterHeight = _14.setFooterHeight, setBottomBarHeight = _14.setBottomBarHeight, setSummaryHeight = _14.setSummaryHeight, setItemHeight = _14.setItemHeight, setItemPadding = _14.setItemPadding, setLoading = _14.setLoading, setSpinning = _14.setSpinning, setDisabled = _14.setDisabled;
266
+ }); })), setHeight = _16.setHeight, setWidth = _16.setWidth, setContentBodyHeight = _16.setContentBodyHeight, setDisplayItemCount = _16.setDisplayItemCount, setHeaderHeight = _16.setHeaderHeight, setFooterHeight = _16.setFooterHeight, setBottomBarHeight = _16.setBottomBarHeight, setSummaryHeight = _16.setSummaryHeight, setItemHeight = _16.setItemHeight, setItemPadding = _16.setItemPadding, setLoading = _16.setLoading, setSpinning = _16.setSpinning, setDisabled = _16.setDisabled;
252
267
  // [Selector Group 7] Data & Column Setters - 데이터/열 설정자
253
- var _15 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
268
+ var _17 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
254
269
  setData: s.setData,
255
270
  setSourceData: s.setSourceData,
256
271
  setProcessedData: s.setProcessedData,
@@ -261,9 +276,9 @@ function Table(props) {
261
276
  setFrozenColumnIndex: s.setFrozenColumnIndex,
262
277
  setFrozenRowCount: s.setFrozenRowCount,
263
278
  setFrozenRowsHeight: s.setFrozenRowsHeight,
264
- }); })), setData = _15.setData, setSourceData = _15.setSourceData, setProcessedData = _15.setProcessedData, setColumns = _15.setColumns, setColumnsGroup = _15.setColumnsGroup, setColumnGroups = _15.setColumnGroups, setFrozenColumnsWidth = _15.setFrozenColumnsWidth, setFrozenColumnIndex = _15.setFrozenColumnIndex, setFrozenRowCount = _15.setFrozenRowCount, setFrozenRowsHeight = _15.setFrozenRowsHeight;
279
+ }); })), setData = _17.setData, setSourceData = _17.setSourceData, setProcessedData = _17.setProcessedData, setColumns = _17.setColumns, setColumnsGroup = _17.setColumnsGroup, setColumnGroups = _17.setColumnGroups, setFrozenColumnsWidth = _17.setFrozenColumnsWidth, setFrozenColumnIndex = _17.setFrozenColumnIndex, setFrozenRowCount = _17.setFrozenRowCount, setFrozenRowsHeight = _17.setFrozenRowsHeight;
265
280
  // [Selector Group 8] Row & Sort Setters - 행/정렬 설정자
266
- var _16 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
281
+ var _18 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
267
282
  setRowChecked: s.setRowChecked,
268
283
  setCheckedIndexesMap: s.setCheckedIndexesMap,
269
284
  setSort: s.setSort,
@@ -281,9 +296,9 @@ function Table(props) {
281
296
  requestSearchOpen: s.requestSearchOpen,
282
297
  openContextMenu: s.openContextMenu,
283
298
  commitCheckboxCell: s.commitCheckboxCell,
284
- }); })), setRowChecked = _16.setRowChecked, setCheckedIndexesMap = _16.setCheckedIndexesMap, setSort = _16.setSort, setSortParams = _16.setSortParams, setDataQuery = _16.setDataQuery, setDataControl = _16.setDataControl, setIcons = _16.setIcons, setColumnVisibilityState = _16.setColumnVisibilityState, setActiveToolbox = _16.setActiveToolbox, setRowKey = _16.setRowKey, setFocusedRowKey = _16.setFocusedRowKey, setEditItem = _16.setEditItem, setSearchOptions = _16.setSearchOptions, setContextMenuOptions = _16.setContextMenuOptions, requestSearchOpen = _16.requestSearchOpen, openContextMenu = _16.openContextMenu, commitCheckboxCell = _16.commitCheckboxCell;
299
+ }); })), setRowChecked = _18.setRowChecked, setCheckedIndexesMap = _18.setCheckedIndexesMap, setSort = _18.setSort, setSortParams = _18.setSortParams, setDataQuery = _18.setDataQuery, setDataControl = _18.setDataControl, setIcons = _18.setIcons, setColumnVisibilityState = _18.setColumnVisibilityState, setActiveToolbox = _18.setActiveToolbox, setRowKey = _18.setRowKey, setFocusedRowKey = _18.setFocusedRowKey, setEditItem = _18.setEditItem, setSearchOptions = _18.setSearchOptions, setContextMenuOptions = _18.setContextMenuOptions, requestSearchOpen = _18.requestSearchOpen, openContextMenu = _18.openContextMenu, commitCheckboxCell = _18.commitCheckboxCell;
285
300
  // [Selector Group 9] Pagination & Display Setters - 페이지/표시 설정자
286
- var _17 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
301
+ var _19 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
287
302
  setPage: s.setPage,
288
303
  setDisplayPaginationLength: s.setDisplayPaginationLength,
289
304
  setShowLineNumber: s.setShowLineNumber,
@@ -299,9 +314,9 @@ function Table(props) {
299
314
  setScrollbar: s.setScrollbar,
300
315
  setStatus: s.setStatus,
301
316
  setPagination: s.setPagination,
302
- }); })), setPage = _17.setPage, setDisplayPaginationLength = _17.setDisplayPaginationLength, setShowLineNumber = _17.setShowLineNumber, setMsg = _17.setMsg, setRowClassName = _17.setRowClassName, setCellMergeOptions = _17.setCellMergeOptions, setVariant = _17.setVariant, setSummary = _17.setSummary, setColumnSortable = _17.setColumnSortable, setReorder = _17.setReorder, setClassName = _17.setClassName, setStyle = _17.setStyle, setScrollbar = _17.setScrollbar, setStatus = _17.setStatus, setPagination = _17.setPagination;
317
+ }); })), setPage = _19.setPage, setDisplayPaginationLength = _19.setDisplayPaginationLength, setShowLineNumber = _19.setShowLineNumber, setMsg = _19.setMsg, setRowClassName = _19.setRowClassName, setCellMergeOptions = _19.setCellMergeOptions, setVariant = _19.setVariant, setSummary = _19.setSummary, setColumnSortable = _19.setColumnSortable, setReorder = _19.setReorder, setClassName = _19.setClassName, setStyle = _19.setStyle, setScrollbar = _19.setScrollbar, setStatus = _19.setStatus, setPagination = _19.setPagination;
303
318
  // [Selector Group 10] Edit & Event Setters - 편집/이벤트 설정자
304
- var _18 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
319
+ var _20 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
305
320
  setEditable: s.setEditable,
306
321
  setEditTrigger: s.setEditTrigger,
307
322
  setOnClick: s.setOnClick,
@@ -310,8 +325,8 @@ function Table(props) {
310
325
  setOnLoadMore: s.setOnLoadMore,
311
326
  setScroll: s.setScroll,
312
327
  setInitialized: s.setInitialized,
313
- }); })), setEditable = _18.setEditable, setEditTrigger = _18.setEditTrigger, setOnClick = _18.setOnClick, setOnChangeColumns = _18.setOnChangeColumns, setOnChangeData = _18.setOnChangeData, setOnLoadMore = _18.setOnLoadMore, setScroll = _18.setScroll, setInitialized = _18.setInitialized;
314
- var _19 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
328
+ }); })), setEditable = _20.setEditable, setEditTrigger = _20.setEditTrigger, setOnClick = _20.setOnClick, setOnChangeColumns = _20.setOnChangeColumns, setOnChangeData = _20.setOnChangeData, setOnLoadMore = _20.setOnLoadMore, setScroll = _20.setScroll, setInitialized = _20.setInitialized;
329
+ var _21 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
315
330
  setCellSelectionRanges: s.setCellSelectionRanges,
316
331
  setCellSelecting: s.setCellSelecting,
317
332
  clearCellSelection: s.clearCellSelection,
@@ -319,7 +334,7 @@ function Table(props) {
319
334
  moveActiveCell: s.moveActiveCell,
320
335
  setCellNavigationOptions: s.setCellNavigationOptions,
321
336
  syncActiveCellToBounds: s.syncActiveCellToBounds,
322
- }); })), setCellSelectionRanges = _19.setCellSelectionRanges, setCellSelecting = _19.setCellSelecting, clearCellSelection = _19.clearCellSelection, setActiveCell = _19.setActiveCell, moveActiveCell = _19.moveActiveCell, setCellNavigationOptions = _19.setCellNavigationOptions, syncActiveCellToBounds = _19.syncActiveCellToBounds;
337
+ }); })), setCellSelectionRanges = _21.setCellSelectionRanges, setCellSelecting = _21.setCellSelecting, clearCellSelection = _21.clearCellSelection, setActiveCell = _21.setActiveCell, moveActiveCell = _21.moveActiveCell, setCellNavigationOptions = _21.setCellNavigationOptions, syncActiveCellToBounds = _21.syncActiveCellToBounds;
323
338
  var trHeight = itemHeight + itemPadding * 2;
324
339
  var rowHeightMetrics = props.rowHeightMetrics;
325
340
  var variableRowOffsets = rowHeightMetrics.variable ? rowHeightMetrics.offsets : undefined;
@@ -334,7 +349,7 @@ function Table(props) {
334
349
  enabled: scrollbar.variant !== 'native',
335
350
  });
336
351
  }, [contentBodyHeight, logicalBodyContentHeight, scrollbar.variant]);
337
- var _20 = __read(React.useState(0), 2), virtualScrollBase = _20[0], setVirtualScrollBase = _20[1];
352
+ var _22 = __read(React.useState(0), 2), virtualScrollBase = _22[0], setVirtualScrollBase = _22[1];
338
353
  var virtualScrollBaseRef = (0, react_1.useRef)(0);
339
354
  var containerRef = (0, react_1.useRef)(null);
340
355
  var searchPopoverRef = (0, react_1.useRef)(null);
@@ -467,7 +482,7 @@ function Table(props) {
467
482
  }, [
468
483
  data.length,
469
484
  frozenRowCount,
470
- (_c = props.reorder) === null || _c === void 0 ? void 0 : _c.enabled,
485
+ (_e = props.reorder) === null || _e === void 0 ? void 0 : _e.enabled,
471
486
  scrollOverscanRows,
472
487
  scrollTop,
473
488
  scrollableBodyHeight,
@@ -524,7 +539,7 @@ function Table(props) {
524
539
  ]);
525
540
  }
526
541
  }
527
- var sourceIndex = (_d = storeSourceIndexByVisibleIndex[visibleIndex]) !== null && _d !== void 0 ? _d : visibleIndex;
542
+ var sourceIndex = (_d = storeSourceIndexByVisibleIndex === null || storeSourceIndexByVisibleIndex === void 0 ? void 0 : storeSourceIndexByVisibleIndex[visibleIndex]) !== null && _d !== void 0 ? _d : visibleIndex;
528
543
  var target = {
529
544
  cell: logical.cell,
530
545
  visibleIndex: visibleIndex,
@@ -641,7 +656,7 @@ function Table(props) {
641
656
  var latestCommittedScrollRef = (0, react_1.useRef)({ top: scrollTop, left: scrollLeft });
642
657
  var scrollPropsRef = (0, react_1.useRef)({ top: props.scrollTop, left: props.scrollLeft });
643
658
  var syncedDataPropRef = (0, react_1.useRef)(props.data);
644
- var _21 = __read(React.useState(null), 2), rowScrollRequest = _21[0], setRowScrollRequest = _21[1];
659
+ var _23 = __read(React.useState(null), 2), rowScrollRequest = _23[0], setRowScrollRequest = _23[1];
645
660
  React.useImperativeHandle(props.ref, function () { return ({
646
661
  scrollToRow: function (rowIndex, options) {
647
662
  var _a;
@@ -658,7 +673,7 @@ function Table(props) {
658
673
  var selectionMetricsRef = (0, react_1.useRef)({
659
674
  columns: columns,
660
675
  dataLength: data.length,
661
- frozenColumnIndex: (_d = props.frozenColumnIndex) !== null && _d !== void 0 ? _d : 0,
676
+ frozenColumnIndex: (_f = props.frozenColumnIndex) !== null && _f !== void 0 ? _f : 0,
662
677
  frozenRowCount: frozenRowCount,
663
678
  frozenColumnsWidth: frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0,
664
679
  frozenRowsHeight: frozenRowsHeight,
@@ -1543,7 +1558,7 @@ function Table(props) {
1543
1558
  setFrozenColumnIndex((_d = props.frozenColumnIndex) !== null && _d !== void 0 ? _d : 0);
1544
1559
  }, [
1545
1560
  props.frozenColumnIndex,
1546
- (_e = props.reorder) === null || _e === void 0 ? void 0 : _e.enabled,
1561
+ (_g = props.reorder) === null || _g === void 0 ? void 0 : _g.enabled,
1547
1562
  showLineNumber,
1548
1563
  rowChecked,
1549
1564
  itemHeight,
@@ -1561,7 +1576,7 @@ function Table(props) {
1561
1576
  setFrozenRowsHeight((_d = rowHeightMetrics.offsets[nextFrozenRowCount]) !== null && _d !== void 0 ? _d : nextFrozenRowCount * trHeight);
1562
1577
  }, [
1563
1578
  data.length,
1564
- (_f = props.data) === null || _f === void 0 ? void 0 : _f.length,
1579
+ (_h = props.data) === null || _h === void 0 ? void 0 : _h.length,
1565
1580
  props.frozenRowCount,
1566
1581
  rowHeightMetrics,
1567
1582
  setFrozenRowCount,
@@ -1570,10 +1585,7 @@ function Table(props) {
1570
1585
  ]);
1571
1586
  // [Group 5] Data & columns
1572
1587
  (0, react_1.useEffect)(function () {
1573
- if (props.data !== undefined &&
1574
- props.sourceData !== undefined &&
1575
- props.sourceIndexByVisibleIndex !== undefined &&
1576
- props.visibleIndexBySourceIndex !== undefined) {
1588
+ if (props.data !== undefined && props.sourceData !== undefined) {
1577
1589
  setProcessedData({
1578
1590
  data: props.data,
1579
1591
  sourceData: props.sourceData,
@@ -1661,23 +1673,23 @@ function Table(props) {
1661
1673
  }
1662
1674
  }, [
1663
1675
  props.page,
1664
- (_g = props.page) === null || _g === void 0 ? void 0 : _g.currentPage,
1665
- (_h = props.page) === null || _h === void 0 ? void 0 : _h.loading,
1666
- (_j = props.page) === null || _j === void 0 ? void 0 : _j.pageSize,
1667
- (_k = props.page) === null || _k === void 0 ? void 0 : _k.totalPages,
1668
- (_l = props.page) === null || _l === void 0 ? void 0 : _l.totalElements,
1669
- (_m = props.page) === null || _m === void 0 ? void 0 : _m.onChange,
1670
- (_o = props.page) === null || _o === void 0 ? void 0 : _o.displayPaginationLength,
1676
+ (_j = props.page) === null || _j === void 0 ? void 0 : _j.currentPage,
1677
+ (_k = props.page) === null || _k === void 0 ? void 0 : _k.loading,
1678
+ (_l = props.page) === null || _l === void 0 ? void 0 : _l.pageSize,
1679
+ (_m = props.page) === null || _m === void 0 ? void 0 : _m.totalPages,
1680
+ (_o = props.page) === null || _o === void 0 ? void 0 : _o.totalElements,
1681
+ (_p = props.page) === null || _p === void 0 ? void 0 : _p.onChange,
1682
+ (_q = props.page) === null || _q === void 0 ? void 0 : _q.displayPaginationLength,
1671
1683
  setPage,
1672
1684
  setDisplayPaginationLength,
1673
1685
  ]);
1674
- var previousPageRef = (0, react_1.useRef)((_p = props.page) === null || _p === void 0 ? void 0 : _p.currentPage);
1686
+ var previousPageRef = (0, react_1.useRef)((_r = props.page) === null || _r === void 0 ? void 0 : _r.currentPage);
1675
1687
  (0, react_1.useEffect)(function () {
1676
1688
  var _a, _b;
1677
1689
  if (previousPageRef.current !== ((_a = props.page) === null || _a === void 0 ? void 0 : _a.currentPage))
1678
1690
  resetScrollPosition('top');
1679
1691
  previousPageRef.current = (_b = props.page) === null || _b === void 0 ? void 0 : _b.currentPage;
1680
- }, [resetScrollPosition, (_q = props.page) === null || _q === void 0 ? void 0 : _q.currentPage]);
1692
+ }, [resetScrollPosition, (_s = props.page) === null || _s === void 0 ? void 0 : _s.currentPage]);
1681
1693
  // [Group 8] Row key & selection
1682
1694
  (0, react_1.useEffect)(function () {
1683
1695
  setRowKey(props.rowKey);
@@ -1753,10 +1765,10 @@ function Table(props) {
1753
1765
  }, [
1754
1766
  columns.length,
1755
1767
  data.length,
1756
- (_s = (_r = props.cellNavigationOptions) === null || _r === void 0 ? void 0 : _r.activeCell) === null || _s === void 0 ? void 0 : _s.columnIndex,
1757
- (_u = (_t = props.cellNavigationOptions) === null || _t === void 0 ? void 0 : _t.activeCell) === null || _u === void 0 ? void 0 : _u.rowIndex,
1758
- (_w = (_v = props.cellNavigationOptions) === null || _v === void 0 ? void 0 : _v.defaultActiveCell) === null || _w === void 0 ? void 0 : _w.columnIndex,
1759
- (_y = (_x = props.cellNavigationOptions) === null || _x === void 0 ? void 0 : _x.defaultActiveCell) === null || _y === void 0 ? void 0 : _y.rowIndex,
1768
+ (_u = (_t = props.cellNavigationOptions) === null || _t === void 0 ? void 0 : _t.activeCell) === null || _u === void 0 ? void 0 : _u.columnIndex,
1769
+ (_w = (_v = props.cellNavigationOptions) === null || _v === void 0 ? void 0 : _v.activeCell) === null || _w === void 0 ? void 0 : _w.rowIndex,
1770
+ (_y = (_x = props.cellNavigationOptions) === null || _x === void 0 ? void 0 : _x.defaultActiveCell) === null || _y === void 0 ? void 0 : _y.columnIndex,
1771
+ (_0 = (_z = props.cellNavigationOptions) === null || _z === void 0 ? void 0 : _z.defaultActiveCell) === null || _0 === void 0 ? void 0 : _0.rowIndex,
1760
1772
  disabled,
1761
1773
  syncActiveCellToBounds,
1762
1774
  ]);
@@ -1891,8 +1903,8 @@ function Table(props) {
1891
1903
  endCellSelectionDrag();
1892
1904
  clearCellSelection();
1893
1905
  }, [cellSelectionEnabled, clearCellSelection, endCellSelectionDrag]);
1894
- var clearCellSelectionOnEscape = (_0 = (_z = props.cellSelectionOptions) === null || _z === void 0 ? void 0 : _z.clearOnEscape) !== null && _0 !== void 0 ? _0 : true;
1895
- var clearCellSelectionOnOutsideClick = (_2 = (_1 = props.cellSelectionOptions) === null || _1 === void 0 ? void 0 : _1.clearOnOutsideClick) !== null && _2 !== void 0 ? _2 : true;
1906
+ var clearCellSelectionOnEscape = (_2 = (_1 = props.cellSelectionOptions) === null || _1 === void 0 ? void 0 : _1.clearOnEscape) !== null && _2 !== void 0 ? _2 : true;
1907
+ var clearCellSelectionOnOutsideClick = (_4 = (_3 = props.cellSelectionOptions) === null || _3 === void 0 ? void 0 : _3.clearOnOutsideClick) !== null && _4 !== void 0 ? _4 : true;
1896
1908
  var keyboardRuntimeRef = (0, react_1.useRef)({
1897
1909
  activeCell: activeCell,
1898
1910
  cellInteractionSession: cellInteractionSession,
@@ -1911,7 +1923,7 @@ function Table(props) {
1911
1923
  editable: editable,
1912
1924
  editItemIndex: editItemIndex,
1913
1925
  endCellSelectionDrag: endCellSelectionDrag,
1914
- frozenColumnIndex: (_3 = props.frozenColumnIndex) !== null && _3 !== void 0 ? _3 : 0,
1926
+ frozenColumnIndex: (_5 = props.frozenColumnIndex) !== null && _5 !== void 0 ? _5 : 0,
1915
1927
  frozenRowCount: frozenRowCount,
1916
1928
  height: height,
1917
1929
  handleClick: handleClick,
@@ -1946,7 +1958,7 @@ function Table(props) {
1946
1958
  editable: editable,
1947
1959
  editItemIndex: editItemIndex,
1948
1960
  endCellSelectionDrag: endCellSelectionDrag,
1949
- frozenColumnIndex: (_4 = props.frozenColumnIndex) !== null && _4 !== void 0 ? _4 : 0,
1961
+ frozenColumnIndex: (_6 = props.frozenColumnIndex) !== null && _6 !== void 0 ? _6 : 0,
1950
1962
  frozenRowCount: frozenRowCount,
1951
1963
  height: height,
1952
1964
  handleClick: handleClick,
@@ -2348,7 +2360,7 @@ function Table(props) {
2348
2360
  if (gateway instanceof HTMLInputElement) {
2349
2361
  gateway.focus({ preventScroll: true });
2350
2362
  }
2351
- }, "data-scroll-variant": scrollbar.variant, "data-vertical-scrollbar": scrollbar.variant !== 'native' && scrollbar.vertical.visible ? 'visible' : 'hidden', "data-bgrid-cell-selection-enabled": cellSelectionEnabled ? 'true' : 'false', "data-bgrid-frozen-columns": ((_5 = props.frozenColumnIndex) !== null && _5 !== void 0 ? _5 : 0) > 0 ? 'true' : 'false', "data-bgrid-disabled": disabled ? 'true' : undefined, "data-bgrid-variable-row-height": rowHeightMetrics.variable ? 'true' : undefined },
2363
+ }, "data-scroll-variant": scrollbar.variant, "data-vertical-scrollbar": scrollbar.variant !== 'native' && scrollbar.vertical.visible ? 'visible' : 'hidden', "data-bgrid-cell-selection-enabled": cellSelectionEnabled ? 'true' : 'false', "data-bgrid-frozen-columns": ((_7 = props.frozenColumnIndex) !== null && _7 !== void 0 ? _7 : 0) > 0 ? 'true' : 'false', "data-bgrid-disabled": disabled ? 'true' : undefined, "data-bgrid-variable-row-height": rowHeightMetrics.variable ? 'true' : undefined },
2352
2364
  scrollbar.variant !== 'native' && scrollbar.vertical.visible && (React.createElement("div", { className: 'bgrid-vertical-scrollbar-gutter', "aria-hidden": 'true' })),
2353
2365
  scrollbar.variant !== 'native' && scrollbar.vertical.visible && (React.createElement("div", { className: 'bgrid-vertical-scrollbar-area', style: {
2354
2366
  top: 0,
@@ -2387,17 +2399,17 @@ function Table(props) {
2387
2399
  React.createElement("div", { className: 'bgrid-body-scroll-content', style: { height: virtualScrollWindowMetrics.physicalContentHeight } },
2388
2400
  frozenRowCount > 0 && (React.createElement("div", { className: 'bgrid-frozen-rows-layer', style: { height: frozenRowsHeight, top: stickyTopHeight }, "data-bgrid-row-band": 'frozen' },
2389
2401
  (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement("div", { className: 'bgrid-frozen-rows-left bgrid-frozen-column-boundary', style: { width: frozenColumnsWidth }, role: 'rfdg-frozen-rows-left' },
2390
- React.createElement(TableBodyFrozen_1.default, { rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: frozenRowRange, role: 'rfdg-body-top-frozen', quadrant: 'top-left', allowRowReorder: false }),
2402
+ React.createElement(TableBodyFrozen_1.default, { rowKeyRegistry: rowKeyRegistry, rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: frozenRowRange, role: 'rfdg-body-top-frozen', quadrant: 'top-left', allowRowReorder: false }),
2391
2403
  renderSelectionOverlay('top-left'))),
2392
2404
  React.createElement("div", { className: 'bgrid-frozen-rows-main', style: { left: frozenColumnsWidth }, role: 'rfdg-frozen-rows-main' },
2393
- React.createElement(TableBody_1.default, { rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: frozenRowRange, role: 'rfdg-body-top', quadrant: 'top-main', allowRowReorder: false }),
2405
+ React.createElement(TableBody_1.default, { rowKeyRegistry: rowKeyRegistry, rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: frozenRowRange, role: 'rfdg-body-top', quadrant: 'top-main', allowRowReorder: false }),
2394
2406
  renderSelectionOverlay('top-main')))),
2395
2407
  React.createElement("div", { className: 'bgrid-scrollable-rows-layer', style: { height: physicalScrollableRowsHeight }, "data-bgrid-row-band": 'scrollable' },
2396
2408
  (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement(FrozenScrollContent, { style: {
2397
2409
  width: frozenColumnsWidth,
2398
2410
  height: physicalScrollableRowsHeight,
2399
2411
  }, role: 'rfdg-frozen-scroll-container' },
2400
- React.createElement(TableBodyFrozen_1.default, { rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: scrollableRowRange, style: frozenScrollableBodyStyle, quadrant: 'body-left', onRowReorderPointerDown: rowReorderController.onPointerDown, onRowReorderKeyDown: rowReorderController.onKeyDown }),
2412
+ React.createElement(TableBodyFrozen_1.default, { rowKeyRegistry: rowKeyRegistry, rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: scrollableRowRange, style: frozenScrollableBodyStyle, quadrant: 'body-left', onRowReorderPointerDown: rowReorderController.onPointerDown, onRowReorderKeyDown: rowReorderController.onKeyDown }),
2401
2413
  renderSelectionOverlay('body-left'))),
2402
2414
  React.createElement(ScrollContent, { style: {
2403
2415
  left: frozenColumnsWidth,
@@ -2406,7 +2418,7 @@ function Table(props) {
2406
2418
  : visibleScrollableRows.paddingTop,
2407
2419
  height: physicalScrollableRowsHeight,
2408
2420
  } },
2409
- React.createElement(TableBody_1.default, { rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: scrollableRowRange, quadrant: 'body-main' }),
2421
+ React.createElement(TableBody_1.default, { rowKeyRegistry: rowKeyRegistry, rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: scrollableRowRange, quadrant: 'body-main' }),
2410
2422
  renderSelectionOverlay('body-main')))),
2411
2423
  summary && summary.position === 'bottom' && (React.createElement(SummaryContainer, { position: 'bottom', style: { height: summaryHeight, bottom: 0 }, role: 'rfdg-summary-container' },
2412
2424
  (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement(FrozenSummary, { style: { width: frozenColumnsWidth }, role: 'rfdg-frozen-summary' },
@@ -2414,7 +2426,7 @@ function Table(props) {
2414
2426
  React.createElement(Summary, { style: { left: frozenColumnsWidth }, role: 'rfdg-summary' },
2415
2427
  React.createElement(TableSummary_1.TableSummary, { position: 'bottom' })))))),
2416
2428
  React.createElement(BodyViewport, { ref: bodyContainerRef, style: { top: stickyTopHeight, height: contentBodyHeight }, "data-last": !page ? 'true' : undefined },
2417
- ((_6 = rowReorderController.preview) === null || _6 === void 0 ? void 0 : _6.visible) && (React.createElement("div", { className: 'bgrid-row-reorder-preview', "data-bgrid-row-reorder-phase": rowReorderController.preview.phase, "aria-hidden": 'true' }, rowReorderController.preview.text)),
2429
+ ((_8 = rowReorderController.preview) === null || _8 === void 0 ? void 0 : _8.visible) && (React.createElement("div", { className: 'bgrid-row-reorder-preview', "data-bgrid-row-reorder-phase": rowReorderController.preview.phase, "aria-hidden": 'true' }, rowReorderController.preview.text)),
2418
2430
  React.createElement(Loading_1.default, { active: !!spinning, size: 'small' })),
2419
2431
  React.createElement("div", { className: 'bgrid-visually-hidden', role: 'status', "aria-live": 'polite', "aria-atomic": 'true' }, rowReorderController.announcement),
2420
2432
  React.createElement(CellTextEditorGateway_1.CellTextEditorGateway, { containerRef: containerRef }),