@coreui/react-data-grid 0.1.0-rc.0 → 0.3.0-rc.0
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 +9 -5
- package/dist/cjs/CDataGrid.d.ts +11 -1
- package/dist/cjs/CDataGrid.js +241 -46
- package/dist/cjs/CDataGrid.js.map +1 -1
- package/dist/cjs/CDataGridBody.d.ts +9 -4
- package/dist/cjs/CDataGridBody.js +54 -11
- package/dist/cjs/CDataGridBody.js.map +1 -1
- package/dist/cjs/CDataGridColumnChooser.d.ts +2 -3
- package/dist/cjs/CDataGridColumnChooser.js.map +1 -1
- package/dist/cjs/CDataGridFilterMenu.d.ts +2 -3
- package/dist/cjs/CDataGridFilterMenu.js.map +1 -1
- package/dist/cjs/CDataGridHeader.d.ts +4 -4
- package/dist/cjs/CDataGridHeader.js +31 -67
- package/dist/cjs/CDataGridHeader.js.map +1 -1
- package/dist/cjs/CDataGridHeaderMenu.d.ts +2 -3
- package/dist/cjs/CDataGridHeaderMenu.js.map +1 -1
- package/dist/cjs/CDataGridPagination.d.ts +2 -3
- package/dist/cjs/CDataGridPagination.js +1 -1
- package/dist/cjs/CDataGridPagination.js.map +1 -1
- package/dist/cjs/CDataGridToolbar.d.ts +8 -6
- package/dist/cjs/CDataGridToolbar.js +7 -2
- package/dist/cjs/CDataGridToolbar.js.map +1 -1
- package/dist/cjs/active-cell.d.ts +1 -0
- package/dist/cjs/active-cell.js +7 -3
- package/dist/cjs/active-cell.js.map +1 -1
- package/dist/cjs/columns.d.ts +38 -12
- package/dist/cjs/columns.js +51 -31
- package/dist/cjs/columns.js.map +1 -1
- package/dist/cjs/features.d.ts +52 -0
- package/dist/cjs/features.js +66 -0
- package/dist/cjs/features.js.map +1 -0
- package/dist/cjs/icons.d.ts +6 -4
- package/dist/cjs/icons.js +12 -8
- package/dist/cjs/icons.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/pinning.d.ts +4 -5
- package/dist/cjs/pinning.js +10 -8
- package/dist/cjs/pinning.js.map +1 -1
- package/dist/cjs/toolbar.d.ts +3 -2
- package/dist/cjs/toolbar.js +5 -2
- package/dist/cjs/toolbar.js.map +1 -1
- package/dist/cjs/types.d.ts +81 -29
- package/dist/esm/CDataGrid.d.ts +11 -1
- package/dist/esm/CDataGrid.mjs +244 -49
- package/dist/esm/CDataGrid.mjs.map +1 -1
- package/dist/esm/CDataGridBody.d.ts +9 -4
- package/dist/esm/CDataGridBody.mjs +55 -12
- package/dist/esm/CDataGridBody.mjs.map +1 -1
- package/dist/esm/CDataGridColumnChooser.d.ts +2 -3
- package/dist/esm/CDataGridColumnChooser.mjs.map +1 -1
- package/dist/esm/CDataGridFilterMenu.d.ts +2 -3
- package/dist/esm/CDataGridFilterMenu.mjs.map +1 -1
- package/dist/esm/CDataGridHeader.d.ts +4 -4
- package/dist/esm/CDataGridHeader.mjs +33 -69
- package/dist/esm/CDataGridHeader.mjs.map +1 -1
- package/dist/esm/CDataGridHeaderMenu.d.ts +2 -3
- package/dist/esm/CDataGridHeaderMenu.mjs.map +1 -1
- package/dist/esm/CDataGridPagination.d.ts +2 -3
- package/dist/esm/CDataGridPagination.mjs +1 -1
- package/dist/esm/CDataGridPagination.mjs.map +1 -1
- package/dist/esm/CDataGridToolbar.d.ts +8 -6
- package/dist/esm/CDataGridToolbar.mjs +7 -2
- package/dist/esm/CDataGridToolbar.mjs.map +1 -1
- package/dist/esm/active-cell.d.ts +1 -0
- package/dist/esm/active-cell.mjs +7 -3
- package/dist/esm/active-cell.mjs.map +1 -1
- package/dist/esm/columns.d.ts +38 -12
- package/dist/esm/columns.mjs +51 -32
- package/dist/esm/columns.mjs.map +1 -1
- package/dist/esm/features.d.ts +52 -0
- package/dist/esm/features.mjs +63 -0
- package/dist/esm/features.mjs.map +1 -0
- package/dist/esm/icons.d.ts +6 -4
- package/dist/esm/icons.mjs +7 -5
- package/dist/esm/icons.mjs.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/pinning.d.ts +4 -5
- package/dist/esm/pinning.mjs +10 -8
- package/dist/esm/pinning.mjs.map +1 -1
- package/dist/esm/toolbar.d.ts +3 -2
- package/dist/esm/toolbar.mjs +5 -2
- package/dist/esm/toolbar.mjs.map +1 -1
- package/dist/esm/types.d.ts +81 -29
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# @coreui/react-data-grid
|
|
2
2
|
|
|
3
|
-
High-performance React data grid for CoreUI,
|
|
4
|
-
|
|
3
|
+
High-performance React data grid for CoreUI — sorting, filtering, selection,
|
|
4
|
+
pagination, column resizing/reordering/pinning, inline editing, CSV export, and
|
|
5
|
+
server-side data, virtualized to 100,000 rows.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`@coreui/
|
|
7
|
+
Load the shared grid stylesheet from `@coreui/data-grid` (installed
|
|
8
|
+
automatically). Use `data-grid.css` next to the CoreUI stylesheet
|
|
9
|
+
(`@coreui/coreui` or `@coreui/coreui-pro` ≥ 5), which supplies the base `.table`,
|
|
10
|
+
`.btn` and form styles; without CoreUI on the page use
|
|
11
|
+
`data-grid.standalone.css` instead, which carries those base styles itself for
|
|
12
|
+
~2.7 kB gzip.
|
|
9
13
|
|
|
10
14
|
## Usage
|
|
11
15
|
|
package/dist/cjs/CDataGrid.d.ts
CHANGED
|
@@ -4,5 +4,15 @@
|
|
|
4
4
|
* License (https://coreui.io/pro/license/)
|
|
5
5
|
* --------------------------------------------------------------------------
|
|
6
6
|
*/
|
|
7
|
+
import { type TableFeatures } from '@tanstack/react-table';
|
|
8
|
+
import { type ReactNode, type Ref } from 'react';
|
|
9
|
+
import { type DataGridFeatures } from './features';
|
|
7
10
|
import type { CDataGridProps } from './types';
|
|
8
|
-
|
|
11
|
+
interface CDataGridComponent {
|
|
12
|
+
<TFeatures extends TableFeatures = DataGridFeatures>(props: CDataGridProps<TFeatures> & {
|
|
13
|
+
ref?: Ref<HTMLDivElement>;
|
|
14
|
+
}): ReactNode;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const CDataGrid: CDataGridComponent;
|
|
18
|
+
export {};
|
package/dist/cjs/CDataGrid.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var filters = require('@coreui/data-grid/filters');
|
|
5
|
+
var clipboard = require('@coreui/data-grid/clipboard');
|
|
6
|
+
var print = require('@coreui/data-grid/print');
|
|
7
|
+
var direction = require('@coreui/data-grid/direction');
|
|
8
|
+
var drag = require('@coreui/data-grid/drag');
|
|
9
|
+
var validate = require('@coreui/data-grid/validate');
|
|
5
10
|
var reactTable = require('@tanstack/react-table');
|
|
6
11
|
var react = require('react');
|
|
7
12
|
var activeCell = require('./active-cell.js');
|
|
@@ -11,6 +16,7 @@ var CDataGridHeader = require('./CDataGridHeader.js');
|
|
|
11
16
|
var CDataGridPagination = require('./CDataGridPagination.js');
|
|
12
17
|
var CDataGridToolbar = require('./CDataGridToolbar.js');
|
|
13
18
|
var columns = require('./columns.js');
|
|
19
|
+
var features = require('./features.js');
|
|
14
20
|
var icons = require('./icons.js');
|
|
15
21
|
var labels = require('@coreui/data-grid/labels');
|
|
16
22
|
var toolbar = require('./toolbar.js');
|
|
@@ -19,6 +25,8 @@ var tooltip = require('./tooltip.js');
|
|
|
19
25
|
const DEFAULT_PAGE_SIZE_OPTIONS = [5, 10, 20, 50];
|
|
20
26
|
const STATE_STORAGE_PREFIX = 'coreui-data-grid:';
|
|
21
27
|
const HISTORY_LIMIT = 100;
|
|
28
|
+
const INFINITE_SCROLL_PAGE_SIZE = 50;
|
|
29
|
+
const UNPAGINATED_PAGE_SIZE = Number.MAX_SAFE_INTEGER;
|
|
22
30
|
const readPersistedState = (stateKey) => {
|
|
23
31
|
if (!stateKey) {
|
|
24
32
|
return null;
|
|
@@ -31,6 +39,17 @@ const readPersistedState = (stateKey) => {
|
|
|
31
39
|
return null;
|
|
32
40
|
}
|
|
33
41
|
};
|
|
42
|
+
// Under RTL the two horizontal keys point at the opposite logical neighbour.
|
|
43
|
+
const INVERTED_ARROWS = {
|
|
44
|
+
ArrowLeft: 'ArrowRight',
|
|
45
|
+
ArrowRight: 'ArrowLeft'
|
|
46
|
+
};
|
|
47
|
+
const CELL_SELECTION_DIRECTIONS = {
|
|
48
|
+
ArrowDown: 'down',
|
|
49
|
+
ArrowLeft: 'left',
|
|
50
|
+
ArrowRight: 'right',
|
|
51
|
+
ArrowUp: 'up'
|
|
52
|
+
};
|
|
34
53
|
const FETCH_DEBOUNCE_MS = 100;
|
|
35
54
|
// Module-level so an omitted `items` prop keeps a stable identity - a fresh
|
|
36
55
|
// array per render would force TanStack to recompute row models every time.
|
|
@@ -43,17 +62,17 @@ const toTanStackFilterFn = (column) => {
|
|
|
43
62
|
return (row, columnId, filterValue) => filters.evaluateColumnFilter(row.getValue(columnId), filterValue, column.filterType);
|
|
44
63
|
};
|
|
45
64
|
const CDataGrid = react.forwardRef((props, ref) => {
|
|
46
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
47
|
-
const { cellNavigation = false, className, columnFilters = false, columnMenu = false, columnMenuIcon = icons.DEFAULT_COLUMN_MENU_ICON, columnOrder = false, columnPinning = false, columnSizing = false, columnVisibility = false, columns: columns$1, dataProvider, editing = false, empty = 'No items found', filterIcon = icons.DEFAULT_FILTER_ICON, globalFilter = false, hideColumnIcon = icons.DEFAULT_HIDE_COLUMN_ICON, history = false, itemKey, items = EMPTY_ITEMS, labels: labels$1,
|
|
65
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
66
|
+
const { autoRowHeight = false, cellNavigation = false, cellSelection = false, className, columnFilters = false, columnMenu = false, columnMenuIcon = icons.DEFAULT_COLUMN_MENU_ICON, columnOrder = false, columnPinning = false, columnSizing = false, columnVisibility = false, columns: columns$1, dataProvider, editing = false, empty = 'No items found', features: features$1 = features.dataGridFeatures, filterIcon = icons.DEFAULT_FILTER_ICON, globalFilter = false, hideColumnIcon = icons.DEFAULT_HIDE_COLUMN_ICON, history = false, infiniteScroll = false, itemKey, items = EMPTY_ITEMS, labels: labels$1, moveStartIcon = icons.DEFAULT_MOVE_START_ICON, moveEndIcon = icons.DEFAULT_MOVE_END_ICON, onDataError, onDataLoad, onEditCancel, onEditCommit, onEditStart, onFilterChange, onOrderChange, onPaginationChange, onPinningChange, onSelectionChange, onRowOrderChange, onCellCopy, onSizingChange, onSortingChange, onVisibilityChange, overscan = 10, pagination = false, pinStartIcon = icons.DEFAULT_PIN_START_ICON, pinEndIcon = icons.DEFAULT_PIN_END_ICON, rowHandleIcon = icons.DEFAULT_ROW_HANDLE_ICON, rowHeight = 44, rowOrder = false, rowSelection = false, slots, sortAscendingIcon = icons.DEFAULT_SORT_ASCENDING_ICON, sortDescendingIcon = icons.DEFAULT_SORT_DESCENDING_ICON, sortNeutralIcon = icons.DEFAULT_SORT_NEUTRAL_ICON, sorterVisibility, sorting = true, stateKey, tableRef, toolbar: toolbar$1 = false, toolbarColumnsIcon = icons.DEFAULT_TOOLBAR_COLUMNS_ICON, printTitle, toolbarExportIcon = icons.DEFAULT_TOOLBAR_EXPORT_ICON, toolbarPrintIcon = icons.DEFAULT_TOOLBAR_PRINT_ICON, toolbarRedoIcon = icons.DEFAULT_TOOLBAR_REDO_ICON, toolbarUndoIcon = icons.DEFAULT_TOOLBAR_UNDO_ICON, unpinIcon = icons.DEFAULT_UNPIN_ICON, virtualization = true, ...rest } = props;
|
|
48
67
|
const mergedLabels = react.useMemo(() => ({ ...labels.DEFAULT_LABELS, ...labels$1 }), [labels$1]);
|
|
49
68
|
const menuIcons = react.useMemo(() => ({
|
|
50
69
|
columnMenu: columnMenuIcon,
|
|
51
70
|
filter: filterIcon,
|
|
52
71
|
hideColumn: hideColumnIcon,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
moveStart: moveStartIcon,
|
|
73
|
+
moveEnd: moveEndIcon,
|
|
74
|
+
pinStart: pinStartIcon,
|
|
75
|
+
pinEnd: pinEndIcon,
|
|
57
76
|
sortAscending: sortAscendingIcon,
|
|
58
77
|
sortDescending: sortDescendingIcon,
|
|
59
78
|
sortNeutral: sortNeutralIcon,
|
|
@@ -62,18 +81,19 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
62
81
|
columnMenuIcon,
|
|
63
82
|
filterIcon,
|
|
64
83
|
hideColumnIcon,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
84
|
+
moveStartIcon,
|
|
85
|
+
moveEndIcon,
|
|
86
|
+
pinStartIcon,
|
|
87
|
+
pinEndIcon,
|
|
69
88
|
sortAscendingIcon,
|
|
70
89
|
sortDescendingIcon,
|
|
71
90
|
sortNeutralIcon,
|
|
72
91
|
unpinIcon
|
|
73
92
|
]);
|
|
74
93
|
const menuBuilder = typeof columnMenu === 'function' ? columnMenu : null;
|
|
75
|
-
//
|
|
76
|
-
|
|
94
|
+
// Both need the active-cell substrate: editing targets it with Enter/F2,
|
|
95
|
+
// cell selection anchors ranges on it.
|
|
96
|
+
const cellNavigationEnabled = cellNavigation || editing || cellSelection;
|
|
77
97
|
const sortingOptions = typeof sorting === 'object' ? sorting : {};
|
|
78
98
|
const sizingEnabled = Boolean(columnSizing);
|
|
79
99
|
const sizingOptions = typeof columnSizing === 'object' ? columnSizing : {};
|
|
@@ -82,9 +102,23 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
82
102
|
const selectionEnabled = Boolean(rowSelection);
|
|
83
103
|
const selectionOptions = typeof rowSelection === 'object' ? rowSelection : {};
|
|
84
104
|
const serverSide = Boolean(dataProvider);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
105
|
+
if (infiniteScroll) {
|
|
106
|
+
if (!serverSide) {
|
|
107
|
+
throw new TypeError('DATA-GRID: Option "infiniteScroll" requires "dataProvider".');
|
|
108
|
+
}
|
|
109
|
+
if (pagination) {
|
|
110
|
+
throw new TypeError('DATA-GRID: Option "infiniteScroll" cannot be combined with "pagination".');
|
|
111
|
+
}
|
|
112
|
+
if (!virtualization) {
|
|
113
|
+
throw new TypeError('DATA-GRID: Option "infiniteScroll" requires "virtualization".');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const infiniteOptions = typeof infiniteScroll === 'object' ? infiniteScroll : {};
|
|
117
|
+
// Server-side mode implies pagination unless it scrolls infinitely, where
|
|
118
|
+
// the pages accumulate behind the virtualizer instead of replacing. The
|
|
119
|
+
// pagination STATE stays either way — infinite scroll pages the requests.
|
|
120
|
+
const paginationEnabled = Boolean(pagination) || (serverSide && !infiniteScroll);
|
|
121
|
+
const paginated = paginationEnabled || Boolean(infiniteScroll);
|
|
88
122
|
const paginationOptions = typeof pagination === 'object' ? pagination : {};
|
|
89
123
|
const virtualizationEnabled = virtualization && !paginationEnabled;
|
|
90
124
|
const resolvedToolbar = toolbar.resolveToolbar({
|
|
@@ -97,6 +131,7 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
97
131
|
const isColumnFilterable = (column) => columnFilters && column.filterable !== false;
|
|
98
132
|
const isColumnResizable = (column) => sizingEnabled && column.resizable !== false;
|
|
99
133
|
// A persisted view (stateKey) seeds the initial state - read once.
|
|
134
|
+
const rootRef = react.useRef(null);
|
|
100
135
|
const persistedStateRef = react.useRef(undefined);
|
|
101
136
|
if (persistedStateRef.current === undefined) {
|
|
102
137
|
persistedStateRef.current = readPersistedState(stateKey);
|
|
@@ -107,7 +142,11 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
107
142
|
const [globalFilterState, setGlobalFilterState] = react.useState((persisted === null || persisted === void 0 ? void 0 : persisted.globalFilter) === undefined || persisted.globalFilter === '' ? undefined : persisted.globalFilter);
|
|
108
143
|
const [rowSelectionState, setRowSelectionState] = react.useState((_c = persisted === null || persisted === void 0 ? void 0 : persisted.rowSelection) !== null && _c !== void 0 ? _c : {});
|
|
109
144
|
const [columnSizingState, setColumnSizingState] = react.useState((_d = persisted === null || persisted === void 0 ? void 0 : persisted.columnSizing) !== null && _d !== void 0 ? _d : {});
|
|
110
|
-
const [columnPinningState, setColumnPinningState] = react.useState(
|
|
145
|
+
const [columnPinningState, setColumnPinningState] = react.useState({
|
|
146
|
+
start: [],
|
|
147
|
+
end: [],
|
|
148
|
+
...((_e = persisted === null || persisted === void 0 ? void 0 : persisted.columnPinning) !== null && _e !== void 0 ? _e : (typeof columnPinning === 'object' ? columnPinning : {}))
|
|
149
|
+
});
|
|
111
150
|
const [columnOrderState, setColumnOrderState] = react.useState((_f = persisted === null || persisted === void 0 ? void 0 : persisted.columnOrder) !== null && _f !== void 0 ? _f : (Array.isArray(columnOrder) ? columnOrder : []));
|
|
112
151
|
const [columnVisibilityState, setColumnVisibilityState] = react.useState((_g = persisted === null || persisted === void 0 ? void 0 : persisted.columnVisibility) !== null && _g !== void 0 ? _g : (typeof columnVisibility === 'object' ? columnVisibility : {}));
|
|
113
152
|
// The chooser's Reset restores the initial columnVisibility object, captured
|
|
@@ -115,7 +154,13 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
115
154
|
const initialColumnVisibility = react.useRef(typeof columnVisibility === 'object' ? columnVisibility : {});
|
|
116
155
|
const [paginationState, setPaginationState] = react.useState({
|
|
117
156
|
pageIndex: (_j = (_h = persisted === null || persisted === void 0 ? void 0 : persisted.pagination) === null || _h === void 0 ? void 0 : _h.pageIndex) !== null && _j !== void 0 ? _j : 0,
|
|
118
|
-
|
|
157
|
+
// Pagination is a registered feature on every grid (v9 features are
|
|
158
|
+
// static), so an unpaginated grid is one page holding every row.
|
|
159
|
+
pageSize: infiniteScroll ?
|
|
160
|
+
(_k = infiniteOptions.pageSize) !== null && _k !== void 0 ? _k : INFINITE_SCROLL_PAGE_SIZE :
|
|
161
|
+
(paginationEnabled ?
|
|
162
|
+
(_o = (_m = (_l = persisted === null || persisted === void 0 ? void 0 : persisted.pagination) === null || _l === void 0 ? void 0 : _l.pageSize) !== null && _m !== void 0 ? _m : paginationOptions.pageSize) !== null && _o !== void 0 ? _o : 10 :
|
|
163
|
+
UNPAGINATED_PAGE_SIZE)
|
|
119
164
|
});
|
|
120
165
|
const [activeCell$1, setActiveCell] = react.useState(null);
|
|
121
166
|
// A pending focus request survives renders until the target cell exists in
|
|
@@ -165,14 +210,31 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
165
210
|
enableSorting: column.sortable !== false,
|
|
166
211
|
filterFn: toTanStackFilterFn(column),
|
|
167
212
|
id: column.key,
|
|
168
|
-
meta: { label: column.label, formatter: column.formatter },
|
|
213
|
+
meta: { label: column.label, formatter: column.formatter, width: column.width },
|
|
169
214
|
...(widthsEnabled && size !== null && { size })
|
|
170
215
|
};
|
|
171
216
|
}), [columns$1, widthsEnabled]);
|
|
172
|
-
|
|
217
|
+
validate.assertFeatureCoverage('data-grid', features$1, {
|
|
218
|
+
cellSelection,
|
|
219
|
+
columnFilters,
|
|
220
|
+
columnOrder: Boolean(columnOrder),
|
|
221
|
+
columnPinning: pinningEnabled,
|
|
222
|
+
columnSizing: sizingEnabled,
|
|
223
|
+
columnVisibility: Boolean(columnVisibility),
|
|
224
|
+
globalFilter: resolvedToolbar.search,
|
|
225
|
+
pagination: paginated,
|
|
226
|
+
rowSelection: selectionEnabled,
|
|
227
|
+
selectFilters: columnFilters && columns$1.some(column => column.filterType === 'select'),
|
|
228
|
+
sorting: Boolean(sorting)
|
|
229
|
+
});
|
|
230
|
+
const table = reactTable.useTable({
|
|
173
231
|
columns: columnDefs,
|
|
174
|
-
columnResizeMode: (
|
|
232
|
+
columnResizeMode: (_p = sizingOptions.mode) !== null && _p !== void 0 ? _p : 'onChange',
|
|
233
|
+
// Construction-time only — table-core copies the options object. A
|
|
234
|
+
// direction flipped later is picked up when a resize starts.
|
|
235
|
+
columnResizeDirection: direction.isElementRTL(rootRef.current) ? 'rtl' : 'ltr',
|
|
175
236
|
data: serverSide ? serverItems : items,
|
|
237
|
+
enableCellSelection: cellSelection,
|
|
176
238
|
enableColumnFilters: columnFilters,
|
|
177
239
|
enableColumnPinning: pinningEnabled,
|
|
178
240
|
enableColumnResizing: sizingEnabled,
|
|
@@ -182,12 +244,10 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
182
244
|
enableRowSelection: selectionEnabled,
|
|
183
245
|
enableSorting: Boolean(sorting),
|
|
184
246
|
enableSortingRemoval: Boolean(sortingOptions.resetable),
|
|
185
|
-
|
|
186
|
-
//
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
getFilteredRowModel: reactTable.getFilteredRowModel(),
|
|
190
|
-
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
247
|
+
// The runtime set may be smaller than the DataGridFeatures the table is
|
|
248
|
+
// typed against - internals stay typed on the full set and every call
|
|
249
|
+
// into an optional feature is capability-guarded.
|
|
250
|
+
features: features$1,
|
|
191
251
|
globalFilterFn: 'includesString',
|
|
192
252
|
...(serverSide && {
|
|
193
253
|
manualFiltering: true,
|
|
@@ -195,7 +255,6 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
195
255
|
manualSorting: true,
|
|
196
256
|
rowCount: serverTotalRows
|
|
197
257
|
}),
|
|
198
|
-
...(paginationEnabled && { getPaginationRowModel: reactTable.getPaginationRowModel() }),
|
|
199
258
|
...(itemKey && { getRowId: itemKey }),
|
|
200
259
|
onColumnFiltersChange: setColumnFiltersState,
|
|
201
260
|
onColumnOrderChange: setColumnOrderState,
|
|
@@ -218,7 +277,6 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
218
277
|
sorting: sortingState
|
|
219
278
|
}
|
|
220
279
|
});
|
|
221
|
-
const rootRef = react.useRef(null);
|
|
222
280
|
// Stable across renders - an inline callback ref would be detached/reattached
|
|
223
281
|
// (null, node) on every render, hammering consumer callback refs.
|
|
224
282
|
const setRootRef = react.useCallback((node) => {
|
|
@@ -256,8 +314,68 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
256
314
|
const tooltip$1 = tooltip.createTooltip(rootRef.current);
|
|
257
315
|
return () => tooltip$1.dispose();
|
|
258
316
|
}, []);
|
|
317
|
+
// Pointer-based column drag: the shared controller owns the ghost, the drop
|
|
318
|
+
// indicator and the edge auto-scroll, and writes to the DOM directly, so a
|
|
319
|
+
// drag costs no React renders. The table is read through a ref so the
|
|
320
|
+
// controller survives every unrelated re-render.
|
|
321
|
+
const tableRefForDrag = react.useRef(table);
|
|
322
|
+
tableRefForDrag.current = table;
|
|
323
|
+
react.useEffect(() => {
|
|
324
|
+
const root = rootRef.current;
|
|
325
|
+
if (!columnOrder || !root) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const controller = drag.createColumnDragController({
|
|
329
|
+
root,
|
|
330
|
+
getScrollElement: () => viewportElement,
|
|
331
|
+
canDrop: (sourceKey, targetKey) => columns.canReorderColumn(tableRefForDrag.current, sourceKey, targetKey),
|
|
332
|
+
onReorder: (sourceKey, targetKey, after) => columns.reorderColumn(tableRefForDrag.current, sourceKey, targetKey, after)
|
|
333
|
+
});
|
|
334
|
+
return () => controller.dispose();
|
|
335
|
+
}, [columnOrder, viewportElement]);
|
|
336
|
+
// The grid never mutates `items` — it hands the reordered array to the app
|
|
337
|
+
// through onRowOrderChange, the same contract inline editing uses.
|
|
338
|
+
const rowOrderRef = react.useRef({ items, rowIndexOffset: 0, onRowOrderChange });
|
|
339
|
+
rowOrderRef.current = {
|
|
340
|
+
items,
|
|
341
|
+
rowIndexOffset: paginationEnabled ? paginationState.pageIndex * paginationState.pageSize : 0,
|
|
342
|
+
onRowOrderChange
|
|
343
|
+
};
|
|
344
|
+
react.useEffect(() => {
|
|
345
|
+
const root = rootRef.current;
|
|
346
|
+
if (!rowOrder || !root) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
const controller = drag.createRowDragController({
|
|
350
|
+
root,
|
|
351
|
+
getScrollElement: () => viewportElement,
|
|
352
|
+
onReorder(sourceIndex, targetIndex, after) {
|
|
353
|
+
var _a;
|
|
354
|
+
const { current } = rowOrderRef;
|
|
355
|
+
const next = [...current.items];
|
|
356
|
+
const from = current.rowIndexOffset + sourceIndex;
|
|
357
|
+
const [item] = next.splice(from, 1);
|
|
358
|
+
if (item === undefined) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
// Resolved AFTER the removal, so the index still points at the target
|
|
362
|
+
// whichever direction the row travelled.
|
|
363
|
+
const target = current.rowIndexOffset + targetIndex;
|
|
364
|
+
const to = target > from ? target - 1 : target;
|
|
365
|
+
const newIndex = after ? to + 1 : to;
|
|
366
|
+
next.splice(newIndex, 0, item);
|
|
367
|
+
(_a = current.onRowOrderChange) === null || _a === void 0 ? void 0 : _a.call(current, {
|
|
368
|
+
items: next, item, oldIndex: from, newIndex
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
return () => controller.dispose();
|
|
373
|
+
}, [rowOrder, viewportElement]);
|
|
259
374
|
const requestIdRef = react.useRef(0);
|
|
260
375
|
const lastFilterKeyRef = react.useRef(null);
|
|
376
|
+
// One page bump per fetch: the body re-renders many times before the next
|
|
377
|
+
// page lands, and each of those passes still sees the end of the buffer.
|
|
378
|
+
const loadMorePendingRef = react.useRef(false);
|
|
261
379
|
react.useEffect(() => {
|
|
262
380
|
if (!dataProvider) {
|
|
263
381
|
return;
|
|
@@ -284,7 +402,14 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
284
402
|
if (id !== requestIdRef.current) {
|
|
285
403
|
return;
|
|
286
404
|
}
|
|
287
|
-
|
|
405
|
+
// Infinite scroll accumulates: only a first page replaces what is on
|
|
406
|
+
// screen, every later one appends to it. A replacement also shrinks
|
|
407
|
+
// the buffer back under a viewport scrolled far past it.
|
|
408
|
+
loadMorePendingRef.current = false;
|
|
409
|
+
if (infiniteScroll && paginationState.pageIndex === 0 && viewportElement) {
|
|
410
|
+
viewportElement.scrollTop = 0;
|
|
411
|
+
}
|
|
412
|
+
setServerItems(previous => (infiniteScroll && paginationState.pageIndex > 0 ? [...previous, ...response.items] : response.items));
|
|
288
413
|
setServerTotalRows(response.totalRows);
|
|
289
414
|
setLoadFailed(false);
|
|
290
415
|
setAnnouncement(labels.interpolate(mergedLabels.resultsAnnouncement, { count: response.totalRows }));
|
|
@@ -294,7 +419,8 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
294
419
|
if (id !== requestIdRef.current) {
|
|
295
420
|
return;
|
|
296
421
|
}
|
|
297
|
-
|
|
422
|
+
loadMorePendingRef.current = false;
|
|
423
|
+
setServerItems(EMPTY_ITEMS);
|
|
298
424
|
setServerTotalRows(0);
|
|
299
425
|
setLoadFailed(true);
|
|
300
426
|
onDataError === null || onDataError === void 0 ? void 0 : onDataError(error);
|
|
@@ -309,7 +435,9 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
309
435
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
310
436
|
}, [dataProvider, sortingState, columnFiltersState, globalFilterState, paginationState]);
|
|
311
437
|
const mounted = react.useRef(false);
|
|
312
|
-
const totalRows = serverSide ?
|
|
438
|
+
const totalRows = serverSide ?
|
|
439
|
+
serverTotalRows :
|
|
440
|
+
(typeof table.getFilteredRowModel === 'function' ? table.getFilteredRowModel() : table.getCoreRowModel()).rows.length;
|
|
313
441
|
react.useEffect(() => {
|
|
314
442
|
if (mounted.current) {
|
|
315
443
|
onSortingChange === null || onSortingChange === void 0 ? void 0 : onSortingChange(sortingState);
|
|
@@ -323,13 +451,15 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
323
451
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
324
452
|
}, [columnFiltersState, globalFilterState]);
|
|
325
453
|
react.useEffect(() => {
|
|
326
|
-
if (mounted.current) {
|
|
454
|
+
if (mounted.current && typeof table.getSelectedRowModel === 'function') {
|
|
327
455
|
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(rowSelectionState, table.getSelectedRowModel().rows.map(row => row.original));
|
|
328
456
|
}
|
|
329
457
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
330
458
|
}, [rowSelectionState]);
|
|
459
|
+
// No onPaginationChange under infinite scroll — pagination is internal
|
|
460
|
+
// there (no widget, not user-adjustable); onDataLoad is the page signal.
|
|
331
461
|
react.useEffect(() => {
|
|
332
|
-
if (mounted.current) {
|
|
462
|
+
if (mounted.current && !infiniteScroll) {
|
|
333
463
|
onPaginationChange === null || onPaginationChange === void 0 ? void 0 : onPaginationChange(paginationState);
|
|
334
464
|
}
|
|
335
465
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -374,11 +504,17 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
374
504
|
// reshuffles rows would make it point at an arbitrary one. An in-flight
|
|
375
505
|
// edit stops (commit) first. A pending focus request marks an intentional
|
|
376
506
|
// navigation (PageUp/PageDown page flip) - keep the cell it just set.
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
507
|
+
// Infinite scroll is the exception: its page bumps only append, so every
|
|
508
|
+
// row already on screen keeps its index and its focus.
|
|
509
|
+
const signature = JSON.stringify(infiniteScroll ?
|
|
510
|
+
[sortingState, columnFiltersState, globalFilterState !== null && globalFilterState !== void 0 ? globalFilterState : ''] :
|
|
511
|
+
[
|
|
512
|
+
sortingState,
|
|
513
|
+
columnFiltersState,
|
|
514
|
+
globalFilterState !== null && globalFilterState !== void 0 ? globalFilterState : '',
|
|
515
|
+
paginationState.pageIndex,
|
|
516
|
+
paginationState.pageSize
|
|
517
|
+
]);
|
|
382
518
|
if (rowSetSignatureRef.current === signature) {
|
|
383
519
|
return;
|
|
384
520
|
}
|
|
@@ -389,6 +525,7 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
389
525
|
setActiveCell(null);
|
|
390
526
|
}
|
|
391
527
|
}
|
|
528
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
392
529
|
}, [sortingState, columnFiltersState, globalFilterState, paginationState]);
|
|
393
530
|
react.useEffect(() => {
|
|
394
531
|
mounted.current = true;
|
|
@@ -400,9 +537,31 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
400
537
|
}, []);
|
|
401
538
|
const hasCustomFilterRow = columnFilters && columns$1.some(column => column.filter && column.filterable !== false);
|
|
402
539
|
const headerRowCount = hasCustomFilterRow ? 2 : 1;
|
|
403
|
-
const position = (
|
|
540
|
+
const position = (_q = paginationOptions.position) !== null && _q !== void 0 ? _q : 'bottom';
|
|
404
541
|
const rowCount = table.getRowModel().rows.length;
|
|
542
|
+
const appending = Boolean(infiniteScroll) && serverItems.length > 0;
|
|
543
|
+
const loadMore = () => {
|
|
544
|
+
if (loadMorePendingRef.current || rowCount === 0 || rowCount >= totalRows) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
loadMorePendingRef.current = true;
|
|
548
|
+
setPaginationState(previous => ({ ...previous, pageIndex: previous.pageIndex + 1 }));
|
|
549
|
+
};
|
|
405
550
|
const visibleColumnIds = columns.visibleColumns(table, columns$1).map(column => column.key);
|
|
551
|
+
// The columns the selection's column indexes address, with the formatter
|
|
552
|
+
// each cell displays through — a copied date pastes as the date on screen.
|
|
553
|
+
const clipboardColumns = () => columns.visibleColumns(table, columns$1).map(column => ({ id: column.key, formatter: column.formatter }));
|
|
554
|
+
// Prints every sorted and filtered row, not the virtual window or the
|
|
555
|
+
// current page: the grid renders a plain complete table, prints it, and
|
|
556
|
+
// throws it away.
|
|
557
|
+
const printGridTable = () => print.printGrid(table, columns.visibleColumns(table, columns$1).map(column => {
|
|
558
|
+
var _a;
|
|
559
|
+
return ({
|
|
560
|
+
id: column.key,
|
|
561
|
+
label: (_a = column.label) !== null && _a !== void 0 ? _a : column.key,
|
|
562
|
+
formatter: column.formatter
|
|
563
|
+
});
|
|
564
|
+
}), { title: printTitle });
|
|
406
565
|
const activeCellContext = () => {
|
|
407
566
|
var _a;
|
|
408
567
|
return ({
|
|
@@ -411,7 +570,8 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
411
570
|
pageStep: paginationEnabled ?
|
|
412
571
|
paginationState.pageSize :
|
|
413
572
|
Math.max(1, Math.floor(((_a = viewportElement === null || viewportElement === void 0 ? void 0 : viewportElement.clientHeight) !== null && _a !== void 0 ? _a : 0) / rowHeight) || rowCount),
|
|
414
|
-
paginated: paginationEnabled
|
|
573
|
+
paginated: paginationEnabled,
|
|
574
|
+
rtl: direction.isElementRTL(rootRef.current)
|
|
415
575
|
});
|
|
416
576
|
};
|
|
417
577
|
// Clamped for rendering only - the state stays as set and re-clamps as the
|
|
@@ -455,6 +615,14 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
455
615
|
var _a;
|
|
456
616
|
focusRequestRef.current = cell;
|
|
457
617
|
setActiveCell(cell);
|
|
618
|
+
// The active cell is the grid's single focus owner; cell selection follows
|
|
619
|
+
// it rather than keeping a second anchor of its own.
|
|
620
|
+
if (cellSelection && cell.rowIndex >= 0) {
|
|
621
|
+
const row = table.getRowModel().rows[cell.rowIndex];
|
|
622
|
+
if (row) {
|
|
623
|
+
table.setFocusedCell(row.id, cell.columnId);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
458
626
|
if (virtualizationEnabled && cell.rowIndex >= 0) {
|
|
459
627
|
// No-op when the row is already in view (align: auto); otherwise the
|
|
460
628
|
// focus request stays pending until the row renders.
|
|
@@ -742,7 +910,7 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
742
910
|
}
|
|
743
911
|
};
|
|
744
912
|
const handleNavigationKeydown = (event) => {
|
|
745
|
-
var _a, _b, _c, _d;
|
|
913
|
+
var _a, _b, _c, _d, _e;
|
|
746
914
|
if (!cellNavigationEnabled) {
|
|
747
915
|
return;
|
|
748
916
|
}
|
|
@@ -836,11 +1004,37 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
836
1004
|
}
|
|
837
1005
|
return;
|
|
838
1006
|
}
|
|
1007
|
+
if (cellSelection && (event.ctrlKey || event.metaKey) && found.cell.rowIndex >= 0) {
|
|
1008
|
+
const key = event.key.toLowerCase();
|
|
1009
|
+
if (key === 'a') {
|
|
1010
|
+
event.preventDefault();
|
|
1011
|
+
table.selectAllCells();
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
if (key === 'c') {
|
|
1015
|
+
event.preventDefault();
|
|
1016
|
+
clipboard.copyCellSelection(table, clipboardColumns()).then(text => {
|
|
1017
|
+
if (text !== '') {
|
|
1018
|
+
onCellCopy === null || onCellCopy === void 0 ? void 0 : onCellCopy({ text });
|
|
1019
|
+
}
|
|
1020
|
+
}, () => { });
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
839
1024
|
const result = activeCell.resolveNavigation(event.key, event.ctrlKey || event.metaKey, found.cell, activeCellContext());
|
|
840
1025
|
if (!result) {
|
|
841
1026
|
return;
|
|
842
1027
|
}
|
|
843
1028
|
event.preventDefault();
|
|
1029
|
+
// Shift+arrow grows the range from its anchor and leaves focus put; a
|
|
1030
|
+
// plain arrow moves focus and collapses the range to the new cell.
|
|
1031
|
+
if (cellSelection && found.cell.rowIndex >= 0 && result.cell.rowIndex >= 0) {
|
|
1032
|
+
const direction$1 = CELL_SELECTION_DIRECTIONS[direction.isElementRTL(rootRef.current) ? ((_e = INVERTED_ARROWS[event.key]) !== null && _e !== void 0 ? _e : event.key) : event.key];
|
|
1033
|
+
if (event.shiftKey && direction$1) {
|
|
1034
|
+
table.extendCellSelection(direction$1);
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
844
1038
|
if (result.pageDelta === 1 && table.getCanNextPage()) {
|
|
845
1039
|
table.nextPage();
|
|
846
1040
|
}
|
|
@@ -862,9 +1056,9 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
862
1056
|
jsxRuntime.jsx(EmptySlot, { table: table, labels: mergedLabels }) :
|
|
863
1057
|
(loadFailed ? mergedLabels.loadError : empty);
|
|
864
1058
|
const editingConfig = editingCell ?
|
|
865
|
-
(
|
|
1059
|
+
(_r = columns$1.find(column => column.key === editingCell.columnId)) !== null && _r !== void 0 ? _r : null :
|
|
866
1060
|
null;
|
|
867
|
-
const EditorComponent = (
|
|
1061
|
+
const EditorComponent = (_s = editingConfig === null || editingConfig === void 0 ? void 0 : editingConfig.editor) !== null && _s !== void 0 ? _s : CDataGridCellEditor.CDataGridCellEditor;
|
|
868
1062
|
const editorSession = editingCell && editingConfig ?
|
|
869
1063
|
{
|
|
870
1064
|
rowId: editingCell.rowId,
|
|
@@ -883,9 +1077,10 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
883
1077
|
onHidden: () => stopEditingRef.current({ commit: true, force: true })
|
|
884
1078
|
} :
|
|
885
1079
|
null;
|
|
886
|
-
return (jsxRuntime.jsxs("div", { className: `data-grid${sizingEnabled ? ' data-grid-resizable' : ''}${pinningEnabled ? ' data-grid-pinned' : ''}${className ? ` ${className}` : ''}`, "data-coreui-sorter-visibility": sorterVisibility || undefined, ref: setRootRef, ...rest, children: [jsxRuntime.jsx("div", { className: "visually-hidden", "aria-live": "polite", children: announcement }), ToolbarSlot ?
|
|
1080
|
+
return (jsxRuntime.jsxs("div", { className: `data-grid${autoRowHeight && virtualizationEnabled ? ' data-grid-auto-row-height' : ''}${sizingEnabled ? ' data-grid-resizable' : ''}${pinningEnabled ? ' data-grid-pinned' : ''}${className ? ` ${className}` : ''}`, "data-coreui-sorter-visibility": sorterVisibility || undefined, ref: setRootRef, ...rest, children: [jsxRuntime.jsx("div", { className: "visually-hidden", "aria-live": "polite", children: announcement }), ToolbarSlot ?
|
|
887
1081
|
jsxRuntime.jsx(ToolbarSlot, { table: table, labels: mergedLabels }) :
|
|
888
|
-
(resolvedToolbar.columns || resolvedToolbar.export || resolvedToolbar.
|
|
1082
|
+
(resolvedToolbar.columns || resolvedToolbar.export || resolvedToolbar.print ||
|
|
1083
|
+
resolvedToolbar.search || resolvedToolbar.history) && (jsxRuntime.jsx(CDataGridToolbar.CDataGridToolbar, { columns: columns$1, columnsIcon: toolbarColumnsIcon, container: rootRef, export: resolvedToolbar.export, exportIcon: toolbarExportIcon, exportOptions: resolvedToolbar.exportOptions, initialVisibility: initialColumnVisibility.current, labels: mergedLabels, canRedo: canRedo, canUndo: canUndo, onPrint: printGridTable, onRedo: redo, onUndo: undo, print: resolvedToolbar.print, printIcon: toolbarPrintIcon, redoIcon: toolbarRedoIcon, search: resolvedToolbar.search, searchValue: globalFilterState !== null && globalFilterState !== void 0 ? globalFilterState : '', showColumns: resolvedToolbar.columns, showHistory: resolvedToolbar.history, undoIcon: toolbarUndoIcon, table: table })), paginationEnabled && (position === 'top' || position === 'both') && paginationElement('top'), jsxRuntime.jsxs("div", { className: "data-grid-viewport", ref: setViewportElement, ...(serverSide && { 'aria-busy': loading }), ...(cellNavigationEnabled && {
|
|
889
1084
|
// Focus parks here when the focused row is recycled out of the
|
|
890
1085
|
// window; the keydown fallback then scrolls the active cell back.
|
|
891
1086
|
tabIndex: -1,
|
|
@@ -895,7 +1090,7 @@ const CDataGrid = react.forwardRef((props, ref) => {
|
|
|
895
1090
|
}), ...(editing && { onDoubleClick: handleEditingDoubleClick }), children: [jsxRuntime.jsxs("table", { className: "table", "aria-rowcount": headerRowCount + totalRows, ...(cellNavigationEnabled && {
|
|
896
1091
|
role: 'grid',
|
|
897
1092
|
'aria-colcount': visibleColumnIds.length + (selectionEnabled ? 1 : 0)
|
|
898
|
-
}), children: [jsxRuntime.jsx(CDataGridHeader.CDataGridHeader, { cellNavigation: cellNavigationEnabled, columnFilters: columnFilters, columns: columns$1, draggable: Boolean(columnOrder), icons: menuIcons, isFilterable: isColumnFilterable, isResizable: isColumnResizable, isSortable: isColumnSortable, labels: mergedLabels, menu: Boolean(columnMenu), menuBuilder: menuBuilder, menuContainer: rootRef, pinning: pinningEnabled, resizable: sizingEnabled, selectAll: selectionEnabled && selectionOptions.selectAll !== false, selection: selectionEnabled, tabStop: tabStop, table: table, visibility: Boolean(columnVisibility) }), jsxRuntime.jsx(CDataGridBody.CDataGridBody, { cellNavigation: cellNavigationEnabled, columns: columns$1, containsFocusRef: containsFocusRef, editorSession: editorSession, empty: emptyContent, focusRequestRef: focusRequestRef, headerRowCount: headerRowCount, labels: mergedLabels, overscan: overscan, pinning: pinningEnabled, rowHeight: rowHeight, rowIndexOffset: paginationEnabled ? paginationState.pageIndex * paginationState.pageSize : 0, scrollElement: viewportElement, scrollToIndexRef: scrollToIndexRef, selection: selectionEnabled, tabStop: tabStop, table: table, virtualization: virtualizationEnabled })] }), serverSide && (jsxRuntime.jsx("div", { className: "data-grid-loading", hidden: !loading, children: jsxRuntime.jsx("div", { className: "spinner-border", role: "status", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: mergedLabels.loading }) }) }))] }), (editorSession === null || editorSession === void 0 ? void 0 : editorSession.popup) && (jsxRuntime.jsx("div", { className: "data-grid-editor-popup", style: editorPopupStyle !== null && editorPopupStyle !== void 0 ? editorPopupStyle : undefined, onBlur: editorSession.onBlur, onKeyDown: handleNavigationKeydown, children: editorSession.render() })), paginationEnabled && (position === 'bottom' || position === 'both') && paginationElement('bottom')] }));
|
|
1093
|
+
}), children: [jsxRuntime.jsx(CDataGridHeader.CDataGridHeader, { cellNavigation: cellNavigationEnabled, columnFilters: columnFilters, columns: columns$1, draggable: Boolean(columnOrder), icons: menuIcons, isFilterable: isColumnFilterable, isResizable: isColumnResizable, isSortable: isColumnSortable, labels: mergedLabels, menu: Boolean(columnMenu), menuBuilder: menuBuilder, menuContainer: rootRef, pinning: pinningEnabled, resizable: sizingEnabled, rowOrder: rowOrder, selectAll: selectionEnabled && selectionOptions.selectAll !== false, selection: selectionEnabled, tabStop: tabStop, table: table, visibility: Boolean(columnVisibility) }), jsxRuntime.jsx(CDataGridBody.CDataGridBody, { cellNavigation: cellNavigationEnabled, columns: columns$1, containsFocusRef: containsFocusRef, editorSession: editorSession, empty: emptyContent, focusRequestRef: focusRequestRef, headerRowCount: headerRowCount, labels: mergedLabels, loadMoreThreshold: infiniteScroll ? (_t = infiniteOptions.threshold) !== null && _t !== void 0 ? _t : overscan : null, onLoadMore: loadMore, overscan: overscan, pinning: pinningEnabled, autoRowHeight: autoRowHeight && virtualizationEnabled, rowHeight: rowHeight, cellSelection: cellSelection, rowHandleIcon: rowHandleIcon, rowIndexOffset: paginationEnabled ? paginationState.pageIndex * paginationState.pageSize : 0, rowOrder: rowOrder, scrollElement: viewportElement, scrollToIndexRef: scrollToIndexRef, selection: selectionEnabled, tabStop: tabStop, table: table, virtualization: virtualizationEnabled })] }), serverSide && (jsxRuntime.jsx("div", { className: "data-grid-loading", hidden: !loading || appending, children: jsxRuntime.jsx("div", { className: "spinner-border", role: "status", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: mergedLabels.loading }) }) })), Boolean(infiniteScroll) && (jsxRuntime.jsx("div", { className: "data-grid-loading-more", hidden: !loading || !appending, children: jsxRuntime.jsx("div", { className: "spinner-border", role: "status", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: mergedLabels.loading }) }) }))] }), (editorSession === null || editorSession === void 0 ? void 0 : editorSession.popup) && (jsxRuntime.jsx("div", { className: "data-grid-editor-popup", style: editorPopupStyle !== null && editorPopupStyle !== void 0 ? editorPopupStyle : undefined, onBlur: editorSession.onBlur, onKeyDown: handleNavigationKeydown, children: editorSession.render() })), paginationEnabled && (position === 'bottom' || position === 'both') && paginationElement('bottom')] }));
|
|
899
1094
|
});
|
|
900
1095
|
CDataGrid.displayName = 'CDataGrid';
|
|
901
1096
|
|