@ishibashi0112/spreadsheet-grid 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/ActiveCellOverlay.d.ts +14 -0
- package/dist/CellEditorLayer.d.ts +18 -0
- package/dist/SelectionOverlay.d.ts +14 -0
- package/dist/SpreadsheetGrid.d.ts +3 -0
- package/dist/hooks/useColumnAutosizeRunner.d.ts +16 -0
- package/dist/hooks/useColumnChooserController.d.ts +18 -0
- package/dist/hooks/useColumnHeaderDragController.d.ts +24 -0
- package/dist/hooks/useColumnMenuController.d.ts +23 -0
- package/dist/hooks/useColumnSelectOptionsCollector.d.ts +18 -0
- package/dist/hooks/useFilterPopoverController.d.ts +30 -0
- package/dist/hooks/useGridBarContext.d.ts +17 -0
- package/dist/hooks/useGridClipboardController.d.ts +22 -0
- package/dist/hooks/useGridEditController.d.ts +23 -0
- package/dist/hooks/useGridKeyboardInteractions.d.ts +21 -0
- package/dist/hooks/useGridPointerInteractions.d.ts +46 -0
- package/dist/hooks/useGridViewportSync.d.ts +21 -0
- package/dist/hooks/useServerSideRowModel.d.ts +16 -0
- package/dist/hooks/useSortManagementController.d.ts +18 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5024 -0
- package/dist/logic/columnAutosize.d.ts +18 -0
- package/dist/logic/cx.d.ts +1 -0
- package/dist/logic/domGuards.d.ts +7 -0
- package/dist/logic/filtering.d.ts +12 -0
- package/dist/logic/geometry.d.ts +72 -0
- package/dist/logic/rowHeightStore.d.ts +13 -0
- package/dist/logic/selectOptions.d.ts +9 -0
- package/dist/logic/serverSideBlocks.d.ts +2 -0
- package/dist/logic/serverSideCache.d.ts +13 -0
- package/dist/logic/serverSideQuery.d.ts +7 -0
- package/dist/logic/sorting.d.ts +11 -0
- package/dist/logic/verticalGeometry.d.ts +50 -0
- package/dist/model/gridActions.d.ts +87 -0
- package/dist/model/gridReducer.d.ts +4 -0
- package/dist/model/gridSelectors.d.ts +40 -0
- package/dist/model/gridTypes.d.ts +267 -0
- package/dist/style.css +2 -0
- package/dist/utils/clipboard.d.ts +25 -0
- package/dist/utils/excelColumnName.d.ts +1 -0
- package/dist/utils/permissions.d.ts +4 -0
- package/dist/utils/scheduler.d.ts +1 -0
- package/dist/view/ColumnChooserPanel.d.ts +23 -0
- package/dist/view/ColumnFilterPopover.d.ts +40 -0
- package/dist/view/ColumnMenuPopover.d.ts +25 -0
- package/dist/view/DefaultGridBottomBar.d.ts +6 -0
- package/dist/view/DefaultGridTopBar.d.ts +6 -0
- package/dist/view/GridBodyLayer.d.ts +43 -0
- package/dist/view/GridHeaderRow.d.ts +41 -0
- package/dist/view/SortManagementPanel.d.ts +24 -0
- package/dist/view/gridBarHelpers.d.ts +12 -0
- package/package.json +89 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,5024 @@
|
|
|
1
|
+
import { memo as e, useCallback as t, useDeferredValue as n, useEffect as r, useLayoutEffect as i, useMemo as a, useReducer as o, useRef as s, useState as c } from "react";
|
|
2
|
+
import { useVirtualizer as l } from "@tanstack/react-virtual";
|
|
3
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as p } from "react-dom";
|
|
5
|
+
//#region src/components/spreadsheet-grid/logic/cx.ts
|
|
6
|
+
function m(...e) {
|
|
7
|
+
return e.filter(Boolean).join(" ");
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/components/spreadsheet-grid/model/gridActions.ts
|
|
11
|
+
var h = {
|
|
12
|
+
activateCell: (e) => ({
|
|
13
|
+
type: "cell/activate",
|
|
14
|
+
cell: e
|
|
15
|
+
}),
|
|
16
|
+
startSelection: (e) => ({
|
|
17
|
+
type: "selection/start",
|
|
18
|
+
cell: e
|
|
19
|
+
}),
|
|
20
|
+
updateSelection: (e) => ({
|
|
21
|
+
type: "selection/update",
|
|
22
|
+
cell: e
|
|
23
|
+
}),
|
|
24
|
+
startRowSelection: (e) => ({
|
|
25
|
+
type: "rowSelection/start",
|
|
26
|
+
row: e
|
|
27
|
+
}),
|
|
28
|
+
updateRowSelection: (e) => ({
|
|
29
|
+
type: "rowSelection/update",
|
|
30
|
+
row: e
|
|
31
|
+
}),
|
|
32
|
+
startColumnSelection: (e) => ({
|
|
33
|
+
type: "columnSelection/start",
|
|
34
|
+
col: e
|
|
35
|
+
}),
|
|
36
|
+
updateColumnSelection: (e) => ({
|
|
37
|
+
type: "columnSelection/update",
|
|
38
|
+
col: e
|
|
39
|
+
}),
|
|
40
|
+
endSelection: () => ({ type: "selection/end" }),
|
|
41
|
+
clearSelection: () => ({ type: "selection/clear" }),
|
|
42
|
+
startEdit: (e) => ({
|
|
43
|
+
type: "edit/start",
|
|
44
|
+
cell: e
|
|
45
|
+
}),
|
|
46
|
+
stopEdit: () => ({ type: "edit/stop" }),
|
|
47
|
+
startColumnResize: (e, t, n, r, i) => ({
|
|
48
|
+
type: "column/resizeStart",
|
|
49
|
+
columnKey: e,
|
|
50
|
+
startX: t,
|
|
51
|
+
startWidth: n,
|
|
52
|
+
minWidth: r,
|
|
53
|
+
maxWidth: i
|
|
54
|
+
}),
|
|
55
|
+
updateColumnResize: (e) => ({
|
|
56
|
+
type: "column/resizeUpdate",
|
|
57
|
+
clientX: e
|
|
58
|
+
}),
|
|
59
|
+
endColumnResize: () => ({ type: "column/resizeEnd" }),
|
|
60
|
+
syncColumnWidths: (e) => ({
|
|
61
|
+
type: "columnWidths/sync",
|
|
62
|
+
widths: e
|
|
63
|
+
}),
|
|
64
|
+
setGlobalFilter: (e) => ({
|
|
65
|
+
type: "filter/setGlobal",
|
|
66
|
+
value: e
|
|
67
|
+
}),
|
|
68
|
+
setColumnFilter: (e, t) => ({
|
|
69
|
+
type: "filter/setColumn",
|
|
70
|
+
columnKey: e,
|
|
71
|
+
value: t
|
|
72
|
+
}),
|
|
73
|
+
clearColumnFilter: (e) => ({
|
|
74
|
+
type: "filter/clearColumn",
|
|
75
|
+
columnKey: e
|
|
76
|
+
}),
|
|
77
|
+
resetAllFilters: () => ({ type: "filter/resetAll" }),
|
|
78
|
+
setSort: (e) => ({
|
|
79
|
+
type: "sort/set",
|
|
80
|
+
entries: e
|
|
81
|
+
}),
|
|
82
|
+
clearSort: () => ({ type: "sort/clear" })
|
|
83
|
+
}, g = 60, _ = 1e3, v = (e, t, n) => Math.min(Math.max(e, t), n), y = (e) => e.reduce((e, t) => (e[t.key] = t.width, e), {}), b = (e) => ({
|
|
84
|
+
activeCell: null,
|
|
85
|
+
selection: null,
|
|
86
|
+
editingCell: null,
|
|
87
|
+
dragState: null,
|
|
88
|
+
columnWidths: y(e),
|
|
89
|
+
filters: {
|
|
90
|
+
globalText: "",
|
|
91
|
+
columnFilters: {}
|
|
92
|
+
},
|
|
93
|
+
sort: []
|
|
94
|
+
}), x = (e, t) => {
|
|
95
|
+
switch (t.type) {
|
|
96
|
+
case "cell/activate": return {
|
|
97
|
+
...e,
|
|
98
|
+
activeCell: t.cell
|
|
99
|
+
};
|
|
100
|
+
case "selection/start": return {
|
|
101
|
+
...e,
|
|
102
|
+
activeCell: t.cell,
|
|
103
|
+
selection: {
|
|
104
|
+
type: "cell",
|
|
105
|
+
range: {
|
|
106
|
+
start: t.cell,
|
|
107
|
+
end: t.cell
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
dragState: {
|
|
111
|
+
type: "selection",
|
|
112
|
+
selectionKind: "cell",
|
|
113
|
+
anchor: t.cell
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
case "rowSelection/start": return {
|
|
117
|
+
...e,
|
|
118
|
+
activeCell: {
|
|
119
|
+
row: t.row,
|
|
120
|
+
col: e.activeCell?.col ?? 0
|
|
121
|
+
},
|
|
122
|
+
selection: {
|
|
123
|
+
type: "row",
|
|
124
|
+
startRow: t.row,
|
|
125
|
+
endRow: t.row
|
|
126
|
+
},
|
|
127
|
+
dragState: {
|
|
128
|
+
type: "selection",
|
|
129
|
+
selectionKind: "row",
|
|
130
|
+
anchorRow: t.row
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
case "rowSelection/update": return e.dragState?.type !== "selection" || e.dragState.selectionKind !== "row" || e.selection?.type === "row" && e.selection.endRow === t.row ? e : {
|
|
134
|
+
...e,
|
|
135
|
+
selection: {
|
|
136
|
+
type: "row",
|
|
137
|
+
startRow: e.dragState.anchorRow,
|
|
138
|
+
endRow: t.row
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
case "selection/update": return e.dragState?.type !== "selection" || e.dragState.selectionKind !== "cell" || e.selection?.type === "cell" && e.selection.range.end.row === t.cell.row && e.selection.range.end.col === t.cell.col ? e : {
|
|
142
|
+
...e,
|
|
143
|
+
selection: {
|
|
144
|
+
type: "cell",
|
|
145
|
+
range: {
|
|
146
|
+
start: e.dragState.anchor,
|
|
147
|
+
end: t.cell
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
case "columnSelection/start": return {
|
|
152
|
+
...e,
|
|
153
|
+
activeCell: {
|
|
154
|
+
row: e.activeCell?.row ?? 0,
|
|
155
|
+
col: t.col
|
|
156
|
+
},
|
|
157
|
+
selection: {
|
|
158
|
+
type: "col",
|
|
159
|
+
startCol: t.col,
|
|
160
|
+
endCol: t.col
|
|
161
|
+
},
|
|
162
|
+
dragState: {
|
|
163
|
+
type: "selection",
|
|
164
|
+
selectionKind: "col",
|
|
165
|
+
anchorCol: t.col
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
case "columnSelection/update": return e.dragState?.type !== "selection" || e.dragState.selectionKind !== "col" || e.selection?.type === "col" && e.selection.endCol === t.col ? e : {
|
|
169
|
+
...e,
|
|
170
|
+
selection: {
|
|
171
|
+
type: "col",
|
|
172
|
+
startCol: e.dragState.anchorCol,
|
|
173
|
+
endCol: t.col
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
case "selection/end": return e.dragState?.type === "selection" ? {
|
|
177
|
+
...e,
|
|
178
|
+
dragState: null
|
|
179
|
+
} : e;
|
|
180
|
+
case "selection/clear": return {
|
|
181
|
+
...e,
|
|
182
|
+
selection: null,
|
|
183
|
+
dragState: null
|
|
184
|
+
};
|
|
185
|
+
case "edit/start": return {
|
|
186
|
+
...e,
|
|
187
|
+
editingCell: t.cell,
|
|
188
|
+
activeCell: t.cell
|
|
189
|
+
};
|
|
190
|
+
case "edit/stop": return {
|
|
191
|
+
...e,
|
|
192
|
+
editingCell: null
|
|
193
|
+
};
|
|
194
|
+
case "column/resizeStart": return {
|
|
195
|
+
...e,
|
|
196
|
+
dragState: {
|
|
197
|
+
type: "columnResize",
|
|
198
|
+
columnKey: t.columnKey,
|
|
199
|
+
startX: t.startX,
|
|
200
|
+
startWidth: t.startWidth,
|
|
201
|
+
minWidth: t.minWidth || g,
|
|
202
|
+
maxWidth: t.maxWidth || _
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
case "column/resizeUpdate": {
|
|
206
|
+
if (e.dragState?.type !== "columnResize") return e;
|
|
207
|
+
let n = v(e.dragState.startWidth + (t.clientX - e.dragState.startX), e.dragState.minWidth, e.dragState.maxWidth);
|
|
208
|
+
return e.columnWidths[e.dragState.columnKey] === n ? e : {
|
|
209
|
+
...e,
|
|
210
|
+
columnWidths: {
|
|
211
|
+
...e.columnWidths,
|
|
212
|
+
[e.dragState.columnKey]: n
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
case "column/resizeEnd": return e.dragState?.type === "columnResize" ? {
|
|
217
|
+
...e,
|
|
218
|
+
dragState: null
|
|
219
|
+
} : e;
|
|
220
|
+
case "columnWidths/sync": return {
|
|
221
|
+
...e,
|
|
222
|
+
columnWidths: {
|
|
223
|
+
...e.columnWidths,
|
|
224
|
+
...t.widths
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
case "filter/setGlobal": return {
|
|
228
|
+
...e,
|
|
229
|
+
filters: {
|
|
230
|
+
...e.filters,
|
|
231
|
+
globalText: t.value
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
case "filter/setColumn": return {
|
|
235
|
+
...e,
|
|
236
|
+
filters: {
|
|
237
|
+
...e.filters,
|
|
238
|
+
columnFilters: {
|
|
239
|
+
...e.filters.columnFilters,
|
|
240
|
+
[t.columnKey]: t.value
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
case "filter/clearColumn": {
|
|
245
|
+
let n = { ...e.filters.columnFilters };
|
|
246
|
+
return delete n[t.columnKey], {
|
|
247
|
+
...e,
|
|
248
|
+
filters: {
|
|
249
|
+
...e.filters,
|
|
250
|
+
columnFilters: n
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
case "filter/resetAll": return {
|
|
255
|
+
...e,
|
|
256
|
+
filters: {
|
|
257
|
+
globalText: "",
|
|
258
|
+
columnFilters: {}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
case "sort/set": return {
|
|
262
|
+
...e,
|
|
263
|
+
sort: t.entries
|
|
264
|
+
};
|
|
265
|
+
case "sort/clear": return {
|
|
266
|
+
...e,
|
|
267
|
+
sort: []
|
|
268
|
+
};
|
|
269
|
+
default: return e;
|
|
270
|
+
}
|
|
271
|
+
}, S = (e) => ({
|
|
272
|
+
start: {
|
|
273
|
+
row: Math.min(e.start.row, e.end.row),
|
|
274
|
+
col: Math.min(e.start.col, e.end.col)
|
|
275
|
+
},
|
|
276
|
+
end: {
|
|
277
|
+
row: Math.max(e.start.row, e.end.row),
|
|
278
|
+
col: Math.max(e.start.col, e.end.col)
|
|
279
|
+
}
|
|
280
|
+
}), C = (e, t) => ({
|
|
281
|
+
startRow: Math.min(e, t),
|
|
282
|
+
endRow: Math.max(e, t)
|
|
283
|
+
}), w = (e, t) => ({
|
|
284
|
+
startCol: Math.min(e, t),
|
|
285
|
+
endCol: Math.max(e, t)
|
|
286
|
+
}), T = (e) => e.filters.globalText, E = (e) => {
|
|
287
|
+
if (!e) return { kind: "none" };
|
|
288
|
+
if (e.type === "cell") {
|
|
289
|
+
let t = S(e.range);
|
|
290
|
+
return {
|
|
291
|
+
kind: "cell",
|
|
292
|
+
startRow: t.start.row,
|
|
293
|
+
endRow: t.end.row,
|
|
294
|
+
startCol: t.start.col,
|
|
295
|
+
endCol: t.end.col
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
if (e.type === "row") {
|
|
299
|
+
let t = C(e.startRow, e.endRow);
|
|
300
|
+
return {
|
|
301
|
+
kind: "row",
|
|
302
|
+
startRow: t.startRow,
|
|
303
|
+
endRow: t.endRow
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
let t = w(e.startCol, e.endCol);
|
|
307
|
+
return {
|
|
308
|
+
kind: "col",
|
|
309
|
+
startCol: t.startCol,
|
|
310
|
+
endCol: t.endCol
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/components/spreadsheet-grid/SelectionOverlay.tsx
|
|
315
|
+
function D({ rect: e, headerHeight: t, leadingWidth: n, baseOffset: r = 0 }) {
|
|
316
|
+
return e ? /* @__PURE__ */ d("div", {
|
|
317
|
+
className: "ssg-selection-overlay",
|
|
318
|
+
style: {
|
|
319
|
+
position: "absolute",
|
|
320
|
+
left: n + e.left,
|
|
321
|
+
top: t + e.top - r,
|
|
322
|
+
width: e.width,
|
|
323
|
+
height: e.height
|
|
324
|
+
}
|
|
325
|
+
}) : null;
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/components/spreadsheet-grid/ActiveCellOverlay.tsx
|
|
329
|
+
function O({ rect: e, headerHeight: t, leadingWidth: n, baseOffset: r = 0 }) {
|
|
330
|
+
return e ? /* @__PURE__ */ d("div", {
|
|
331
|
+
className: "ssg-active-cell-overlay",
|
|
332
|
+
style: {
|
|
333
|
+
position: "absolute",
|
|
334
|
+
left: n + e.left,
|
|
335
|
+
top: t + e.top - r,
|
|
336
|
+
width: e.width,
|
|
337
|
+
height: e.height
|
|
338
|
+
}
|
|
339
|
+
}) : null;
|
|
340
|
+
}
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/components/spreadsheet-grid/CellEditorLayer.tsx
|
|
343
|
+
function k({ rect: e, headerHeight: t, leadingWidth: n, baseOffset: i = 0, initialValue: a, onCommit: o, onCancel: l }) {
|
|
344
|
+
let u = s(null), [f, p] = c(""), m = e !== null, [h, g] = c(!1);
|
|
345
|
+
return m !== h && (g(m), m && p(a)), r(() => {
|
|
346
|
+
if (!e || !u.current) return;
|
|
347
|
+
u.current.focus();
|
|
348
|
+
let t = u.current.value.length;
|
|
349
|
+
u.current.setSelectionRange(t, t);
|
|
350
|
+
}, [e]), e ? /* @__PURE__ */ d("div", {
|
|
351
|
+
className: "ssg-cell-editor",
|
|
352
|
+
style: {
|
|
353
|
+
position: "absolute",
|
|
354
|
+
left: n + e.left,
|
|
355
|
+
top: t + e.top - i,
|
|
356
|
+
width: e.width,
|
|
357
|
+
height: e.height
|
|
358
|
+
},
|
|
359
|
+
children: /* @__PURE__ */ d("input", {
|
|
360
|
+
ref: u,
|
|
361
|
+
type: "text",
|
|
362
|
+
value: f,
|
|
363
|
+
onChange: (e) => p(e.target.value),
|
|
364
|
+
onKeyDown: (e) => {
|
|
365
|
+
if (e.key === "Enter") {
|
|
366
|
+
e.preventDefault(), o(f, "down");
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
if (e.key === "Escape") {
|
|
370
|
+
e.preventDefault(), l();
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
e.key === "Tab" && (e.preventDefault(), o(f, e.shiftKey ? "left" : "right"));
|
|
374
|
+
},
|
|
375
|
+
onBlur: () => o(f),
|
|
376
|
+
className: "ssg-cell-editor-input"
|
|
377
|
+
})
|
|
378
|
+
}) : null;
|
|
379
|
+
}
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region src/components/spreadsheet-grid/utils/permissions.ts
|
|
382
|
+
var A = (e, t, n, r, i) => e.readOnly || i.readOnly || i.editable === !1 ? !1 : e.canEditCell ? e.canEditCell(t, n, r, i) : !0, j = (e, t) => t.getValue ? t.getValue(e) : e[t.key], M = (e, t, n) => t.setValue ? t.setValue(e, n) : {
|
|
383
|
+
...e,
|
|
384
|
+
[t.key]: n
|
|
385
|
+
}, N = (e) => {
|
|
386
|
+
let t = new Int32Array(e);
|
|
387
|
+
for (let n = 0; n < e; n += 1) t[n] = n;
|
|
388
|
+
return t;
|
|
389
|
+
}, P = (e) => e?.kind === "set", F = (e) => {
|
|
390
|
+
if (!e) return !1;
|
|
391
|
+
switch (e.kind) {
|
|
392
|
+
case "set":
|
|
393
|
+
case "number":
|
|
394
|
+
case "custom": return !0;
|
|
395
|
+
case "select": return e.value.length > 0;
|
|
396
|
+
case "text":
|
|
397
|
+
case "date": return e.value.trim().length > 0;
|
|
398
|
+
}
|
|
399
|
+
}, I = (e) => {
|
|
400
|
+
let t = e.trim();
|
|
401
|
+
if (!t) return null;
|
|
402
|
+
let n = t.match(/^(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)$/);
|
|
403
|
+
if (n) {
|
|
404
|
+
let e = Number(n[1]), t = Number(n[2]);
|
|
405
|
+
return !Number.isFinite(e) || !Number.isFinite(t) ? null : {
|
|
406
|
+
mode: "range",
|
|
407
|
+
min: Math.min(e, t),
|
|
408
|
+
max: Math.max(e, t)
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
let r = t.match(/^(<=|>=|=|<|>)?\s*(-?\d+(?:\.\d+)?)$/);
|
|
412
|
+
return r ? {
|
|
413
|
+
mode: "comparison",
|
|
414
|
+
operator: r[1] ?? "=",
|
|
415
|
+
value: Number(r[2])
|
|
416
|
+
} : null;
|
|
417
|
+
}, L = (e) => e?.kind === "number", ee = (e) => {
|
|
418
|
+
let t = e.trim();
|
|
419
|
+
return t ? {
|
|
420
|
+
kind: "number",
|
|
421
|
+
raw: t,
|
|
422
|
+
parsed: I(t)
|
|
423
|
+
} : null;
|
|
424
|
+
}, te = (e) => {
|
|
425
|
+
if (!e) return "";
|
|
426
|
+
switch (e.kind) {
|
|
427
|
+
case "number": return e.raw;
|
|
428
|
+
case "text":
|
|
429
|
+
case "date":
|
|
430
|
+
case "select": return e.value;
|
|
431
|
+
case "set":
|
|
432
|
+
case "custom": return "";
|
|
433
|
+
}
|
|
434
|
+
}, ne = (e, t, n) => {
|
|
435
|
+
if (!F(t)) return null;
|
|
436
|
+
let r = t;
|
|
437
|
+
if (e.filterFn) {
|
|
438
|
+
let t = e.filterFn;
|
|
439
|
+
return (e) => t(e, r);
|
|
440
|
+
}
|
|
441
|
+
switch (r.kind) {
|
|
442
|
+
case "set": {
|
|
443
|
+
let t = new Set(r.values);
|
|
444
|
+
return r.mode === "exclude" ? (n) => !t.has(String(j(n, e) ?? "")) : (n) => t.has(String(j(n, e) ?? ""));
|
|
445
|
+
}
|
|
446
|
+
case "number": {
|
|
447
|
+
let t = r.parsed;
|
|
448
|
+
if (t === null) {
|
|
449
|
+
let t = r.raw.toLowerCase();
|
|
450
|
+
return (n) => String(j(n, e) ?? "").toLowerCase().includes(t);
|
|
451
|
+
}
|
|
452
|
+
if (t.mode === "range") {
|
|
453
|
+
let { min: r, max: i } = t;
|
|
454
|
+
return (t, a) => {
|
|
455
|
+
let o = n ? n[a] : Number(j(t, e));
|
|
456
|
+
return Number.isFinite(o) && o >= r && o <= i;
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
let { operator: i, value: a } = t;
|
|
460
|
+
return (t, r) => {
|
|
461
|
+
let o = n ? n[r] : Number(j(t, e));
|
|
462
|
+
if (!Number.isFinite(o)) return !1;
|
|
463
|
+
switch (i) {
|
|
464
|
+
case ">": return o > a;
|
|
465
|
+
case ">=": return o >= a;
|
|
466
|
+
case "<": return o < a;
|
|
467
|
+
case "<=": return o <= a;
|
|
468
|
+
default: return o === a;
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
case "select": {
|
|
473
|
+
let t = r.value;
|
|
474
|
+
return (n) => String(j(n, e) ?? "") === t;
|
|
475
|
+
}
|
|
476
|
+
case "text":
|
|
477
|
+
case "date": {
|
|
478
|
+
let t = r.value.trim().toLowerCase();
|
|
479
|
+
return (n) => String(j(n, e) ?? "").toLowerCase().includes(t);
|
|
480
|
+
}
|
|
481
|
+
case "custom": {
|
|
482
|
+
let t = String(r.value ?? "").trim().toLowerCase();
|
|
483
|
+
return (n) => String(j(n, e) ?? "").toLowerCase().includes(t);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}, re = (e, t, n, r) => {
|
|
487
|
+
let i = r.trim().toLowerCase();
|
|
488
|
+
if (!i) return t;
|
|
489
|
+
let a = t.length, o = n.length, s = new Int32Array(a), c = 0;
|
|
490
|
+
for (let r = 0; r < a; r += 1) {
|
|
491
|
+
let a = t[r], l = e[a], u = !1;
|
|
492
|
+
for (let e = 0; e < o; e += 1) {
|
|
493
|
+
let t = j(l, n[e]);
|
|
494
|
+
if (String(t ?? "").toLowerCase().includes(i)) {
|
|
495
|
+
u = !0;
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
u && (s[c] = a, c += 1);
|
|
500
|
+
}
|
|
501
|
+
return c === a ? t : s.slice(0, c);
|
|
502
|
+
}, ie = (e, t, n, r, i) => {
|
|
503
|
+
let a = [];
|
|
504
|
+
for (let e of n) {
|
|
505
|
+
let t = ne(e, r[e.key], i?.get(e.key));
|
|
506
|
+
t && a.push(t);
|
|
507
|
+
}
|
|
508
|
+
if (a.length === 0) return t;
|
|
509
|
+
let o = t.length, s = a.length, c = new Int32Array(o), l = 0;
|
|
510
|
+
for (let n = 0; n < o; n += 1) {
|
|
511
|
+
let r = t[n], i = e[r], o = !0;
|
|
512
|
+
for (let e = 0; e < s; e += 1) if (!a[e](i, r)) {
|
|
513
|
+
o = !1;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
o && (c[l] = r, l += 1);
|
|
517
|
+
}
|
|
518
|
+
return l === o ? t : c.slice(0, l);
|
|
519
|
+
}, ae = 240, R = 8, oe = 8, se = 260, ce = 400, le = ({ visibleColumns: e, columnFilterValues: n, enableColumnFilter: i, gridRootRef: o }) => {
|
|
520
|
+
let [l, u] = c(null), [d, f] = c(null), p = s(null), m = s(null), h = s(null), g = s(null), _ = l !== null, v = l?.columnKey ?? null, y = a(() => v ? e.find((e) => e.key === v) ?? null : null, [v, e]), b = t(() => {
|
|
521
|
+
if (!v || !m.current) {
|
|
522
|
+
f(null);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
let e = m.current.getBoundingClientRect(), t = y?.filterType === "set" ? ce : se, n = e.right - ae;
|
|
526
|
+
n = Math.max(R, n), n = Math.min(n, window.innerWidth - ae - R);
|
|
527
|
+
let r = e.bottom + oe;
|
|
528
|
+
r + t > window.innerHeight - R && (r = e.top - t - oe), r = Math.max(R, r), f((e) => e && e.top === r && e.left === n && e.width === ae ? e : {
|
|
529
|
+
top: r,
|
|
530
|
+
left: n,
|
|
531
|
+
width: ae
|
|
532
|
+
});
|
|
533
|
+
}, [v, y]), x = t((e, t) => {
|
|
534
|
+
t.preventDefault(), t.stopPropagation(), i && (document.activeElement instanceof HTMLElement && document.activeElement.blur(), o.current?.blur(), m.current = t.currentTarget, u({
|
|
535
|
+
columnKey: e.key,
|
|
536
|
+
draftValue: te(n[e.key])
|
|
537
|
+
}));
|
|
538
|
+
}, [
|
|
539
|
+
n,
|
|
540
|
+
i,
|
|
541
|
+
o
|
|
542
|
+
]), S = t(() => {
|
|
543
|
+
u(null), f(null), m.current = null, h.current = null, g.current = null, requestAnimationFrame(() => {
|
|
544
|
+
o.current?.focus();
|
|
545
|
+
});
|
|
546
|
+
}, [o]), C = t((e) => {
|
|
547
|
+
u((t) => t && {
|
|
548
|
+
...t,
|
|
549
|
+
draftValue: e
|
|
550
|
+
});
|
|
551
|
+
}, []);
|
|
552
|
+
return r(() => {
|
|
553
|
+
if (!v) return;
|
|
554
|
+
b();
|
|
555
|
+
let e = () => {
|
|
556
|
+
b();
|
|
557
|
+
};
|
|
558
|
+
return window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
559
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
560
|
+
};
|
|
561
|
+
}, [v, b]), r(() => {
|
|
562
|
+
if (!y || !d) return;
|
|
563
|
+
let e = y.filterType ?? "text", t = 0, n = 0;
|
|
564
|
+
return t = requestAnimationFrame(() => {
|
|
565
|
+
n = requestAnimationFrame(() => {
|
|
566
|
+
if (e === "select") {
|
|
567
|
+
g.current?.focus();
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
let t = h.current;
|
|
571
|
+
if (!t) return;
|
|
572
|
+
t.focus();
|
|
573
|
+
let n = t.value.length;
|
|
574
|
+
t.setSelectionRange(n, n);
|
|
575
|
+
});
|
|
576
|
+
}), () => {
|
|
577
|
+
cancelAnimationFrame(t), cancelAnimationFrame(n);
|
|
578
|
+
};
|
|
579
|
+
}, [
|
|
580
|
+
y,
|
|
581
|
+
d?.top,
|
|
582
|
+
d?.left,
|
|
583
|
+
d?.width
|
|
584
|
+
]), r(() => {
|
|
585
|
+
if (!_) return;
|
|
586
|
+
let e = (e) => {
|
|
587
|
+
let t = e.target;
|
|
588
|
+
t && (p.current?.contains(t) || m.current?.contains(t) || S());
|
|
589
|
+
};
|
|
590
|
+
return window.addEventListener("pointerdown", e), () => {
|
|
591
|
+
window.removeEventListener("pointerdown", e);
|
|
592
|
+
};
|
|
593
|
+
}, [S, _]), {
|
|
594
|
+
filterPopoverState: l,
|
|
595
|
+
filterPopoverLayout: d,
|
|
596
|
+
filterPopoverRef: p,
|
|
597
|
+
filterTextInputRef: h,
|
|
598
|
+
filterSelectRef: g,
|
|
599
|
+
isFilterPopoverOpen: _,
|
|
600
|
+
openedFilterColumn: y,
|
|
601
|
+
openColumnFilterPopover: x,
|
|
602
|
+
closeColumnFilterPopover: S,
|
|
603
|
+
updateFilterPopoverDraft: C
|
|
604
|
+
};
|
|
605
|
+
}, ue = (e, t, n) => Math.min(Math.max(e, t), n), de = (e, t) => {
|
|
606
|
+
let n = 0;
|
|
607
|
+
return e.map((e, r) => {
|
|
608
|
+
let i = t[e.key] ?? e.width, a = {
|
|
609
|
+
index: r,
|
|
610
|
+
column: e,
|
|
611
|
+
start: n,
|
|
612
|
+
size: i,
|
|
613
|
+
end: n + i
|
|
614
|
+
};
|
|
615
|
+
return n += i, a;
|
|
616
|
+
});
|
|
617
|
+
}, fe = (e) => e.pinned === "left" ? "left" : e.pinned === "right" ? "right" : "center", pe = (e) => {
|
|
618
|
+
let t = [], n = [], r = [];
|
|
619
|
+
for (let i of e) {
|
|
620
|
+
let e = fe(i);
|
|
621
|
+
e === "left" ? t.push(i) : e === "right" ? r.push(i) : n.push(i);
|
|
622
|
+
}
|
|
623
|
+
return [
|
|
624
|
+
...t,
|
|
625
|
+
...n,
|
|
626
|
+
...r
|
|
627
|
+
];
|
|
628
|
+
}, me = (e) => {
|
|
629
|
+
let t = {
|
|
630
|
+
left: [],
|
|
631
|
+
center: [],
|
|
632
|
+
right: []
|
|
633
|
+
};
|
|
634
|
+
return e.forEach((e, n) => {
|
|
635
|
+
t[fe(e)].push({
|
|
636
|
+
column: e,
|
|
637
|
+
logicalIndex: n
|
|
638
|
+
});
|
|
639
|
+
}), t;
|
|
640
|
+
}, he = (e, t) => e.map(({ column: e }) => t[e.key] ?? e.width), ge = (e, t) => he(e, t).join(","), _e = (e) => e === "" ? [] : e.split(",").map(Number), z = (e, t, n) => {
|
|
641
|
+
let r = 0;
|
|
642
|
+
return {
|
|
643
|
+
pane: e,
|
|
644
|
+
entries: t.map(({ column: e, logicalIndex: t }, i) => {
|
|
645
|
+
let a = n[i] ?? e.width, o = {
|
|
646
|
+
column: e,
|
|
647
|
+
logicalIndex: t,
|
|
648
|
+
paneLocalStart: r,
|
|
649
|
+
paneLocalSize: a,
|
|
650
|
+
paneLocalEnd: r + a
|
|
651
|
+
};
|
|
652
|
+
return r += a, o;
|
|
653
|
+
}),
|
|
654
|
+
totalWidth: r
|
|
655
|
+
};
|
|
656
|
+
}, ve = (e, t, n) => z(e, t, _e(n)), ye = (e, t) => {
|
|
657
|
+
let n = [
|
|
658
|
+
["left", e.left],
|
|
659
|
+
["center", e.center],
|
|
660
|
+
["right", e.right]
|
|
661
|
+
];
|
|
662
|
+
for (let [e, r] of n) {
|
|
663
|
+
let n = r.entries.find((e) => e.logicalIndex === t);
|
|
664
|
+
if (n) return {
|
|
665
|
+
pane: e,
|
|
666
|
+
entry: n
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
return null;
|
|
670
|
+
}, be = (e, t) => {
|
|
671
|
+
let { entries: n } = e;
|
|
672
|
+
if (n.length === 0) return -1;
|
|
673
|
+
if (t <= 0) return n[0].logicalIndex;
|
|
674
|
+
let r = 0, i = n.length - 1;
|
|
675
|
+
for (; r <= i;) {
|
|
676
|
+
let e = Math.floor((r + i) / 2), a = n[e];
|
|
677
|
+
if (t < a.paneLocalStart) {
|
|
678
|
+
i = e - 1;
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
if (t >= a.paneLocalEnd) {
|
|
682
|
+
r = e + 1;
|
|
683
|
+
continue;
|
|
684
|
+
}
|
|
685
|
+
return a.logicalIndex;
|
|
686
|
+
}
|
|
687
|
+
return n[Math.max(0, Math.min(r, n.length - 1))].logicalIndex;
|
|
688
|
+
}, xe = (e, t) => {
|
|
689
|
+
let { entries: n } = e;
|
|
690
|
+
for (let e = 0; e < n.length; e += 1) {
|
|
691
|
+
let r = n[e];
|
|
692
|
+
if (t < r.paneLocalStart + r.paneLocalSize / 2) return e;
|
|
693
|
+
}
|
|
694
|
+
return n.length;
|
|
695
|
+
}, Se = (e, t) => {
|
|
696
|
+
let { entries: n, totalWidth: r } = e;
|
|
697
|
+
return n.length === 0 ? 0 : t <= 0 ? n[0].paneLocalStart : t >= n.length ? r : n[t].paneLocalStart;
|
|
698
|
+
}, Ce = (e, t, n) => {
|
|
699
|
+
let r = Math.min(t, n), i = Math.max(t, n), a = Infinity, o = -Infinity, s = !1;
|
|
700
|
+
for (let t of e.entries) t.logicalIndex < r || t.logicalIndex > i || (s = !0, t.paneLocalStart < a && (a = t.paneLocalStart), t.paneLocalEnd > o && (o = t.paneLocalEnd));
|
|
701
|
+
return s ? {
|
|
702
|
+
start: a,
|
|
703
|
+
end: o,
|
|
704
|
+
width: o - a
|
|
705
|
+
} : null;
|
|
706
|
+
}, we = (e, t, n) => ({
|
|
707
|
+
left: Ce(e.left, t, n),
|
|
708
|
+
center: Ce(e.center, t, n),
|
|
709
|
+
right: Ce(e.right, t, n)
|
|
710
|
+
}), Te = (e) => {
|
|
711
|
+
let t = (e) => e.entries.length === 0 ? null : {
|
|
712
|
+
start: 0,
|
|
713
|
+
end: e.totalWidth,
|
|
714
|
+
width: e.totalWidth
|
|
715
|
+
};
|
|
716
|
+
return {
|
|
717
|
+
left: t(e.left),
|
|
718
|
+
center: t(e.center),
|
|
719
|
+
right: t(e.right)
|
|
720
|
+
};
|
|
721
|
+
}, Ee = (e, t) => {
|
|
722
|
+
let n = ye(e, t);
|
|
723
|
+
if (!n) return null;
|
|
724
|
+
let { pane: r, entry: i } = n;
|
|
725
|
+
return {
|
|
726
|
+
pane: r,
|
|
727
|
+
extent: {
|
|
728
|
+
start: i.paneLocalStart,
|
|
729
|
+
end: i.paneLocalEnd,
|
|
730
|
+
width: i.paneLocalSize
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
}, De = (e) => {
|
|
734
|
+
let t = e.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
735
|
+
return t ? t.split("\n").filter((e) => e.length > 0).map((e) => e.split(" ")) : [];
|
|
736
|
+
}, Oe = (e, t, n, r) => {
|
|
737
|
+
if (!r) return "";
|
|
738
|
+
let i = [];
|
|
739
|
+
if (r.type === "cell") {
|
|
740
|
+
let t = S(r.range);
|
|
741
|
+
for (let r = t.start.row; r <= t.end.row; r += 1) {
|
|
742
|
+
let a = e(r);
|
|
743
|
+
if (!a) continue;
|
|
744
|
+
let o = [];
|
|
745
|
+
for (let e = t.start.col; e <= t.end.col; e += 1) {
|
|
746
|
+
let t = n[e];
|
|
747
|
+
if (!t) continue;
|
|
748
|
+
let r = j(a, t), i = t.formatClipboardValue ? t.formatClipboardValue(r, a) : String(r ?? "");
|
|
749
|
+
o.push(i);
|
|
750
|
+
}
|
|
751
|
+
i.push(o.join(" "));
|
|
752
|
+
}
|
|
753
|
+
return i.join("\n");
|
|
754
|
+
}
|
|
755
|
+
if (r.type === "row") {
|
|
756
|
+
let t = C(r.startRow, r.endRow);
|
|
757
|
+
for (let r = t.startRow; r <= t.endRow; r += 1) {
|
|
758
|
+
let t = e(r);
|
|
759
|
+
if (!t) continue;
|
|
760
|
+
let a = n.map((e) => {
|
|
761
|
+
let n = j(t, e);
|
|
762
|
+
return e.formatClipboardValue ? e.formatClipboardValue(n, t) : String(n ?? "");
|
|
763
|
+
});
|
|
764
|
+
i.push(a.join(" "));
|
|
765
|
+
}
|
|
766
|
+
return i.join("\n");
|
|
767
|
+
}
|
|
768
|
+
let a = w(r.startCol, r.endCol);
|
|
769
|
+
for (let r = 0; r < t; r += 1) {
|
|
770
|
+
let t = e(r);
|
|
771
|
+
if (!t) continue;
|
|
772
|
+
let o = [];
|
|
773
|
+
for (let e = a.startCol; e <= a.endCol; e += 1) {
|
|
774
|
+
let r = n[e];
|
|
775
|
+
if (!r) continue;
|
|
776
|
+
let i = j(t, r), a = r.formatClipboardValue ? r.formatClipboardValue(i, t) : String(i ?? "");
|
|
777
|
+
o.push(a);
|
|
778
|
+
}
|
|
779
|
+
i.push(o.join(" "));
|
|
780
|
+
}
|
|
781
|
+
return i.join("\n");
|
|
782
|
+
}, ke = (e, t, n, r, i, a, o) => {
|
|
783
|
+
if (r.length === 0) return e;
|
|
784
|
+
let s = [...e];
|
|
785
|
+
for (let e = 0; e < r.length; e += 1) {
|
|
786
|
+
let c = t(i + e);
|
|
787
|
+
if (c === void 0) continue;
|
|
788
|
+
let l = s[c];
|
|
789
|
+
if (!l) continue;
|
|
790
|
+
let u = l, d = !1;
|
|
791
|
+
for (let t = 0; t < r[e].length; t += 1) {
|
|
792
|
+
let i = a + t, s = n[i];
|
|
793
|
+
if (!s || !o(c, i, l, s)) continue;
|
|
794
|
+
let f = r[e][t], p = s.parseClipboardValue ? s.parseClipboardValue(f, l) : f;
|
|
795
|
+
u = M(u, s, p), d = !0;
|
|
796
|
+
}
|
|
797
|
+
d && (s[c] = u);
|
|
798
|
+
}
|
|
799
|
+
return s;
|
|
800
|
+
}, Ae = ({ rows: e, rowModel: n, visibleColumns: r, uiState: i, readOnly: a, canEditCell: o, createRow: s, createOverflowColumn: c, onRowsChange: l, onColumnsChange: u, dispatch: d }) => {
|
|
801
|
+
let f = n.getRowCount(), p = f > 0 && r.length > 0 && i.selection?.type === "cell" && (() => {
|
|
802
|
+
let e = i.selection.range.start, t = i.selection.range.end, n = Math.min(e.row, t.row), a = Math.min(e.col, t.col), o = Math.max(e.row, t.row), s = Math.max(e.col, t.col);
|
|
803
|
+
return n === 0 && a === 0 && o === f - 1 && s === r.length - 1;
|
|
804
|
+
})(), m = t(() => {
|
|
805
|
+
let e = n.getRowCount();
|
|
806
|
+
if (e === 0 || r.length === 0) return "";
|
|
807
|
+
let t = [];
|
|
808
|
+
for (let i = 0; i < e; i += 1) {
|
|
809
|
+
let e = n.getRow(i);
|
|
810
|
+
if (!e) continue;
|
|
811
|
+
let a = r.map((t) => {
|
|
812
|
+
let n = j(e, t);
|
|
813
|
+
return t.formatClipboardValue ? t.formatClipboardValue(n, e) : String(n ?? "");
|
|
814
|
+
});
|
|
815
|
+
t.push(a.join(" "));
|
|
816
|
+
}
|
|
817
|
+
return t.join("\n");
|
|
818
|
+
}, [n, r]);
|
|
819
|
+
return {
|
|
820
|
+
isWholeGridSelected: p,
|
|
821
|
+
handleCopy: t(async () => {
|
|
822
|
+
let e = p ? m() : Oe(n.getRow, n.getRowCount(), r, i.selection);
|
|
823
|
+
e && navigator.clipboard?.writeText && await navigator.clipboard.writeText(e);
|
|
824
|
+
}, [
|
|
825
|
+
p,
|
|
826
|
+
n,
|
|
827
|
+
m,
|
|
828
|
+
i.selection,
|
|
829
|
+
r
|
|
830
|
+
]),
|
|
831
|
+
handlePaste: t((t) => {
|
|
832
|
+
if (!l || !i.activeCell) return;
|
|
833
|
+
let f = t.clipboardData.getData("text/plain");
|
|
834
|
+
if (!f) return;
|
|
835
|
+
t.preventDefault();
|
|
836
|
+
let p = De(f);
|
|
837
|
+
if (p.length === 0) return;
|
|
838
|
+
let m = i.activeCell.row, g = n.getSourceIndex(m);
|
|
839
|
+
if (g === void 0) return;
|
|
840
|
+
let _ = i.activeCell.col, v = [...e], y = [...r], b = n.getRowCount(), x = v.length, S = (e) => e < b ? n.getSourceIndex(e) : x + (e - b), C = g + p.length;
|
|
841
|
+
if (C > v.length && s) for (; v.length < C;) v.push(s());
|
|
842
|
+
let w = p.reduce((e, t) => Math.max(e, t.length), 0);
|
|
843
|
+
if (w === 0) return;
|
|
844
|
+
let T = _ + w;
|
|
845
|
+
if (T > y.length && u && c) {
|
|
846
|
+
for (; y.length < T;) y.push(c(y.length));
|
|
847
|
+
u(y);
|
|
848
|
+
}
|
|
849
|
+
let E = ke(v, S, y, p, m, _, (e, t, n, r) => A({
|
|
850
|
+
readOnly: a,
|
|
851
|
+
canEditCell: o
|
|
852
|
+
}, e, t, n, r)), D = ue(i.activeCell.row + Math.max(p.length - 1, 0), 0, Math.max(Math.max(n.getRowCount() - 1, 0), m + p.length - 1)), O = ue(i.activeCell.col + Math.max((p[0]?.length ?? 1) - 1, 0), 0, Math.max(Math.max(y.length - 1, 0), _ + w - 1));
|
|
853
|
+
l(E), d(h.startSelection(i.activeCell)), d(h.updateSelection({
|
|
854
|
+
row: D,
|
|
855
|
+
col: O
|
|
856
|
+
})), d(h.endSelection()), d(h.activateCell(i.activeCell));
|
|
857
|
+
}, [
|
|
858
|
+
o,
|
|
859
|
+
c,
|
|
860
|
+
s,
|
|
861
|
+
d,
|
|
862
|
+
u,
|
|
863
|
+
l,
|
|
864
|
+
a,
|
|
865
|
+
n,
|
|
866
|
+
e,
|
|
867
|
+
i.activeCell,
|
|
868
|
+
r
|
|
869
|
+
])
|
|
870
|
+
};
|
|
871
|
+
}, B = (e) => {
|
|
872
|
+
if (e < 0) return "";
|
|
873
|
+
let t = e, n = "";
|
|
874
|
+
for (; t >= 0;) n = String.fromCharCode(t % 26 + 65) + n, t = Math.floor(t / 26) - 1;
|
|
875
|
+
return n;
|
|
876
|
+
}, je = (e, t, n) => e ? e(t) : n, Me = (e, t = 16) => e.length <= t ? e : `${e.slice(0, t)}…`, Ne = (e) => e ? `${B(e.col)}${e.row + 1}` : "なし", Pe = (e) => {
|
|
877
|
+
if (!e) return "なし";
|
|
878
|
+
if (e.type === "cell") {
|
|
879
|
+
let t = Math.min(e.range.start.row, e.range.end.row), n = Math.max(e.range.start.row, e.range.end.row), r = Math.min(e.range.start.col, e.range.end.col), i = Math.max(e.range.start.col, e.range.end.col);
|
|
880
|
+
return `${B(r)}${t + 1} - ${B(i)}${n + 1}`;
|
|
881
|
+
}
|
|
882
|
+
if (e.type === "row") {
|
|
883
|
+
let t = Math.min(e.startRow, e.endRow), n = Math.max(e.startRow, e.endRow);
|
|
884
|
+
return `Row ${t + 1} - ${n + 1}`;
|
|
885
|
+
}
|
|
886
|
+
let t = Math.min(e.startCol, e.endCol), n = Math.max(e.startCol, e.endCol);
|
|
887
|
+
return `Col ${B(t)} - ${B(n)}`;
|
|
888
|
+
}, Fe = (e, t) => `Rows: ${t} / ${e.rows.length}`, Ie = (e) => `Columns: ${e.visibleColumns.length} / ${e.columns.length}`, Le = (e, t) => {
|
|
889
|
+
let n = e.selection;
|
|
890
|
+
if (!n) return {
|
|
891
|
+
selectedCellCount: 0,
|
|
892
|
+
selectedRowCount: 0,
|
|
893
|
+
selectedColumnCount: 0
|
|
894
|
+
};
|
|
895
|
+
if (n.type === "cell") {
|
|
896
|
+
let e = Math.min(n.range.start.row, n.range.end.row), t = Math.max(n.range.start.row, n.range.end.row), r = Math.min(n.range.start.col, n.range.end.col), i = Math.max(n.range.start.col, n.range.end.col), a = t - e + 1, o = i - r + 1;
|
|
897
|
+
return {
|
|
898
|
+
selectedCellCount: a * o,
|
|
899
|
+
selectedRowCount: a,
|
|
900
|
+
selectedColumnCount: o
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
if (n.type === "row") {
|
|
904
|
+
let t = Math.min(n.startRow, n.endRow), r = Math.max(n.startRow, n.endRow) - t + 1, i = e.visibleColumns.length;
|
|
905
|
+
return {
|
|
906
|
+
selectedCellCount: r * i,
|
|
907
|
+
selectedRowCount: r,
|
|
908
|
+
selectedColumnCount: i
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
let r = Math.min(n.startCol, n.endCol), i = Math.max(n.startCol, n.endCol) - r + 1, a = t;
|
|
912
|
+
return {
|
|
913
|
+
selectedCellCount: a * i,
|
|
914
|
+
selectedRowCount: a,
|
|
915
|
+
selectedColumnCount: i
|
|
916
|
+
};
|
|
917
|
+
}, Re = (e, t) => {
|
|
918
|
+
let n = Le(e, t);
|
|
919
|
+
return `Cells: ${n.selectedCellCount} / Rows: ${n.selectedRowCount}`;
|
|
920
|
+
}, ze = (e) => Object.values(e).filter((e) => F(e)).length, Be = (e) => {
|
|
921
|
+
let t = e.globalFilterText.trim().length > 0, n = t ? Me(e.globalFilterText.trim()) : null, r = ze(e.columnFilterValues);
|
|
922
|
+
return !t && r === 0 ? "Filter: なし" : t && r === 0 ? `Filter: Global("${n}")` : !t && r > 0 ? `Filter: ${r}列` : `Filter: Global("${n}") + ${r}列`;
|
|
923
|
+
}, Ve = (e, t) => {
|
|
924
|
+
let n = e.find((e) => e.key === t);
|
|
925
|
+
return n?.title || n?.key || t;
|
|
926
|
+
}, He = (e) => e.sortState.length === 0 ? "Sort: なし" : `Sort: ${e.sortState.map((t) => `${Ve(e.columns, t.columnKey)} (${t.direction === "asc" ? "昇順" : "降順"})`).join(", ")}`, Ue = (e, t) => {
|
|
927
|
+
let n = Le(e, t), r = e.globalFilterText.trim().length > 0, i = r ? Me(e.globalFilterText.trim()) : null, a = ze(e.columnFilterValues), o = r || a > 0, s = e.sortState.length > 0, c = s ? Ve(e.columns, e.sortState[0].columnKey) : null;
|
|
928
|
+
return {
|
|
929
|
+
rowSummaryText: Fe(e, t),
|
|
930
|
+
columnSummaryText: Ie(e),
|
|
931
|
+
filterSummaryText: Be(e),
|
|
932
|
+
sortSummaryText: He(e),
|
|
933
|
+
activeCellLabel: Ne(e.activeCell),
|
|
934
|
+
selectionLabel: Pe(e.selection),
|
|
935
|
+
selectionStatsText: Re(e, t),
|
|
936
|
+
selectionStats: n,
|
|
937
|
+
hasGlobalFilter: r,
|
|
938
|
+
globalFilterPreview: i,
|
|
939
|
+
activeColumnFilterCount: a,
|
|
940
|
+
hasAnyFilter: o,
|
|
941
|
+
hasSorting: s,
|
|
942
|
+
sortedColumnLabel: c
|
|
943
|
+
};
|
|
944
|
+
}, We = ({ rows: e, viewRowCount: t, getFilteredRows: n, columns: r, visibleColumns: i, uiState: o, setGlobalFilterText: s }) => {
|
|
945
|
+
let c = T(o), l = o.filters.columnFilters, u = o.sort, d = o.activeCell, f = o.selection, p = a(() => ({
|
|
946
|
+
rows: e,
|
|
947
|
+
columns: r,
|
|
948
|
+
visibleColumns: i,
|
|
949
|
+
globalFilterText: c,
|
|
950
|
+
columnFilterValues: l,
|
|
951
|
+
sortState: u,
|
|
952
|
+
activeCell: d,
|
|
953
|
+
selection: f
|
|
954
|
+
}), [
|
|
955
|
+
e,
|
|
956
|
+
r,
|
|
957
|
+
i,
|
|
958
|
+
c,
|
|
959
|
+
l,
|
|
960
|
+
u,
|
|
961
|
+
d,
|
|
962
|
+
f
|
|
963
|
+
]), m = a(() => Ue(p, t), [p, t]);
|
|
964
|
+
return {
|
|
965
|
+
slotContextBase: p,
|
|
966
|
+
derivedSummary: m,
|
|
967
|
+
slotContext: a(() => ({
|
|
968
|
+
...p,
|
|
969
|
+
get filteredRows() {
|
|
970
|
+
return n();
|
|
971
|
+
},
|
|
972
|
+
setGlobalFilterText: s,
|
|
973
|
+
derivedSummary: m
|
|
974
|
+
}), [
|
|
975
|
+
m,
|
|
976
|
+
n,
|
|
977
|
+
s,
|
|
978
|
+
p
|
|
979
|
+
])
|
|
980
|
+
};
|
|
981
|
+
}, Ge = ({ uiState: e, rows: n, visibleColumns: r, rowModel: i, setEditorInitialValue: a, onRowsChange: o, dispatch: s, getMovedCell: c, gridRootRef: l, editorActionGuardRef: u }) => {
|
|
982
|
+
let d = t((e) => {
|
|
983
|
+
s(h.startSelection(e)), s(h.endSelection()), s(h.activateCell(e));
|
|
984
|
+
}, [s]);
|
|
985
|
+
return {
|
|
986
|
+
activateSingleCell: d,
|
|
987
|
+
startEditWithValue: t((e, t) => {
|
|
988
|
+
a(t), s(h.startEdit(e));
|
|
989
|
+
}, [s, a]),
|
|
990
|
+
commitEdit: t((t, a) => {
|
|
991
|
+
if (u.current || !e.editingCell) return;
|
|
992
|
+
let f = e.editingCell, p = a === "down" ? c(f, 1, 0) : a === "right" ? c(f, 0, 1) : a === "left" ? c(f, 0, -1) : f, m = r[f.col], g = i.getSourceIndex(f.row), _ = n[g];
|
|
993
|
+
if (!m || !_) {
|
|
994
|
+
s(h.stopEdit());
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
if (o) {
|
|
998
|
+
let e = m.parseClipboardValue ? m.parseClipboardValue(t, _) : t;
|
|
999
|
+
o(n.map((t, n) => n === g ? M(t, m, e) : t));
|
|
1000
|
+
}
|
|
1001
|
+
u.current = !0, requestAnimationFrame(() => {
|
|
1002
|
+
l.current?.focus(), d(p), u.current = !1;
|
|
1003
|
+
}), s(h.stopEdit());
|
|
1004
|
+
}, [
|
|
1005
|
+
d,
|
|
1006
|
+
s,
|
|
1007
|
+
u,
|
|
1008
|
+
i,
|
|
1009
|
+
c,
|
|
1010
|
+
l,
|
|
1011
|
+
o,
|
|
1012
|
+
n,
|
|
1013
|
+
e.editingCell,
|
|
1014
|
+
r
|
|
1015
|
+
]),
|
|
1016
|
+
cancelEdit: t(() => {
|
|
1017
|
+
u.current || (u.current = !0, s(h.stopEdit()), requestAnimationFrame(() => {
|
|
1018
|
+
l.current?.focus(), u.current = !1;
|
|
1019
|
+
}));
|
|
1020
|
+
}, [
|
|
1021
|
+
s,
|
|
1022
|
+
u,
|
|
1023
|
+
l
|
|
1024
|
+
])
|
|
1025
|
+
};
|
|
1026
|
+
}, Ke = (e) => e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey, qe = (e) => e instanceof HTMLElement ? e.closest("input, textarea, select, button, [contenteditable=\"true\"]") !== null : !1, Je = ({ uiState: e, rowModel: n, visibleColumns: r, readOnly: i, canEditCell: a, setEditorInitialValue: o, dispatch: s, handleCopy: c, handleCellDoubleClick: l, isWholeGridSelected: u, selectEntireGrid: d }) => {
|
|
1027
|
+
let f = n.getRowCount(), p = t((e, t, n) => ({
|
|
1028
|
+
row: ue(e.row + t, 0, Math.max(f - 1, 0)),
|
|
1029
|
+
col: ue(e.col + n, 0, Math.max(r.length - 1, 0))
|
|
1030
|
+
}), [f, r.length]), m = t((t, n, i) => {
|
|
1031
|
+
if (f === 0 || r.length === 0) return;
|
|
1032
|
+
let a = e.activeCell ?? {
|
|
1033
|
+
row: 0,
|
|
1034
|
+
col: 0
|
|
1035
|
+
}, o = {
|
|
1036
|
+
row: ue(a.row + t, 0, f - 1),
|
|
1037
|
+
col: ue(a.col + n, 0, r.length - 1)
|
|
1038
|
+
};
|
|
1039
|
+
if (i) {
|
|
1040
|
+
let t = e.selection?.type === "cell" ? e.selection.range.start : a;
|
|
1041
|
+
s(h.startSelection(t)), s(h.updateSelection(o)), s(h.endSelection()), s(h.activateCell(o));
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
s(h.startSelection(o)), s(h.endSelection()), s(h.activateCell(o));
|
|
1045
|
+
}, [
|
|
1046
|
+
s,
|
|
1047
|
+
f,
|
|
1048
|
+
e.activeCell,
|
|
1049
|
+
e.selection,
|
|
1050
|
+
r.length
|
|
1051
|
+
]);
|
|
1052
|
+
return {
|
|
1053
|
+
getMovedCell: p,
|
|
1054
|
+
handleKeyDown: t(async (t) => {
|
|
1055
|
+
if (!qe(t.target) && !e.editingCell) {
|
|
1056
|
+
if ((t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "c") {
|
|
1057
|
+
t.preventDefault(), await c();
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
if ((t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "a") {
|
|
1061
|
+
if (t.preventDefault(), u) {
|
|
1062
|
+
s(h.clearSelection()), s(h.activateCell(null));
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
d();
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
if (t.key === "ArrowUp") {
|
|
1069
|
+
t.preventDefault(), m(-1, 0, t.shiftKey);
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
if (t.key === "ArrowDown") {
|
|
1073
|
+
t.preventDefault(), m(1, 0, t.shiftKey);
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
if (t.key === "ArrowLeft") {
|
|
1077
|
+
t.preventDefault(), m(0, -1, t.shiftKey);
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
if (t.key === "ArrowRight") {
|
|
1081
|
+
t.preventDefault(), m(0, 1, t.shiftKey);
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
if (t.key === "Tab") {
|
|
1085
|
+
t.preventDefault(), m(0, t.shiftKey ? -1 : 1, !1);
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
if (t.key === "Escape") {
|
|
1089
|
+
t.preventDefault(), s(h.clearSelection());
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
if (t.key === "Enter" || t.key === "F2") {
|
|
1093
|
+
t.preventDefault(), e.activeCell && l(e.activeCell);
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
if (Ke(t) && e.activeCell) {
|
|
1097
|
+
let c = n.getRow(e.activeCell.row), l = r[e.activeCell.col];
|
|
1098
|
+
if (!c || !l || !A({
|
|
1099
|
+
readOnly: i,
|
|
1100
|
+
canEditCell: a
|
|
1101
|
+
}, e.activeCell.row, e.activeCell.col, c, l)) return;
|
|
1102
|
+
t.preventDefault(), o(t.key), s(h.startEdit(e.activeCell));
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}, [
|
|
1106
|
+
a,
|
|
1107
|
+
s,
|
|
1108
|
+
n,
|
|
1109
|
+
l,
|
|
1110
|
+
c,
|
|
1111
|
+
u,
|
|
1112
|
+
m,
|
|
1113
|
+
i,
|
|
1114
|
+
d,
|
|
1115
|
+
o,
|
|
1116
|
+
e.activeCell,
|
|
1117
|
+
e.editingCell,
|
|
1118
|
+
r
|
|
1119
|
+
])
|
|
1120
|
+
};
|
|
1121
|
+
}, Ye = new Intl.Collator("ja", {
|
|
1122
|
+
numeric: !0,
|
|
1123
|
+
sensitivity: "base"
|
|
1124
|
+
}), Xe = (e, t) => {
|
|
1125
|
+
let n = Number(e), r = Number(t);
|
|
1126
|
+
return Number.isFinite(n) && Number.isFinite(r) ? n - r : Ye.compare(String(e ?? ""), String(t ?? ""));
|
|
1127
|
+
}, Ze = (e, t, n, r) => {
|
|
1128
|
+
if (!r) return e.length === 1 && e[0].columnKey === t && e[0].direction === n ? [] : [{
|
|
1129
|
+
columnKey: t,
|
|
1130
|
+
direction: n
|
|
1131
|
+
}];
|
|
1132
|
+
let i = e.findIndex((e) => e.columnKey === t);
|
|
1133
|
+
return i === -1 ? [...e, {
|
|
1134
|
+
columnKey: t,
|
|
1135
|
+
direction: n
|
|
1136
|
+
}] : e[i].direction === n ? e.filter((e, t) => t !== i) : e.map((e, r) => r === i ? {
|
|
1137
|
+
columnKey: t,
|
|
1138
|
+
direction: n
|
|
1139
|
+
} : e);
|
|
1140
|
+
}, Qe = (e, t, n) => e.some((e) => e.columnKey === t) ? e : [...e, {
|
|
1141
|
+
columnKey: t,
|
|
1142
|
+
direction: n
|
|
1143
|
+
}], $e = (e, t, n) => t < 0 || t >= e.length || e[t].direction === n ? e : e.map((e, r) => r === t ? {
|
|
1144
|
+
...e,
|
|
1145
|
+
direction: n
|
|
1146
|
+
} : e), et = (e, t, n) => t < 0 || t >= e.length || e[t].columnKey === n ? e : e.map((e, r) => r === t ? {
|
|
1147
|
+
...e,
|
|
1148
|
+
columnKey: n
|
|
1149
|
+
} : e).filter((e, r) => r === t || e.columnKey !== n), tt = (e, t) => t < 0 || t >= e.length ? e : e.filter((e, n) => n !== t), nt = (e, t, n) => {
|
|
1150
|
+
if (t < 0 || t >= e.length || n < 0 || n >= e.length || t === n) return e;
|
|
1151
|
+
let r = [...e], [i] = r.splice(t, 1);
|
|
1152
|
+
return r.splice(n, 0, i), r;
|
|
1153
|
+
}, rt = (e, t, n, r) => {
|
|
1154
|
+
if (r.length === 0) return t;
|
|
1155
|
+
let i = r.map((e) => {
|
|
1156
|
+
let t = n.find((t) => t.key === e.columnKey);
|
|
1157
|
+
return t ? {
|
|
1158
|
+
column: t,
|
|
1159
|
+
multiplier: e.direction === "asc" ? 1 : -1
|
|
1160
|
+
} : null;
|
|
1161
|
+
}).filter((e) => e !== null);
|
|
1162
|
+
if (i.length === 0) return t;
|
|
1163
|
+
let a = t.length, o = i.length, s = i.map((e) => e.multiplier), c = Array(o), l = !0;
|
|
1164
|
+
for (let n = 0; n < o; n += 1) {
|
|
1165
|
+
let r = i[n].column, o = new Float64Array(a), s = !0;
|
|
1166
|
+
for (let n = 0; n < a; n += 1) {
|
|
1167
|
+
let i = Number(j(e[t[n]], r));
|
|
1168
|
+
if (!Number.isFinite(i)) {
|
|
1169
|
+
s = !1;
|
|
1170
|
+
break;
|
|
1171
|
+
}
|
|
1172
|
+
o[n] = i;
|
|
1173
|
+
}
|
|
1174
|
+
if (!s) {
|
|
1175
|
+
l = !1;
|
|
1176
|
+
break;
|
|
1177
|
+
}
|
|
1178
|
+
c[n] = o;
|
|
1179
|
+
}
|
|
1180
|
+
let u = Array(a);
|
|
1181
|
+
for (let e = 0; e < a; e += 1) u[e] = e;
|
|
1182
|
+
if (l) if (o === 1) {
|
|
1183
|
+
let e = c[0], n = s[0];
|
|
1184
|
+
u.sort((r, i) => {
|
|
1185
|
+
let a = e[r] - e[i];
|
|
1186
|
+
return a === 0 ? t[r] - t[i] : a * n;
|
|
1187
|
+
});
|
|
1188
|
+
} else u.sort((e, n) => {
|
|
1189
|
+
for (let t = 0; t < o; t += 1) {
|
|
1190
|
+
let r = c[t][e] - c[t][n];
|
|
1191
|
+
if (r !== 0) return r * s[t];
|
|
1192
|
+
}
|
|
1193
|
+
return t[e] - t[n];
|
|
1194
|
+
});
|
|
1195
|
+
else {
|
|
1196
|
+
let n = i.map(({ column: n }) => {
|
|
1197
|
+
let r = Array(a);
|
|
1198
|
+
for (let i = 0; i < a; i += 1) r[i] = j(e[t[i]], n);
|
|
1199
|
+
return r;
|
|
1200
|
+
});
|
|
1201
|
+
u.sort((e, r) => {
|
|
1202
|
+
for (let t = 0; t < o; t += 1) {
|
|
1203
|
+
let i = Xe(n[t][e], n[t][r]);
|
|
1204
|
+
if (i !== 0) return i * s[t];
|
|
1205
|
+
}
|
|
1206
|
+
return t[e] - t[r];
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
let d = new Int32Array(a);
|
|
1210
|
+
for (let e = 0; e < a; e += 1) d[e] = t[u[e]];
|
|
1211
|
+
return d;
|
|
1212
|
+
}, it = 15e6, at = (e, t, n, r) => e && t && n > 0 && n <= r, ot = 1 << 20, st = (e, t) => ({
|
|
1213
|
+
rowCount: e,
|
|
1214
|
+
rowTop: (e) => e * t,
|
|
1215
|
+
rowsHeight: (e, n) => (n - e + 1) * t,
|
|
1216
|
+
totalBodyHeight: e * t,
|
|
1217
|
+
rowAtContentY: (n) => Math.min(Math.max(Math.floor(n / t), 0), Math.max(e - 1, 0))
|
|
1218
|
+
}), ct = (e, t, n, r) => {
|
|
1219
|
+
if (r < n) return null;
|
|
1220
|
+
let i = Math.max(e, n), a = Math.min(t, r);
|
|
1221
|
+
return i > a ? null : {
|
|
1222
|
+
start: i,
|
|
1223
|
+
end: a
|
|
1224
|
+
};
|
|
1225
|
+
}, V = (e, t) => e * t, H = (e, t) => t === 1 ? e : e / t, lt = (e, t, n, r) => {
|
|
1226
|
+
let i = t * (1 - n);
|
|
1227
|
+
return r.rowAtContentY(e - i);
|
|
1228
|
+
}, ut = ({ rowCount: e, rowHeight: t, headerHeight: n, viewportHeight: r, scrollTop: i, overscan: a, maxBodyPx: o }) => {
|
|
1229
|
+
let s = e * t, c = Math.min(s, o), l = Math.max(n + s - r, 0), u = Math.max(n + c - r, 0), d = u > 0 && s > c ? l / u : 1, f = Math.min(Math.max(i, 0), u), p = f * d, m = Math.ceil(r / t) + 1, h = Math.floor(p / t), g = Math.max(h - a, 0), _ = Math.min(h + m + a, e), v = d === 1 ? 0 : Math.floor(g * t / ot) * ot, y = f - p + v, b = [], x = /* @__PURE__ */ new Set();
|
|
1230
|
+
for (let e = g; e < _; e += 1) b.push({
|
|
1231
|
+
index: e,
|
|
1232
|
+
start: n + e * t - v
|
|
1233
|
+
}), x.add(e);
|
|
1234
|
+
return {
|
|
1235
|
+
physicalBodyHeight: c,
|
|
1236
|
+
logicalBodyHeight: s,
|
|
1237
|
+
scaleFactor: d,
|
|
1238
|
+
translateY: y,
|
|
1239
|
+
windowBaseOffsetPx: v,
|
|
1240
|
+
rows: b,
|
|
1241
|
+
rowIndexSet: x
|
|
1242
|
+
};
|
|
1243
|
+
}, dt = ({ headerHeight: e, viewportHeight: t, scrollTop: n, overscan: r }, i) => {
|
|
1244
|
+
let a = i.rowCount, o = i.totalBodyHeight, s = o, c = Math.max(e + o - t, 0), l = Math.min(Math.max(n, 0), c), u = i.rowAtContentY(l), d = i.rowAtContentY(l + t), f = Math.max(u - r, 0), p = Math.min(d + r + 1, a), m = [], h = /* @__PURE__ */ new Set();
|
|
1245
|
+
for (let t = f; t < p; t += 1) m.push({
|
|
1246
|
+
index: t,
|
|
1247
|
+
start: e + i.rowTop(t),
|
|
1248
|
+
size: i.rowsHeight(t, t)
|
|
1249
|
+
}), h.add(t);
|
|
1250
|
+
return {
|
|
1251
|
+
physicalBodyHeight: s,
|
|
1252
|
+
logicalBodyHeight: o,
|
|
1253
|
+
scaleFactor: 1,
|
|
1254
|
+
translateY: 0,
|
|
1255
|
+
windowBaseOffsetPx: 0,
|
|
1256
|
+
rows: m,
|
|
1257
|
+
rowIndexSet: h
|
|
1258
|
+
};
|
|
1259
|
+
}, ft = ({ gridRootRef: e, bodyScrollRef: n, scrollContainerRef: i, leftPaneScrollRef: a, rightPaneScrollRef: o, pointerClientRef: c, autoScrollFrameRef: l, uiState: u, dispatch: d, enableRangeSelection: f, enableSorting: p, orderedColumns: m, filteredRowsLength: g, visibleColumnsLength: _, paneLayout: v, leftLeadingWidth: y, centerLeadingWidth: b, rightLeadingWidth: x, headerHeight: S, rowMetrics: C, verticalScaleFactor: w, setHoveredRowIndex: T, setHoveredColumnIndex: E, enableRowHover: D, enableColumnHeaderHover: O }) => {
|
|
1260
|
+
let k = s(u.dragState);
|
|
1261
|
+
k.current = u.dragState;
|
|
1262
|
+
let A = s(u.sort);
|
|
1263
|
+
A.current = u.sort;
|
|
1264
|
+
let j = s(m);
|
|
1265
|
+
j.current = m;
|
|
1266
|
+
let M = s(p);
|
|
1267
|
+
M.current = p;
|
|
1268
|
+
let N = u.dragState?.type ?? null, P = t((e, t) => {
|
|
1269
|
+
let r = n.current;
|
|
1270
|
+
if (!r || g === 0 || _ === 0) return null;
|
|
1271
|
+
let s = r.getBoundingClientRect(), c = lt(r.scrollTop + t - s.top - S, i.current?.scrollTop ?? 0, w, C), l = null, u = a.current;
|
|
1272
|
+
if (l === null && u && v.left.entries.length > 0) {
|
|
1273
|
+
let t = u.getBoundingClientRect();
|
|
1274
|
+
if (e < t.right) {
|
|
1275
|
+
let n = e - t.left - y;
|
|
1276
|
+
l = be(v.left, n);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
let d = o.current;
|
|
1280
|
+
if (l === null && d && v.right.entries.length > 0) {
|
|
1281
|
+
let t = d.getBoundingClientRect();
|
|
1282
|
+
if (e >= t.left) {
|
|
1283
|
+
let n = e - t.left - x;
|
|
1284
|
+
l = be(v.right, n);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
if (l === null && v.center.entries.length > 0) {
|
|
1288
|
+
let t = r.scrollLeft + e - s.left - b;
|
|
1289
|
+
l = be(v.center, Math.max(t, 0));
|
|
1290
|
+
}
|
|
1291
|
+
return l === null ? null : {
|
|
1292
|
+
row: c,
|
|
1293
|
+
col: ue(l, 0, _ - 1)
|
|
1294
|
+
};
|
|
1295
|
+
}, [
|
|
1296
|
+
n,
|
|
1297
|
+
a,
|
|
1298
|
+
o,
|
|
1299
|
+
i,
|
|
1300
|
+
g,
|
|
1301
|
+
_,
|
|
1302
|
+
v,
|
|
1303
|
+
y,
|
|
1304
|
+
b,
|
|
1305
|
+
x,
|
|
1306
|
+
S,
|
|
1307
|
+
C,
|
|
1308
|
+
w
|
|
1309
|
+
]), F = t((e, t) => {
|
|
1310
|
+
let n = k.current;
|
|
1311
|
+
if (!n || n.type !== "selection") return;
|
|
1312
|
+
let r = P(e, t);
|
|
1313
|
+
if (r) {
|
|
1314
|
+
if (n.selectionKind === "cell") {
|
|
1315
|
+
d(h.updateSelection(r));
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
if (n.selectionKind === "row") {
|
|
1319
|
+
d(h.updateRowSelection(r.row));
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
n.selectionKind === "col" && d(h.updateColumnSelection(r.col));
|
|
1323
|
+
}
|
|
1324
|
+
}, [d, P]);
|
|
1325
|
+
return r(() => {
|
|
1326
|
+
let e = (e) => {
|
|
1327
|
+
c.current = {
|
|
1328
|
+
x: e.clientX,
|
|
1329
|
+
y: e.clientY
|
|
1330
|
+
}, N === "columnResize" && d(h.updateColumnResize(e.clientX));
|
|
1331
|
+
}, t = () => {
|
|
1332
|
+
d(h.endSelection()), d(h.endColumnResize());
|
|
1333
|
+
};
|
|
1334
|
+
return window.addEventListener("pointermove", e), window.addEventListener("pointerup", t), () => {
|
|
1335
|
+
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", t);
|
|
1336
|
+
};
|
|
1337
|
+
}, [
|
|
1338
|
+
d,
|
|
1339
|
+
c,
|
|
1340
|
+
N
|
|
1341
|
+
]), r(() => {
|
|
1342
|
+
if (N !== "selection") {
|
|
1343
|
+
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
let e = () => {
|
|
1347
|
+
let t = i.current, n = c.current;
|
|
1348
|
+
if (!t || !n) {
|
|
1349
|
+
l.current = requestAnimationFrame(e);
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
let r = t.getBoundingClientRect(), a = t.scrollTop, o = t.scrollLeft, s = k.current?.type === "selection" && k.current.selectionKind === "col", u = k.current?.type === "selection" && k.current.selectionKind === "row";
|
|
1353
|
+
s || (n.y < r.top + 24 ? a = Math.max(t.scrollTop - 18, 0) : n.y > r.bottom - 24 && (a = t.scrollTop + 18)), u || (n.x < r.left + 24 ? o = Math.max(t.scrollLeft - 18, 0) : n.x > r.right - 24 && (o = t.scrollLeft + 18)), (a !== t.scrollTop || o !== t.scrollLeft) && (t.scrollTo({
|
|
1354
|
+
top: a,
|
|
1355
|
+
left: o,
|
|
1356
|
+
behavior: "auto"
|
|
1357
|
+
}), F(n.x, n.y)), l.current = requestAnimationFrame(e);
|
|
1358
|
+
};
|
|
1359
|
+
return l.current = requestAnimationFrame(e), () => {
|
|
1360
|
+
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
1361
|
+
};
|
|
1362
|
+
}, [
|
|
1363
|
+
l,
|
|
1364
|
+
i,
|
|
1365
|
+
c,
|
|
1366
|
+
N,
|
|
1367
|
+
F
|
|
1368
|
+
]), {
|
|
1369
|
+
updateSelectionFromPointer: F,
|
|
1370
|
+
handleCellPointerDown: t((t, n) => {
|
|
1371
|
+
n.preventDefault(), n.button === 0 && (e.current?.focus(), d(h.activateCell(t)), f && d(h.startSelection(t)));
|
|
1372
|
+
}, [
|
|
1373
|
+
d,
|
|
1374
|
+
f,
|
|
1375
|
+
e
|
|
1376
|
+
]),
|
|
1377
|
+
handleCellPointerEnter: t((e, t) => {
|
|
1378
|
+
if (D && T(e.row), !f) return;
|
|
1379
|
+
let n = k.current;
|
|
1380
|
+
n?.type !== "selection" || n.selectionKind !== "cell" || (c.current = {
|
|
1381
|
+
x: t.clientX,
|
|
1382
|
+
y: t.clientY
|
|
1383
|
+
}, d(h.updateSelection(e)));
|
|
1384
|
+
}, [
|
|
1385
|
+
d,
|
|
1386
|
+
f,
|
|
1387
|
+
c,
|
|
1388
|
+
T,
|
|
1389
|
+
D
|
|
1390
|
+
]),
|
|
1391
|
+
handleNativeDragStart: t((e) => {
|
|
1392
|
+
e.preventDefault();
|
|
1393
|
+
}, []),
|
|
1394
|
+
handleRowHeaderPointerDown: t((t, n) => {
|
|
1395
|
+
n.preventDefault(), n.button === 0 && (e.current?.focus(), d(h.startRowSelection(t)));
|
|
1396
|
+
}, [d, e]),
|
|
1397
|
+
handleRowHeaderPointerEnter: t((e, t) => {
|
|
1398
|
+
D && T(e);
|
|
1399
|
+
let n = k.current;
|
|
1400
|
+
n?.type !== "selection" || n.selectionKind !== "row" || (c.current = {
|
|
1401
|
+
x: t.clientX,
|
|
1402
|
+
y: t.clientY
|
|
1403
|
+
}, d(h.updateRowSelection(e)));
|
|
1404
|
+
}, [
|
|
1405
|
+
d,
|
|
1406
|
+
c,
|
|
1407
|
+
T,
|
|
1408
|
+
D
|
|
1409
|
+
]),
|
|
1410
|
+
handleColumnHeaderPointerDown: t((t, n) => {
|
|
1411
|
+
if (n.preventDefault(), n.button === 0) {
|
|
1412
|
+
if (e.current?.focus(), n.shiftKey && M.current) {
|
|
1413
|
+
let e = j.current[t];
|
|
1414
|
+
if (e) {
|
|
1415
|
+
let t = A.current, n = t.find((t) => t.columnKey === e.key)?.direction ? "desc" : "asc", r = Ze(t, e.key, n, !0);
|
|
1416
|
+
d(r.length === 0 ? h.clearSort() : h.setSort(r));
|
|
1417
|
+
}
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
d(h.startColumnSelection(t));
|
|
1421
|
+
}
|
|
1422
|
+
}, [d, e]),
|
|
1423
|
+
handleColumnHeaderPointerEnter: t((e, t) => {
|
|
1424
|
+
T(null), O && E(e);
|
|
1425
|
+
let n = k.current;
|
|
1426
|
+
n?.type !== "selection" || n.selectionKind !== "col" || (c.current = {
|
|
1427
|
+
x: t.clientX,
|
|
1428
|
+
y: t.clientY
|
|
1429
|
+
}, d(h.updateColumnSelection(e)));
|
|
1430
|
+
}, [
|
|
1431
|
+
d,
|
|
1432
|
+
c,
|
|
1433
|
+
T,
|
|
1434
|
+
E,
|
|
1435
|
+
O
|
|
1436
|
+
])
|
|
1437
|
+
};
|
|
1438
|
+
}, pt = ({ scrollRef: e, columnVirtualizer: t, columnMeasurements: n, totalScrollWidth: i, physicalBodyHeight: a, headerHeight: o, leftPaneWidth: s, rightPaneWidth: c, centerLeadingWidth: l, activeCellRect: u, verticalScaleFactor: d }) => {
|
|
1439
|
+
r(() => {
|
|
1440
|
+
t.measure();
|
|
1441
|
+
}, [t, n]), r(() => {
|
|
1442
|
+
if (!e.current) return;
|
|
1443
|
+
let t = e.current, n = Math.max(i - t.clientWidth, 0), r = Math.max(o + a - t.clientHeight, 0);
|
|
1444
|
+
t.scrollLeft > n && (t.scrollLeft = n), t.scrollTop > r && (t.scrollTop = r);
|
|
1445
|
+
}, [
|
|
1446
|
+
e,
|
|
1447
|
+
i,
|
|
1448
|
+
a,
|
|
1449
|
+
o
|
|
1450
|
+
]), r(() => {
|
|
1451
|
+
if (!e.current || !u) return;
|
|
1452
|
+
let t = e.current, n = o + u.top, r = n + u.height, i = s + l + u.left, a = i + u.width, f = V(t.scrollTop, d), p = t.scrollLeft, m = t.clientHeight, h = t.clientWidth, g = f, _ = p, v = f + o, y = f + m;
|
|
1453
|
+
n < v ? g = Math.max(n - o, 0) : r > y && (g = Math.max(r - m, 0));
|
|
1454
|
+
let b = p + s, x = p + h - c;
|
|
1455
|
+
i < b ? _ = Math.max(i - s, 0) : a > x && (_ = Math.max(a - h + c, 0)), (g !== f || _ !== p) && t.scrollTo({
|
|
1456
|
+
top: H(g, d),
|
|
1457
|
+
left: _,
|
|
1458
|
+
behavior: "auto"
|
|
1459
|
+
});
|
|
1460
|
+
}, [
|
|
1461
|
+
e,
|
|
1462
|
+
u,
|
|
1463
|
+
o,
|
|
1464
|
+
s,
|
|
1465
|
+
c,
|
|
1466
|
+
l,
|
|
1467
|
+
d
|
|
1468
|
+
]);
|
|
1469
|
+
};
|
|
1470
|
+
//#endregion
|
|
1471
|
+
//#region src/components/spreadsheet-grid/hooks/useColumnHeaderDragController.ts
|
|
1472
|
+
function U(e, t, n, r) {
|
|
1473
|
+
let i = e.find((e) => e.key === t);
|
|
1474
|
+
if (!i) return null;
|
|
1475
|
+
let a = fe(i), o = {
|
|
1476
|
+
left: [],
|
|
1477
|
+
center: [],
|
|
1478
|
+
right: []
|
|
1479
|
+
}, s = /* @__PURE__ */ new Map();
|
|
1480
|
+
for (let t of e) o[fe(t)].push(t.key), s.set(t.key, t.visible !== !1);
|
|
1481
|
+
let c = o[n].filter((e) => s.get(e)).indexOf(t), l = o[a].indexOf(t);
|
|
1482
|
+
if (l < 0) return null;
|
|
1483
|
+
o[a].splice(l, 1);
|
|
1484
|
+
let u = r;
|
|
1485
|
+
a === n && c >= 0 && u > c && --u;
|
|
1486
|
+
let d = o[n].filter((e) => s.get(e));
|
|
1487
|
+
if (u = Math.max(0, Math.min(u, d.length)), a === n && c >= 0 && u === c) return null;
|
|
1488
|
+
let f;
|
|
1489
|
+
return f = u >= d.length ? o[n].length : o[n].indexOf(d[u]), o[n].splice(f, 0, t), [
|
|
1490
|
+
...o.left,
|
|
1491
|
+
...o.center,
|
|
1492
|
+
...o.right
|
|
1493
|
+
];
|
|
1494
|
+
}
|
|
1495
|
+
var mt = 24, ht = 18, gt = 32, W = 2, G = 14, _t = 12, vt = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"5 9 2 12 5 15\"/><polyline points=\"9 5 12 2 15 5\"/><polyline points=\"15 19 12 22 9 19\"/><polyline points=\"19 9 22 12 19 15\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", yt = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"22\"/><path d=\"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z\"/></svg>", bt = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"4.9\" y1=\"4.9\" x2=\"19.1\" y2=\"19.1\"/></svg>", K = {
|
|
1496
|
+
normal: {
|
|
1497
|
+
border: "#2563eb",
|
|
1498
|
+
background: "#eff6ff",
|
|
1499
|
+
color: "#1d4ed8"
|
|
1500
|
+
},
|
|
1501
|
+
out: {
|
|
1502
|
+
border: "#ef4444",
|
|
1503
|
+
background: "#fef2f2",
|
|
1504
|
+
color: "#dc2626"
|
|
1505
|
+
}
|
|
1506
|
+
}, xt = (e) => {
|
|
1507
|
+
let n = s(e);
|
|
1508
|
+
n.current = e;
|
|
1509
|
+
let i = s(null), a = s(null), o = s(null), c = s(null), l = s(null), u = s({
|
|
1510
|
+
x: 0,
|
|
1511
|
+
y: 0
|
|
1512
|
+
}), d = s(null), f = s(null), p = s(null), m = s(null), h = t(() => {
|
|
1513
|
+
for (let e of [
|
|
1514
|
+
i,
|
|
1515
|
+
a,
|
|
1516
|
+
o
|
|
1517
|
+
]) e.current && (e.current.style.display = "none");
|
|
1518
|
+
}, []), g = t((e) => {
|
|
1519
|
+
if (f.current) return;
|
|
1520
|
+
let t = document.createElement("div");
|
|
1521
|
+
t.setAttribute("data-grid-drag-ghost", ""), t.style.cssText = [
|
|
1522
|
+
"position:fixed",
|
|
1523
|
+
"top:0",
|
|
1524
|
+
"left:0",
|
|
1525
|
+
"display:inline-flex",
|
|
1526
|
+
"align-items:center",
|
|
1527
|
+
"gap:6px",
|
|
1528
|
+
"padding:4px 10px 4px 8px",
|
|
1529
|
+
"border-radius:9999px",
|
|
1530
|
+
"border:1px solid " + K.normal.border,
|
|
1531
|
+
"background:" + K.normal.background,
|
|
1532
|
+
"color:" + K.normal.color,
|
|
1533
|
+
"font-size:12px",
|
|
1534
|
+
"font-weight:600",
|
|
1535
|
+
"line-height:1",
|
|
1536
|
+
"white-space:nowrap",
|
|
1537
|
+
"box-shadow:0 4px 12px rgba(15,23,42,0.18)",
|
|
1538
|
+
"pointer-events:none",
|
|
1539
|
+
"user-select:none",
|
|
1540
|
+
"z-index:9999",
|
|
1541
|
+
"will-change:transform",
|
|
1542
|
+
"transform:translate(-9999px,-9999px)"
|
|
1543
|
+
].join(";");
|
|
1544
|
+
let n = document.createElement("span");
|
|
1545
|
+
n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
|
|
1546
|
+
let r = document.createElement("span");
|
|
1547
|
+
r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), f.current = t, p.current = n, m.current = null;
|
|
1548
|
+
}, []), _ = t((e) => {
|
|
1549
|
+
let t = f.current;
|
|
1550
|
+
if (!t) return;
|
|
1551
|
+
let { x: n, y: r } = u.current;
|
|
1552
|
+
t.style.transform = "translate(" + (n + G) + "px," + (r + _t) + "px)";
|
|
1553
|
+
let i = e ?? "out";
|
|
1554
|
+
if (m.current === i) return;
|
|
1555
|
+
m.current = i;
|
|
1556
|
+
let a = p.current;
|
|
1557
|
+
i === "out" ? (t.style.borderColor = K.out.border, t.style.background = K.out.background, t.style.color = K.out.color, a && (a.innerHTML = bt)) : (t.style.borderColor = K.normal.border, t.style.background = K.normal.background, t.style.color = K.normal.color, a && (a.innerHTML = i === "center" ? vt : yt));
|
|
1558
|
+
}, []), v = t(() => {
|
|
1559
|
+
let e = f.current;
|
|
1560
|
+
e && e.parentNode && e.parentNode.removeChild(e), f.current = null, p.current = null, m.current = null;
|
|
1561
|
+
}, []), y = t((e, t) => {
|
|
1562
|
+
let { paneLayout: r, leftPaneScrollRef: i, rightPaneScrollRef: a, bodyScrollRef: o, scrollContainerRef: s, leftLeadingWidth: c, centerLeadingWidth: l, rightLeadingWidth: u } = n.current, d = s.current;
|
|
1563
|
+
if (d) {
|
|
1564
|
+
let n = d.getBoundingClientRect();
|
|
1565
|
+
if (e < n.left || e > n.right || t < n.top || t > n.bottom) return null;
|
|
1566
|
+
}
|
|
1567
|
+
let f = i.current, p = a.current;
|
|
1568
|
+
if (f && r.left.entries.length === 0 && e <= f.getBoundingClientRect().left + gt) return {
|
|
1569
|
+
pane: "left",
|
|
1570
|
+
slot: 0,
|
|
1571
|
+
leftPx: W
|
|
1572
|
+
};
|
|
1573
|
+
if (f && r.left.entries.length > 0) {
|
|
1574
|
+
let t = f.getBoundingClientRect();
|
|
1575
|
+
if (e < t.right) {
|
|
1576
|
+
let n = e - t.left - c, i = xe(r.left, n);
|
|
1577
|
+
return {
|
|
1578
|
+
pane: "left",
|
|
1579
|
+
slot: i,
|
|
1580
|
+
leftPx: c + Se(r.left, i)
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
if (p && r.right.entries.length === 0 && e >= p.getBoundingClientRect().left - gt) return {
|
|
1585
|
+
pane: "right",
|
|
1586
|
+
slot: 0,
|
|
1587
|
+
leftPx: -2
|
|
1588
|
+
};
|
|
1589
|
+
if (p && r.right.entries.length > 0) {
|
|
1590
|
+
let t = p.getBoundingClientRect();
|
|
1591
|
+
if (e >= t.left) {
|
|
1592
|
+
let n = e - t.left - u, i = xe(r.right, n);
|
|
1593
|
+
return {
|
|
1594
|
+
pane: "right",
|
|
1595
|
+
slot: i,
|
|
1596
|
+
leftPx: u + Se(r.right, i)
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
let m = o.current;
|
|
1601
|
+
if (m && r.center.entries.length > 0) {
|
|
1602
|
+
let t = m.getBoundingClientRect(), n = m.scrollLeft + e - t.left - l, i = xe(r.center, Math.max(n, 0));
|
|
1603
|
+
return {
|
|
1604
|
+
pane: "center",
|
|
1605
|
+
slot: i,
|
|
1606
|
+
leftPx: l + Se(r.center, i)
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
return null;
|
|
1610
|
+
}, []), b = t(() => {
|
|
1611
|
+
let e = y(u.current.x, u.current.y);
|
|
1612
|
+
if (_(e ? e.pane : null), !e) {
|
|
1613
|
+
l.current = null, h();
|
|
1614
|
+
return;
|
|
1615
|
+
}
|
|
1616
|
+
l.current = {
|
|
1617
|
+
pane: e.pane,
|
|
1618
|
+
slot: e.slot
|
|
1619
|
+
};
|
|
1620
|
+
let t = {
|
|
1621
|
+
left: i.current,
|
|
1622
|
+
center: a.current,
|
|
1623
|
+
right: o.current
|
|
1624
|
+
};
|
|
1625
|
+
for (let n of [
|
|
1626
|
+
"left",
|
|
1627
|
+
"center",
|
|
1628
|
+
"right"
|
|
1629
|
+
]) {
|
|
1630
|
+
let r = t[n];
|
|
1631
|
+
r && (n === e.pane ? (r.style.left = `${e.leftPx}px`, r.style.display = "block") : r.style.display = "none");
|
|
1632
|
+
}
|
|
1633
|
+
}, [
|
|
1634
|
+
y,
|
|
1635
|
+
h,
|
|
1636
|
+
_
|
|
1637
|
+
]), x = s(() => {});
|
|
1638
|
+
x.current = t(() => {
|
|
1639
|
+
let e = n.current.scrollContainerRef.current;
|
|
1640
|
+
if (e) {
|
|
1641
|
+
let t = e.getBoundingClientRect(), n = u.current, r = e.scrollLeft;
|
|
1642
|
+
n.x < t.left + mt ? r = Math.max(e.scrollLeft - ht, 0) : n.x > t.right - mt && (r = e.scrollLeft + ht), r !== e.scrollLeft && e.scrollTo({
|
|
1643
|
+
left: r,
|
|
1644
|
+
behavior: "auto"
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
b(), d.current = requestAnimationFrame(x.current);
|
|
1648
|
+
}, [b]);
|
|
1649
|
+
let S = t((e) => {
|
|
1650
|
+
d.current !== null && (cancelAnimationFrame(d.current), d.current = null), document.body.style.cursor = "", h(), v();
|
|
1651
|
+
let t = c.current, r = l.current;
|
|
1652
|
+
if (c.current = null, l.current = null, !e || !t || !r) return;
|
|
1653
|
+
let { columns: i, applyColumnOrderAndPin: a } = n.current, o = U(i, t, r.pane, r.slot);
|
|
1654
|
+
o && a(o, new Map([[t, r.pane === "center" ? void 0 : r.pane]]));
|
|
1655
|
+
}, [h, v]), C = t((e, t) => {
|
|
1656
|
+
if (!n.current.enabled || t.button !== 0) return;
|
|
1657
|
+
t.stopPropagation(), t.preventDefault(), c.current = e.key, u.current = {
|
|
1658
|
+
x: t.clientX,
|
|
1659
|
+
y: t.clientY
|
|
1660
|
+
}, document.body.style.cursor = "grabbing", g(e.title || e.key);
|
|
1661
|
+
let r = t.currentTarget, i = t.pointerId;
|
|
1662
|
+
try {
|
|
1663
|
+
r.setPointerCapture(i);
|
|
1664
|
+
} catch {}
|
|
1665
|
+
let a = (e) => {
|
|
1666
|
+
u.current = {
|
|
1667
|
+
x: e.clientX,
|
|
1668
|
+
y: e.clientY
|
|
1669
|
+
}, b();
|
|
1670
|
+
};
|
|
1671
|
+
function o() {
|
|
1672
|
+
l(), S(!0);
|
|
1673
|
+
}
|
|
1674
|
+
function s() {
|
|
1675
|
+
l(), S(!1);
|
|
1676
|
+
}
|
|
1677
|
+
let l = () => {
|
|
1678
|
+
r.removeEventListener("pointermove", a), r.removeEventListener("pointerup", o), r.removeEventListener("pointercancel", s), r.removeEventListener("lostpointercapture", s);
|
|
1679
|
+
try {
|
|
1680
|
+
r.releasePointerCapture(i);
|
|
1681
|
+
} catch {}
|
|
1682
|
+
};
|
|
1683
|
+
r.addEventListener("pointermove", a), r.addEventListener("pointerup", o), r.addEventListener("pointercancel", s), r.addEventListener("lostpointercapture", s), b(), d.current = requestAnimationFrame(x.current);
|
|
1684
|
+
}, [
|
|
1685
|
+
b,
|
|
1686
|
+
S,
|
|
1687
|
+
g
|
|
1688
|
+
]);
|
|
1689
|
+
return r(() => () => {
|
|
1690
|
+
d.current !== null && (cancelAnimationFrame(d.current), d.current = null), document.body.style.cursor = "";
|
|
1691
|
+
let e = f.current;
|
|
1692
|
+
e && e.parentNode && e.parentNode.removeChild(e), f.current = null, p.current = null, m.current = null;
|
|
1693
|
+
}, []), {
|
|
1694
|
+
onColumnDragHandlePointerDown: C,
|
|
1695
|
+
leftIndicatorRef: i,
|
|
1696
|
+
centerIndicatorRef: a,
|
|
1697
|
+
rightIndicatorRef: o
|
|
1698
|
+
};
|
|
1699
|
+
}, St = (e, t) => {
|
|
1700
|
+
let { heights: n, prefix: r, rowCount: i } = e, a = Math.max(t, 0);
|
|
1701
|
+
for (let e = a; e < i; e += 1) r[e + 1] = r[e] + n[e];
|
|
1702
|
+
}, Ct = (e, t, n, r) => {
|
|
1703
|
+
let i = r ?? /* @__PURE__ */ new Map(), a = Math.max(e, 0), o = new Float64Array(a);
|
|
1704
|
+
for (let e = 0; e < a; e += 1) {
|
|
1705
|
+
let r = i.get(n(e));
|
|
1706
|
+
o[e] = r === void 0 ? t : r;
|
|
1707
|
+
}
|
|
1708
|
+
let s = {
|
|
1709
|
+
rowCount: a,
|
|
1710
|
+
estimate: t,
|
|
1711
|
+
heights: o,
|
|
1712
|
+
prefix: new Float64Array(a + 1),
|
|
1713
|
+
measured: i
|
|
1714
|
+
};
|
|
1715
|
+
return St(s, 0), s;
|
|
1716
|
+
}, wt = (e, t, n, r) => t < 0 || t >= e.rowCount || (e.measured.set(n, r), e.heights[t] === r) ? !1 : (e.heights[t] = r, !0), Tt = (e, t, n) => {
|
|
1717
|
+
if (t <= 0 || n <= 0) return 0;
|
|
1718
|
+
if (n >= e[t]) return t - 1;
|
|
1719
|
+
let r = 0, i = t;
|
|
1720
|
+
for (; r < i;) {
|
|
1721
|
+
let t = r + i + 1 >> 1;
|
|
1722
|
+
e[t] <= n ? r = t : i = t - 1;
|
|
1723
|
+
}
|
|
1724
|
+
return Math.min(Math.max(r, 0), t - 1);
|
|
1725
|
+
}, Et = (e) => {
|
|
1726
|
+
let { prefix: t, rowCount: n } = e;
|
|
1727
|
+
return {
|
|
1728
|
+
rowCount: n,
|
|
1729
|
+
rowTop: (e) => t[Math.min(Math.max(e, 0), n)],
|
|
1730
|
+
rowsHeight: (e, r) => t[Math.min(Math.max(r + 1, 0), n)] - t[Math.min(Math.max(e, 0), n)],
|
|
1731
|
+
totalBodyHeight: t[n],
|
|
1732
|
+
rowAtContentY: (e) => Tt(t, n, e)
|
|
1733
|
+
};
|
|
1734
|
+
}, Dt = 21, Ot = 4, kt = 141, At = 13, q = 600, jt = 60, Mt = 1e3, Nt = 16, Pt = null, Ft = () => Pt || (typeof document > "u" ? null : (Pt = document.createElement("canvas").getContext("2d"), Pt)), It = "system-ui, sans-serif", Lt = (e) => {
|
|
1735
|
+
let t = It, n = 13, r = "400";
|
|
1736
|
+
if (e && typeof window < "u") {
|
|
1737
|
+
let i = window.getComputedStyle(e);
|
|
1738
|
+
i.fontFamily && (t = i.fontFamily);
|
|
1739
|
+
let a = Number.parseFloat(i.fontSize);
|
|
1740
|
+
Number.isFinite(a) && a > 0 && (n = a), i.fontWeight && (r = i.fontWeight);
|
|
1741
|
+
}
|
|
1742
|
+
return {
|
|
1743
|
+
cellFont: `${r} ${n}px ${t}`,
|
|
1744
|
+
headerFont: `${q} ${At}px ${t}`
|
|
1745
|
+
};
|
|
1746
|
+
}, Rt = (e, t, n) => Math.min(Math.max(e, t), n), zt = (e) => e >= 4352 && e <= 4447 || e >= 11904 && e <= 12350 || e >= 12353 && e <= 13311 || e >= 13312 && e <= 19903 || e >= 19968 && e <= 40959 || e >= 40960 && e <= 42191 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65072 && e <= 65103 || e >= 65280 && e <= 65376 || e >= 65504 && e <= 65510 || e >= 127744 && e <= 129791 || e >= 131072 && e <= 262141, J = (e) => {
|
|
1747
|
+
let t = 0;
|
|
1748
|
+
for (let n of e) {
|
|
1749
|
+
let e = n.codePointAt(0) ?? 0;
|
|
1750
|
+
t += zt(e) ? 2 : 1;
|
|
1751
|
+
}
|
|
1752
|
+
return t;
|
|
1753
|
+
};
|
|
1754
|
+
function Bt(e) {
|
|
1755
|
+
let t = e.map(() => []), n = e.map(() => []), r = e.map(() => Infinity);
|
|
1756
|
+
return {
|
|
1757
|
+
collect: (i) => {
|
|
1758
|
+
for (let a = 0; a < e.length; a += 1) {
|
|
1759
|
+
let o = String(j(i, e[a]) ?? "");
|
|
1760
|
+
if (o === "") continue;
|
|
1761
|
+
let s = t[a], c = n[a];
|
|
1762
|
+
if (s.length === Nt && 2 * o.length <= r[a]) continue;
|
|
1763
|
+
let l = J(o);
|
|
1764
|
+
if (s.length < Nt) {
|
|
1765
|
+
if (s.push(o), c.push(l), s.length === Nt) {
|
|
1766
|
+
let e = c[0];
|
|
1767
|
+
for (let t = 1; t < Nt; t += 1) c[t] < e && (e = c[t]);
|
|
1768
|
+
r[a] = e;
|
|
1769
|
+
}
|
|
1770
|
+
continue;
|
|
1771
|
+
}
|
|
1772
|
+
if (l <= r[a]) continue;
|
|
1773
|
+
let u = 0;
|
|
1774
|
+
for (let e = 1; e < Nt; e += 1) c[e] < c[u] && (u = e);
|
|
1775
|
+
s[u] = o, c[u] = l;
|
|
1776
|
+
let d = c[0];
|
|
1777
|
+
for (let e = 1; e < Nt; e += 1) c[e] < d && (d = c[e]);
|
|
1778
|
+
r[a] = d;
|
|
1779
|
+
}
|
|
1780
|
+
},
|
|
1781
|
+
finalize: ({ gridRoot: n, currentWidths: r }) => {
|
|
1782
|
+
let i = Ft();
|
|
1783
|
+
if (!i || e.length === 0) return {};
|
|
1784
|
+
let { cellFont: a, headerFont: o } = Lt(n), s = {};
|
|
1785
|
+
for (let n = 0; n < e.length; n += 1) {
|
|
1786
|
+
let c = e[n];
|
|
1787
|
+
i.font = o;
|
|
1788
|
+
let l = c.title || c.key, u = i.measureText(l).width + Ot + kt;
|
|
1789
|
+
i.font = a;
|
|
1790
|
+
let d = 0, f = t[n];
|
|
1791
|
+
for (let e = 0; e < f.length; e += 1) {
|
|
1792
|
+
let t = i.measureText(f[e]).width;
|
|
1793
|
+
t > d && (d = t);
|
|
1794
|
+
}
|
|
1795
|
+
let p = d > 0 ? d + Ot + Dt : 0, m = Math.ceil(Rt(Math.max(u, p), c.minWidth ?? jt, c.maxWidth ?? Mt));
|
|
1796
|
+
r[c.key] !== m && (s[c.key] = m);
|
|
1797
|
+
}
|
|
1798
|
+
return s;
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1802
|
+
function Vt() {
|
|
1803
|
+
return Ft() !== null;
|
|
1804
|
+
}
|
|
1805
|
+
//#endregion
|
|
1806
|
+
//#region src/components/spreadsheet-grid/utils/scheduler.ts
|
|
1807
|
+
var Ht = () => new Promise((e) => {
|
|
1808
|
+
if (typeof MessageChannel > "u") {
|
|
1809
|
+
setTimeout(e, 0);
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
let t = new MessageChannel();
|
|
1813
|
+
t.port1.onmessage = () => {
|
|
1814
|
+
t.port1.close(), e();
|
|
1815
|
+
}, t.port2.postMessage(null);
|
|
1816
|
+
}), Ut = 10, Wt = 180, Y = () => typeof performance < "u" ? performance.now() : Date.now(), Gt = ({ rowModelRef: e, gridRootRef: n, columnWidthsRef: i, dispatch: a }) => {
|
|
1817
|
+
let [o, l] = c(!1), u = s(0), d = s(null), f = () => {
|
|
1818
|
+
d.current !== null && (clearTimeout(d.current), d.current = null);
|
|
1819
|
+
};
|
|
1820
|
+
return r(() => () => {
|
|
1821
|
+
u.current += 1, f();
|
|
1822
|
+
}, []), {
|
|
1823
|
+
isAutosizing: o,
|
|
1824
|
+
runAutosize: t(async (t) => {
|
|
1825
|
+
if (t.length === 0 || !Vt()) return;
|
|
1826
|
+
let r = u.current += 1;
|
|
1827
|
+
f();
|
|
1828
|
+
let o = e.current, s = o.getRowCount(), c = n.current, p = i.current, m = Bt(t);
|
|
1829
|
+
d.current = setTimeout(() => {
|
|
1830
|
+
u.current === r && l(!0);
|
|
1831
|
+
}, Wt);
|
|
1832
|
+
try {
|
|
1833
|
+
let t = 0;
|
|
1834
|
+
for (; t < s;) {
|
|
1835
|
+
let n = Y();
|
|
1836
|
+
for (; t < s && Y() - n < Ut;) {
|
|
1837
|
+
let e = o.getRow(t);
|
|
1838
|
+
e && m.collect(e), t += 1;
|
|
1839
|
+
}
|
|
1840
|
+
if (t < s && (await Ht(), u.current !== r || e.current !== o)) return;
|
|
1841
|
+
}
|
|
1842
|
+
let n = m.finalize({
|
|
1843
|
+
gridRoot: c,
|
|
1844
|
+
currentWidths: p
|
|
1845
|
+
});
|
|
1846
|
+
Object.keys(n).length > 0 && a(h.syncColumnWidths(n));
|
|
1847
|
+
} finally {
|
|
1848
|
+
u.current === r && (f(), l(!1));
|
|
1849
|
+
}
|
|
1850
|
+
}, [
|
|
1851
|
+
i,
|
|
1852
|
+
a,
|
|
1853
|
+
n,
|
|
1854
|
+
e
|
|
1855
|
+
])
|
|
1856
|
+
};
|
|
1857
|
+
}, Kt = () => {
|
|
1858
|
+
let e = /* @__PURE__ */ new Set(), t = [];
|
|
1859
|
+
return {
|
|
1860
|
+
collect(n) {
|
|
1861
|
+
let r = String(n ?? "");
|
|
1862
|
+
e.has(r) || (e.add(r), t.push({
|
|
1863
|
+
value: r,
|
|
1864
|
+
label: r || "(空白)"
|
|
1865
|
+
}));
|
|
1866
|
+
},
|
|
1867
|
+
finalize() {
|
|
1868
|
+
return t.sort((e, t) => Ye.compare(e.label, t.label));
|
|
1869
|
+
}
|
|
1870
|
+
};
|
|
1871
|
+
}, qt = (e, t) => {
|
|
1872
|
+
let n = Kt();
|
|
1873
|
+
for (let r = 0; r < e; r += 1) n.collect(t(r));
|
|
1874
|
+
return n.finalize();
|
|
1875
|
+
}, Jt = 10, Yt = () => typeof performance < "u" ? performance.now() : Date.now(), Xt = [], Zt = /* @__PURE__ */ new Set(), Qt = {
|
|
1876
|
+
status: "idle",
|
|
1877
|
+
options: Xt,
|
|
1878
|
+
allValues: Zt,
|
|
1879
|
+
progress: 0
|
|
1880
|
+
}, $t = {
|
|
1881
|
+
status: "collecting",
|
|
1882
|
+
options: Xt,
|
|
1883
|
+
allValues: Zt,
|
|
1884
|
+
progress: 0
|
|
1885
|
+
}, en = (e) => new Set(e.map((e) => e.value)), tn = {
|
|
1886
|
+
source: null,
|
|
1887
|
+
rowCount: 0,
|
|
1888
|
+
result: Qt
|
|
1889
|
+
}, nn = ({ column: e, rowCount: t, getRawValueAt: n }) => {
|
|
1890
|
+
let i = e?.filterType ?? null, o = i === "select" || i === "set", s = e?.filterOptions && e.filterOptions.length > 0 ? e.filterOptions : null, l = o && s === null && t > 5e4, u = a(() => {
|
|
1891
|
+
if (!e || !o) return Qt;
|
|
1892
|
+
if (s) {
|
|
1893
|
+
let e = s;
|
|
1894
|
+
return {
|
|
1895
|
+
status: "ready",
|
|
1896
|
+
options: e,
|
|
1897
|
+
allValues: en(e),
|
|
1898
|
+
progress: 1
|
|
1899
|
+
};
|
|
1900
|
+
}
|
|
1901
|
+
if (!l) {
|
|
1902
|
+
let e = qt(t, n);
|
|
1903
|
+
return {
|
|
1904
|
+
status: "ready",
|
|
1905
|
+
options: e,
|
|
1906
|
+
allValues: en(e),
|
|
1907
|
+
progress: 1
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
return null;
|
|
1911
|
+
}, [
|
|
1912
|
+
e,
|
|
1913
|
+
o,
|
|
1914
|
+
s,
|
|
1915
|
+
l,
|
|
1916
|
+
t,
|
|
1917
|
+
n
|
|
1918
|
+
]), [d, f] = c(tn);
|
|
1919
|
+
r(() => {
|
|
1920
|
+
if (u !== null) return;
|
|
1921
|
+
let e = n, r = t, i = Kt(), a = !1;
|
|
1922
|
+
return (async () => {
|
|
1923
|
+
let t = 0;
|
|
1924
|
+
for (; t < r;) {
|
|
1925
|
+
let n = Yt();
|
|
1926
|
+
for (; t < r && Yt() - n < Jt;) i.collect(e(t)), t += 1;
|
|
1927
|
+
if (t < r) {
|
|
1928
|
+
if (await Ht(), a) return;
|
|
1929
|
+
f({
|
|
1930
|
+
source: e,
|
|
1931
|
+
rowCount: r,
|
|
1932
|
+
result: {
|
|
1933
|
+
status: "collecting",
|
|
1934
|
+
options: Xt,
|
|
1935
|
+
allValues: Zt,
|
|
1936
|
+
progress: t / r
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
if (a) return;
|
|
1942
|
+
let n = i.finalize();
|
|
1943
|
+
f({
|
|
1944
|
+
source: e,
|
|
1945
|
+
rowCount: r,
|
|
1946
|
+
result: {
|
|
1947
|
+
status: "ready",
|
|
1948
|
+
options: n,
|
|
1949
|
+
allValues: en(n),
|
|
1950
|
+
progress: 1
|
|
1951
|
+
}
|
|
1952
|
+
});
|
|
1953
|
+
})(), () => {
|
|
1954
|
+
a = !0;
|
|
1955
|
+
};
|
|
1956
|
+
}, [
|
|
1957
|
+
u,
|
|
1958
|
+
t,
|
|
1959
|
+
n
|
|
1960
|
+
]);
|
|
1961
|
+
let p = d.source === n && d.rowCount === t ? d.result : $t;
|
|
1962
|
+
return u ?? p;
|
|
1963
|
+
};
|
|
1964
|
+
//#endregion
|
|
1965
|
+
//#region src/components/spreadsheet-grid/logic/serverSideCache.ts
|
|
1966
|
+
function X(e) {
|
|
1967
|
+
let t = e.blockSize, n = e.maxBlocks, r = /* @__PURE__ */ new Map(), i = (e) => {
|
|
1968
|
+
let t = r.get(e);
|
|
1969
|
+
t !== void 0 && (r.delete(e), r.set(e, t));
|
|
1970
|
+
}, a = () => {
|
|
1971
|
+
for (; r.size > n;) {
|
|
1972
|
+
let e = r.keys().next().value;
|
|
1973
|
+
if (e === void 0) break;
|
|
1974
|
+
r.delete(e);
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
return {
|
|
1978
|
+
getRow: (e) => {
|
|
1979
|
+
if (t <= 0 || e < 0) return;
|
|
1980
|
+
let n = Math.floor(e / t), i = r.get(n);
|
|
1981
|
+
if (i !== void 0) return i[e - n * t];
|
|
1982
|
+
},
|
|
1983
|
+
hasBlock: (e) => r.has(e),
|
|
1984
|
+
setBlock: (e, t) => {
|
|
1985
|
+
r.has(e) && r.delete(e), r.set(e, t), a();
|
|
1986
|
+
},
|
|
1987
|
+
touchBlocks: (e) => {
|
|
1988
|
+
for (let t of e) i(t);
|
|
1989
|
+
},
|
|
1990
|
+
clear: () => {
|
|
1991
|
+
r.clear();
|
|
1992
|
+
},
|
|
1993
|
+
loadedBlockIndexes: () => Array.from(r.keys())
|
|
1994
|
+
};
|
|
1995
|
+
}
|
|
1996
|
+
//#endregion
|
|
1997
|
+
//#region src/components/spreadsheet-grid/logic/serverSideBlocks.ts
|
|
1998
|
+
function rn(e, t) {
|
|
1999
|
+
return Math.floor(e / t);
|
|
2000
|
+
}
|
|
2001
|
+
function an(e, t, n, r) {
|
|
2002
|
+
if (n <= 0 || r <= 0) return [];
|
|
2003
|
+
let i = Math.max(0, Math.floor(e)), a = Math.min(r, Math.floor(t));
|
|
2004
|
+
if (a <= i) return [];
|
|
2005
|
+
let o = rn(i, n), s = rn(a - 1, n), c = [];
|
|
2006
|
+
for (let e = o; e <= s; e += 1) c.push(e);
|
|
2007
|
+
return c;
|
|
2008
|
+
}
|
|
2009
|
+
//#endregion
|
|
2010
|
+
//#region src/components/spreadsheet-grid/hooks/useServerSideRowModel.ts
|
|
2011
|
+
var on = 100, sn = 64, cn = 120;
|
|
2012
|
+
function ln(e) {
|
|
2013
|
+
let { dataSource: n, rowKeyGetter: i, query: o, queryKey: l, refreshToken: u } = e, d = n?.blockSize ?? on, f = n?.maxCachedBlocks ?? sn, p = e.debounceMs ?? cn, [m] = c(() => X({
|
|
2014
|
+
blockSize: d,
|
|
2015
|
+
maxBlocks: f
|
|
2016
|
+
})), [h, g] = c(n?.initialRowCount ?? 0), [_, v] = c(0), y = s(h), b = s(!1), x = s(/* @__PURE__ */ new Map()), S = s(null), C = s({
|
|
2017
|
+
start: 0,
|
|
2018
|
+
end: 0
|
|
2019
|
+
}), w = t((e) => {
|
|
2020
|
+
if (n == null || m.hasBlock(e) || x.current.has(e)) return;
|
|
2021
|
+
let t = new AbortController();
|
|
2022
|
+
x.current.set(e, t);
|
|
2023
|
+
let r = e * d, i = r + d;
|
|
2024
|
+
n.getRows({
|
|
2025
|
+
startIndex: r,
|
|
2026
|
+
endIndex: i,
|
|
2027
|
+
query: o,
|
|
2028
|
+
signal: t.signal
|
|
2029
|
+
}).then((n) => {
|
|
2030
|
+
t.signal.aborted || x.current.get(e) === t && (x.current.delete(e), m.setBlock(e, n.rows), n.totalRowCount !== y.current && (y.current = n.totalRowCount, g(n.totalRowCount)), v((e) => e + 1));
|
|
2031
|
+
}).catch(() => {
|
|
2032
|
+
x.current.get(e) === t && x.current.delete(e);
|
|
2033
|
+
});
|
|
2034
|
+
}, [
|
|
2035
|
+
m,
|
|
2036
|
+
d,
|
|
2037
|
+
n,
|
|
2038
|
+
o
|
|
2039
|
+
]), T = t(() => {
|
|
2040
|
+
let { start: e, end: t } = C.current, n = an(e, t, d, y.current), r = new Set(n);
|
|
2041
|
+
for (let [e, t] of x.current) r.has(e) || (t.abort(), x.current.delete(e));
|
|
2042
|
+
for (let e of n) w(e);
|
|
2043
|
+
}, [d, w]), E = t(() => {
|
|
2044
|
+
S.current !== null && clearTimeout(S.current), S.current = setTimeout(() => {
|
|
2045
|
+
S.current = null, T();
|
|
2046
|
+
}, p);
|
|
2047
|
+
}, [p, T]), D = t((e, t) => {
|
|
2048
|
+
n != null && (C.current = {
|
|
2049
|
+
start: e,
|
|
2050
|
+
end: t
|
|
2051
|
+
}, m.touchBlocks(an(e, t, d, y.current)), E());
|
|
2052
|
+
}, [
|
|
2053
|
+
m,
|
|
2054
|
+
d,
|
|
2055
|
+
n,
|
|
2056
|
+
E
|
|
2057
|
+
]);
|
|
2058
|
+
r(() => {
|
|
2059
|
+
if (n == null) return;
|
|
2060
|
+
for (let [, e] of x.current) e.abort();
|
|
2061
|
+
x.current.clear(), S.current !== null && (clearTimeout(S.current), S.current = null), m.clear();
|
|
2062
|
+
let e = !b.current;
|
|
2063
|
+
b.current = !0, v((e) => e + 1), e ? (n.initialRowCount ?? 0) <= 0 && w(0) : w(0);
|
|
2064
|
+
}, [l]);
|
|
2065
|
+
let O = s(u);
|
|
2066
|
+
r(() => {
|
|
2067
|
+
if (n == null || u === void 0) {
|
|
2068
|
+
O.current = u;
|
|
2069
|
+
return;
|
|
2070
|
+
}
|
|
2071
|
+
if (O.current === void 0) {
|
|
2072
|
+
O.current = u;
|
|
2073
|
+
return;
|
|
2074
|
+
}
|
|
2075
|
+
if (O.current !== u) {
|
|
2076
|
+
O.current = u;
|
|
2077
|
+
for (let [, e] of x.current) e.abort();
|
|
2078
|
+
x.current.clear(), S.current !== null && (clearTimeout(S.current), S.current = null), m.clear(), v((e) => e + 1), T();
|
|
2079
|
+
}
|
|
2080
|
+
}, [u]), r(() => {
|
|
2081
|
+
let e = x.current, t = S;
|
|
2082
|
+
return () => {
|
|
2083
|
+
for (let [, t] of e) t.abort();
|
|
2084
|
+
e.clear(), t.current !== null && (clearTimeout(t.current), t.current = null);
|
|
2085
|
+
};
|
|
2086
|
+
}, []);
|
|
2087
|
+
let k = t((e) => m.getRow(e) !== void 0, [m]);
|
|
2088
|
+
return {
|
|
2089
|
+
rowModel: a(() => ({
|
|
2090
|
+
getRowCount: () => y.current,
|
|
2091
|
+
getRow: (e) => m.getRow(e),
|
|
2092
|
+
getSourceIndex: (e) => e,
|
|
2093
|
+
getRowKey: (e) => {
|
|
2094
|
+
let t = m.getRow(e);
|
|
2095
|
+
return t === void 0 ? e : i(t, e);
|
|
2096
|
+
}
|
|
2097
|
+
}), [
|
|
2098
|
+
m,
|
|
2099
|
+
i,
|
|
2100
|
+
_
|
|
2101
|
+
]),
|
|
2102
|
+
rowCount: h,
|
|
2103
|
+
isRowLoaded: k,
|
|
2104
|
+
requestRange: D
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2107
|
+
//#endregion
|
|
2108
|
+
//#region src/components/spreadsheet-grid/logic/serverSideQuery.ts
|
|
2109
|
+
var un = (e) => {
|
|
2110
|
+
let t = {}, n = e.globalText.trim();
|
|
2111
|
+
n.length > 0 && (t.globalText = n);
|
|
2112
|
+
let r = {}, i = !1;
|
|
2113
|
+
for (let t of Object.keys(e.columnFilters)) {
|
|
2114
|
+
let n = e.columnFilters[t];
|
|
2115
|
+
F(n) && (r[t] = n, i = !0);
|
|
2116
|
+
}
|
|
2117
|
+
return i && (t.columnFilters = r), e.sort.length > 0 && (t.sort = e.sort), t;
|
|
2118
|
+
}, dn = (e) => {
|
|
2119
|
+
let t = e.columnFilters ?? {}, n = Object.keys(t).sort().map((e) => [e, t[e]]), r = e.sort ?? [];
|
|
2120
|
+
return JSON.stringify({
|
|
2121
|
+
g: e.globalText ?? "",
|
|
2122
|
+
s: r.map((e) => [e.columnKey, e.direction]),
|
|
2123
|
+
c: n
|
|
2124
|
+
});
|
|
2125
|
+
}, fn = (e, t) => e === null ? !0 : e.mode === "include" ? e.values.has(t) : !e.values.has(t), pn = 28;
|
|
2126
|
+
function mn({ options: e, setSelection: t, searchInputRef: r, onValueToggle: i, onSelectAllChange: o, onRequestClose: p, isServerSide: m }) {
|
|
2127
|
+
let [h, g] = c(""), _ = n(h), v = a(() => {
|
|
2128
|
+
let t = _.trim().toLowerCase();
|
|
2129
|
+
return t ? e.filter((e) => e.label.toLowerCase().includes(t)) : e;
|
|
2130
|
+
}, [e, _]), y = _.trim().length > 0, b = s(null), x = l({
|
|
2131
|
+
count: v.length,
|
|
2132
|
+
getScrollElement: () => b.current,
|
|
2133
|
+
estimateSize: () => pn,
|
|
2134
|
+
overscan: 10
|
|
2135
|
+
}), S = a(() => {
|
|
2136
|
+
if (t === null) return v.length;
|
|
2137
|
+
let e = 0;
|
|
2138
|
+
for (let n of v) fn(t, n.value) && (e += 1);
|
|
2139
|
+
return e;
|
|
2140
|
+
}, [t, v]), C = v.length > 0 && S === v.length, w = S > 0 && !C, T = t === null ? e.length : t.mode === "include" ? t.values.size : e.length - t.values.size;
|
|
2141
|
+
return /* @__PURE__ */ f(u, { children: [
|
|
2142
|
+
/* @__PURE__ */ d("input", {
|
|
2143
|
+
ref: r,
|
|
2144
|
+
type: "text",
|
|
2145
|
+
value: h,
|
|
2146
|
+
onChange: (e) => g(e.target.value),
|
|
2147
|
+
onKeyDown: (e) => {
|
|
2148
|
+
e.stopPropagation(), e.key === "Escape" && (e.preventDefault(), p());
|
|
2149
|
+
},
|
|
2150
|
+
placeholder: "検索...",
|
|
2151
|
+
className: "ssg-filter-input"
|
|
2152
|
+
}),
|
|
2153
|
+
/* @__PURE__ */ f("label", {
|
|
2154
|
+
className: "ssg-filter-selectall",
|
|
2155
|
+
children: [/* @__PURE__ */ d("input", {
|
|
2156
|
+
type: "checkbox",
|
|
2157
|
+
checked: C,
|
|
2158
|
+
ref: (e) => {
|
|
2159
|
+
e && (e.indeterminate = w);
|
|
2160
|
+
},
|
|
2161
|
+
onChange: () => {
|
|
2162
|
+
o(y ? v.map((e) => e.value) : "all", !C);
|
|
2163
|
+
}
|
|
2164
|
+
}), /* @__PURE__ */ d("span", {
|
|
2165
|
+
className: "ssg-filter-selectall-label",
|
|
2166
|
+
children: y ? "(検索結果をすべて選択)" : "(すべて選択)"
|
|
2167
|
+
})]
|
|
2168
|
+
}),
|
|
2169
|
+
/* @__PURE__ */ d("div", {
|
|
2170
|
+
ref: b,
|
|
2171
|
+
className: "ssg-filter-list",
|
|
2172
|
+
children: v.length === 0 ? /* @__PURE__ */ d("div", {
|
|
2173
|
+
className: "ssg-filter-empty",
|
|
2174
|
+
children: e.length === 0 ? m ? "候補が未指定です(serverSide では列に filterOptions などの候補供給が必要)" : "候補がありません" : "一致する候補がありません"
|
|
2175
|
+
}) : /* @__PURE__ */ d("div", {
|
|
2176
|
+
className: "ssg-filter-virt",
|
|
2177
|
+
style: { height: x.getTotalSize() },
|
|
2178
|
+
children: x.getVirtualItems().map((e) => {
|
|
2179
|
+
let n = v[e.index];
|
|
2180
|
+
if (!n) return null;
|
|
2181
|
+
let r = fn(t, n.value);
|
|
2182
|
+
return /* @__PURE__ */ f("label", {
|
|
2183
|
+
className: "ssg-filter-option",
|
|
2184
|
+
style: {
|
|
2185
|
+
transform: `translateY(${e.start}px)`,
|
|
2186
|
+
height: e.size
|
|
2187
|
+
},
|
|
2188
|
+
children: [/* @__PURE__ */ d("input", {
|
|
2189
|
+
type: "checkbox",
|
|
2190
|
+
checked: r,
|
|
2191
|
+
onChange: () => i(n.value)
|
|
2192
|
+
}), /* @__PURE__ */ d("span", {
|
|
2193
|
+
className: "ssg-filter-option-label",
|
|
2194
|
+
children: n.label
|
|
2195
|
+
})]
|
|
2196
|
+
}, n.value);
|
|
2197
|
+
})
|
|
2198
|
+
})
|
|
2199
|
+
}),
|
|
2200
|
+
/* @__PURE__ */ f("div", {
|
|
2201
|
+
className: "ssg-filter-meta",
|
|
2202
|
+
children: [
|
|
2203
|
+
"選択中: ",
|
|
2204
|
+
T,
|
|
2205
|
+
" / ",
|
|
2206
|
+
e.length,
|
|
2207
|
+
" 件",
|
|
2208
|
+
y ? `(表示中 ${v.length} 件)` : ""
|
|
2209
|
+
]
|
|
2210
|
+
})
|
|
2211
|
+
] });
|
|
2212
|
+
}
|
|
2213
|
+
function hn({ isOpen: e, title: t, filterType: n, draftValue: r, currentValueText: i, layout: a, selectOptions: o, optionsStatus: s, optionsProgress: c, setSelection: l, popoverRef: m, textInputRef: h, selectRef: g, onRequestClose: _, onDraftChange: v, onApply: y, onClear: b, onSetValueToggle: x, onSetSelectAllChange: S, onSetClear: C, isServerSide: w = !1 }) {
|
|
2214
|
+
if (typeof document > "u" || !e || !a) return null;
|
|
2215
|
+
let T = {
|
|
2216
|
+
top: a.top,
|
|
2217
|
+
left: a.left,
|
|
2218
|
+
width: a.width
|
|
2219
|
+
}, E = (e) => {
|
|
2220
|
+
e.stopPropagation();
|
|
2221
|
+
}, D = (e) => {
|
|
2222
|
+
e.stopPropagation();
|
|
2223
|
+
}, O = n === "set";
|
|
2224
|
+
return p(/* @__PURE__ */ f("div", {
|
|
2225
|
+
ref: m,
|
|
2226
|
+
onPointerDown: D,
|
|
2227
|
+
onKeyDownCapture: E,
|
|
2228
|
+
onPasteCapture: (e) => {
|
|
2229
|
+
e.stopPropagation();
|
|
2230
|
+
},
|
|
2231
|
+
className: "ssg-filter-popover",
|
|
2232
|
+
style: T,
|
|
2233
|
+
children: [
|
|
2234
|
+
/* @__PURE__ */ f("div", {
|
|
2235
|
+
className: "ssg-filter-title",
|
|
2236
|
+
children: ["列フィルター: ", t]
|
|
2237
|
+
}),
|
|
2238
|
+
(O || n === "select") && s === "collecting" ? /* @__PURE__ */ f("div", {
|
|
2239
|
+
className: "ssg-filter-collecting",
|
|
2240
|
+
children: [
|
|
2241
|
+
"候補を収集中… ",
|
|
2242
|
+
Math.round(c * 100),
|
|
2243
|
+
"%"
|
|
2244
|
+
]
|
|
2245
|
+
}) : O ? /* @__PURE__ */ d(mn, {
|
|
2246
|
+
options: o,
|
|
2247
|
+
setSelection: l,
|
|
2248
|
+
searchInputRef: h,
|
|
2249
|
+
onValueToggle: x,
|
|
2250
|
+
onSelectAllChange: S,
|
|
2251
|
+
onRequestClose: _,
|
|
2252
|
+
isServerSide: w
|
|
2253
|
+
}) : n === "select" ? /* @__PURE__ */ f(u, { children: [
|
|
2254
|
+
/* @__PURE__ */ d("div", {
|
|
2255
|
+
className: "ssg-filter-hint",
|
|
2256
|
+
children: "フィルター種別: select"
|
|
2257
|
+
}),
|
|
2258
|
+
/* @__PURE__ */ f("select", {
|
|
2259
|
+
ref: g,
|
|
2260
|
+
value: r,
|
|
2261
|
+
onChange: (e) => v(e.target.value),
|
|
2262
|
+
onKeyDown: (e) => {
|
|
2263
|
+
if (e.stopPropagation(), e.key === "Enter") {
|
|
2264
|
+
e.preventDefault(), y();
|
|
2265
|
+
return;
|
|
2266
|
+
}
|
|
2267
|
+
e.key === "Escape" && (e.preventDefault(), _());
|
|
2268
|
+
},
|
|
2269
|
+
className: "ssg-filter-select",
|
|
2270
|
+
children: [/* @__PURE__ */ d("option", {
|
|
2271
|
+
value: "",
|
|
2272
|
+
children: "(すべて)"
|
|
2273
|
+
}), o.map((e) => /* @__PURE__ */ d("option", {
|
|
2274
|
+
value: e.value,
|
|
2275
|
+
children: e.label
|
|
2276
|
+
}, `${t}-${e.value}`))]
|
|
2277
|
+
}),
|
|
2278
|
+
/* @__PURE__ */ f("div", {
|
|
2279
|
+
className: "ssg-filter-meta",
|
|
2280
|
+
children: ["候補数: ", o.length]
|
|
2281
|
+
})
|
|
2282
|
+
] }) : /* @__PURE__ */ f(u, { children: [
|
|
2283
|
+
/* @__PURE__ */ f("div", {
|
|
2284
|
+
className: "ssg-filter-hint",
|
|
2285
|
+
children: ["フィルター種別: ", n === "number" ? "number" : "text"]
|
|
2286
|
+
}),
|
|
2287
|
+
/* @__PURE__ */ d("input", {
|
|
2288
|
+
ref: h,
|
|
2289
|
+
type: "text",
|
|
2290
|
+
value: r,
|
|
2291
|
+
onChange: (e) => v(e.target.value),
|
|
2292
|
+
onKeyDown: (e) => {
|
|
2293
|
+
if (e.stopPropagation(), e.key === "Enter") {
|
|
2294
|
+
e.preventDefault(), y();
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
e.key === "Escape" && (e.preventDefault(), _());
|
|
2298
|
+
},
|
|
2299
|
+
placeholder: n === "number" ? "例: >=10 / <20 / 10..20 / =5" : "部分一致で絞り込み",
|
|
2300
|
+
className: "ssg-filter-input"
|
|
2301
|
+
}),
|
|
2302
|
+
/* @__PURE__ */ d("div", {
|
|
2303
|
+
className: "ssg-filter-meta ssg-filter-meta--ellipsis",
|
|
2304
|
+
children: n === "number" ? "数量系は =, >, >=, <, <=, .. が使えます" : "text は部分一致検索です"
|
|
2305
|
+
})
|
|
2306
|
+
] }),
|
|
2307
|
+
!O && /* @__PURE__ */ f("div", {
|
|
2308
|
+
className: "ssg-filter-meta ssg-filter-meta--ellipsis",
|
|
2309
|
+
children: ["現在値: ", i]
|
|
2310
|
+
}),
|
|
2311
|
+
/* @__PURE__ */ d("div", {
|
|
2312
|
+
className: "ssg-filter-footer",
|
|
2313
|
+
children: O ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("button", {
|
|
2314
|
+
type: "button",
|
|
2315
|
+
onPointerDown: (e) => {
|
|
2316
|
+
e.preventDefault(), e.stopPropagation(), C();
|
|
2317
|
+
},
|
|
2318
|
+
onKeyDown: (e) => {
|
|
2319
|
+
e.stopPropagation();
|
|
2320
|
+
},
|
|
2321
|
+
className: "ssg-filter-btn-secondary",
|
|
2322
|
+
children: "クリア"
|
|
2323
|
+
}), /* @__PURE__ */ d("button", {
|
|
2324
|
+
type: "button",
|
|
2325
|
+
onPointerDown: (e) => {
|
|
2326
|
+
e.preventDefault(), e.stopPropagation(), _();
|
|
2327
|
+
},
|
|
2328
|
+
onKeyDown: (e) => {
|
|
2329
|
+
e.stopPropagation();
|
|
2330
|
+
},
|
|
2331
|
+
className: "ssg-filter-btn-primary",
|
|
2332
|
+
children: "閉じる"
|
|
2333
|
+
})] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("button", {
|
|
2334
|
+
type: "button",
|
|
2335
|
+
onPointerDown: (e) => {
|
|
2336
|
+
e.preventDefault(), e.stopPropagation(), b();
|
|
2337
|
+
},
|
|
2338
|
+
onKeyDown: (e) => {
|
|
2339
|
+
e.stopPropagation();
|
|
2340
|
+
},
|
|
2341
|
+
className: "ssg-filter-btn-secondary",
|
|
2342
|
+
children: "クリア"
|
|
2343
|
+
}), /* @__PURE__ */ d("button", {
|
|
2344
|
+
type: "button",
|
|
2345
|
+
onPointerDown: (e) => {
|
|
2346
|
+
e.preventDefault(), e.stopPropagation(), y();
|
|
2347
|
+
},
|
|
2348
|
+
onKeyDown: (e) => {
|
|
2349
|
+
e.stopPropagation();
|
|
2350
|
+
},
|
|
2351
|
+
className: "ssg-filter-btn-primary",
|
|
2352
|
+
children: "適用"
|
|
2353
|
+
})] })
|
|
2354
|
+
})
|
|
2355
|
+
]
|
|
2356
|
+
}), document.body);
|
|
2357
|
+
}
|
|
2358
|
+
//#endregion
|
|
2359
|
+
//#region src/components/spreadsheet-grid/view/DefaultGridBottomBar.tsx
|
|
2360
|
+
function gn({ context: e }) {
|
|
2361
|
+
let { derivedSummary: t } = e;
|
|
2362
|
+
return /* @__PURE__ */ d("div", {
|
|
2363
|
+
className: "ssg-bar--bottom",
|
|
2364
|
+
children: /* @__PURE__ */ f("div", {
|
|
2365
|
+
className: "ssg-bar-container",
|
|
2366
|
+
children: [/* @__PURE__ */ f("div", {
|
|
2367
|
+
className: "ssg-bar-group",
|
|
2368
|
+
children: [/* @__PURE__ */ d("span", {
|
|
2369
|
+
className: "ssg-bar-chip",
|
|
2370
|
+
children: t.rowSummaryText
|
|
2371
|
+
}), /* @__PURE__ */ d("span", {
|
|
2372
|
+
className: "ssg-bar-chip",
|
|
2373
|
+
children: t.columnSummaryText
|
|
2374
|
+
})]
|
|
2375
|
+
}), /* @__PURE__ */ f("div", {
|
|
2376
|
+
className: "ssg-bar-group",
|
|
2377
|
+
children: [
|
|
2378
|
+
/* @__PURE__ */ f("span", {
|
|
2379
|
+
className: "ssg-bar-chip",
|
|
2380
|
+
children: ["Active: ", t.activeCellLabel]
|
|
2381
|
+
}),
|
|
2382
|
+
/* @__PURE__ */ f("span", {
|
|
2383
|
+
className: "ssg-bar-chip",
|
|
2384
|
+
children: ["Selection: ", t.selectionLabel]
|
|
2385
|
+
}),
|
|
2386
|
+
/* @__PURE__ */ d("span", {
|
|
2387
|
+
className: "ssg-bar-chip",
|
|
2388
|
+
children: t.selectionStatsText
|
|
2389
|
+
}),
|
|
2390
|
+
/* @__PURE__ */ f("span", {
|
|
2391
|
+
className: "ssg-bar-chip",
|
|
2392
|
+
children: ["Cols: ", t.selectionStats.selectedColumnCount]
|
|
2393
|
+
})
|
|
2394
|
+
]
|
|
2395
|
+
})]
|
|
2396
|
+
})
|
|
2397
|
+
});
|
|
2398
|
+
}
|
|
2399
|
+
//#endregion
|
|
2400
|
+
//#region src/components/spreadsheet-grid/view/DefaultGridTopBar.tsx
|
|
2401
|
+
function _n({ context: e }) {
|
|
2402
|
+
let { derivedSummary: t } = e;
|
|
2403
|
+
return /* @__PURE__ */ d("div", {
|
|
2404
|
+
className: "ssg-bar--top",
|
|
2405
|
+
children: /* @__PURE__ */ f("div", {
|
|
2406
|
+
className: "ssg-bar-container",
|
|
2407
|
+
children: [/* @__PURE__ */ f("div", {
|
|
2408
|
+
className: "ssg-bar-group ssg-bar-leading",
|
|
2409
|
+
children: [
|
|
2410
|
+
/* @__PURE__ */ d("span", {
|
|
2411
|
+
className: "ssg-bar-title",
|
|
2412
|
+
children: "Toolbar"
|
|
2413
|
+
}),
|
|
2414
|
+
/* @__PURE__ */ d("span", {
|
|
2415
|
+
className: "ssg-bar-chip ssg-bar-chip--emphasis",
|
|
2416
|
+
children: t.rowSummaryText
|
|
2417
|
+
}),
|
|
2418
|
+
/* @__PURE__ */ d("span", {
|
|
2419
|
+
className: "ssg-bar-chip ssg-bar-chip--emphasis",
|
|
2420
|
+
children: t.columnSummaryText
|
|
2421
|
+
}),
|
|
2422
|
+
/* @__PURE__ */ d("span", {
|
|
2423
|
+
className: "ssg-bar-chip ssg-bar-chip--emphasis",
|
|
2424
|
+
children: t.filterSummaryText
|
|
2425
|
+
}),
|
|
2426
|
+
/* @__PURE__ */ d("span", {
|
|
2427
|
+
className: "ssg-bar-chip ssg-bar-chip--emphasis",
|
|
2428
|
+
children: t.sortSummaryText
|
|
2429
|
+
})
|
|
2430
|
+
]
|
|
2431
|
+
}), /* @__PURE__ */ f("div", {
|
|
2432
|
+
className: "ssg-bar-input-group",
|
|
2433
|
+
children: [/* @__PURE__ */ d("input", {
|
|
2434
|
+
type: "text",
|
|
2435
|
+
value: e.globalFilterText,
|
|
2436
|
+
onChange: (t) => e.setGlobalFilterText(t.target.value),
|
|
2437
|
+
placeholder: "グローバルフィルター",
|
|
2438
|
+
className: "ssg-bar-input"
|
|
2439
|
+
}), e.globalFilterText.trim().length > 0 ? /* @__PURE__ */ d("button", {
|
|
2440
|
+
type: "button",
|
|
2441
|
+
onClick: () => e.setGlobalFilterText(""),
|
|
2442
|
+
className: "ssg-bar-clear-btn",
|
|
2443
|
+
children: "クリア"
|
|
2444
|
+
}) : null]
|
|
2445
|
+
})]
|
|
2446
|
+
})
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
//#endregion
|
|
2450
|
+
//#region src/components/spreadsheet-grid/view/GridBodyLayer.tsx
|
|
2451
|
+
function vn({ pane: e, ownsRowHeader: t, leadingWidth: n, rowIndex: r, rowKey: i, row: a, top: o, renderEntries: s, rowHeight: c, autoHeight: l, autoHeightMinHeight: u, rowHeaderCellStyle: p, isRowHovered: h, isWholeGridSelected: g, isRowSelected: _, activeColInRow: v, editingColInRow: y, selectedColStart: b, selectedColEnd: x, readOnly: S, canEditCell: C, onRowHeaderPointerDown: w, onRowHeaderPointerEnter: T, onRowHeaderPointerLeave: E, onCellPointerDown: D, onCellPointerEnter: O, onCellDoubleClick: k, renderCellContent: M, rowClassName: N, bodyCellClassName: P, bodyRowClassName: F, rowHeaderCellClassName: I }) {
|
|
2452
|
+
return /* @__PURE__ */ f("div", {
|
|
2453
|
+
"data-pane": e,
|
|
2454
|
+
"data-row-index": r,
|
|
2455
|
+
className: m("ssg-body-row", N, F),
|
|
2456
|
+
style: {
|
|
2457
|
+
height: c,
|
|
2458
|
+
transform: `translateY(${o}px)`
|
|
2459
|
+
},
|
|
2460
|
+
children: [t && /* @__PURE__ */ d("div", {
|
|
2461
|
+
onPointerDown: (e) => w(r, e),
|
|
2462
|
+
onPointerEnter: (e) => T(r, e),
|
|
2463
|
+
onPointerLeave: () => E(r),
|
|
2464
|
+
className: m("ssg-header-cell", "ssg-row-header-cell", (g || _) && "ssg-header-cell--selected", h && "ssg-header-cell--hovered", N, I),
|
|
2465
|
+
style: {
|
|
2466
|
+
...p,
|
|
2467
|
+
height: c
|
|
2468
|
+
},
|
|
2469
|
+
children: r + 1
|
|
2470
|
+
}), s.map((e) => {
|
|
2471
|
+
if (!e) return null;
|
|
2472
|
+
let t = e.logicalIndex, o = e.column, s = n + e.paneLocalStart, f = e.paneLocalSize, p = t === v, g = t === y, w = _ || b >= 0 && t >= b && t <= x, T = !A({
|
|
2473
|
+
readOnly: S,
|
|
2474
|
+
canEditCell: C
|
|
2475
|
+
}, r, t, a, o), E = l && o.autoHeight === !0, F, I = o.cellClassName;
|
|
2476
|
+
I && (F = typeof I == "function" ? I({
|
|
2477
|
+
row: a,
|
|
2478
|
+
rowIndex: r,
|
|
2479
|
+
colIndex: t,
|
|
2480
|
+
value: j(a, o),
|
|
2481
|
+
column: o,
|
|
2482
|
+
isActive: p,
|
|
2483
|
+
isSelected: w,
|
|
2484
|
+
isEditing: g,
|
|
2485
|
+
readOnly: T
|
|
2486
|
+
}) : I);
|
|
2487
|
+
let L = m("ssg-body-cell", E && "ssg-body-cell--autoheight", T && !w && "ssg-body-cell--readonly", h && "ssg-body-cell--row-hovered", N, F, P);
|
|
2488
|
+
return /* @__PURE__ */ d("div", {
|
|
2489
|
+
"data-autoheight-cell": E ? "" : void 0,
|
|
2490
|
+
className: L,
|
|
2491
|
+
onPointerDown: (e) => D({
|
|
2492
|
+
row: r,
|
|
2493
|
+
col: t
|
|
2494
|
+
}, e),
|
|
2495
|
+
onPointerEnter: (e) => O({
|
|
2496
|
+
row: r,
|
|
2497
|
+
col: t
|
|
2498
|
+
}, e),
|
|
2499
|
+
onDoubleClick: () => k({
|
|
2500
|
+
row: r,
|
|
2501
|
+
col: t
|
|
2502
|
+
}),
|
|
2503
|
+
style: {
|
|
2504
|
+
left: s,
|
|
2505
|
+
width: f,
|
|
2506
|
+
minWidth: f,
|
|
2507
|
+
...E ? { minHeight: u } : { height: c },
|
|
2508
|
+
zIndex: p ? 3 : 1
|
|
2509
|
+
},
|
|
2510
|
+
children: M(a, r, o, t, {
|
|
2511
|
+
isActive: p,
|
|
2512
|
+
isSelected: w,
|
|
2513
|
+
isEditing: g,
|
|
2514
|
+
readOnly: T
|
|
2515
|
+
})
|
|
2516
|
+
}, `${String(i)}-${o.key}`);
|
|
2517
|
+
})]
|
|
2518
|
+
});
|
|
2519
|
+
}
|
|
2520
|
+
var yn = e(vn), bn = [
|
|
2521
|
+
"62%",
|
|
2522
|
+
"46%",
|
|
2523
|
+
"78%",
|
|
2524
|
+
"54%"
|
|
2525
|
+
];
|
|
2526
|
+
function xn({ pane: e, ownsRowHeader: t, leadingWidth: n, rowIndex: r, top: i, rowHeight: a, renderEntries: o, rowHeaderCellStyle: s, isRowHovered: c, onRowHeaderPointerDown: l, onRowHeaderPointerEnter: u, onRowHeaderPointerLeave: p, onCellPointerDown: h, onCellPointerEnter: g, bodyCellClassName: _, bodyRowClassName: v, rowHeaderCellClassName: y }) {
|
|
2527
|
+
return /* @__PURE__ */ f("div", {
|
|
2528
|
+
"data-pane": e,
|
|
2529
|
+
"data-row-index": r,
|
|
2530
|
+
"data-skeleton-row": "",
|
|
2531
|
+
className: m("ssg-body-row", v),
|
|
2532
|
+
style: {
|
|
2533
|
+
height: a,
|
|
2534
|
+
transform: `translateY(${i}px)`
|
|
2535
|
+
},
|
|
2536
|
+
children: [t && /* @__PURE__ */ d("div", {
|
|
2537
|
+
onPointerDown: (e) => l(r, e),
|
|
2538
|
+
onPointerEnter: (e) => u(r, e),
|
|
2539
|
+
onPointerLeave: () => p(r),
|
|
2540
|
+
className: m("ssg-header-cell", "ssg-row-header-cell", "ssg-skeleton-rowheader", c && "ssg-header-cell--hovered", y),
|
|
2541
|
+
style: {
|
|
2542
|
+
...s,
|
|
2543
|
+
height: a
|
|
2544
|
+
},
|
|
2545
|
+
children: r + 1
|
|
2546
|
+
}), o.map((t) => {
|
|
2547
|
+
if (!t) return null;
|
|
2548
|
+
let i = t.logicalIndex, o = n + t.paneLocalStart, s = t.paneLocalSize, l = bn[i % bn.length];
|
|
2549
|
+
return /* @__PURE__ */ d("div", {
|
|
2550
|
+
className: m("ssg-body-cell", c && "ssg-body-cell--row-hovered", _),
|
|
2551
|
+
onPointerDown: (e) => h({
|
|
2552
|
+
row: r,
|
|
2553
|
+
col: i
|
|
2554
|
+
}, e),
|
|
2555
|
+
onPointerEnter: (e) => g({
|
|
2556
|
+
row: r,
|
|
2557
|
+
col: i
|
|
2558
|
+
}, e),
|
|
2559
|
+
style: {
|
|
2560
|
+
left: o,
|
|
2561
|
+
width: s,
|
|
2562
|
+
minWidth: s,
|
|
2563
|
+
height: a,
|
|
2564
|
+
zIndex: 1
|
|
2565
|
+
},
|
|
2566
|
+
children: /* @__PURE__ */ d("div", {
|
|
2567
|
+
"aria-hidden": "true",
|
|
2568
|
+
className: "ssg-skeleton-bar",
|
|
2569
|
+
style: { width: l }
|
|
2570
|
+
})
|
|
2571
|
+
}, `skeleton-${e}-${i}`);
|
|
2572
|
+
})]
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
2575
|
+
var Sn = e(xn);
|
|
2576
|
+
function Cn({ pane: e, ownsRowHeader: t, leadingWidth: n, rowModel: r, virtualRows: i, virtualRowIndexes: a, renderEntries: o, rowHeight: s, autoHeight: c = !1, isServerSide: l = !1, rowHeaderCellStyle: f, hoveredRowIndex: p, isWholeGridSelected: m, activeCell: h, editingCell: g, selectionSnapshot: _, readOnly: v, canEditCell: y, onRowHeaderPointerDown: b, onRowHeaderPointerEnter: x, onRowHeaderPointerLeave: S, onCellPointerDown: C, onCellPointerEnter: w, onCellDoubleClick: T, renderCellContent: E, getRowClassName: D, bodyCellClassName: O, bodyRowClassName: k, rowHeaderCellClassName: A }) {
|
|
2577
|
+
return /* @__PURE__ */ d(u, { children: i.map((i) => {
|
|
2578
|
+
let u = i.index;
|
|
2579
|
+
if (!a.has(u)) return null;
|
|
2580
|
+
let j = i.size ?? s, M = r.getRow(u);
|
|
2581
|
+
if (!M) {
|
|
2582
|
+
if (!l) return null;
|
|
2583
|
+
let a = r.getRowKey(u) ?? u;
|
|
2584
|
+
return /* @__PURE__ */ d(Sn, {
|
|
2585
|
+
pane: e,
|
|
2586
|
+
ownsRowHeader: t,
|
|
2587
|
+
leadingWidth: n,
|
|
2588
|
+
rowIndex: u,
|
|
2589
|
+
top: i.start,
|
|
2590
|
+
rowHeight: j,
|
|
2591
|
+
renderEntries: o,
|
|
2592
|
+
rowHeaderCellStyle: f,
|
|
2593
|
+
isRowHovered: p === u,
|
|
2594
|
+
onRowHeaderPointerDown: b,
|
|
2595
|
+
onRowHeaderPointerEnter: x,
|
|
2596
|
+
onRowHeaderPointerLeave: S,
|
|
2597
|
+
onCellPointerDown: C,
|
|
2598
|
+
onCellPointerEnter: w,
|
|
2599
|
+
bodyCellClassName: O,
|
|
2600
|
+
bodyRowClassName: k,
|
|
2601
|
+
rowHeaderCellClassName: A
|
|
2602
|
+
}, String(a));
|
|
2603
|
+
}
|
|
2604
|
+
let N = r.getRowKey(u) ?? u, P = _.kind === "row" && u >= _.startRow && u <= _.endRow, F = _.kind === "cell" && u >= _.startRow && u <= _.endRow, I = _.kind === "col" || F ? _.startCol : -1, L = _.kind === "col" || F ? _.endCol : -1, ee = h && h.row === u ? h.col : -1, te = g && g.row === u ? g.col : -1, ne = D?.(M, u);
|
|
2605
|
+
return /* @__PURE__ */ d(yn, {
|
|
2606
|
+
pane: e,
|
|
2607
|
+
ownsRowHeader: t,
|
|
2608
|
+
leadingWidth: n,
|
|
2609
|
+
rowIndex: u,
|
|
2610
|
+
rowKey: N,
|
|
2611
|
+
row: M,
|
|
2612
|
+
top: i.start,
|
|
2613
|
+
renderEntries: o,
|
|
2614
|
+
rowHeight: j,
|
|
2615
|
+
autoHeight: c,
|
|
2616
|
+
autoHeightMinHeight: s,
|
|
2617
|
+
rowHeaderCellStyle: f,
|
|
2618
|
+
isRowHovered: p === u,
|
|
2619
|
+
isWholeGridSelected: m,
|
|
2620
|
+
isRowSelected: P,
|
|
2621
|
+
activeColInRow: ee,
|
|
2622
|
+
editingColInRow: te,
|
|
2623
|
+
selectedColStart: I,
|
|
2624
|
+
selectedColEnd: L,
|
|
2625
|
+
readOnly: v,
|
|
2626
|
+
canEditCell: y,
|
|
2627
|
+
onRowHeaderPointerDown: b,
|
|
2628
|
+
onRowHeaderPointerEnter: x,
|
|
2629
|
+
onRowHeaderPointerLeave: S,
|
|
2630
|
+
onCellPointerDown: C,
|
|
2631
|
+
onCellPointerEnter: w,
|
|
2632
|
+
onCellDoubleClick: T,
|
|
2633
|
+
renderCellContent: E,
|
|
2634
|
+
rowClassName: ne,
|
|
2635
|
+
bodyCellClassName: O,
|
|
2636
|
+
bodyRowClassName: k,
|
|
2637
|
+
rowHeaderCellClassName: A
|
|
2638
|
+
}, String(N));
|
|
2639
|
+
}) });
|
|
2640
|
+
}
|
|
2641
|
+
//#endregion
|
|
2642
|
+
//#region src/components/spreadsheet-grid/view/GridHeaderRow.tsx
|
|
2643
|
+
function wn({ isActive: e, title: t, className: n, onPointerDown: r, children: i }) {
|
|
2644
|
+
return /* @__PURE__ */ d("button", {
|
|
2645
|
+
type: "button",
|
|
2646
|
+
title: t,
|
|
2647
|
+
onPointerDown: r,
|
|
2648
|
+
className: m("ssg-icon-btn", e && "ssg-icon-btn--active", n),
|
|
2649
|
+
children: i
|
|
2650
|
+
});
|
|
2651
|
+
}
|
|
2652
|
+
function Tn({ pane: e, ownsRowHeader: t, leadingWidth: n, headerHeight: r, rowHeaderCellStyle: i, headerRowClassName: a, headerCellClassName: o, rowHeaderCellClassName: s, isCornerHovered: c, isWholeGridSelected: l, filteredRowsLength: u, visibleColumnsLength: p, renderEntries: h, hoveredColumnIndex: g, selectionSnapshot: _, columnFilterValues: v, sortState: y, iconButtonClassName: b, onCornerPointerDown: x, onCornerPointerEnter: S, onCornerPointerLeave: C, onColumnHeaderPointerDown: w, onColumnHeaderPointerEnter: T, onColumnHeaderPointerLeave: E, onColumnFilterButtonPointerDown: D, onColumnResizePointerDown: O, enableColumnMenu: k, openedMenuColumnKey: A, onColumnMenuButtonPointerDown: j, onColumnHeaderContextMenu: M, onColumnDragHandlePointerDown: N }) {
|
|
2653
|
+
return /* @__PURE__ */ f("div", {
|
|
2654
|
+
"data-pane": e,
|
|
2655
|
+
className: m("ssg-header-row", a),
|
|
2656
|
+
style: { height: r },
|
|
2657
|
+
children: [t && /* @__PURE__ */ d("div", {
|
|
2658
|
+
onPointerDown: x,
|
|
2659
|
+
onPointerEnter: S,
|
|
2660
|
+
onPointerLeave: C,
|
|
2661
|
+
className: m("ssg-header-cell", "ssg-corner-cell", l && "ssg-header-cell--selected", c && "ssg-header-cell--hovered", s),
|
|
2662
|
+
style: {
|
|
2663
|
+
...i,
|
|
2664
|
+
height: r,
|
|
2665
|
+
cursor: u > 0 && p > 0 ? "pointer" : "default"
|
|
2666
|
+
},
|
|
2667
|
+
children: "#"
|
|
2668
|
+
}), h.map((e) => {
|
|
2669
|
+
if (!e) return null;
|
|
2670
|
+
let t = e.logicalIndex, i = e.column, a = n + e.paneLocalStart, s = e.paneLocalSize, c = F(v[i.key]), u = _.kind === "col" && t >= _.startCol && t <= _.endCol, p = y.findIndex((e) => e.columnKey === i.key), h = p === -1 ? null : y[p], x = A === i.key, S = k;
|
|
2671
|
+
return /* @__PURE__ */ f("div", {
|
|
2672
|
+
onPointerDown: (e) => w(t, e),
|
|
2673
|
+
onPointerEnter: (e) => T(t, e),
|
|
2674
|
+
onPointerLeave: () => E(t),
|
|
2675
|
+
onContextMenu: (e) => M(i, e),
|
|
2676
|
+
className: m("ssg-header-cell", (l || u) && "ssg-header-cell--selected", g === t && "ssg-header-cell--hovered", o),
|
|
2677
|
+
style: {
|
|
2678
|
+
left: a,
|
|
2679
|
+
width: s,
|
|
2680
|
+
minWidth: s,
|
|
2681
|
+
height: r
|
|
2682
|
+
},
|
|
2683
|
+
children: [
|
|
2684
|
+
N && /* @__PURE__ */ d("span", {
|
|
2685
|
+
onPointerDown: (e) => N(i, e),
|
|
2686
|
+
title: "ドラッグで列を移動",
|
|
2687
|
+
"aria-hidden": "true",
|
|
2688
|
+
className: "ssg-header-grip",
|
|
2689
|
+
children: /* @__PURE__ */ f("svg", {
|
|
2690
|
+
width: "8",
|
|
2691
|
+
height: "14",
|
|
2692
|
+
viewBox: "0 0 8 14",
|
|
2693
|
+
fill: "currentColor",
|
|
2694
|
+
"aria-hidden": "true",
|
|
2695
|
+
focusable: "false",
|
|
2696
|
+
children: [
|
|
2697
|
+
/* @__PURE__ */ d("circle", {
|
|
2698
|
+
cx: "2",
|
|
2699
|
+
cy: "3",
|
|
2700
|
+
r: "1"
|
|
2701
|
+
}),
|
|
2702
|
+
/* @__PURE__ */ d("circle", {
|
|
2703
|
+
cx: "6",
|
|
2704
|
+
cy: "3",
|
|
2705
|
+
r: "1"
|
|
2706
|
+
}),
|
|
2707
|
+
/* @__PURE__ */ d("circle", {
|
|
2708
|
+
cx: "2",
|
|
2709
|
+
cy: "7",
|
|
2710
|
+
r: "1"
|
|
2711
|
+
}),
|
|
2712
|
+
/* @__PURE__ */ d("circle", {
|
|
2713
|
+
cx: "6",
|
|
2714
|
+
cy: "7",
|
|
2715
|
+
r: "1"
|
|
2716
|
+
}),
|
|
2717
|
+
/* @__PURE__ */ d("circle", {
|
|
2718
|
+
cx: "2",
|
|
2719
|
+
cy: "11",
|
|
2720
|
+
r: "1"
|
|
2721
|
+
}),
|
|
2722
|
+
/* @__PURE__ */ d("circle", {
|
|
2723
|
+
cx: "6",
|
|
2724
|
+
cy: "11",
|
|
2725
|
+
r: "1"
|
|
2726
|
+
})
|
|
2727
|
+
]
|
|
2728
|
+
})
|
|
2729
|
+
}),
|
|
2730
|
+
/* @__PURE__ */ f("div", {
|
|
2731
|
+
className: "ssg-header-label-row",
|
|
2732
|
+
children: [
|
|
2733
|
+
/* @__PURE__ */ d("div", {
|
|
2734
|
+
className: m("ssg-header-label", c && "ssg-header-label--filtered"),
|
|
2735
|
+
children: i.renderHeader ? i.renderHeader({
|
|
2736
|
+
colIndex: t,
|
|
2737
|
+
width: s,
|
|
2738
|
+
column: i,
|
|
2739
|
+
filterValue: v[i.key],
|
|
2740
|
+
isFiltered: c
|
|
2741
|
+
}) : i.title || i.key
|
|
2742
|
+
}),
|
|
2743
|
+
h && /* @__PURE__ */ f("span", {
|
|
2744
|
+
"aria-hidden": "true",
|
|
2745
|
+
title: (h.direction === "asc" ? "昇順で並び替え中" : "降順で並び替え中") + (y.length > 1 ? ` (優先度 ${p + 1})` : ""),
|
|
2746
|
+
className: "ssg-header-sort",
|
|
2747
|
+
children: [h.direction === "asc" ? "↑" : "↓", y.length > 1 && /* @__PURE__ */ d("span", {
|
|
2748
|
+
className: "ssg-header-sort-priority",
|
|
2749
|
+
children: p + 1
|
|
2750
|
+
})]
|
|
2751
|
+
}),
|
|
2752
|
+
/* @__PURE__ */ d(wn, {
|
|
2753
|
+
title: "列フィルター",
|
|
2754
|
+
isActive: c,
|
|
2755
|
+
className: b,
|
|
2756
|
+
onPointerDown: (e) => D(i, e),
|
|
2757
|
+
children: /* @__PURE__ */ d("svg", {
|
|
2758
|
+
width: "12",
|
|
2759
|
+
height: "12",
|
|
2760
|
+
viewBox: "0 0 16 16",
|
|
2761
|
+
fill: c ? "currentColor" : "none",
|
|
2762
|
+
stroke: "currentColor",
|
|
2763
|
+
strokeWidth: c ? 0 : 1.4,
|
|
2764
|
+
strokeLinejoin: "round",
|
|
2765
|
+
"aria-hidden": "true",
|
|
2766
|
+
focusable: "false",
|
|
2767
|
+
children: /* @__PURE__ */ d("path", { d: "M2 4 L14 4 L9.2 9.2 L9.2 13 L6.8 13 L6.8 9.2 Z" })
|
|
2768
|
+
})
|
|
2769
|
+
}),
|
|
2770
|
+
S && /* @__PURE__ */ d(wn, {
|
|
2771
|
+
title: "列メニュー",
|
|
2772
|
+
isActive: x,
|
|
2773
|
+
className: b,
|
|
2774
|
+
onPointerDown: (e) => j(i, e),
|
|
2775
|
+
children: "⋮"
|
|
2776
|
+
})
|
|
2777
|
+
]
|
|
2778
|
+
}),
|
|
2779
|
+
/* @__PURE__ */ d("div", {
|
|
2780
|
+
onPointerDown: (e) => O(i, e),
|
|
2781
|
+
className: "ssg-header-resize"
|
|
2782
|
+
})
|
|
2783
|
+
]
|
|
2784
|
+
}, i.key);
|
|
2785
|
+
})]
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
var En = e(Tn), Dn = 200, On = 8, kn = 6, An = 289, jn = ({ visibleColumns: e, enableColumnMenu: n, gridRootRef: i }) => {
|
|
2789
|
+
let [o, l] = c(null), [u, d] = c(null), f = s(null), p = s(null), m = s(null), h = s(o);
|
|
2790
|
+
h.current = o;
|
|
2791
|
+
let g = o !== null, _ = o?.columnKey ?? null, v = a(() => _ ? e.find((e) => e.key === _) ?? null : null, [_, e]), y = t(() => {
|
|
2792
|
+
if (!_) {
|
|
2793
|
+
d(null);
|
|
2794
|
+
return;
|
|
2795
|
+
}
|
|
2796
|
+
let e, t, n, r = p.current, i = m.current;
|
|
2797
|
+
if (r) {
|
|
2798
|
+
if (!r.isConnected) {
|
|
2799
|
+
d(null), l(null), p.current = null;
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
let i = r.getBoundingClientRect();
|
|
2803
|
+
t = i.right - Dn, e = i.bottom + kn, n = i.top - An - kn;
|
|
2804
|
+
} else if (i) t = i.x, e = i.y, n = i.y - An;
|
|
2805
|
+
else {
|
|
2806
|
+
d(null);
|
|
2807
|
+
return;
|
|
2808
|
+
}
|
|
2809
|
+
t = Math.max(On, t), t = Math.min(t, window.innerWidth - Dn - On), e + An > window.innerHeight - On && (e = n), e = Math.max(On, e), d((n) => n && n.top === e && n.left === t && n.width === Dn ? n : {
|
|
2810
|
+
top: e,
|
|
2811
|
+
left: t,
|
|
2812
|
+
width: Dn
|
|
2813
|
+
});
|
|
2814
|
+
}, [_]), b = t(() => {
|
|
2815
|
+
l(null), d(null), p.current = null, m.current = null, requestAnimationFrame(() => {
|
|
2816
|
+
i.current?.focus();
|
|
2817
|
+
});
|
|
2818
|
+
}, [i]), x = t((e, t) => {
|
|
2819
|
+
if (t.preventDefault(), t.stopPropagation(), !n || t.button !== 0) return;
|
|
2820
|
+
let r = t.currentTarget;
|
|
2821
|
+
if (h.current?.columnKey === e.key && p.current === r) {
|
|
2822
|
+
b();
|
|
2823
|
+
return;
|
|
2824
|
+
}
|
|
2825
|
+
document.activeElement instanceof HTMLElement && document.activeElement.blur(), i.current?.blur(), p.current = r, m.current = null, l({ columnKey: e.key });
|
|
2826
|
+
}, [
|
|
2827
|
+
b,
|
|
2828
|
+
n,
|
|
2829
|
+
i
|
|
2830
|
+
]), S = t((e, t) => {
|
|
2831
|
+
n && (t.preventDefault(), t.stopPropagation(), document.activeElement instanceof HTMLElement && document.activeElement.blur(), i.current?.blur(), p.current = null, m.current = {
|
|
2832
|
+
x: t.clientX,
|
|
2833
|
+
y: t.clientY
|
|
2834
|
+
}, l({ columnKey: e.key }), y());
|
|
2835
|
+
}, [
|
|
2836
|
+
n,
|
|
2837
|
+
i,
|
|
2838
|
+
y
|
|
2839
|
+
]);
|
|
2840
|
+
return r(() => {
|
|
2841
|
+
if (!_) return;
|
|
2842
|
+
y();
|
|
2843
|
+
let e = () => {
|
|
2844
|
+
y();
|
|
2845
|
+
}, t = () => {
|
|
2846
|
+
if (m.current) {
|
|
2847
|
+
b();
|
|
2848
|
+
return;
|
|
2849
|
+
}
|
|
2850
|
+
y();
|
|
2851
|
+
};
|
|
2852
|
+
return window.addEventListener("resize", e), window.addEventListener("scroll", t, !0), () => {
|
|
2853
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", t, !0);
|
|
2854
|
+
};
|
|
2855
|
+
}, [
|
|
2856
|
+
_,
|
|
2857
|
+
y,
|
|
2858
|
+
b
|
|
2859
|
+
]), r(() => {
|
|
2860
|
+
if (!g) return;
|
|
2861
|
+
let e = (e) => {
|
|
2862
|
+
let t = e.target;
|
|
2863
|
+
t && (f.current?.contains(t) || p.current?.contains(t) || b());
|
|
2864
|
+
};
|
|
2865
|
+
return window.addEventListener("pointerdown", e), () => {
|
|
2866
|
+
window.removeEventListener("pointerdown", e);
|
|
2867
|
+
};
|
|
2868
|
+
}, [b, g]), r(() => {
|
|
2869
|
+
if (!g) return;
|
|
2870
|
+
let e = (e) => {
|
|
2871
|
+
e.key === "Escape" && (e.preventDefault(), b());
|
|
2872
|
+
};
|
|
2873
|
+
return window.addEventListener("keydown", e), () => {
|
|
2874
|
+
window.removeEventListener("keydown", e);
|
|
2875
|
+
};
|
|
2876
|
+
}, [b, g]), {
|
|
2877
|
+
columnMenuLayout: u,
|
|
2878
|
+
columnMenuRef: f,
|
|
2879
|
+
isColumnMenuOpen: g,
|
|
2880
|
+
openedMenuColumnKey: _,
|
|
2881
|
+
openedMenuColumn: v,
|
|
2882
|
+
openColumnMenuFromButton: x,
|
|
2883
|
+
openColumnMenuFromContextMenu: S,
|
|
2884
|
+
closeColumnMenu: b
|
|
2885
|
+
};
|
|
2886
|
+
}, Mn = [
|
|
2887
|
+
{
|
|
2888
|
+
value: void 0,
|
|
2889
|
+
label: "固定しない"
|
|
2890
|
+
},
|
|
2891
|
+
{
|
|
2892
|
+
value: "left",
|
|
2893
|
+
label: "左に固定"
|
|
2894
|
+
},
|
|
2895
|
+
{
|
|
2896
|
+
value: "right",
|
|
2897
|
+
label: "右に固定"
|
|
2898
|
+
}
|
|
2899
|
+
], Nn = 180, Pn = 4, Fn = 8, In = "pin";
|
|
2900
|
+
function Ln({ isOpen: e, title: t, columnKey: n, canSort: i, sortDirection: a, onSortChange: o, onOpenSortManager: s, pinned: l, canChangePinned: h, layout: g, popoverRef: _, onPinnedChange: v, onAutosizeColumn: y, onAutosizeAllColumns: b, onOpenColumnChooser: x, canResetColumns: S, onResetColumns: C, onRequestClose: w }) {
|
|
2901
|
+
let [T, E] = c(null);
|
|
2902
|
+
if (r(() => {
|
|
2903
|
+
E(null);
|
|
2904
|
+
}, [n, e]), !e || !g) return null;
|
|
2905
|
+
let D = T === In, O = g.left + g.width + Pn + Nn > window.innerWidth - Fn, k = {
|
|
2906
|
+
position: "fixed",
|
|
2907
|
+
top: g.top,
|
|
2908
|
+
left: g.left,
|
|
2909
|
+
width: g.width,
|
|
2910
|
+
zIndex: 1e3
|
|
2911
|
+
}, A = {
|
|
2912
|
+
position: "absolute",
|
|
2913
|
+
top: -9,
|
|
2914
|
+
...O ? { right: `calc(100% + ${Pn}px)` } : { left: `calc(100% + ${Pn}px)` },
|
|
2915
|
+
width: Nn,
|
|
2916
|
+
zIndex: 1
|
|
2917
|
+
};
|
|
2918
|
+
return p(/* @__PURE__ */ f("div", {
|
|
2919
|
+
ref: _,
|
|
2920
|
+
onPointerDown: (e) => {
|
|
2921
|
+
e.stopPropagation();
|
|
2922
|
+
},
|
|
2923
|
+
onKeyDownCapture: (e) => {
|
|
2924
|
+
e.stopPropagation();
|
|
2925
|
+
},
|
|
2926
|
+
onContextMenu: (e) => {
|
|
2927
|
+
e.preventDefault();
|
|
2928
|
+
},
|
|
2929
|
+
className: "ssg-menu-panel",
|
|
2930
|
+
style: k,
|
|
2931
|
+
children: [
|
|
2932
|
+
/* @__PURE__ */ d("div", {
|
|
2933
|
+
className: "ssg-menu-title",
|
|
2934
|
+
children: t
|
|
2935
|
+
}),
|
|
2936
|
+
i && /* @__PURE__ */ f(u, { children: [
|
|
2937
|
+
/* @__PURE__ */ f("button", {
|
|
2938
|
+
type: "button",
|
|
2939
|
+
onPointerEnter: () => {
|
|
2940
|
+
E(null);
|
|
2941
|
+
},
|
|
2942
|
+
onClick: () => {
|
|
2943
|
+
o("asc");
|
|
2944
|
+
},
|
|
2945
|
+
className: "ssg-menu-item",
|
|
2946
|
+
children: [/* @__PURE__ */ d("span", {
|
|
2947
|
+
className: m("ssg-menu-sort-icon", a === "asc" && "ssg-menu-sort-icon--active"),
|
|
2948
|
+
children: a === "asc" ? "✓" : "↑"
|
|
2949
|
+
}), /* @__PURE__ */ d("span", {
|
|
2950
|
+
className: m("ssg-menu-label", a === "asc" && "ssg-menu-label--sorted"),
|
|
2951
|
+
children: "昇順で並び替え"
|
|
2952
|
+
})]
|
|
2953
|
+
}),
|
|
2954
|
+
/* @__PURE__ */ f("button", {
|
|
2955
|
+
type: "button",
|
|
2956
|
+
onPointerEnter: () => {
|
|
2957
|
+
E(null);
|
|
2958
|
+
},
|
|
2959
|
+
onClick: () => {
|
|
2960
|
+
o("desc");
|
|
2961
|
+
},
|
|
2962
|
+
className: "ssg-menu-item",
|
|
2963
|
+
children: [/* @__PURE__ */ d("span", {
|
|
2964
|
+
className: m("ssg-menu-sort-icon", a === "desc" && "ssg-menu-sort-icon--active"),
|
|
2965
|
+
children: a === "desc" ? "✓" : "↓"
|
|
2966
|
+
}), /* @__PURE__ */ d("span", {
|
|
2967
|
+
className: m("ssg-menu-label", a === "desc" && "ssg-menu-label--sorted"),
|
|
2968
|
+
children: "降順で並び替え"
|
|
2969
|
+
})]
|
|
2970
|
+
}),
|
|
2971
|
+
/* @__PURE__ */ f("button", {
|
|
2972
|
+
type: "button",
|
|
2973
|
+
onPointerEnter: () => {
|
|
2974
|
+
E(null);
|
|
2975
|
+
},
|
|
2976
|
+
onClick: () => {
|
|
2977
|
+
s();
|
|
2978
|
+
},
|
|
2979
|
+
className: "ssg-menu-item",
|
|
2980
|
+
children: [/* @__PURE__ */ d("span", { className: "ssg-menu-icon" }), /* @__PURE__ */ d("span", {
|
|
2981
|
+
className: "ssg-menu-label",
|
|
2982
|
+
children: "並び替えを管理…"
|
|
2983
|
+
})]
|
|
2984
|
+
}),
|
|
2985
|
+
/* @__PURE__ */ d("div", { className: "ssg-menu-separator" })
|
|
2986
|
+
] }),
|
|
2987
|
+
/* @__PURE__ */ f("div", {
|
|
2988
|
+
className: "ssg-menu-submenu-anchor",
|
|
2989
|
+
children: [/* @__PURE__ */ f("button", {
|
|
2990
|
+
type: "button",
|
|
2991
|
+
onPointerEnter: () => {
|
|
2992
|
+
E(In);
|
|
2993
|
+
},
|
|
2994
|
+
onClick: () => {
|
|
2995
|
+
E((e) => e === In ? null : In);
|
|
2996
|
+
},
|
|
2997
|
+
className: m("ssg-menu-item", D && "ssg-menu-item--active"),
|
|
2998
|
+
children: [
|
|
2999
|
+
/* @__PURE__ */ d("span", { className: "ssg-menu-icon" }),
|
|
3000
|
+
/* @__PURE__ */ d("span", {
|
|
3001
|
+
className: "ssg-menu-label",
|
|
3002
|
+
children: "列の固定"
|
|
3003
|
+
}),
|
|
3004
|
+
/* @__PURE__ */ d("span", {
|
|
3005
|
+
className: "ssg-menu-caret",
|
|
3006
|
+
children: "›"
|
|
3007
|
+
})
|
|
3008
|
+
]
|
|
3009
|
+
}), D && /* @__PURE__ */ f("div", {
|
|
3010
|
+
className: "ssg-menu-panel",
|
|
3011
|
+
style: A,
|
|
3012
|
+
children: [Mn.map((e) => {
|
|
3013
|
+
let t = l === e.value;
|
|
3014
|
+
return /* @__PURE__ */ f("button", {
|
|
3015
|
+
type: "button",
|
|
3016
|
+
disabled: !h,
|
|
3017
|
+
onClick: () => {
|
|
3018
|
+
h && v(n, e.value);
|
|
3019
|
+
},
|
|
3020
|
+
className: "ssg-menu-item",
|
|
3021
|
+
children: [/* @__PURE__ */ d("span", {
|
|
3022
|
+
className: m("ssg-menu-check", !t && "ssg-menu-check--hidden"),
|
|
3023
|
+
children: "✓"
|
|
3024
|
+
}), /* @__PURE__ */ d("span", {
|
|
3025
|
+
className: "ssg-menu-label",
|
|
3026
|
+
children: e.label
|
|
3027
|
+
})]
|
|
3028
|
+
}, e.label);
|
|
3029
|
+
}), !h && /* @__PURE__ */ d("div", {
|
|
3030
|
+
className: "ssg-menu-note",
|
|
3031
|
+
children: "onColumnsChange 未指定のため固定状態を変更できません"
|
|
3032
|
+
})]
|
|
3033
|
+
})]
|
|
3034
|
+
}),
|
|
3035
|
+
/* @__PURE__ */ f("button", {
|
|
3036
|
+
type: "button",
|
|
3037
|
+
onPointerEnter: () => {
|
|
3038
|
+
E(null);
|
|
3039
|
+
},
|
|
3040
|
+
onClick: () => {
|
|
3041
|
+
y(n);
|
|
3042
|
+
},
|
|
3043
|
+
className: "ssg-menu-item",
|
|
3044
|
+
children: [/* @__PURE__ */ d("span", { className: "ssg-menu-icon" }), /* @__PURE__ */ d("span", {
|
|
3045
|
+
className: "ssg-menu-label",
|
|
3046
|
+
children: "この列の幅を自動調整"
|
|
3047
|
+
})]
|
|
3048
|
+
}),
|
|
3049
|
+
/* @__PURE__ */ f("button", {
|
|
3050
|
+
type: "button",
|
|
3051
|
+
onPointerEnter: () => {
|
|
3052
|
+
E(null);
|
|
3053
|
+
},
|
|
3054
|
+
onClick: () => {
|
|
3055
|
+
b();
|
|
3056
|
+
},
|
|
3057
|
+
className: "ssg-menu-item",
|
|
3058
|
+
children: [/* @__PURE__ */ d("span", { className: "ssg-menu-icon" }), /* @__PURE__ */ d("span", {
|
|
3059
|
+
className: "ssg-menu-label",
|
|
3060
|
+
children: "すべての列の幅を自動調整"
|
|
3061
|
+
})]
|
|
3062
|
+
}),
|
|
3063
|
+
/* @__PURE__ */ f("button", {
|
|
3064
|
+
type: "button",
|
|
3065
|
+
onPointerEnter: () => {
|
|
3066
|
+
E(null);
|
|
3067
|
+
},
|
|
3068
|
+
onClick: () => {
|
|
3069
|
+
x();
|
|
3070
|
+
},
|
|
3071
|
+
className: "ssg-menu-item",
|
|
3072
|
+
children: [/* @__PURE__ */ d("span", { className: "ssg-menu-icon" }), /* @__PURE__ */ d("span", {
|
|
3073
|
+
className: "ssg-menu-label",
|
|
3074
|
+
children: "列の表示"
|
|
3075
|
+
})]
|
|
3076
|
+
}),
|
|
3077
|
+
/* @__PURE__ */ f("button", {
|
|
3078
|
+
type: "button",
|
|
3079
|
+
"aria-disabled": !S,
|
|
3080
|
+
tabIndex: S ? 0 : -1,
|
|
3081
|
+
title: S ? "すべての列の幅・固定・表示を初期状態に戻します" : "onColumnsChange 未指定のため列をリセットできません",
|
|
3082
|
+
onPointerEnter: () => {
|
|
3083
|
+
E(null);
|
|
3084
|
+
},
|
|
3085
|
+
onClick: () => {
|
|
3086
|
+
S && C();
|
|
3087
|
+
},
|
|
3088
|
+
className: m("ssg-menu-item", !S && "ssg-menu-item--disabled"),
|
|
3089
|
+
children: [/* @__PURE__ */ d("span", { className: "ssg-menu-icon" }), /* @__PURE__ */ d("span", {
|
|
3090
|
+
className: "ssg-menu-label",
|
|
3091
|
+
children: "列のリセット"
|
|
3092
|
+
})]
|
|
3093
|
+
}),
|
|
3094
|
+
/* @__PURE__ */ d("div", {
|
|
3095
|
+
className: "ssg-menu-footer",
|
|
3096
|
+
children: /* @__PURE__ */ d("button", {
|
|
3097
|
+
type: "button",
|
|
3098
|
+
onClick: w,
|
|
3099
|
+
className: "ssg-menu-close-btn",
|
|
3100
|
+
children: "閉じる"
|
|
3101
|
+
})
|
|
3102
|
+
})
|
|
3103
|
+
]
|
|
3104
|
+
}), document.body);
|
|
3105
|
+
}
|
|
3106
|
+
//#endregion
|
|
3107
|
+
//#region src/components/spreadsheet-grid/hooks/useColumnChooserController.ts
|
|
3108
|
+
var Rn = 280, zn = 8, Bn = 12, Vn = ({ enableColumnMenu: e, gridRootRef: n }) => {
|
|
3109
|
+
let [i, a] = c(!1), [o, l] = c(null), u = s(null), d = t(() => {
|
|
3110
|
+
let e = n.current;
|
|
3111
|
+
if (!e) {
|
|
3112
|
+
l(null);
|
|
3113
|
+
return;
|
|
3114
|
+
}
|
|
3115
|
+
let t = e.getBoundingClientRect(), r = t.right - Rn - Bn, i = t.top + Bn;
|
|
3116
|
+
r = Math.max(zn, r), r = Math.min(r, window.innerWidth - Rn - zn), i = Math.max(zn, i), l((e) => e && e.top === i && e.left === r && e.width === Rn ? e : {
|
|
3117
|
+
top: i,
|
|
3118
|
+
left: r,
|
|
3119
|
+
width: Rn
|
|
3120
|
+
});
|
|
3121
|
+
}, [n]), f = t(() => {
|
|
3122
|
+
e && (document.activeElement instanceof HTMLElement && document.activeElement.blur(), n.current?.blur(), a(!0));
|
|
3123
|
+
}, [e, n]), p = t(() => {
|
|
3124
|
+
a(!1), l(null), requestAnimationFrame(() => {
|
|
3125
|
+
n.current?.focus();
|
|
3126
|
+
});
|
|
3127
|
+
}, [n]);
|
|
3128
|
+
return r(() => {
|
|
3129
|
+
if (!i) return;
|
|
3130
|
+
d();
|
|
3131
|
+
let e = () => {
|
|
3132
|
+
d();
|
|
3133
|
+
};
|
|
3134
|
+
return window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
3135
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
3136
|
+
};
|
|
3137
|
+
}, [i, d]), r(() => {
|
|
3138
|
+
if (!i) return;
|
|
3139
|
+
let e = (e) => {
|
|
3140
|
+
let t = e.target;
|
|
3141
|
+
t && (u.current?.contains(t) || p());
|
|
3142
|
+
};
|
|
3143
|
+
return window.addEventListener("pointerdown", e), () => {
|
|
3144
|
+
window.removeEventListener("pointerdown", e);
|
|
3145
|
+
};
|
|
3146
|
+
}, [p, i]), r(() => {
|
|
3147
|
+
if (!i) return;
|
|
3148
|
+
let e = (e) => {
|
|
3149
|
+
e.key === "Escape" && (e.preventDefault(), p());
|
|
3150
|
+
};
|
|
3151
|
+
return window.addEventListener("keydown", e), () => {
|
|
3152
|
+
window.removeEventListener("keydown", e);
|
|
3153
|
+
};
|
|
3154
|
+
}, [p, i]), {
|
|
3155
|
+
isColumnChooserOpen: i,
|
|
3156
|
+
columnChooserLayout: o,
|
|
3157
|
+
columnChooserRef: u,
|
|
3158
|
+
openColumnChooser: f,
|
|
3159
|
+
closeColumnChooser: p
|
|
3160
|
+
};
|
|
3161
|
+
}, Hn = 28, Un = 12, Wn = [
|
|
3162
|
+
"left",
|
|
3163
|
+
"center",
|
|
3164
|
+
"right"
|
|
3165
|
+
], Z = {
|
|
3166
|
+
left: "左固定",
|
|
3167
|
+
center: "固定なし",
|
|
3168
|
+
right: "右固定"
|
|
3169
|
+
};
|
|
3170
|
+
function Gn(e, t, n) {
|
|
3171
|
+
let r = e.find((e) => e.key === t);
|
|
3172
|
+
if (!r) return null;
|
|
3173
|
+
let i = r.pane, a = {
|
|
3174
|
+
left: [],
|
|
3175
|
+
center: [],
|
|
3176
|
+
right: []
|
|
3177
|
+
};
|
|
3178
|
+
for (let t of e) a[t.pane].push(t.key);
|
|
3179
|
+
let o = a[i], s = o.indexOf(t);
|
|
3180
|
+
if (s < 0) return null;
|
|
3181
|
+
let c = n;
|
|
3182
|
+
if (c > s && --c, c = Math.max(0, Math.min(c, o.length - 1)), c === s) return null;
|
|
3183
|
+
let [l] = o.splice(s, 1);
|
|
3184
|
+
return o.splice(c, 0, l), [
|
|
3185
|
+
...a.left,
|
|
3186
|
+
...a.center,
|
|
3187
|
+
...a.right
|
|
3188
|
+
];
|
|
3189
|
+
}
|
|
3190
|
+
function Kn({ state: e, disabled: t }) {
|
|
3191
|
+
return /* @__PURE__ */ f("span", {
|
|
3192
|
+
className: m("ssg-checkbox", (e === "checked" || e === "indeterminate") && "ssg-checkbox--filled", t && "ssg-checkbox--disabled"),
|
|
3193
|
+
"aria-hidden": !0,
|
|
3194
|
+
children: [e === "checked" && /* @__PURE__ */ d("svg", {
|
|
3195
|
+
width: "11",
|
|
3196
|
+
height: "11",
|
|
3197
|
+
viewBox: "0 0 12 12",
|
|
3198
|
+
fill: "none",
|
|
3199
|
+
children: /* @__PURE__ */ d("path", {
|
|
3200
|
+
d: "M2.5 6.2 4.7 8.4 9.5 3.6",
|
|
3201
|
+
stroke: "#ffffff",
|
|
3202
|
+
strokeWidth: "1.8",
|
|
3203
|
+
strokeLinecap: "round",
|
|
3204
|
+
strokeLinejoin: "round"
|
|
3205
|
+
})
|
|
3206
|
+
}), e === "indeterminate" && /* @__PURE__ */ d("span", { className: "ssg-checkbox-dash" })]
|
|
3207
|
+
});
|
|
3208
|
+
}
|
|
3209
|
+
function qn({ disabled: e }) {
|
|
3210
|
+
return /* @__PURE__ */ d("svg", {
|
|
3211
|
+
width: "10",
|
|
3212
|
+
height: "16",
|
|
3213
|
+
viewBox: "0 0 10 16",
|
|
3214
|
+
fill: e ? "#cbd5e1" : "#94a3b8",
|
|
3215
|
+
"aria-hidden": !0,
|
|
3216
|
+
children: [
|
|
3217
|
+
3,
|
|
3218
|
+
8,
|
|
3219
|
+
13
|
|
3220
|
+
].map((e) => [3, 7].map((t) => /* @__PURE__ */ d("circle", {
|
|
3221
|
+
cx: t,
|
|
3222
|
+
cy: e,
|
|
3223
|
+
r: "1.2"
|
|
3224
|
+
}, `${t}-${e}`)))
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
function Jn({ isOpen: e, items: n, canToggle: i, layout: o, panelRef: l, onToggleColumnVisibility: u, onShowAllColumns: h, onResetColumns: g, onReorderColumns: _, onRequestClose: v }) {
|
|
3228
|
+
let [y, b] = c(""), x = s(null);
|
|
3229
|
+
r(() => {
|
|
3230
|
+
if (e) {
|
|
3231
|
+
b("");
|
|
3232
|
+
let e = requestAnimationFrame(() => {
|
|
3233
|
+
x.current?.focus();
|
|
3234
|
+
});
|
|
3235
|
+
return () => cancelAnimationFrame(e);
|
|
3236
|
+
}
|
|
3237
|
+
}, [e]);
|
|
3238
|
+
let S = a(() => n.filter((e) => e.visible).length, [n]), C = S === n.length && n.length > 0, w = C ? "checked" : "indeterminate", T = a(() => {
|
|
3239
|
+
let e = y.trim().toLowerCase();
|
|
3240
|
+
return e ? n.filter((t) => t.title.toLowerCase().includes(e)) : n;
|
|
3241
|
+
}, [n, y]), E = a(() => {
|
|
3242
|
+
let e = {
|
|
3243
|
+
left: [],
|
|
3244
|
+
center: [],
|
|
3245
|
+
right: []
|
|
3246
|
+
};
|
|
3247
|
+
for (let t of T) e[t.pane].push(t);
|
|
3248
|
+
return Wn.map((t) => ({
|
|
3249
|
+
pane: t,
|
|
3250
|
+
items: e[t]
|
|
3251
|
+
})).filter((e) => e.items.length > 0);
|
|
3252
|
+
}, [T]), D = E.length >= 2, O = i && y.trim() === "", k = s(null), [A, j] = c(null), M = s(!1), N = s(null), [P, F] = c(null), I = s(0), L = s(null), ee = t(() => {
|
|
3253
|
+
let e = k.current, t = N.current;
|
|
3254
|
+
if (!e || !t) return;
|
|
3255
|
+
let n = e.querySelectorAll(`[data-chooser-row][data-chooser-pane="${t}"]`), r = I.current, i = n.length;
|
|
3256
|
+
for (let e = 0; e < n.length; e += 1) {
|
|
3257
|
+
let t = n[e].getBoundingClientRect();
|
|
3258
|
+
if (r < t.top + t.height / 2) {
|
|
3259
|
+
i = e;
|
|
3260
|
+
break;
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
F(i);
|
|
3264
|
+
}, []), te = t(() => {
|
|
3265
|
+
let e = k.current;
|
|
3266
|
+
if (!e || !M.current) {
|
|
3267
|
+
L.current = null;
|
|
3268
|
+
return;
|
|
3269
|
+
}
|
|
3270
|
+
let t = e.getBoundingClientRect(), n = I.current, r = 0;
|
|
3271
|
+
if (n < t.top + Hn ? r = -12 : n > t.bottom - Hn && (r = Un), r !== 0) {
|
|
3272
|
+
let t = e.scrollTop;
|
|
3273
|
+
e.scrollTop += r, e.scrollTop !== t && ee();
|
|
3274
|
+
}
|
|
3275
|
+
L.current = requestAnimationFrame(te);
|
|
3276
|
+
}, [ee]), ne = t((e) => {
|
|
3277
|
+
L.current !== null && (cancelAnimationFrame(L.current), L.current = null);
|
|
3278
|
+
let t = A, r = P;
|
|
3279
|
+
if (M.current = !1, N.current = null, j(null), F(null), e && t !== null && r !== null) {
|
|
3280
|
+
let e = Gn(n, t, r);
|
|
3281
|
+
e && _(e);
|
|
3282
|
+
}
|
|
3283
|
+
}, [
|
|
3284
|
+
A,
|
|
3285
|
+
P,
|
|
3286
|
+
n,
|
|
3287
|
+
_
|
|
3288
|
+
]), re = t((e, t, n) => {
|
|
3289
|
+
O && (n.preventDefault(), n.stopPropagation(), n.currentTarget.setPointerCapture(n.pointerId), M.current = !0, N.current = t, I.current = n.clientY, j(e), ee(), L.current === null && (L.current = requestAnimationFrame(te)));
|
|
3290
|
+
}, [
|
|
3291
|
+
O,
|
|
3292
|
+
ee,
|
|
3293
|
+
te
|
|
3294
|
+
]), ie = t((e) => {
|
|
3295
|
+
M.current && (I.current = e.clientY, ee());
|
|
3296
|
+
}, [ee]), ae = t(() => {
|
|
3297
|
+
M.current && ne(!0);
|
|
3298
|
+
}, [ne]), R = t(() => {
|
|
3299
|
+
M.current && ne(!1);
|
|
3300
|
+
}, [ne]);
|
|
3301
|
+
if (r(() => {
|
|
3302
|
+
e || (M.current = !1, N.current = null, j(null), F(null), L.current !== null && (cancelAnimationFrame(L.current), L.current = null));
|
|
3303
|
+
}, [e]), r(() => () => {
|
|
3304
|
+
L.current !== null && (cancelAnimationFrame(L.current), L.current = null);
|
|
3305
|
+
}, []), !e || !o) return null;
|
|
3306
|
+
let oe = {
|
|
3307
|
+
top: o.top,
|
|
3308
|
+
left: o.left,
|
|
3309
|
+
width: o.width
|
|
3310
|
+
}, se = (e) => {
|
|
3311
|
+
e.stopPropagation();
|
|
3312
|
+
}, ce = (e) => {
|
|
3313
|
+
e.stopPropagation();
|
|
3314
|
+
}, le = () => {
|
|
3315
|
+
i && (C || h());
|
|
3316
|
+
}, ue = A === null ? null : n.find((e) => e.key === A)?.pane ?? null, de = (e, t, n) => {
|
|
3317
|
+
let r = e.visible && S === 1, a = !i || r, o = A === e.key;
|
|
3318
|
+
return /* @__PURE__ */ f("div", {
|
|
3319
|
+
"data-chooser-row": "",
|
|
3320
|
+
"data-chooser-pane": n,
|
|
3321
|
+
className: m("ssg-chooser-row", A !== null && ue === n && P === t && "ssg-chooser-row--drop-before", o && "ssg-chooser-row--dragging"),
|
|
3322
|
+
children: [/* @__PURE__ */ d("span", {
|
|
3323
|
+
role: "button",
|
|
3324
|
+
"aria-label": "ドラッグして並べ替え",
|
|
3325
|
+
title: i ? y.trim() === "" ? "ドラッグして並べ替え(同じセクション内のみ)" : "検索中は並べ替えできません" : "onColumnsChange 未指定のため並べ替えできません",
|
|
3326
|
+
onPointerDown: (t) => re(e.key, n, t),
|
|
3327
|
+
onPointerMove: ie,
|
|
3328
|
+
onPointerUp: ae,
|
|
3329
|
+
onPointerCancel: R,
|
|
3330
|
+
className: m("ssg-chooser-handle", !O && "ssg-chooser-handle--disabled", o && "ssg-chooser-handle--dragging"),
|
|
3331
|
+
children: /* @__PURE__ */ d(qn, { disabled: !O })
|
|
3332
|
+
}), /* @__PURE__ */ f("button", {
|
|
3333
|
+
type: "button",
|
|
3334
|
+
disabled: a,
|
|
3335
|
+
onClick: () => {
|
|
3336
|
+
a || u(e.key, !e.visible);
|
|
3337
|
+
},
|
|
3338
|
+
className: "ssg-chooser-toggle",
|
|
3339
|
+
children: [/* @__PURE__ */ d(Kn, {
|
|
3340
|
+
state: e.visible ? "checked" : "unchecked",
|
|
3341
|
+
disabled: a
|
|
3342
|
+
}), /* @__PURE__ */ d("span", {
|
|
3343
|
+
className: m("ssg-chooser-label", a && !e.visible && "ssg-chooser-label--muted"),
|
|
3344
|
+
children: e.title
|
|
3345
|
+
})]
|
|
3346
|
+
})]
|
|
3347
|
+
}, e.key);
|
|
3348
|
+
};
|
|
3349
|
+
return p(/* @__PURE__ */ f("div", {
|
|
3350
|
+
ref: l,
|
|
3351
|
+
onPointerDown: se,
|
|
3352
|
+
onKeyDownCapture: ce,
|
|
3353
|
+
onContextMenu: (e) => {
|
|
3354
|
+
e.preventDefault();
|
|
3355
|
+
},
|
|
3356
|
+
className: "ssg-popover ssg-chooser-panel",
|
|
3357
|
+
style: oe,
|
|
3358
|
+
children: [
|
|
3359
|
+
/* @__PURE__ */ f("div", {
|
|
3360
|
+
className: "ssg-popover-header",
|
|
3361
|
+
children: [/* @__PURE__ */ d("span", {
|
|
3362
|
+
className: "ssg-popover-title",
|
|
3363
|
+
children: "列の表示"
|
|
3364
|
+
}), /* @__PURE__ */ d("button", {
|
|
3365
|
+
type: "button",
|
|
3366
|
+
onClick: v,
|
|
3367
|
+
"aria-label": "閉じる",
|
|
3368
|
+
className: "ssg-popover-close",
|
|
3369
|
+
children: "×"
|
|
3370
|
+
})]
|
|
3371
|
+
}),
|
|
3372
|
+
/* @__PURE__ */ f("div", {
|
|
3373
|
+
className: "ssg-chooser-search-row",
|
|
3374
|
+
children: [/* @__PURE__ */ d("button", {
|
|
3375
|
+
type: "button",
|
|
3376
|
+
disabled: !i,
|
|
3377
|
+
onClick: le,
|
|
3378
|
+
"aria-label": "すべての列を表示",
|
|
3379
|
+
title: "すべての列を表示",
|
|
3380
|
+
className: "ssg-chooser-master-btn",
|
|
3381
|
+
children: /* @__PURE__ */ d(Kn, {
|
|
3382
|
+
state: w,
|
|
3383
|
+
disabled: !i
|
|
3384
|
+
})
|
|
3385
|
+
}), /* @__PURE__ */ f("div", {
|
|
3386
|
+
className: "ssg-chooser-search-field",
|
|
3387
|
+
children: [/* @__PURE__ */ d("span", {
|
|
3388
|
+
"aria-hidden": !0,
|
|
3389
|
+
className: "ssg-chooser-search-icon",
|
|
3390
|
+
children: "⌕"
|
|
3391
|
+
}), /* @__PURE__ */ d("input", {
|
|
3392
|
+
ref: x,
|
|
3393
|
+
type: "text",
|
|
3394
|
+
value: y,
|
|
3395
|
+
onChange: (e) => b(e.target.value),
|
|
3396
|
+
placeholder: "検索...",
|
|
3397
|
+
className: "ssg-chooser-search-input"
|
|
3398
|
+
})]
|
|
3399
|
+
})]
|
|
3400
|
+
}),
|
|
3401
|
+
/* @__PURE__ */ d("div", {
|
|
3402
|
+
ref: k,
|
|
3403
|
+
className: "ssg-chooser-list",
|
|
3404
|
+
children: T.length === 0 ? /* @__PURE__ */ d("div", {
|
|
3405
|
+
className: "ssg-chooser-empty",
|
|
3406
|
+
children: "該当する列がありません"
|
|
3407
|
+
}) : E.map((e) => /* @__PURE__ */ f("div", {
|
|
3408
|
+
"data-chooser-section": e.pane,
|
|
3409
|
+
children: [
|
|
3410
|
+
D && /* @__PURE__ */ d("div", {
|
|
3411
|
+
className: "ssg-chooser-section-heading",
|
|
3412
|
+
children: Z[e.pane]
|
|
3413
|
+
}),
|
|
3414
|
+
e.items.map((t, n) => de(t, n, e.pane)),
|
|
3415
|
+
A !== null && ue === e.pane && P === e.items.length && /* @__PURE__ */ d("div", { className: "ssg-chooser-drop-end" })
|
|
3416
|
+
]
|
|
3417
|
+
}, e.pane))
|
|
3418
|
+
}),
|
|
3419
|
+
/* @__PURE__ */ f("div", {
|
|
3420
|
+
className: "ssg-chooser-footer",
|
|
3421
|
+
children: [/* @__PURE__ */ d("button", {
|
|
3422
|
+
type: "button",
|
|
3423
|
+
disabled: !i,
|
|
3424
|
+
onClick: () => {
|
|
3425
|
+
i && g();
|
|
3426
|
+
},
|
|
3427
|
+
title: "すべての列の幅・固定・表示を初期状態に戻します",
|
|
3428
|
+
className: "ssg-chooser-reset-btn",
|
|
3429
|
+
children: "すべての列を初期状態に戻す"
|
|
3430
|
+
}), !i && /* @__PURE__ */ d("div", {
|
|
3431
|
+
className: "ssg-chooser-note",
|
|
3432
|
+
children: "onColumnsChange 未指定のため表示/非表示・リセットを変更できません"
|
|
3433
|
+
})]
|
|
3434
|
+
})
|
|
3435
|
+
]
|
|
3436
|
+
}), document.body);
|
|
3437
|
+
}
|
|
3438
|
+
//#endregion
|
|
3439
|
+
//#region src/components/spreadsheet-grid/hooks/useSortManagementController.ts
|
|
3440
|
+
var Q = 320, Yn = 8, Xn = 12, Zn = ({ enableSorting: e, gridRootRef: n }) => {
|
|
3441
|
+
let [i, a] = c(!1), [o, l] = c(null), u = s(null), d = t(() => {
|
|
3442
|
+
let e = n.current;
|
|
3443
|
+
if (!e) {
|
|
3444
|
+
l(null);
|
|
3445
|
+
return;
|
|
3446
|
+
}
|
|
3447
|
+
let t = e.getBoundingClientRect(), r = t.right - Q - Xn, i = t.top + Xn;
|
|
3448
|
+
r = Math.max(Yn, r), r = Math.min(r, window.innerWidth - Q - Yn), i = Math.max(Yn, i), l((e) => e && e.top === i && e.left === r && e.width === Q ? e : {
|
|
3449
|
+
top: i,
|
|
3450
|
+
left: r,
|
|
3451
|
+
width: Q
|
|
3452
|
+
});
|
|
3453
|
+
}, [n]), f = t(() => {
|
|
3454
|
+
e && (document.activeElement instanceof HTMLElement && document.activeElement.blur(), n.current?.blur(), a(!0));
|
|
3455
|
+
}, [e, n]), p = t(() => {
|
|
3456
|
+
a(!1), l(null), requestAnimationFrame(() => {
|
|
3457
|
+
n.current?.focus();
|
|
3458
|
+
});
|
|
3459
|
+
}, [n]);
|
|
3460
|
+
return r(() => {
|
|
3461
|
+
if (!i) return;
|
|
3462
|
+
d();
|
|
3463
|
+
let e = () => {
|
|
3464
|
+
d();
|
|
3465
|
+
};
|
|
3466
|
+
return window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
3467
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
3468
|
+
};
|
|
3469
|
+
}, [i, d]), r(() => {
|
|
3470
|
+
if (!i) return;
|
|
3471
|
+
let e = (e) => {
|
|
3472
|
+
let t = e.target;
|
|
3473
|
+
t && (u.current?.contains(t) || p());
|
|
3474
|
+
};
|
|
3475
|
+
return window.addEventListener("pointerdown", e), () => {
|
|
3476
|
+
window.removeEventListener("pointerdown", e);
|
|
3477
|
+
};
|
|
3478
|
+
}, [p, i]), r(() => {
|
|
3479
|
+
if (!i) return;
|
|
3480
|
+
let e = (e) => {
|
|
3481
|
+
e.key === "Escape" && (e.preventDefault(), p());
|
|
3482
|
+
};
|
|
3483
|
+
return window.addEventListener("keydown", e), () => {
|
|
3484
|
+
window.removeEventListener("keydown", e);
|
|
3485
|
+
};
|
|
3486
|
+
}, [p, i]), {
|
|
3487
|
+
isSortManagerOpen: i,
|
|
3488
|
+
sortManagerLayout: o,
|
|
3489
|
+
sortManagerRef: u,
|
|
3490
|
+
openSortManager: f,
|
|
3491
|
+
closeSortManager: p
|
|
3492
|
+
};
|
|
3493
|
+
};
|
|
3494
|
+
//#endregion
|
|
3495
|
+
//#region src/components/spreadsheet-grid/view/SortManagementPanel.tsx
|
|
3496
|
+
function Qn({ disabled: e }) {
|
|
3497
|
+
return /* @__PURE__ */ d("svg", {
|
|
3498
|
+
width: "10",
|
|
3499
|
+
height: "16",
|
|
3500
|
+
viewBox: "0 0 10 16",
|
|
3501
|
+
fill: e ? "#cbd5e1" : "#94a3b8",
|
|
3502
|
+
"aria-hidden": !0,
|
|
3503
|
+
children: [
|
|
3504
|
+
3,
|
|
3505
|
+
8,
|
|
3506
|
+
13
|
|
3507
|
+
].map((e) => [3, 7].map((t) => /* @__PURE__ */ d("circle", {
|
|
3508
|
+
cx: t,
|
|
3509
|
+
cy: e,
|
|
3510
|
+
r: "1.2"
|
|
3511
|
+
}, `${t}-${e}`)))
|
|
3512
|
+
});
|
|
3513
|
+
}
|
|
3514
|
+
function $n({ isOpen: e, entries: n, columns: i, canSort: o, layout: l, panelRef: u, onAddLevel: h, onChangeDirection: g, onChangeColumn: _, onRemoveLevel: v, onClearAll: y, onMove: b, onRequestClose: x }) {
|
|
3515
|
+
let S = a(() => new Set(n.map((e) => e.columnKey)), [n]), C = a(() => i.find((e) => !S.has(e.key)) ?? null, [i, S]), w = (e) => i.find((t) => t.key === e)?.title ?? e, T = o && n.length >= 2, E = s(null), [D, O] = c(null), k = s(!1), [A, j] = c(null), M = s(0), N = t(() => {
|
|
3516
|
+
let e = E.current;
|
|
3517
|
+
if (!e) return;
|
|
3518
|
+
let t = e.querySelectorAll("[data-sort-level]"), n = M.current, r = t.length;
|
|
3519
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
3520
|
+
let i = t[e].getBoundingClientRect();
|
|
3521
|
+
if (n < i.top + i.height / 2) {
|
|
3522
|
+
r = e;
|
|
3523
|
+
break;
|
|
3524
|
+
}
|
|
3525
|
+
}
|
|
3526
|
+
j(r);
|
|
3527
|
+
}, []), P = t((e) => {
|
|
3528
|
+
let t = D, n = A;
|
|
3529
|
+
if (k.current = !1, O(null), j(null), e && t !== null && n !== null) {
|
|
3530
|
+
let e = n;
|
|
3531
|
+
e > t && --e, b(t, e);
|
|
3532
|
+
}
|
|
3533
|
+
}, [
|
|
3534
|
+
D,
|
|
3535
|
+
A,
|
|
3536
|
+
b
|
|
3537
|
+
]), F = t((e, t) => {
|
|
3538
|
+
T && (t.preventDefault(), t.stopPropagation(), t.currentTarget.setPointerCapture(t.pointerId), k.current = !0, M.current = t.clientY, O(e), N());
|
|
3539
|
+
}, [T, N]), I = t((e) => {
|
|
3540
|
+
k.current && (M.current = e.clientY, N());
|
|
3541
|
+
}, [N]), L = t(() => {
|
|
3542
|
+
k.current && P(!0);
|
|
3543
|
+
}, [P]), ee = t(() => {
|
|
3544
|
+
k.current && P(!1);
|
|
3545
|
+
}, [P]);
|
|
3546
|
+
if (r(() => {
|
|
3547
|
+
e || (k.current = !1, O(null), j(null));
|
|
3548
|
+
}, [e]), !e || !l) return null;
|
|
3549
|
+
let te = {
|
|
3550
|
+
top: l.top,
|
|
3551
|
+
left: l.left,
|
|
3552
|
+
width: l.width
|
|
3553
|
+
}, ne = (e) => {
|
|
3554
|
+
e.stopPropagation();
|
|
3555
|
+
}, re = (e) => {
|
|
3556
|
+
e.stopPropagation();
|
|
3557
|
+
}, ie = o && C !== null;
|
|
3558
|
+
return p(/* @__PURE__ */ f("div", {
|
|
3559
|
+
ref: u,
|
|
3560
|
+
onPointerDown: ne,
|
|
3561
|
+
onKeyDownCapture: re,
|
|
3562
|
+
onContextMenu: (e) => {
|
|
3563
|
+
e.preventDefault();
|
|
3564
|
+
},
|
|
3565
|
+
className: "ssg-popover ssg-sort-panel",
|
|
3566
|
+
style: te,
|
|
3567
|
+
children: [
|
|
3568
|
+
/* @__PURE__ */ f("div", {
|
|
3569
|
+
className: "ssg-popover-header",
|
|
3570
|
+
children: [/* @__PURE__ */ d("span", {
|
|
3571
|
+
className: "ssg-popover-title",
|
|
3572
|
+
children: "並び替え"
|
|
3573
|
+
}), /* @__PURE__ */ d("button", {
|
|
3574
|
+
type: "button",
|
|
3575
|
+
onClick: x,
|
|
3576
|
+
"aria-label": "閉じる",
|
|
3577
|
+
className: "ssg-popover-close",
|
|
3578
|
+
children: "×"
|
|
3579
|
+
})]
|
|
3580
|
+
}),
|
|
3581
|
+
/* @__PURE__ */ f("div", {
|
|
3582
|
+
ref: E,
|
|
3583
|
+
className: "ssg-sort-list",
|
|
3584
|
+
children: [n.length === 0 ? /* @__PURE__ */ d("div", {
|
|
3585
|
+
className: "ssg-sort-empty",
|
|
3586
|
+
children: "並び替えは設定されていません"
|
|
3587
|
+
}) : n.map((e, t) => {
|
|
3588
|
+
let r = i.filter((t) => t.key === e.columnKey || !S.has(t.key)), a = r.some((t) => t.key === e.columnKey) ? r : [{
|
|
3589
|
+
key: e.columnKey,
|
|
3590
|
+
title: w(e.columnKey)
|
|
3591
|
+
}, ...r], s = D === t;
|
|
3592
|
+
return /* @__PURE__ */ f("div", {
|
|
3593
|
+
"data-sort-level": "",
|
|
3594
|
+
className: m("ssg-sort-level", D !== null && A === t && "ssg-sort-level--drop-before", s && "ssg-sort-level--dragging"),
|
|
3595
|
+
children: [
|
|
3596
|
+
/* @__PURE__ */ d("span", {
|
|
3597
|
+
role: "button",
|
|
3598
|
+
"aria-label": "ドラッグして優先順位を変更",
|
|
3599
|
+
title: o ? n.length < 2 ? "レベルが 2 件以上のとき並べ替えできます" : "ドラッグして優先順位を変更" : "並び替えが無効です",
|
|
3600
|
+
onPointerDown: (e) => F(t, e),
|
|
3601
|
+
onPointerMove: I,
|
|
3602
|
+
onPointerUp: L,
|
|
3603
|
+
onPointerCancel: ee,
|
|
3604
|
+
className: m("ssg-sort-handle", !T && "ssg-sort-handle--disabled", s && "ssg-sort-handle--dragging"),
|
|
3605
|
+
children: /* @__PURE__ */ d(Qn, { disabled: !T })
|
|
3606
|
+
}),
|
|
3607
|
+
/* @__PURE__ */ d("span", {
|
|
3608
|
+
"aria-hidden": !0,
|
|
3609
|
+
className: "ssg-sort-badge",
|
|
3610
|
+
children: t + 1
|
|
3611
|
+
}),
|
|
3612
|
+
/* @__PURE__ */ d("select", {
|
|
3613
|
+
value: e.columnKey,
|
|
3614
|
+
disabled: !o,
|
|
3615
|
+
onChange: (e) => _(t, e.target.value),
|
|
3616
|
+
className: "ssg-sort-select",
|
|
3617
|
+
children: a.map((e) => /* @__PURE__ */ d("option", {
|
|
3618
|
+
value: e.key,
|
|
3619
|
+
children: e.title
|
|
3620
|
+
}, e.key))
|
|
3621
|
+
}),
|
|
3622
|
+
/* @__PURE__ */ f("div", {
|
|
3623
|
+
className: "ssg-sort-dir-group",
|
|
3624
|
+
children: [/* @__PURE__ */ d("button", {
|
|
3625
|
+
type: "button",
|
|
3626
|
+
disabled: !o,
|
|
3627
|
+
onClick: () => g(t, "asc"),
|
|
3628
|
+
title: "昇順",
|
|
3629
|
+
className: m("ssg-sort-dir-btn", e.direction === "asc" && "ssg-sort-dir-btn--active"),
|
|
3630
|
+
children: "↑ 昇順"
|
|
3631
|
+
}), /* @__PURE__ */ d("button", {
|
|
3632
|
+
type: "button",
|
|
3633
|
+
disabled: !o,
|
|
3634
|
+
onClick: () => g(t, "desc"),
|
|
3635
|
+
title: "降順",
|
|
3636
|
+
className: m("ssg-sort-dir-btn", e.direction === "desc" && "ssg-sort-dir-btn--active"),
|
|
3637
|
+
children: "↓ 降順"
|
|
3638
|
+
})]
|
|
3639
|
+
}),
|
|
3640
|
+
/* @__PURE__ */ d("button", {
|
|
3641
|
+
type: "button",
|
|
3642
|
+
disabled: !o,
|
|
3643
|
+
onClick: () => v(t),
|
|
3644
|
+
"aria-label": "このレベルを削除",
|
|
3645
|
+
title: "このレベルを削除",
|
|
3646
|
+
className: "ssg-sort-delete",
|
|
3647
|
+
children: "×"
|
|
3648
|
+
})
|
|
3649
|
+
]
|
|
3650
|
+
}, e.columnKey);
|
|
3651
|
+
}), D !== null && A === n.length && /* @__PURE__ */ d("div", { className: "ssg-sort-drop-end" })]
|
|
3652
|
+
}),
|
|
3653
|
+
/* @__PURE__ */ f("div", {
|
|
3654
|
+
className: "ssg-popover-footer",
|
|
3655
|
+
children: [/* @__PURE__ */ d("button", {
|
|
3656
|
+
type: "button",
|
|
3657
|
+
disabled: !ie,
|
|
3658
|
+
onClick: () => {
|
|
3659
|
+
!ie || !C || h(C.key, "asc");
|
|
3660
|
+
},
|
|
3661
|
+
title: o ? C === null ? "すべての列が並び替えに使われています" : "並び替えの基準を追加します" : "並び替えが無効です",
|
|
3662
|
+
className: "ssg-sort-footer-btn ssg-sort-footer-btn--add",
|
|
3663
|
+
children: "+ 基準を追加"
|
|
3664
|
+
}), /* @__PURE__ */ d("button", {
|
|
3665
|
+
type: "button",
|
|
3666
|
+
disabled: !o || n.length === 0,
|
|
3667
|
+
onClick: () => {
|
|
3668
|
+
!o || n.length === 0 || y();
|
|
3669
|
+
},
|
|
3670
|
+
title: "すべての並び替えを解除します",
|
|
3671
|
+
className: "ssg-sort-footer-btn ssg-sort-footer-btn--clear",
|
|
3672
|
+
children: "すべてクリア"
|
|
3673
|
+
})]
|
|
3674
|
+
}),
|
|
3675
|
+
!o && /* @__PURE__ */ d("div", {
|
|
3676
|
+
className: "ssg-sort-note",
|
|
3677
|
+
children: "並び替えが無効のため編集できません"
|
|
3678
|
+
})
|
|
3679
|
+
]
|
|
3680
|
+
}), document.body);
|
|
3681
|
+
}
|
|
3682
|
+
//#endregion
|
|
3683
|
+
//#region src/components/spreadsheet-grid/SpreadsheetGrid.tsx
|
|
3684
|
+
var er = (e, t) => {
|
|
3685
|
+
let n = new Set(e);
|
|
3686
|
+
return n.add(t), n;
|
|
3687
|
+
}, tr = (e, t) => {
|
|
3688
|
+
let n = new Set(e);
|
|
3689
|
+
return n.delete(t), n;
|
|
3690
|
+
}, nr = (e, t) => {
|
|
3691
|
+
let n = new Set(e);
|
|
3692
|
+
for (let e of t) n.add(e);
|
|
3693
|
+
return n;
|
|
3694
|
+
}, rr = (e, t) => {
|
|
3695
|
+
let n = new Set(e);
|
|
3696
|
+
for (let e of t) n.delete(e);
|
|
3697
|
+
return n;
|
|
3698
|
+
}, ir = [], ar = {}, or = {}, sr = [], cr = 300;
|
|
3699
|
+
function lr({ rows: e = ir, dataSource: u, serverSideRefreshToken: p, columns: g, onRowsChange: _, onColumnsChange: v, rowKeyGetter: y, createRow: T, createOverflowColumn: F, rowHeight: I = 36, autoHeight: ne = !1, estimateRowHeight: ae, headerHeight: R = 40, rowHeaderWidth: oe = 56, readOnly: se = !1, canEditCell: ce, enableRangeSelection: ue = !0, enableGlobalFilter: he = !0, enableColumnFilter: _e = !0, enableSorting: z = !0, enableRowHover: ye = !0, enableColumnHeaderHover: be = !0, enableColumnMenu: xe = !0, noMatchingRowsText: Se = "一致する行がありません", noRowsText: Ce = "表示する行がありません", renderTopBar: De, renderBottomBar: Oe, className: ke, classNames: B, getRowClassName: Me }) {
|
|
3700
|
+
let Ne = s(null), Pe = s(null), Fe = s(null), Ie = s(null), Le = s(!1), Re = s(null), ze = s(null), Be = s(null), [Ve, He] = c(""), [Ue, Ke] = c(!1), [qe, Ye] = c(null), [Xe, ot] = c(null), V = a(() => g.filter((e) => e.visible !== !1), [g]), H = a(() => pe(V), [V]), lt = a(() => y ?? ((e, t) => t), [y]), U = u != null, mt = z, ht = _e, gt = he, [W, G] = o(x, V, b), _t = s(W.columnWidths);
|
|
3701
|
+
_t.current = W.columnWidths;
|
|
3702
|
+
let vt = s(null);
|
|
3703
|
+
vt.current === null && (vt.current = new Map(g.map((e) => [e.key, {
|
|
3704
|
+
width: e.width,
|
|
3705
|
+
pinned: e.pinned,
|
|
3706
|
+
visible: e.visible
|
|
3707
|
+
}])));
|
|
3708
|
+
let yt = a(() => E(W.selection), [W.selection]), bt = a(() => me(H), [H]), K = ge(bt.left, W.columnWidths), Tt = ge(bt.center, W.columnWidths), Dt = ge(bt.right, W.columnWidths), Ot = a(() => ve("left", bt.left, K), [bt.left, K]), kt = a(() => ve("center", bt.center, Tt), [bt.center, Tt]), At = a(() => ve("right", bt.right, Dt), [bt.right, Dt]), q = a(() => ({
|
|
3709
|
+
left: Ot,
|
|
3710
|
+
center: kt,
|
|
3711
|
+
right: At
|
|
3712
|
+
}), [
|
|
3713
|
+
Ot,
|
|
3714
|
+
kt,
|
|
3715
|
+
At
|
|
3716
|
+
]), jt = q.left.entries.length > 0, Mt = q.right.entries.length > 0, Nt = !jt, Pt = oe, Ft = Nt ? oe : 0, It = jt ? Pt + q.left.totalWidth : 0, Lt = q.right.totalWidth, Rt = Ft + q.center.totalWidth, zt = It + Rt + Lt, { filterPopoverState: J, filterPopoverLayout: Bt, filterPopoverRef: Vt, filterTextInputRef: Ht, filterSelectRef: Ut, isFilterPopoverOpen: Wt, openedFilterColumn: Y, openColumnFilterPopover: Kt, closeColumnFilterPopover: qt, updateFilterPopoverDraft: Jt } = le({
|
|
3717
|
+
visibleColumns: V,
|
|
3718
|
+
columnFilterValues: W.filters.columnFilters,
|
|
3719
|
+
enableColumnFilter: ht,
|
|
3720
|
+
gridRootRef: Ne
|
|
3721
|
+
}), { columnMenuLayout: Yt, columnMenuRef: Xt, isColumnMenuOpen: Zt, openedMenuColumnKey: Qt, openedMenuColumn: $t, openColumnMenuFromButton: en, openColumnMenuFromContextMenu: tn, closeColumnMenu: X } = jn({
|
|
3722
|
+
visibleColumns: V,
|
|
3723
|
+
enableColumnMenu: xe,
|
|
3724
|
+
gridRootRef: Ne
|
|
3725
|
+
}), { isColumnChooserOpen: rn, columnChooserLayout: an, columnChooserRef: on, openColumnChooser: sn, closeColumnChooser: cn } = Vn({
|
|
3726
|
+
enableColumnMenu: xe,
|
|
3727
|
+
gridRootRef: Ne
|
|
3728
|
+
}), { isSortManagerOpen: pn, sortManagerLayout: mn, sortManagerRef: vn, openSortManager: yn, closeSortManager: bn } = Zn({
|
|
3729
|
+
enableSorting: mt,
|
|
3730
|
+
gridRootRef: Ne
|
|
3731
|
+
});
|
|
3732
|
+
r(() => {
|
|
3733
|
+
let e = V.reduce((e, t) => (e[t.key] = t.width, e), {});
|
|
3734
|
+
G(h.syncColumnWidths(e));
|
|
3735
|
+
}, [V]);
|
|
3736
|
+
let xn = W.filters.globalText, Sn = n(xn), wn = W.filters.columnFilters, Tn = n(wn), Dn = a(() => N(e.length), [e.length]), On = a(() => re(e, Dn, V, Sn), [
|
|
3737
|
+
e,
|
|
3738
|
+
Dn,
|
|
3739
|
+
V,
|
|
3740
|
+
Sn
|
|
3741
|
+
]), kn = a(() => {
|
|
3742
|
+
let e = [];
|
|
3743
|
+
for (let t of V) L(Tn[t.key]) && e.push(t.key);
|
|
3744
|
+
return e.join("\0");
|
|
3745
|
+
}, [V, Tn]), An = a(() => {
|
|
3746
|
+
let t = /* @__PURE__ */ new Map();
|
|
3747
|
+
if (kn.length === 0) return t;
|
|
3748
|
+
let n = new Set(kn.split("\0")), r = e.length;
|
|
3749
|
+
for (let i of V) {
|
|
3750
|
+
if (!n.has(i.key)) continue;
|
|
3751
|
+
let a = new Float64Array(r);
|
|
3752
|
+
for (let t = 0; t < r; t += 1) a[t] = Number(j(e[t], i));
|
|
3753
|
+
t.set(i.key, a);
|
|
3754
|
+
}
|
|
3755
|
+
return t;
|
|
3756
|
+
}, [
|
|
3757
|
+
e,
|
|
3758
|
+
V,
|
|
3759
|
+
kn
|
|
3760
|
+
]), Mn = a(() => ie(e, On, V, Tn, An), [
|
|
3761
|
+
e,
|
|
3762
|
+
On,
|
|
3763
|
+
V,
|
|
3764
|
+
Tn,
|
|
3765
|
+
An
|
|
3766
|
+
]), Nn = a(() => rt(e, Mn, V, W.sort), [
|
|
3767
|
+
e,
|
|
3768
|
+
Mn,
|
|
3769
|
+
V,
|
|
3770
|
+
W.sort
|
|
3771
|
+
]), Pn = a(() => ({
|
|
3772
|
+
getRowCount: () => Nn.length,
|
|
3773
|
+
getRow: (t) => e[Nn[t]],
|
|
3774
|
+
getSourceIndex: (e) => Nn[e],
|
|
3775
|
+
getRowKey: (t) => lt(e[Nn[t]], Nn[t])
|
|
3776
|
+
}), [
|
|
3777
|
+
Nn,
|
|
3778
|
+
e,
|
|
3779
|
+
lt
|
|
3780
|
+
]), Fn = a(() => U ? un({
|
|
3781
|
+
globalText: gt ? xn : "",
|
|
3782
|
+
columnFilters: ht ? wn : or,
|
|
3783
|
+
sort: mt ? W.sort : sr
|
|
3784
|
+
}) : ar, [
|
|
3785
|
+
U,
|
|
3786
|
+
gt,
|
|
3787
|
+
xn,
|
|
3788
|
+
ht,
|
|
3789
|
+
wn,
|
|
3790
|
+
mt,
|
|
3791
|
+
W.sort
|
|
3792
|
+
]), In = a(() => U ? dn(Fn) : "", [U, Fn]), [Rn, zn] = c(Fn), [Bn, Hn] = c(In);
|
|
3793
|
+
r(() => {
|
|
3794
|
+
if (!U) return;
|
|
3795
|
+
let e = setTimeout(() => {
|
|
3796
|
+
zn(Fn), Hn(In);
|
|
3797
|
+
}, cr);
|
|
3798
|
+
return () => clearTimeout(e);
|
|
3799
|
+
}, [
|
|
3800
|
+
U,
|
|
3801
|
+
In,
|
|
3802
|
+
Fn
|
|
3803
|
+
]);
|
|
3804
|
+
let Un = ln({
|
|
3805
|
+
dataSource: u,
|
|
3806
|
+
rowKeyGetter: lt,
|
|
3807
|
+
query: Rn,
|
|
3808
|
+
queryKey: Bn,
|
|
3809
|
+
refreshToken: p
|
|
3810
|
+
}), Wn = Un.requestRange, Z = U ? Un.rowModel : Pn, Gn = s(Z);
|
|
3811
|
+
Gn.current = Z;
|
|
3812
|
+
let { isAutosizing: Kn, runAutosize: qn } = Gt({
|
|
3813
|
+
rowModelRef: Gn,
|
|
3814
|
+
gridRootRef: Ne,
|
|
3815
|
+
columnWidthsRef: _t,
|
|
3816
|
+
dispatch: G
|
|
3817
|
+
}), Q = Z.getRowCount(), Yn = a(() => {
|
|
3818
|
+
let t = null;
|
|
3819
|
+
return () => t ??= Array.from(Nn, (t) => e[t]);
|
|
3820
|
+
}, [Nn, e]), Xn = a(() => de(V, W.columnWidths), [V, W.columnWidths]), [Qn, lr] = c(0), [ur, dr] = c(0);
|
|
3821
|
+
r(() => {
|
|
3822
|
+
let e = Re.current;
|
|
3823
|
+
if (!e) return;
|
|
3824
|
+
lr(e.scrollTop), dr(e.clientHeight);
|
|
3825
|
+
let t = () => lr(e.scrollTop);
|
|
3826
|
+
e.addEventListener("scroll", t, { passive: !0 });
|
|
3827
|
+
let n = new ResizeObserver(() => dr(e.clientHeight));
|
|
3828
|
+
return n.observe(e), () => {
|
|
3829
|
+
e.removeEventListener("scroll", t), n.disconnect();
|
|
3830
|
+
};
|
|
3831
|
+
}, []);
|
|
3832
|
+
let fr = q.center.entries, pr = l({
|
|
3833
|
+
horizontal: !0,
|
|
3834
|
+
count: fr.length,
|
|
3835
|
+
getScrollElement: () => Re.current,
|
|
3836
|
+
estimateSize: (e) => fr[e]?.paneLocalSize ?? fr[e]?.column.width ?? 120,
|
|
3837
|
+
overscan: 8,
|
|
3838
|
+
useFlushSync: !1,
|
|
3839
|
+
scrollMargin: It
|
|
3840
|
+
}), mr = pr.getVirtualItems(), hr = ae ?? I, gr = a(() => V.some((e) => e.autoHeight === !0), [V]), _r = !U && at(ne, gr, Q, 5e4);
|
|
3841
|
+
r(() => {}, [
|
|
3842
|
+
ne,
|
|
3843
|
+
gr,
|
|
3844
|
+
Q,
|
|
3845
|
+
U
|
|
3846
|
+
]);
|
|
3847
|
+
let vr = s(/* @__PURE__ */ new Map()), [yr, br] = c(0), [xr, Sr] = c(0), Cr = s(null), wr = s(/* @__PURE__ */ new Set()), Tr = a(() => _r ? Ct(Q, hr, Z.getRowKey, vr.current) : null, [
|
|
3848
|
+
_r,
|
|
3849
|
+
Q,
|
|
3850
|
+
hr,
|
|
3851
|
+
Z
|
|
3852
|
+
]), $ = a(() => _r && Tr ? Et(Tr) : st(Q, I), [
|
|
3853
|
+
_r,
|
|
3854
|
+
Tr,
|
|
3855
|
+
yr,
|
|
3856
|
+
Q,
|
|
3857
|
+
I
|
|
3858
|
+
]), Er = a(() => _r ? dt({
|
|
3859
|
+
headerHeight: R,
|
|
3860
|
+
viewportHeight: ur,
|
|
3861
|
+
scrollTop: Qn,
|
|
3862
|
+
overscan: 20
|
|
3863
|
+
}, $) : ut({
|
|
3864
|
+
rowCount: Q,
|
|
3865
|
+
rowHeight: I,
|
|
3866
|
+
headerHeight: R,
|
|
3867
|
+
viewportHeight: ur,
|
|
3868
|
+
scrollTop: Qn,
|
|
3869
|
+
overscan: 20,
|
|
3870
|
+
maxBodyPx: it
|
|
3871
|
+
}), [
|
|
3872
|
+
_r,
|
|
3873
|
+
$,
|
|
3874
|
+
Q,
|
|
3875
|
+
I,
|
|
3876
|
+
R,
|
|
3877
|
+
ur,
|
|
3878
|
+
Qn
|
|
3879
|
+
]), Dr = Er.rows, Or = Er.rowIndexSet, kr = Dr.length > 0 ? Dr[0].index : 0, Ar = Dr.length > 0 ? Dr[Dr.length - 1].index : -1;
|
|
3880
|
+
r(() => {
|
|
3881
|
+
if (!U) return;
|
|
3882
|
+
let e = Re.current;
|
|
3883
|
+
e && (e.scrollTop = 0), lr(0);
|
|
3884
|
+
}, [U, Bn]), r(() => {
|
|
3885
|
+
U && (Ar < kr || Wn(kr, Ar + 1));
|
|
3886
|
+
}, [
|
|
3887
|
+
U,
|
|
3888
|
+
kr,
|
|
3889
|
+
Ar,
|
|
3890
|
+
Wn,
|
|
3891
|
+
Bn
|
|
3892
|
+
]);
|
|
3893
|
+
let jr = Er.physicalBodyHeight, Mr = Er.translateY === 0 ? void 0 : `translateY(${Er.translateY}px)`, Nr = Er.scaleFactor, Pr = Er.windowBaseOffsetPx;
|
|
3894
|
+
i(() => {
|
|
3895
|
+
if (!_r || !Tr) {
|
|
3896
|
+
Cr.current?.disconnect(), Cr.current = null, wr.current.clear();
|
|
3897
|
+
return;
|
|
3898
|
+
}
|
|
3899
|
+
let e = Re.current;
|
|
3900
|
+
if (!e) return;
|
|
3901
|
+
let t = e.querySelectorAll("[data-autoheight-cell]");
|
|
3902
|
+
if (t.length > 0) {
|
|
3903
|
+
let n = /* @__PURE__ */ new Map();
|
|
3904
|
+
t.forEach((e) => {
|
|
3905
|
+
let t = e.closest("[data-row-index]");
|
|
3906
|
+
if (!t) return;
|
|
3907
|
+
let r = Number(t.dataset.rowIndex);
|
|
3908
|
+
if (!Number.isFinite(r)) return;
|
|
3909
|
+
let i = Math.ceil(e.getBoundingClientRect().height), a = n.get(r);
|
|
3910
|
+
(a === void 0 || i > a) && n.set(r, i);
|
|
3911
|
+
});
|
|
3912
|
+
let r = !1, i = Infinity;
|
|
3913
|
+
if (n.forEach((e, t) => {
|
|
3914
|
+
wt(Tr, t, Z.getRowKey(t) ?? t, e) && (r = !0, t < i && (i = t));
|
|
3915
|
+
}), r) {
|
|
3916
|
+
let t = e.scrollTop, n = $.rowAtContentY(t), r = t - $.rowTop(n);
|
|
3917
|
+
St(Tr, i), e.scrollTop = Tr.prefix[n] + r, br((e) => e + 1);
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
let n = Cr.current ?? new ResizeObserver(() => Sr((e) => e + 1));
|
|
3921
|
+
Cr.current = n;
|
|
3922
|
+
let r = wr.current, i = /* @__PURE__ */ new Set();
|
|
3923
|
+
t.forEach((e) => {
|
|
3924
|
+
i.add(e), r.has(e) || (n.observe(e), r.add(e));
|
|
3925
|
+
});
|
|
3926
|
+
let a = [];
|
|
3927
|
+
r.forEach((e) => {
|
|
3928
|
+
i.has(e) || a.push(e);
|
|
3929
|
+
}), a.forEach((e) => {
|
|
3930
|
+
n.unobserve(e), r.delete(e);
|
|
3931
|
+
});
|
|
3932
|
+
}, [
|
|
3933
|
+
_r,
|
|
3934
|
+
Tr,
|
|
3935
|
+
$,
|
|
3936
|
+
Z,
|
|
3937
|
+
Dr,
|
|
3938
|
+
ur,
|
|
3939
|
+
yr,
|
|
3940
|
+
xr
|
|
3941
|
+
]), r(() => {
|
|
3942
|
+
let e = wr.current;
|
|
3943
|
+
return () => {
|
|
3944
|
+
Cr.current?.disconnect(), Cr.current = null, e.clear();
|
|
3945
|
+
};
|
|
3946
|
+
}, []);
|
|
3947
|
+
let Fr = a(() => mr.map((e) => fr[e.index]).filter((e) => !!e), [mr, fr]), Ir = q.left.entries, Lr = q.right.entries, Rr = a(() => {
|
|
3948
|
+
if (!W.activeCell) return null;
|
|
3949
|
+
let { row: e, col: t } = W.activeCell;
|
|
3950
|
+
if (e < 0 || e >= Q) return null;
|
|
3951
|
+
let n = Ee(q, t);
|
|
3952
|
+
return n ? {
|
|
3953
|
+
pane: n.pane,
|
|
3954
|
+
rect: {
|
|
3955
|
+
left: n.extent.start,
|
|
3956
|
+
top: $.rowTop(e),
|
|
3957
|
+
width: n.extent.width,
|
|
3958
|
+
height: $.rowsHeight(e, e)
|
|
3959
|
+
}
|
|
3960
|
+
} : null;
|
|
3961
|
+
}, [
|
|
3962
|
+
W.activeCell,
|
|
3963
|
+
Q,
|
|
3964
|
+
q,
|
|
3965
|
+
$
|
|
3966
|
+
]), zr = a(() => Rr && Rr.pane === "center" ? Rr.rect : null, [Rr]), Br = t((e) => Rr && Rr.pane === e ? Rr.rect : null, [Rr]), Vr = t((e) => W.editingCell ? Br(e) : null, [W.editingCell, Br]);
|
|
3967
|
+
pt({
|
|
3968
|
+
scrollRef: Re,
|
|
3969
|
+
columnVirtualizer: pr,
|
|
3970
|
+
columnMeasurements: Xn,
|
|
3971
|
+
totalScrollWidth: zt,
|
|
3972
|
+
physicalBodyHeight: jr,
|
|
3973
|
+
headerHeight: R,
|
|
3974
|
+
leftPaneWidth: It,
|
|
3975
|
+
rightPaneWidth: Lt,
|
|
3976
|
+
centerLeadingWidth: Ft,
|
|
3977
|
+
activeCellRect: zr,
|
|
3978
|
+
verticalScaleFactor: Nr
|
|
3979
|
+
});
|
|
3980
|
+
let { updateSelectionFromPointer: Hr, handleCellPointerDown: Ur, handleCellPointerEnter: Wr, handleNativeDragStart: Gr, handleRowHeaderPointerDown: Kr, handleRowHeaderPointerEnter: qr, handleColumnHeaderPointerDown: Jr, handleColumnHeaderPointerEnter: Yr } = ft({
|
|
3981
|
+
gridRootRef: Ne,
|
|
3982
|
+
bodyScrollRef: Ie,
|
|
3983
|
+
scrollContainerRef: Re,
|
|
3984
|
+
leftPaneScrollRef: ze,
|
|
3985
|
+
rightPaneScrollRef: Be,
|
|
3986
|
+
pointerClientRef: Pe,
|
|
3987
|
+
autoScrollFrameRef: Fe,
|
|
3988
|
+
uiState: W,
|
|
3989
|
+
dispatch: G,
|
|
3990
|
+
enableRangeSelection: ue,
|
|
3991
|
+
enableSorting: mt,
|
|
3992
|
+
orderedColumns: H,
|
|
3993
|
+
filteredRowsLength: Q,
|
|
3994
|
+
visibleColumnsLength: V.length,
|
|
3995
|
+
paneLayout: q,
|
|
3996
|
+
leftLeadingWidth: Pt,
|
|
3997
|
+
centerLeadingWidth: Ft,
|
|
3998
|
+
rightLeadingWidth: 0,
|
|
3999
|
+
headerHeight: R,
|
|
4000
|
+
rowMetrics: $,
|
|
4001
|
+
verticalScaleFactor: Nr,
|
|
4002
|
+
setHoveredRowIndex: Ye,
|
|
4003
|
+
setHoveredColumnIndex: ot,
|
|
4004
|
+
enableRowHover: ye,
|
|
4005
|
+
enableColumnHeaderHover: be
|
|
4006
|
+
}), { isWholeGridSelected: Xr, handleCopy: Zr, handlePaste: Qr } = Ae({
|
|
4007
|
+
rows: e,
|
|
4008
|
+
rowModel: Z,
|
|
4009
|
+
visibleColumns: H,
|
|
4010
|
+
uiState: W,
|
|
4011
|
+
readOnly: se,
|
|
4012
|
+
canEditCell: ce,
|
|
4013
|
+
createRow: T,
|
|
4014
|
+
createOverflowColumn: F,
|
|
4015
|
+
onRowsChange: _,
|
|
4016
|
+
onColumnsChange: v,
|
|
4017
|
+
dispatch: G
|
|
4018
|
+
}), $r = t(() => {
|
|
4019
|
+
if (Q === 0 || V.length === 0) return;
|
|
4020
|
+
let e = {
|
|
4021
|
+
row: 0,
|
|
4022
|
+
col: 0
|
|
4023
|
+
}, t = {
|
|
4024
|
+
row: Q - 1,
|
|
4025
|
+
col: V.length - 1
|
|
4026
|
+
};
|
|
4027
|
+
G(h.startSelection(e)), G(h.updateSelection(t)), G(h.endSelection()), G(h.activateCell(e));
|
|
4028
|
+
}, [
|
|
4029
|
+
G,
|
|
4030
|
+
Q,
|
|
4031
|
+
V.length
|
|
4032
|
+
]), { getMovedCell: ei, handleKeyDown: ti } = Je({
|
|
4033
|
+
uiState: W,
|
|
4034
|
+
rowModel: Z,
|
|
4035
|
+
visibleColumns: H,
|
|
4036
|
+
readOnly: se,
|
|
4037
|
+
canEditCell: ce,
|
|
4038
|
+
setEditorInitialValue: He,
|
|
4039
|
+
dispatch: G,
|
|
4040
|
+
handleCopy: Zr,
|
|
4041
|
+
handleCellDoubleClick: t((e) => {
|
|
4042
|
+
let t = Z.getRow(e.row), n = H[e.col];
|
|
4043
|
+
if (!t || !n || !A({
|
|
4044
|
+
readOnly: se,
|
|
4045
|
+
canEditCell: ce
|
|
4046
|
+
}, e.row, e.col, t, n)) return;
|
|
4047
|
+
let r = j(t, n);
|
|
4048
|
+
He(String(r ?? "")), G(h.startEdit(e));
|
|
4049
|
+
}, [
|
|
4050
|
+
ce,
|
|
4051
|
+
G,
|
|
4052
|
+
Z,
|
|
4053
|
+
se,
|
|
4054
|
+
H
|
|
4055
|
+
]),
|
|
4056
|
+
isWholeGridSelected: Xr,
|
|
4057
|
+
selectEntireGrid: $r
|
|
4058
|
+
}), { startEditWithValue: ni, commitEdit: ri, cancelEdit: ii } = Ge({
|
|
4059
|
+
uiState: W,
|
|
4060
|
+
rows: e,
|
|
4061
|
+
visibleColumns: H,
|
|
4062
|
+
rowModel: Z,
|
|
4063
|
+
setEditorInitialValue: He,
|
|
4064
|
+
onRowsChange: _,
|
|
4065
|
+
dispatch: G,
|
|
4066
|
+
getMovedCell: ei,
|
|
4067
|
+
gridRootRef: Ne,
|
|
4068
|
+
editorActionGuardRef: Le
|
|
4069
|
+
}), ai = t((e) => {
|
|
4070
|
+
let t = Z.getRow(e.row), n = H[e.col];
|
|
4071
|
+
if (!t || !n || !A({
|
|
4072
|
+
readOnly: se,
|
|
4073
|
+
canEditCell: ce
|
|
4074
|
+
}, e.row, e.col, t, n)) return;
|
|
4075
|
+
let r = j(t, n);
|
|
4076
|
+
ni(e, String(r ?? ""));
|
|
4077
|
+
}, [
|
|
4078
|
+
ce,
|
|
4079
|
+
Z,
|
|
4080
|
+
se,
|
|
4081
|
+
ni,
|
|
4082
|
+
H
|
|
4083
|
+
]), oi = a(() => {
|
|
4084
|
+
if (!W.selection) return null;
|
|
4085
|
+
if (W.selection.type === "cell") {
|
|
4086
|
+
let e = S(W.selection.range);
|
|
4087
|
+
return {
|
|
4088
|
+
extents: we(q, e.start.col, e.end.col),
|
|
4089
|
+
startRow: e.start.row,
|
|
4090
|
+
endRow: e.end.row
|
|
4091
|
+
};
|
|
4092
|
+
}
|
|
4093
|
+
if (W.selection.type === "row") {
|
|
4094
|
+
let e = C(W.selection.startRow, W.selection.endRow);
|
|
4095
|
+
return {
|
|
4096
|
+
extents: Te(q),
|
|
4097
|
+
startRow: e.startRow,
|
|
4098
|
+
endRow: e.endRow
|
|
4099
|
+
};
|
|
4100
|
+
}
|
|
4101
|
+
let e = w(W.selection.startCol, W.selection.endCol);
|
|
4102
|
+
return {
|
|
4103
|
+
extents: we(q, e.startCol, e.endCol),
|
|
4104
|
+
startRow: 0,
|
|
4105
|
+
endRow: Math.max(Q - 1, 0)
|
|
4106
|
+
};
|
|
4107
|
+
}, [
|
|
4108
|
+
W.selection,
|
|
4109
|
+
q,
|
|
4110
|
+
Q
|
|
4111
|
+
]), si = a(() => {
|
|
4112
|
+
if (!oi) return null;
|
|
4113
|
+
let e = ct(oi.startRow, oi.endRow, kr, Ar);
|
|
4114
|
+
return e ? {
|
|
4115
|
+
top: $.rowTop(e.start),
|
|
4116
|
+
height: $.rowsHeight(e.start, e.end)
|
|
4117
|
+
} : null;
|
|
4118
|
+
}, [
|
|
4119
|
+
oi,
|
|
4120
|
+
$,
|
|
4121
|
+
kr,
|
|
4122
|
+
Ar
|
|
4123
|
+
]), ci = t((e) => {
|
|
4124
|
+
if (!oi || !si) return null;
|
|
4125
|
+
let t = oi.extents[e];
|
|
4126
|
+
return t ? {
|
|
4127
|
+
left: t.start,
|
|
4128
|
+
top: si.top,
|
|
4129
|
+
width: t.width,
|
|
4130
|
+
height: si.height
|
|
4131
|
+
} : null;
|
|
4132
|
+
}, [oi, si]), li = t((e) => {
|
|
4133
|
+
if (e.preventDefault(), e.button === 0 && !(Q === 0 || V.length === 0)) {
|
|
4134
|
+
if (Ne.current?.focus(), Xr) {
|
|
4135
|
+
G(h.clearSelection()), G(h.activateCell(null));
|
|
4136
|
+
return;
|
|
4137
|
+
}
|
|
4138
|
+
$r();
|
|
4139
|
+
}
|
|
4140
|
+
}, [
|
|
4141
|
+
G,
|
|
4142
|
+
Q,
|
|
4143
|
+
Xr,
|
|
4144
|
+
$r,
|
|
4145
|
+
V.length
|
|
4146
|
+
]), ui = t((e) => {
|
|
4147
|
+
Ye((t) => t === e ? null : t);
|
|
4148
|
+
}, []), di = t((e) => {
|
|
4149
|
+
ot((t) => t === e ? null : t);
|
|
4150
|
+
}, []), fi = t(() => {
|
|
4151
|
+
Ke(!0);
|
|
4152
|
+
}, []), pi = t(() => {
|
|
4153
|
+
Ke(!1);
|
|
4154
|
+
}, []), mi = t((e, t) => {
|
|
4155
|
+
t.preventDefault(), t.stopPropagation(), G(h.startColumnResize(e.key, t.clientX, _t.current[e.key] ?? e.width, e.minWidth ?? 60, e.maxWidth ?? 1e3));
|
|
4156
|
+
}, [G]), hi = t((e, t) => {
|
|
4157
|
+
if (X(), !v) return;
|
|
4158
|
+
let n = g.find((t) => t.key === e);
|
|
4159
|
+
n && (n.pinned ?? void 0) !== t && (v(g.map((n) => {
|
|
4160
|
+
let r = _t.current[n.key] ?? n.width;
|
|
4161
|
+
return n.key === e ? {
|
|
4162
|
+
...n,
|
|
4163
|
+
width: r,
|
|
4164
|
+
pinned: t
|
|
4165
|
+
} : r === n.width ? n : {
|
|
4166
|
+
...n,
|
|
4167
|
+
width: r
|
|
4168
|
+
};
|
|
4169
|
+
})), G(h.stopEdit()), G(h.clearSelection()), G(h.activateCell(null)));
|
|
4170
|
+
}, [
|
|
4171
|
+
X,
|
|
4172
|
+
g,
|
|
4173
|
+
G,
|
|
4174
|
+
v
|
|
4175
|
+
]), gi = t((e) => {
|
|
4176
|
+
X();
|
|
4177
|
+
let t = V.find((t) => t.key === e);
|
|
4178
|
+
t && qn([t]);
|
|
4179
|
+
}, [
|
|
4180
|
+
X,
|
|
4181
|
+
qn,
|
|
4182
|
+
V
|
|
4183
|
+
]), _i = t(() => {
|
|
4184
|
+
X(), qn(V);
|
|
4185
|
+
}, [
|
|
4186
|
+
X,
|
|
4187
|
+
qn,
|
|
4188
|
+
V
|
|
4189
|
+
]), vi = a(() => g.map((e) => ({
|
|
4190
|
+
key: e.key,
|
|
4191
|
+
title: e.title ?? e.key,
|
|
4192
|
+
visible: e.visible !== !1,
|
|
4193
|
+
pane: fe(e)
|
|
4194
|
+
})), [g]), yi = t(() => {
|
|
4195
|
+
X(), sn();
|
|
4196
|
+
}, [X, sn]), bi = a(() => V.map((e) => ({
|
|
4197
|
+
key: e.key,
|
|
4198
|
+
title: e.title ?? e.key
|
|
4199
|
+
})), [V]), xi = t(() => {
|
|
4200
|
+
X(), yn();
|
|
4201
|
+
}, [X, yn]), Si = t((e, t) => {
|
|
4202
|
+
if (!v) return;
|
|
4203
|
+
let n = g.find((t) => t.key === e);
|
|
4204
|
+
n && n.visible !== !1 !== t && (!t && g.filter((e) => e.visible !== !1).length <= 1 || (v(g.map((n) => {
|
|
4205
|
+
let r = _t.current[n.key] ?? n.width;
|
|
4206
|
+
return n.key === e ? {
|
|
4207
|
+
...n,
|
|
4208
|
+
width: r,
|
|
4209
|
+
visible: t
|
|
4210
|
+
} : r === n.width ? n : {
|
|
4211
|
+
...n,
|
|
4212
|
+
width: r
|
|
4213
|
+
};
|
|
4214
|
+
})), G(h.stopEdit()), G(h.clearSelection()), G(h.activateCell(null))));
|
|
4215
|
+
}, [
|
|
4216
|
+
g,
|
|
4217
|
+
G,
|
|
4218
|
+
v
|
|
4219
|
+
]), Ci = t(() => {
|
|
4220
|
+
v && g.some((e) => e.visible === !1) && (v(g.map((e) => {
|
|
4221
|
+
let t = _t.current[e.key] ?? e.width, n = t !== e.width, r = e.visible === !1;
|
|
4222
|
+
return !n && !r ? e : r ? {
|
|
4223
|
+
...e,
|
|
4224
|
+
width: t,
|
|
4225
|
+
visible: !0
|
|
4226
|
+
} : {
|
|
4227
|
+
...e,
|
|
4228
|
+
width: t
|
|
4229
|
+
};
|
|
4230
|
+
})), G(h.stopEdit()), G(h.clearSelection()), G(h.activateCell(null)));
|
|
4231
|
+
}, [
|
|
4232
|
+
g,
|
|
4233
|
+
G,
|
|
4234
|
+
v
|
|
4235
|
+
]), wi = t((e, t) => {
|
|
4236
|
+
if (!v || e.length !== g.length) return;
|
|
4237
|
+
let n = new Map(g.map((e) => [e.key, e]));
|
|
4238
|
+
if (!e.every((e) => n.has(e))) return;
|
|
4239
|
+
let r = pe(e.map((e) => {
|
|
4240
|
+
let r = n.get(e), i = _t.current[r.key] ?? r.width, a = t?.has(e) ? t.get(e) : r.pinned, o = i !== r.width, s = (r.pinned ?? void 0) !== (a ?? void 0);
|
|
4241
|
+
return o || s ? {
|
|
4242
|
+
...r,
|
|
4243
|
+
width: i,
|
|
4244
|
+
pinned: a
|
|
4245
|
+
} : r;
|
|
4246
|
+
}));
|
|
4247
|
+
r.length === g.length && r.every((e, t) => {
|
|
4248
|
+
let n = g[t];
|
|
4249
|
+
return !!n && n.key === e.key && n.width === e.width && (n.pinned ?? void 0) === (e.pinned ?? void 0);
|
|
4250
|
+
}) || (v(r), G(h.stopEdit()), G(h.clearSelection()), G(h.activateCell(null)));
|
|
4251
|
+
}, [
|
|
4252
|
+
g,
|
|
4253
|
+
G,
|
|
4254
|
+
v
|
|
4255
|
+
]), Ti = t((e) => {
|
|
4256
|
+
wi(e);
|
|
4257
|
+
}, [wi]), { onColumnDragHandlePointerDown: Ei, leftIndicatorRef: Di, centerIndicatorRef: Oi, rightIndicatorRef: ki } = xt({
|
|
4258
|
+
enabled: !!v,
|
|
4259
|
+
columns: g,
|
|
4260
|
+
paneLayout: q,
|
|
4261
|
+
leftPaneScrollRef: ze,
|
|
4262
|
+
rightPaneScrollRef: Be,
|
|
4263
|
+
bodyScrollRef: Ie,
|
|
4264
|
+
scrollContainerRef: Re,
|
|
4265
|
+
leftLeadingWidth: Pt,
|
|
4266
|
+
centerLeadingWidth: Ft,
|
|
4267
|
+
rightLeadingWidth: 0,
|
|
4268
|
+
applyColumnOrderAndPin: wi
|
|
4269
|
+
}), Ai = v ? Ei : void 0, ji = {
|
|
4270
|
+
position: "absolute",
|
|
4271
|
+
top: 0,
|
|
4272
|
+
height: R + jr,
|
|
4273
|
+
width: 2,
|
|
4274
|
+
backgroundColor: "#2563eb",
|
|
4275
|
+
transform: "translateX(-1px)",
|
|
4276
|
+
pointerEvents: "none",
|
|
4277
|
+
zIndex: 8,
|
|
4278
|
+
display: "none"
|
|
4279
|
+
}, Mi = t(() => {
|
|
4280
|
+
if (!v) return;
|
|
4281
|
+
let e = vt.current;
|
|
4282
|
+
if (!e) return;
|
|
4283
|
+
let t = !1, n = g.map((n) => {
|
|
4284
|
+
let r = _t.current[n.key] ?? n.width, i = e.get(n.key);
|
|
4285
|
+
if (!i) return r === n.width ? n : {
|
|
4286
|
+
...n,
|
|
4287
|
+
width: r
|
|
4288
|
+
};
|
|
4289
|
+
let a = i.pinned ?? void 0, o = r !== i.width, s = (n.pinned ?? void 0) !== a, c = n.visible !== !1 != (i.visible !== !1);
|
|
4290
|
+
return (o || s || c) && (t = !0), {
|
|
4291
|
+
...n,
|
|
4292
|
+
width: i.width,
|
|
4293
|
+
pinned: i.pinned,
|
|
4294
|
+
visible: i.visible
|
|
4295
|
+
};
|
|
4296
|
+
});
|
|
4297
|
+
t && (v(n), G(h.stopEdit()), G(h.clearSelection()), G(h.activateCell(null)));
|
|
4298
|
+
}, [
|
|
4299
|
+
g,
|
|
4300
|
+
G,
|
|
4301
|
+
v
|
|
4302
|
+
]), Ni = t(() => {
|
|
4303
|
+
X(), Mi();
|
|
4304
|
+
}, [X, Mi]), Pi = t((t) => Y ? j(e[t], Y) : void 0, [e, Y]), { options: Fi, allValues: Ii, status: Li, progress: Ri } = nn({
|
|
4305
|
+
column: Y,
|
|
4306
|
+
rowCount: e.length,
|
|
4307
|
+
getRawValueAt: Pi
|
|
4308
|
+
}), zi = Y ? W.filters.columnFilters[Y.key] : void 0, Bi = a(() => P(zi) ? {
|
|
4309
|
+
mode: zi.mode === "exclude" ? "exclude" : "include",
|
|
4310
|
+
values: new Set(zi.values)
|
|
4311
|
+
} : null, [zi]), Vi = !(Y?.filterOptions && Y.filterOptions.length > 0), Hi = t((e, t, n) => {
|
|
4312
|
+
let r = t.mode === "include" ? t.values.size : n - t.values.size;
|
|
4313
|
+
if (r >= n) {
|
|
4314
|
+
G(h.clearColumnFilter(e));
|
|
4315
|
+
return;
|
|
4316
|
+
}
|
|
4317
|
+
if (r <= 0) {
|
|
4318
|
+
G(h.setColumnFilter(e, {
|
|
4319
|
+
kind: "set",
|
|
4320
|
+
mode: "include",
|
|
4321
|
+
values: []
|
|
4322
|
+
}));
|
|
4323
|
+
return;
|
|
4324
|
+
}
|
|
4325
|
+
let i = {
|
|
4326
|
+
kind: "set",
|
|
4327
|
+
mode: t.mode,
|
|
4328
|
+
values: Array.from(t.values)
|
|
4329
|
+
};
|
|
4330
|
+
G(h.setColumnFilter(e, i));
|
|
4331
|
+
}, [G]), Ui = t((e) => {
|
|
4332
|
+
if (!J) return;
|
|
4333
|
+
let t = Fi.length, n = Bi, r;
|
|
4334
|
+
r = fn(n, e) ? n === null ? Vi ? {
|
|
4335
|
+
mode: "exclude",
|
|
4336
|
+
values: new Set([e])
|
|
4337
|
+
} : {
|
|
4338
|
+
mode: "include",
|
|
4339
|
+
values: tr(Ii, e)
|
|
4340
|
+
} : n.mode === "include" ? {
|
|
4341
|
+
mode: "include",
|
|
4342
|
+
values: tr(n.values, e)
|
|
4343
|
+
} : {
|
|
4344
|
+
mode: "exclude",
|
|
4345
|
+
values: er(n.values, e)
|
|
4346
|
+
} : n.mode === "include" ? {
|
|
4347
|
+
mode: "include",
|
|
4348
|
+
values: er(n.values, e)
|
|
4349
|
+
} : {
|
|
4350
|
+
mode: "exclude",
|
|
4351
|
+
values: tr(n.values, e)
|
|
4352
|
+
}, Hi(J.columnKey, r, t);
|
|
4353
|
+
}, [
|
|
4354
|
+
J,
|
|
4355
|
+
Bi,
|
|
4356
|
+
Vi,
|
|
4357
|
+
Ii,
|
|
4358
|
+
Fi,
|
|
4359
|
+
Hi
|
|
4360
|
+
]), Wi = t((e, t) => {
|
|
4361
|
+
if (!J) return;
|
|
4362
|
+
let n = J.columnKey, r = Fi.length;
|
|
4363
|
+
if (e === "all") {
|
|
4364
|
+
t ? G(h.clearColumnFilter(n)) : Hi(n, {
|
|
4365
|
+
mode: "include",
|
|
4366
|
+
values: /* @__PURE__ */ new Set()
|
|
4367
|
+
}, r);
|
|
4368
|
+
return;
|
|
4369
|
+
}
|
|
4370
|
+
let i = Bi, a;
|
|
4371
|
+
if (t) {
|
|
4372
|
+
if (i === null) {
|
|
4373
|
+
G(h.clearColumnFilter(n));
|
|
4374
|
+
return;
|
|
4375
|
+
}
|
|
4376
|
+
a = i.mode === "include" ? {
|
|
4377
|
+
mode: "include",
|
|
4378
|
+
values: nr(i.values, e)
|
|
4379
|
+
} : {
|
|
4380
|
+
mode: "exclude",
|
|
4381
|
+
values: rr(i.values, e)
|
|
4382
|
+
};
|
|
4383
|
+
} else a = i === null ? Vi ? {
|
|
4384
|
+
mode: "exclude",
|
|
4385
|
+
values: new Set(e)
|
|
4386
|
+
} : {
|
|
4387
|
+
mode: "include",
|
|
4388
|
+
values: rr(Ii, e)
|
|
4389
|
+
} : i.mode === "include" ? {
|
|
4390
|
+
mode: "include",
|
|
4391
|
+
values: rr(i.values, e)
|
|
4392
|
+
} : {
|
|
4393
|
+
mode: "exclude",
|
|
4394
|
+
values: nr(i.values, e)
|
|
4395
|
+
};
|
|
4396
|
+
Hi(n, a, r);
|
|
4397
|
+
}, [
|
|
4398
|
+
J,
|
|
4399
|
+
Bi,
|
|
4400
|
+
Vi,
|
|
4401
|
+
Ii,
|
|
4402
|
+
Fi,
|
|
4403
|
+
Hi,
|
|
4404
|
+
G
|
|
4405
|
+
]), Gi = t(() => {
|
|
4406
|
+
J && G(h.clearColumnFilter(J.columnKey));
|
|
4407
|
+
}, [G, J]), Ki = t(() => {
|
|
4408
|
+
if (!J) return;
|
|
4409
|
+
let e = V.find((e) => e.key === J.columnKey)?.filterType ?? "text";
|
|
4410
|
+
if (e === "set") {
|
|
4411
|
+
qt();
|
|
4412
|
+
return;
|
|
4413
|
+
}
|
|
4414
|
+
if (e === "number") {
|
|
4415
|
+
let e = ee(J.draftValue);
|
|
4416
|
+
if (!e) {
|
|
4417
|
+
G(h.clearColumnFilter(J.columnKey)), qt();
|
|
4418
|
+
return;
|
|
4419
|
+
}
|
|
4420
|
+
G(h.setColumnFilter(J.columnKey, e)), qt();
|
|
4421
|
+
return;
|
|
4422
|
+
}
|
|
4423
|
+
let t = e === "select" ? J.draftValue : J.draftValue.trim();
|
|
4424
|
+
if (!t) {
|
|
4425
|
+
G(h.clearColumnFilter(J.columnKey)), qt();
|
|
4426
|
+
return;
|
|
4427
|
+
}
|
|
4428
|
+
let n = e === "select" ? {
|
|
4429
|
+
kind: "select",
|
|
4430
|
+
value: t
|
|
4431
|
+
} : e === "date" ? {
|
|
4432
|
+
kind: "date",
|
|
4433
|
+
value: t
|
|
4434
|
+
} : e === "custom" ? {
|
|
4435
|
+
kind: "custom",
|
|
4436
|
+
value: t
|
|
4437
|
+
} : {
|
|
4438
|
+
kind: "text",
|
|
4439
|
+
value: t
|
|
4440
|
+
};
|
|
4441
|
+
G(h.setColumnFilter(J.columnKey, n)), qt();
|
|
4442
|
+
}, [
|
|
4443
|
+
qt,
|
|
4444
|
+
G,
|
|
4445
|
+
J,
|
|
4446
|
+
V
|
|
4447
|
+
]), qi = t(() => {
|
|
4448
|
+
J && (G(h.clearColumnFilter(J.columnKey)), qt());
|
|
4449
|
+
}, [
|
|
4450
|
+
qt,
|
|
4451
|
+
G,
|
|
4452
|
+
J
|
|
4453
|
+
]), Ji = t((e, t) => {
|
|
4454
|
+
if (X(), !z) return;
|
|
4455
|
+
let n = Ze(W.sort, e, t, !1);
|
|
4456
|
+
G(n.length === 0 ? h.clearSort() : h.setSort(n));
|
|
4457
|
+
}, [
|
|
4458
|
+
X,
|
|
4459
|
+
G,
|
|
4460
|
+
z,
|
|
4461
|
+
W.sort
|
|
4462
|
+
]), Yi = t((e, t) => {
|
|
4463
|
+
if (!z) return;
|
|
4464
|
+
let n = Qe(W.sort, e, t);
|
|
4465
|
+
G(h.setSort(n));
|
|
4466
|
+
}, [
|
|
4467
|
+
G,
|
|
4468
|
+
z,
|
|
4469
|
+
W.sort
|
|
4470
|
+
]), Xi = t((e, t) => {
|
|
4471
|
+
if (!z) return;
|
|
4472
|
+
let n = $e(W.sort, e, t);
|
|
4473
|
+
G(h.setSort(n));
|
|
4474
|
+
}, [
|
|
4475
|
+
G,
|
|
4476
|
+
z,
|
|
4477
|
+
W.sort
|
|
4478
|
+
]), Zi = t((e, t) => {
|
|
4479
|
+
if (!z) return;
|
|
4480
|
+
let n = et(W.sort, e, t);
|
|
4481
|
+
G(h.setSort(n));
|
|
4482
|
+
}, [
|
|
4483
|
+
G,
|
|
4484
|
+
z,
|
|
4485
|
+
W.sort
|
|
4486
|
+
]), Qi = t((e) => {
|
|
4487
|
+
if (!z) return;
|
|
4488
|
+
let t = tt(W.sort, e);
|
|
4489
|
+
G(t.length === 0 ? h.clearSort() : h.setSort(t));
|
|
4490
|
+
}, [
|
|
4491
|
+
G,
|
|
4492
|
+
z,
|
|
4493
|
+
W.sort
|
|
4494
|
+
]), $i = t(() => {
|
|
4495
|
+
z && G(h.clearSort());
|
|
4496
|
+
}, [G, z]), ea = t((e, t) => {
|
|
4497
|
+
if (!z) return;
|
|
4498
|
+
let n = nt(W.sort, e, t);
|
|
4499
|
+
G(h.setSort(n));
|
|
4500
|
+
}, [
|
|
4501
|
+
G,
|
|
4502
|
+
z,
|
|
4503
|
+
W.sort
|
|
4504
|
+
]), ta = t((t, n, r, i, a) => {
|
|
4505
|
+
let o = j(t, r);
|
|
4506
|
+
return r.renderCell ? r.renderCell({
|
|
4507
|
+
row: t,
|
|
4508
|
+
rowIndex: n,
|
|
4509
|
+
colIndex: i,
|
|
4510
|
+
value: o,
|
|
4511
|
+
column: r,
|
|
4512
|
+
isActive: a.isActive,
|
|
4513
|
+
isSelected: a.isSelected,
|
|
4514
|
+
isEditing: a.isEditing,
|
|
4515
|
+
readOnly: a.readOnly,
|
|
4516
|
+
setValue: (t) => {
|
|
4517
|
+
if (!_) return;
|
|
4518
|
+
let i = Z.getSourceIndex(n);
|
|
4519
|
+
i !== void 0 && _(e.map((e, n) => n === i ? M(e, r, t) : e));
|
|
4520
|
+
}
|
|
4521
|
+
}) : /* @__PURE__ */ d("span", { children: String(o ?? "") });
|
|
4522
|
+
}, [
|
|
4523
|
+
Z,
|
|
4524
|
+
_,
|
|
4525
|
+
e
|
|
4526
|
+
]), { slotContext: na } = We({
|
|
4527
|
+
rows: e,
|
|
4528
|
+
viewRowCount: Q,
|
|
4529
|
+
getFilteredRows: Yn,
|
|
4530
|
+
columns: g,
|
|
4531
|
+
visibleColumns: V,
|
|
4532
|
+
uiState: W,
|
|
4533
|
+
setGlobalFilterText: t((e) => {
|
|
4534
|
+
G(h.setGlobalFilter(e));
|
|
4535
|
+
}, [G])
|
|
4536
|
+
}), ra = a(() => ({
|
|
4537
|
+
width: oe,
|
|
4538
|
+
minWidth: oe
|
|
4539
|
+
}), [oe]), ia = Q === 0, aa = (e, t, n) => ({
|
|
4540
|
+
position: "sticky",
|
|
4541
|
+
...e === "left" ? { left: 0 } : { right: 0 },
|
|
4542
|
+
width: t,
|
|
4543
|
+
minWidth: t,
|
|
4544
|
+
flexShrink: 0,
|
|
4545
|
+
alignSelf: "stretch",
|
|
4546
|
+
zIndex: 2,
|
|
4547
|
+
...n ? e === "left" ? {
|
|
4548
|
+
borderRight: "1px solid #cbd5e1",
|
|
4549
|
+
boxShadow: "6px 0 8px -6px rgba(15, 23, 42, 0.35)"
|
|
4550
|
+
} : {
|
|
4551
|
+
borderLeft: "1px solid #cbd5e1",
|
|
4552
|
+
boxShadow: "-6px 0 8px -6px rgba(15, 23, 42, 0.35)"
|
|
4553
|
+
} : {}
|
|
4554
|
+
}), oa = (() => {
|
|
4555
|
+
if (!Y) return "(なし)";
|
|
4556
|
+
let e = W.filters.columnFilters[Y.key];
|
|
4557
|
+
if (P(e)) return e.mode === "exclude" ? `${e.values.length}件を除外中` : `${e.values.length}件を選択中`;
|
|
4558
|
+
if (L(e)) return e.raw;
|
|
4559
|
+
let t = te(e);
|
|
4560
|
+
return t.trim() ? t : "(なし)";
|
|
4561
|
+
})(), sa = Y ? /* @__PURE__ */ d(hn, {
|
|
4562
|
+
isOpen: !!J,
|
|
4563
|
+
title: Y.title || Y.key,
|
|
4564
|
+
filterType: Y.filterType ?? "text",
|
|
4565
|
+
isServerSide: U,
|
|
4566
|
+
draftValue: J?.draftValue ?? "",
|
|
4567
|
+
currentValueText: oa,
|
|
4568
|
+
layout: Bt,
|
|
4569
|
+
selectOptions: Fi,
|
|
4570
|
+
setSelection: Bi,
|
|
4571
|
+
optionsStatus: Li,
|
|
4572
|
+
optionsProgress: Ri,
|
|
4573
|
+
popoverRef: Vt,
|
|
4574
|
+
textInputRef: Ht,
|
|
4575
|
+
selectRef: Ut,
|
|
4576
|
+
onRequestClose: qt,
|
|
4577
|
+
onDraftChange: Jt,
|
|
4578
|
+
onApply: Ki,
|
|
4579
|
+
onClear: qi,
|
|
4580
|
+
onSetValueToggle: Ui,
|
|
4581
|
+
onSetSelectAllChange: Wi,
|
|
4582
|
+
onSetClear: Gi
|
|
4583
|
+
}) : null, ca = $t ? /* @__PURE__ */ d(Ln, {
|
|
4584
|
+
isOpen: Zt,
|
|
4585
|
+
title: $t.title || $t.key,
|
|
4586
|
+
columnKey: $t.key,
|
|
4587
|
+
canSort: mt,
|
|
4588
|
+
sortDirection: W.sort.find((e) => e.columnKey === $t.key)?.direction ?? null,
|
|
4589
|
+
onSortChange: (e) => Ji($t.key, e),
|
|
4590
|
+
onOpenSortManager: xi,
|
|
4591
|
+
pinned: $t.pinned,
|
|
4592
|
+
canChangePinned: !!v,
|
|
4593
|
+
layout: Yt,
|
|
4594
|
+
popoverRef: Xt,
|
|
4595
|
+
onPinnedChange: hi,
|
|
4596
|
+
onAutosizeColumn: gi,
|
|
4597
|
+
onAutosizeAllColumns: _i,
|
|
4598
|
+
onOpenColumnChooser: yi,
|
|
4599
|
+
canResetColumns: !!v,
|
|
4600
|
+
onResetColumns: Ni,
|
|
4601
|
+
onRequestClose: X
|
|
4602
|
+
}) : null, la = /* @__PURE__ */ d(Jn, {
|
|
4603
|
+
isOpen: rn,
|
|
4604
|
+
items: vi,
|
|
4605
|
+
canToggle: !!v,
|
|
4606
|
+
layout: an,
|
|
4607
|
+
panelRef: on,
|
|
4608
|
+
onToggleColumnVisibility: Si,
|
|
4609
|
+
onShowAllColumns: Ci,
|
|
4610
|
+
onResetColumns: Mi,
|
|
4611
|
+
onReorderColumns: Ti,
|
|
4612
|
+
onRequestClose: cn
|
|
4613
|
+
}), ua = /* @__PURE__ */ d($n, {
|
|
4614
|
+
isOpen: pn,
|
|
4615
|
+
entries: W.sort,
|
|
4616
|
+
columns: bi,
|
|
4617
|
+
canSort: mt,
|
|
4618
|
+
layout: mn,
|
|
4619
|
+
panelRef: vn,
|
|
4620
|
+
onAddLevel: Yi,
|
|
4621
|
+
onChangeDirection: Xi,
|
|
4622
|
+
onChangeColumn: Zi,
|
|
4623
|
+
onRemoveLevel: Qi,
|
|
4624
|
+
onClearAll: $i,
|
|
4625
|
+
onMove: ea,
|
|
4626
|
+
onRequestClose: bn
|
|
4627
|
+
}), da = Wt || Zt || rn || pn, fa = je(De, na, gt ? /* @__PURE__ */ d(_n, { context: na }) : null), pa = je(Oe, na, /* @__PURE__ */ d(gn, { context: na }));
|
|
4628
|
+
return /* @__PURE__ */ f("div", {
|
|
4629
|
+
className: m("ssg-root", ke, B?.root),
|
|
4630
|
+
children: [
|
|
4631
|
+
fa,
|
|
4632
|
+
/* @__PURE__ */ f("div", {
|
|
4633
|
+
ref: Ne,
|
|
4634
|
+
className: "ssg-shell",
|
|
4635
|
+
style: { cursor: Kn ? "progress" : void 0 },
|
|
4636
|
+
onDragStart: Gr,
|
|
4637
|
+
onPointerLeave: () => Ye(null),
|
|
4638
|
+
onPointerMoveCapture: (e) => {
|
|
4639
|
+
Pe.current = {
|
|
4640
|
+
x: e.clientX,
|
|
4641
|
+
y: e.clientY
|
|
4642
|
+
}, Hr(e.clientX, e.clientY);
|
|
4643
|
+
},
|
|
4644
|
+
tabIndex: da ? -1 : 0,
|
|
4645
|
+
onKeyDown: da ? void 0 : ti,
|
|
4646
|
+
onPaste: da ? void 0 : Qr,
|
|
4647
|
+
children: [/* @__PURE__ */ f("div", {
|
|
4648
|
+
ref: Re,
|
|
4649
|
+
className: "ssg-scroll-container",
|
|
4650
|
+
children: [/* @__PURE__ */ f("div", {
|
|
4651
|
+
className: "ssg-inner-row",
|
|
4652
|
+
style: {
|
|
4653
|
+
width: zt,
|
|
4654
|
+
minWidth: zt,
|
|
4655
|
+
height: R + jr
|
|
4656
|
+
},
|
|
4657
|
+
children: [
|
|
4658
|
+
/* @__PURE__ */ f("div", {
|
|
4659
|
+
ref: ze,
|
|
4660
|
+
style: aa("left", It, jt),
|
|
4661
|
+
children: [jt && /* @__PURE__ */ f("div", {
|
|
4662
|
+
style: {
|
|
4663
|
+
position: "relative",
|
|
4664
|
+
overflow: "clip",
|
|
4665
|
+
width: It,
|
|
4666
|
+
minWidth: It,
|
|
4667
|
+
height: R + jr
|
|
4668
|
+
},
|
|
4669
|
+
children: [/* @__PURE__ */ d(En, {
|
|
4670
|
+
pane: "left",
|
|
4671
|
+
ownsRowHeader: !0,
|
|
4672
|
+
leadingWidth: Pt,
|
|
4673
|
+
headerHeight: R,
|
|
4674
|
+
rowHeaderCellStyle: ra,
|
|
4675
|
+
headerRowClassName: B?.headerRow,
|
|
4676
|
+
headerCellClassName: B?.headerCell,
|
|
4677
|
+
rowHeaderCellClassName: B?.rowHeaderCell,
|
|
4678
|
+
isCornerHovered: Ue,
|
|
4679
|
+
isWholeGridSelected: Xr,
|
|
4680
|
+
filteredRowsLength: Q,
|
|
4681
|
+
visibleColumnsLength: V.length,
|
|
4682
|
+
renderEntries: Ir,
|
|
4683
|
+
hoveredColumnIndex: Xe,
|
|
4684
|
+
selectionSnapshot: yt,
|
|
4685
|
+
columnFilterValues: W.filters.columnFilters,
|
|
4686
|
+
sortState: W.sort,
|
|
4687
|
+
iconButtonClassName: B?.iconButton,
|
|
4688
|
+
onCornerPointerDown: li,
|
|
4689
|
+
onCornerPointerEnter: fi,
|
|
4690
|
+
onCornerPointerLeave: pi,
|
|
4691
|
+
onColumnHeaderPointerDown: Jr,
|
|
4692
|
+
onColumnHeaderPointerEnter: Yr,
|
|
4693
|
+
onColumnHeaderPointerLeave: di,
|
|
4694
|
+
onColumnFilterButtonPointerDown: Kt,
|
|
4695
|
+
onColumnResizePointerDown: mi,
|
|
4696
|
+
enableColumnMenu: xe,
|
|
4697
|
+
openedMenuColumnKey: Qt,
|
|
4698
|
+
onColumnMenuButtonPointerDown: en,
|
|
4699
|
+
onColumnHeaderContextMenu: tn,
|
|
4700
|
+
onColumnDragHandlePointerDown: Ai
|
|
4701
|
+
}), /* @__PURE__ */ f("div", {
|
|
4702
|
+
style: {
|
|
4703
|
+
position: "absolute",
|
|
4704
|
+
top: 0,
|
|
4705
|
+
left: 0,
|
|
4706
|
+
width: It,
|
|
4707
|
+
height: R + jr,
|
|
4708
|
+
transform: Mr
|
|
4709
|
+
},
|
|
4710
|
+
children: [
|
|
4711
|
+
/* @__PURE__ */ d(D, {
|
|
4712
|
+
rect: ci("left"),
|
|
4713
|
+
headerHeight: R,
|
|
4714
|
+
baseOffset: Pr,
|
|
4715
|
+
leadingWidth: Pt
|
|
4716
|
+
}),
|
|
4717
|
+
/* @__PURE__ */ d(O, {
|
|
4718
|
+
rect: Br("left"),
|
|
4719
|
+
headerHeight: R,
|
|
4720
|
+
baseOffset: Pr,
|
|
4721
|
+
leadingWidth: Pt
|
|
4722
|
+
}),
|
|
4723
|
+
/* @__PURE__ */ d(k, {
|
|
4724
|
+
rect: Vr("left"),
|
|
4725
|
+
headerHeight: R,
|
|
4726
|
+
baseOffset: Pr,
|
|
4727
|
+
leadingWidth: Pt,
|
|
4728
|
+
initialValue: Ve,
|
|
4729
|
+
onCommit: ri,
|
|
4730
|
+
onCancel: ii
|
|
4731
|
+
}),
|
|
4732
|
+
/* @__PURE__ */ d(Cn, {
|
|
4733
|
+
pane: "left",
|
|
4734
|
+
ownsRowHeader: !0,
|
|
4735
|
+
leadingWidth: Pt,
|
|
4736
|
+
rowModel: Z,
|
|
4737
|
+
virtualRows: Dr,
|
|
4738
|
+
virtualRowIndexes: Or,
|
|
4739
|
+
renderEntries: Ir,
|
|
4740
|
+
rowHeight: I,
|
|
4741
|
+
autoHeight: _r,
|
|
4742
|
+
isServerSide: U,
|
|
4743
|
+
rowHeaderCellStyle: ra,
|
|
4744
|
+
hoveredRowIndex: qe,
|
|
4745
|
+
isWholeGridSelected: Xr,
|
|
4746
|
+
activeCell: W.activeCell,
|
|
4747
|
+
editingCell: W.editingCell,
|
|
4748
|
+
selectionSnapshot: yt,
|
|
4749
|
+
readOnly: se,
|
|
4750
|
+
canEditCell: ce,
|
|
4751
|
+
onRowHeaderPointerDown: Kr,
|
|
4752
|
+
onRowHeaderPointerEnter: qr,
|
|
4753
|
+
onRowHeaderPointerLeave: ui,
|
|
4754
|
+
onCellPointerDown: Ur,
|
|
4755
|
+
onCellPointerEnter: Wr,
|
|
4756
|
+
onCellDoubleClick: ai,
|
|
4757
|
+
renderCellContent: ta,
|
|
4758
|
+
getRowClassName: Me,
|
|
4759
|
+
bodyCellClassName: B?.bodyCell,
|
|
4760
|
+
bodyRowClassName: B?.bodyRow,
|
|
4761
|
+
rowHeaderCellClassName: B?.rowHeaderCell
|
|
4762
|
+
})
|
|
4763
|
+
]
|
|
4764
|
+
})]
|
|
4765
|
+
}), /* @__PURE__ */ d("div", {
|
|
4766
|
+
ref: Di,
|
|
4767
|
+
style: ji
|
|
4768
|
+
})]
|
|
4769
|
+
}),
|
|
4770
|
+
/* @__PURE__ */ d("div", {
|
|
4771
|
+
ref: Ie,
|
|
4772
|
+
className: "ssg-center-pane",
|
|
4773
|
+
style: {
|
|
4774
|
+
width: Rt,
|
|
4775
|
+
minWidth: Rt
|
|
4776
|
+
},
|
|
4777
|
+
children: /* @__PURE__ */ f("div", {
|
|
4778
|
+
style: {
|
|
4779
|
+
position: "relative",
|
|
4780
|
+
overflow: "clip",
|
|
4781
|
+
width: Rt,
|
|
4782
|
+
minWidth: Rt,
|
|
4783
|
+
height: R + jr
|
|
4784
|
+
},
|
|
4785
|
+
children: [
|
|
4786
|
+
/* @__PURE__ */ d(En, {
|
|
4787
|
+
pane: "center",
|
|
4788
|
+
ownsRowHeader: Nt,
|
|
4789
|
+
leadingWidth: Ft,
|
|
4790
|
+
headerHeight: R,
|
|
4791
|
+
rowHeaderCellStyle: ra,
|
|
4792
|
+
headerRowClassName: B?.headerRow,
|
|
4793
|
+
headerCellClassName: B?.headerCell,
|
|
4794
|
+
rowHeaderCellClassName: B?.rowHeaderCell,
|
|
4795
|
+
isCornerHovered: Ue,
|
|
4796
|
+
isWholeGridSelected: Xr,
|
|
4797
|
+
filteredRowsLength: Q,
|
|
4798
|
+
visibleColumnsLength: V.length,
|
|
4799
|
+
renderEntries: Fr,
|
|
4800
|
+
hoveredColumnIndex: Xe,
|
|
4801
|
+
selectionSnapshot: yt,
|
|
4802
|
+
columnFilterValues: W.filters.columnFilters,
|
|
4803
|
+
sortState: W.sort,
|
|
4804
|
+
iconButtonClassName: B?.iconButton,
|
|
4805
|
+
onCornerPointerDown: li,
|
|
4806
|
+
onCornerPointerEnter: fi,
|
|
4807
|
+
onCornerPointerLeave: pi,
|
|
4808
|
+
onColumnHeaderPointerDown: Jr,
|
|
4809
|
+
onColumnHeaderPointerEnter: Yr,
|
|
4810
|
+
onColumnHeaderPointerLeave: di,
|
|
4811
|
+
onColumnFilterButtonPointerDown: Kt,
|
|
4812
|
+
onColumnResizePointerDown: mi,
|
|
4813
|
+
enableColumnMenu: xe,
|
|
4814
|
+
openedMenuColumnKey: Qt,
|
|
4815
|
+
onColumnMenuButtonPointerDown: en,
|
|
4816
|
+
onColumnHeaderContextMenu: tn,
|
|
4817
|
+
onColumnDragHandlePointerDown: Ai
|
|
4818
|
+
}),
|
|
4819
|
+
/* @__PURE__ */ f("div", {
|
|
4820
|
+
style: {
|
|
4821
|
+
position: "absolute",
|
|
4822
|
+
top: 0,
|
|
4823
|
+
left: 0,
|
|
4824
|
+
width: Rt,
|
|
4825
|
+
height: R + jr,
|
|
4826
|
+
transform: Mr
|
|
4827
|
+
},
|
|
4828
|
+
children: [
|
|
4829
|
+
/* @__PURE__ */ d(D, {
|
|
4830
|
+
rect: ci("center"),
|
|
4831
|
+
headerHeight: R,
|
|
4832
|
+
baseOffset: Pr,
|
|
4833
|
+
leadingWidth: Ft
|
|
4834
|
+
}),
|
|
4835
|
+
/* @__PURE__ */ d(O, {
|
|
4836
|
+
rect: Br("center"),
|
|
4837
|
+
headerHeight: R,
|
|
4838
|
+
baseOffset: Pr,
|
|
4839
|
+
leadingWidth: Ft
|
|
4840
|
+
}),
|
|
4841
|
+
/* @__PURE__ */ d(k, {
|
|
4842
|
+
rect: Vr("center"),
|
|
4843
|
+
headerHeight: R,
|
|
4844
|
+
baseOffset: Pr,
|
|
4845
|
+
leadingWidth: Ft,
|
|
4846
|
+
initialValue: Ve,
|
|
4847
|
+
onCommit: ri,
|
|
4848
|
+
onCancel: ii
|
|
4849
|
+
}),
|
|
4850
|
+
/* @__PURE__ */ d(Cn, {
|
|
4851
|
+
pane: "center",
|
|
4852
|
+
ownsRowHeader: Nt,
|
|
4853
|
+
leadingWidth: Ft,
|
|
4854
|
+
rowModel: Z,
|
|
4855
|
+
virtualRows: Dr,
|
|
4856
|
+
virtualRowIndexes: Or,
|
|
4857
|
+
renderEntries: Fr,
|
|
4858
|
+
rowHeight: I,
|
|
4859
|
+
autoHeight: _r,
|
|
4860
|
+
isServerSide: U,
|
|
4861
|
+
rowHeaderCellStyle: ra,
|
|
4862
|
+
hoveredRowIndex: qe,
|
|
4863
|
+
isWholeGridSelected: Xr,
|
|
4864
|
+
activeCell: W.activeCell,
|
|
4865
|
+
editingCell: W.editingCell,
|
|
4866
|
+
selectionSnapshot: yt,
|
|
4867
|
+
readOnly: se,
|
|
4868
|
+
canEditCell: ce,
|
|
4869
|
+
onRowHeaderPointerDown: Kr,
|
|
4870
|
+
onRowHeaderPointerEnter: qr,
|
|
4871
|
+
onRowHeaderPointerLeave: ui,
|
|
4872
|
+
onCellPointerDown: Ur,
|
|
4873
|
+
onCellPointerEnter: Wr,
|
|
4874
|
+
onCellDoubleClick: ai,
|
|
4875
|
+
renderCellContent: ta,
|
|
4876
|
+
getRowClassName: Me,
|
|
4877
|
+
bodyCellClassName: B?.bodyCell,
|
|
4878
|
+
bodyRowClassName: B?.bodyRow,
|
|
4879
|
+
rowHeaderCellClassName: B?.rowHeaderCell
|
|
4880
|
+
})
|
|
4881
|
+
]
|
|
4882
|
+
}),
|
|
4883
|
+
/* @__PURE__ */ d("div", {
|
|
4884
|
+
ref: Oi,
|
|
4885
|
+
style: ji
|
|
4886
|
+
})
|
|
4887
|
+
]
|
|
4888
|
+
})
|
|
4889
|
+
}),
|
|
4890
|
+
/* @__PURE__ */ f("div", {
|
|
4891
|
+
ref: Be,
|
|
4892
|
+
style: aa("right", Lt, Mt),
|
|
4893
|
+
children: [Mt && /* @__PURE__ */ f("div", {
|
|
4894
|
+
style: {
|
|
4895
|
+
position: "relative",
|
|
4896
|
+
overflow: "clip",
|
|
4897
|
+
width: Lt,
|
|
4898
|
+
minWidth: Lt,
|
|
4899
|
+
height: R + jr
|
|
4900
|
+
},
|
|
4901
|
+
children: [/* @__PURE__ */ d(En, {
|
|
4902
|
+
pane: "right",
|
|
4903
|
+
ownsRowHeader: !1,
|
|
4904
|
+
leadingWidth: 0,
|
|
4905
|
+
headerHeight: R,
|
|
4906
|
+
rowHeaderCellStyle: ra,
|
|
4907
|
+
headerRowClassName: B?.headerRow,
|
|
4908
|
+
headerCellClassName: B?.headerCell,
|
|
4909
|
+
rowHeaderCellClassName: B?.rowHeaderCell,
|
|
4910
|
+
isCornerHovered: Ue,
|
|
4911
|
+
isWholeGridSelected: Xr,
|
|
4912
|
+
filteredRowsLength: Q,
|
|
4913
|
+
visibleColumnsLength: V.length,
|
|
4914
|
+
renderEntries: Lr,
|
|
4915
|
+
hoveredColumnIndex: Xe,
|
|
4916
|
+
selectionSnapshot: yt,
|
|
4917
|
+
columnFilterValues: W.filters.columnFilters,
|
|
4918
|
+
sortState: W.sort,
|
|
4919
|
+
iconButtonClassName: B?.iconButton,
|
|
4920
|
+
onCornerPointerDown: li,
|
|
4921
|
+
onCornerPointerEnter: fi,
|
|
4922
|
+
onCornerPointerLeave: pi,
|
|
4923
|
+
onColumnHeaderPointerDown: Jr,
|
|
4924
|
+
onColumnHeaderPointerEnter: Yr,
|
|
4925
|
+
onColumnHeaderPointerLeave: di,
|
|
4926
|
+
onColumnFilterButtonPointerDown: Kt,
|
|
4927
|
+
onColumnResizePointerDown: mi,
|
|
4928
|
+
enableColumnMenu: xe,
|
|
4929
|
+
openedMenuColumnKey: Qt,
|
|
4930
|
+
onColumnMenuButtonPointerDown: en,
|
|
4931
|
+
onColumnHeaderContextMenu: tn,
|
|
4932
|
+
onColumnDragHandlePointerDown: Ai
|
|
4933
|
+
}), /* @__PURE__ */ f("div", {
|
|
4934
|
+
style: {
|
|
4935
|
+
position: "absolute",
|
|
4936
|
+
top: 0,
|
|
4937
|
+
left: 0,
|
|
4938
|
+
width: Lt,
|
|
4939
|
+
height: R + jr,
|
|
4940
|
+
transform: Mr
|
|
4941
|
+
},
|
|
4942
|
+
children: [
|
|
4943
|
+
/* @__PURE__ */ d(D, {
|
|
4944
|
+
rect: ci("right"),
|
|
4945
|
+
headerHeight: R,
|
|
4946
|
+
baseOffset: Pr,
|
|
4947
|
+
leadingWidth: 0
|
|
4948
|
+
}),
|
|
4949
|
+
/* @__PURE__ */ d(O, {
|
|
4950
|
+
rect: Br("right"),
|
|
4951
|
+
headerHeight: R,
|
|
4952
|
+
baseOffset: Pr,
|
|
4953
|
+
leadingWidth: 0
|
|
4954
|
+
}),
|
|
4955
|
+
/* @__PURE__ */ d(k, {
|
|
4956
|
+
rect: Vr("right"),
|
|
4957
|
+
headerHeight: R,
|
|
4958
|
+
baseOffset: Pr,
|
|
4959
|
+
leadingWidth: 0,
|
|
4960
|
+
initialValue: Ve,
|
|
4961
|
+
onCommit: ri,
|
|
4962
|
+
onCancel: ii
|
|
4963
|
+
}),
|
|
4964
|
+
/* @__PURE__ */ d(Cn, {
|
|
4965
|
+
pane: "right",
|
|
4966
|
+
ownsRowHeader: !1,
|
|
4967
|
+
leadingWidth: 0,
|
|
4968
|
+
rowModel: Z,
|
|
4969
|
+
virtualRows: Dr,
|
|
4970
|
+
virtualRowIndexes: Or,
|
|
4971
|
+
renderEntries: Lr,
|
|
4972
|
+
rowHeight: I,
|
|
4973
|
+
autoHeight: _r,
|
|
4974
|
+
isServerSide: U,
|
|
4975
|
+
rowHeaderCellStyle: ra,
|
|
4976
|
+
hoveredRowIndex: qe,
|
|
4977
|
+
isWholeGridSelected: Xr,
|
|
4978
|
+
activeCell: W.activeCell,
|
|
4979
|
+
editingCell: W.editingCell,
|
|
4980
|
+
selectionSnapshot: yt,
|
|
4981
|
+
readOnly: se,
|
|
4982
|
+
canEditCell: ce,
|
|
4983
|
+
onRowHeaderPointerDown: Kr,
|
|
4984
|
+
onRowHeaderPointerEnter: qr,
|
|
4985
|
+
onRowHeaderPointerLeave: ui,
|
|
4986
|
+
onCellPointerDown: Ur,
|
|
4987
|
+
onCellPointerEnter: Wr,
|
|
4988
|
+
onCellDoubleClick: ai,
|
|
4989
|
+
renderCellContent: ta,
|
|
4990
|
+
getRowClassName: Me,
|
|
4991
|
+
bodyCellClassName: B?.bodyCell,
|
|
4992
|
+
bodyRowClassName: B?.bodyRow,
|
|
4993
|
+
rowHeaderCellClassName: B?.rowHeaderCell
|
|
4994
|
+
})
|
|
4995
|
+
]
|
|
4996
|
+
})]
|
|
4997
|
+
}), /* @__PURE__ */ d("div", {
|
|
4998
|
+
ref: ki,
|
|
4999
|
+
style: ji
|
|
5000
|
+
})]
|
|
5001
|
+
})
|
|
5002
|
+
]
|
|
5003
|
+
}), ia && /* @__PURE__ */ d("div", {
|
|
5004
|
+
className: "ssg-empty-state",
|
|
5005
|
+
children: e.length === 0 ? Ce : Se
|
|
5006
|
+
})]
|
|
5007
|
+
}), Kn && /* @__PURE__ */ d("div", {
|
|
5008
|
+
className: "ssg-autosize-overlay",
|
|
5009
|
+
children: /* @__PURE__ */ d("span", {
|
|
5010
|
+
className: "ssg-autosize-pill",
|
|
5011
|
+
children: "列幅を計算中…"
|
|
5012
|
+
})
|
|
5013
|
+
})]
|
|
5014
|
+
}),
|
|
5015
|
+
pa,
|
|
5016
|
+
sa,
|
|
5017
|
+
ca,
|
|
5018
|
+
la,
|
|
5019
|
+
ua
|
|
5020
|
+
]
|
|
5021
|
+
});
|
|
5022
|
+
}
|
|
5023
|
+
//#endregion
|
|
5024
|
+
export { lr as SpreadsheetGrid };
|