beautiful-grid 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/BGrid.js +15 -5
- package/cjs/components/Table.js +8 -2
- package/cjs/components/TableSummary.js +25 -34
- package/cjs/components/TableSummaryFronzen.js +36 -34
- package/cjs/store/createAppStore.js +2 -0
- package/cjs/utils/columnVisibility.js +17 -14
- package/cjs/utils/index.js +1 -0
- package/cjs/utils/summary.js +55 -0
- package/esm/BGrid.js +14 -6
- package/esm/components/Table.js +8 -2
- package/esm/components/TableSummary.js +26 -29
- package/esm/components/TableSummaryFronzen.js +26 -29
- package/esm/store/createAppStore.js +2 -0
- package/esm/utils/columnVisibility.js +21 -18
- package/esm/utils/index.js +1 -0
- package/esm/utils/summary.js +35 -0
- package/package.json +1 -1
- package/style.css +8 -3
- package/types/BGrid.d.ts +1 -1
- package/types/components/Table.d.ts +1 -0
- package/types/store/createAppStore.d.ts +1 -1
- package/types/types.d.ts +18 -4
- package/types/utils/index.d.ts +1 -0
- package/types/utils/summary.d.ts +13 -0
package/cjs/BGrid.js
CHANGED
|
@@ -93,7 +93,7 @@ function computeModelColumns(columns, frozenColumnIndex, duplicateToolboxColumnI
|
|
|
93
93
|
}
|
|
94
94
|
function BGrid(_a) {
|
|
95
95
|
var _b, _c, _d, _e;
|
|
96
|
-
var ref = _a.ref, width = _a.width, height = _a.height, _f = _a.headerHeight, headerHeight = _f === void 0 ? 30 : _f, footerHeight = _a.footerHeight,
|
|
96
|
+
var ref = _a.ref, width = _a.width, height = _a.height, _f = _a.headerHeight, headerHeight = _f === void 0 ? 30 : _f, footerHeight = _a.footerHeight, explicitSummaryHeight = _a.summaryHeight, _g = _a.summaryRowHeight, summaryRowHeight = _g === void 0 ? utils_1.DEFAULT_SUMMARY_ROW_HEIGHT : _g, _h = _a.itemHeight, itemHeight = _h === void 0 ? 15 : _h, _j = _a.itemPadding, itemPadding = _j === void 0 ? 7 : _j, getRowHeight = _a.getRowHeight, columns = _a.columns, columnsGroup = _a.columnsGroup, columnGroups = _a.columnGroups, onChangeColumns = _a.onChangeColumns, _k = _a.frozenColumnIndex, frozenColumnIndex = _k === void 0 ? 0 : _k, _l = _a.frozenRowCount, frozenRowCount = _l === void 0 ? 0 : _l, _m = _a.data, data = _m === void 0 ? [] : _m, page = _a.page, scrollbar = _a.scrollbar, status = _a.status, pagination = _a.pagination, bottomBarHeight = _a.bottomBarHeight, _o = _a.scrollTop, scrollTop = _o === void 0 ? 0 : _o, _p = _a.scrollLeft, scrollLeft = _p === void 0 ? 0 : _p, className = _a.className, style = _a.style, rowChecked = _a.rowChecked, sort = _a.sort, onClick = _a.onClick, _q = _a.loading, loading = _q === void 0 ? false : _q, spinning = _a.spinning, disabled = _a.disabled, rowKey = _a.rowKey, selectedRowKey = _a.selectedRowKey, editable = _a.editable, onChangeData = _a.onChangeData, showLineNumber = _a.showLineNumber, msg = _a.msg, getRowClassName = _a.getRowClassName, _r = _a.editTrigger, editTrigger = _r === void 0 ? 'dblclick' : _r, cellMergeOptions = _a.cellMergeOptions, cellSelectionOptions = _a.cellSelectionOptions, cellNavigationOptions = _a.cellNavigationOptions, variant = _a.variant, summary = _a.summary, columnSortable = _a.columnSortable, reorder = _a.reorder, pivot = _a.pivot, dataControl = _a.dataControl, icons = _a.icons, columnVisibility = _a.columnVisibility, searchOptions = _a.searchOptions, contextMenuOptions = _a.contextMenuOptions, tree = _a.tree;
|
|
97
97
|
var _s = __read(React.useState(function () {
|
|
98
98
|
var _a;
|
|
99
99
|
return __spreadArray([], __read(((_a = tree === null || tree === void 0 ? void 0 : tree.defaultExpandedRowKeys) !== null && _a !== void 0 ? _a : [])), false);
|
|
@@ -608,6 +608,13 @@ function BGrid(_a) {
|
|
|
608
608
|
console.warn('[BGrid] Both bottomBarHeight and footerHeight were provided. bottomBarHeight takes precedence.');
|
|
609
609
|
}
|
|
610
610
|
}, [bottomBarHeight, footerHeight]);
|
|
611
|
+
var resolvedSummaryHeight = React.useMemo(function () {
|
|
612
|
+
return (0, utils_1.computeSummaryHeight)({
|
|
613
|
+
summary: resolvedSummary,
|
|
614
|
+
summaryHeight: explicitSummaryHeight,
|
|
615
|
+
summaryRowHeight: summaryRowHeight,
|
|
616
|
+
});
|
|
617
|
+
}, [resolvedSummary, explicitSummaryHeight, summaryRowHeight]);
|
|
611
618
|
var initialStoreState = React.useMemo(function () {
|
|
612
619
|
var _a, _b, _c;
|
|
613
620
|
var initialWidth = width !== undefined ? Math.max(width, 100) : 0;
|
|
@@ -617,7 +624,7 @@ function BGrid(_a) {
|
|
|
617
624
|
? Math.max(initialHeight -
|
|
618
625
|
headerHeight -
|
|
619
626
|
(initialShowBottomBar ? resolvedBottomBarHeight : 0) -
|
|
620
|
-
(resolvedSummary ?
|
|
627
|
+
(resolvedSummary ? resolvedSummaryHeight : 0) -
|
|
621
628
|
containerBorderWidth * 2, 0)
|
|
622
629
|
: 0;
|
|
623
630
|
var displayItemCount = contentBodyHeight > 0 ? Math.ceil(contentBodyHeight / (itemHeight + itemPadding * 2)) : 0;
|
|
@@ -638,7 +645,8 @@ function BGrid(_a) {
|
|
|
638
645
|
scrollbar: resolvedScrollbar,
|
|
639
646
|
status: resolvedStatus,
|
|
640
647
|
pagination: resolvedPagination,
|
|
641
|
-
summaryHeight:
|
|
648
|
+
summaryHeight: resolvedSummaryHeight,
|
|
649
|
+
summaryRowHeight: summaryRowHeight,
|
|
642
650
|
itemHeight: itemHeight,
|
|
643
651
|
itemPadding: itemPadding,
|
|
644
652
|
frozenColumnIndex: resolvedFrozenColumnIndex,
|
|
@@ -709,7 +717,8 @@ function BGrid(_a) {
|
|
|
709
717
|
resolvedScrollbar,
|
|
710
718
|
resolvedStatus,
|
|
711
719
|
resolvedPagination,
|
|
712
|
-
|
|
720
|
+
resolvedSummaryHeight,
|
|
721
|
+
summaryRowHeight,
|
|
713
722
|
itemHeight,
|
|
714
723
|
itemPadding,
|
|
715
724
|
rowHeightMetrics,
|
|
@@ -766,7 +775,8 @@ function BGrid(_a) {
|
|
|
766
775
|
onChangeColumns: resolvedOnChangeColumns, width: width, height: height, className: className, style: style, loading: loading, disabled: resolvedDisabled, spinning: spinning, scrollLeft: scrollLeft, scrollTop: scrollTop, headerHeight: headerHeight, footerHeight: footerHeight, bottomBarHeight: resolvedBottomBarHeight,
|
|
767
776
|
scrollbar: resolvedScrollbar,
|
|
768
777
|
status: resolvedStatus,
|
|
769
|
-
pagination: resolvedPagination,
|
|
778
|
+
pagination: resolvedPagination,
|
|
779
|
+
summaryHeight: resolvedSummaryHeight, summaryRowHeight: summaryRowHeight, itemHeight: itemHeight, itemPadding: itemPadding, rowHeightMetrics: rowHeightMetrics, frozenColumnIndex: resolvedFrozenColumnIndex,
|
|
770
780
|
frozenRowCount: resolvedFrozenRowCount,
|
|
771
781
|
rowChecked: resolvedRowChecked, checkedIndexesMap: checkedIndexesMap, sort: resolvedSort, sortParams: sortParams, dataQuery: resolvedDataQuery,
|
|
772
782
|
dataControl: resolvedDataControl, icons: icons, columnVisibilityState: columnVisibilityState, searchOptions: resolvedSearchOptions,
|
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,
|
|
@@ -1506,6 +1508,8 @@ function Table(props) {
|
|
|
1506
1508
|
setFooterHeight(props.footerHeight);
|
|
1507
1509
|
if (props.summaryHeight !== undefined)
|
|
1508
1510
|
setSummaryHeight(props.summaryHeight);
|
|
1511
|
+
if (props.summaryRowHeight !== undefined)
|
|
1512
|
+
setSummaryRowHeight(props.summaryRowHeight);
|
|
1509
1513
|
if (props.itemHeight !== undefined)
|
|
1510
1514
|
setItemHeight(props.itemHeight);
|
|
1511
1515
|
if (props.itemPadding !== undefined)
|
|
@@ -1515,12 +1519,14 @@ function Table(props) {
|
|
|
1515
1519
|
props.headerHeight,
|
|
1516
1520
|
props.footerHeight,
|
|
1517
1521
|
props.summaryHeight,
|
|
1522
|
+
props.summaryRowHeight,
|
|
1518
1523
|
props.itemHeight,
|
|
1519
1524
|
props.itemPadding,
|
|
1520
1525
|
setWidth,
|
|
1521
1526
|
setHeaderHeight,
|
|
1522
1527
|
setFooterHeight,
|
|
1523
1528
|
setSummaryHeight,
|
|
1529
|
+
setSummaryRowHeight,
|
|
1524
1530
|
setItemHeight,
|
|
1525
1531
|
setItemPadding,
|
|
1526
1532
|
]);
|
|
@@ -64,61 +64,52 @@ var react_1 = require("react");
|
|
|
64
64
|
var React = __importStar(require("react"));
|
|
65
65
|
var shallow_1 = require("zustand/react/shallow");
|
|
66
66
|
var store_1 = require("../store");
|
|
67
|
+
var utils_1 = require("../utils");
|
|
67
68
|
var TableColGroup_1 = __importDefault(require("./TableColGroup"));
|
|
68
69
|
function TableSummary(_a) {
|
|
69
70
|
var position = _a.position;
|
|
70
71
|
// [Selector Group 1] Summary Configuration - 요약 설정
|
|
71
72
|
var _b = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
|
|
72
73
|
summaryHeight: s.summaryHeight,
|
|
74
|
+
summaryRowHeight: s.summaryRowHeight,
|
|
73
75
|
summary: s.summary,
|
|
74
76
|
columns: s.columns,
|
|
75
|
-
columnsGroup: s.columnsGroup,
|
|
76
77
|
frozenColumnIndex: s.frozenColumnIndex,
|
|
77
78
|
variant: s.variant,
|
|
78
79
|
data: s.data,
|
|
79
|
-
}); })), summaryHeight = _b.summaryHeight,
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
else {
|
|
90
|
-
if (ignoreColumnCnt > 0) {
|
|
91
|
-
ignoreColumnCnt--;
|
|
92
|
-
return {};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return {
|
|
96
|
-
column: column,
|
|
97
|
-
columnIndex: columnIndex,
|
|
98
|
-
summaryColumn: summaryColumn,
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
}, [columns, frozenColumnIndex, summary]);
|
|
80
|
+
}); })), summaryHeight = _b.summaryHeight, summaryRowHeight = _b.summaryRowHeight, summary = _b.summary, columns = _b.columns, frozenColumnIndex = _b.frozenColumnIndex, variant = _b.variant, data = _b.data;
|
|
81
|
+
var summaryRows = (0, react_1.useMemo)(function () { return (0, utils_1.normalizeSummaryRows)(summary); }, [summary]);
|
|
82
|
+
var renderedRows = (0, react_1.useMemo)(function () {
|
|
83
|
+
var targetColumns = columns.slice(frozenColumnIndex);
|
|
84
|
+
return summaryRows.map(function (row, rowIndex) { return ({
|
|
85
|
+
row: row,
|
|
86
|
+
rowIndex: rowIndex,
|
|
87
|
+
cells: (0, utils_1.buildSummaryRowCells)(targetColumns, row.columns, frozenColumnIndex),
|
|
88
|
+
}); });
|
|
89
|
+
}, [summaryRows, columns, frozenColumnIndex]);
|
|
102
90
|
return (React.createElement(SummaryTable, { variant: variant, summaryHeight: summaryHeight, position: position },
|
|
103
91
|
React.createElement(TableColGroup_1.default, null),
|
|
104
|
-
React.createElement("tbody", { role: 'rfdg-summary' },
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
92
|
+
React.createElement("tbody", { role: 'rfdg-summary' }, renderedRows.map(function (_a) {
|
|
93
|
+
var _b, _c, _d;
|
|
94
|
+
var row = _a.row, rowIndex = _a.rowIndex, cells = _a.cells;
|
|
95
|
+
var rowHeight = (_b = row.height) !== null && _b !== void 0 ? _b : summaryRowHeight;
|
|
96
|
+
return (React.createElement("tr", { key: (_c = row.id) !== null && _c !== void 0 ? _c : rowIndex, className: ['bgrid-summary-row', (_d = row.className) !== null && _d !== void 0 ? _d : ''].filter(Boolean).join(' '), style: __assign(__assign({}, (rowHeight !== undefined ? { height: rowHeight } : {})), row.style) },
|
|
97
|
+
cells.map(function (cell, index) {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
if (!cell || !cell.column)
|
|
110
100
|
return null;
|
|
101
|
+
var column = cell.column, summaryColumn = cell.summaryColumn, columnIndex = cell.columnIndex;
|
|
111
102
|
if (!summaryColumn)
|
|
112
103
|
return React.createElement("td", { key: index });
|
|
113
|
-
return (React.createElement("td", { key: index, style: {
|
|
114
|
-
textAlign: summaryColumn.align,
|
|
115
|
-
}, colSpan: (_b = summaryColumn.colSpan) !== null && _b !== void 0 ? _b : 1 }, (_c = summaryColumn.itemRender) === null || _c === void 0 ? void 0 : _c.call(summaryColumn, {
|
|
104
|
+
return (React.createElement("td", { key: index, className: summaryColumn.className, style: __assign({ textAlign: summaryColumn.align }, summaryColumn.style), colSpan: (_a = summaryColumn.colSpan) !== null && _a !== void 0 ? _a : 1 }, (_b = summaryColumn.itemRender) === null || _b === void 0 ? void 0 : _b.call(summaryColumn, {
|
|
116
105
|
column: column,
|
|
117
106
|
columnIndex: columnIndex,
|
|
107
|
+
rowIndex: rowIndex,
|
|
118
108
|
data: data,
|
|
119
109
|
})));
|
|
120
110
|
}),
|
|
121
|
-
React.createElement("td", { "data-none": true })))
|
|
111
|
+
React.createElement("td", { "data-none": true })));
|
|
112
|
+
}))));
|
|
122
113
|
}
|
|
123
114
|
function SummaryTable(_a) {
|
|
124
115
|
var summaryHeight = _a.summaryHeight, variant = _a.variant, position = _a.position, className = _a.className, children = _a.children, rest = __rest(_a, ["summaryHeight", "variant", "position", "className", "children"]);
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -41,6 +52,7 @@ var React = __importStar(require("react"));
|
|
|
41
52
|
var react_1 = require("react");
|
|
42
53
|
var shallow_1 = require("zustand/react/shallow");
|
|
43
54
|
var store_1 = require("../store");
|
|
55
|
+
var utils_1 = require("../utils");
|
|
44
56
|
var TableColGroupFrozen_1 = __importDefault(require("./TableColGroupFrozen"));
|
|
45
57
|
var TableHead_1 = require("./TableHead");
|
|
46
58
|
var TableSummary_1 = require("./TableSummary");
|
|
@@ -49,57 +61,47 @@ function TableSummaryFrozen(_a) {
|
|
|
49
61
|
// [Selector Group 1] Summary Configuration - 요약 설정
|
|
50
62
|
var _b = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
|
|
51
63
|
summaryHeight: s.summaryHeight,
|
|
64
|
+
summaryRowHeight: s.summaryRowHeight,
|
|
52
65
|
summary: s.summary,
|
|
53
66
|
columns: s.columns,
|
|
54
|
-
columnsGroup: s.columnsGroup,
|
|
55
67
|
frozenColumnIndex: s.frozenColumnIndex,
|
|
56
68
|
variant: s.variant,
|
|
57
69
|
data: s.data,
|
|
58
70
|
showLineNumber: s.showLineNumber,
|
|
59
71
|
rowChecked: s.rowChecked,
|
|
60
|
-
}); })), summaryHeight = _b.summaryHeight,
|
|
72
|
+
}); })), summaryHeight = _b.summaryHeight, summaryRowHeight = _b.summaryRowHeight, summary = _b.summary, columns = _b.columns, frozenColumnIndex = _b.frozenColumnIndex, variant = _b.variant, data = _b.data, showLineNumber = _b.showLineNumber, rowChecked = _b.rowChecked;
|
|
61
73
|
var hasRowSelection = !!rowChecked;
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
else {
|
|
72
|
-
if (ignoreColumnCnt > 0) {
|
|
73
|
-
ignoreColumnCnt--;
|
|
74
|
-
return {};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
column: column,
|
|
79
|
-
columnIndex: columnIndex,
|
|
80
|
-
summaryColumn: summaryColumn,
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
}, [columns, frozenColumnIndex, summary]);
|
|
74
|
+
var summaryRows = (0, react_1.useMemo)(function () { return (0, utils_1.normalizeSummaryRows)(summary); }, [summary]);
|
|
75
|
+
var renderedRows = (0, react_1.useMemo)(function () {
|
|
76
|
+
var targetColumns = columns.slice(0, frozenColumnIndex);
|
|
77
|
+
return summaryRows.map(function (row, rowIndex) { return ({
|
|
78
|
+
row: row,
|
|
79
|
+
rowIndex: rowIndex,
|
|
80
|
+
cells: (0, utils_1.buildSummaryRowCells)(targetColumns, row.columns, 0),
|
|
81
|
+
}); });
|
|
82
|
+
}, [summaryRows, columns, frozenColumnIndex]);
|
|
84
83
|
return (React.createElement(TableSummary_1.SummaryTable, { variant: variant, summaryHeight: summaryHeight, position: position },
|
|
85
84
|
React.createElement(TableColGroupFrozen_1.default, null),
|
|
86
|
-
React.createElement("tbody", { role: 'rfdg-summay-frozen' },
|
|
87
|
-
|
|
85
|
+
React.createElement("tbody", { role: 'rfdg-summay-frozen' }, renderedRows.map(function (_a) {
|
|
86
|
+
var _b, _c, _d;
|
|
87
|
+
var row = _a.row, rowIndex = _a.rowIndex, cells = _a.cells;
|
|
88
|
+
var rowHeight = (_b = row.height) !== null && _b !== void 0 ? _b : summaryRowHeight;
|
|
89
|
+
return (React.createElement("tr", { key: (_c = row.id) !== null && _c !== void 0 ? _c : rowIndex, className: ['bgrid-summary-row', (_d = row.className) !== null && _d !== void 0 ? _d : ''].filter(Boolean).join(' '), style: __assign(__assign({}, (rowHeight !== undefined ? { height: rowHeight } : {})), row.style) },
|
|
88
90
|
showLineNumber && React.createElement(TableHead_1.HeadTd, { className: !hasRowSelection ? 'bordered' : '' }, "\u00A0"),
|
|
89
91
|
hasRowSelection && React.createElement("td", { className: 'bordered' }, "\u00A0"),
|
|
90
|
-
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
if (!column)
|
|
92
|
+
cells.map(function (cell, index) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
if (!cell || !cell.column)
|
|
94
95
|
return null;
|
|
96
|
+
var column = cell.column, summaryColumn = cell.summaryColumn, columnIndex = cell.columnIndex;
|
|
95
97
|
if (!summaryColumn)
|
|
96
98
|
return React.createElement("td", { key: index });
|
|
97
|
-
return (React.createElement("td", { key: index, style: {
|
|
98
|
-
textAlign: summaryColumn.align,
|
|
99
|
-
}, colSpan: (_b = summaryColumn.colSpan) !== null && _b !== void 0 ? _b : 1 }, (_c = summaryColumn.itemRender) === null || _c === void 0 ? void 0 : _c.call(summaryColumn, {
|
|
99
|
+
return (React.createElement("td", { key: index, className: summaryColumn.className, style: __assign({ textAlign: summaryColumn.align }, summaryColumn.style), colSpan: (_a = summaryColumn.colSpan) !== null && _a !== void 0 ? _a : 1 }, (_b = summaryColumn.itemRender) === null || _b === void 0 ? void 0 : _b.call(summaryColumn, {
|
|
100
100
|
column: column,
|
|
101
101
|
columnIndex: columnIndex,
|
|
102
|
+
rowIndex: rowIndex,
|
|
102
103
|
data: data,
|
|
103
104
|
})));
|
|
104
|
-
})))
|
|
105
|
+
})));
|
|
106
|
+
}))));
|
|
105
107
|
}
|
|
@@ -223,6 +223,7 @@ function AppStoreProvider(_a) {
|
|
|
223
223
|
visible: true,
|
|
224
224
|
},
|
|
225
225
|
summaryHeight: (_j = initialState === null || initialState === void 0 ? void 0 : initialState.summaryHeight) !== null && _j !== void 0 ? _j : 30,
|
|
226
|
+
summaryRowHeight: initialState === null || initialState === void 0 ? void 0 : initialState.summaryRowHeight,
|
|
226
227
|
itemHeight: (_k = initialState === null || initialState === void 0 ? void 0 : initialState.itemHeight) !== null && _k !== void 0 ? _k : 15,
|
|
227
228
|
itemPadding: (_l = initialState === null || initialState === void 0 ? void 0 : initialState.itemPadding) !== null && _l !== void 0 ? _l : 7,
|
|
228
229
|
frozenColumnIndex: (_m = initialState === null || initialState === void 0 ? void 0 : initialState.frozenColumnIndex) !== null && _m !== void 0 ? _m : 0,
|
|
@@ -917,6 +918,7 @@ function AppStoreProvider(_a) {
|
|
|
917
918
|
setHeaderHeight: function (headerHeight) { return set({ headerHeight: headerHeight }); },
|
|
918
919
|
setFooterHeight: function (footerHeight) { return set({ footerHeight: footerHeight }); },
|
|
919
920
|
setSummaryHeight: function (summaryHeight) { return set({ summaryHeight: summaryHeight }); },
|
|
921
|
+
setSummaryRowHeight: function (summaryRowHeight) { return set({ summaryRowHeight: summaryRowHeight }); },
|
|
920
922
|
setItemHeight: function (itemHeight) { return set({ itemHeight: itemHeight }); },
|
|
921
923
|
setItemPadding: function (itemPadding) { return set({ itemPadding: itemPadding }); },
|
|
922
924
|
setFrozenColumnIndex: function (frozenColumnIndex) { return set({ frozenColumnIndex: frozenColumnIndex }); },
|
|
@@ -94,21 +94,24 @@ function projectCellMergeOptions(options, visibleIndexByOriginalIndex) {
|
|
|
94
94
|
}, {});
|
|
95
95
|
return __assign(__assign({}, options), { columnsMap: columnsMap });
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function projectSummaryColumn(sc, vMap) {
|
|
98
|
+
var _a;
|
|
99
|
+
var end = sc.columnIndex + ((_a = sc.colSpan) !== null && _a !== void 0 ? _a : 1);
|
|
100
|
+
var idxs = [];
|
|
101
|
+
for (var i = sc.columnIndex; i < end; i++) {
|
|
102
|
+
var v = vMap.get(i);
|
|
103
|
+
if (v !== undefined)
|
|
104
|
+
idxs.push(v);
|
|
105
|
+
}
|
|
106
|
+
return idxs.length ? [__assign(__assign({}, sc), { columnIndex: idxs[0], colSpan: idxs.length })] : [];
|
|
107
|
+
}
|
|
108
|
+
function projectSummary(summary, vMap) {
|
|
98
109
|
if (!summary)
|
|
99
110
|
return undefined;
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
for (var index = summaryColumn.columnIndex; index < originalEnd; index += 1) {
|
|
105
|
-
var visibleIndex = visibleIndexByOriginalIndex.get(index);
|
|
106
|
-
if (visibleIndex !== undefined)
|
|
107
|
-
visibleIndexes.push(visibleIndex);
|
|
111
|
+
var projectCols = function (cols) { return cols.flatMap(function (c) { return projectSummaryColumn(c, vMap); }); };
|
|
112
|
+
return __assign(__assign(__assign({}, summary), (summary.columns ? { columns: projectCols(summary.columns) } : {})), (summary.rows
|
|
113
|
+
? {
|
|
114
|
+
rows: summary.rows.map(function (r) { return (Array.isArray(r) ? projectCols(r) : __assign(__assign({}, r), { columns: projectCols(r.columns) })); }),
|
|
108
115
|
}
|
|
109
|
-
|
|
110
|
-
return [];
|
|
111
|
-
return [__assign(__assign({}, summaryColumn), { columnIndex: visibleIndexes[0], colSpan: visibleIndexes.length })];
|
|
112
|
-
});
|
|
113
|
-
return __assign(__assign({}, summary), { columns: columns });
|
|
116
|
+
: {}));
|
|
114
117
|
}
|
package/cjs/utils/index.js
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.DEFAULT_SUMMARY_ROW_HEIGHT = void 0;
|
|
15
|
+
exports.normalizeSummaryRows = normalizeSummaryRows;
|
|
16
|
+
exports.computeSummaryHeight = computeSummaryHeight;
|
|
17
|
+
exports.buildSummaryRowCells = buildSummaryRowCells;
|
|
18
|
+
exports.DEFAULT_SUMMARY_ROW_HEIGHT = 30;
|
|
19
|
+
function normalizeSummaryRows(summary) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
if (!summary)
|
|
22
|
+
return [];
|
|
23
|
+
if ((_a = summary.rows) === null || _a === void 0 ? void 0 : _a.length) {
|
|
24
|
+
return summary.rows.map(function (row, idx) { var _a; return Array.isArray(row) ? { id: idx, columns: row } : __assign(__assign({}, row), { id: (_a = row.id) !== null && _a !== void 0 ? _a : idx }); });
|
|
25
|
+
}
|
|
26
|
+
return ((_b = summary.columns) === null || _b === void 0 ? void 0 : _b.length) ? [{ id: 0, columns: summary.columns }] : [];
|
|
27
|
+
}
|
|
28
|
+
function computeSummaryHeight(options) {
|
|
29
|
+
var summary = options.summary, summaryHeight = options.summaryHeight, _a = options.summaryRowHeight, summaryRowHeight = _a === void 0 ? exports.DEFAULT_SUMMARY_ROW_HEIGHT : _a;
|
|
30
|
+
if (!summary)
|
|
31
|
+
return 0;
|
|
32
|
+
var rows = normalizeSummaryRows(summary);
|
|
33
|
+
if (!rows.length)
|
|
34
|
+
return 0;
|
|
35
|
+
return summaryHeight !== undefined
|
|
36
|
+
? summaryHeight
|
|
37
|
+
: rows.reduce(function (acc, row) { var _a; return acc + ((_a = row.height) !== null && _a !== void 0 ? _a : summaryRowHeight); }, 0);
|
|
38
|
+
}
|
|
39
|
+
function buildSummaryRowCells(columns, summaryColumns, startIndex) {
|
|
40
|
+
if (startIndex === void 0) { startIndex = 0; }
|
|
41
|
+
var ignoreCnt = 0;
|
|
42
|
+
return columns.map(function (column, i) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
var columnIndex = startIndex + i;
|
|
45
|
+
var summaryColumn = summaryColumns === null || summaryColumns === void 0 ? void 0 : summaryColumns.find(function (sc) { return sc.columnIndex === columnIndex; });
|
|
46
|
+
if (summaryColumn && ((_a = summaryColumn.colSpan) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
47
|
+
ignoreCnt = ((_b = summaryColumn.colSpan) !== null && _b !== void 0 ? _b : 1) - 1;
|
|
48
|
+
}
|
|
49
|
+
else if (ignoreCnt > 0) {
|
|
50
|
+
ignoreCnt--;
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return { column: column, columnIndex: columnIndex, summaryColumn: summaryColumn };
|
|
54
|
+
});
|
|
55
|
+
}
|
package/esm/BGrid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Table from './components/Table';
|
|
3
|
-
import { createPivotData, createRowHeightMetrics, buildHeaderMatrix, countVisibleCheckedIndexes, findDuplicateColumnIds, getCellValueByRowKey, getColumnId, getColumnKeyToken, getFrozenColumnsWidth, getTreeRowPath, processDataQuery, projectTreeData, projectColumnVisibility, resolveStatusOptions, resolvePaginationViewOptions, resolveScrollbarOptions, shouldRenderBottomBar, } from './utils';
|
|
3
|
+
import { createPivotData, createRowHeightMetrics, buildHeaderMatrix, countVisibleCheckedIndexes, findDuplicateColumnIds, getCellValueByRowKey, getColumnId, getColumnKeyToken, getFrozenColumnsWidth, getTreeRowPath, processDataQuery, projectTreeData, projectColumnVisibility, resolveStatusOptions, resolvePaginationViewOptions, resolveScrollbarOptions, computeSummaryHeight, DEFAULT_SUMMARY_ROW_HEIGHT, shouldRenderBottomBar, } from './utils';
|
|
4
4
|
import { AppStoreProvider } from './store';
|
|
5
5
|
import { TreeContext } from './components/TreeContext';
|
|
6
6
|
function computeModelColumns(columns, frozenColumnIndex, duplicateToolboxColumnIds) {
|
|
@@ -22,7 +22,7 @@ function computeModelColumns(columns, frozenColumnIndex, duplicateToolboxColumnI
|
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
export function BGrid({ ref, width, height, headerHeight = 30, footerHeight, summaryHeight =
|
|
25
|
+
export function BGrid({ ref, width, height, headerHeight = 30, footerHeight, summaryHeight: explicitSummaryHeight, summaryRowHeight = DEFAULT_SUMMARY_ROW_HEIGHT, itemHeight = 15, itemPadding = 7, getRowHeight, columns, columnsGroup, columnGroups, onChangeColumns, frozenColumnIndex = 0, frozenRowCount = 0, data = [], page, scrollbar, status, pagination, bottomBarHeight, scrollTop = 0, scrollLeft = 0, className, style, rowChecked, sort, onClick, loading = false, spinning, disabled, rowKey, selectedRowKey, editable, onChangeData, showLineNumber, msg, getRowClassName, editTrigger = 'dblclick', cellMergeOptions, cellSelectionOptions, cellNavigationOptions, variant, summary, columnSortable, reorder, pivot, dataControl, icons, columnVisibility, searchOptions, contextMenuOptions, tree, }) {
|
|
26
26
|
const [uncontrolledExpandedRowKeys, setUncontrolledExpandedRowKeys] = React.useState(() => [
|
|
27
27
|
...(tree?.defaultExpandedRowKeys ?? []),
|
|
28
28
|
]);
|
|
@@ -535,6 +535,11 @@ export function BGrid({ ref, width, height, headerHeight = 30, footerHeight, sum
|
|
|
535
535
|
console.warn('[BGrid] Both bottomBarHeight and footerHeight were provided. bottomBarHeight takes precedence.');
|
|
536
536
|
}
|
|
537
537
|
}, [bottomBarHeight, footerHeight]);
|
|
538
|
+
const resolvedSummaryHeight = React.useMemo(() => computeSummaryHeight({
|
|
539
|
+
summary: resolvedSummary,
|
|
540
|
+
summaryHeight: explicitSummaryHeight,
|
|
541
|
+
summaryRowHeight,
|
|
542
|
+
}), [resolvedSummary, explicitSummaryHeight, summaryRowHeight]);
|
|
538
543
|
const initialStoreState = React.useMemo(() => {
|
|
539
544
|
const initialWidth = width !== undefined ? Math.max(width, 100) : 0;
|
|
540
545
|
const initialHeight = height !== undefined ? Math.max(height, 100) : 0;
|
|
@@ -543,7 +548,7 @@ export function BGrid({ ref, width, height, headerHeight = 30, footerHeight, sum
|
|
|
543
548
|
? Math.max(initialHeight -
|
|
544
549
|
headerHeight -
|
|
545
550
|
(initialShowBottomBar ? resolvedBottomBarHeight : 0) -
|
|
546
|
-
(resolvedSummary ?
|
|
551
|
+
(resolvedSummary ? resolvedSummaryHeight : 0) -
|
|
547
552
|
containerBorderWidth * 2, 0)
|
|
548
553
|
: 0;
|
|
549
554
|
const displayItemCount = contentBodyHeight > 0 ? Math.ceil(contentBodyHeight / (itemHeight + itemPadding * 2)) : 0;
|
|
@@ -564,7 +569,8 @@ export function BGrid({ ref, width, height, headerHeight = 30, footerHeight, sum
|
|
|
564
569
|
scrollbar: resolvedScrollbar,
|
|
565
570
|
status: resolvedStatus,
|
|
566
571
|
pagination: resolvedPagination,
|
|
567
|
-
summaryHeight,
|
|
572
|
+
summaryHeight: resolvedSummaryHeight,
|
|
573
|
+
summaryRowHeight,
|
|
568
574
|
itemHeight,
|
|
569
575
|
itemPadding,
|
|
570
576
|
frozenColumnIndex: resolvedFrozenColumnIndex,
|
|
@@ -635,7 +641,8 @@ export function BGrid({ ref, width, height, headerHeight = 30, footerHeight, sum
|
|
|
635
641
|
resolvedScrollbar,
|
|
636
642
|
resolvedStatus,
|
|
637
643
|
resolvedPagination,
|
|
638
|
-
|
|
644
|
+
resolvedSummaryHeight,
|
|
645
|
+
summaryRowHeight,
|
|
639
646
|
itemHeight,
|
|
640
647
|
itemPadding,
|
|
641
648
|
rowHeightMetrics,
|
|
@@ -705,7 +712,8 @@ export function BGrid({ ref, width, height, headerHeight = 30, footerHeight, sum
|
|
|
705
712
|
scrollbar: resolvedScrollbar,
|
|
706
713
|
status: resolvedStatus,
|
|
707
714
|
pagination: resolvedPagination,
|
|
708
|
-
summaryHeight,
|
|
715
|
+
summaryHeight: resolvedSummaryHeight,
|
|
716
|
+
summaryRowHeight,
|
|
709
717
|
itemHeight,
|
|
710
718
|
itemPadding,
|
|
711
719
|
rowHeightMetrics,
|
package/esm/components/Table.js
CHANGED
|
@@ -58,11 +58,12 @@ function Table(props) {
|
|
|
58
58
|
itemPadding: s.itemPadding,
|
|
59
59
|
})));
|
|
60
60
|
// [Selector Group 2] Header, Footer, Summary - 헤더/푸터/요약
|
|
61
|
-
const { headerHeight, footerHeight, bottomBarHeight, summaryHeight } = useAppStore(useShallow(s => ({
|
|
61
|
+
const { headerHeight, footerHeight, bottomBarHeight, summaryHeight, summaryRowHeight } = useAppStore(useShallow(s => ({
|
|
62
62
|
headerHeight: s.headerHeight,
|
|
63
63
|
footerHeight: s.footerHeight,
|
|
64
64
|
bottomBarHeight: s.bottomBarHeight,
|
|
65
65
|
summaryHeight: s.summaryHeight,
|
|
66
|
+
summaryRowHeight: s.summaryRowHeight,
|
|
66
67
|
})));
|
|
67
68
|
// [Selector Group 3] Scroll State - 스크롤 상태
|
|
68
69
|
const { scrollLeft, scrollTop } = useAppStore(useShallow(s => ({
|
|
@@ -113,7 +114,7 @@ function Table(props) {
|
|
|
113
114
|
cellInteractionSession: s.cellInteractionSession,
|
|
114
115
|
})));
|
|
115
116
|
// [Selector Group 6] State Setters - 차원 설정자
|
|
116
|
-
const { setHeight, setWidth, setContentBodyHeight, setDisplayItemCount, setHeaderHeight, setFooterHeight, setBottomBarHeight, setSummaryHeight, setItemHeight, setItemPadding, setLoading, setSpinning, setDisabled, } = useAppStore(useShallow(s => ({
|
|
117
|
+
const { setHeight, setWidth, setContentBodyHeight, setDisplayItemCount, setHeaderHeight, setFooterHeight, setBottomBarHeight, setSummaryHeight, setSummaryRowHeight, setItemHeight, setItemPadding, setLoading, setSpinning, setDisabled, } = useAppStore(useShallow(s => ({
|
|
117
118
|
setHeight: s.setHeight,
|
|
118
119
|
setWidth: s.setWidth,
|
|
119
120
|
setContentBodyHeight: s.setContentBodyHeight,
|
|
@@ -122,6 +123,7 @@ function Table(props) {
|
|
|
122
123
|
setFooterHeight: s.setFooterHeight,
|
|
123
124
|
setBottomBarHeight: s.setBottomBarHeight,
|
|
124
125
|
setSummaryHeight: s.setSummaryHeight,
|
|
126
|
+
setSummaryRowHeight: s.setSummaryRowHeight,
|
|
125
127
|
setItemHeight: s.setItemHeight,
|
|
126
128
|
setItemPadding: s.setItemPadding,
|
|
127
129
|
setLoading: s.setLoading,
|
|
@@ -1314,6 +1316,8 @@ function Table(props) {
|
|
|
1314
1316
|
setFooterHeight(props.footerHeight);
|
|
1315
1317
|
if (props.summaryHeight !== undefined)
|
|
1316
1318
|
setSummaryHeight(props.summaryHeight);
|
|
1319
|
+
if (props.summaryRowHeight !== undefined)
|
|
1320
|
+
setSummaryRowHeight(props.summaryRowHeight);
|
|
1317
1321
|
if (props.itemHeight !== undefined)
|
|
1318
1322
|
setItemHeight(props.itemHeight);
|
|
1319
1323
|
if (props.itemPadding !== undefined)
|
|
@@ -1323,12 +1327,14 @@ function Table(props) {
|
|
|
1323
1327
|
props.headerHeight,
|
|
1324
1328
|
props.footerHeight,
|
|
1325
1329
|
props.summaryHeight,
|
|
1330
|
+
props.summaryRowHeight,
|
|
1326
1331
|
props.itemHeight,
|
|
1327
1332
|
props.itemPadding,
|
|
1328
1333
|
setWidth,
|
|
1329
1334
|
setHeaderHeight,
|
|
1330
1335
|
setFooterHeight,
|
|
1331
1336
|
setSummaryHeight,
|
|
1337
|
+
setSummaryRowHeight,
|
|
1332
1338
|
setItemHeight,
|
|
1333
1339
|
setItemPadding,
|
|
1334
1340
|
]);
|
|
@@ -2,57 +2,54 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useShallow } from 'zustand/react/shallow';
|
|
4
4
|
import { useAppStore } from '../store';
|
|
5
|
+
import { buildSummaryRowCells, normalizeSummaryRows } from '../utils';
|
|
5
6
|
import TableColGroup from './TableColGroup';
|
|
6
7
|
export function TableSummary({ position }) {
|
|
7
8
|
// [Selector Group 1] Summary Configuration - 요약 설정
|
|
8
|
-
const { summaryHeight, summary, columns,
|
|
9
|
+
const { summaryHeight, summaryRowHeight, summary, columns, frozenColumnIndex, variant, data } = useAppStore(useShallow(s => ({
|
|
9
10
|
summaryHeight: s.summaryHeight,
|
|
11
|
+
summaryRowHeight: s.summaryRowHeight,
|
|
10
12
|
summary: s.summary,
|
|
11
13
|
columns: s.columns,
|
|
12
|
-
columnsGroup: s.columnsGroup,
|
|
13
14
|
frozenColumnIndex: s.frozenColumnIndex,
|
|
14
15
|
variant: s.variant,
|
|
15
16
|
data: s.data,
|
|
16
17
|
})));
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (ignoreColumnCnt > 0) {
|
|
27
|
-
ignoreColumnCnt--;
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
column,
|
|
33
|
-
columnIndex,
|
|
34
|
-
summaryColumn,
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
}, [columns, frozenColumnIndex, summary]);
|
|
18
|
+
const summaryRows = useMemo(() => normalizeSummaryRows(summary), [summary]);
|
|
19
|
+
const renderedRows = useMemo(() => {
|
|
20
|
+
const targetColumns = columns.slice(frozenColumnIndex);
|
|
21
|
+
return summaryRows.map((row, rowIndex) => ({
|
|
22
|
+
row,
|
|
23
|
+
rowIndex,
|
|
24
|
+
cells: buildSummaryRowCells(targetColumns, row.columns, frozenColumnIndex),
|
|
25
|
+
}));
|
|
26
|
+
}, [summaryRows, columns, frozenColumnIndex]);
|
|
38
27
|
return (React.createElement(SummaryTable, { variant: variant, summaryHeight: summaryHeight, position: position },
|
|
39
28
|
React.createElement(TableColGroup, null),
|
|
40
|
-
React.createElement("tbody", { role: 'rfdg-summary' },
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
React.createElement("tbody", { role: 'rfdg-summary' }, renderedRows.map(({ row, rowIndex, cells }) => {
|
|
30
|
+
const rowHeight = row.height ?? summaryRowHeight;
|
|
31
|
+
return (React.createElement("tr", { key: row.id ?? rowIndex, className: ['bgrid-summary-row', row.className ?? ''].filter(Boolean).join(' '), style: {
|
|
32
|
+
...(rowHeight !== undefined ? { height: rowHeight } : {}),
|
|
33
|
+
...row.style,
|
|
34
|
+
} },
|
|
35
|
+
cells.map((cell, index) => {
|
|
36
|
+
if (!cell || !cell.column)
|
|
44
37
|
return null;
|
|
38
|
+
const { column, summaryColumn, columnIndex } = cell;
|
|
45
39
|
if (!summaryColumn)
|
|
46
40
|
return React.createElement("td", { key: index });
|
|
47
|
-
return (React.createElement("td", { key: index, style: {
|
|
41
|
+
return (React.createElement("td", { key: index, className: summaryColumn.className, style: {
|
|
48
42
|
textAlign: summaryColumn.align,
|
|
43
|
+
...summaryColumn.style,
|
|
49
44
|
}, colSpan: summaryColumn.colSpan ?? 1 }, summaryColumn.itemRender?.({
|
|
50
45
|
column,
|
|
51
46
|
columnIndex,
|
|
47
|
+
rowIndex,
|
|
52
48
|
data,
|
|
53
49
|
})));
|
|
54
50
|
}),
|
|
55
|
-
React.createElement("td", { "data-none": true })))
|
|
51
|
+
React.createElement("td", { "data-none": true })));
|
|
52
|
+
}))));
|
|
56
53
|
}
|
|
57
54
|
export function SummaryTable({ summaryHeight, variant, position, className, children, ...rest }) {
|
|
58
55
|
return (React.createElement("table", { className: [
|
|
@@ -2,16 +2,17 @@ import * as React from 'react';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { useShallow } from 'zustand/react/shallow';
|
|
4
4
|
import { useAppStore } from '../store';
|
|
5
|
+
import { buildSummaryRowCells, normalizeSummaryRows } from '../utils';
|
|
5
6
|
import TableColGroupFrozen from './TableColGroupFrozen';
|
|
6
7
|
import { HeadTd } from './TableHead';
|
|
7
8
|
import { SummaryTable } from './TableSummary';
|
|
8
9
|
export function TableSummaryFrozen({ position }) {
|
|
9
10
|
// [Selector Group 1] Summary Configuration - 요약 설정
|
|
10
|
-
const { summaryHeight, summary, columns,
|
|
11
|
+
const { summaryHeight, summaryRowHeight, summary, columns, frozenColumnIndex, variant, data, showLineNumber, rowChecked, } = useAppStore(useShallow(s => ({
|
|
11
12
|
summaryHeight: s.summaryHeight,
|
|
13
|
+
summaryRowHeight: s.summaryRowHeight,
|
|
12
14
|
summary: s.summary,
|
|
13
15
|
columns: s.columns,
|
|
14
|
-
columnsGroup: s.columnsGroup,
|
|
15
16
|
frozenColumnIndex: s.frozenColumnIndex,
|
|
16
17
|
variant: s.variant,
|
|
17
18
|
data: s.data,
|
|
@@ -19,44 +20,40 @@ export function TableSummaryFrozen({ position }) {
|
|
|
19
20
|
rowChecked: s.rowChecked,
|
|
20
21
|
})));
|
|
21
22
|
const hasRowSelection = !!rowChecked;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (ignoreColumnCnt > 0) {
|
|
32
|
-
ignoreColumnCnt--;
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
column,
|
|
38
|
-
columnIndex,
|
|
39
|
-
summaryColumn,
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
}, [columns, frozenColumnIndex, summary]);
|
|
23
|
+
const summaryRows = useMemo(() => normalizeSummaryRows(summary), [summary]);
|
|
24
|
+
const renderedRows = useMemo(() => {
|
|
25
|
+
const targetColumns = columns.slice(0, frozenColumnIndex);
|
|
26
|
+
return summaryRows.map((row, rowIndex) => ({
|
|
27
|
+
row,
|
|
28
|
+
rowIndex,
|
|
29
|
+
cells: buildSummaryRowCells(targetColumns, row.columns, 0),
|
|
30
|
+
}));
|
|
31
|
+
}, [summaryRows, columns, frozenColumnIndex]);
|
|
43
32
|
return (React.createElement(SummaryTable, { variant: variant, summaryHeight: summaryHeight, position: position },
|
|
44
33
|
React.createElement(TableColGroupFrozen, null),
|
|
45
|
-
React.createElement("tbody", { role: 'rfdg-summay-frozen' },
|
|
46
|
-
|
|
34
|
+
React.createElement("tbody", { role: 'rfdg-summay-frozen' }, renderedRows.map(({ row, rowIndex, cells }) => {
|
|
35
|
+
const rowHeight = row.height ?? summaryRowHeight;
|
|
36
|
+
return (React.createElement("tr", { key: row.id ?? rowIndex, className: ['bgrid-summary-row', row.className ?? ''].filter(Boolean).join(' '), style: {
|
|
37
|
+
...(rowHeight !== undefined ? { height: rowHeight } : {}),
|
|
38
|
+
...row.style,
|
|
39
|
+
} },
|
|
47
40
|
showLineNumber && React.createElement(HeadTd, { className: !hasRowSelection ? 'bordered' : '' }, "\u00A0"),
|
|
48
41
|
hasRowSelection && React.createElement("td", { className: 'bordered' }, "\u00A0"),
|
|
49
|
-
|
|
50
|
-
if (!column)
|
|
42
|
+
cells.map((cell, index) => {
|
|
43
|
+
if (!cell || !cell.column)
|
|
51
44
|
return null;
|
|
45
|
+
const { column, summaryColumn, columnIndex } = cell;
|
|
52
46
|
if (!summaryColumn)
|
|
53
47
|
return React.createElement("td", { key: index });
|
|
54
|
-
return (React.createElement("td", { key: index, style: {
|
|
48
|
+
return (React.createElement("td", { key: index, className: summaryColumn.className, style: {
|
|
55
49
|
textAlign: summaryColumn.align,
|
|
50
|
+
...summaryColumn.style,
|
|
56
51
|
}, colSpan: summaryColumn.colSpan ?? 1 }, summaryColumn.itemRender?.({
|
|
57
52
|
column,
|
|
58
53
|
columnIndex,
|
|
54
|
+
rowIndex,
|
|
59
55
|
data,
|
|
60
56
|
})));
|
|
61
|
-
})))
|
|
57
|
+
})));
|
|
58
|
+
}))));
|
|
62
59
|
}
|
|
@@ -77,6 +77,7 @@ export function AppStoreProvider({ children, initialState }) {
|
|
|
77
77
|
visible: true,
|
|
78
78
|
},
|
|
79
79
|
summaryHeight: initialState?.summaryHeight ?? 30,
|
|
80
|
+
summaryRowHeight: initialState?.summaryRowHeight,
|
|
80
81
|
itemHeight: initialState?.itemHeight ?? 15,
|
|
81
82
|
itemPadding: initialState?.itemPadding ?? 7,
|
|
82
83
|
frozenColumnIndex: initialState?.frozenColumnIndex ?? 0,
|
|
@@ -779,6 +780,7 @@ export function AppStoreProvider({ children, initialState }) {
|
|
|
779
780
|
setHeaderHeight: headerHeight => set({ headerHeight }),
|
|
780
781
|
setFooterHeight: footerHeight => set({ footerHeight }),
|
|
781
782
|
setSummaryHeight: summaryHeight => set({ summaryHeight }),
|
|
783
|
+
setSummaryRowHeight: summaryRowHeight => set({ summaryRowHeight }),
|
|
782
784
|
setItemHeight: itemHeight => set({ itemHeight }),
|
|
783
785
|
setItemPadding: itemPadding => set({ itemPadding }),
|
|
784
786
|
setFrozenColumnIndex: frozenColumnIndex => set({ frozenColumnIndex }),
|
|
@@ -66,24 +66,27 @@ function projectCellMergeOptions(options, visibleIndexByOriginalIndex) {
|
|
|
66
66
|
}, {});
|
|
67
67
|
return { ...options, columnsMap };
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function projectSummaryColumn(sc, vMap) {
|
|
70
|
+
const end = sc.columnIndex + (sc.colSpan ?? 1);
|
|
71
|
+
const idxs = [];
|
|
72
|
+
for (let i = sc.columnIndex; i < end; i++) {
|
|
73
|
+
const v = vMap.get(i);
|
|
74
|
+
if (v !== undefined)
|
|
75
|
+
idxs.push(v);
|
|
76
|
+
}
|
|
77
|
+
return idxs.length ? [{ ...sc, columnIndex: idxs[0], colSpan: idxs.length }] : [];
|
|
78
|
+
}
|
|
79
|
+
function projectSummary(summary, vMap) {
|
|
70
80
|
if (!summary)
|
|
71
81
|
return undefined;
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return [{
|
|
83
|
-
...summaryColumn,
|
|
84
|
-
columnIndex: visibleIndexes[0],
|
|
85
|
-
colSpan: visibleIndexes.length,
|
|
86
|
-
}];
|
|
87
|
-
});
|
|
88
|
-
return { ...summary, columns };
|
|
82
|
+
const projectCols = (cols) => cols.flatMap(c => projectSummaryColumn(c, vMap));
|
|
83
|
+
return {
|
|
84
|
+
...summary,
|
|
85
|
+
...(summary.columns ? { columns: projectCols(summary.columns) } : {}),
|
|
86
|
+
...(summary.rows
|
|
87
|
+
? {
|
|
88
|
+
rows: summary.rows.map(r => (Array.isArray(r) ? projectCols(r) : { ...r, columns: projectCols(r.columns) })),
|
|
89
|
+
}
|
|
90
|
+
: {}),
|
|
91
|
+
};
|
|
89
92
|
}
|
package/esm/utils/index.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const DEFAULT_SUMMARY_ROW_HEIGHT = 30;
|
|
2
|
+
export function normalizeSummaryRows(summary) {
|
|
3
|
+
if (!summary)
|
|
4
|
+
return [];
|
|
5
|
+
if (summary.rows?.length) {
|
|
6
|
+
return summary.rows.map((row, idx) => Array.isArray(row) ? { id: idx, columns: row } : { ...row, id: row.id ?? idx });
|
|
7
|
+
}
|
|
8
|
+
return summary.columns?.length ? [{ id: 0, columns: summary.columns }] : [];
|
|
9
|
+
}
|
|
10
|
+
export function computeSummaryHeight(options) {
|
|
11
|
+
const { summary, summaryHeight, summaryRowHeight = DEFAULT_SUMMARY_ROW_HEIGHT } = options;
|
|
12
|
+
if (!summary)
|
|
13
|
+
return 0;
|
|
14
|
+
const rows = normalizeSummaryRows(summary);
|
|
15
|
+
if (!rows.length)
|
|
16
|
+
return 0;
|
|
17
|
+
return summaryHeight !== undefined
|
|
18
|
+
? summaryHeight
|
|
19
|
+
: rows.reduce((acc, row) => acc + (row.height ?? summaryRowHeight), 0);
|
|
20
|
+
}
|
|
21
|
+
export function buildSummaryRowCells(columns, summaryColumns, startIndex = 0) {
|
|
22
|
+
let ignoreCnt = 0;
|
|
23
|
+
return columns.map((column, i) => {
|
|
24
|
+
const columnIndex = startIndex + i;
|
|
25
|
+
const summaryColumn = summaryColumns?.find(sc => sc.columnIndex === columnIndex);
|
|
26
|
+
if (summaryColumn && (summaryColumn.colSpan ?? 1) > 1) {
|
|
27
|
+
ignoreCnt = (summaryColumn.colSpan ?? 1) - 1;
|
|
28
|
+
}
|
|
29
|
+
else if (ignoreCnt > 0) {
|
|
30
|
+
ignoreCnt--;
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return { column, columnIndex, summaryColumn };
|
|
34
|
+
});
|
|
35
|
+
}
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -497,7 +497,8 @@
|
|
|
497
497
|
box-shadow: var(--bgrid-frozen-boundary-shadow);
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
-
.bgrid-body-table > tbody > tr > td[data-none]
|
|
500
|
+
.bgrid-body-table > tbody > tr > td[data-none],
|
|
501
|
+
.bgrid-summary-table > tbody > tr > td[data-none] {
|
|
501
502
|
border-right: none;
|
|
502
503
|
}
|
|
503
504
|
|
|
@@ -768,11 +769,11 @@
|
|
|
768
769
|
border: 0 !important;
|
|
769
770
|
}
|
|
770
771
|
|
|
771
|
-
.bgrid-body-vertical-bordered > tbody > tr > td {
|
|
772
|
+
.bgrid-body-vertical-bordered > tbody > tr > td:not([data-none]) {
|
|
772
773
|
border-right: 1px solid var(--bgrid-border-color-light, var(--bgrid-border-color-base));
|
|
773
774
|
}
|
|
774
775
|
|
|
775
|
-
.bgrid-summary-vertical-bordered > tbody > tr > td {
|
|
776
|
+
.bgrid-summary-vertical-bordered > tbody > tr > td:not([data-none]) {
|
|
776
777
|
border-right: 1px solid var(--bgrid-border-color-light, var(--bgrid-border-color-base));
|
|
777
778
|
}
|
|
778
779
|
|
|
@@ -795,6 +796,10 @@
|
|
|
795
796
|
padding: 0 6.5px;
|
|
796
797
|
}
|
|
797
798
|
|
|
799
|
+
.bgrid-summary-table > tbody > tr > td[data-none] {
|
|
800
|
+
border-right: none !important;
|
|
801
|
+
}
|
|
802
|
+
|
|
798
803
|
.bgrid-page-no {
|
|
799
804
|
transition: all 0.3s;
|
|
800
805
|
display: flex;
|
package/types/BGrid.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BGridProps } from './types';
|
|
3
|
-
export declare function BGrid<T = Record<string, any>>({ ref, width, height, headerHeight, footerHeight, summaryHeight, itemHeight, itemPadding, getRowHeight, columns, columnsGroup, columnGroups, onChangeColumns, frozenColumnIndex, frozenRowCount, data, page, scrollbar, status, pagination, bottomBarHeight, scrollTop, scrollLeft, className, style, rowChecked, sort, onClick, loading, spinning, disabled, rowKey, selectedRowKey, editable, onChangeData, showLineNumber, msg, getRowClassName, editTrigger, cellMergeOptions, cellSelectionOptions, cellNavigationOptions, variant, summary, columnSortable, reorder, pivot, dataControl, icons, columnVisibility, searchOptions, contextMenuOptions, tree, }: BGridProps<T>): React.JSX.Element;
|
|
3
|
+
export declare function BGrid<T = Record<string, any>>({ ref, width, height, headerHeight, footerHeight, summaryHeight: explicitSummaryHeight, summaryRowHeight, itemHeight, itemPadding, getRowHeight, columns, columnsGroup, columnGroups, onChangeColumns, frozenColumnIndex, frozenRowCount, data, page, scrollbar, status, pagination, bottomBarHeight, scrollTop, scrollLeft, className, style, rowChecked, sort, onClick, loading, spinning, disabled, rowKey, selectedRowKey, editable, onChangeData, showLineNumber, msg, getRowClassName, editTrigger, cellMergeOptions, cellSelectionOptions, cellNavigationOptions, variant, summary, columnSortable, reorder, pivot, dataControl, icons, columnVisibility, searchOptions, contextMenuOptions, tree, }: BGridProps<T>): React.JSX.Element;
|
|
@@ -13,6 +13,7 @@ interface Props<T> {
|
|
|
13
13
|
status?: BGridResolvedStatusOptions;
|
|
14
14
|
pagination?: BGridResolvedPaginationViewOptions;
|
|
15
15
|
summaryHeight?: number;
|
|
16
|
+
summaryRowHeight?: number;
|
|
16
17
|
itemHeight?: number;
|
|
17
18
|
itemPadding?: number;
|
|
18
19
|
rowHeightMetrics: BGridRowHeightMetrics;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { StoreApi } from 'zustand';
|
|
4
4
|
import { AppModel, AppStore } from '../types';
|
|
5
|
-
export type AppStoreInitialState<T = any> = Partial<Pick<AppModel<T>, 'width' | 'height' | 'headerHeight' | 'footerHeight' | 'bottomBarHeight' | 'scrollbar' | 'status' | 'pagination' | 'summaryHeight' | 'itemHeight' | 'itemPadding' | 'frozenColumnIndex' | 'frozenRowCount' | 'frozenRowsHeight' | 'frozenColumnsWidth' | 'columns' | 'columnsGroup' | 'columnGroups' | 'data' | 'sourceData' | 'sourceIndexByVisibleIndex' | 'visibleIndexBySourceIndex' | 'contentBodyHeight' | 'displayItemCount' | 'checkedIndexesMap' | 'rowChecked' | 'checkedAll' | 'sort' | 'sortParams' | 'dataQuery' | 'activeCell' | 'activeCellHost' | 'cellInteractionSession' | 'cellNavigationOptions' | 'dataControl' | 'filterDrafts' | 'activeToolboxColumnId' | 'columnVisibilityState' | 'searchOptions' | 'contextMenuOptions' | 'searchOpen' | 'searchQuery' | 'searchStatus' | 'searchMatches' | 'activeSearchMatchIndex' | 'contextMenuState' | 'icons' | 'page' | 'displayPaginationLength' | 'loading' | 'disabled' | 'spinning' | 'scrollTop' | 'scrollLeft' | 'rowKey' | 'selectedRowKey' | 'editable' | 'editTrigger' | 'showLineNumber' | 'msg' | 'getRowClassName' | 'cellMergeOptions' | 'variant' | 'summary' | 'columnSortable' | 'reorder' | 'className' | 'style' | 'onClick' | 'onChangeColumns' | 'onChangeData' | 'onLoadMore'>>;
|
|
5
|
+
export type AppStoreInitialState<T = any> = Partial<Pick<AppModel<T>, 'width' | 'height' | 'headerHeight' | 'footerHeight' | 'bottomBarHeight' | 'scrollbar' | 'status' | 'pagination' | 'summaryHeight' | 'summaryRowHeight' | 'itemHeight' | 'itemPadding' | 'frozenColumnIndex' | 'frozenRowCount' | 'frozenRowsHeight' | 'frozenColumnsWidth' | 'columns' | 'columnsGroup' | 'columnGroups' | 'data' | 'sourceData' | 'sourceIndexByVisibleIndex' | 'visibleIndexBySourceIndex' | 'contentBodyHeight' | 'displayItemCount' | 'checkedIndexesMap' | 'rowChecked' | 'checkedAll' | 'sort' | 'sortParams' | 'dataQuery' | 'activeCell' | 'activeCellHost' | 'cellInteractionSession' | 'cellNavigationOptions' | 'dataControl' | 'filterDrafts' | 'activeToolboxColumnId' | 'columnVisibilityState' | 'searchOptions' | 'contextMenuOptions' | 'searchOpen' | 'searchQuery' | 'searchStatus' | 'searchMatches' | 'activeSearchMatchIndex' | 'contextMenuState' | 'icons' | 'page' | 'displayPaginationLength' | 'loading' | 'disabled' | 'spinning' | 'scrollTop' | 'scrollLeft' | 'rowKey' | 'selectedRowKey' | 'editable' | 'editTrigger' | 'showLineNumber' | 'msg' | 'getRowClassName' | 'cellMergeOptions' | 'variant' | 'summary' | 'columnSortable' | 'reorder' | 'className' | 'style' | 'onClick' | 'onChangeColumns' | 'onChangeData' | 'onLoadMore'>>;
|
|
6
6
|
interface AppStoreProviderProps<T = any> {
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
initialState?: AppStoreInitialState<T>;
|
package/types/types.d.ts
CHANGED
|
@@ -219,6 +219,7 @@ export interface BGridCellMergeColumn {
|
|
|
219
219
|
export interface BGridSummaryItemRenderProps<T> {
|
|
220
220
|
column: BGridColumn<T>;
|
|
221
221
|
columnIndex: number;
|
|
222
|
+
rowIndex?: number;
|
|
222
223
|
data: BGridDataItem<T>[];
|
|
223
224
|
}
|
|
224
225
|
export interface BGridSummaryColumn<T> {
|
|
@@ -226,9 +227,22 @@ export interface BGridSummaryColumn<T> {
|
|
|
226
227
|
align?: AlignDirection;
|
|
227
228
|
colSpan?: number;
|
|
228
229
|
className?: string;
|
|
230
|
+
style?: React.CSSProperties;
|
|
229
231
|
getClassName?: (key: string | string[]) => string;
|
|
230
232
|
itemRender?: (props: BGridSummaryItemRenderProps<T>) => React.ReactNode;
|
|
231
233
|
}
|
|
234
|
+
export interface BGridSummaryRow<T> {
|
|
235
|
+
id?: string | number;
|
|
236
|
+
className?: string;
|
|
237
|
+
style?: React.CSSProperties;
|
|
238
|
+
height?: number;
|
|
239
|
+
columns: BGridSummaryColumn<T>[];
|
|
240
|
+
}
|
|
241
|
+
export interface BGridSummaryOptions<T> {
|
|
242
|
+
columns?: BGridSummaryColumn<T>[];
|
|
243
|
+
rows?: (BGridSummaryRow<T> | BGridSummaryColumn<T>[])[];
|
|
244
|
+
position: 'top' | 'bottom';
|
|
245
|
+
}
|
|
232
246
|
export declare enum BGridDataItemStatus {
|
|
233
247
|
new = 0,
|
|
234
248
|
edit = 1,
|
|
@@ -791,6 +805,7 @@ export interface BGridProps<T> {
|
|
|
791
805
|
footerHeight?: number;
|
|
792
806
|
bottomBarHeight?: number;
|
|
793
807
|
summaryHeight?: number;
|
|
808
|
+
summaryRowHeight?: number;
|
|
794
809
|
itemHeight?: number;
|
|
795
810
|
itemPadding?: number;
|
|
796
811
|
/**
|
|
@@ -897,10 +912,7 @@ export interface BGridProps<T> {
|
|
|
897
912
|
};
|
|
898
913
|
cellNavigationOptions?: BGridCellNavigationOptions;
|
|
899
914
|
variant?: 'default' | 'vertical-bordered';
|
|
900
|
-
summary?:
|
|
901
|
-
columns: BGridSummaryColumn<T>[];
|
|
902
|
-
position: 'top' | 'bottom';
|
|
903
|
-
};
|
|
915
|
+
summary?: BGridSummaryOptions<T>;
|
|
904
916
|
columnSortable?: boolean;
|
|
905
917
|
reorder?: BGridReorderInfo<T>;
|
|
906
918
|
reorderingInfo?: BGridReorderingInfo;
|
|
@@ -989,6 +1001,7 @@ export interface AppModel<T> extends BGridProps<T> {
|
|
|
989
1001
|
footerHeight: number;
|
|
990
1002
|
bottomBarHeight: number;
|
|
991
1003
|
summaryHeight: number;
|
|
1004
|
+
summaryRowHeight?: number;
|
|
992
1005
|
itemHeight: number;
|
|
993
1006
|
itemPadding: number;
|
|
994
1007
|
frozenColumnIndex: number;
|
|
@@ -1099,6 +1112,7 @@ export interface AppActions<T> {
|
|
|
1099
1112
|
setFooterHeight: (footerHeight: number) => void;
|
|
1100
1113
|
setBottomBarHeight: (bottomBarHeight: number) => void;
|
|
1101
1114
|
setSummaryHeight: (summaryHeight: number) => void;
|
|
1115
|
+
setSummaryRowHeight: (summaryRowHeight?: number) => void;
|
|
1102
1116
|
setItemHeight: (itemHeight: number) => void;
|
|
1103
1117
|
setItemPadding: (itemPadding: number) => void;
|
|
1104
1118
|
setFrozenColumnIndex: (frozenColumnIndex: number) => void;
|
package/types/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BGridColumn, BGridSummaryColumn, BGridSummaryOptions, BGridSummaryRow } from '../types';
|
|
2
|
+
export declare const DEFAULT_SUMMARY_ROW_HEIGHT = 30;
|
|
3
|
+
export declare function normalizeSummaryRows<T>(summary?: BGridSummaryOptions<T>): BGridSummaryRow<T>[];
|
|
4
|
+
export declare function computeSummaryHeight<T>(options: {
|
|
5
|
+
summary?: BGridSummaryOptions<T>;
|
|
6
|
+
summaryHeight?: number;
|
|
7
|
+
summaryRowHeight?: number;
|
|
8
|
+
}): number;
|
|
9
|
+
export declare function buildSummaryRowCells<T>(columns: BGridColumn<T>[], summaryColumns?: BGridSummaryColumn<T>[], startIndex?: number): ({
|
|
10
|
+
column: BGridColumn<T>;
|
|
11
|
+
columnIndex: number;
|
|
12
|
+
summaryColumn?: BGridSummaryColumn<T>;
|
|
13
|
+
} | null)[];
|