@ornery/ui-grid-react 0.1.5 → 0.1.6
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/dist/UiGrid.d.ts +11 -0
- package/dist/UiGrid.d.ts.map +1 -0
- package/dist/gridStateMath.d.ts +8 -0
- package/dist/gridStateMath.d.ts.map +1 -0
- package/dist/index.d.ts +13 -155
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +541 -1054
- package/dist/index.mjs +434 -919
- package/dist/mountUiGrid.d.ts +4 -0
- package/dist/mountUiGrid.d.ts.map +1 -0
- package/dist/rustWasmGridEngine.d.ts +8 -0
- package/dist/rustWasmGridEngine.d.ts.map +1 -0
- package/dist/{index.d.mts → useGridState.d.ts} +5 -50
- package/dist/useGridState.d.ts.map +1 -0
- package/dist/useVirtualScroll.d.ts +20 -0
- package/dist/useVirtualScroll.d.ts.map +1 -0
- package/dist/virtualScrollMath.d.ts +17 -0
- package/dist/virtualScrollMath.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/UiGrid.test.tsx +2 -1
- package/src/UiGrid.tsx +174 -45
- package/src/index.ts +1 -0
- package/src/mountUiGrid.tsx +10 -0
- package/src/rustWasmGridEngine.ts +3 -1
- package/src/ui-grid.css +161 -1
- package/src/useGridState.ts +39 -27
- package/src/useVirtualScroll.ts +2 -0
- package/tsconfig.build.json +6 -0
- package/tsconfig.dts.json +15 -0
- package/CLAUDE.md +0 -283
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,18 +17,27 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var index_exports = {};
|
|
22
32
|
__export(index_exports, {
|
|
23
|
-
DEFAULT_GRID_LABELS: () =>
|
|
33
|
+
DEFAULT_GRID_LABELS: () => import_ui_grid4.DEFAULT_GRID_LABELS,
|
|
24
34
|
UiGrid: () => UiGrid,
|
|
25
35
|
buildGridTemplateColumns: () => buildGridTemplateColumns,
|
|
26
36
|
computeViewportHeightPx: () => computeViewportHeightPx,
|
|
27
37
|
computeViewportRows: () => computeViewportRows,
|
|
28
38
|
enableReactUiGridWasmEngine: () => enableReactUiGridWasmEngine,
|
|
29
39
|
formatPaginationSummary: () => formatPaginationSummary,
|
|
40
|
+
mountUiGrid: () => mountUiGrid,
|
|
30
41
|
orderVisibleColumns: () => orderVisibleColumns,
|
|
31
42
|
registerReactUiGridWasmEngineFromModule: () => registerReactUiGridWasmEngineFromModule,
|
|
32
43
|
resolveBenchmarkIterations: () => resolveBenchmarkIterations,
|
|
@@ -35,6 +46,9 @@ __export(index_exports, {
|
|
|
35
46
|
});
|
|
36
47
|
module.exports = __toCommonJS(index_exports);
|
|
37
48
|
|
|
49
|
+
// src/UiGrid.tsx
|
|
50
|
+
var import_react3 = __toESM(require("react"));
|
|
51
|
+
|
|
38
52
|
// src/useGridState.ts
|
|
39
53
|
var import_react = require("react");
|
|
40
54
|
|
|
@@ -63,678 +77,7 @@ function computeViewportRows(viewportHeight, rowHeight) {
|
|
|
63
77
|
}
|
|
64
78
|
|
|
65
79
|
// src/useGridState.ts
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
// ../ui-grid/src/lib/grid/grid.core.pagination.ts
|
|
69
|
-
function seekGridPage(page, totalPages) {
|
|
70
|
-
return Math.min(Math.max(page, 1), Math.max(totalPages, 1));
|
|
71
|
-
}
|
|
72
|
-
function resolveGridPageSize(pageSize) {
|
|
73
|
-
return Number.isFinite(pageSize) && pageSize > 0 ? pageSize : null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// ../ui-grid/src/lib/grid/grid.constants.ts
|
|
77
|
-
var SORT_DIRECTIONS = {
|
|
78
|
-
asc: "asc",
|
|
79
|
-
desc: "desc",
|
|
80
|
-
none: "none"
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// ../ui-grid/src/lib/grid/grid.utils.ts
|
|
84
|
-
var PROTECTED_PATH_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
85
|
-
function getPathValue(record, path) {
|
|
86
|
-
return path.split(".").reduce((current, part) => {
|
|
87
|
-
if (current === null || current === void 0 || typeof current !== "object") {
|
|
88
|
-
return void 0;
|
|
89
|
-
}
|
|
90
|
-
if (PROTECTED_PATH_SEGMENTS.has(part)) {
|
|
91
|
-
return void 0;
|
|
92
|
-
}
|
|
93
|
-
if (!Object.prototype.hasOwnProperty.call(current, part)) {
|
|
94
|
-
return void 0;
|
|
95
|
-
}
|
|
96
|
-
return current[part];
|
|
97
|
-
}, record);
|
|
98
|
-
}
|
|
99
|
-
function getCellValue(row, column) {
|
|
100
|
-
if (column.valueGetter) {
|
|
101
|
-
return column.valueGetter(row);
|
|
102
|
-
}
|
|
103
|
-
if (column.field) {
|
|
104
|
-
return getPathValue(row, column.field);
|
|
105
|
-
}
|
|
106
|
-
return row[column.name];
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// ../ui-grid/src/lib/grid/grid.core.identity.ts
|
|
110
|
-
function buildGridSortState(columnName, direction) {
|
|
111
|
-
return {
|
|
112
|
-
columnName,
|
|
113
|
-
direction: direction ?? SORT_DIRECTIONS.asc
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// ../ui-grid/src/lib/grid/grid.core.edit.ts
|
|
118
|
-
function beginGridEditSession(rowId, columnName, editingValue) {
|
|
119
|
-
const position = { rowId, columnName };
|
|
120
|
-
return {
|
|
121
|
-
focusedCell: position,
|
|
122
|
-
editingCell: position,
|
|
123
|
-
editingValue
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function clearGridEditSession() {
|
|
127
|
-
return {
|
|
128
|
-
editingCell: null,
|
|
129
|
-
editingValue: ""
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function stringifyGridEditorValue(value) {
|
|
133
|
-
if (value instanceof Date) {
|
|
134
|
-
return value.toISOString().slice(0, 10);
|
|
135
|
-
}
|
|
136
|
-
return value === null || value === void 0 ? "" : String(value);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// ../ui-grid/src/lib/grid/grid.core.infinite-scroll.ts
|
|
140
|
-
function maybeRequestInfiniteScrollData(context) {
|
|
141
|
-
if (context.state.dataLoading) {
|
|
142
|
-
return { request: null, nextState: context.state };
|
|
143
|
-
}
|
|
144
|
-
if (context.state.scrollUp && context.startIndex <= context.threshold) {
|
|
145
|
-
return {
|
|
146
|
-
request: "top",
|
|
147
|
-
nextState: {
|
|
148
|
-
...context.state,
|
|
149
|
-
dataLoading: true,
|
|
150
|
-
previousVisibleRows: context.visibleRows
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
if (context.state.scrollDown && context.startIndex + context.viewportRows >= Math.max(context.visibleRows - context.threshold, 0)) {
|
|
155
|
-
return {
|
|
156
|
-
request: "bottom",
|
|
157
|
-
nextState: {
|
|
158
|
-
...context.state,
|
|
159
|
-
dataLoading: true,
|
|
160
|
-
previousVisibleRows: context.visibleRows
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
return { request: null, nextState: context.state };
|
|
165
|
-
}
|
|
166
|
-
function completeInfiniteScrollDataLoad(state, scrollUp, scrollDown) {
|
|
167
|
-
return {
|
|
168
|
-
...state,
|
|
169
|
-
scrollUp,
|
|
170
|
-
scrollDown,
|
|
171
|
-
dataLoading: false
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function resetInfiniteScrollState(scrollUp, scrollDown) {
|
|
175
|
-
return {
|
|
176
|
-
scrollUp,
|
|
177
|
-
scrollDown,
|
|
178
|
-
dataLoading: false,
|
|
179
|
-
previousVisibleRows: 0
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
function saveInfiniteScrollPercentage(state, visibleRows) {
|
|
183
|
-
return {
|
|
184
|
-
...state,
|
|
185
|
-
previousVisibleRows: visibleRows
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
function setInfiniteScrollDirectionsState(state, scrollUp, scrollDown) {
|
|
189
|
-
return {
|
|
190
|
-
...state,
|
|
191
|
-
scrollUp,
|
|
192
|
-
scrollDown
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// ../ui-grid/src/lib/grid/grid.core.row-state.ts
|
|
197
|
-
function toggleGridRowExpanded(expandedRows, rowId) {
|
|
198
|
-
const expanded = !expandedRows[rowId];
|
|
199
|
-
return {
|
|
200
|
-
expanded,
|
|
201
|
-
nextExpandedRows: {
|
|
202
|
-
...expandedRows,
|
|
203
|
-
[rowId]: expanded
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function expandAllGridRows(rows) {
|
|
208
|
-
const nextExpandedRows = {};
|
|
209
|
-
for (const row of rows) {
|
|
210
|
-
nextExpandedRows[row.id] = true;
|
|
211
|
-
}
|
|
212
|
-
return nextExpandedRows;
|
|
213
|
-
}
|
|
214
|
-
function setGridTreeRowExpanded(expandedTreeRows, rowId, expanded) {
|
|
215
|
-
return {
|
|
216
|
-
...expandedTreeRows,
|
|
217
|
-
[rowId]: expanded
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
function toggleGridTreeRowExpanded(expandedTreeRows, rowId) {
|
|
221
|
-
const expanded = !expandedTreeRows[rowId];
|
|
222
|
-
return {
|
|
223
|
-
expanded,
|
|
224
|
-
nextExpandedTreeRows: setGridTreeRowExpanded(expandedTreeRows, rowId, expanded)
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function expandAllGridTreeRows(rows) {
|
|
228
|
-
const nextExpandedTreeRows = {};
|
|
229
|
-
for (const row of rows) {
|
|
230
|
-
if (row.hasChildren) {
|
|
231
|
-
nextExpandedTreeRows[row.id] = true;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return nextExpandedTreeRows;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// ../ui-grid/src/lib/grid/grid.core.state.ts
|
|
238
|
-
function normalizeGridSavedState(state) {
|
|
239
|
-
const normalized = {};
|
|
240
|
-
if (Array.isArray(state.columnOrder)) {
|
|
241
|
-
normalized.columnOrder = state.columnOrder.filter(
|
|
242
|
-
(columnName) => typeof columnName === "string" && isSafeStateKey(columnName)
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
if (state.filters && typeof state.filters === "object") {
|
|
246
|
-
normalized.filters = Object.entries(state.filters).reduce(
|
|
247
|
-
(accumulator, [key, value]) => {
|
|
248
|
-
if (typeof key === "string" && isSafeStateKey(key) && typeof value === "string") {
|
|
249
|
-
accumulator[key] = value;
|
|
250
|
-
}
|
|
251
|
-
return accumulator;
|
|
252
|
-
},
|
|
253
|
-
{}
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
if (state.sort && typeof state.sort === "object") {
|
|
257
|
-
normalized.sort = {
|
|
258
|
-
columnName: typeof state.sort.columnName === "string" && isSafeStateKey(state.sort.columnName) ? state.sort.columnName : null,
|
|
259
|
-
direction: state.sort.direction === SORT_DIRECTIONS.asc || state.sort.direction === SORT_DIRECTIONS.desc ? state.sort.direction : SORT_DIRECTIONS.none
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
if (Array.isArray(state.grouping)) {
|
|
263
|
-
normalized.grouping = state.grouping.filter(
|
|
264
|
-
(columnName) => typeof columnName === "string" && isSafeStateKey(columnName)
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
if (state.pagination && typeof state.pagination === "object") {
|
|
268
|
-
const paginationCurrentPage = Number(state.pagination.paginationCurrentPage);
|
|
269
|
-
const paginationPageSize = Number(state.pagination.paginationPageSize);
|
|
270
|
-
normalized.pagination = {
|
|
271
|
-
paginationCurrentPage: Number.isFinite(paginationCurrentPage) && paginationCurrentPage > 0 ? Math.floor(paginationCurrentPage) : 1,
|
|
272
|
-
paginationPageSize: Number.isFinite(paginationPageSize) && paginationPageSize >= 0 ? Math.floor(paginationPageSize) : 0
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
if (state.expandable && typeof state.expandable === "object") {
|
|
276
|
-
normalized.expandable = normalizeBooleanMap(state.expandable);
|
|
277
|
-
}
|
|
278
|
-
if (state.treeView && typeof state.treeView === "object") {
|
|
279
|
-
normalized.treeView = normalizeBooleanMap(state.treeView);
|
|
280
|
-
}
|
|
281
|
-
if (state.pinning && typeof state.pinning === "object") {
|
|
282
|
-
normalized.pinning = Object.entries(state.pinning).reduce(
|
|
283
|
-
(acc, [key, value]) => {
|
|
284
|
-
if (typeof key === "string" && isSafeStateKey(key) && (value === "left" || value === "right")) {
|
|
285
|
-
acc[key] = value;
|
|
286
|
-
}
|
|
287
|
-
return acc;
|
|
288
|
-
},
|
|
289
|
-
{}
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
return normalized;
|
|
293
|
-
}
|
|
294
|
-
function normalizeBooleanMap(value) {
|
|
295
|
-
return Object.entries(value).reduce((accumulator, [key, entry]) => {
|
|
296
|
-
if (typeof key === "string" && isSafeStateKey(key) && typeof entry === "boolean") {
|
|
297
|
-
accumulator[key] = entry;
|
|
298
|
-
}
|
|
299
|
-
return accumulator;
|
|
300
|
-
}, {});
|
|
301
|
-
}
|
|
302
|
-
function isSafeStateKey(value) {
|
|
303
|
-
return value !== "__proto__" && value !== "constructor" && value !== "prototype";
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// ../ui-grid/src/lib/grid/grid.core.pinning.ts
|
|
307
|
-
function isPinningEnabled(options) {
|
|
308
|
-
return options.enablePinning === true;
|
|
309
|
-
}
|
|
310
|
-
function isColumnPinnable(options, column) {
|
|
311
|
-
return isPinningEnabled(options) && column.enablePinning !== false;
|
|
312
|
-
}
|
|
313
|
-
function pinColumnState(current, columnName, direction) {
|
|
314
|
-
const next = { ...current };
|
|
315
|
-
if (direction === "none") {
|
|
316
|
-
delete next[columnName];
|
|
317
|
-
} else {
|
|
318
|
-
next[columnName] = direction;
|
|
319
|
-
}
|
|
320
|
-
return next;
|
|
321
|
-
}
|
|
322
|
-
function buildInitialPinnedState(columns) {
|
|
323
|
-
const state = {};
|
|
324
|
-
for (const col of columns) {
|
|
325
|
-
if (col.pinnedLeft) state[col.name] = "left";
|
|
326
|
-
else if (col.pinnedRight) state[col.name] = "right";
|
|
327
|
-
}
|
|
328
|
-
return state;
|
|
329
|
-
}
|
|
330
|
-
function computePinnedOffset(visibleColumns, pinnedColumns, column) {
|
|
331
|
-
const direction = pinnedColumns[column.name];
|
|
332
|
-
if (!direction) return null;
|
|
333
|
-
function resolveColumnWidthForOffset(column2) {
|
|
334
|
-
const w = column2.width;
|
|
335
|
-
if (!w) return "11rem";
|
|
336
|
-
if (w.includes("fr") || w.includes("minmax")) return "11rem";
|
|
337
|
-
return w;
|
|
338
|
-
}
|
|
339
|
-
if (direction === "left") {
|
|
340
|
-
const offsetParts = [];
|
|
341
|
-
for (const col of visibleColumns) {
|
|
342
|
-
if (col.name === column.name) break;
|
|
343
|
-
if (pinnedColumns[col.name] === "left") {
|
|
344
|
-
offsetParts.push(resolveColumnWidthForOffset(col));
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
return {
|
|
348
|
-
side: "left",
|
|
349
|
-
offset: offsetParts.length > 0 ? `calc(${offsetParts.join(" + ")})` : "0px"
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
if (direction === "right") {
|
|
353
|
-
const offsetParts = [];
|
|
354
|
-
const reversed = [...visibleColumns].reverse();
|
|
355
|
-
for (const col of reversed) {
|
|
356
|
-
if (col.name === column.name) break;
|
|
357
|
-
if (pinnedColumns[col.name] === "right") {
|
|
358
|
-
offsetParts.push(resolveColumnWidthForOffset(col));
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
return {
|
|
362
|
-
side: "right",
|
|
363
|
-
offset: offsetParts.length > 0 ? `calc(${offsetParts.join(" + ")})` : "0px"
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
return null;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// ../ui-grid/src/lib/grid/ui-grid.events.ts
|
|
370
|
-
function raiseGridRenderingComplete(gridApi) {
|
|
371
|
-
gridApi.core.raise.renderingComplete(gridApi);
|
|
372
|
-
}
|
|
373
|
-
function raiseGridRowsRendered(gridApi, rows) {
|
|
374
|
-
gridApi.core.raise.rowsRendered(rows);
|
|
375
|
-
}
|
|
376
|
-
function raiseGridRowsVisibleChanged(gridApi, rows) {
|
|
377
|
-
gridApi.core.raise.rowsVisibleChanged(rows);
|
|
378
|
-
}
|
|
379
|
-
function raiseGridCanvasHeightChanged(gridApi, oldHeight, newHeight) {
|
|
380
|
-
gridApi.core.raise.canvasHeightChanged(oldHeight, newHeight);
|
|
381
|
-
}
|
|
382
|
-
function raiseGridDimensionChanged(gridApi, oldHeight, oldWidth, newHeight, newWidth) {
|
|
383
|
-
gridApi.core.raise.gridDimensionChanged(oldHeight, oldWidth, newHeight, newWidth);
|
|
384
|
-
}
|
|
385
|
-
function raiseGridScrollBegin(gridApi) {
|
|
386
|
-
gridApi.core.raise.scrollBegin();
|
|
387
|
-
}
|
|
388
|
-
function raiseGridScrollEnd(gridApi) {
|
|
389
|
-
gridApi.core.raise.scrollEnd();
|
|
390
|
-
}
|
|
391
|
-
function raiseGridSortChanged(gridApi, sortState) {
|
|
392
|
-
gridApi.core.raise.sortChanged(sortState.columnName, sortState.direction);
|
|
393
|
-
}
|
|
394
|
-
function raiseGridFilterChanged(gridApi, filters) {
|
|
395
|
-
gridApi.core.raise.filterChanged(filters);
|
|
396
|
-
}
|
|
397
|
-
function raiseGridGroupingChanged(gridApi, groupByColumns) {
|
|
398
|
-
gridApi.core.raise.groupingChanged(groupByColumns);
|
|
399
|
-
}
|
|
400
|
-
function raiseGridColumnOrderChanged(gridApi, order) {
|
|
401
|
-
gridApi.core.raise.columnOrderChanged(order);
|
|
402
|
-
}
|
|
403
|
-
function raiseGridBenchmarkComplete(gridApi, result) {
|
|
404
|
-
gridApi.core.raise.benchmarkComplete(result);
|
|
405
|
-
}
|
|
406
|
-
function raiseGridPaginationChanged(gridApi, currentPage, pageSize) {
|
|
407
|
-
gridApi.pagination.raise.paginationChanged(currentPage, pageSize);
|
|
408
|
-
}
|
|
409
|
-
function raiseGridExpandableRowStateChanged(gridApi, row, expanded) {
|
|
410
|
-
gridApi.expandable.raise.rowExpandedStateChanged(row, expanded);
|
|
411
|
-
}
|
|
412
|
-
function raiseGridTreeRowStateChanged(gridApi, row, expanded) {
|
|
413
|
-
if (expanded) {
|
|
414
|
-
gridApi.treeBase.raise.rowExpanded(row);
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
gridApi.treeBase.raise.rowCollapsed(row);
|
|
418
|
-
}
|
|
419
|
-
function raiseGridNeedMoreData(gridApi, request) {
|
|
420
|
-
if (request === "top") {
|
|
421
|
-
gridApi.infiniteScroll.raise.needLoadMoreDataTop();
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
gridApi.infiniteScroll.raise.needLoadMoreData();
|
|
425
|
-
}
|
|
426
|
-
function raiseGridBeginCellEdit(gridApi, rowEntity, column, triggerEvent) {
|
|
427
|
-
gridApi.edit.raise.beginCellEdit(rowEntity, column, triggerEvent);
|
|
428
|
-
}
|
|
429
|
-
function raiseGridAfterCellEdit(gridApi, rowEntity, column, newValue, oldValue) {
|
|
430
|
-
gridApi.edit.raise.afterCellEdit(rowEntity, column, newValue, oldValue);
|
|
431
|
-
}
|
|
432
|
-
function raiseGridCancelCellEdit(gridApi, rowEntity, column) {
|
|
433
|
-
gridApi.edit.raise.cancelCellEdit(rowEntity, column);
|
|
434
|
-
}
|
|
435
|
-
function raiseGridColumnPinned(gridApi, columnName, direction) {
|
|
436
|
-
gridApi.pinning.raise.columnPinned(columnName, direction);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// ../ui-grid/src/lib/grid/ui-grid.state.ts
|
|
440
|
-
function moveArrayItem(items, fromIndex, toIndex) {
|
|
441
|
-
const next = [...items];
|
|
442
|
-
const [item] = next.splice(fromIndex, 1);
|
|
443
|
-
if (item === void 0) {
|
|
444
|
-
return next;
|
|
445
|
-
}
|
|
446
|
-
next.splice(toIndex, 0, item);
|
|
447
|
-
return next;
|
|
448
|
-
}
|
|
449
|
-
function moveGridColumnOrderState(current, fromIndex, toIndex) {
|
|
450
|
-
return moveArrayItem(current, fromIndex, toIndex);
|
|
451
|
-
}
|
|
452
|
-
function createGridRestoreMutationPlan(state) {
|
|
453
|
-
const normalizedState = normalizeGridSavedState(state);
|
|
454
|
-
const plan = {};
|
|
455
|
-
if (normalizedState.columnOrder) {
|
|
456
|
-
plan.columnOrder = normalizedState.columnOrder;
|
|
457
|
-
}
|
|
458
|
-
if (normalizedState.filters) {
|
|
459
|
-
plan.filters = normalizedState.filters;
|
|
460
|
-
}
|
|
461
|
-
if (normalizedState.sort) {
|
|
462
|
-
plan.sort = normalizedState.sort;
|
|
463
|
-
}
|
|
464
|
-
if (normalizedState.grouping) {
|
|
465
|
-
plan.grouping = normalizedState.grouping;
|
|
466
|
-
}
|
|
467
|
-
if (normalizedState.pagination) {
|
|
468
|
-
plan.pagination = {
|
|
469
|
-
currentPage: normalizedState.pagination.paginationCurrentPage,
|
|
470
|
-
pageSize: normalizedState.pagination.paginationPageSize
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
if (normalizedState.expandable) {
|
|
474
|
-
plan.expandable = normalizedState.expandable;
|
|
475
|
-
}
|
|
476
|
-
if (normalizedState.treeView) {
|
|
477
|
-
plan.treeView = normalizedState.treeView;
|
|
478
|
-
}
|
|
479
|
-
if (normalizedState.pinning) {
|
|
480
|
-
plan.pinning = normalizedState.pinning;
|
|
481
|
-
}
|
|
482
|
-
return plan;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// ../ui-grid/src/lib/grid/ui-grid.commands.ts
|
|
486
|
-
function applyGridSortStateCommand(gridApi, setSortState, sortState) {
|
|
487
|
-
setSortState(sortState);
|
|
488
|
-
raiseGridSortChanged(gridApi, sortState);
|
|
489
|
-
}
|
|
490
|
-
function sortGridColumnCommand(gridApi, setSortState, columnName, direction) {
|
|
491
|
-
applyGridSortStateCommand(gridApi, setSortState, buildGridSortState(columnName, direction));
|
|
492
|
-
}
|
|
493
|
-
function updateGridFilterCommand(gridApi, updateFilters, getFilters, columnName, value) {
|
|
494
|
-
updateFilters((current) => ({
|
|
495
|
-
...current,
|
|
496
|
-
[columnName]: value
|
|
497
|
-
}));
|
|
498
|
-
raiseGridFilterChanged(gridApi, getFilters());
|
|
499
|
-
}
|
|
500
|
-
function clearGridFiltersCommand(gridApi, setFilters) {
|
|
501
|
-
const nextFilters = {};
|
|
502
|
-
setFilters(nextFilters);
|
|
503
|
-
raiseGridFilterChanged(gridApi, nextFilters);
|
|
504
|
-
}
|
|
505
|
-
function clearGridGroupingCommand(gridApi, setGroupByColumns, shouldRaise = true) {
|
|
506
|
-
const nextGrouping = [];
|
|
507
|
-
setGroupByColumns(nextGrouping);
|
|
508
|
-
if (shouldRaise) {
|
|
509
|
-
raiseGridGroupingChanged(gridApi, nextGrouping);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
function moveGridColumnCommand(gridApi, canMoveColumns, updateColumnOrder, fromIndex, toIndex) {
|
|
513
|
-
if (!canMoveColumns) {
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
updateColumnOrder((current) => {
|
|
517
|
-
const next = moveGridColumnOrderState(current, fromIndex, toIndex);
|
|
518
|
-
raiseGridColumnOrderChanged(gridApi, next);
|
|
519
|
-
return next;
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
function pinGridColumnCommand(gridApi, isPinningEnabled2, setPinnedColumns, getCurrentPinnedColumns, columnName, direction) {
|
|
523
|
-
if (!isPinningEnabled2) return;
|
|
524
|
-
const next = pinColumnState(getCurrentPinnedColumns(), columnName, direction);
|
|
525
|
-
setPinnedColumns(next);
|
|
526
|
-
raiseGridColumnPinned(gridApi, columnName, direction);
|
|
527
|
-
}
|
|
528
|
-
function seekGridPaginationCommand(gridApi, setCurrentPage, getTotalPages, getEffectivePageSize, page) {
|
|
529
|
-
const nextPage = seekGridPage(page, getTotalPages());
|
|
530
|
-
setCurrentPage(nextPage);
|
|
531
|
-
raiseGridPaginationChanged(gridApi, nextPage, getEffectivePageSize());
|
|
532
|
-
}
|
|
533
|
-
function setGridPaginationPageSizeCommand(gridApi, setPageSize, setCurrentPage, pageSize) {
|
|
534
|
-
const nextPageSize = resolveGridPageSize(pageSize);
|
|
535
|
-
if (nextPageSize === null) {
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
setPageSize(nextPageSize);
|
|
539
|
-
setCurrentPage(1);
|
|
540
|
-
raiseGridPaginationChanged(gridApi, 1, nextPageSize);
|
|
541
|
-
}
|
|
542
|
-
function restoreGridStateCommand(gridApi, state, access) {
|
|
543
|
-
const restorePlan = createGridRestoreMutationPlan(state);
|
|
544
|
-
if (restorePlan.columnOrder) {
|
|
545
|
-
access.setColumnOrder(restorePlan.columnOrder);
|
|
546
|
-
}
|
|
547
|
-
if (restorePlan.filters) {
|
|
548
|
-
access.setActiveFilters(restorePlan.filters);
|
|
549
|
-
raiseGridFilterChanged(gridApi, restorePlan.filters);
|
|
550
|
-
}
|
|
551
|
-
if (restorePlan.sort) {
|
|
552
|
-
access.setSortState(restorePlan.sort);
|
|
553
|
-
}
|
|
554
|
-
if (restorePlan.grouping) {
|
|
555
|
-
access.setGroupByColumns(restorePlan.grouping);
|
|
556
|
-
raiseGridGroupingChanged(gridApi, restorePlan.grouping);
|
|
557
|
-
}
|
|
558
|
-
if (restorePlan.pagination) {
|
|
559
|
-
access.setCurrentPage(restorePlan.pagination.currentPage);
|
|
560
|
-
access.setPageSize(restorePlan.pagination.pageSize);
|
|
561
|
-
raiseGridPaginationChanged(
|
|
562
|
-
gridApi,
|
|
563
|
-
restorePlan.pagination.currentPage,
|
|
564
|
-
access.getEffectivePageSize()
|
|
565
|
-
);
|
|
566
|
-
}
|
|
567
|
-
if (restorePlan.expandable) {
|
|
568
|
-
access.setExpandedRows(restorePlan.expandable);
|
|
569
|
-
}
|
|
570
|
-
if (restorePlan.treeView) {
|
|
571
|
-
access.setExpandedTreeRows(restorePlan.treeView);
|
|
572
|
-
}
|
|
573
|
-
if (restorePlan.pinning && typeof access.setPinnedColumns === "function") {
|
|
574
|
-
access.setPinnedColumns(restorePlan.pinning);
|
|
575
|
-
for (const [col, dir] of Object.entries(restorePlan.pinning)) {
|
|
576
|
-
raiseGridColumnPinned(gridApi, col, dir);
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
function toggleGridRowExpansionCommand(gridApi, canExpandRows, currentExpandedRows, rowId, setExpandedRows, findRowById) {
|
|
581
|
-
if (!canExpandRows) {
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
const { expanded, nextExpandedRows } = toggleGridRowExpanded(currentExpandedRows, rowId);
|
|
585
|
-
setExpandedRows(nextExpandedRows);
|
|
586
|
-
const gridRow = findRowById(rowId);
|
|
587
|
-
if (!gridRow) {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
gridRow.expanded = expanded;
|
|
591
|
-
raiseGridExpandableRowStateChanged(gridApi, gridRow, expanded);
|
|
592
|
-
}
|
|
593
|
-
function expandAllGridRowsCommand(buildRows, data, setExpandedRows) {
|
|
594
|
-
setExpandedRows(expandAllGridRows(buildRows(data)));
|
|
595
|
-
}
|
|
596
|
-
function collapseAllGridRowsCommand(setExpandedRows) {
|
|
597
|
-
setExpandedRows({});
|
|
598
|
-
}
|
|
599
|
-
function toggleGridTreeRowCommand(gridApi, currentExpandedTreeRows, rowId, setExpandedTreeRows, findRowById) {
|
|
600
|
-
const { expanded, nextExpandedTreeRows } = toggleGridTreeRowExpanded(
|
|
601
|
-
currentExpandedTreeRows,
|
|
602
|
-
rowId
|
|
603
|
-
);
|
|
604
|
-
setExpandedTreeRows(nextExpandedTreeRows);
|
|
605
|
-
const gridRow = findRowById(rowId);
|
|
606
|
-
if (gridRow) {
|
|
607
|
-
raiseGridTreeRowStateChanged(gridApi, gridRow, expanded);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
function setGridTreeRowExpandedCommand(gridApi, currentExpandedTreeRows, rowId, expanded, setExpandedTreeRows, findRowById) {
|
|
611
|
-
setExpandedTreeRows(setGridTreeRowExpanded(currentExpandedTreeRows, rowId, expanded));
|
|
612
|
-
const gridRow = findRowById(rowId);
|
|
613
|
-
if (gridRow) {
|
|
614
|
-
raiseGridTreeRowStateChanged(gridApi, gridRow, expanded);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
function expandAllGridTreeRowsCommand(buildRows, data, setExpandedTreeRows) {
|
|
618
|
-
setExpandedTreeRows(expandAllGridTreeRows(buildRows(data)));
|
|
619
|
-
}
|
|
620
|
-
function collapseAllGridTreeRowsCommand(setExpandedTreeRows) {
|
|
621
|
-
setExpandedTreeRows({});
|
|
622
|
-
}
|
|
623
|
-
function beginGridCellEditCommand(gridApi, access, row, column, currentValue, triggerEvent, initialValue) {
|
|
624
|
-
const nextEditSession = beginGridEditSession(
|
|
625
|
-
row.id,
|
|
626
|
-
column.name,
|
|
627
|
-
initialValue ?? stringifyGridEditorValue(currentValue)
|
|
628
|
-
);
|
|
629
|
-
access.setFocusedCell(nextEditSession.focusedCell);
|
|
630
|
-
access.setEditingCell(nextEditSession.editingCell);
|
|
631
|
-
access.setEditingValue(nextEditSession.editingValue);
|
|
632
|
-
raiseGridBeginCellEdit(gridApi, row.entity, column, triggerEvent);
|
|
633
|
-
return nextEditSession.editingCell;
|
|
634
|
-
}
|
|
635
|
-
function commitGridCellEditCommand(gridApi, access) {
|
|
636
|
-
const editingCell = access.getEditingCell();
|
|
637
|
-
if (!editingCell) {
|
|
638
|
-
return { committed: false };
|
|
639
|
-
}
|
|
640
|
-
const row = access.findRowById(editingCell.rowId);
|
|
641
|
-
const column = access.findColumnByName(editingCell.columnName);
|
|
642
|
-
if (!row || !column) {
|
|
643
|
-
access.setEditingCell(null);
|
|
644
|
-
return { committed: false };
|
|
645
|
-
}
|
|
646
|
-
const oldValue = getCellValue(row.entity, column);
|
|
647
|
-
const newValue = access.parseEditedValue(column, access.getEditingValue(), oldValue);
|
|
648
|
-
access.setCellValue(row.entity, column, newValue);
|
|
649
|
-
const clearedEditSession = clearGridEditSession();
|
|
650
|
-
access.setEditingCell(clearedEditSession.editingCell);
|
|
651
|
-
raiseGridAfterCellEdit(gridApi, row.entity, column, newValue, oldValue);
|
|
652
|
-
access.setEditingValue(clearedEditSession.editingValue);
|
|
653
|
-
return {
|
|
654
|
-
committed: true,
|
|
655
|
-
focusTarget: { rowId: row.id, columnName: column.name },
|
|
656
|
-
row,
|
|
657
|
-
column
|
|
658
|
-
};
|
|
659
|
-
}
|
|
660
|
-
function cancelGridCellEditCommand(gridApi, access) {
|
|
661
|
-
const editingCell = access.getEditingCell();
|
|
662
|
-
if (!editingCell) {
|
|
663
|
-
return {};
|
|
664
|
-
}
|
|
665
|
-
const row = access.findRowById(editingCell.rowId);
|
|
666
|
-
const column = access.findColumnByName(editingCell.columnName);
|
|
667
|
-
const clearedEditSession = clearGridEditSession();
|
|
668
|
-
access.setEditingCell(clearedEditSession.editingCell);
|
|
669
|
-
access.setEditingValue(clearedEditSession.editingValue);
|
|
670
|
-
if (!row || !column) {
|
|
671
|
-
return {};
|
|
672
|
-
}
|
|
673
|
-
raiseGridCancelCellEdit(gridApi, row.entity, column);
|
|
674
|
-
return { focusTarget: editingCell };
|
|
675
|
-
}
|
|
676
|
-
function maybeRequestInfiniteScrollCommand(gridApi, access) {
|
|
677
|
-
if (!access.enabled || !access.virtualizationEnabled) {
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
const { request, nextState } = maybeRequestInfiniteScrollData({
|
|
681
|
-
state: access.state,
|
|
682
|
-
startIndex: access.startIndex,
|
|
683
|
-
visibleRows: access.visibleRows,
|
|
684
|
-
viewportRows: access.viewportRows,
|
|
685
|
-
threshold: access.threshold
|
|
686
|
-
});
|
|
687
|
-
if (request === "top" || request === "bottom") {
|
|
688
|
-
access.setState(nextState);
|
|
689
|
-
raiseGridNeedMoreData(gridApi, request);
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
function completeGridInfiniteScrollDataLoadCommand(currentState, setState, scrollUp, scrollDown) {
|
|
693
|
-
setState(completeInfiniteScrollDataLoad(currentState, scrollUp, scrollDown));
|
|
694
|
-
return Promise.resolve();
|
|
695
|
-
}
|
|
696
|
-
function resetGridInfiniteScrollCommand(setState, scrollUp, scrollDown) {
|
|
697
|
-
setState(resetInfiniteScrollState(scrollUp, scrollDown));
|
|
698
|
-
}
|
|
699
|
-
function saveGridInfiniteScrollPercentageCommand(currentState, visibleRows, setState) {
|
|
700
|
-
setState(saveInfiniteScrollPercentage(currentState, visibleRows));
|
|
701
|
-
}
|
|
702
|
-
function setGridInfiniteScrollDirectionsCommand(currentState, setState, scrollUp, scrollDown) {
|
|
703
|
-
setState(setInfiniteScrollDirectionsState(currentState, scrollUp, scrollDown));
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
// ../ui-grid/src/lib/grid/ui-grid.host.ts
|
|
707
|
-
function observeGridHostSize(hostElement, onSizeChange) {
|
|
708
|
-
if (typeof ResizeObserver === "undefined") {
|
|
709
|
-
return null;
|
|
710
|
-
}
|
|
711
|
-
const observer = new ResizeObserver((entries) => {
|
|
712
|
-
const entry = entries[0];
|
|
713
|
-
if (!entry) {
|
|
714
|
-
return;
|
|
715
|
-
}
|
|
716
|
-
onSizeChange({
|
|
717
|
-
height: Math.round(entry.contentRect.height),
|
|
718
|
-
width: Math.round(entry.contentRect.width)
|
|
719
|
-
});
|
|
720
|
-
});
|
|
721
|
-
observer.observe(hostElement);
|
|
722
|
-
return observer;
|
|
723
|
-
}
|
|
724
|
-
function downloadGridCsvFile(csv, filename) {
|
|
725
|
-
if (typeof Blob === "undefined" || typeof URL === "undefined" || typeof document === "undefined") {
|
|
726
|
-
return;
|
|
727
|
-
}
|
|
728
|
-
const blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
|
|
729
|
-
const url = URL.createObjectURL(blob);
|
|
730
|
-
const link = document.createElement("a");
|
|
731
|
-
link.href = url;
|
|
732
|
-
link.download = filename;
|
|
733
|
-
link.click();
|
|
734
|
-
URL.revokeObjectURL(url);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
// src/useGridState.ts
|
|
80
|
+
var import_ui_grid2 = require("@ornery/ui-grid");
|
|
738
81
|
function escapeCssSelectorValue(value) {
|
|
739
82
|
const nativeEscape = globalThis.CSS?.escape;
|
|
740
83
|
if (typeof nativeEscape === "function") {
|
|
@@ -772,7 +115,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
772
115
|
const [hiddenRowReasons, setHiddenRowReasons] = (0, import_react.useState)({});
|
|
773
116
|
const [sortState, setSortState] = (0, import_react.useState)({
|
|
774
117
|
columnName: null,
|
|
775
|
-
direction:
|
|
118
|
+
direction: import_ui_grid2.SORT_DIRECTIONS.none
|
|
776
119
|
});
|
|
777
120
|
const [focusedCell, setFocusedCell] = (0, import_react.useState)(null);
|
|
778
121
|
const [editingCell, setEditingCell] = (0, import_react.useState)(null);
|
|
@@ -833,12 +176,21 @@ function useGridState(options, onRegisterApi) {
|
|
|
833
176
|
optionsRef.current = options;
|
|
834
177
|
const rowSize = options.rowHeight ?? 44;
|
|
835
178
|
const visibleColumns = (0, import_react.useMemo)(() => {
|
|
836
|
-
|
|
837
|
-
|
|
179
|
+
const orderedColumns = orderVisibleColumns(options.columnDefs, columnOrder);
|
|
180
|
+
const pinnedEntries = Object.entries(pinnedColumns);
|
|
181
|
+
if (pinnedEntries.length === 0) {
|
|
182
|
+
return orderedColumns;
|
|
183
|
+
}
|
|
184
|
+
const columnByName = new Map(orderedColumns.map((column) => [column.name, column]));
|
|
185
|
+
const pinnedLeft = pinnedEntries.filter(([, direction]) => direction === "left").map(([columnName]) => columnByName.get(columnName)).filter((column) => column !== void 0);
|
|
186
|
+
const pinnedRight = pinnedEntries.filter(([, direction]) => direction === "right").map(([columnName]) => columnByName.get(columnName)).filter((column) => column !== void 0);
|
|
187
|
+
const centerColumns = orderedColumns.filter((column) => pinnedColumns[column.name] === void 0);
|
|
188
|
+
return [...pinnedLeft, ...centerColumns, ...pinnedRight];
|
|
189
|
+
}, [options.columnDefs, columnOrder, pinnedColumns]);
|
|
838
190
|
const visibleColumnsRef = (0, import_react.useRef)(visibleColumns);
|
|
839
191
|
visibleColumnsRef.current = visibleColumns;
|
|
840
192
|
const pipeline = (0, import_react.useMemo)(() => {
|
|
841
|
-
return
|
|
193
|
+
return import_ui_grid2.defaultGridEngine.buildPipeline({
|
|
842
194
|
options,
|
|
843
195
|
columns: visibleColumns,
|
|
844
196
|
activeFilters,
|
|
@@ -868,28 +220,28 @@ function useGridState(options, onRegisterApi) {
|
|
|
868
220
|
]);
|
|
869
221
|
const pipelineRef = (0, import_react.useRef)(pipeline);
|
|
870
222
|
pipelineRef.current = pipeline;
|
|
871
|
-
const labels = (0, import_react.useMemo)(() => (0,
|
|
223
|
+
const labels = (0, import_react.useMemo)(() => (0, import_ui_grid2.resolveGridLabels)(options.labels), [options.labels]);
|
|
872
224
|
const gridTemplateColumns = (0, import_react.useMemo)(
|
|
873
225
|
() => buildGridTemplateColumns(visibleColumns),
|
|
874
226
|
[visibleColumns]
|
|
875
227
|
);
|
|
876
228
|
const isPinningEnabledFn = (0, import_react.useCallback)(() => {
|
|
877
|
-
return isPinningEnabled(optionsRef.current);
|
|
229
|
+
return (0, import_ui_grid2.isPinningEnabled)(optionsRef.current);
|
|
878
230
|
}, []);
|
|
879
231
|
const isColumnPinnableFn = (0, import_react.useCallback)((column) => {
|
|
880
|
-
return isColumnPinnable(optionsRef.current, column);
|
|
232
|
+
return (0, import_ui_grid2.isColumnPinnable)(optionsRef.current, column);
|
|
881
233
|
}, []);
|
|
882
234
|
const isPinnedFn = (0, import_react.useCallback)((column) => {
|
|
883
235
|
return pinnedColumnsRef.current[column.name] !== void 0;
|
|
884
236
|
}, []);
|
|
885
237
|
const pinnedOffsetFn = (0, import_react.useCallback)((column) => {
|
|
886
|
-
return computePinnedOffset(visibleColumnsRef.current, pinnedColumnsRef.current, column);
|
|
238
|
+
return (0, import_ui_grid2.computePinnedOffset)(visibleColumnsRef.current, pinnedColumnsRef.current, column);
|
|
887
239
|
}, []);
|
|
888
240
|
const resolveRowId = (0, import_react.useCallback)((row) => {
|
|
889
|
-
return (0,
|
|
241
|
+
return (0, import_ui_grid2.resolveGridRowId)(optionsRef.current, row);
|
|
890
242
|
}, []);
|
|
891
243
|
const buildRowsFromData = (0, import_react.useCallback)((data) => {
|
|
892
|
-
return (0,
|
|
244
|
+
return (0, import_ui_grid2.buildGridRows)(
|
|
893
245
|
{ ...optionsRef.current, data },
|
|
894
246
|
optionsRef.current.rowHeight ?? 44,
|
|
895
247
|
hiddenRowReasonsRef.current,
|
|
@@ -898,19 +250,19 @@ function useGridState(options, onRegisterApi) {
|
|
|
898
250
|
}, []);
|
|
899
251
|
const findRowById = (0, import_react.useCallback)(
|
|
900
252
|
(rowId) => {
|
|
901
|
-
return (0,
|
|
253
|
+
return (0, import_ui_grid2.findGridRowById)(buildRowsFromData(optionsRef.current.data), rowId);
|
|
902
254
|
},
|
|
903
255
|
[buildRowsFromData]
|
|
904
256
|
);
|
|
905
257
|
const canExpandRowsFn = (0, import_react.useCallback)(() => {
|
|
906
|
-
return
|
|
258
|
+
return import_ui_grid2.FEATURE_EXPANDABLE && (0, import_ui_grid2.canGridExpandRows)(optionsRef.current);
|
|
907
259
|
}, []);
|
|
908
260
|
const effectivePageSizeFn = (0, import_react.useCallback)((totalItems) => {
|
|
909
|
-
return (0,
|
|
261
|
+
return (0, import_ui_grid2.getEffectivePageSize)(optionsRef.current, pageSizeRef.current, totalItems);
|
|
910
262
|
}, []);
|
|
911
263
|
const getCurrentPageValueFn = (0, import_react.useCallback)((totalItems) => {
|
|
912
264
|
const ti = totalItems ?? pipelineRef.current.totalItems;
|
|
913
|
-
return (0,
|
|
265
|
+
return (0, import_ui_grid2.getCurrentPageValue)(
|
|
914
266
|
optionsRef.current,
|
|
915
267
|
currentPageRef.current,
|
|
916
268
|
ti,
|
|
@@ -919,11 +271,11 @@ function useGridState(options, onRegisterApi) {
|
|
|
919
271
|
}, []);
|
|
920
272
|
const getTotalPagesValueFn = (0, import_react.useCallback)((totalItems) => {
|
|
921
273
|
const ti = totalItems ?? pipelineRef.current.totalItems;
|
|
922
|
-
return (0,
|
|
274
|
+
return (0, import_ui_grid2.getTotalPagesValue)(optionsRef.current, ti, pageSizeRef.current);
|
|
923
275
|
}, []);
|
|
924
276
|
const getFirstRowIndexValueFn = (0, import_react.useCallback)((totalItems) => {
|
|
925
277
|
const ti = totalItems ?? pipelineRef.current.totalItems;
|
|
926
|
-
return (0,
|
|
278
|
+
return (0, import_ui_grid2.getFirstRowIndexValue)(
|
|
927
279
|
optionsRef.current,
|
|
928
280
|
currentPageRef.current,
|
|
929
281
|
ti,
|
|
@@ -932,7 +284,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
932
284
|
}, []);
|
|
933
285
|
const getLastRowIndexValueFn = (0, import_react.useCallback)((totalItems) => {
|
|
934
286
|
const ti = totalItems ?? pipelineRef.current.totalItems;
|
|
935
|
-
return (0,
|
|
287
|
+
return (0, import_ui_grid2.getLastRowIndexValue)(
|
|
936
288
|
optionsRef.current,
|
|
937
289
|
currentPageRef.current,
|
|
938
290
|
ti,
|
|
@@ -941,7 +293,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
941
293
|
}, []);
|
|
942
294
|
const isCellEditable = (0, import_react.useCallback)(
|
|
943
295
|
(row, column, triggerEvent) => {
|
|
944
|
-
if (!
|
|
296
|
+
if (!import_ui_grid2.FEATURE_CELL_EDIT) return false;
|
|
945
297
|
const editable = column.enableCellEdit ?? optionsRef.current.enableCellEdit ?? false;
|
|
946
298
|
if (!editable) return false;
|
|
947
299
|
const condition = column.cellEditableCondition ?? optionsRef.current.cellEditableCondition ?? true;
|
|
@@ -1006,12 +358,12 @@ function useGridState(options, onRegisterApi) {
|
|
|
1006
358
|
refresh: () => setActiveFilters((current) => ({ ...current })),
|
|
1007
359
|
getVisibleRows: () => pipelineRef.current.visibleRows,
|
|
1008
360
|
setRowInvisible: (row, reason = "user") => {
|
|
1009
|
-
const rowId = (0,
|
|
1010
|
-
setHiddenRowReasons((current) => (0,
|
|
361
|
+
const rowId = (0, import_ui_grid2.resolveGridRowId)(optionsRef.current, row);
|
|
362
|
+
setHiddenRowReasons((current) => (0, import_ui_grid2.addGridRowInvisibleReason)(current, rowId, reason));
|
|
1011
363
|
},
|
|
1012
364
|
clearRowInvisible: (row, reason = "user") => {
|
|
1013
|
-
const rowId = (0,
|
|
1014
|
-
setHiddenRowReasons((current) => (0,
|
|
365
|
+
const rowId = (0, import_ui_grid2.resolveGridRowId)(optionsRef.current, row);
|
|
366
|
+
setHiddenRowReasons((current) => (0, import_ui_grid2.clearGridRowInvisibleReason)(current, rowId, reason));
|
|
1015
367
|
},
|
|
1016
368
|
setFilter: (columnName, value) => {
|
|
1017
369
|
setActiveFilters((current) => {
|
|
@@ -1028,19 +380,19 @@ function useGridState(options, onRegisterApi) {
|
|
|
1028
380
|
queueMicrotask(() => gridApiRef.current.core.raise.filterChanged(nextFilters));
|
|
1029
381
|
},
|
|
1030
382
|
sortColumn: (columnName, direction) => {
|
|
1031
|
-
sortGridColumnCommand(gridApiRef.current, (s) => setSortState(s), columnName, direction);
|
|
383
|
+
(0, import_ui_grid2.sortGridColumnCommand)(gridApiRef.current, (s) => setSortState(s), columnName, direction);
|
|
1032
384
|
},
|
|
1033
385
|
moveColumn: (fromIndex, toIndex) => {
|
|
1034
|
-
moveGridColumnCommand(
|
|
386
|
+
(0, import_ui_grid2.moveGridColumnCommand)(
|
|
1035
387
|
gridApiRef.current,
|
|
1036
|
-
|
|
388
|
+
import_ui_grid2.FEATURE_COLUMN_MOVING && optionsRef.current.enableColumnMoving === true,
|
|
1037
389
|
(updater) => setColumnOrder((current) => updater(current)),
|
|
1038
390
|
fromIndex,
|
|
1039
391
|
toIndex
|
|
1040
392
|
);
|
|
1041
393
|
},
|
|
1042
394
|
toggleGrouping: (columnName) => {
|
|
1043
|
-
if (!(
|
|
395
|
+
if (!(import_ui_grid2.FEATURE_GROUPING && (0, import_ui_grid2.isGridGroupingEnabled)(optionsRef.current))) return;
|
|
1044
396
|
const current = groupByColumnsRef.current;
|
|
1045
397
|
const next = current.includes(columnName) ? current.filter((n) => n !== columnName) : [...current, columnName];
|
|
1046
398
|
groupByColumnsRef.current = next;
|
|
@@ -1048,7 +400,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1048
400
|
gridApiRef.current.core.raise.groupingChanged(next);
|
|
1049
401
|
},
|
|
1050
402
|
clearGrouping: () => {
|
|
1051
|
-
clearGridGroupingCommand(
|
|
403
|
+
(0, import_ui_grid2.clearGridGroupingCommand)(
|
|
1052
404
|
gridApiRef.current,
|
|
1053
405
|
(grouping) => setGroupByColumns(grouping),
|
|
1054
406
|
false
|
|
@@ -1071,30 +423,30 @@ function useGridState(options, onRegisterApi) {
|
|
|
1071
423
|
toggleRowExpansion: (row) => toggleRowExpansionByRefFn(row),
|
|
1072
424
|
expandAllRows: () => expandAllRowsFn(),
|
|
1073
425
|
collapseAllRows: () => {
|
|
1074
|
-
collapseAllGridRowsCommand((e) => setExpandedRows(e));
|
|
426
|
+
(0, import_ui_grid2.collapseAllGridRowsCommand)((e) => setExpandedRows(e));
|
|
1075
427
|
},
|
|
1076
428
|
toggleAllRows: () => toggleAllRowsFn(),
|
|
1077
429
|
treeExpandAllRows: () => {
|
|
1078
|
-
expandAllGridTreeRowsCommand(
|
|
430
|
+
(0, import_ui_grid2.expandAllGridTreeRowsCommand)(
|
|
1079
431
|
(data) => buildRowsFromData(data),
|
|
1080
432
|
optionsRef.current.data,
|
|
1081
433
|
(e) => setExpandedTreeRows(e)
|
|
1082
434
|
);
|
|
1083
435
|
},
|
|
1084
436
|
treeCollapseAllRows: () => {
|
|
1085
|
-
collapseAllGridTreeRowsCommand((e) => setExpandedTreeRows(e));
|
|
437
|
+
(0, import_ui_grid2.collapseAllGridTreeRowsCommand)((e) => setExpandedTreeRows(e));
|
|
1086
438
|
},
|
|
1087
439
|
treeToggleRow: (row) => toggleTreeRowByRefFn(row),
|
|
1088
440
|
treeExpandRow: (row) => expandTreeRowByRefFn(row),
|
|
1089
441
|
treeCollapseRow: (row) => collapseTreeRowByRefFn(row),
|
|
1090
442
|
treeGetRowChildren: (row) => {
|
|
1091
|
-
const rowId = (0,
|
|
443
|
+
const rowId = (0, import_ui_grid2.resolveGridRowId)(optionsRef.current, row);
|
|
1092
444
|
return buildRowsFromData(optionsRef.current.data).filter((r) => r.parentId === rowId);
|
|
1093
445
|
},
|
|
1094
446
|
treeGetState: () => expandedTreeRowsRef.current,
|
|
1095
447
|
treeSetState: (state) => setExpandedTreeRows({ ...state }),
|
|
1096
448
|
infiniteScrollDataLoaded: (scrollUp, scrollDown) => {
|
|
1097
|
-
return completeGridInfiniteScrollDataLoadCommand(
|
|
449
|
+
return (0, import_ui_grid2.completeGridInfiniteScrollDataLoadCommand)(
|
|
1098
450
|
infiniteScrollStateRef.current,
|
|
1099
451
|
(s) => setInfiniteScrollState(s),
|
|
1100
452
|
scrollUp ?? infiniteScrollStateRef.current.scrollUp,
|
|
@@ -1102,35 +454,35 @@ function useGridState(options, onRegisterApi) {
|
|
|
1102
454
|
);
|
|
1103
455
|
},
|
|
1104
456
|
infiniteScrollReset: (scrollUp, scrollDown) => {
|
|
1105
|
-
resetGridInfiniteScrollCommand(
|
|
457
|
+
(0, import_ui_grid2.resetGridInfiniteScrollCommand)(
|
|
1106
458
|
(s) => setInfiniteScrollState(s),
|
|
1107
459
|
scrollUp ?? infiniteScrollStateRef.current.scrollUp,
|
|
1108
460
|
scrollDown ?? infiniteScrollStateRef.current.scrollDown
|
|
1109
461
|
);
|
|
1110
462
|
},
|
|
1111
463
|
infiniteScrollSaveScrollPercentage: () => {
|
|
1112
|
-
saveGridInfiniteScrollPercentageCommand(
|
|
464
|
+
(0, import_ui_grid2.saveGridInfiniteScrollPercentageCommand)(
|
|
1113
465
|
infiniteScrollStateRef.current,
|
|
1114
466
|
pipelineRef.current.visibleRows.length,
|
|
1115
467
|
(s) => setInfiniteScrollState(s)
|
|
1116
468
|
);
|
|
1117
469
|
},
|
|
1118
470
|
infiniteScrollDataRemovedTop: (scrollUp, scrollDown) => {
|
|
1119
|
-
resetGridInfiniteScrollCommand(
|
|
471
|
+
(0, import_ui_grid2.resetGridInfiniteScrollCommand)(
|
|
1120
472
|
(s) => setInfiniteScrollState(s),
|
|
1121
473
|
scrollUp ?? infiniteScrollStateRef.current.scrollUp,
|
|
1122
474
|
scrollDown ?? infiniteScrollStateRef.current.scrollDown
|
|
1123
475
|
);
|
|
1124
476
|
},
|
|
1125
477
|
infiniteScrollDataRemovedBottom: (scrollUp, scrollDown) => {
|
|
1126
|
-
resetGridInfiniteScrollCommand(
|
|
478
|
+
(0, import_ui_grid2.resetGridInfiniteScrollCommand)(
|
|
1127
479
|
(s) => setInfiniteScrollState(s),
|
|
1128
480
|
scrollUp ?? infiniteScrollStateRef.current.scrollUp,
|
|
1129
481
|
scrollDown ?? infiniteScrollStateRef.current.scrollDown
|
|
1130
482
|
);
|
|
1131
483
|
},
|
|
1132
484
|
infiniteScrollSetDirections: (scrollUp, scrollDown) => {
|
|
1133
|
-
setGridInfiniteScrollDirectionsCommand(
|
|
485
|
+
(0, import_ui_grid2.setGridInfiniteScrollDirectionsCommand)(
|
|
1134
486
|
infiniteScrollStateRef.current,
|
|
1135
487
|
(s) => setInfiniteScrollState(s),
|
|
1136
488
|
scrollUp,
|
|
@@ -1138,7 +490,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1138
490
|
);
|
|
1139
491
|
},
|
|
1140
492
|
saveState: () => {
|
|
1141
|
-
return (0,
|
|
493
|
+
return (0, import_ui_grid2.buildGridSavedState)({
|
|
1142
494
|
columnOrder: columnOrderRef.current,
|
|
1143
495
|
activeFilters: activeFiltersRef.current,
|
|
1144
496
|
sortState: sortStateRef.current,
|
|
@@ -1152,7 +504,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1152
504
|
});
|
|
1153
505
|
},
|
|
1154
506
|
restoreState: (state) => {
|
|
1155
|
-
restoreGridStateCommand(gridApiRef.current, state, {
|
|
507
|
+
(0, import_ui_grid2.restoreGridStateCommand)(gridApiRef.current, state, {
|
|
1156
508
|
setColumnOrder: (order) => setColumnOrder(order),
|
|
1157
509
|
setActiveFilters: (filters) => setActiveFilters(filters),
|
|
1158
510
|
setSortState: (s) => setSortState(s),
|
|
@@ -1166,8 +518,8 @@ function useGridState(options, onRegisterApi) {
|
|
|
1166
518
|
});
|
|
1167
519
|
},
|
|
1168
520
|
beginCellEdit: (row, columnName, triggerEvent) => {
|
|
1169
|
-
const rowId = (0,
|
|
1170
|
-
const gridRow = (0,
|
|
521
|
+
const rowId = (0, import_ui_grid2.resolveGridRowId)(optionsRef.current, row);
|
|
522
|
+
const gridRow = (0, import_ui_grid2.findGridRowById)(buildRowsFromData(optionsRef.current.data), rowId);
|
|
1171
523
|
const column = visibleColumnsRef.current.find((c) => c.name === columnName);
|
|
1172
524
|
if (!gridRow || !column || !isCellEditable(gridRow, column, triggerEvent)) return;
|
|
1173
525
|
startCellEditFn(gridRow, column, triggerEvent);
|
|
@@ -1176,7 +528,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1176
528
|
cancelCellEdit: () => cancelCellEditFn(),
|
|
1177
529
|
getEditingCell: () => editingCellRef.current,
|
|
1178
530
|
pinColumn: (columnName, direction) => {
|
|
1179
|
-
pinGridColumnCommand(
|
|
531
|
+
(0, import_ui_grid2.pinGridColumnCommand)(
|
|
1180
532
|
gridApiRef.current,
|
|
1181
533
|
isPinningEnabledFn(),
|
|
1182
534
|
(v) => setPinnedColumns(v),
|
|
@@ -1186,12 +538,12 @@ function useGridState(options, onRegisterApi) {
|
|
|
1186
538
|
);
|
|
1187
539
|
}
|
|
1188
540
|
};
|
|
1189
|
-
gridApiRef.current = (0,
|
|
541
|
+
gridApiRef.current = (0, import_ui_grid2.createGridApi)(bindings);
|
|
1190
542
|
}
|
|
1191
543
|
const gridApi = gridApiRef.current;
|
|
1192
544
|
const seekPageFn = (0, import_react.useCallback)(
|
|
1193
545
|
(page) => {
|
|
1194
|
-
seekGridPaginationCommand(
|
|
546
|
+
(0, import_ui_grid2.seekGridPaginationCommand)(
|
|
1195
547
|
gridApiRef.current,
|
|
1196
548
|
(nextPage) => setCurrentPage(nextPage),
|
|
1197
549
|
() => getTotalPagesValueFn(),
|
|
@@ -1204,7 +556,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1204
556
|
const togglePinFn = (0, import_react.useCallback)((column) => {
|
|
1205
557
|
const current = pinnedColumnsRef.current[column.name];
|
|
1206
558
|
const next = current === "left" ? "right" : current === "right" ? "none" : "left";
|
|
1207
|
-
pinGridColumnCommand(
|
|
559
|
+
(0, import_ui_grid2.pinGridColumnCommand)(
|
|
1208
560
|
gridApiRef.current,
|
|
1209
561
|
isPinningEnabledFn(),
|
|
1210
562
|
(v) => setPinnedColumns(v),
|
|
@@ -1214,7 +566,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1214
566
|
);
|
|
1215
567
|
}, []);
|
|
1216
568
|
const setPaginationPageSizeFn = (0, import_react.useCallback)((ps) => {
|
|
1217
|
-
setGridPaginationPageSizeCommand(
|
|
569
|
+
(0, import_ui_grid2.setGridPaginationPageSizeCommand)(
|
|
1218
570
|
gridApiRef.current,
|
|
1219
571
|
(nextPageSize) => setPageSize(nextPageSize),
|
|
1220
572
|
(nextPage) => setCurrentPage(nextPage),
|
|
@@ -1223,83 +575,83 @@ function useGridState(options, onRegisterApi) {
|
|
|
1223
575
|
}, []);
|
|
1224
576
|
const toggleRowExpansionByRefFn = (0, import_react.useCallback)(
|
|
1225
577
|
(row) => {
|
|
1226
|
-
const rowId = (0,
|
|
1227
|
-
toggleGridRowExpansionCommand(
|
|
578
|
+
const rowId = (0, import_ui_grid2.resolveGridRowId)(optionsRef.current, row);
|
|
579
|
+
(0, import_ui_grid2.toggleGridRowExpansionCommand)(
|
|
1228
580
|
gridApiRef.current,
|
|
1229
|
-
|
|
581
|
+
import_ui_grid2.FEATURE_EXPANDABLE && (0, import_ui_grid2.canGridExpandRows)(optionsRef.current),
|
|
1230
582
|
expandedRowsRef.current,
|
|
1231
583
|
rowId,
|
|
1232
584
|
(e) => setExpandedRows(e),
|
|
1233
|
-
(resolvedRowId) => (0,
|
|
585
|
+
(resolvedRowId) => (0, import_ui_grid2.findGridRowById)(buildRowsFromData(optionsRef.current.data), resolvedRowId)
|
|
1234
586
|
);
|
|
1235
587
|
},
|
|
1236
588
|
[buildRowsFromData]
|
|
1237
589
|
);
|
|
1238
590
|
const expandAllRowsFn = (0, import_react.useCallback)(() => {
|
|
1239
|
-
if (!(0,
|
|
1240
|
-
expandAllGridRowsCommand(
|
|
591
|
+
if (!(0, import_ui_grid2.canGridExpandRows)(optionsRef.current)) return;
|
|
592
|
+
(0, import_ui_grid2.expandAllGridRowsCommand)(
|
|
1241
593
|
(data) => buildRowsFromData(data),
|
|
1242
594
|
optionsRef.current.data,
|
|
1243
595
|
(e) => setExpandedRows(e)
|
|
1244
596
|
);
|
|
1245
597
|
}, [buildRowsFromData]);
|
|
1246
598
|
const toggleAllRowsFn = (0, import_react.useCallback)(() => {
|
|
1247
|
-
const allExpanded = (0,
|
|
599
|
+
const allExpanded = (0, import_ui_grid2.areAllGridRowsExpanded)(
|
|
1248
600
|
buildRowsFromData(optionsRef.current.data),
|
|
1249
601
|
expandedRowsRef.current
|
|
1250
602
|
);
|
|
1251
603
|
if (allExpanded) {
|
|
1252
|
-
collapseAllGridRowsCommand((e) => setExpandedRows(e));
|
|
604
|
+
(0, import_ui_grid2.collapseAllGridRowsCommand)((e) => setExpandedRows(e));
|
|
1253
605
|
} else {
|
|
1254
606
|
expandAllRowsFn();
|
|
1255
607
|
}
|
|
1256
608
|
}, [buildRowsFromData, expandAllRowsFn]);
|
|
1257
609
|
const toggleTreeRowByRefFn = (0, import_react.useCallback)(
|
|
1258
610
|
(row) => {
|
|
1259
|
-
const rowId = (0,
|
|
1260
|
-
toggleGridTreeRowCommand(
|
|
611
|
+
const rowId = (0, import_ui_grid2.resolveGridRowId)(optionsRef.current, row);
|
|
612
|
+
(0, import_ui_grid2.toggleGridTreeRowCommand)(
|
|
1261
613
|
gridApiRef.current,
|
|
1262
614
|
expandedTreeRowsRef.current,
|
|
1263
615
|
rowId,
|
|
1264
616
|
(e) => setExpandedTreeRows(e),
|
|
1265
|
-
(resolvedRowId) => (0,
|
|
617
|
+
(resolvedRowId) => (0, import_ui_grid2.findGridRowById)(buildRowsFromData(optionsRef.current.data), resolvedRowId)
|
|
1266
618
|
);
|
|
1267
619
|
},
|
|
1268
620
|
[buildRowsFromData]
|
|
1269
621
|
);
|
|
1270
622
|
const expandTreeRowByRefFn = (0, import_react.useCallback)(
|
|
1271
623
|
(row) => {
|
|
1272
|
-
const rowId = (0,
|
|
1273
|
-
setGridTreeRowExpandedCommand(
|
|
624
|
+
const rowId = (0, import_ui_grid2.resolveGridRowId)(optionsRef.current, row);
|
|
625
|
+
(0, import_ui_grid2.setGridTreeRowExpandedCommand)(
|
|
1274
626
|
gridApiRef.current,
|
|
1275
627
|
expandedTreeRowsRef.current,
|
|
1276
628
|
rowId,
|
|
1277
629
|
true,
|
|
1278
630
|
(e) => setExpandedTreeRows(e),
|
|
1279
|
-
(resolvedRowId) => (0,
|
|
631
|
+
(resolvedRowId) => (0, import_ui_grid2.findGridRowById)(buildRowsFromData(optionsRef.current.data), resolvedRowId)
|
|
1280
632
|
);
|
|
1281
633
|
},
|
|
1282
634
|
[buildRowsFromData]
|
|
1283
635
|
);
|
|
1284
636
|
const collapseTreeRowByRefFn = (0, import_react.useCallback)(
|
|
1285
637
|
(row) => {
|
|
1286
|
-
const rowId = (0,
|
|
1287
|
-
setGridTreeRowExpandedCommand(
|
|
638
|
+
const rowId = (0, import_ui_grid2.resolveGridRowId)(optionsRef.current, row);
|
|
639
|
+
(0, import_ui_grid2.setGridTreeRowExpandedCommand)(
|
|
1288
640
|
gridApiRef.current,
|
|
1289
641
|
expandedTreeRowsRef.current,
|
|
1290
642
|
rowId,
|
|
1291
643
|
false,
|
|
1292
644
|
(e) => setExpandedTreeRows(e),
|
|
1293
|
-
(resolvedRowId) => (0,
|
|
645
|
+
(resolvedRowId) => (0, import_ui_grid2.findGridRowById)(buildRowsFromData(optionsRef.current.data), resolvedRowId)
|
|
1294
646
|
);
|
|
1295
647
|
},
|
|
1296
648
|
[buildRowsFromData]
|
|
1297
649
|
);
|
|
1298
650
|
const startCellEditFn = (0, import_react.useCallback)(
|
|
1299
651
|
(row, column, triggerEvent, initialValue) => {
|
|
1300
|
-
const currentValue = (0,
|
|
652
|
+
const currentValue = (0, import_ui_grid2.getCellValue)(row.entity, column);
|
|
1301
653
|
const focusToken = ++editorFocusTokenRef.current;
|
|
1302
|
-
const ec = beginGridCellEditCommand(
|
|
654
|
+
const ec = (0, import_ui_grid2.beginGridCellEditCommand)(
|
|
1303
655
|
gridApiRef.current,
|
|
1304
656
|
{
|
|
1305
657
|
setFocusedCell: (fc) => setFocusedCell(fc),
|
|
@@ -1320,17 +672,17 @@ function useGridState(options, onRegisterApi) {
|
|
|
1320
672
|
);
|
|
1321
673
|
const commitCellEditFn = (0, import_react.useCallback)(
|
|
1322
674
|
(direction, restoreFocus = true) => {
|
|
1323
|
-
const result = commitGridCellEditCommand(gridApiRef.current, {
|
|
675
|
+
const result = (0, import_ui_grid2.commitGridCellEditCommand)(gridApiRef.current, {
|
|
1324
676
|
getEditingCell: () => editingCellRef.current,
|
|
1325
677
|
getEditingValue: () => editingValueRef.current,
|
|
1326
678
|
setEditingCell: (ec) => setEditingCell(ec),
|
|
1327
679
|
setEditingValue: (ev) => setEditingValue(ev),
|
|
1328
|
-
findRowById: (rowId) => (0,
|
|
680
|
+
findRowById: (rowId) => (0, import_ui_grid2.findGridRowById)(buildRowsFromData(optionsRef.current.data), rowId),
|
|
1329
681
|
findColumnByName: (columnName) => visibleColumnsRef.current.find((c) => c.name === columnName),
|
|
1330
|
-
parseEditedValue: (column, value, oldValue) => (0,
|
|
682
|
+
parseEditedValue: (column, value, oldValue) => (0, import_ui_grid2.parseGridEditedValue)(column, value, oldValue),
|
|
1331
683
|
setCellValue: (rowEntity, column, value) => {
|
|
1332
684
|
const fieldPath = column.editModelField ?? column.field ?? column.name;
|
|
1333
|
-
(0,
|
|
685
|
+
(0, import_ui_grid2.setPathValue)(rowEntity, fieldPath, value);
|
|
1334
686
|
}
|
|
1335
687
|
});
|
|
1336
688
|
if (!result.committed || !result.row || !result.column || !result.focusTarget) return;
|
|
@@ -1346,11 +698,11 @@ function useGridState(options, onRegisterApi) {
|
|
|
1346
698
|
);
|
|
1347
699
|
const cancelCellEditFn = (0, import_react.useCallback)(() => {
|
|
1348
700
|
const hadEditingCell = editingCellRef.current !== null;
|
|
1349
|
-
const result = cancelGridCellEditCommand(gridApiRef.current, {
|
|
701
|
+
const result = (0, import_ui_grid2.cancelGridCellEditCommand)(gridApiRef.current, {
|
|
1350
702
|
getEditingCell: () => editingCellRef.current,
|
|
1351
703
|
setEditingCell: (ec) => setEditingCell(ec),
|
|
1352
704
|
setEditingValue: (ev) => setEditingValue(ev),
|
|
1353
|
-
findRowById: (rowId) => (0,
|
|
705
|
+
findRowById: (rowId) => (0, import_ui_grid2.findGridRowById)(buildRowsFromData(optionsRef.current.data), rowId),
|
|
1354
706
|
findColumnByName: (columnName) => visibleColumnsRef.current.find((c) => c.name === columnName)
|
|
1355
707
|
});
|
|
1356
708
|
if (!hadEditingCell) return;
|
|
@@ -1359,7 +711,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1359
711
|
}, [buildRowsFromData, focusRenderedCell]);
|
|
1360
712
|
const moveFocusFn = (0, import_react.useCallback)(
|
|
1361
713
|
(row, column, direction, triggerEvent) => {
|
|
1362
|
-
const nextCell = (0,
|
|
714
|
+
const nextCell = (0, import_ui_grid2.findNextGridCell)({
|
|
1363
715
|
rows: pipelineRef.current.visibleRows,
|
|
1364
716
|
columns: visibleColumnsRef.current,
|
|
1365
717
|
rowId: row.id,
|
|
@@ -1382,7 +734,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1382
734
|
optionsRef.current.benchmark?.iterations
|
|
1383
735
|
);
|
|
1384
736
|
const startedAt = performance.now();
|
|
1385
|
-
let lastResult =
|
|
737
|
+
let lastResult = import_ui_grid2.defaultGridEngine.buildPipeline({
|
|
1386
738
|
options: optionsRef.current,
|
|
1387
739
|
columns: visibleColumnsRef.current,
|
|
1388
740
|
activeFilters: activeFiltersRef.current,
|
|
@@ -1397,7 +749,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1397
749
|
rowSize: optionsRef.current.rowHeight ?? 44
|
|
1398
750
|
});
|
|
1399
751
|
for (let i = 1; i < safeIterations; i++) {
|
|
1400
|
-
lastResult =
|
|
752
|
+
lastResult = import_ui_grid2.defaultGridEngine.buildPipeline({
|
|
1401
753
|
options: optionsRef.current,
|
|
1402
754
|
columns: visibleColumnsRef.current,
|
|
1403
755
|
activeFilters: activeFiltersRef.current,
|
|
@@ -1421,14 +773,14 @@ function useGridState(options, onRegisterApi) {
|
|
|
1421
773
|
renderedItems: lastResult.displayItems.length
|
|
1422
774
|
};
|
|
1423
775
|
setBenchmarkResult(result);
|
|
1424
|
-
raiseGridBenchmarkComplete(gridApiRef.current, result);
|
|
776
|
+
(0, import_ui_grid2.raiseGridBenchmarkComplete)(gridApiRef.current, result);
|
|
1425
777
|
return result;
|
|
1426
778
|
}, []);
|
|
1427
779
|
const exportCsvFn = (0, import_react.useCallback)(() => {
|
|
1428
|
-
if (!
|
|
780
|
+
if (!import_ui_grid2.FEATURE_CSV_EXPORT) return;
|
|
1429
781
|
const columns = visibleColumnsRef.current;
|
|
1430
|
-
const csv = (0,
|
|
1431
|
-
downloadGridCsvFile(csv, `${(0,
|
|
782
|
+
const csv = (0, import_ui_grid2.exportCsvRows)(columns, pipelineRef.current.visibleRows);
|
|
783
|
+
(0, import_ui_grid2.downloadGridCsvFile)(csv, `${(0, import_ui_grid2.sanitizeDownloadFilename)(optionsRef.current.id)}.csv`);
|
|
1432
784
|
}, []);
|
|
1433
785
|
(0, import_react.useEffect)(() => {
|
|
1434
786
|
if (initializedGridIdRef.current === options.id) return;
|
|
@@ -1443,9 +795,9 @@ function useGridState(options, onRegisterApi) {
|
|
|
1443
795
|
setExpandedTreeRows({});
|
|
1444
796
|
setColumnOrder(options.columnDefs.map((column) => column.name));
|
|
1445
797
|
setGroupByColumns(options.grouping?.groupBy ?? []);
|
|
1446
|
-
setPinnedColumns(buildInitialPinnedState(options.columnDefs));
|
|
798
|
+
setPinnedColumns((0, import_ui_grid2.buildInitialPinnedState)(options.columnDefs));
|
|
1447
799
|
setCurrentPage(options.paginationCurrentPage ?? 1);
|
|
1448
|
-
setPageSize((0,
|
|
800
|
+
setPageSize((0, import_ui_grid2.getEffectivePageSize)(options, 0, options.data.length));
|
|
1449
801
|
setInfiniteScrollState({
|
|
1450
802
|
scrollUp: options.infiniteScrollUp === true,
|
|
1451
803
|
scrollDown: options.infiniteScrollDown !== false,
|
|
@@ -1457,28 +809,28 @@ function useGridState(options, onRegisterApi) {
|
|
|
1457
809
|
);
|
|
1458
810
|
setSortState({
|
|
1459
811
|
columnName: initialSort?.name ?? null,
|
|
1460
|
-
direction: initialSort?.sort?.direction ??
|
|
812
|
+
direction: initialSort?.sort?.direction ?? import_ui_grid2.SORT_DIRECTIONS.none
|
|
1461
813
|
});
|
|
1462
814
|
onRegisterApi?.(gridApi);
|
|
1463
|
-
raiseGridRenderingComplete(gridApi);
|
|
815
|
+
(0, import_ui_grid2.raiseGridRenderingComplete)(gridApi);
|
|
1464
816
|
}, [options.id]);
|
|
1465
817
|
(0, import_react.useEffect)(() => {
|
|
1466
|
-
raiseGridRowsRendered(gridApi, pipeline.visibleRows);
|
|
1467
|
-
raiseGridRowsVisibleChanged(gridApi, pipeline.visibleRows);
|
|
818
|
+
(0, import_ui_grid2.raiseGridRowsRendered)(gridApi, pipeline.visibleRows);
|
|
819
|
+
(0, import_ui_grid2.raiseGridRowsVisibleChanged)(gridApi, pipeline.visibleRows);
|
|
1468
820
|
const newHeight = pipeline.displayItems.length * rowSize;
|
|
1469
821
|
if (newHeight !== lastCanvasHeightRef.current) {
|
|
1470
|
-
raiseGridCanvasHeightChanged(gridApi, lastCanvasHeightRef.current, newHeight);
|
|
822
|
+
(0, import_ui_grid2.raiseGridCanvasHeightChanged)(gridApi, lastCanvasHeightRef.current, newHeight);
|
|
1471
823
|
lastCanvasHeightRef.current = newHeight;
|
|
1472
824
|
}
|
|
1473
825
|
}, [pipeline, gridApi, rowSize]);
|
|
1474
826
|
(0, import_react.useEffect)(() => {
|
|
1475
|
-
if (!
|
|
827
|
+
if (!import_ui_grid2.FEATURE_AUTO_RESIZE || !options.enableAutoResize) return;
|
|
1476
828
|
const container = gridContainerRef.current;
|
|
1477
829
|
if (!container) return;
|
|
1478
|
-
const observer = observeGridHostSize(container, ({ height: nextHeight, width: nextWidth }) => {
|
|
830
|
+
const observer = (0, import_ui_grid2.observeGridHostSize)(container, ({ height: nextHeight, width: nextWidth }) => {
|
|
1479
831
|
if (nextHeight === lastGridHeightRef.current && nextWidth === lastGridWidthRef.current)
|
|
1480
832
|
return;
|
|
1481
|
-
raiseGridDimensionChanged(
|
|
833
|
+
(0, import_ui_grid2.raiseGridDimensionChanged)(
|
|
1482
834
|
gridApi,
|
|
1483
835
|
lastGridHeightRef.current,
|
|
1484
836
|
lastGridWidthRef.current,
|
|
@@ -1503,7 +855,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1503
855
|
const paginationTotalPages = getTotalPagesValueFn();
|
|
1504
856
|
const paginationSelectedPageSize = effectivePageSizeFn(pipeline.totalItems);
|
|
1505
857
|
const viewportHeightPx = computeViewportHeightPx(options.viewportHeight, autoViewportHeight);
|
|
1506
|
-
const headerLabelFn = (0, import_react.useCallback)((column) => (0,
|
|
858
|
+
const headerLabelFn = (0, import_react.useCallback)((column) => (0, import_ui_grid2.headerLabel)(column), []);
|
|
1507
859
|
const isGroupItemFn = (0, import_react.useCallback)(
|
|
1508
860
|
(item) => item.kind === "group",
|
|
1509
861
|
[]
|
|
@@ -1518,24 +870,24 @@ function useGridState(options, onRegisterApi) {
|
|
|
1518
870
|
[]
|
|
1519
871
|
);
|
|
1520
872
|
const sortDirectionFn = (0, import_react.useCallback)((column) => {
|
|
1521
|
-
return sortStateRef.current.columnName === column.name ? sortStateRef.current.direction :
|
|
873
|
+
return sortStateRef.current.columnName === column.name ? sortStateRef.current.direction : import_ui_grid2.SORT_DIRECTIONS.none;
|
|
1522
874
|
}, []);
|
|
1523
875
|
const sortButtonLabelFn = (0, import_react.useCallback)(
|
|
1524
876
|
(column) => {
|
|
1525
|
-
return (0,
|
|
877
|
+
return (0, import_ui_grid2.gridSortButtonLabel)(sortDirectionFn(column), labels);
|
|
1526
878
|
},
|
|
1527
879
|
[labels, sortDirectionFn]
|
|
1528
880
|
);
|
|
1529
881
|
const sortAriaSortFn = (0, import_react.useCallback)(
|
|
1530
882
|
(column) => {
|
|
1531
|
-
return (0,
|
|
883
|
+
return (0, import_ui_grid2.gridSortAriaSort)(sortDirectionFn(column));
|
|
1532
884
|
},
|
|
1533
885
|
[sortDirectionFn]
|
|
1534
886
|
);
|
|
1535
887
|
const groupingButtonLabelFn = (0, import_react.useCallback)(
|
|
1536
888
|
(column) => {
|
|
1537
|
-
return (0,
|
|
1538
|
-
(0,
|
|
889
|
+
return (0, import_ui_grid2.gridGroupingButtonLabel)(
|
|
890
|
+
(0, import_ui_grid2.isGridColumnGrouped)(groupByColumnsRef.current, column),
|
|
1539
891
|
labels
|
|
1540
892
|
);
|
|
1541
893
|
},
|
|
@@ -1546,39 +898,39 @@ function useGridState(options, onRegisterApi) {
|
|
|
1546
898
|
}, []);
|
|
1547
899
|
const filterPlaceholderFn = (0, import_react.useCallback)(
|
|
1548
900
|
(column) => {
|
|
1549
|
-
return (0,
|
|
901
|
+
return (0, import_ui_grid2.gridFilterPlaceholder)((0, import_ui_grid2.isGridColumnFilterable)(optionsRef.current, column), labels);
|
|
1550
902
|
},
|
|
1551
903
|
[labels]
|
|
1552
904
|
);
|
|
1553
905
|
const isFilterInputDisabledFn = (0, import_react.useCallback)((column) => {
|
|
1554
|
-
return !(0,
|
|
906
|
+
return !(0, import_ui_grid2.isGridColumnFilterable)(optionsRef.current, column);
|
|
1555
907
|
}, []);
|
|
1556
908
|
const groupDisclosureLabelFn = (0, import_react.useCallback)(
|
|
1557
909
|
(item) => {
|
|
1558
|
-
return (0,
|
|
910
|
+
return (0, import_ui_grid2.gridGroupDisclosureLabel)(item.collapsed, labels);
|
|
1559
911
|
},
|
|
1560
912
|
[labels]
|
|
1561
913
|
);
|
|
1562
914
|
const cellContextFn = (0, import_react.useCallback)(
|
|
1563
915
|
(row, column) => {
|
|
1564
|
-
return (0,
|
|
916
|
+
return (0, import_ui_grid2.buildGridCellContext)(row, column);
|
|
1565
917
|
},
|
|
1566
918
|
[]
|
|
1567
919
|
);
|
|
1568
920
|
const displayValueFn = (0, import_react.useCallback)(
|
|
1569
921
|
(row, column) => {
|
|
1570
|
-
return (0,
|
|
922
|
+
return (0, import_ui_grid2.formatGridCellDisplayValue)(cellContextFn(row, column));
|
|
1571
923
|
},
|
|
1572
924
|
[cellContextFn]
|
|
1573
925
|
);
|
|
1574
926
|
const isFocusedCellFn = (0, import_react.useCallback)((row, column) => {
|
|
1575
|
-
return (0,
|
|
927
|
+
return (0, import_ui_grid2.isGridCellPosition)(focusedCellRef.current, row.id, column.name);
|
|
1576
928
|
}, []);
|
|
1577
929
|
const isEditingCellFn = (0, import_react.useCallback)((row, column) => {
|
|
1578
|
-
return (0,
|
|
930
|
+
return (0, import_ui_grid2.isGridCellPosition)(editingCellRef.current, row.id, column.name);
|
|
1579
931
|
}, []);
|
|
1580
932
|
const editorInputTypeFn = (0, import_react.useCallback)((column) => {
|
|
1581
|
-
return (0,
|
|
933
|
+
return (0, import_ui_grid2.gridEditorInputType)(column);
|
|
1582
934
|
}, []);
|
|
1583
935
|
const expandedContextFn = (0, import_react.useCallback)(
|
|
1584
936
|
(row) => {
|
|
@@ -1592,42 +944,42 @@ function useGridState(options, onRegisterApi) {
|
|
|
1592
944
|
},
|
|
1593
945
|
[]
|
|
1594
946
|
);
|
|
1595
|
-
const columnWidthFn = (0, import_react.useCallback)((column) => (0,
|
|
947
|
+
const columnWidthFn = (0, import_react.useCallback)((column) => (0, import_ui_grid2.gridColumnWidth)(column), []);
|
|
1596
948
|
const isColumnSortableFn = (0, import_react.useCallback)((column) => {
|
|
1597
|
-
return (0,
|
|
949
|
+
return (0, import_ui_grid2.isGridColumnSortable)(optionsRef.current, column);
|
|
1598
950
|
}, []);
|
|
1599
951
|
const isColumnFilterableFn = (0, import_react.useCallback)((column) => {
|
|
1600
|
-
return (0,
|
|
952
|
+
return (0, import_ui_grid2.isGridColumnFilterable)(optionsRef.current, column);
|
|
1601
953
|
}, []);
|
|
1602
954
|
const cellIndentFn = (0, import_react.useCallback)((row, column) => {
|
|
1603
|
-
return (0,
|
|
955
|
+
return (0, import_ui_grid2.gridCellIndent)(optionsRef.current, visibleColumnsRef.current, row, column);
|
|
1604
956
|
}, []);
|
|
1605
957
|
const treeToggleLabelFn = (0, import_react.useCallback)(
|
|
1606
958
|
(row) => {
|
|
1607
|
-
return (0,
|
|
959
|
+
return (0, import_ui_grid2.gridTreeToggleLabelForRow)(expandedTreeRowsRef.current, row, labels);
|
|
1608
960
|
},
|
|
1609
961
|
[labels]
|
|
1610
962
|
);
|
|
1611
963
|
const isTreeRowExpandedFn = (0, import_react.useCallback)((row) => {
|
|
1612
|
-
return (0,
|
|
964
|
+
return (0, import_ui_grid2.isGridTreeRowExpanded)(expandedTreeRowsRef.current, row);
|
|
1613
965
|
}, []);
|
|
1614
966
|
const expandToggleLabelFn = (0, import_react.useCallback)(
|
|
1615
967
|
(row) => {
|
|
1616
|
-
return (0,
|
|
968
|
+
return (0, import_ui_grid2.gridExpandToggleLabelForRow)(row, labels);
|
|
1617
969
|
},
|
|
1618
970
|
[labels]
|
|
1619
971
|
);
|
|
1620
972
|
const isGroupedFn = (0, import_react.useCallback)((column) => {
|
|
1621
|
-
return (0,
|
|
973
|
+
return (0, import_ui_grid2.isGridColumnGrouped)(groupByColumnsRef.current, column);
|
|
1622
974
|
}, []);
|
|
1623
975
|
const showTreeToggleFn = (0, import_react.useCallback)((row, column) => {
|
|
1624
|
-
return (0,
|
|
976
|
+
return (0, import_ui_grid2.shouldShowGridTreeToggle)(optionsRef.current, visibleColumnsRef.current, row, column);
|
|
1625
977
|
}, []);
|
|
1626
978
|
const showExpandToggleFn = (0, import_react.useCallback)((row, column) => {
|
|
1627
|
-
return (0,
|
|
979
|
+
return (0, import_ui_grid2.shouldShowGridExpandToggle)(optionsRef.current, visibleColumnsRef.current, column);
|
|
1628
980
|
}, []);
|
|
1629
981
|
const showPaginationControlsFn = (0, import_react.useCallback)(() => {
|
|
1630
|
-
return
|
|
982
|
+
return import_ui_grid2.FEATURE_PAGINATION && (0, import_ui_grid2.shouldShowGridPaginationControls)(optionsRef.current);
|
|
1631
983
|
}, []);
|
|
1632
984
|
const paginationSummaryFn = (0, import_react.useCallback)(() => {
|
|
1633
985
|
const ti = pipelineRef.current.totalItems;
|
|
@@ -1637,22 +989,22 @@ function useGridState(options, onRegisterApi) {
|
|
|
1637
989
|
return optionsRef.current.paginationPageSizes ?? [];
|
|
1638
990
|
}, []);
|
|
1639
991
|
const isGroupingEnabledFn = (0, import_react.useCallback)(() => {
|
|
1640
|
-
return
|
|
992
|
+
return import_ui_grid2.FEATURE_GROUPING && (0, import_ui_grid2.isGridGroupingEnabled)(optionsRef.current);
|
|
1641
993
|
}, []);
|
|
1642
994
|
const isFilteringEnabledFn = (0, import_react.useCallback)(() => {
|
|
1643
|
-
return
|
|
995
|
+
return import_ui_grid2.FEATURE_FILTERING && (0, import_ui_grid2.isGridFilteringEnabled)(optionsRef.current);
|
|
1644
996
|
}, []);
|
|
1645
997
|
const toggleSortFn = (0, import_react.useCallback)((column) => {
|
|
1646
|
-
if (!
|
|
1647
|
-
const currentDirection = sortStateRef.current.columnName === column.name ? sortStateRef.current.direction :
|
|
1648
|
-
const nextDirection = currentDirection ===
|
|
1649
|
-
applyGridSortStateCommand(gridApiRef.current, (state) => setSortState(state), {
|
|
1650
|
-
columnName: nextDirection ===
|
|
998
|
+
if (!import_ui_grid2.FEATURE_SORTING || !(0, import_ui_grid2.isGridColumnSortable)(optionsRef.current, column)) return;
|
|
999
|
+
const currentDirection = sortStateRef.current.columnName === column.name ? sortStateRef.current.direction : import_ui_grid2.SORT_DIRECTIONS.none;
|
|
1000
|
+
const nextDirection = currentDirection === import_ui_grid2.SORT_DIRECTIONS.none ? import_ui_grid2.SORT_DIRECTIONS.asc : currentDirection === import_ui_grid2.SORT_DIRECTIONS.asc ? import_ui_grid2.SORT_DIRECTIONS.desc : import_ui_grid2.SORT_DIRECTIONS.none;
|
|
1001
|
+
(0, import_ui_grid2.applyGridSortStateCommand)(gridApiRef.current, (state) => setSortState(state), {
|
|
1002
|
+
columnName: nextDirection === import_ui_grid2.SORT_DIRECTIONS.none ? null : column.name,
|
|
1651
1003
|
direction: nextDirection
|
|
1652
1004
|
});
|
|
1653
1005
|
}, []);
|
|
1654
1006
|
const updateFilterFn = (0, import_react.useCallback)((columnName, value) => {
|
|
1655
|
-
updateGridFilterCommand(
|
|
1007
|
+
(0, import_ui_grid2.updateGridFilterCommand)(
|
|
1656
1008
|
gridApiRef.current,
|
|
1657
1009
|
(updater) => setActiveFilters((current) => updater(current)),
|
|
1658
1010
|
() => activeFiltersRef.current,
|
|
@@ -1661,11 +1013,11 @@ function useGridState(options, onRegisterApi) {
|
|
|
1661
1013
|
);
|
|
1662
1014
|
}, []);
|
|
1663
1015
|
const clearAllFiltersFn = (0, import_react.useCallback)(() => {
|
|
1664
|
-
clearGridFiltersCommand(gridApiRef.current, (filters) => setActiveFilters(filters));
|
|
1016
|
+
(0, import_ui_grid2.clearGridFiltersCommand)(gridApiRef.current, (filters) => setActiveFilters(filters));
|
|
1665
1017
|
}, []);
|
|
1666
1018
|
const toggleGroupingFn = (0, import_react.useCallback)((column, event) => {
|
|
1667
1019
|
event?.stopPropagation();
|
|
1668
|
-
if (!(
|
|
1020
|
+
if (!(import_ui_grid2.FEATURE_GROUPING && (0, import_ui_grid2.isGridGroupingEnabled)(optionsRef.current))) return;
|
|
1669
1021
|
const current = groupByColumnsRef.current;
|
|
1670
1022
|
const next = current.includes(column.name) ? current.filter((n) => n !== column.name) : [...current, column.name];
|
|
1671
1023
|
groupByColumnsRef.current = next;
|
|
@@ -1680,7 +1032,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1680
1032
|
}, []);
|
|
1681
1033
|
const focusCellFn = (0, import_react.useCallback)(
|
|
1682
1034
|
(row, column, triggerEvent) => {
|
|
1683
|
-
const nextFocusResult = (0,
|
|
1035
|
+
const nextFocusResult = (0, import_ui_grid2.buildGridFocusCellResult)({
|
|
1684
1036
|
currentFocusedCell: focusedCellRef.current,
|
|
1685
1037
|
currentEditingCell: editingCellRef.current,
|
|
1686
1038
|
rowId: row.id,
|
|
@@ -1739,7 +1091,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1739
1091
|
default:
|
|
1740
1092
|
break;
|
|
1741
1093
|
}
|
|
1742
|
-
if ((0,
|
|
1094
|
+
if ((0, import_ui_grid2.isPrintableGridKey)(event.key, event.ctrlKey, event.metaKey, event.altKey) && isCellEditable(row, column, event.nativeEvent)) {
|
|
1743
1095
|
event.preventDefault();
|
|
1744
1096
|
startCellEditFn(row, column, event.nativeEvent, event.key);
|
|
1745
1097
|
}
|
|
@@ -1803,9 +1155,9 @@ function useGridState(options, onRegisterApi) {
|
|
|
1803
1155
|
[toggleTreeRowByRefFn]
|
|
1804
1156
|
);
|
|
1805
1157
|
const moveColumnFn = (0, import_react.useCallback)((fromIndex, toIndex) => {
|
|
1806
|
-
moveGridColumnCommand(
|
|
1158
|
+
(0, import_ui_grid2.moveGridColumnCommand)(
|
|
1807
1159
|
gridApiRef.current,
|
|
1808
|
-
|
|
1160
|
+
import_ui_grid2.FEATURE_COLUMN_MOVING && optionsRef.current.enableColumnMoving === true,
|
|
1809
1161
|
(updater) => setColumnOrder((current) => updater(current)),
|
|
1810
1162
|
fromIndex,
|
|
1811
1163
|
toIndex
|
|
@@ -1826,17 +1178,17 @@ function useGridState(options, onRegisterApi) {
|
|
|
1826
1178
|
const onViewportScrollFn = (0, import_react.useCallback)((startIndex) => {
|
|
1827
1179
|
if (!scrollingRef.current) {
|
|
1828
1180
|
scrollingRef.current = true;
|
|
1829
|
-
raiseGridScrollBegin(gridApiRef.current);
|
|
1181
|
+
(0, import_ui_grid2.raiseGridScrollBegin)(gridApiRef.current);
|
|
1830
1182
|
}
|
|
1831
1183
|
if (scrollEndHandleRef.current) {
|
|
1832
1184
|
window.clearTimeout(scrollEndHandleRef.current);
|
|
1833
1185
|
}
|
|
1834
1186
|
scrollEndHandleRef.current = window.setTimeout(() => {
|
|
1835
1187
|
scrollingRef.current = false;
|
|
1836
|
-
raiseGridScrollEnd(gridApiRef.current);
|
|
1188
|
+
(0, import_ui_grid2.raiseGridScrollEnd)(gridApiRef.current);
|
|
1837
1189
|
}, 120);
|
|
1838
|
-
const isInfiniteScrollEnabled =
|
|
1839
|
-
maybeRequestInfiniteScrollCommand(gridApiRef.current, {
|
|
1190
|
+
const isInfiniteScrollEnabled = import_ui_grid2.FEATURE_INFINITE_SCROLL && (optionsRef.current.infiniteScrollRowsFromEnd !== void 0 || optionsRef.current.infiniteScrollUp === true || optionsRef.current.infiniteScrollDown !== void 0);
|
|
1191
|
+
(0, import_ui_grid2.maybeRequestInfiniteScrollCommand)(gridApiRef.current, {
|
|
1840
1192
|
enabled: isInfiniteScrollEnabled,
|
|
1841
1193
|
virtualizationEnabled: pipelineRef.current.virtualizationEnabled,
|
|
1842
1194
|
state: infiniteScrollStateRef.current,
|
|
@@ -1914,16 +1266,16 @@ function useGridState(options, onRegisterApi) {
|
|
|
1914
1266
|
pageSizeOptions: pageSizeOptionsFn,
|
|
1915
1267
|
isCellEditable,
|
|
1916
1268
|
shouldEditOnFocus: shouldEditOnFocusFn,
|
|
1917
|
-
sortingFeature:
|
|
1918
|
-
filteringFeature:
|
|
1919
|
-
groupingFeature:
|
|
1920
|
-
paginationFeature:
|
|
1921
|
-
cellEditFeature:
|
|
1922
|
-
expandableFeature:
|
|
1923
|
-
treeViewFeature:
|
|
1924
|
-
infiniteScrollFeature:
|
|
1925
|
-
columnMovingFeature:
|
|
1926
|
-
csvExportFeature:
|
|
1269
|
+
sortingFeature: import_ui_grid2.FEATURE_SORTING,
|
|
1270
|
+
filteringFeature: import_ui_grid2.FEATURE_FILTERING,
|
|
1271
|
+
groupingFeature: import_ui_grid2.FEATURE_GROUPING,
|
|
1272
|
+
paginationFeature: import_ui_grid2.FEATURE_PAGINATION,
|
|
1273
|
+
cellEditFeature: import_ui_grid2.FEATURE_CELL_EDIT,
|
|
1274
|
+
expandableFeature: import_ui_grid2.FEATURE_EXPANDABLE,
|
|
1275
|
+
treeViewFeature: import_ui_grid2.FEATURE_TREE_VIEW,
|
|
1276
|
+
infiniteScrollFeature: import_ui_grid2.FEATURE_INFINITE_SCROLL,
|
|
1277
|
+
columnMovingFeature: import_ui_grid2.FEATURE_COLUMN_MOVING,
|
|
1278
|
+
csvExportFeature: import_ui_grid2.FEATURE_CSV_EXPORT,
|
|
1927
1279
|
isGroupingEnabled: isGroupingEnabledFn,
|
|
1928
1280
|
isFilteringEnabled: isFilteringEnabledFn,
|
|
1929
1281
|
toggleSort: toggleSortFn,
|
|
@@ -1952,7 +1304,7 @@ function useGridState(options, onRegisterApi) {
|
|
|
1952
1304
|
isPinningEnabled: isPinningEnabledFn,
|
|
1953
1305
|
isColumnPinnable: isColumnPinnableFn,
|
|
1954
1306
|
togglePin: togglePinFn,
|
|
1955
|
-
pinningFeature:
|
|
1307
|
+
pinningFeature: import_ui_grid2.FEATURE_PINNING
|
|
1956
1308
|
};
|
|
1957
1309
|
}
|
|
1958
1310
|
|
|
@@ -2000,6 +1352,7 @@ function useVirtualScroll(options) {
|
|
|
2000
1352
|
totalHeight: virtualWindow.totalHeight,
|
|
2001
1353
|
offsetY: virtualWindow.offsetY,
|
|
2002
1354
|
onScroll,
|
|
1355
|
+
setScrollTop,
|
|
2003
1356
|
viewportRef,
|
|
2004
1357
|
scrollTop
|
|
2005
1358
|
};
|
|
@@ -2048,10 +1401,82 @@ function UiGrid({
|
|
|
2048
1401
|
viewportHeight: options.viewportHeight ?? 560,
|
|
2049
1402
|
overscan: 3
|
|
2050
1403
|
});
|
|
1404
|
+
const headerGridRef = import_react3.default.useRef(null);
|
|
1405
|
+
const filterGridRef = import_react3.default.useRef(null);
|
|
1406
|
+
const [openPinMenuColumn, setOpenPinMenuColumn] = import_react3.default.useState(null);
|
|
1407
|
+
const [headerStickyHeight, setHeaderStickyHeight] = import_react3.default.useState(0);
|
|
1408
|
+
const [filterStickyHeight, setFilterStickyHeight] = import_react3.default.useState(0);
|
|
1409
|
+
const stickyChromeHeight = headerStickyHeight + filterStickyHeight;
|
|
1410
|
+
const scrollContainerHeight = `${(options.viewportHeight ?? 560) + stickyChromeHeight}px`;
|
|
1411
|
+
const eventPathIncludesClass = import_react3.default.useCallback((event, className2) => {
|
|
1412
|
+
const eventPath = typeof event.composedPath === "function" ? event.composedPath() : event.target ? [event.target] : [];
|
|
1413
|
+
return eventPath.some((target) => {
|
|
1414
|
+
if (!target || typeof target !== "object" || !("classList" in target)) {
|
|
1415
|
+
return false;
|
|
1416
|
+
}
|
|
1417
|
+
const classList = target.classList;
|
|
1418
|
+
return classList?.contains(className2) ?? false;
|
|
1419
|
+
});
|
|
1420
|
+
}, []);
|
|
1421
|
+
const isPinMenuOpen = import_react3.default.useCallback(
|
|
1422
|
+
(column) => openPinMenuColumn === column.name,
|
|
1423
|
+
[openPinMenuColumn]
|
|
1424
|
+
);
|
|
1425
|
+
const pinButtonLabel = import_react3.default.useCallback(
|
|
1426
|
+
(column) => state.isPinned(column) ? labels.unpin : labels.pinColumn,
|
|
1427
|
+
[labels, state]
|
|
1428
|
+
);
|
|
1429
|
+
const onPinTrigger = import_react3.default.useCallback(
|
|
1430
|
+
(column, event) => {
|
|
1431
|
+
event?.stopPropagation();
|
|
1432
|
+
if (state.isPinned(column)) {
|
|
1433
|
+
setOpenPinMenuColumn(null);
|
|
1434
|
+
state.gridApi.pinning.pinColumn(column.name, "none");
|
|
1435
|
+
return;
|
|
1436
|
+
}
|
|
1437
|
+
setOpenPinMenuColumn((current) => current === column.name ? null : column.name);
|
|
1438
|
+
},
|
|
1439
|
+
[state]
|
|
1440
|
+
);
|
|
1441
|
+
const choosePinDirection = import_react3.default.useCallback(
|
|
1442
|
+
(column, direction, event) => {
|
|
1443
|
+
event?.stopPropagation();
|
|
1444
|
+
setOpenPinMenuColumn(null);
|
|
1445
|
+
state.gridApi.pinning.pinColumn(column.name, direction);
|
|
1446
|
+
},
|
|
1447
|
+
[state]
|
|
1448
|
+
);
|
|
1449
|
+
import_react3.default.useLayoutEffect(() => {
|
|
1450
|
+
setHeaderStickyHeight(headerGridRef.current?.offsetHeight ?? 0);
|
|
1451
|
+
setFilterStickyHeight(filterGridRef.current?.offsetHeight ?? 0);
|
|
1452
|
+
}, [visibleColumns, filteringFeature, options.enableFiltering]);
|
|
1453
|
+
import_react3.default.useEffect(() => {
|
|
1454
|
+
if (!openPinMenuColumn) {
|
|
1455
|
+
return;
|
|
1456
|
+
}
|
|
1457
|
+
const handleDocumentClick = (event) => {
|
|
1458
|
+
if (eventPathIncludesClass(event, "pin-control")) {
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1461
|
+
setOpenPinMenuColumn(null);
|
|
1462
|
+
};
|
|
1463
|
+
const handleDocumentEscape = (event) => {
|
|
1464
|
+
if (event.key === "Escape") {
|
|
1465
|
+
setOpenPinMenuColumn(null);
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
document.addEventListener("click", handleDocumentClick);
|
|
1469
|
+
document.addEventListener("keydown", handleDocumentEscape);
|
|
1470
|
+
return () => {
|
|
1471
|
+
document.removeEventListener("click", handleDocumentClick);
|
|
1472
|
+
document.removeEventListener("keydown", handleDocumentEscape);
|
|
1473
|
+
};
|
|
1474
|
+
}, [eventPathIncludesClass, openPinMenuColumn]);
|
|
2051
1475
|
const itemsToRender = virtualizationEnabled ? displayItems.slice(virtualScroll.visibleRange.start, virtualScroll.visibleRange.end) : displayItems;
|
|
2052
|
-
const
|
|
2053
|
-
|
|
2054
|
-
|
|
1476
|
+
const onGridTableScroll = (event) => {
|
|
1477
|
+
const bodyScrollTop = Math.max(0, event.currentTarget.scrollTop - stickyChromeHeight);
|
|
1478
|
+
virtualScroll.setScrollTop(bodyScrollTop);
|
|
1479
|
+
const startIndex = Math.floor(bodyScrollTop / rowSize);
|
|
2055
1480
|
state.onViewportScroll(startIndex);
|
|
2056
1481
|
};
|
|
2057
1482
|
function renderDisplayItem(item) {
|
|
@@ -2291,262 +1716,322 @@ function UiGrid({
|
|
|
2291
1716
|
] }),
|
|
2292
1717
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "`gridOptions` compatibility layer: sorting, filtering, grouping, column moving, templating, and virtualized rendering." })
|
|
2293
1718
|
] }),
|
|
2294
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
const pinned = state.isPinned(column);
|
|
2304
|
-
const pinOffset = pinned ? state.pinnedOffset(column) : null;
|
|
2305
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2306
|
-
"div",
|
|
2307
|
-
{
|
|
2308
|
-
className: `header-cell ui-grid-header-cell${sortingFeature && state.sortDirection(column) !== "none" ? " is-active" : ""}${pinned ? " is-pinned" : ""}`,
|
|
2309
|
-
"data-part": "header-cell",
|
|
2310
|
-
role: "columnheader",
|
|
2311
|
-
"aria-sort": sortingFeature ? state.sortAriaSort(column) : void 0,
|
|
2312
|
-
style: {
|
|
2313
|
-
position: pinned ? "sticky" : void 0,
|
|
2314
|
-
left: pinOffset?.side === "left" ? pinOffset.offset : void 0,
|
|
2315
|
-
right: pinOffset?.side === "right" ? pinOffset.offset : void 0,
|
|
2316
|
-
zIndex: pinned ? 2 : void 0
|
|
2317
|
-
},
|
|
2318
|
-
children: [
|
|
2319
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "header-label", children: state.headerLabel(column) }),
|
|
2320
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "header-actions", children: [
|
|
2321
|
-
sortingFeature && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2322
|
-
"button",
|
|
2323
|
-
{
|
|
2324
|
-
type: "button",
|
|
2325
|
-
className: `header-action${!state.isColumnSortable(column) ? " header-action-disabled" : ""}`,
|
|
2326
|
-
disabled: !state.isColumnSortable(column),
|
|
2327
|
-
"aria-label": state.sortButtonLabel(column),
|
|
2328
|
-
title: state.sortButtonLabel(column),
|
|
2329
|
-
onClick: () => state.toggleSort(column),
|
|
2330
|
-
children: [
|
|
2331
|
-
renderSortIcon(column),
|
|
2332
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only ui-grid-sr-only", children: state.sortButtonLabel(column) })
|
|
2333
|
-
]
|
|
2334
|
-
}
|
|
2335
|
-
),
|
|
2336
|
-
groupingFeature && state.isGroupingEnabled() && column.enableGrouping !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2337
|
-
"button",
|
|
2338
|
-
{
|
|
2339
|
-
type: "button",
|
|
2340
|
-
className: `chip-action${state.isGrouped(column) ? " chip-action-active" : ""}`,
|
|
2341
|
-
"data-part": "group-toggle",
|
|
2342
|
-
"aria-label": state.groupingButtonLabel(column),
|
|
2343
|
-
title: state.groupingButtonLabel(column),
|
|
2344
|
-
onClick: (e) => state.toggleGrouping(column, e),
|
|
2345
|
-
children: [
|
|
2346
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 6h8v4H4V6Zm0 8h8v4H4v-4Zm10-8h6v4h-6V6Zm0 8h6v4h-6v-4Z" }) }),
|
|
2347
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only ui-grid-sr-only", children: state.groupingButtonLabel(column) })
|
|
2348
|
-
]
|
|
2349
|
-
}
|
|
2350
|
-
),
|
|
2351
|
-
state.pinningFeature && state.isPinningEnabled() && state.isColumnPinnable(column) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2352
|
-
"button",
|
|
2353
|
-
{
|
|
2354
|
-
type: "button",
|
|
2355
|
-
className: `chip-action${pinned ? " chip-action-active" : ""}`,
|
|
2356
|
-
"data-part": "pin-toggle",
|
|
2357
|
-
"aria-label": pinned ? labels.unpin : labels.pinLeft,
|
|
2358
|
-
title: pinned ? labels.unpin : labels.pinLeft,
|
|
2359
|
-
onClick: () => state.togglePin(column),
|
|
2360
|
-
children: [
|
|
2361
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M16 12V4h1V2H7v2h1v8l-2 2v2h5v6l1 1 1-1v-6h5v-2l-2-2z" }) }),
|
|
2362
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only ui-grid-sr-only", children: pinned ? labels.unpin : labels.pinLeft })
|
|
2363
|
-
]
|
|
2364
|
-
}
|
|
2365
|
-
)
|
|
2366
|
-
] })
|
|
2367
|
-
]
|
|
2368
|
-
},
|
|
2369
|
-
column.name
|
|
2370
|
-
);
|
|
2371
|
-
})
|
|
2372
|
-
}
|
|
2373
|
-
),
|
|
2374
|
-
filteringFeature && state.isFilteringEnabled() && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2375
|
-
"div",
|
|
2376
|
-
{
|
|
2377
|
-
className: "filter-grid ui-grid-header",
|
|
2378
|
-
"data-part": "filters",
|
|
2379
|
-
style: { gridTemplateColumns },
|
|
2380
|
-
children: visibleColumns.map((column) => {
|
|
2381
|
-
const pinned = state.isPinned(column);
|
|
2382
|
-
const pinOffset = pinned ? state.pinnedOffset(column) : null;
|
|
2383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2384
|
-
"label",
|
|
2385
|
-
{
|
|
2386
|
-
className: `filter-cell ui-grid-filter-container${pinned ? " is-pinned" : ""}`,
|
|
2387
|
-
"data-part": "filter-cell",
|
|
2388
|
-
style: {
|
|
2389
|
-
position: pinned ? "sticky" : void 0,
|
|
2390
|
-
left: pinOffset?.side === "left" ? pinOffset.offset : void 0,
|
|
2391
|
-
right: pinOffset?.side === "right" ? pinOffset.offset : void 0,
|
|
2392
|
-
zIndex: pinned ? 2 : void 0
|
|
2393
|
-
},
|
|
2394
|
-
children: [
|
|
2395
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "sr-only ui-grid-sr-only", children: [
|
|
2396
|
-
labels.filterColumn,
|
|
2397
|
-
" ",
|
|
2398
|
-
state.headerLabel(column)
|
|
2399
|
-
] }),
|
|
2400
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2401
|
-
"input",
|
|
2402
|
-
{
|
|
2403
|
-
className: "ui-grid-filter-input",
|
|
2404
|
-
type: "text",
|
|
2405
|
-
defaultValue: state.filterValue(column.name),
|
|
2406
|
-
placeholder: state.filterPlaceholder(column),
|
|
2407
|
-
disabled: state.isFilterInputDisabled(column),
|
|
2408
|
-
onChange: (e) => state.updateFilter(column.name, e.target.value)
|
|
2409
|
-
}
|
|
2410
|
-
)
|
|
2411
|
-
]
|
|
2412
|
-
},
|
|
2413
|
-
column.name
|
|
2414
|
-
);
|
|
2415
|
-
})
|
|
2416
|
-
}
|
|
2417
|
-
),
|
|
2418
|
-
displayItems.length > 0 ? virtualizationEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2419
|
-
"div",
|
|
2420
|
-
{
|
|
2421
|
-
className: "grid-viewport ui-grid-viewport",
|
|
2422
|
-
"data-part": "viewport",
|
|
2423
|
-
ref: virtualScroll.viewportRef,
|
|
2424
|
-
style: { height: viewportHeightPx, overflow: "auto", position: "relative" },
|
|
2425
|
-
onScroll: onViewportScroll,
|
|
2426
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { height: `${virtualScroll.totalHeight}px`, position: "relative" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1719
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1720
|
+
"div",
|
|
1721
|
+
{
|
|
1722
|
+
className: "grid-table ui-grid-contents-wrapper",
|
|
1723
|
+
"data-part": "grid-table",
|
|
1724
|
+
style: virtualizationEnabled ? { height: scrollContainerHeight, overflowY: "auto" } : void 0,
|
|
1725
|
+
onScroll: virtualizationEnabled ? onGridTableScroll : void 0,
|
|
1726
|
+
children: [
|
|
1727
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2427
1728
|
"div",
|
|
2428
1729
|
{
|
|
2429
|
-
className: "
|
|
1730
|
+
className: "header-grid ui-grid-header ui-grid-header-canvas",
|
|
1731
|
+
"data-part": "header",
|
|
1732
|
+
role: "row",
|
|
1733
|
+
ref: headerGridRef,
|
|
1734
|
+
style: { gridTemplateColumns },
|
|
1735
|
+
children: visibleColumns.map((column) => {
|
|
1736
|
+
const pinned = state.isPinned(column);
|
|
1737
|
+
const pinOffset = pinned ? state.pinnedOffset(column) : null;
|
|
1738
|
+
const pinMenuOpen = isPinMenuOpen(column);
|
|
1739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1740
|
+
"div",
|
|
1741
|
+
{
|
|
1742
|
+
className: `header-cell ui-grid-header-cell${sortingFeature && state.sortDirection(column) !== "none" ? " is-active" : ""}${pinned ? " is-pinned" : ""}${pinMenuOpen ? " is-pin-menu-open" : ""}`,
|
|
1743
|
+
"data-part": "header-cell",
|
|
1744
|
+
role: "columnheader",
|
|
1745
|
+
"aria-sort": sortingFeature ? state.sortAriaSort(column) : void 0,
|
|
1746
|
+
style: {
|
|
1747
|
+
position: pinned ? "sticky" : void 0,
|
|
1748
|
+
left: pinOffset?.side === "left" ? pinOffset.offset : void 0,
|
|
1749
|
+
right: pinOffset?.side === "right" ? pinOffset.offset : void 0,
|
|
1750
|
+
zIndex: pinMenuOpen ? 8 : pinned ? 2 : void 0
|
|
1751
|
+
},
|
|
1752
|
+
children: [
|
|
1753
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "header-label", children: state.headerLabel(column) }),
|
|
1754
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "header-actions", children: [
|
|
1755
|
+
sortingFeature && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1756
|
+
"button",
|
|
1757
|
+
{
|
|
1758
|
+
type: "button",
|
|
1759
|
+
className: `header-action${!state.isColumnSortable(column) ? " header-action-disabled" : ""}`,
|
|
1760
|
+
disabled: !state.isColumnSortable(column),
|
|
1761
|
+
"aria-label": state.sortButtonLabel(column),
|
|
1762
|
+
title: state.sortButtonLabel(column),
|
|
1763
|
+
onClick: () => state.toggleSort(column),
|
|
1764
|
+
children: [
|
|
1765
|
+
renderSortIcon(column),
|
|
1766
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only ui-grid-sr-only", children: state.sortButtonLabel(column) })
|
|
1767
|
+
]
|
|
1768
|
+
}
|
|
1769
|
+
),
|
|
1770
|
+
groupingFeature && state.isGroupingEnabled() && column.enableGrouping !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1771
|
+
"button",
|
|
1772
|
+
{
|
|
1773
|
+
type: "button",
|
|
1774
|
+
className: `chip-action${state.isGrouped(column) ? " chip-action-active" : ""}`,
|
|
1775
|
+
"data-part": "group-toggle",
|
|
1776
|
+
"aria-label": state.groupingButtonLabel(column),
|
|
1777
|
+
title: state.groupingButtonLabel(column),
|
|
1778
|
+
onClick: (e) => state.toggleGrouping(column, e),
|
|
1779
|
+
children: [
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 6h8v4H4V6Zm0 8h8v4H4v-4Zm10-8h6v4h-6V6Zm0 8h6v4h-6v-4Z" }) }),
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only ui-grid-sr-only", children: state.groupingButtonLabel(column) })
|
|
1782
|
+
]
|
|
1783
|
+
}
|
|
1784
|
+
),
|
|
1785
|
+
state.pinningFeature && state.isPinningEnabled() && state.isColumnPinnable(column) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `pin-control${pinMenuOpen ? " pin-control-open" : ""}`, onClick: (event) => event.stopPropagation(), children: [
|
|
1786
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1787
|
+
"button",
|
|
1788
|
+
{
|
|
1789
|
+
type: "button",
|
|
1790
|
+
className: `chip-action pin-trigger${pinned || pinMenuOpen ? " chip-action-active" : ""}`,
|
|
1791
|
+
"data-part": "pin-toggle",
|
|
1792
|
+
"aria-label": pinButtonLabel(column),
|
|
1793
|
+
title: pinButtonLabel(column),
|
|
1794
|
+
"aria-haspopup": pinned ? void 0 : "menu",
|
|
1795
|
+
"aria-expanded": pinned ? void 0 : pinMenuOpen,
|
|
1796
|
+
onClick: (event) => onPinTrigger(column, event),
|
|
1797
|
+
children: [
|
|
1798
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M16 12V4h1V2H7v2h1v8l-2 2v2h5v6l1 1 1-1v-6h5v-2l-2-2z" }) }),
|
|
1799
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only ui-grid-sr-only", children: pinButtonLabel(column) })
|
|
1800
|
+
]
|
|
1801
|
+
}
|
|
1802
|
+
),
|
|
1803
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1804
|
+
"div",
|
|
1805
|
+
{
|
|
1806
|
+
className: "pin-menu",
|
|
1807
|
+
"data-part": "pin-menu",
|
|
1808
|
+
role: "menu",
|
|
1809
|
+
"aria-label": "Pin options",
|
|
1810
|
+
"aria-hidden": !pinMenuOpen,
|
|
1811
|
+
children: [
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1813
|
+
"button",
|
|
1814
|
+
{
|
|
1815
|
+
type: "button",
|
|
1816
|
+
className: "pin-menu-action",
|
|
1817
|
+
"data-part": "pin-left-action",
|
|
1818
|
+
role: "menuitem",
|
|
1819
|
+
"aria-label": labels.pinLeft,
|
|
1820
|
+
title: labels.pinLeft,
|
|
1821
|
+
tabIndex: pinMenuOpen ? 0 : -1,
|
|
1822
|
+
onClick: (event) => choosePinDirection(column, "left", event),
|
|
1823
|
+
children: [
|
|
1824
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 6 4 12l6 6v-4h10v-4H10V6z" }) }),
|
|
1825
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only ui-grid-sr-only", children: labels.pinLeft })
|
|
1826
|
+
]
|
|
1827
|
+
}
|
|
1828
|
+
),
|
|
1829
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1830
|
+
"button",
|
|
1831
|
+
{
|
|
1832
|
+
type: "button",
|
|
1833
|
+
className: "pin-menu-action",
|
|
1834
|
+
"data-part": "pin-right-action",
|
|
1835
|
+
role: "menuitem",
|
|
1836
|
+
"aria-label": labels.pinRight,
|
|
1837
|
+
title: labels.pinRight,
|
|
1838
|
+
tabIndex: pinMenuOpen ? 0 : -1,
|
|
1839
|
+
onClick: (event) => choosePinDirection(column, "right", event),
|
|
1840
|
+
children: [
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M14 6v4H4v4h10v4l6-6-6-6z" }) }),
|
|
1842
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only ui-grid-sr-only", children: labels.pinRight })
|
|
1843
|
+
]
|
|
1844
|
+
}
|
|
1845
|
+
)
|
|
1846
|
+
]
|
|
1847
|
+
}
|
|
1848
|
+
)
|
|
1849
|
+
] })
|
|
1850
|
+
] })
|
|
1851
|
+
]
|
|
1852
|
+
},
|
|
1853
|
+
column.name
|
|
1854
|
+
);
|
|
1855
|
+
})
|
|
1856
|
+
}
|
|
1857
|
+
),
|
|
1858
|
+
filteringFeature && state.isFilteringEnabled() && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1859
|
+
"div",
|
|
1860
|
+
{
|
|
1861
|
+
className: "filter-grid ui-grid-header",
|
|
1862
|
+
"data-part": "filters",
|
|
1863
|
+
ref: filterGridRef,
|
|
1864
|
+
style: { gridTemplateColumns, ["--ui-grid-header-sticky-top"]: `${headerStickyHeight}px` },
|
|
1865
|
+
children: visibleColumns.map((column) => {
|
|
1866
|
+
const pinned = state.isPinned(column);
|
|
1867
|
+
const pinOffset = pinned ? state.pinnedOffset(column) : null;
|
|
1868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1869
|
+
"label",
|
|
1870
|
+
{
|
|
1871
|
+
className: `filter-cell ui-grid-filter-container${pinned ? " is-pinned" : ""}`,
|
|
1872
|
+
"data-part": "filter-cell",
|
|
1873
|
+
style: {
|
|
1874
|
+
position: pinned ? "sticky" : void 0,
|
|
1875
|
+
left: pinOffset?.side === "left" ? pinOffset.offset : void 0,
|
|
1876
|
+
right: pinOffset?.side === "right" ? pinOffset.offset : void 0,
|
|
1877
|
+
zIndex: pinned ? 2 : void 0
|
|
1878
|
+
},
|
|
1879
|
+
children: [
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "sr-only ui-grid-sr-only", children: [
|
|
1881
|
+
labels.filterColumn,
|
|
1882
|
+
" ",
|
|
1883
|
+
state.headerLabel(column)
|
|
1884
|
+
] }),
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1886
|
+
"input",
|
|
1887
|
+
{
|
|
1888
|
+
className: "ui-grid-filter-input",
|
|
1889
|
+
type: "text",
|
|
1890
|
+
defaultValue: state.filterValue(column.name),
|
|
1891
|
+
placeholder: state.filterPlaceholder(column),
|
|
1892
|
+
disabled: state.isFilterInputDisabled(column),
|
|
1893
|
+
onChange: (e) => state.updateFilter(column.name, e.target.value)
|
|
1894
|
+
}
|
|
1895
|
+
)
|
|
1896
|
+
]
|
|
1897
|
+
},
|
|
1898
|
+
column.name
|
|
1899
|
+
);
|
|
1900
|
+
})
|
|
1901
|
+
}
|
|
1902
|
+
),
|
|
1903
|
+
displayItems.length > 0 ? virtualizationEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-virtual-spacer", style: { height: `${virtualScroll.totalHeight}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1904
|
+
"div",
|
|
1905
|
+
{
|
|
1906
|
+
className: "body-grid ui-grid-canvas grid-virtual-body",
|
|
2430
1907
|
"data-part": "body",
|
|
2431
1908
|
role: "rowgroup",
|
|
2432
1909
|
style: {
|
|
2433
1910
|
gridTemplateColumns,
|
|
2434
1911
|
position: "absolute",
|
|
2435
|
-
top:
|
|
2436
|
-
left: 0
|
|
2437
|
-
right: 0,
|
|
2438
|
-
transform: `translateY(${virtualScroll.offsetY}px)`
|
|
1912
|
+
top: `${virtualScroll.offsetY}px`,
|
|
1913
|
+
left: 0
|
|
2439
1914
|
},
|
|
2440
1915
|
children: itemsToRender.map(renderDisplayItem)
|
|
2441
1916
|
}
|
|
2442
|
-
) })
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
1917
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1918
|
+
"div",
|
|
1919
|
+
{
|
|
1920
|
+
className: "body-grid ui-grid-canvas",
|
|
1921
|
+
"data-part": "body",
|
|
1922
|
+
role: "rowgroup",
|
|
1923
|
+
style: { gridTemplateColumns },
|
|
1924
|
+
children: displayItems.map(renderDisplayItem)
|
|
1925
|
+
}
|
|
1926
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "empty-state ui-grid-no-row-overlay", "data-part": "empty-state", children: [
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: options.emptyMessage ?? labels.emptyHeading }),
|
|
1928
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: labels.emptyDescription })
|
|
1929
|
+
] }),
|
|
1930
|
+
paginationFeature && state.showPaginationControls() && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1931
|
+
"footer",
|
|
1932
|
+
{
|
|
1933
|
+
className: "pagination-bar ui-grid-pagination",
|
|
1934
|
+
"data-part": "pagination",
|
|
1935
|
+
role: "navigation",
|
|
1936
|
+
"aria-label": labels.paginationPage,
|
|
1937
|
+
children: [
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: state.paginationSummary() }),
|
|
1939
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pagination-controls", children: [
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1941
|
+
"button",
|
|
1942
|
+
{
|
|
1943
|
+
type: "button",
|
|
1944
|
+
className: "action action-secondary pagination-button",
|
|
1945
|
+
"aria-label": labels.paginationPrevious,
|
|
1946
|
+
disabled: paginationCurrentPage <= 1,
|
|
1947
|
+
onClick: () => state.previousPage(),
|
|
1948
|
+
children: [
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1950
|
+
"svg",
|
|
1951
|
+
{
|
|
1952
|
+
className: "pagination-icon",
|
|
1953
|
+
viewBox: "0 0 24 24",
|
|
1954
|
+
"aria-hidden": "true",
|
|
1955
|
+
focusable: false,
|
|
1956
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" })
|
|
1957
|
+
}
|
|
1958
|
+
),
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: labels.paginationPrevious })
|
|
1960
|
+
]
|
|
1961
|
+
}
|
|
1962
|
+
),
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
1964
|
+
labels.paginationPage,
|
|
1965
|
+
" ",
|
|
1966
|
+
paginationCurrentPage,
|
|
1967
|
+
" ",
|
|
1968
|
+
labels.paginationOf,
|
|
1969
|
+
" ",
|
|
1970
|
+
paginationTotalPages
|
|
1971
|
+
] }),
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1973
|
+
"button",
|
|
1974
|
+
{
|
|
1975
|
+
type: "button",
|
|
1976
|
+
className: "action action-secondary pagination-button",
|
|
1977
|
+
"aria-label": labels.paginationNext,
|
|
1978
|
+
disabled: paginationCurrentPage >= paginationTotalPages,
|
|
1979
|
+
onClick: () => state.nextPage(),
|
|
1980
|
+
children: [
|
|
1981
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1982
|
+
"svg",
|
|
1983
|
+
{
|
|
1984
|
+
className: "pagination-icon",
|
|
1985
|
+
viewBox: "0 0 24 24",
|
|
1986
|
+
"aria-hidden": "true",
|
|
1987
|
+
focusable: false,
|
|
1988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" })
|
|
1989
|
+
}
|
|
1990
|
+
),
|
|
1991
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: labels.paginationNext })
|
|
1992
|
+
]
|
|
1993
|
+
}
|
|
1994
|
+
),
|
|
1995
|
+
state.pageSizeOptions().length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "pagination-size", children: [
|
|
1996
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: labels.paginationRows }),
|
|
2508
1997
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2509
|
-
"
|
|
1998
|
+
"select",
|
|
2510
1999
|
{
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z" })
|
|
2000
|
+
"aria-label": labels.paginationRows,
|
|
2001
|
+
value: paginationSelectedPageSize,
|
|
2002
|
+
onChange: (e) => state.onPageSizeChange(e.target.value),
|
|
2003
|
+
children: state.pageSizeOptions().map((size) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: size, children: size }, size))
|
|
2516
2004
|
}
|
|
2517
|
-
)
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
{
|
|
2527
|
-
"aria-label": labels.paginationRows,
|
|
2528
|
-
value: paginationSelectedPageSize,
|
|
2529
|
-
onChange: (e) => state.onPageSizeChange(e.target.value),
|
|
2530
|
-
children: state.pageSizeOptions().map((size) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: size, children: size }, size))
|
|
2531
|
-
}
|
|
2532
|
-
)
|
|
2533
|
-
] })
|
|
2534
|
-
] })
|
|
2535
|
-
]
|
|
2536
|
-
}
|
|
2537
|
-
)
|
|
2538
|
-
] })
|
|
2005
|
+
)
|
|
2006
|
+
] })
|
|
2007
|
+
] })
|
|
2008
|
+
]
|
|
2009
|
+
}
|
|
2010
|
+
)
|
|
2011
|
+
]
|
|
2012
|
+
}
|
|
2013
|
+
)
|
|
2539
2014
|
]
|
|
2540
2015
|
}
|
|
2541
2016
|
)
|
|
2542
2017
|
] }) });
|
|
2543
2018
|
}
|
|
2544
2019
|
|
|
2020
|
+
// src/mountUiGrid.tsx
|
|
2021
|
+
var import_react4 = __toESM(require("react"));
|
|
2022
|
+
var import_client = require("react-dom/client");
|
|
2023
|
+
function mountUiGrid(container, props) {
|
|
2024
|
+
const root = (0, import_client.createRoot)(container);
|
|
2025
|
+
root.render(import_react4.default.createElement(UiGrid, props));
|
|
2026
|
+
return root;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2545
2029
|
// src/rustWasmGridEngine.ts
|
|
2546
|
-
var
|
|
2547
|
-
var uiGridWasmModulePath = "../../../dist/ui-grid-wasm/ui_grid_wasm.js";
|
|
2030
|
+
var import_ui_grid3 = require("@ornery/ui-grid");
|
|
2031
|
+
var uiGridWasmModulePath = "../../../dist/ui-grid-wasm-web/ui_grid_wasm.js";
|
|
2032
|
+
var uiGridWasmBinaryPath = "/dist/ui-grid-wasm-web/ui_grid_wasm_bg.wasm";
|
|
2548
2033
|
function registerReactUiGridWasmEngineFromModule(module2) {
|
|
2549
|
-
(0,
|
|
2034
|
+
(0, import_ui_grid3.registerRustWasmGridEngine)({
|
|
2550
2035
|
buildPipeline(context) {
|
|
2551
2036
|
return module2.build_pipeline_js(context);
|
|
2552
2037
|
}
|
|
@@ -2557,11 +2042,12 @@ async function enableReactUiGridWasmEngine() {
|
|
|
2557
2042
|
/* @vite-ignore */
|
|
2558
2043
|
uiGridWasmModulePath
|
|
2559
2044
|
);
|
|
2045
|
+
await module2.default(uiGridWasmBinaryPath);
|
|
2560
2046
|
registerReactUiGridWasmEngineFromModule(module2);
|
|
2561
2047
|
}
|
|
2562
2048
|
|
|
2563
2049
|
// src/index.ts
|
|
2564
|
-
var
|
|
2050
|
+
var import_ui_grid4 = require("@ornery/ui-grid");
|
|
2565
2051
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2566
2052
|
0 && (module.exports = {
|
|
2567
2053
|
DEFAULT_GRID_LABELS,
|
|
@@ -2571,6 +2057,7 @@ var import_ui_grid9 = require("@ornery/ui-grid");
|
|
|
2571
2057
|
computeViewportRows,
|
|
2572
2058
|
enableReactUiGridWasmEngine,
|
|
2573
2059
|
formatPaginationSummary,
|
|
2060
|
+
mountUiGrid,
|
|
2574
2061
|
orderVisibleColumns,
|
|
2575
2062
|
registerReactUiGridWasmEngineFromModule,
|
|
2576
2063
|
resolveBenchmarkIterations,
|