beautiful-grid 1.0.13 → 1.0.15
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/README.md +121 -6
- package/cjs/BGrid.js +388 -44
- package/cjs/components/CellNavigationDomSync.js +8 -0
- package/cjs/components/CellTextEditorGateway.js +13 -9
- package/cjs/components/ColResizer.js +13 -7
- package/cjs/components/MasterDetailCell.js +145 -0
- package/cjs/components/MasterDetailContext.js +42 -0
- package/cjs/components/Table.js +162 -52
- package/cjs/components/TableBody.js +7 -3
- package/cjs/components/TableBodyCell.js +2 -1
- package/cjs/components/TableSummary.js +25 -34
- package/cjs/components/TableSummaryFronzen.js +36 -34
- package/cjs/store/createAppStore.js +2 -0
- package/cjs/utils/cellSelectionGeometry.js +32 -6
- package/cjs/utils/columnVisibility.js +17 -14
- package/cjs/utils/index.js +1 -0
- package/cjs/utils/rowHeightMetrics.js +47 -6
- package/cjs/utils/summary.js +55 -0
- package/cjs/utils/useRowReorderController.js +5 -1
- package/esm/BGrid.js +387 -72
- package/esm/components/CellNavigationDomSync.js +8 -0
- package/esm/components/CellTextEditorGateway.js +12 -9
- package/esm/components/ColResizer.js +8 -2
- package/esm/components/MasterDetailCell.js +101 -0
- package/esm/components/MasterDetailContext.js +5 -0
- package/esm/components/Table.js +151 -42
- package/esm/components/TableBody.js +6 -2
- package/esm/components/TableBodyCell.js +2 -1
- package/esm/components/TableSummary.js +26 -29
- package/esm/components/TableSummaryFronzen.js +26 -29
- package/esm/store/createAppStore.js +2 -0
- package/esm/utils/cellSelectionGeometry.js +31 -5
- package/esm/utils/columnVisibility.js +21 -18
- package/esm/utils/index.js +1 -0
- package/esm/utils/rowHeightMetrics.js +46 -6
- package/esm/utils/summary.js +35 -0
- package/esm/utils/useRowReorderController.js +5 -1
- package/package.json +1 -1
- package/style.css +164 -14
- package/types/BGrid.d.ts +1 -1
- package/types/components/MasterDetailCell.d.ts +21 -0
- package/types/components/MasterDetailContext.d.ts +20 -0
- package/types/components/Table.d.ts +1 -0
- package/types/components/TableBody.d.ts +2 -1
- package/types/store/createAppStore.d.ts +1 -1
- package/types/types.d.ts +70 -4
- package/types/utils/cellSelectionGeometry.d.ts +3 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/rowHeightMetrics.d.ts +15 -1
- package/types/utils/summary.d.ts +13 -0
package/cjs/components/Table.js
CHANGED
|
@@ -200,7 +200,8 @@ function Table(props) {
|
|
|
200
200
|
footerHeight: s.footerHeight,
|
|
201
201
|
bottomBarHeight: s.bottomBarHeight,
|
|
202
202
|
summaryHeight: s.summaryHeight,
|
|
203
|
-
|
|
203
|
+
summaryRowHeight: s.summaryRowHeight,
|
|
204
|
+
}); })), headerHeight = _10.headerHeight, footerHeight = _10.footerHeight, bottomBarHeight = _10.bottomBarHeight, summaryHeight = _10.summaryHeight, summaryRowHeight = _10.summaryRowHeight;
|
|
204
205
|
// [Selector Group 3] Scroll State - 스크롤 상태
|
|
205
206
|
var _11 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
|
|
206
207
|
scrollLeft: s.scrollLeft,
|
|
@@ -259,12 +260,13 @@ function Table(props) {
|
|
|
259
260
|
setFooterHeight: s.setFooterHeight,
|
|
260
261
|
setBottomBarHeight: s.setBottomBarHeight,
|
|
261
262
|
setSummaryHeight: s.setSummaryHeight,
|
|
263
|
+
setSummaryRowHeight: s.setSummaryRowHeight,
|
|
262
264
|
setItemHeight: s.setItemHeight,
|
|
263
265
|
setItemPadding: s.setItemPadding,
|
|
264
266
|
setLoading: s.setLoading,
|
|
265
267
|
setSpinning: s.setSpinning,
|
|
266
268
|
setDisabled: s.setDisabled,
|
|
267
|
-
}); })), 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;
|
|
269
|
+
}); })), setHeight = _16.setHeight, setWidth = _16.setWidth, setContentBodyHeight = _16.setContentBodyHeight, setDisplayItemCount = _16.setDisplayItemCount, setHeaderHeight = _16.setHeaderHeight, setFooterHeight = _16.setFooterHeight, setBottomBarHeight = _16.setBottomBarHeight, setSummaryHeight = _16.setSummaryHeight, setSummaryRowHeight = _16.setSummaryRowHeight, setItemHeight = _16.setItemHeight, setItemPadding = _16.setItemPadding, setLoading = _16.setLoading, setSpinning = _16.setSpinning, setDisabled = _16.setDisabled;
|
|
268
270
|
// [Selector Group 7] Data & Column Setters - 데이터/열 설정자
|
|
269
271
|
var _17 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
|
|
270
272
|
setData: s.setData,
|
|
@@ -341,22 +343,31 @@ function Table(props) {
|
|
|
341
343
|
var variableRowOffsets = rowHeightMetrics.variable ? rowHeightMetrics.offsets : undefined;
|
|
342
344
|
var scrollableBodyHeight = Math.max(contentBodyHeight - frozenRowsHeight, 0);
|
|
343
345
|
var scrollOverscanRows = Math.max(KEYBOARD_NAVIGATION_ROW_WINDOW_SIZE, Math.ceil(scrollableBodyHeight / Math.max(trHeight, 1)));
|
|
344
|
-
var mainViewportWidth = Math.max(width - (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0), 0);
|
|
345
346
|
var logicalBodyContentHeight = rowHeightMetrics.totalHeight;
|
|
347
|
+
var scrollContainerRef = (0, react_1.useRef)(null);
|
|
348
|
+
var scrollableColumnsWidth = React.useMemo(function () { var _a; return columns.slice((_a = props.frozenColumnIndex) !== null && _a !== void 0 ? _a : 0).reduce(function (totalWidth, column) { var _a; return totalWidth + ((_a = column.width) !== null && _a !== void 0 ? _a : 100); }, 0); }, [columns, props.frozenColumnIndex]);
|
|
349
|
+
var stickyTopHeight = headerHeight + ((summary === null || summary === void 0 ? void 0 : summary.position) === 'top' ? summaryHeight : 0);
|
|
350
|
+
var stickyBottomHeight = (summary === null || summary === void 0 ? void 0 : summary.position) === 'bottom' ? summaryHeight : 0;
|
|
351
|
+
var stickyFixedHeight = stickyTopHeight + stickyBottomHeight;
|
|
352
|
+
var scrollPlaneContentWidth = (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) + scrollableColumnsWidth;
|
|
353
|
+
var measuredScrollbarMetrics = (0, scrollbar_1.useScrollbarMetrics)(scrollContainerRef, [data.length, itemHeight, itemPadding, contentBodyHeight, width], scrollPlaneContentWidth, stickyFixedHeight);
|
|
354
|
+
// Native horizontal scrollbars occupy viewport space; use the measured body height for every scroll path.
|
|
355
|
+
var effectiveBodyHeight = scrollbar.variant === 'native'
|
|
356
|
+
? measuredScrollbarMetrics.vertical.viewportSize || contentBodyHeight
|
|
357
|
+
: contentBodyHeight;
|
|
346
358
|
var virtualScrollWindowMetrics = React.useMemo(function () {
|
|
347
359
|
return (0, utils_1.getVirtualScrollWindowMetrics)({
|
|
348
360
|
logicalContentHeight: logicalBodyContentHeight,
|
|
349
|
-
viewportHeight:
|
|
361
|
+
viewportHeight: effectiveBodyHeight,
|
|
350
362
|
enabled: scrollbar.variant !== 'native',
|
|
351
363
|
});
|
|
352
|
-
}, [
|
|
364
|
+
}, [effectiveBodyHeight, logicalBodyContentHeight, scrollbar.variant]);
|
|
353
365
|
var _22 = __read(React.useState(0), 2), virtualScrollBase = _22[0], setVirtualScrollBase = _22[1];
|
|
354
366
|
var virtualScrollBaseRef = (0, react_1.useRef)(0);
|
|
355
367
|
var containerRef = (0, react_1.useRef)(null);
|
|
356
368
|
var searchPopoverRef = (0, react_1.useRef)(null);
|
|
357
369
|
var editorPortalRef = (0, react_1.useRef)(null);
|
|
358
370
|
var bodyContainerRef = (0, react_1.useRef)(null);
|
|
359
|
-
var scrollContainerRef = (0, react_1.useRef)(null);
|
|
360
371
|
var logicalVerticalScrollState = React.useMemo(function () { return ({
|
|
361
372
|
scrollTop: scrollTop,
|
|
362
373
|
scrollHeight: virtualScrollWindowMetrics.logicalContentHeight,
|
|
@@ -419,6 +430,8 @@ function Table(props) {
|
|
|
419
430
|
rowCount: data.length,
|
|
420
431
|
rowHeight: trHeight,
|
|
421
432
|
rowOffsets: variableRowOffsets,
|
|
433
|
+
rowHeights: rowHeightMetrics.heights,
|
|
434
|
+
detailHeights: rowHeightMetrics.detailHeights,
|
|
422
435
|
frozenColumnCount: (_a = props.frozenColumnIndex) !== null && _a !== void 0 ? _a : 0,
|
|
423
436
|
frozenRowCount: frozenRowCount,
|
|
424
437
|
frozenColumnsWidth: frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0,
|
|
@@ -430,6 +443,8 @@ function Table(props) {
|
|
|
430
443
|
frozenColumnsWidth,
|
|
431
444
|
frozenRowCount,
|
|
432
445
|
props.frozenColumnIndex,
|
|
446
|
+
rowHeightMetrics.detailHeights,
|
|
447
|
+
rowHeightMetrics.heights,
|
|
433
448
|
trHeight,
|
|
434
449
|
variableRowOffsets,
|
|
435
450
|
]);
|
|
@@ -441,6 +456,8 @@ function Table(props) {
|
|
|
441
456
|
rowCount: data.length,
|
|
442
457
|
rowHeight: trHeight,
|
|
443
458
|
rowOffsets: variableRowOffsets,
|
|
459
|
+
rowHeights: rowHeightMetrics.heights,
|
|
460
|
+
detailHeights: rowHeightMetrics.detailHeights,
|
|
444
461
|
frozenColumnCount: (_a = props.frozenColumnIndex) !== null && _a !== void 0 ? _a : 0,
|
|
445
462
|
frozenRowCount: frozenRowCount,
|
|
446
463
|
frozenColumnsWidth: frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0,
|
|
@@ -452,21 +469,13 @@ function Table(props) {
|
|
|
452
469
|
frozenColumnsWidth,
|
|
453
470
|
frozenRowCount,
|
|
454
471
|
props.frozenColumnIndex,
|
|
472
|
+
rowHeightMetrics.detailHeights,
|
|
473
|
+
rowHeightMetrics.heights,
|
|
455
474
|
trHeight,
|
|
456
475
|
variableRowOffsets,
|
|
457
476
|
]);
|
|
458
477
|
var activeOverlayFill = activeCellSelected;
|
|
459
478
|
var activeOverlayRing = !!activeCell && !hasMultiCellSelection;
|
|
460
|
-
var renderSelectionOverlay = function (quadrant) {
|
|
461
|
-
var topQuadrant = quadrant === 'top-left' || quadrant === 'top-main';
|
|
462
|
-
var leftQuadrant = quadrant === 'top-left' || quadrant === 'body-left';
|
|
463
|
-
return (React.createElement(selection_1.CellSelectionOverlay, { quadrant: quadrant, selectionFragments: selectionFragments, activeFragments: activeFragments, activeFill: activeOverlayFill, activeRing: activeOverlayRing, viewport: {
|
|
464
|
-
left: leftQuadrant ? 0 : scrollLeft,
|
|
465
|
-
top: topQuadrant ? 0 : scrollTop,
|
|
466
|
-
width: leftQuadrant ? frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0 : mainViewportWidth,
|
|
467
|
-
height: topQuadrant ? frozenRowsHeight : scrollableBodyHeight,
|
|
468
|
-
}, offsetTop: !topQuadrant && virtualScrollWindowMetrics.enabled ? virtualScrollBase : 0 }));
|
|
469
|
-
};
|
|
470
479
|
var visibleScrollableRows = React.useMemo(function () {
|
|
471
480
|
var _a, _b, _c;
|
|
472
481
|
return (0, utils_1.getVisibleScrollableRowRange)({
|
|
@@ -607,14 +616,9 @@ function Table(props) {
|
|
|
607
616
|
storeRowKey,
|
|
608
617
|
storeSourceIndexByVisibleIndex,
|
|
609
618
|
]);
|
|
610
|
-
var scrollableColumnsWidth = React.useMemo(function () { var _a; return columns.slice((_a = props.frozenColumnIndex) !== null && _a !== void 0 ? _a : 0).reduce(function (totalWidth, column) { var _a; return totalWidth + ((_a = column.width) !== null && _a !== void 0 ? _a : 100); }, 0); }, [columns, props.frozenColumnIndex]);
|
|
611
|
-
var stickyTopHeight = headerHeight + ((summary === null || summary === void 0 ? void 0 : summary.position) === 'top' ? summaryHeight : 0);
|
|
612
|
-
var stickyBottomHeight = (summary === null || summary === void 0 ? void 0 : summary.position) === 'bottom' ? summaryHeight : 0;
|
|
613
|
-
var stickyFixedHeight = stickyTopHeight + stickyBottomHeight;
|
|
614
619
|
var scrollViewportHeight = contentBodyHeight + stickyFixedHeight;
|
|
615
620
|
var physicalScrollableRowsHeight = Math.max(virtualScrollWindowMetrics.physicalContentHeight - frozenRowsHeight, 0);
|
|
616
621
|
var scrollPlaneHeight = stickyFixedHeight + virtualScrollWindowMetrics.physicalContentHeight;
|
|
617
|
-
var scrollPlaneContentWidth = (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) + scrollableColumnsWidth;
|
|
618
622
|
var scrollPlaneWidth = Math.max(width, scrollPlaneContentWidth);
|
|
619
623
|
var customVerticalScrollbarGutter = scrollbar.vertical.visible && scrollbar.variant === 'classic'
|
|
620
624
|
? 'var(--bgrid-scrollbar-classic-gutter-size)'
|
|
@@ -623,8 +627,9 @@ function Table(props) {
|
|
|
623
627
|
: undefined;
|
|
624
628
|
var scrollPlaneMinWidth = customVerticalScrollbarGutter
|
|
625
629
|
? "max(100%, calc(".concat(scrollPlaneContentWidth, "px + ").concat(customVerticalScrollbarGutter, "))")
|
|
626
|
-
:
|
|
627
|
-
|
|
630
|
+
: scrollbar.variant === 'native'
|
|
631
|
+
? "max(100%, ".concat(scrollPlaneContentWidth, "px)")
|
|
632
|
+
: scrollPlaneWidth;
|
|
628
633
|
var scrollbarMetrics = React.useMemo(function () {
|
|
629
634
|
return virtualScrollWindowMetrics.enabled
|
|
630
635
|
? __assign(__assign({}, measuredScrollbarMetrics), { vertical: {
|
|
@@ -641,6 +646,25 @@ function Table(props) {
|
|
|
641
646
|
right: (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) + measuredVerticalScrollbarGutter,
|
|
642
647
|
bottom: stickyFixedHeight + frozenRowsHeight,
|
|
643
648
|
};
|
|
649
|
+
var verticalScrollbarGutterWidth = scrollbar.vertical.visible && scrollbar.variant === 'classic'
|
|
650
|
+
? 25
|
|
651
|
+
: scrollbar.vertical.visible && scrollbar.variant === 'modern'
|
|
652
|
+
? 24
|
|
653
|
+
: 0;
|
|
654
|
+
var horizontalViewportSize = scrollbarMetrics.horizontal.viewportSize > 0
|
|
655
|
+
? scrollbarMetrics.horizontal.viewportSize
|
|
656
|
+
: Math.max(width - containerBorderWidth * 2, 0);
|
|
657
|
+
var mainViewportWidth = Math.max(horizontalViewportSize - (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) - verticalScrollbarGutterWidth, 0);
|
|
658
|
+
var renderSelectionOverlay = function (quadrant) {
|
|
659
|
+
var topQuadrant = quadrant === 'top-left' || quadrant === 'top-main';
|
|
660
|
+
var leftQuadrant = quadrant === 'top-left' || quadrant === 'body-left';
|
|
661
|
+
return (React.createElement(selection_1.CellSelectionOverlay, { quadrant: quadrant, selectionFragments: selectionFragments, activeFragments: activeFragments, activeFill: activeOverlayFill, activeRing: activeOverlayRing, viewport: {
|
|
662
|
+
left: leftQuadrant ? 0 : scrollLeft,
|
|
663
|
+
top: topQuadrant ? 0 : scrollTop,
|
|
664
|
+
width: leftQuadrant ? frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0 : mainViewportWidth,
|
|
665
|
+
height: topQuadrant ? frozenRowsHeight : scrollableBodyHeight,
|
|
666
|
+
}, offsetTop: !topQuadrant && virtualScrollWindowMetrics.enabled ? virtualScrollBase : 0 }));
|
|
667
|
+
};
|
|
644
668
|
var showBottomBar = (0, utils_1.shouldRenderBottomBar)({
|
|
645
669
|
hasPage: !!page,
|
|
646
670
|
hasHorizontalOverflow: scrollbarMetrics.horizontal.hasOverflow,
|
|
@@ -868,6 +892,8 @@ function Table(props) {
|
|
|
868
892
|
hoveredRowIndexesRef.current.forEach(function (hoveredIndex) {
|
|
869
893
|
var _a;
|
|
870
894
|
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll("tr[data-ri=\"".concat(hoveredIndex, "\"]")).forEach(function (el) {
|
|
895
|
+
if (el.closest('[role="grid"], [role="treegrid"]') !== containerRef.current)
|
|
896
|
+
return;
|
|
871
897
|
el.classList.remove('bgrid-row-hover');
|
|
872
898
|
});
|
|
873
899
|
});
|
|
@@ -884,6 +910,8 @@ function Table(props) {
|
|
|
884
910
|
rowIndexes.forEach(function (rowIndex) {
|
|
885
911
|
var _a;
|
|
886
912
|
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll("tr[data-ri=\"".concat(rowIndex, "\"]")).forEach(function (el) {
|
|
913
|
+
if (el.closest('[role="grid"], [role="treegrid"]') !== containerRef.current)
|
|
914
|
+
return;
|
|
887
915
|
el.classList.add('bgrid-row-hover');
|
|
888
916
|
});
|
|
889
917
|
});
|
|
@@ -910,20 +938,30 @@ function Table(props) {
|
|
|
910
938
|
return true;
|
|
911
939
|
}, [columns.length, data.length, setCellSelectionRanges]);
|
|
912
940
|
var onBodyPointerOverCapture = (0, react_1.useCallback)(function (evt) {
|
|
913
|
-
var _a;
|
|
941
|
+
var _a, _b;
|
|
914
942
|
if (disabled) {
|
|
915
943
|
clearHoveredRow();
|
|
916
944
|
return;
|
|
917
945
|
}
|
|
918
|
-
var target = evt.target;
|
|
946
|
+
var target = evt.target instanceof HTMLElement ? evt.target : null;
|
|
947
|
+
var detailOwner = target === null || target === void 0 ? void 0 : target.closest('[data-bgrid-detail-owner]');
|
|
948
|
+
if (detailOwner && ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(detailOwner))) {
|
|
949
|
+
clearHoveredRow();
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
919
952
|
updateAxisSelectionByTarget(target);
|
|
920
953
|
var physicalCellPosition = getCellPosition(target, containerRef.current);
|
|
921
954
|
var cellPosition = physicalCellPosition ? toLogicalCellPosition(physicalCellPosition) : undefined;
|
|
922
955
|
if (cellSelectionEnabled && cellSelectionDragRef.current && cellPosition) {
|
|
923
956
|
setCellSelectionRanges(updateSelectionDragRange(cellSelectionDragRef.current, getRangeFromDrag(cellSelectionDragRef.current, cellPosition)));
|
|
924
957
|
}
|
|
958
|
+
var targetGrid = target === null || target === void 0 ? void 0 : target.closest('[role="grid"], [role="treegrid"]');
|
|
959
|
+
if (targetGrid && targetGrid !== containerRef.current && ((_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.contains(targetGrid))) {
|
|
960
|
+
clearHoveredRow();
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
925
963
|
var tr = target === null || target === void 0 ? void 0 : target.closest('tr[data-ri]');
|
|
926
|
-
if (!tr ||
|
|
964
|
+
if (!tr || tr.closest('[role="grid"], [role="treegrid"]') !== containerRef.current) {
|
|
927
965
|
clearHoveredRow();
|
|
928
966
|
return;
|
|
929
967
|
}
|
|
@@ -946,10 +984,17 @@ function Table(props) {
|
|
|
946
984
|
updateAxisSelectionByTarget,
|
|
947
985
|
]);
|
|
948
986
|
var onBodyPointerDownCapture = (0, react_1.useCallback)(function (evt) {
|
|
949
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
987
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
950
988
|
if (disabled)
|
|
951
989
|
return;
|
|
952
|
-
var
|
|
990
|
+
var target = evt.target instanceof Element ? evt.target : null;
|
|
991
|
+
var detailOwner = target === null || target === void 0 ? void 0 : target.closest('[data-bgrid-detail-owner]');
|
|
992
|
+
if (detailOwner && ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(detailOwner)))
|
|
993
|
+
return;
|
|
994
|
+
var targetGrid = target === null || target === void 0 ? void 0 : target.closest('[role="grid"], [role="treegrid"]');
|
|
995
|
+
if (targetGrid && targetGrid !== containerRef.current && ((_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.contains(targetGrid)))
|
|
996
|
+
return;
|
|
997
|
+
var navEnabled = (_c = cellNavigationOptions === null || cellNavigationOptions === void 0 ? void 0 : cellNavigationOptions.enabled) !== null && _c !== void 0 ? _c : true;
|
|
953
998
|
if (!cellSelectionEnabled && !navEnabled)
|
|
954
999
|
return;
|
|
955
1000
|
if (evt.button !== 0 || isInteractiveTarget(evt.target))
|
|
@@ -959,12 +1004,12 @@ function Table(props) {
|
|
|
959
1004
|
: undefined;
|
|
960
1005
|
if (axisTarget && data.length > 0 && columns.length > 0) {
|
|
961
1006
|
evt.preventDefault();
|
|
962
|
-
(
|
|
1007
|
+
(_d = containerRef.current) === null || _d === void 0 ? void 0 : _d.focus({ preventScroll: true });
|
|
963
1008
|
var isAdditiveSelection = evt.metaKey || evt.ctrlKey;
|
|
964
1009
|
var isRangeExtension = evt.shiftKey && (cellSelectionRange || activeCell);
|
|
965
1010
|
var activeRangeStart = axisTarget.axis === 'row'
|
|
966
|
-
? (
|
|
967
|
-
: (
|
|
1011
|
+
? (_e = cellSelectionRange === null || cellSelectionRange === void 0 ? void 0 : cellSelectionRange.startRowIndex) !== null && _e !== void 0 ? _e : activeCell === null || activeCell === void 0 ? void 0 : activeCell.rowIndex
|
|
1012
|
+
: (_f = cellSelectionRange === null || cellSelectionRange === void 0 ? void 0 : cellSelectionRange.startColumnIndex) !== null && _f !== void 0 ? _f : activeCell === null || activeCell === void 0 ? void 0 : activeCell.columnIndex;
|
|
968
1013
|
var startIndex = isRangeExtension ? activeRangeStart !== null && activeRangeStart !== void 0 ? activeRangeStart : axisTarget.startIndex : axisTarget.startIndex;
|
|
969
1014
|
var endIndex = axisTarget.startIndex < startIndex ? axisTarget.startIndex : axisTarget.endIndex;
|
|
970
1015
|
var baseRanges = isAdditiveSelection
|
|
@@ -999,7 +1044,7 @@ function Table(props) {
|
|
|
999
1044
|
}
|
|
1000
1045
|
var cellPosition = toLogicalCellPosition(physicalCellPosition);
|
|
1001
1046
|
evt.preventDefault();
|
|
1002
|
-
(
|
|
1047
|
+
(_g = containerRef.current) === null || _g === void 0 ? void 0 : _g.focus({ preventScroll: true });
|
|
1003
1048
|
var clickedCell = {
|
|
1004
1049
|
rowIndex: cellPosition.rowIndex,
|
|
1005
1050
|
columnIndex: cellPosition.columnIndex,
|
|
@@ -1012,10 +1057,10 @@ function Table(props) {
|
|
|
1012
1057
|
var isAdditiveSelection = evt.metaKey || evt.ctrlKey;
|
|
1013
1058
|
var isRangeExtension = evt.shiftKey && (cellSelectionRange || activeCell);
|
|
1014
1059
|
var startRowIndex = isRangeExtension
|
|
1015
|
-
? (
|
|
1060
|
+
? (_j = (_h = cellSelectionRange === null || cellSelectionRange === void 0 ? void 0 : cellSelectionRange.startRowIndex) !== null && _h !== void 0 ? _h : activeCell === null || activeCell === void 0 ? void 0 : activeCell.rowIndex) !== null && _j !== void 0 ? _j : cellPosition.rowIndex
|
|
1016
1061
|
: cellPosition.rowIndex;
|
|
1017
1062
|
var startColumnIndex = isRangeExtension
|
|
1018
|
-
? (
|
|
1063
|
+
? (_l = (_k = cellSelectionRange === null || cellSelectionRange === void 0 ? void 0 : cellSelectionRange.startColumnIndex) !== null && _k !== void 0 ? _k : activeCell === null || activeCell === void 0 ? void 0 : activeCell.columnIndex) !== null && _l !== void 0 ? _l : cellPosition.columnIndex
|
|
1019
1064
|
: cellPosition.columnIndex;
|
|
1020
1065
|
var startRowSpan = isRangeExtension
|
|
1021
1066
|
? Math.abs(cellPosition.rowIndex - startRowIndex) + 1
|
|
@@ -1506,6 +1551,8 @@ function Table(props) {
|
|
|
1506
1551
|
setFooterHeight(props.footerHeight);
|
|
1507
1552
|
if (props.summaryHeight !== undefined)
|
|
1508
1553
|
setSummaryHeight(props.summaryHeight);
|
|
1554
|
+
if (props.summaryRowHeight !== undefined)
|
|
1555
|
+
setSummaryRowHeight(props.summaryRowHeight);
|
|
1509
1556
|
if (props.itemHeight !== undefined)
|
|
1510
1557
|
setItemHeight(props.itemHeight);
|
|
1511
1558
|
if (props.itemPadding !== undefined)
|
|
@@ -1515,12 +1562,14 @@ function Table(props) {
|
|
|
1515
1562
|
props.headerHeight,
|
|
1516
1563
|
props.footerHeight,
|
|
1517
1564
|
props.summaryHeight,
|
|
1565
|
+
props.summaryRowHeight,
|
|
1518
1566
|
props.itemHeight,
|
|
1519
1567
|
props.itemPadding,
|
|
1520
1568
|
setWidth,
|
|
1521
1569
|
setHeaderHeight,
|
|
1522
1570
|
setFooterHeight,
|
|
1523
1571
|
setSummaryHeight,
|
|
1572
|
+
setSummaryRowHeight,
|
|
1524
1573
|
setItemHeight,
|
|
1525
1574
|
setItemPadding,
|
|
1526
1575
|
]);
|
|
@@ -2098,6 +2147,19 @@ function Table(props) {
|
|
|
2098
2147
|
var activeElement = document.activeElement;
|
|
2099
2148
|
if (!container || (activeElement !== container && !container.contains(activeElement)))
|
|
2100
2149
|
return;
|
|
2150
|
+
var target = evt.target instanceof Element ? evt.target : null;
|
|
2151
|
+
var detailOwner = target === null || target === void 0 ? void 0 : target.closest('[data-bgrid-detail-owner]');
|
|
2152
|
+
if (detailOwner && container.contains(detailOwner))
|
|
2153
|
+
return;
|
|
2154
|
+
var activeDetailOwner = activeElement instanceof Element ? activeElement.closest('[data-bgrid-detail-owner]') : null;
|
|
2155
|
+
if (activeDetailOwner && container.contains(activeDetailOwner))
|
|
2156
|
+
return;
|
|
2157
|
+
var targetGrid = target === null || target === void 0 ? void 0 : target.closest('[role="grid"], [role="treegrid"]');
|
|
2158
|
+
if (targetGrid && targetGrid !== container && container.contains(targetGrid))
|
|
2159
|
+
return;
|
|
2160
|
+
var activeGrid = activeElement instanceof Element ? activeElement.closest('[role="grid"], [role="treegrid"]') : null;
|
|
2161
|
+
if (activeGrid && activeGrid !== container && container.contains(activeGrid))
|
|
2162
|
+
return;
|
|
2101
2163
|
if (disabled) {
|
|
2102
2164
|
stopArrowRepeat();
|
|
2103
2165
|
return;
|
|
@@ -2111,7 +2173,7 @@ function Table(props) {
|
|
|
2111
2173
|
evt.stopPropagation();
|
|
2112
2174
|
requestSearchOpen(true, 'shortcut');
|
|
2113
2175
|
setTimeout(function () {
|
|
2114
|
-
var input = container.
|
|
2176
|
+
var input = Array.from(container.querySelectorAll('.bgrid-search-input')).find(function (el) { return el.closest('[role="grid"], [role="treegrid"]') === container; });
|
|
2115
2177
|
input === null || input === void 0 ? void 0 : input.focus({ preventScroll: true });
|
|
2116
2178
|
input === null || input === void 0 ? void 0 : input.select();
|
|
2117
2179
|
}, searchOpen ? 0 : 1);
|
|
@@ -2122,7 +2184,7 @@ function Table(props) {
|
|
|
2122
2184
|
return;
|
|
2123
2185
|
var isShift = evt.shiftKey;
|
|
2124
2186
|
if (!cellInteractionSession && activeCell && (evt.key === 'ContextMenu' || (isShift && evt.key === 'F10'))) {
|
|
2125
|
-
var targetCell = container.
|
|
2187
|
+
var targetCell = Array.from(container.querySelectorAll("td[data-bgrid-cell=\"true\"][data-row-index=\"".concat(activeCell.rowIndex, "\"][data-column-index=\"").concat(activeCell.columnIndex, "\"]"))).find(function (el) { return el.closest('[role="grid"], [role="treegrid"]') === container; });
|
|
2126
2188
|
var rect = targetCell === null || targetCell === void 0 ? void 0 : targetCell.getBoundingClientRect();
|
|
2127
2189
|
if (rect && openCellContextMenu(activeCell, rect.left + 8, rect.top + Math.min(rect.height, 20), true)) {
|
|
2128
2190
|
evt.preventDefault();
|
|
@@ -2325,6 +2387,19 @@ function Table(props) {
|
|
|
2325
2387
|
var activeElement = document.activeElement;
|
|
2326
2388
|
if (!container || (activeElement !== container && !container.contains(activeElement)))
|
|
2327
2389
|
return;
|
|
2390
|
+
var target = evt.target instanceof Element ? evt.target : null;
|
|
2391
|
+
var detailOwner = target === null || target === void 0 ? void 0 : target.closest('[data-bgrid-detail-owner]');
|
|
2392
|
+
if (detailOwner && container.contains(detailOwner))
|
|
2393
|
+
return;
|
|
2394
|
+
var activeDetailOwner = activeElement instanceof Element ? activeElement.closest('[data-bgrid-detail-owner]') : null;
|
|
2395
|
+
if (activeDetailOwner && container.contains(activeDetailOwner))
|
|
2396
|
+
return;
|
|
2397
|
+
var targetGrid = target === null || target === void 0 ? void 0 : target.closest('[role="grid"], [role="treegrid"]');
|
|
2398
|
+
if (targetGrid && targetGrid !== container && container.contains(targetGrid))
|
|
2399
|
+
return;
|
|
2400
|
+
var activeGrid = activeElement instanceof Element ? activeElement.closest('[role="grid"], [role="treegrid"]') : null;
|
|
2401
|
+
if (activeGrid && activeGrid !== container && container.contains(activeGrid))
|
|
2402
|
+
return;
|
|
2328
2403
|
if (keyboardRuntimeRef.current.disabled)
|
|
2329
2404
|
return;
|
|
2330
2405
|
if (isInteractiveTarget(evt.target))
|
|
@@ -2338,6 +2413,19 @@ function Table(props) {
|
|
|
2338
2413
|
var activeElement = document.activeElement;
|
|
2339
2414
|
if (!container || (activeElement !== container && !container.contains(activeElement)))
|
|
2340
2415
|
return;
|
|
2416
|
+
var target = evt.target instanceof Element ? evt.target : null;
|
|
2417
|
+
var detailOwner = target === null || target === void 0 ? void 0 : target.closest('[data-bgrid-detail-owner]');
|
|
2418
|
+
if (detailOwner && container.contains(detailOwner))
|
|
2419
|
+
return;
|
|
2420
|
+
var activeDetailOwner = activeElement instanceof Element ? activeElement.closest('[data-bgrid-detail-owner]') : null;
|
|
2421
|
+
if (activeDetailOwner && container.contains(activeDetailOwner))
|
|
2422
|
+
return;
|
|
2423
|
+
var targetGrid = target === null || target === void 0 ? void 0 : target.closest('[role="grid"], [role="treegrid"]');
|
|
2424
|
+
if (targetGrid && targetGrid !== container && container.contains(targetGrid))
|
|
2425
|
+
return;
|
|
2426
|
+
var activeGrid = activeElement instanceof Element ? activeElement.closest('[role="grid"], [role="treegrid"]') : null;
|
|
2427
|
+
if (activeGrid && activeGrid !== container && container.contains(activeGrid))
|
|
2428
|
+
return;
|
|
2341
2429
|
if (keyboardRuntimeRef.current.disabled)
|
|
2342
2430
|
return;
|
|
2343
2431
|
if (keyboardRuntimeRef.current.editItemIndex !== undefined && keyboardRuntimeRef.current.editItemIndex >= 0) {
|
|
@@ -2356,13 +2444,23 @@ function Table(props) {
|
|
|
2356
2444
|
}
|
|
2357
2445
|
};
|
|
2358
2446
|
var handlePointerDown = function (evt) {
|
|
2359
|
-
var _a = keyboardRuntimeRef.current, clearCellSelection = _a.clearCellSelection, clearCellSelectionOnOutsideClick = _a.clearCellSelectionOnOutsideClick, endCellSelectionDrag = _a.endCellSelectionDrag;
|
|
2360
|
-
if (!clearCellSelectionOnOutsideClick)
|
|
2361
|
-
return;
|
|
2362
2447
|
var container = containerRef.current;
|
|
2363
2448
|
var target = evt.target;
|
|
2364
|
-
if (!container
|
|
2365
|
-
|
|
2449
|
+
if (!container)
|
|
2450
|
+
return;
|
|
2451
|
+
var detailOwner = target instanceof Element ? target.closest('[data-bgrid-detail-owner]') : null;
|
|
2452
|
+
var targetGrid = target instanceof Element ? target.closest('[role="grid"], [role="treegrid"]') : null;
|
|
2453
|
+
if ((detailOwner && container.contains(detailOwner)) ||
|
|
2454
|
+
(targetGrid && targetGrid !== container && container.contains(targetGrid))) {
|
|
2455
|
+
var _a = keyboardRuntimeRef.current, clearCellSelection_1 = _a.clearCellSelection, endCellSelectionDrag_1 = _a.endCellSelectionDrag;
|
|
2456
|
+
endCellSelectionDrag_1();
|
|
2457
|
+
clearCellSelection_1();
|
|
2458
|
+
return;
|
|
2459
|
+
}
|
|
2460
|
+
var _b = keyboardRuntimeRef.current, clearCellSelection = _b.clearCellSelection, clearCellSelectionOnOutsideClick = _b.clearCellSelectionOnOutsideClick, endCellSelectionDrag = _b.endCellSelectionDrag;
|
|
2461
|
+
if (!clearCellSelectionOnOutsideClick)
|
|
2462
|
+
return;
|
|
2463
|
+
if ((target instanceof Node && container.contains(target)) ||
|
|
2366
2464
|
isPointInsideElement(container, evt.clientX, evt.clientY)) {
|
|
2367
2465
|
return;
|
|
2368
2466
|
}
|
|
@@ -2391,7 +2489,7 @@ function Table(props) {
|
|
|
2391
2489
|
React.createElement(Container, { ref: containerRef, role: props.treeEnabled ? 'treegrid' : 'grid', style: __assign(__assign({}, style), (_a = { width: width, height: height, borderWidth: "".concat(containerBorderWidth, "px") }, _a['--bgrid-virtual-row-height'] = "".concat(trHeight, "px"), _a)), className: className, tabIndex: 0, "aria-disabled": disabled ? 'true' : undefined, onFocus: function (event) {
|
|
2392
2490
|
if (event.target !== event.currentTarget)
|
|
2393
2491
|
return;
|
|
2394
|
-
var gateway = event.currentTarget.
|
|
2492
|
+
var gateway = Array.from(event.currentTarget.querySelectorAll('[data-bgrid-text-editor-gateway="true"]')).find(function (el) { return el.closest('[role="grid"], [role="treegrid"]') === event.currentTarget; });
|
|
2395
2493
|
if (gateway instanceof HTMLInputElement) {
|
|
2396
2494
|
gateway.focus({ preventScroll: true });
|
|
2397
2495
|
}
|
|
@@ -2403,11 +2501,19 @@ function Table(props) {
|
|
|
2403
2501
|
} },
|
|
2404
2502
|
React.createElement(scrollbar_1.CustomScrollbar, { orientation: 'vertical', variant: scrollbar.variant, metrics: scrollbarMetrics.vertical, scrollOffset: scrollTop, onScrollChange: handleScrollTopChange }))),
|
|
2405
2503
|
React.createElement(ScrollContainer, { ref: scrollContainerRef, role: 'rfdg-scroll-container', "data-bgrid-scroll-plane": 'sticky', style: { height: scrollViewportHeight }, onPointerDownCapture: onBodyPointerDownCapture, onPointerOverCapture: onBodyPointerOverCapture, onPointerLeave: onBodyPointerLeave, onContextMenuCapture: function (event) {
|
|
2504
|
+
var _a, _b;
|
|
2406
2505
|
if (disabled)
|
|
2407
2506
|
return;
|
|
2507
|
+
var target = event.target instanceof HTMLElement ? event.target : null;
|
|
2508
|
+
var detailOwner = target === null || target === void 0 ? void 0 : target.closest('[data-bgrid-detail-owner]');
|
|
2509
|
+
if (detailOwner && ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(detailOwner)))
|
|
2510
|
+
return;
|
|
2511
|
+
var targetGrid = target === null || target === void 0 ? void 0 : target.closest('[role="grid"], [role="treegrid"]');
|
|
2512
|
+
if (targetGrid && targetGrid !== containerRef.current && ((_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.contains(targetGrid)))
|
|
2513
|
+
return;
|
|
2408
2514
|
if (isInteractiveTarget(event.target))
|
|
2409
2515
|
return;
|
|
2410
|
-
var cell = getCellPosition(
|
|
2516
|
+
var cell = getCellPosition(target, containerRef.current);
|
|
2411
2517
|
if (!cell)
|
|
2412
2518
|
return;
|
|
2413
2519
|
if (openCellContextMenu(cell, event.clientX, event.clientY, false)) {
|
|
@@ -2428,8 +2534,8 @@ function Table(props) {
|
|
|
2428
2534
|
React.createElement(TableSummary_1.TableSummary, { position: 'top' })))),
|
|
2429
2535
|
React.createElement("div", { className: 'bgrid-virtual-row-backdrop', "aria-hidden": 'true', style: {
|
|
2430
2536
|
top: stickyTopHeight,
|
|
2431
|
-
height:
|
|
2432
|
-
marginBottom: -
|
|
2537
|
+
height: effectiveBodyHeight,
|
|
2538
|
+
marginBottom: -effectiveBodyHeight,
|
|
2433
2539
|
} }),
|
|
2434
2540
|
React.createElement("div", { className: 'bgrid-body-scroll-content', style: { height: virtualScrollWindowMetrics.physicalContentHeight } },
|
|
2435
2541
|
frozenRowCount > 0 && (React.createElement("div", { className: 'bgrid-frozen-rows-layer', style: { height: frozenRowsHeight, top: stickyTopHeight }, "data-bgrid-row-band": 'frozen' },
|
|
@@ -2437,7 +2543,7 @@ function Table(props) {
|
|
|
2437
2543
|
React.createElement(TableBodyFrozen_1.default, { rowKeyRegistry: rowKeyRegistry, rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: frozenRowRange, role: 'rfdg-body-top-frozen', quadrant: 'top-left', allowRowReorder: false }),
|
|
2438
2544
|
renderSelectionOverlay('top-left'))),
|
|
2439
2545
|
React.createElement("div", { className: 'bgrid-frozen-rows-main', style: { left: frozenColumnsWidth }, role: 'rfdg-frozen-rows-main' },
|
|
2440
|
-
React.createElement(TableBody_1.default, { rowKeyRegistry: rowKeyRegistry, rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: frozenRowRange, role: 'rfdg-body-top', quadrant: 'top-main', allowRowReorder: false }),
|
|
2546
|
+
React.createElement(TableBody_1.default, { rowKeyRegistry: rowKeyRegistry, rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: frozenRowRange, role: 'rfdg-body-top', quadrant: 'top-main', allowRowReorder: false, viewportWidth: mainViewportWidth }),
|
|
2441
2547
|
renderSelectionOverlay('top-main')))),
|
|
2442
2548
|
React.createElement("div", { className: 'bgrid-scrollable-rows-layer', style: { height: physicalScrollableRowsHeight }, "data-bgrid-row-band": 'scrollable' },
|
|
2443
2549
|
(frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement(FrozenScrollContent, { style: {
|
|
@@ -2453,7 +2559,7 @@ function Table(props) {
|
|
|
2453
2559
|
: visibleScrollableRows.paddingTop,
|
|
2454
2560
|
height: physicalScrollableRowsHeight,
|
|
2455
2561
|
} },
|
|
2456
|
-
React.createElement(TableBody_1.default, { rowKeyRegistry: rowKeyRegistry, rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: scrollableRowRange, quadrant: 'body-main' }),
|
|
2562
|
+
React.createElement(TableBody_1.default, { rowKeyRegistry: rowKeyRegistry, rowHeightMetrics: rowHeightMetrics, scrollContainerRef: scrollContainerRef, rowRange: scrollableRowRange, quadrant: 'body-main', viewportWidth: mainViewportWidth }),
|
|
2457
2563
|
renderSelectionOverlay('body-main')))),
|
|
2458
2564
|
summary && summary.position === 'bottom' && (React.createElement(SummaryContainer, { position: 'bottom', style: { height: summaryHeight, bottom: 0 }, role: 'rfdg-summary-container' },
|
|
2459
2565
|
(frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement(FrozenSummary, { style: { width: frozenColumnsWidth }, role: 'rfdg-frozen-summary' },
|
|
@@ -2474,18 +2580,20 @@ function Table(props) {
|
|
|
2474
2580
|
React.createElement(Loading_1.default, { active: loading }))));
|
|
2475
2581
|
}
|
|
2476
2582
|
function getAxisSelectionTarget(target, container) {
|
|
2477
|
-
if (!target || !container)
|
|
2583
|
+
if (!target || !container || !(target instanceof Element))
|
|
2478
2584
|
return undefined;
|
|
2479
2585
|
var lineNumberCell = target.closest('.bgrid-line-number-cell[data-row-index]');
|
|
2480
|
-
if (lineNumberCell instanceof HTMLElement &&
|
|
2586
|
+
if (lineNumberCell instanceof HTMLElement && lineNumberCell.closest('[role="grid"], [role="treegrid"]') === container) {
|
|
2481
2587
|
var rowIndex = Number(lineNumberCell.dataset.rowIndex);
|
|
2482
2588
|
if (Number.isFinite(rowIndex)) {
|
|
2483
2589
|
return { axis: 'row', startIndex: rowIndex, endIndex: rowIndex };
|
|
2484
2590
|
}
|
|
2485
2591
|
}
|
|
2486
2592
|
var headerCell = target.closest('[data-header-cell-type][data-column-index][data-bgrid-axis-selectable="true"]');
|
|
2487
|
-
if (!(headerCell instanceof HTMLTableCellElement) ||
|
|
2593
|
+
if (!(headerCell instanceof HTMLTableCellElement) ||
|
|
2594
|
+
headerCell.closest('[role="grid"], [role="treegrid"]') !== container) {
|
|
2488
2595
|
return undefined;
|
|
2596
|
+
}
|
|
2489
2597
|
if (target.closest('.bgrid-col-resizer, .bgrid-toolbox-trigger-btn'))
|
|
2490
2598
|
return undefined;
|
|
2491
2599
|
if (headerCell.classList.contains('drag-item') && target.closest('.bgrid-column-drag-handle'))
|
|
@@ -2523,8 +2631,10 @@ function updateAxisSelectionDragRange(dragState, activeRange) {
|
|
|
2523
2631
|
return nextRanges;
|
|
2524
2632
|
}
|
|
2525
2633
|
function getCellPosition(target, container) {
|
|
2526
|
-
|
|
2527
|
-
|
|
2634
|
+
if (!target || !(target instanceof Element))
|
|
2635
|
+
return undefined;
|
|
2636
|
+
var cell = target.closest('td[data-bgrid-cell="true"]');
|
|
2637
|
+
if (!(cell instanceof HTMLElement) || cell.closest('[role="grid"], [role="treegrid"]') !== container)
|
|
2528
2638
|
return undefined;
|
|
2529
2639
|
var rowIndex = Number(cell.dataset.rowIndex);
|
|
2530
2640
|
var columnIndex = Number(cell.dataset.columnIndex);
|
|
@@ -70,6 +70,7 @@ var TableColGroup_1 = __importDefault(require("./TableColGroup"));
|
|
|
70
70
|
var TableColGroupFrozen_1 = __importDefault(require("./TableColGroupFrozen"));
|
|
71
71
|
var utils_1 = require("../utils");
|
|
72
72
|
var TableBodyRow_1 = require("./TableBodyRow");
|
|
73
|
+
var MasterDetailCell_1 = require("./MasterDetailCell");
|
|
73
74
|
var types_1 = require("../types");
|
|
74
75
|
function getVisibleColumnRange(columns, firstScrollableColumnIndex, scrollLeft, viewportWidth) {
|
|
75
76
|
var _a, _b, _c;
|
|
@@ -170,7 +171,7 @@ function getRowReactKey(item, sourceIndex, rowKey, registry) {
|
|
|
170
171
|
}
|
|
171
172
|
function TableBody(_a) {
|
|
172
173
|
var _b, _c;
|
|
173
|
-
var rowKeyRegistry = _a.rowKeyRegistry, _d = _a.region, region = _d === void 0 ? 'main' : _d, rowRange = _a.rowRange, style = _a.style, role = _a.role, quadrant = _a.quadrant, _e = _a.allowRowReorder, allowRowReorder = _e === void 0 ? true : _e, onRowReorderPointerDown = _a.onRowReorderPointerDown, onRowReorderKeyDown = _a.onRowReorderKeyDown, rowHeightMetrics = _a.rowHeightMetrics;
|
|
174
|
+
var rowKeyRegistry = _a.rowKeyRegistry, _d = _a.region, region = _d === void 0 ? 'main' : _d, rowRange = _a.rowRange, style = _a.style, role = _a.role, quadrant = _a.quadrant, _e = _a.allowRowReorder, allowRowReorder = _e === void 0 ? true : _e, onRowReorderPointerDown = _a.onRowReorderPointerDown, onRowReorderKeyDown = _a.onRowReorderKeyDown, rowHeightMetrics = _a.rowHeightMetrics, viewportWidth = _a.viewportWidth;
|
|
174
175
|
var isLeftRegion = region === 'left';
|
|
175
176
|
// [Selector Group 1] Scroll & Dimensions - 스크롤 및 차원
|
|
176
177
|
var _f = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
|
|
@@ -260,7 +261,7 @@ function TableBody(_a) {
|
|
|
260
261
|
isLeftRegion ? React.createElement(TableColGroupFrozen_1.default, null) : React.createElement(TableColGroup_1.default, null),
|
|
261
262
|
React.createElement("tbody", { role: role !== null && role !== void 0 ? role : (isLeftRegion ? 'rfdg-body-frozen' : 'rfdg-body') },
|
|
262
263
|
dataSet.map(function (item, i) {
|
|
263
|
-
var _a, _b, _c, _d;
|
|
264
|
+
var _a, _b, _c, _d, _e, _f;
|
|
264
265
|
var ri = startIdx + i;
|
|
265
266
|
var resolvedRowHeight = (_a = rowHeightMetrics === null || rowHeightMetrics === void 0 ? void 0 : rowHeightMetrics.heights[ri]) !== null && _a !== void 0 ? _a : trHeight;
|
|
266
267
|
var rowStatus = getRowStatusLabel(item.status);
|
|
@@ -294,7 +295,10 @@ function TableBody(_a) {
|
|
|
294
295
|
var isRowEditing = (cellInteractionSession === null || cellInteractionSession === void 0 ? void 0 : cellInteractionSession.kind) === 'editor' &&
|
|
295
296
|
(cellInteractionSession.cell.rowIndex === ri || cellInteractionSession.hostCell.rowIndex === ri);
|
|
296
297
|
var rowReactKey = getRowReactKey(item, sourceIndex, rowKey, rowKeyRegistry);
|
|
297
|
-
|
|
298
|
+
var detailHeight = (_e = (_d = rowHeightMetrics === null || rowHeightMetrics === void 0 ? void 0 : rowHeightMetrics.detailHeights) === null || _d === void 0 ? void 0 : _d[ri]) !== null && _e !== void 0 ? _e : 0;
|
|
299
|
+
return (React.createElement(React.Fragment, { key: rowReactKey },
|
|
300
|
+
React.createElement(TableBodyRow_1.TableBodyRow, { item: item, data: data, ri: ri, sourceIndex: sourceIndex, columns: columns, startCIdx: startCIdx, endCIdx: endCIdx, frozenColumnIndex: frozenColumnIndex, isLeftRegion: isLeftRegion, showLineNumber: showLineNumber !== null && showLineNumber !== void 0 ? showLineNumber : false, hasRowChecked: hasRowChecked, isRadio: Boolean(isRadio), checked: checkedAll === true || checkedIndexesMap.get(sourceIndex), rowCheckedDisabled: Boolean(disabled || ((_f = rowChecked === null || rowChecked === void 0 ? void 0 : rowChecked.disabled) === null || _f === void 0 ? void 0 : _f.call(rowChecked, sourceIndex, item))), rowStatus: rowStatus, active: active, className: className, resolvedRowHeight: resolvedRowHeight, itemHeight: itemHeight, itemPadding: itemPadding, editable: Boolean(editable), disabled: Boolean(disabled), editTrigger: editTrigger, hasOnClick: hasOnClick, cellMergeOptions: cellMergeOptions, mergeColumns: mergeColumns, odd: !mergeColumns ? ri % 2 === 0 : undefined, variant: variant, rowReorderEnabled: rowReorderEnabled, rowReorderRole: rowReorderRole, rowReorderPhase: reorderingInfo === null || reorderingInfo === void 0 ? void 0 : reorderingInfo.phase, rowReorderDirection: rowReorderDirection, rowReorderOffset: rowReorderOffset, reorder: reorder, reorderingInfo: reorderingInfo, searchMatchTokens: searchMatchTokens, currentSearchToken: currentSearchToken, isRowEditing: isRowEditing, cellInteractionSession: isRowEditing ? cellInteractionSession : undefined, handleClick: handleClick, setEditItem: setEditItem, setItemValue: setItemValue, handleMoveEditFocus: handleMoveEditFocus, handleChangeChecked: handleChangeChecked, handleChangeCheckedRadio: handleChangeCheckedRadio, getRowSpan: getRowSpan, onRowReorderPointerDown: onRowReorderPointerDown, onRowReorderKeyDown: onRowReorderKeyDown }),
|
|
301
|
+
detailHeight > 0 && (React.createElement(MasterDetailCell_1.MasterDetailRow, { item: item, sourceIndex: sourceIndex, visibleIndex: ri, detailHeight: detailHeight, isLeftRegion: isLeftRegion, viewportWidth: viewportWidth !== null && viewportWidth !== void 0 ? viewportWidth : Math.max(width - (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0), 0), frozenColumnsWidth: frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0, colSpan: isLeftRegion ? Math.max(frozenColumnIndex, 1) : Math.max(columns.length - frozenColumnIndex, 1) }))));
|
|
298
302
|
}),
|
|
299
303
|
endNumber - startIdx < 1 &&
|
|
300
304
|
(isLeftRegion ? (React.createElement(NoDataTr, { itemHeight: itemHeight, itemPadding: itemPadding })) : (React.createElement(NoDataTr, { itemHeight: itemHeight, itemPadding: itemPadding }, (msg === null || msg === void 0 ? void 0 : msg.emptyList) ? (React.createElement(React.Fragment, null,
|
|
@@ -39,6 +39,7 @@ var PluginCellEditor_1 = require("./PluginCellEditor");
|
|
|
39
39
|
var CellEditorIcon_1 = require("./CellEditorIcon");
|
|
40
40
|
var CheckboxCellEditor_1 = require("./CheckboxCellEditor");
|
|
41
41
|
var TreeCell_1 = require("./TreeCell");
|
|
42
|
+
var MasterDetailCell_1 = require("./MasterDetailCell");
|
|
42
43
|
function Cell(_a) {
|
|
43
44
|
var _b, _c, _d;
|
|
44
45
|
var index = _a.index, _e = _a.hostIndex, hostIndex = _e === void 0 ? index : _e, columnIndex = _a.columnIndex, column = _a.column, item = _a.item, valueByRowKey = _a.valueByRowKey, handleSave = _a.handleSave, handleCancel = _a.handleCancel, handleMove = _a.handleMove, editable = _a.editable, cellEditable = _a.cellEditable, _f = _a.interactionEditing, interactionEditing = _f === void 0 ? false : _f, editSession = _a.editSession;
|
|
@@ -75,7 +76,7 @@ function Cell(_a) {
|
|
|
75
76
|
content = renderSafeCellValue(valueByRowKey);
|
|
76
77
|
}
|
|
77
78
|
return (React.createElement("div", { className: isPluginEditorActive ? 'bgrid-cell-content bgrid-cell-content-plugin-editor' : 'bgrid-cell-content' },
|
|
78
|
-
React.createElement("div", { className: 'bgrid-cell-value' }, column.treeCell ? (React.createElement(TreeCell_1.TreeCell, { column: column, item: item }, content)) : (content)),
|
|
79
|
+
React.createElement("div", { className: 'bgrid-cell-value' }, column.treeCell ? (React.createElement(TreeCell_1.TreeCell, { column: column, item: item }, content)) : column.masterDetailCell ? (React.createElement(MasterDetailCell_1.MasterDetailCell, { column: column, item: item, sourceIndex: index }, content)) : (content)),
|
|
79
80
|
column.editorIcon && ((_d = column.editor) === null || _d === void 0 ? void 0 : _d.type) !== 'checkbox' && cellEditable && (React.createElement(CellEditorIcon_1.CellEditorIcon, { hostCell: { rowIndex: hostIndex, columnIndex: columnIndex }, index: index, columnIndex: columnIndex, column: column, item: item, value: valueByRowKey, editing: interactionEditing }))));
|
|
80
81
|
}
|
|
81
82
|
function renderSafeCellValue(value, preserveRenderableArrays) {
|