@taskctrl/canvas-grid 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas-grid.cjs.js +1 -1
- package/dist/canvas-grid.es.js +860 -849
- package/dist/dom/ColumnHeaders.d.ts +3 -1
- package/package.json +1 -1
package/dist/canvas-grid.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
class
|
|
1
|
+
import { jsxs as ve, jsx as T } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as re, useState as we, useCallback as se, useEffect as be, memo as Cn, forwardRef as yn, useMemo as wt, useImperativeHandle as xn } from "react";
|
|
3
|
+
import { createPortal as Rn } from "react-dom";
|
|
4
|
+
class en {
|
|
5
5
|
constructor(e) {
|
|
6
6
|
this.scrollX = 0, this.scrollY = 0, this.canvasWidth = 0, this.canvasHeight = 0, this.rowHeight = 32, this.pinnedWidth = 0, this._columnOffsets = [], this._columnWidths = [], this._pinnedOffsets = [], this._pinnedWidths = [], this._scrollableOffsets = [], this._scrollableWidths = [], e && this.update(e);
|
|
7
7
|
}
|
|
@@ -68,8 +68,8 @@ class Zt {
|
|
|
68
68
|
return -1;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
class
|
|
71
|
+
const Nt = ["grid", "cells", "overlay"];
|
|
72
|
+
class In {
|
|
73
73
|
constructor(e) {
|
|
74
74
|
this._dirty = { grid: !1, cells: !1, overlay: !1 }, this._rafId = null, this._drawFn = e;
|
|
75
75
|
}
|
|
@@ -77,7 +77,7 @@ class yn {
|
|
|
77
77
|
this._dirty[e] = !0, this._rafId === null && (this._rafId = requestAnimationFrame(() => this._flush()));
|
|
78
78
|
}
|
|
79
79
|
markAllDirty() {
|
|
80
|
-
for (const e of
|
|
80
|
+
for (const e of Nt)
|
|
81
81
|
this._dirty[e] = !0;
|
|
82
82
|
this._rafId === null && (this._rafId = requestAnimationFrame(() => this._flush()));
|
|
83
83
|
}
|
|
@@ -86,11 +86,11 @@ class yn {
|
|
|
86
86
|
}
|
|
87
87
|
_flush() {
|
|
88
88
|
this._rafId = null;
|
|
89
|
-
for (const e of
|
|
89
|
+
for (const e of Nt)
|
|
90
90
|
this._dirty[e] && (this._dirty[e] = !1, this._drawFn(e));
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
class
|
|
93
|
+
class Sn {
|
|
94
94
|
constructor(e, o) {
|
|
95
95
|
this._rows = e, this._expandedRows = o, this._depthMap = /* @__PURE__ */ new Map(), this._childrenMap = /* @__PURE__ */ new Map(), this._buildMaps(), this._flattenedRows = this._buildFlattenedRows();
|
|
96
96
|
}
|
|
@@ -145,8 +145,8 @@ class xn {
|
|
|
145
145
|
return { startIndex: r, endIndex: c };
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
const
|
|
149
|
-
class
|
|
148
|
+
const Mn = 30;
|
|
149
|
+
class Ae {
|
|
150
150
|
constructor(e) {
|
|
151
151
|
this._columns = e;
|
|
152
152
|
}
|
|
@@ -214,10 +214,10 @@ class Pe {
|
|
|
214
214
|
const n = this.getScrollableColumns();
|
|
215
215
|
if (n.length === 0) return { startIndex: 0, endIndex: 0 };
|
|
216
216
|
const r = this.getPinnedWidth(), c = o - r;
|
|
217
|
-
let a = 0,
|
|
218
|
-
for (let
|
|
219
|
-
a + n[
|
|
220
|
-
return
|
|
217
|
+
let a = 0, h = 0, g = n.length - 1;
|
|
218
|
+
for (let R = 0; R < n.length; R++)
|
|
219
|
+
a + n[R].width <= e && (h = R + 1), a < e + c && (g = R), a += n[R].width;
|
|
220
|
+
return h = Math.min(h, n.length - 1), g = Math.min(g, n.length - 1), { startIndex: h, endIndex: g };
|
|
221
221
|
}
|
|
222
222
|
/** Returns the range of pinned columns (always all of them). */
|
|
223
223
|
getPinnedRange() {
|
|
@@ -227,32 +227,32 @@ class Pe {
|
|
|
227
227
|
resize(e, o) {
|
|
228
228
|
const n = this._columns.map((r) => {
|
|
229
229
|
if (r.id !== e) return r;
|
|
230
|
-
const c = r.minWidth ??
|
|
230
|
+
const c = r.minWidth ?? Mn;
|
|
231
231
|
return { ...r, width: Math.max(c, o) };
|
|
232
232
|
});
|
|
233
|
-
return new
|
|
233
|
+
return new Ae(n);
|
|
234
234
|
}
|
|
235
235
|
reorder(e, o) {
|
|
236
|
-
const n = [...this._columns], r = n.findIndex((
|
|
237
|
-
if (r === -1) return new
|
|
236
|
+
const n = [...this._columns], r = n.findIndex((h) => h.id === e);
|
|
237
|
+
if (r === -1) return new Ae(n);
|
|
238
238
|
const [c] = n.splice(r, 1), a = Math.max(0, Math.min(o, n.length));
|
|
239
|
-
return n.splice(a, 0, c), new
|
|
239
|
+
return n.splice(a, 0, c), new Ae(n);
|
|
240
240
|
}
|
|
241
241
|
hide(e) {
|
|
242
242
|
const o = this._columns.map((n) => n.id === e ? { ...n, hidden: !0 } : n);
|
|
243
|
-
return new
|
|
243
|
+
return new Ae(o);
|
|
244
244
|
}
|
|
245
245
|
show(e) {
|
|
246
246
|
const o = this._columns.map(
|
|
247
247
|
(n) => n.id === e ? { ...n, hidden: !1 } : n
|
|
248
248
|
);
|
|
249
|
-
return new
|
|
249
|
+
return new Ae(o);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function $e(t, e) {
|
|
253
253
|
return `${t}|${e}`;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function bt() {
|
|
256
256
|
return {
|
|
257
257
|
cells: /* @__PURE__ */ new Set(),
|
|
258
258
|
rows: /* @__PURE__ */ new Set(),
|
|
@@ -260,22 +260,22 @@ function wt() {
|
|
|
260
260
|
anchor: void 0
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
class
|
|
263
|
+
class _n {
|
|
264
264
|
constructor(e) {
|
|
265
265
|
e ? this._selection = {
|
|
266
266
|
cells: new Set(e.cells),
|
|
267
267
|
rows: new Set(e.rows),
|
|
268
268
|
columns: new Set(e.columns),
|
|
269
269
|
anchor: e.anchor
|
|
270
|
-
} : this._selection =
|
|
270
|
+
} : this._selection = bt();
|
|
271
271
|
}
|
|
272
272
|
// Single click — clear previous, select one cell, set anchor
|
|
273
273
|
click(e, o, n, r) {
|
|
274
|
-
this._selection =
|
|
274
|
+
this._selection = bt(), this._selection.cells.add($e(e, o)), this._selection.anchor = { rowId: e, colId: o };
|
|
275
275
|
}
|
|
276
276
|
// Ctrl+click — toggle cell in/out of selection
|
|
277
277
|
ctrlClick(e, o) {
|
|
278
|
-
const n =
|
|
278
|
+
const n = $e(e, o);
|
|
279
279
|
this._selection.cells.has(n) ? this._selection.cells.delete(n) : this._selection.cells.add(n), this._selection.anchor = { rowId: e, colId: o };
|
|
280
280
|
}
|
|
281
281
|
// Shift+click — select rectangle from anchor to target
|
|
@@ -285,30 +285,30 @@ class Rn {
|
|
|
285
285
|
this.click(e, o, n, r);
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
|
-
const a = n.indexOf(c.rowId),
|
|
289
|
-
for (let B = W; B <=
|
|
290
|
-
for (let
|
|
291
|
-
|
|
292
|
-
this._selection.cells =
|
|
288
|
+
const a = n.indexOf(c.rowId), h = n.indexOf(e), g = r.indexOf(c.colId), R = r.indexOf(o), W = Math.min(a, h), O = Math.max(a, h), H = Math.min(g, R), M = Math.max(g, R), X = /* @__PURE__ */ new Set();
|
|
289
|
+
for (let B = W; B <= O; B++)
|
|
290
|
+
for (let G = H; G <= M; G++)
|
|
291
|
+
X.add($e(n[B], r[G]));
|
|
292
|
+
this._selection.cells = X, this._selection.rows = /* @__PURE__ */ new Set(), this._selection.columns = /* @__PURE__ */ new Set();
|
|
293
293
|
}
|
|
294
294
|
// Select entire row
|
|
295
295
|
selectRow(e, o) {
|
|
296
296
|
for (const n of o)
|
|
297
|
-
this._selection.cells.add(
|
|
297
|
+
this._selection.cells.add($e(e, n));
|
|
298
298
|
this._selection.rows.add(e), this._selection.anchor = { rowId: e, colId: o[0] ?? "" };
|
|
299
299
|
}
|
|
300
300
|
// Select entire column
|
|
301
301
|
selectColumn(e, o) {
|
|
302
302
|
for (const n of o)
|
|
303
|
-
this._selection.cells.add(
|
|
303
|
+
this._selection.cells.add($e(n, e));
|
|
304
304
|
this._selection.columns.add(e), this._selection.anchor = { rowId: o[0] ?? "", colId: e };
|
|
305
305
|
}
|
|
306
306
|
// Clear all selection
|
|
307
307
|
clear() {
|
|
308
|
-
this._selection =
|
|
308
|
+
this._selection = bt();
|
|
309
309
|
}
|
|
310
310
|
isSelected(e, o) {
|
|
311
|
-
return this._selection.cells.has(
|
|
311
|
+
return this._selection.cells.has($e(e, o));
|
|
312
312
|
}
|
|
313
313
|
isRowSelected(e) {
|
|
314
314
|
return this._selection.rows.has(e);
|
|
@@ -329,230 +329,230 @@ class Rn {
|
|
|
329
329
|
function rt(t, e, o, n, r) {
|
|
330
330
|
const c = o.yToRow(e), a = n.flattenedRows;
|
|
331
331
|
if (c < 0 || c >= a.length) return null;
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
334
|
-
if (t <
|
|
335
|
-
let
|
|
336
|
-
for (const
|
|
337
|
-
if (t >=
|
|
338
|
-
return { rowId: a[c].id, colId:
|
|
339
|
-
|
|
332
|
+
const h = r.getPinnedColumns(), g = r.getPinnedWidth();
|
|
333
|
+
if (h.length > 0) {
|
|
334
|
+
if (t < g) {
|
|
335
|
+
let M = 0;
|
|
336
|
+
for (const X of h) {
|
|
337
|
+
if (t >= M && t < M + X.width)
|
|
338
|
+
return { rowId: a[c].id, colId: X.id };
|
|
339
|
+
M += X.width;
|
|
340
340
|
}
|
|
341
341
|
return null;
|
|
342
342
|
}
|
|
343
|
-
const W = t -
|
|
344
|
-
let
|
|
345
|
-
for (const
|
|
346
|
-
if (W >=
|
|
347
|
-
return { rowId: a[c].id, colId:
|
|
348
|
-
|
|
343
|
+
const W = t - g + o.scrollX, O = r.getScrollableColumns();
|
|
344
|
+
let H = 0;
|
|
345
|
+
for (const M of O) {
|
|
346
|
+
if (W >= H && W < H + M.width)
|
|
347
|
+
return { rowId: a[c].id, colId: M.id };
|
|
348
|
+
H += M.width;
|
|
349
349
|
}
|
|
350
350
|
return null;
|
|
351
351
|
}
|
|
352
|
-
const
|
|
353
|
-
return
|
|
352
|
+
const R = r.getColumnAtX(t + o.scrollX);
|
|
353
|
+
return R === null ? null : { rowId: a[c].id, colId: R };
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function kn(t, e, o) {
|
|
356
356
|
const n = window.devicePixelRatio || 1;
|
|
357
357
|
(t.width !== Math.round(e * n) || t.height !== Math.round(o * n)) && (t.width = Math.round(e * n), t.height = Math.round(o * n), t.style.width = `${e}px`, t.style.height = `${o}px`);
|
|
358
358
|
const c = t.getContext("2d");
|
|
359
359
|
return c.setTransform(n, 0, 0, n, 0, 0), c;
|
|
360
360
|
}
|
|
361
|
-
function
|
|
362
|
-
const { canvasWidth: c, canvasHeight: a, rowHeight:
|
|
361
|
+
function tn(t, e, o, n, r = {}) {
|
|
362
|
+
const { canvasWidth: c, canvasHeight: a, rowHeight: h } = e, { rowStyle: g } = r;
|
|
363
363
|
t.clearRect(0, 0, c, a), t.fillStyle = "#f3f4f6", t.fillRect(0, 0, c, a);
|
|
364
|
-
const
|
|
365
|
-
if (W.length === 0 ||
|
|
366
|
-
const B = n.getTotalWidth(),
|
|
367
|
-
for (let
|
|
368
|
-
const
|
|
369
|
-
if (!
|
|
370
|
-
const
|
|
371
|
-
let
|
|
372
|
-
if (
|
|
373
|
-
const
|
|
374
|
-
|
|
364
|
+
const R = o.getVisibleRange(e.scrollY, a, h), W = o.flattenedRows, O = n.getPinnedColumns(), H = n.getScrollableColumns(), M = n.getPinnedWidth(), X = O.length > 0;
|
|
365
|
+
if (W.length === 0 || O.length === 0 && H.length === 0) return;
|
|
366
|
+
const B = n.getTotalWidth(), G = Math.min(c, B - e.scrollX + (X ? e.scrollX : 0)), P = X ? Math.min(c, M + n.getScrollableColumns().reduce((D, u) => D + u.width, 0) - e.scrollX) : G, j = W.length * h, F = Math.min(a, j - e.scrollY);
|
|
367
|
+
for (let D = R.startIndex; D <= R.endIndex; D++) {
|
|
368
|
+
const u = W[D];
|
|
369
|
+
if (!u) continue;
|
|
370
|
+
const x = e.rowToY(D), z = o.getDepth(u.id);
|
|
371
|
+
let v = D % 2 === 0 ? "#ffffff" : "#f9fafb";
|
|
372
|
+
if (g) {
|
|
373
|
+
const m = g(u, z);
|
|
374
|
+
m != null && m.backgroundColor && (v = m.backgroundColor);
|
|
375
375
|
}
|
|
376
|
-
t.fillStyle =
|
|
376
|
+
t.fillStyle = v, t.fillRect(0, x, Math.max(P, M), h), t.strokeStyle = "#d1d5db", t.lineWidth = 0.5, t.beginPath(), t.moveTo(0, x + h), t.lineTo(Math.max(P, M), x + h), t.stroke();
|
|
377
377
|
}
|
|
378
|
-
if (
|
|
379
|
-
const
|
|
378
|
+
if (F > 0) {
|
|
379
|
+
const D = n.getVisibleRange(e.scrollX, c);
|
|
380
380
|
t.strokeStyle = "#d1d5db", t.lineWidth = 0.5;
|
|
381
|
-
for (let
|
|
382
|
-
const
|
|
383
|
-
if (!
|
|
384
|
-
const
|
|
385
|
-
t.beginPath(), t.moveTo(
|
|
381
|
+
for (let u = D.startIndex; u <= D.endIndex; u++) {
|
|
382
|
+
const x = H[u];
|
|
383
|
+
if (!x) continue;
|
|
384
|
+
const z = e.colToX(u, !1);
|
|
385
|
+
t.beginPath(), t.moveTo(z + x.width, 0), t.lineTo(z + x.width, F), t.stroke();
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
if (
|
|
389
|
-
t.fillStyle = "#ffffff", t.fillRect(0, 0,
|
|
390
|
-
for (let
|
|
391
|
-
const
|
|
392
|
-
if (!
|
|
393
|
-
const
|
|
394
|
-
let
|
|
395
|
-
if (
|
|
396
|
-
const
|
|
397
|
-
|
|
388
|
+
if (X && F > 0) {
|
|
389
|
+
t.fillStyle = "#ffffff", t.fillRect(0, 0, M, a);
|
|
390
|
+
for (let u = R.startIndex; u <= R.endIndex; u++) {
|
|
391
|
+
const x = W[u];
|
|
392
|
+
if (!x) continue;
|
|
393
|
+
const z = e.rowToY(u), v = o.getDepth(x.id);
|
|
394
|
+
let m = u % 2 === 0 ? "#ffffff" : "#f9fafb";
|
|
395
|
+
if (g) {
|
|
396
|
+
const _ = g(x, v);
|
|
397
|
+
_ != null && _.backgroundColor && (m = _.backgroundColor);
|
|
398
398
|
}
|
|
399
|
-
t.fillStyle =
|
|
399
|
+
t.fillStyle = m, t.fillRect(0, z, M, h), t.strokeStyle = "#d1d5db", t.lineWidth = 0.5, t.beginPath(), t.moveTo(0, z + h), t.lineTo(M, z + h), t.stroke();
|
|
400
400
|
}
|
|
401
|
-
const
|
|
401
|
+
const D = n.getPinnedRange();
|
|
402
402
|
t.strokeStyle = "#d1d5db", t.lineWidth = 0.5;
|
|
403
|
-
for (let
|
|
404
|
-
const
|
|
405
|
-
if (!
|
|
406
|
-
const
|
|
407
|
-
t.beginPath(), t.moveTo(
|
|
403
|
+
for (let u = D.startIndex; u <= D.endIndex; u++) {
|
|
404
|
+
const x = O[u];
|
|
405
|
+
if (!x) continue;
|
|
406
|
+
const z = e.colToX(u, !0);
|
|
407
|
+
t.beginPath(), t.moveTo(z + x.width, 0), t.lineTo(z + x.width, F), t.stroke();
|
|
408
408
|
}
|
|
409
|
-
t.strokeStyle = "#d1d5db", t.lineWidth = 1, t.beginPath(), t.moveTo(
|
|
409
|
+
t.strokeStyle = "#d1d5db", t.lineWidth = 1, t.beginPath(), t.moveTo(M, 0), t.lineTo(M, F), t.stroke();
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
function
|
|
413
|
-
function e(a,
|
|
414
|
-
t.fillStyle =
|
|
415
|
-
}
|
|
416
|
-
function o(a,
|
|
417
|
-
t.fillText(a,
|
|
418
|
-
}
|
|
419
|
-
function n(a,
|
|
420
|
-
if (t.measureText(a).width <=
|
|
421
|
-
let
|
|
422
|
-
for (;
|
|
423
|
-
if (
|
|
424
|
-
return
|
|
412
|
+
function Tn(t) {
|
|
413
|
+
function e(a, h, g, R, W, O) {
|
|
414
|
+
t.fillStyle = O, t.beginPath(), t.roundRect(a, h, g, R, W), t.fill();
|
|
415
|
+
}
|
|
416
|
+
function o(a, h, g, R) {
|
|
417
|
+
t.fillText(a, h, g, R);
|
|
418
|
+
}
|
|
419
|
+
function n(a, h) {
|
|
420
|
+
if (t.measureText(a).width <= h) return a;
|
|
421
|
+
let g = a;
|
|
422
|
+
for (; g.length > 0; )
|
|
423
|
+
if (g = g.slice(0, -1), t.measureText(g + "…").width <= h)
|
|
424
|
+
return g + "…";
|
|
425
425
|
return "…";
|
|
426
426
|
}
|
|
427
|
-
function r(a,
|
|
428
|
-
const
|
|
429
|
-
return e(a,
|
|
427
|
+
function r(a, h, g, R, W) {
|
|
428
|
+
const X = t.measureText(g).width + 16;
|
|
429
|
+
return e(a, h, X, 20, 20 / 2, R), t.fillStyle = W, t.fillText(g, a + 8, h + 20 / 2), X;
|
|
430
430
|
}
|
|
431
|
-
function c(a,
|
|
432
|
-
e(a,
|
|
433
|
-
const
|
|
434
|
-
|
|
431
|
+
function c(a, h, g, R, W, O) {
|
|
432
|
+
e(a, h, g, R, R / 2, "#d1d5db");
|
|
433
|
+
const H = g * Math.max(0, Math.min(1, W));
|
|
434
|
+
H > 0 && e(a, h, H, R, R / 2, O);
|
|
435
435
|
}
|
|
436
436
|
return { roundRect: e, fillText: o, truncateText: n, badge: r, progressBar: c };
|
|
437
437
|
}
|
|
438
|
-
function
|
|
439
|
-
const { canvasWidth: a, canvasHeight:
|
|
440
|
-
c.clearBackground !== !1 && t.clearRect(0, 0, a,
|
|
441
|
-
const
|
|
442
|
-
if (
|
|
443
|
-
const
|
|
444
|
-
const
|
|
445
|
-
selected: r.isSelected(
|
|
446
|
-
hovered:
|
|
447
|
-
rowSelected: r.isRowSelected(
|
|
448
|
-
colSelected: r.isColumnSelected(
|
|
438
|
+
function nn(t, e, o, n, r, c) {
|
|
439
|
+
const { canvasWidth: a, canvasHeight: h, rowHeight: g } = e, { cellRenderer: R, getCellData: W, hoveredCell: O } = c;
|
|
440
|
+
c.clearBackground !== !1 && t.clearRect(0, 0, a, h);
|
|
441
|
+
const H = o.getVisibleRange(e.scrollY, h, g), M = o.flattenedRows, X = n.getPinnedColumns(), B = n.getScrollableColumns(), G = X.length > 0;
|
|
442
|
+
if (M.length === 0 || X.length === 0 && B.length === 0) return;
|
|
443
|
+
const P = Tn(t), j = (u, x, z, v) => {
|
|
444
|
+
const m = { x: z, y: v, width: x.width, height: g }, _ = { rowId: u.id, colId: x.id, data: W(u.id, x.id) }, S = {
|
|
445
|
+
selected: r.isSelected(u.id, x.id),
|
|
446
|
+
hovered: O != null && O.rowId === u.id && O.colId === x.id,
|
|
447
|
+
rowSelected: r.isRowSelected(u.id),
|
|
448
|
+
colSelected: r.isColumnSelected(x.id),
|
|
449
449
|
filtered: !0,
|
|
450
|
-
depth: o.getDepth(
|
|
451
|
-
hasChildren: o.hasChildren(
|
|
452
|
-
expanded: o.isExpanded(
|
|
450
|
+
depth: o.getDepth(u.id),
|
|
451
|
+
hasChildren: o.hasChildren(u.id),
|
|
452
|
+
expanded: o.isExpanded(u.id)
|
|
453
453
|
};
|
|
454
|
-
t.save(), t.beginPath(), t.rect(
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
454
|
+
t.save(), t.beginPath(), t.rect(z, v, x.width, g), t.clip(), R(t, _, m, S, P), t.restore();
|
|
455
|
+
}, F = G ? n.getPinnedWidth() : 0, D = n.getVisibleRange(e.scrollX, a);
|
|
456
|
+
t.save(), G && (t.beginPath(), t.rect(F, 0, Math.max(0, a - F), h), t.clip());
|
|
457
|
+
for (let u = H.startIndex; u <= H.endIndex; u++) {
|
|
458
|
+
const x = M[u];
|
|
459
|
+
if (!x) continue;
|
|
460
|
+
const z = e.rowToY(u);
|
|
461
|
+
for (let v = D.startIndex; v <= D.endIndex; v++) {
|
|
462
|
+
const m = B[v];
|
|
463
|
+
if (!m) continue;
|
|
464
|
+
const _ = e.colToX(v, G ? !1 : void 0);
|
|
465
|
+
j(x, m, _, z);
|
|
465
466
|
}
|
|
466
467
|
}
|
|
467
|
-
if (
|
|
468
|
-
n.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
const R = e.colToX(b, !0);
|
|
479
|
-
J(T, M, R, p);
|
|
468
|
+
if (t.restore(), G) {
|
|
469
|
+
const u = n.getPinnedRange();
|
|
470
|
+
for (let x = H.startIndex; x <= H.endIndex; x++) {
|
|
471
|
+
const z = M[x];
|
|
472
|
+
if (!z) continue;
|
|
473
|
+
const v = e.rowToY(x);
|
|
474
|
+
for (let m = u.startIndex; m <= u.endIndex; m++) {
|
|
475
|
+
const _ = X[m];
|
|
476
|
+
if (!_) continue;
|
|
477
|
+
const S = e.colToX(m, !0);
|
|
478
|
+
j(z, _, S, v);
|
|
480
479
|
}
|
|
481
480
|
}
|
|
482
481
|
}
|
|
483
482
|
}
|
|
484
|
-
function
|
|
485
|
-
const { canvasWidth: a, canvasHeight:
|
|
486
|
-
t.clearRect(0, 0, a,
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
489
|
-
const
|
|
490
|
-
for (let
|
|
491
|
-
const
|
|
492
|
-
if (!
|
|
493
|
-
const
|
|
494
|
-
|
|
483
|
+
function Hn(t, e, o, n, r, c = {}) {
|
|
484
|
+
const { canvasWidth: a, canvasHeight: h, rowHeight: g } = e, { hoveredCell: R, hoveredRowId: W, selectedCell: O, resizingColumn: H, loading: M } = c;
|
|
485
|
+
t.clearRect(0, 0, a, h);
|
|
486
|
+
const X = o.getVisibleRange(e.scrollY, h, g), B = o.flattenedRows, G = n.getPinnedColumns(), P = n.getScrollableColumns(), j = G.length > 0, F = n.getPinnedWidth();
|
|
487
|
+
if (B.length === 0 || G.length === 0 && P.length === 0) return;
|
|
488
|
+
const D = n.getVisibleRange(e.scrollX, a), u = n.getPinnedRange(), x = (v) => {
|
|
489
|
+
for (let m = D.startIndex; m <= D.endIndex; m++) {
|
|
490
|
+
const _ = P[m];
|
|
491
|
+
if (!_) continue;
|
|
492
|
+
const S = j ? e.colToX(m, !1) : e.colToX(m);
|
|
493
|
+
v(_, S);
|
|
495
494
|
}
|
|
496
|
-
if (
|
|
497
|
-
for (let
|
|
498
|
-
const
|
|
499
|
-
if (!
|
|
500
|
-
const
|
|
501
|
-
|
|
495
|
+
if (j)
|
|
496
|
+
for (let m = u.startIndex; m <= u.endIndex; m++) {
|
|
497
|
+
const _ = G[m];
|
|
498
|
+
if (!_) continue;
|
|
499
|
+
const S = e.colToX(m, !0);
|
|
500
|
+
v(_, S);
|
|
502
501
|
}
|
|
503
502
|
};
|
|
504
|
-
if (
|
|
505
|
-
for (let
|
|
506
|
-
const
|
|
507
|
-
if (!
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
t.fillStyle = "rgba(59,130,246,0.06)", t.fillRect(
|
|
503
|
+
if (O) {
|
|
504
|
+
for (let v = X.startIndex; v <= X.endIndex; v++) {
|
|
505
|
+
const m = B[v];
|
|
506
|
+
if (!m || m.id !== O.rowId) continue;
|
|
507
|
+
const _ = e.rowToY(v);
|
|
508
|
+
x((S, l) => {
|
|
509
|
+
t.fillStyle = "rgba(59,130,246,0.06)", t.fillRect(l, _, S.width, g);
|
|
511
510
|
});
|
|
512
511
|
break;
|
|
513
512
|
}
|
|
514
|
-
|
|
515
|
-
if (
|
|
516
|
-
for (let
|
|
517
|
-
if (!B[
|
|
518
|
-
const
|
|
519
|
-
t.fillStyle = "rgba(59,130,246,0.06)", t.fillRect(
|
|
513
|
+
x((v, m) => {
|
|
514
|
+
if (v.id === O.colId)
|
|
515
|
+
for (let _ = X.startIndex; _ <= X.endIndex; _++) {
|
|
516
|
+
if (!B[_]) continue;
|
|
517
|
+
const l = e.rowToY(_);
|
|
518
|
+
t.fillStyle = "rgba(59,130,246,0.06)", t.fillRect(m, l, v.width, g);
|
|
520
519
|
}
|
|
521
520
|
});
|
|
522
521
|
}
|
|
523
|
-
const
|
|
524
|
-
const
|
|
525
|
-
|
|
522
|
+
const z = (v, m, _, S, l) => {
|
|
523
|
+
const q = v.width, ge = g, Pe = r.isSelected(_.id, v.id), Re = r.isRowSelected(_.id), d = r.isColumnSelected(v.id), E = W != null && W === _.id, $ = R != null && R.colId === v.id, Y = R != null && R.rowId === _.id && R.colId === v.id;
|
|
524
|
+
Pe ? (t.fillStyle = "rgba(59,130,246,0.12)", t.fillRect(m, S, q, ge), t.strokeStyle = "#3b82f6", t.lineWidth = 2, t.strokeRect(m + 1, S + 1, q - 2, ge - 2)) : Re || d || Y ? (t.fillStyle = "rgba(59,130,246,0.08)", t.fillRect(m, S, q, ge)) : (E || $) && (t.fillStyle = "rgba(59,130,246,0.04)", t.fillRect(m, S, q, ge));
|
|
526
525
|
};
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
526
|
+
t.save(), j && (t.beginPath(), t.rect(F, 0, Math.max(0, a - F), h), t.clip());
|
|
527
|
+
for (let v = X.startIndex; v <= X.endIndex; v++) {
|
|
528
|
+
const m = B[v];
|
|
529
|
+
if (!m) continue;
|
|
530
|
+
const _ = e.rowToY(v);
|
|
531
|
+
for (let S = D.startIndex; S <= D.endIndex; S++) {
|
|
532
|
+
const l = P[S];
|
|
533
|
+
if (!l) continue;
|
|
534
|
+
const q = j ? e.colToX(S, !1) : e.colToX(S);
|
|
535
|
+
z(l, q, m, _);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
if (
|
|
539
|
-
for (let
|
|
540
|
-
const
|
|
541
|
-
if (!
|
|
542
|
-
const
|
|
543
|
-
for (let
|
|
544
|
-
const
|
|
545
|
-
if (!
|
|
546
|
-
const
|
|
547
|
-
|
|
538
|
+
if (t.restore(), j)
|
|
539
|
+
for (let v = X.startIndex; v <= X.endIndex; v++) {
|
|
540
|
+
const m = B[v];
|
|
541
|
+
if (!m) continue;
|
|
542
|
+
const _ = e.rowToY(v);
|
|
543
|
+
for (let S = u.startIndex; S <= u.endIndex; S++) {
|
|
544
|
+
const l = G[S];
|
|
545
|
+
if (!l) continue;
|
|
546
|
+
const q = e.colToX(S, !0);
|
|
547
|
+
z(l, q, m, _);
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
if (
|
|
551
|
-
const
|
|
552
|
-
t.fillStyle = "#f3f4f6", t.fillRect(0,
|
|
550
|
+
if (H && (t.save(), t.strokeStyle = "#3b82f6", t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(H.x, 0), t.lineTo(H.x, h), t.stroke(), t.setLineDash([]), t.restore()), M) {
|
|
551
|
+
const m = h - 32;
|
|
552
|
+
t.fillStyle = "#f3f4f6", t.fillRect(0, m, a, 32), t.strokeStyle = "#e5e7eb", t.lineWidth = 1, t.beginPath(), t.moveTo(0, m), t.lineTo(a, m), t.stroke(), t.fillStyle = "#6b7280", t.font = "13px system-ui, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("Loading...", a / 2, m + 32 / 2);
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function Wn({
|
|
556
556
|
treeEngine: t,
|
|
557
557
|
width: e,
|
|
558
558
|
rowHeight: o,
|
|
@@ -560,54 +560,54 @@ function _n({
|
|
|
560
560
|
viewportHeight: r,
|
|
561
561
|
sidebarRenderer: c,
|
|
562
562
|
onToggle: a,
|
|
563
|
-
onRowClick:
|
|
564
|
-
hoveredRowId:
|
|
565
|
-
onRowHover:
|
|
563
|
+
onRowClick: h,
|
|
564
|
+
hoveredRowId: g,
|
|
565
|
+
onRowHover: R
|
|
566
566
|
}) {
|
|
567
|
-
const W = t.flattenedRows, { startIndex:
|
|
568
|
-
for (let
|
|
569
|
-
const
|
|
570
|
-
if (!
|
|
571
|
-
const
|
|
572
|
-
let
|
|
567
|
+
const W = t.flattenedRows, { startIndex: O, endIndex: H } = t.getVisibleRange(n, r, o), M = [];
|
|
568
|
+
for (let G = O; G <= H; G++) {
|
|
569
|
+
const P = W[G];
|
|
570
|
+
if (!P) continue;
|
|
571
|
+
const j = t.getDepth(P.id), F = t.hasChildren(P.id), D = t.isExpanded(P.id), u = G * o;
|
|
572
|
+
let x;
|
|
573
573
|
if (c)
|
|
574
|
-
|
|
574
|
+
x = c(P, j, D, F);
|
|
575
575
|
else {
|
|
576
|
-
const
|
|
577
|
-
|
|
576
|
+
const v = j * 16 + 8;
|
|
577
|
+
x = /* @__PURE__ */ ve(
|
|
578
578
|
"div",
|
|
579
579
|
{
|
|
580
580
|
style: {
|
|
581
581
|
display: "flex",
|
|
582
582
|
alignItems: "center",
|
|
583
583
|
height: "100%",
|
|
584
|
-
paddingLeft:
|
|
584
|
+
paddingLeft: v,
|
|
585
585
|
overflow: "hidden",
|
|
586
586
|
whiteSpace: "nowrap",
|
|
587
|
-
cursor:
|
|
587
|
+
cursor: F ? "pointer" : "default",
|
|
588
588
|
userSelect: "none"
|
|
589
589
|
},
|
|
590
|
-
onPointerDown:
|
|
591
|
-
|
|
590
|
+
onPointerDown: F ? (m) => {
|
|
591
|
+
m.stopPropagation(), a(P.id);
|
|
592
592
|
} : void 0,
|
|
593
593
|
children: [
|
|
594
|
-
|
|
595
|
-
/* @__PURE__ */
|
|
594
|
+
F ? /* @__PURE__ */ T("span", { style: { marginRight: 4, flexShrink: 0, fontSize: 10, color: "#6b7280" }, children: D ? "▾" : "▸" }) : /* @__PURE__ */ T("span", { style: { width: 14, flexShrink: 0 } }),
|
|
595
|
+
/* @__PURE__ */ T("span", { style: { overflow: "hidden", textOverflow: "ellipsis", fontSize: 12 }, children: String(P.title ?? P.id) })
|
|
596
596
|
]
|
|
597
597
|
}
|
|
598
598
|
);
|
|
599
599
|
}
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
/* @__PURE__ */
|
|
600
|
+
const z = g === P.id;
|
|
601
|
+
M.push(
|
|
602
|
+
/* @__PURE__ */ T(
|
|
603
603
|
"div",
|
|
604
604
|
{
|
|
605
605
|
role: "rowheader",
|
|
606
|
-
"aria-level":
|
|
607
|
-
"aria-expanded":
|
|
606
|
+
"aria-level": j + 1,
|
|
607
|
+
"aria-expanded": F ? D : void 0,
|
|
608
608
|
style: {
|
|
609
609
|
position: "absolute",
|
|
610
|
-
top:
|
|
610
|
+
top: u,
|
|
611
611
|
left: 0,
|
|
612
612
|
width: "100%",
|
|
613
613
|
height: o,
|
|
@@ -615,20 +615,20 @@ function _n({
|
|
|
615
615
|
fontSize: 13,
|
|
616
616
|
color: "#374151",
|
|
617
617
|
borderBottom: "1px solid #e5e7eb",
|
|
618
|
-
cursor:
|
|
619
|
-
backgroundColor:
|
|
618
|
+
cursor: h ? "pointer" : "default",
|
|
619
|
+
backgroundColor: z ? "rgba(59,130,246,0.04)" : void 0
|
|
620
620
|
},
|
|
621
|
-
onPointerDown:
|
|
622
|
-
onPointerEnter: () =>
|
|
623
|
-
onPointerLeave: () =>
|
|
624
|
-
children:
|
|
621
|
+
onPointerDown: h ? (v) => h(P.id, v) : void 0,
|
|
622
|
+
onPointerEnter: () => R == null ? void 0 : R(P.id),
|
|
623
|
+
onPointerLeave: () => R == null ? void 0 : R(null),
|
|
624
|
+
children: x
|
|
625
625
|
},
|
|
626
|
-
String(
|
|
626
|
+
String(P.id)
|
|
627
627
|
)
|
|
628
628
|
);
|
|
629
629
|
}
|
|
630
|
-
const
|
|
631
|
-
return /* @__PURE__ */
|
|
630
|
+
const X = W.length * o, B = Math.min(r, X - n);
|
|
631
|
+
return /* @__PURE__ */ ve(
|
|
632
632
|
"div",
|
|
633
633
|
{
|
|
634
634
|
style: {
|
|
@@ -640,7 +640,7 @@ function _n({
|
|
|
640
640
|
backgroundColor: "#ffffff"
|
|
641
641
|
},
|
|
642
642
|
children: [
|
|
643
|
-
/* @__PURE__ */
|
|
643
|
+
/* @__PURE__ */ T(
|
|
644
644
|
"div",
|
|
645
645
|
{
|
|
646
646
|
style: {
|
|
@@ -654,7 +654,7 @@ function _n({
|
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
656
|
),
|
|
657
|
-
/* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ T(
|
|
658
658
|
"div",
|
|
659
659
|
{
|
|
660
660
|
style: {
|
|
@@ -662,18 +662,18 @@ function _n({
|
|
|
662
662
|
top: 0,
|
|
663
663
|
left: 0,
|
|
664
664
|
width: "100%",
|
|
665
|
-
height:
|
|
665
|
+
height: X,
|
|
666
666
|
transform: `translateY(-${n}px)`
|
|
667
667
|
},
|
|
668
|
-
children:
|
|
668
|
+
children: M
|
|
669
669
|
}
|
|
670
670
|
)
|
|
671
671
|
]
|
|
672
672
|
}
|
|
673
673
|
);
|
|
674
674
|
}
|
|
675
|
-
const
|
|
676
|
-
function
|
|
675
|
+
const ct = 28, vt = 28, Dn = 4, Xn = 18, Pn = "rgba(59,130,246,0.12)";
|
|
676
|
+
function En(t) {
|
|
677
677
|
switch (t) {
|
|
678
678
|
case "vertical":
|
|
679
679
|
return 120;
|
|
@@ -681,24 +681,20 @@ function Wn(t) {
|
|
|
681
681
|
return 32;
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
|
-
function
|
|
685
|
-
return /* @__PURE__ */
|
|
684
|
+
function Ln({ active: t }) {
|
|
685
|
+
return /* @__PURE__ */ T(
|
|
686
686
|
"svg",
|
|
687
687
|
{
|
|
688
|
-
width:
|
|
689
|
-
height:
|
|
690
|
-
viewBox: "0
|
|
691
|
-
fill: "
|
|
692
|
-
stroke: t ? "#2563eb" : "#9ca3af",
|
|
693
|
-
strokeWidth: 2,
|
|
694
|
-
strokeLinecap: "round",
|
|
695
|
-
strokeLinejoin: "round",
|
|
688
|
+
width: 14,
|
|
689
|
+
height: 14,
|
|
690
|
+
viewBox: "0 -960 960 960",
|
|
691
|
+
fill: t ? "#269bf7" : "#9ca3af",
|
|
696
692
|
"aria-hidden": "true",
|
|
697
|
-
children: /* @__PURE__ */
|
|
693
|
+
children: /* @__PURE__ */ T("path", { d: "M429.76-228.04q-14.48 0-24.27-9.7-9.79-9.69-9.79-24.23 0-14.53 9.82-24.37 9.82-9.83 24.24-9.83h100.72q14.37 0 24.1 10.01 9.72 10.01 9.72 24.55 0 14.53-9.82 24.05-9.82 9.52-24.24 9.52H429.76ZM268.57-446.17q-14.51 0-24.17-9.7-9.66-9.69-9.66-24.25 0-14.55 9.66-24.25t24.17-9.7H691.2q14.47 0 24.27 9.88 9.79 9.87 9.79 24.42 0 14.56-9.79 24.08-9.8 9.52-24.27 9.52H268.57Zm-120.72-217.9q-14.51 0-24.17-9.83-9.66-9.83-9.66-24.37 0-14.53 9.82-24.23 9.82-9.7 24.25-9.7h664.06q14.48 0 24.27 9.88 9.8 9.87 9.8 24.4 0 14.54-9.96 24.2-9.95 9.65-24.35 9.65H147.85Z" })
|
|
698
694
|
}
|
|
699
695
|
);
|
|
700
696
|
}
|
|
701
|
-
function
|
|
697
|
+
function On({
|
|
702
698
|
columnEngine: t,
|
|
703
699
|
columnGroups: e,
|
|
704
700
|
scrollX: o,
|
|
@@ -706,131 +702,132 @@ function Dn({
|
|
|
706
702
|
columnHeaderHeight: r,
|
|
707
703
|
onColumnClick: c,
|
|
708
704
|
onColumnResize: a,
|
|
709
|
-
onColumnReorder:
|
|
710
|
-
onColumnFilterClick:
|
|
711
|
-
|
|
705
|
+
onColumnReorder: h,
|
|
706
|
+
onColumnFilterClick: g,
|
|
707
|
+
selectedColId: R,
|
|
708
|
+
columnHeaderRenderer: W
|
|
712
709
|
}) {
|
|
713
|
-
const
|
|
710
|
+
const O = t.getPinnedColumns(), H = t.getScrollableColumns(), M = t.getVisibleColumns(), X = t.getPinnedWidth(), B = /* @__PURE__ */ new Map();
|
|
714
711
|
if (e)
|
|
715
712
|
for (const d of e)
|
|
716
|
-
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
const
|
|
713
|
+
B.set(d.id, d);
|
|
714
|
+
const G = re(null), [P, j] = we(null), F = re(null), D = re(!1), u = re(null), x = re(null);
|
|
715
|
+
F.current = P;
|
|
716
|
+
const z = [...O, ...H], v = [];
|
|
720
717
|
if (e && e.length > 0) {
|
|
721
|
-
let d,
|
|
722
|
-
for (const
|
|
723
|
-
const
|
|
724
|
-
if (
|
|
718
|
+
let d, E = 0, $ = 0, Y = !1;
|
|
719
|
+
for (const V of z) {
|
|
720
|
+
const Q = t.getColumnX(V.id), K = V.pinned === "left";
|
|
721
|
+
if (V.group !== d) {
|
|
725
722
|
if (d !== void 0 && $ > 0) {
|
|
726
|
-
const
|
|
727
|
-
|
|
723
|
+
const le = B.get(d);
|
|
724
|
+
le && v.push({ group: le, startX: E, width: $, pinned: Y });
|
|
728
725
|
}
|
|
729
|
-
d =
|
|
726
|
+
d = V.group, E = Q, $ = V.width, Y = K;
|
|
730
727
|
} else
|
|
731
|
-
$ +=
|
|
728
|
+
$ += V.width;
|
|
732
729
|
}
|
|
733
730
|
if (d !== void 0 && $ > 0) {
|
|
734
|
-
const
|
|
735
|
-
|
|
731
|
+
const V = B.get(d);
|
|
732
|
+
V && v.push({ group: V, startX: E, width: $, pinned: Y });
|
|
736
733
|
}
|
|
737
734
|
}
|
|
738
|
-
const
|
|
739
|
-
(d,
|
|
740
|
-
|
|
741
|
-
const $ =
|
|
742
|
-
$ && (
|
|
735
|
+
const m = v.length > 0, _ = r ?? En(n), S = m ? ct + _ : _, l = se(
|
|
736
|
+
(d, E) => {
|
|
737
|
+
E.stopPropagation(), E.preventDefault();
|
|
738
|
+
const $ = M.find((Y) => Y.id === d);
|
|
739
|
+
$ && (G.current = { colId: d, startX: E.clientX, startWidth: $.width });
|
|
743
740
|
},
|
|
744
|
-
[
|
|
741
|
+
[M]
|
|
745
742
|
);
|
|
746
|
-
|
|
743
|
+
be(() => {
|
|
747
744
|
const d = ($) => {
|
|
748
|
-
const
|
|
749
|
-
if (!
|
|
750
|
-
const
|
|
751
|
-
a == null || a(
|
|
752
|
-
},
|
|
753
|
-
|
|
745
|
+
const Y = G.current;
|
|
746
|
+
if (!Y) return;
|
|
747
|
+
const V = $.clientX - Y.startX, Q = Math.max(Y.startWidth + V, 30);
|
|
748
|
+
a == null || a(Y.colId, Q);
|
|
749
|
+
}, E = () => {
|
|
750
|
+
G.current = null;
|
|
754
751
|
};
|
|
755
|
-
return document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
756
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
752
|
+
return document.addEventListener("mousemove", d), document.addEventListener("mouseup", E), () => {
|
|
753
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", E);
|
|
757
754
|
};
|
|
758
755
|
}, [a]);
|
|
759
|
-
const
|
|
756
|
+
const q = se(
|
|
760
757
|
(d) => {
|
|
761
|
-
const
|
|
762
|
-
if (!
|
|
763
|
-
const $ =
|
|
764
|
-
let
|
|
765
|
-
for (let
|
|
766
|
-
const
|
|
767
|
-
|
|
758
|
+
const E = x.current;
|
|
759
|
+
if (!E) return { dropIndex: 0 };
|
|
760
|
+
const $ = E.getBoundingClientRect(), Y = d - $.left + o;
|
|
761
|
+
let V = 0;
|
|
762
|
+
for (let Q = 0; Q < M.length; Q++) {
|
|
763
|
+
const K = M[Q], Ce = t.getColumnX(K.id) + K.width / 2;
|
|
764
|
+
Y > Ce && (V = Q + 1);
|
|
768
765
|
}
|
|
769
|
-
return { dropIndex:
|
|
766
|
+
return { dropIndex: V };
|
|
770
767
|
},
|
|
771
|
-
[
|
|
772
|
-
),
|
|
773
|
-
(d,
|
|
774
|
-
|
|
768
|
+
[M, t, o]
|
|
769
|
+
), ge = se(
|
|
770
|
+
(d, E) => {
|
|
771
|
+
E.target.dataset.resizeHandle || h && (E.preventDefault(), D.current = !1, u.current = { colId: d, startX: E.clientX, currentX: E.clientX });
|
|
775
772
|
},
|
|
776
|
-
[
|
|
773
|
+
[h]
|
|
777
774
|
);
|
|
778
|
-
|
|
779
|
-
if (!
|
|
780
|
-
const d = (
|
|
781
|
-
const
|
|
782
|
-
if (!
|
|
783
|
-
const
|
|
784
|
-
if (!
|
|
785
|
-
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
colId:
|
|
789
|
-
startX:
|
|
790
|
-
currentX:
|
|
791
|
-
dropIndex:
|
|
792
|
-
ghostLeft:
|
|
793
|
-
ghostWidth: (
|
|
794
|
-
ghostTitle: (
|
|
775
|
+
be(() => {
|
|
776
|
+
if (!h) return;
|
|
777
|
+
const d = (Y) => {
|
|
778
|
+
const V = u.current;
|
|
779
|
+
if (!V) return;
|
|
780
|
+
const Q = Math.abs(Y.clientX - V.startX);
|
|
781
|
+
if (!D.current && Q >= Dn) {
|
|
782
|
+
D.current = !0;
|
|
783
|
+
const K = M.find((Te) => Te.id === V.colId), le = t.getColumnX(V.colId), { dropIndex: Ce } = q(Y.clientX);
|
|
784
|
+
j({
|
|
785
|
+
colId: V.colId,
|
|
786
|
+
startX: V.startX,
|
|
787
|
+
currentX: Y.clientX,
|
|
788
|
+
dropIndex: Ce,
|
|
789
|
+
ghostLeft: le - o,
|
|
790
|
+
ghostWidth: (K == null ? void 0 : K.width) ?? 80,
|
|
791
|
+
ghostTitle: (K == null ? void 0 : K.title) ?? ""
|
|
795
792
|
});
|
|
796
793
|
return;
|
|
797
794
|
}
|
|
798
|
-
if (
|
|
799
|
-
const { dropIndex:
|
|
800
|
-
|
|
795
|
+
if (D.current) {
|
|
796
|
+
const { dropIndex: K } = q(Y.clientX);
|
|
797
|
+
j((le) => le && { ...le, currentX: Y.clientX, dropIndex: K });
|
|
801
798
|
}
|
|
802
|
-
},
|
|
803
|
-
|
|
804
|
-
}, $ = (
|
|
805
|
-
|
|
799
|
+
}, E = () => {
|
|
800
|
+
D.current && F.current && h(F.current.colId, F.current.dropIndex), u.current = null, D.current = !1, j(null);
|
|
801
|
+
}, $ = (Y) => {
|
|
802
|
+
Y.key === "Escape" && (u.current = null, D.current = !1, j(null));
|
|
806
803
|
};
|
|
807
|
-
return document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
808
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
804
|
+
return document.addEventListener("mousemove", d), document.addEventListener("mouseup", E), document.addEventListener("keydown", $), () => {
|
|
805
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", E), document.removeEventListener("keydown", $);
|
|
809
806
|
};
|
|
810
|
-
}, [
|
|
811
|
-
const
|
|
812
|
-
if (!
|
|
813
|
-
const { dropIndex: d } =
|
|
814
|
-
if (d >=
|
|
815
|
-
const
|
|
816
|
-
return t.getColumnX(
|
|
807
|
+
}, [h, M, t, o, q]);
|
|
808
|
+
const Pe = () => {
|
|
809
|
+
if (!P) return 0;
|
|
810
|
+
const { dropIndex: d } = P;
|
|
811
|
+
if (d >= M.length) {
|
|
812
|
+
const E = M[M.length - 1];
|
|
813
|
+
return t.getColumnX(E.id) + E.width - o;
|
|
817
814
|
}
|
|
818
|
-
return t.getColumnX(
|
|
819
|
-
},
|
|
820
|
-
const V = (
|
|
815
|
+
return t.getColumnX(M[d].id) - o;
|
|
816
|
+
}, Re = (d, E, $, Y = 0) => {
|
|
817
|
+
const V = (P == null ? void 0 : P.colId) === d.id, K = d.pinned === "left" ? "horizontal" : n, le = d.filterable && !!g, Ce = le && K === "vertical" ? Xn : 0, Te = Math.max(0, $ - Y - Ce), Ee = W == null ? void 0 : W(d.id, d.title, {
|
|
821
818
|
width: d.width,
|
|
822
|
-
height:
|
|
823
|
-
orientation:
|
|
824
|
-
})
|
|
825
|
-
let
|
|
826
|
-
return
|
|
819
|
+
height: Te,
|
|
820
|
+
orientation: K
|
|
821
|
+
});
|
|
822
|
+
let Ie;
|
|
823
|
+
return Ee ? Ie = Ee : K === "vertical" ? Ie = /* @__PURE__ */ T(
|
|
827
824
|
"div",
|
|
828
825
|
{
|
|
829
826
|
style: {
|
|
830
827
|
writingMode: "vertical-rl",
|
|
831
828
|
textOrientation: "mixed",
|
|
832
829
|
transform: "rotate(180deg)",
|
|
833
|
-
height:
|
|
830
|
+
height: Te - 16,
|
|
834
831
|
lineHeight: `${d.width}px`,
|
|
835
832
|
overflow: "hidden",
|
|
836
833
|
textOverflow: "ellipsis",
|
|
@@ -838,35 +835,37 @@ function Dn({
|
|
|
838
835
|
},
|
|
839
836
|
children: d.title
|
|
840
837
|
}
|
|
841
|
-
) :
|
|
838
|
+
) : Ie = /* @__PURE__ */ T("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 }, children: d.title }), /* @__PURE__ */ ve(
|
|
842
839
|
"div",
|
|
843
840
|
{
|
|
844
841
|
role: "columnheader",
|
|
845
842
|
"aria-label": d.title,
|
|
846
843
|
style: {
|
|
847
844
|
position: "absolute",
|
|
848
|
-
left:
|
|
845
|
+
left: E,
|
|
849
846
|
width: d.width,
|
|
850
847
|
height: $,
|
|
851
848
|
boxSizing: "border-box",
|
|
852
849
|
borderRight: "1px solid #d1d5db",
|
|
850
|
+
// Tint the selected column's header to match the column highlight.
|
|
851
|
+
backgroundColor: R != null && d.id === R ? Pn : void 0,
|
|
853
852
|
display: "flex",
|
|
854
|
-
alignItems:
|
|
855
|
-
justifyContent:
|
|
856
|
-
paddingLeft:
|
|
857
|
-
paddingBottom:
|
|
858
|
-
cursor:
|
|
853
|
+
alignItems: K === "horizontal" ? "center" : "flex-end",
|
|
854
|
+
justifyContent: K === "horizontal" ? "flex-start" : "center",
|
|
855
|
+
paddingLeft: K === "horizontal" ? 8 : 0,
|
|
856
|
+
paddingBottom: K !== "horizontal" ? 6 : 0,
|
|
857
|
+
cursor: h ? "grab" : c ? "pointer" : "default",
|
|
859
858
|
userSelect: "none",
|
|
860
859
|
fontSize: 13,
|
|
861
860
|
fontWeight: 500,
|
|
862
861
|
color: "#6C737F",
|
|
863
862
|
opacity: V ? 0.4 : 1
|
|
864
863
|
},
|
|
865
|
-
onMouseDown:
|
|
866
|
-
onPointerDown: c && !
|
|
864
|
+
onMouseDown: h ? (k) => ge(d.id, k) : void 0,
|
|
865
|
+
onPointerDown: c && !h ? (k) => c(d.id, k) : void 0,
|
|
867
866
|
children: [
|
|
868
|
-
|
|
869
|
-
|
|
867
|
+
Ie,
|
|
868
|
+
le && /* @__PURE__ */ T(
|
|
870
869
|
"button",
|
|
871
870
|
{
|
|
872
871
|
type: "button",
|
|
@@ -874,7 +873,7 @@ function Dn({
|
|
|
874
873
|
"data-cg-filter-icon": d.id,
|
|
875
874
|
style: {
|
|
876
875
|
position: "absolute",
|
|
877
|
-
top: 2,
|
|
876
|
+
top: Y + 2,
|
|
878
877
|
right: 5,
|
|
879
878
|
zIndex: 2,
|
|
880
879
|
display: "flex",
|
|
@@ -887,15 +886,15 @@ function Dn({
|
|
|
887
886
|
cursor: "pointer",
|
|
888
887
|
lineHeight: 0
|
|
889
888
|
},
|
|
890
|
-
onMouseDown: (
|
|
891
|
-
onPointerDown: (
|
|
892
|
-
onClick: (
|
|
893
|
-
|
|
889
|
+
onMouseDown: (k) => k.stopPropagation(),
|
|
890
|
+
onPointerDown: (k) => k.stopPropagation(),
|
|
891
|
+
onClick: (k) => {
|
|
892
|
+
k.stopPropagation(), g == null || g(d.id, k.currentTarget.getBoundingClientRect());
|
|
894
893
|
},
|
|
895
|
-
children: /* @__PURE__ */
|
|
894
|
+
children: /* @__PURE__ */ T(Ln, { active: d.filterActive })
|
|
896
895
|
}
|
|
897
896
|
),
|
|
898
|
-
a && /* @__PURE__ */
|
|
897
|
+
a && /* @__PURE__ */ T(
|
|
899
898
|
"div",
|
|
900
899
|
{
|
|
901
900
|
"data-resize-handle": "true",
|
|
@@ -908,7 +907,7 @@ function Dn({
|
|
|
908
907
|
cursor: "col-resize",
|
|
909
908
|
zIndex: 1
|
|
910
909
|
},
|
|
911
|
-
onMouseDown: (
|
|
910
|
+
onMouseDown: (k) => l(d.id, k)
|
|
912
911
|
}
|
|
913
912
|
)
|
|
914
913
|
]
|
|
@@ -916,21 +915,21 @@ function Dn({
|
|
|
916
915
|
d.id
|
|
917
916
|
);
|
|
918
917
|
};
|
|
919
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ ve(
|
|
920
919
|
"div",
|
|
921
920
|
{
|
|
922
|
-
ref:
|
|
921
|
+
ref: x,
|
|
923
922
|
style: {
|
|
924
923
|
flex: 1,
|
|
925
924
|
// Exactly totalHeight so the bottom-border row isn't pushed under the
|
|
926
925
|
// body (a +1 here gets clipped/covered, hiding the header border).
|
|
927
|
-
height:
|
|
926
|
+
height: S,
|
|
928
927
|
overflow: "hidden",
|
|
929
928
|
position: "relative",
|
|
930
929
|
backgroundColor: "#f9fafb"
|
|
931
930
|
},
|
|
932
931
|
children: [
|
|
933
|
-
/* @__PURE__ */
|
|
932
|
+
/* @__PURE__ */ ve(
|
|
934
933
|
"div",
|
|
935
934
|
{
|
|
936
935
|
style: {
|
|
@@ -938,27 +937,37 @@ function Dn({
|
|
|
938
937
|
top: 0,
|
|
939
938
|
left: 0,
|
|
940
939
|
transform: `translateX(-${o}px)`,
|
|
941
|
-
height:
|
|
940
|
+
height: S
|
|
942
941
|
},
|
|
943
942
|
children: [
|
|
944
|
-
/* @__PURE__ */
|
|
945
|
-
const
|
|
946
|
-
return
|
|
943
|
+
/* @__PURE__ */ T("div", { style: { position: "absolute", top: 0, height: S }, children: H.map((d) => {
|
|
944
|
+
const E = t.getColumnX(d.id);
|
|
945
|
+
return Re(
|
|
946
|
+
d,
|
|
947
|
+
E,
|
|
948
|
+
S,
|
|
949
|
+
m ? ct : 0
|
|
950
|
+
);
|
|
947
951
|
}) }),
|
|
948
|
-
|
|
952
|
+
m && /* @__PURE__ */ T("div", { style: { position: "relative", height: ct, zIndex: 1 }, children: v.filter((d) => !d.pinned).map((d) => /* @__PURE__ */ T(
|
|
949
953
|
"div",
|
|
950
954
|
{
|
|
951
955
|
style: {
|
|
952
956
|
position: "absolute",
|
|
953
957
|
left: d.startX,
|
|
954
958
|
width: d.width,
|
|
955
|
-
height:
|
|
956
|
-
|
|
959
|
+
height: ct,
|
|
960
|
+
// Neutral borders matching the rest of the header grid; a right
|
|
961
|
+
// border separates adjacent parent groups so their boundaries
|
|
962
|
+
// are visible. An explicit group.color still tints the bottom.
|
|
963
|
+
borderBottom: `1px solid ${d.group.color ?? "#d1d5db"}`,
|
|
964
|
+
borderRight: "1px solid #d1d5db",
|
|
957
965
|
display: "flex",
|
|
958
966
|
alignItems: "center",
|
|
959
|
-
|
|
967
|
+
justifyContent: "center",
|
|
968
|
+
padding: "0 8px",
|
|
960
969
|
boxSizing: "border-box",
|
|
961
|
-
fontSize:
|
|
970
|
+
fontSize: 14,
|
|
962
971
|
fontWeight: 600,
|
|
963
972
|
color: "#6b7280",
|
|
964
973
|
overflow: "hidden",
|
|
@@ -972,22 +981,22 @@ function Dn({
|
|
|
972
981
|
]
|
|
973
982
|
}
|
|
974
983
|
),
|
|
975
|
-
|
|
984
|
+
O.length > 0 && /* @__PURE__ */ ve(
|
|
976
985
|
"div",
|
|
977
986
|
{
|
|
978
987
|
style: {
|
|
979
988
|
position: "absolute",
|
|
980
989
|
top: 0,
|
|
981
990
|
left: 0,
|
|
982
|
-
width:
|
|
983
|
-
height:
|
|
991
|
+
width: X,
|
|
992
|
+
height: S,
|
|
984
993
|
backgroundColor: "#f9fafb",
|
|
985
994
|
zIndex: 2,
|
|
986
995
|
display: "flex",
|
|
987
996
|
flexDirection: "column"
|
|
988
997
|
},
|
|
989
998
|
children: [
|
|
990
|
-
|
|
999
|
+
m && /* @__PURE__ */ T("div", { style: { position: "absolute", top: 0, left: 0, width: X, height: S - vt }, children: v.filter((d) => d.pinned).map((d) => /* @__PURE__ */ T(
|
|
991
1000
|
"div",
|
|
992
1001
|
{
|
|
993
1002
|
style: {
|
|
@@ -1001,7 +1010,7 @@ function Dn({
|
|
|
1001
1010
|
alignItems: "center",
|
|
1002
1011
|
justifyContent: "center",
|
|
1003
1012
|
boxSizing: "border-box",
|
|
1004
|
-
fontSize:
|
|
1013
|
+
fontSize: 14,
|
|
1005
1014
|
fontWeight: 600,
|
|
1006
1015
|
color: "#6b7280",
|
|
1007
1016
|
overflow: "hidden",
|
|
@@ -1012,11 +1021,11 @@ function Dn({
|
|
|
1012
1021
|
},
|
|
1013
1022
|
d.group.id
|
|
1014
1023
|
)) }),
|
|
1015
|
-
/* @__PURE__ */
|
|
1016
|
-
const
|
|
1017
|
-
return
|
|
1024
|
+
/* @__PURE__ */ T("div", { style: { position: "absolute", bottom: 0, left: 0, width: X, height: vt, borderTop: "1px solid #d1d5db" }, children: O.map((d) => {
|
|
1025
|
+
const E = t.getColumnX(d.id);
|
|
1026
|
+
return Re(d, E, vt);
|
|
1018
1027
|
}) }),
|
|
1019
|
-
/* @__PURE__ */
|
|
1028
|
+
/* @__PURE__ */ T(
|
|
1020
1029
|
"div",
|
|
1021
1030
|
{
|
|
1022
1031
|
style: {
|
|
@@ -1033,30 +1042,30 @@ function Dn({
|
|
|
1033
1042
|
]
|
|
1034
1043
|
}
|
|
1035
1044
|
),
|
|
1036
|
-
/* @__PURE__ */
|
|
1037
|
-
|
|
1038
|
-
|
|
1045
|
+
/* @__PURE__ */ T("div", { style: { position: "absolute", bottom: 0, left: 0, right: 0, height: 1, backgroundColor: "#d1d5db", zIndex: 5 } }),
|
|
1046
|
+
P && /* @__PURE__ */ T("div", { style: { position: "absolute", top: 0, left: Pe(), width: 2, height: S, backgroundColor: "#3b82f6", pointerEvents: "none", zIndex: 10 } }),
|
|
1047
|
+
P && /* @__PURE__ */ T("div", { style: { position: "fixed", top: 0, left: P.currentX - P.ghostWidth / 2, width: P.ghostWidth, height: 32, backgroundColor: "#dbeafe", border: "1px solid #3b82f6", borderRadius: 4, display: "flex", alignItems: "center", paddingLeft: 8, boxSizing: "border-box", fontSize: 12, fontWeight: 600, color: "#1d4ed8", opacity: 0.85, pointerEvents: "none", zIndex: 9999, whiteSpace: "nowrap", overflow: "hidden" }, children: P.ghostTitle })
|
|
1039
1048
|
]
|
|
1040
1049
|
}
|
|
1041
1050
|
);
|
|
1042
1051
|
}
|
|
1043
|
-
function
|
|
1052
|
+
function An({
|
|
1044
1053
|
columnEngine: t,
|
|
1045
1054
|
onColumnVisibilityChange: e
|
|
1046
1055
|
}) {
|
|
1047
|
-
const [o, n] =
|
|
1048
|
-
return
|
|
1056
|
+
const [o, n] = we(!1), r = re(null), c = t.getAllColumns();
|
|
1057
|
+
return be(() => {
|
|
1049
1058
|
if (!o) return;
|
|
1050
|
-
const a = (
|
|
1051
|
-
r.current && !r.current.contains(
|
|
1052
|
-
},
|
|
1053
|
-
|
|
1059
|
+
const a = (g) => {
|
|
1060
|
+
r.current && !r.current.contains(g.target) && n(!1);
|
|
1061
|
+
}, h = (g) => {
|
|
1062
|
+
g.key === "Escape" && n(!1);
|
|
1054
1063
|
};
|
|
1055
|
-
return document.addEventListener("mousedown", a), document.addEventListener("keydown",
|
|
1056
|
-
document.removeEventListener("mousedown", a), document.removeEventListener("keydown",
|
|
1064
|
+
return document.addEventListener("mousedown", a), document.addEventListener("keydown", h), () => {
|
|
1065
|
+
document.removeEventListener("mousedown", a), document.removeEventListener("keydown", h);
|
|
1057
1066
|
};
|
|
1058
|
-
}, [o]), /* @__PURE__ */
|
|
1059
|
-
/* @__PURE__ */
|
|
1067
|
+
}, [o]), /* @__PURE__ */ ve("div", { ref: r, style: { position: "relative", display: "inline-block" }, children: [
|
|
1068
|
+
/* @__PURE__ */ T(
|
|
1060
1069
|
"button",
|
|
1061
1070
|
{
|
|
1062
1071
|
onClick: () => n((a) => !a),
|
|
@@ -1079,7 +1088,7 @@ function Xn({
|
|
|
1079
1088
|
children: "Columns"
|
|
1080
1089
|
}
|
|
1081
1090
|
),
|
|
1082
|
-
o && /* @__PURE__ */
|
|
1091
|
+
o && /* @__PURE__ */ T(
|
|
1083
1092
|
"div",
|
|
1084
1093
|
{
|
|
1085
1094
|
style: {
|
|
@@ -1096,8 +1105,8 @@ function Xn({
|
|
|
1096
1105
|
padding: "4px 0"
|
|
1097
1106
|
},
|
|
1098
1107
|
children: c.map((a) => {
|
|
1099
|
-
const
|
|
1100
|
-
return /* @__PURE__ */
|
|
1108
|
+
const h = !a.hidden;
|
|
1109
|
+
return /* @__PURE__ */ ve(
|
|
1101
1110
|
"label",
|
|
1102
1111
|
{
|
|
1103
1112
|
style: {
|
|
@@ -1110,25 +1119,25 @@ function Xn({
|
|
|
1110
1119
|
color: "#374151",
|
|
1111
1120
|
userSelect: "none"
|
|
1112
1121
|
},
|
|
1113
|
-
onMouseEnter: (
|
|
1114
|
-
|
|
1122
|
+
onMouseEnter: (g) => {
|
|
1123
|
+
g.currentTarget.style.backgroundColor = "#f3f4f6";
|
|
1115
1124
|
},
|
|
1116
|
-
onMouseLeave: (
|
|
1117
|
-
|
|
1125
|
+
onMouseLeave: (g) => {
|
|
1126
|
+
g.currentTarget.style.backgroundColor = "";
|
|
1118
1127
|
},
|
|
1119
1128
|
children: [
|
|
1120
|
-
/* @__PURE__ */
|
|
1129
|
+
/* @__PURE__ */ T(
|
|
1121
1130
|
"input",
|
|
1122
1131
|
{
|
|
1123
1132
|
type: "checkbox",
|
|
1124
|
-
checked:
|
|
1125
|
-
onChange: (
|
|
1126
|
-
e(a.id,
|
|
1133
|
+
checked: h,
|
|
1134
|
+
onChange: (g) => {
|
|
1135
|
+
e(a.id, g.target.checked);
|
|
1127
1136
|
},
|
|
1128
1137
|
style: { cursor: "pointer", width: 14, height: 14 }
|
|
1129
1138
|
}
|
|
1130
1139
|
),
|
|
1131
|
-
/* @__PURE__ */
|
|
1140
|
+
/* @__PURE__ */ T("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: a.title })
|
|
1132
1141
|
]
|
|
1133
1142
|
},
|
|
1134
1143
|
a.id
|
|
@@ -1138,9 +1147,9 @@ function Xn({
|
|
|
1138
1147
|
)
|
|
1139
1148
|
] });
|
|
1140
1149
|
}
|
|
1141
|
-
function
|
|
1142
|
-
return
|
|
1143
|
-
/* @__PURE__ */
|
|
1150
|
+
function zn({ content: t, position: e }) {
|
|
1151
|
+
return Rn(
|
|
1152
|
+
/* @__PURE__ */ T(
|
|
1144
1153
|
"div",
|
|
1145
1154
|
{
|
|
1146
1155
|
style: {
|
|
@@ -1156,8 +1165,8 @@ function Pn({ content: t, position: e }) {
|
|
|
1156
1165
|
document.body
|
|
1157
1166
|
);
|
|
1158
1167
|
}
|
|
1159
|
-
function
|
|
1160
|
-
return /* @__PURE__ */
|
|
1168
|
+
function Yn({ message: t }) {
|
|
1169
|
+
return /* @__PURE__ */ T(
|
|
1161
1170
|
"div",
|
|
1162
1171
|
{
|
|
1163
1172
|
role: "status",
|
|
@@ -1178,9 +1187,9 @@ function En({ message: t }) {
|
|
|
1178
1187
|
}
|
|
1179
1188
|
);
|
|
1180
1189
|
}
|
|
1181
|
-
const
|
|
1182
|
-
function
|
|
1183
|
-
var
|
|
1190
|
+
const et = 28, Vn = 32, Bn = 120;
|
|
1191
|
+
function Gn(t) {
|
|
1192
|
+
var Ee, Ie;
|
|
1184
1193
|
const {
|
|
1185
1194
|
treeEngine: e,
|
|
1186
1195
|
columnEngine: o,
|
|
@@ -1188,460 +1197,461 @@ function An(t) {
|
|
|
1188
1197
|
rowHeight: r,
|
|
1189
1198
|
sidebarWidth: c,
|
|
1190
1199
|
gridLayerConfig: a,
|
|
1191
|
-
cellLayerConfig:
|
|
1192
|
-
headerOrientation:
|
|
1193
|
-
scale:
|
|
1194
|
-
} = t, W = n != null && n.length > 0,
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
Math.sqrt(256e6 / (
|
|
1200
|
+
cellLayerConfig: h,
|
|
1201
|
+
headerOrientation: g = "horizontal",
|
|
1202
|
+
scale: R = 2
|
|
1203
|
+
} = t, W = n != null && n.length > 0, O = t.columnHeaderHeight ?? (g === "vertical" ? Bn : Vn), H = W ? et + O : O, M = o.getVisibleColumns(), X = e.flattenedRows, B = Math.max(0, ((Ee = t.rowRange) == null ? void 0 : Ee.start) ?? 0), G = Math.min(X.length, ((Ie = t.rowRange) == null ? void 0 : Ie.end) ?? X.length), P = Math.max(0, G - B), j = B * r, F = o.getTotalWidth(), D = P * r, u = c + F, x = H + D, z = 16384, m = Math.min(
|
|
1204
|
+
z / u,
|
|
1205
|
+
z / x,
|
|
1206
|
+
Math.sqrt(256e6 / (u * x))
|
|
1198
1207
|
);
|
|
1199
|
-
let
|
|
1200
|
-
(!Number.isFinite(
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
const l =
|
|
1204
|
-
l.setTransform(
|
|
1205
|
-
const
|
|
1208
|
+
let _ = Math.min(R, m);
|
|
1209
|
+
(!Number.isFinite(_) || _ <= 0) && (_ = 1);
|
|
1210
|
+
const S = document.createElement("canvas");
|
|
1211
|
+
S.width = Math.round(u * _), S.height = Math.round(x * _), S.style.width = `${u}px`, S.style.height = `${x}px`;
|
|
1212
|
+
const l = S.getContext("2d");
|
|
1213
|
+
l.setTransform(_, 0, 0, _, 0, 0), l.fillStyle = "#ffffff", l.fillRect(0, 0, u, x);
|
|
1214
|
+
const q = new en({
|
|
1206
1215
|
scrollX: 0,
|
|
1207
|
-
scrollY:
|
|
1208
|
-
canvasWidth:
|
|
1209
|
-
canvasHeight:
|
|
1216
|
+
scrollY: j,
|
|
1217
|
+
canvasWidth: F,
|
|
1218
|
+
canvasHeight: D,
|
|
1210
1219
|
rowHeight: r
|
|
1211
|
-
}),
|
|
1212
|
-
let
|
|
1213
|
-
for (const
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
const
|
|
1217
|
-
let
|
|
1218
|
-
for (const
|
|
1219
|
-
|
|
1220
|
-
const
|
|
1221
|
-
let
|
|
1222
|
-
for (const
|
|
1223
|
-
|
|
1224
|
-
if (
|
|
1225
|
-
...
|
|
1220
|
+
}), ge = [], Pe = [];
|
|
1221
|
+
let Re = 0;
|
|
1222
|
+
for (const k of M)
|
|
1223
|
+
ge.push(Re), Pe.push(k.width), Re += k.width;
|
|
1224
|
+
q.setColumnOffsets(ge), q.setColumnWidths(Pe);
|
|
1225
|
+
const d = o.getPinnedColumns(), E = o.getScrollableColumns(), $ = [], Y = [];
|
|
1226
|
+
let V = 0;
|
|
1227
|
+
for (const k of d)
|
|
1228
|
+
$.push(V), Y.push(k.width), V += k.width;
|
|
1229
|
+
const Q = [], K = [];
|
|
1230
|
+
let le = 0;
|
|
1231
|
+
for (const k of E)
|
|
1232
|
+
Q.push(le), K.push(k.width), le += k.width;
|
|
1233
|
+
if (q.pinnedWidth = o.getPinnedWidth(), q.setPinnedOffsets($, Y), q.setScrollableOffsets(Q, K), l.save(), l.translate(c, H), tn(l, q, e, o, a), nn(l, q, e, o, t.selectionEngine, {
|
|
1234
|
+
...h,
|
|
1226
1235
|
clearBackground: !1
|
|
1227
1236
|
}), l.restore(), c > 0) {
|
|
1228
|
-
l.save(), l.translate(0,
|
|
1229
|
-
const
|
|
1230
|
-
l.fillStyle =
|
|
1231
|
-
for (let
|
|
1232
|
-
const
|
|
1233
|
-
if (!
|
|
1234
|
-
const
|
|
1235
|
-
l.fillStyle =
|
|
1236
|
-
let
|
|
1237
|
-
if (l.measureText(
|
|
1238
|
-
for (;
|
|
1239
|
-
|
|
1240
|
-
|
|
1237
|
+
l.save(), l.translate(0, H);
|
|
1238
|
+
const k = "#ffffff";
|
|
1239
|
+
l.fillStyle = k, l.fillRect(0, 0, c, D), l.strokeStyle = "#e5e7eb", l.lineWidth = 0.5, l.beginPath(), l.moveTo(c, 0), l.lineTo(c, D), l.stroke(), l.font = "13px system-ui, sans-serif", l.textBaseline = "middle", l.fillStyle = "#374151";
|
|
1240
|
+
for (let ne = B; ne < G; ne++) {
|
|
1241
|
+
const Z = X[ne];
|
|
1242
|
+
if (!Z) continue;
|
|
1243
|
+
const Se = e.getDepth(Z.id), ee = (ne - B) * r, oe = Se * 16 + 8, Me = String(Z.title ?? Z.id), me = c - oe - 8;
|
|
1244
|
+
l.fillStyle = ne % 2 === 0 ? "#ffffff" : "#f9fafb", l.fillRect(0, ee, c, r), l.strokeStyle = "#e5e7eb", l.lineWidth = 0.5, l.beginPath(), l.moveTo(0, ee + r), l.lineTo(c, ee + r), l.stroke(), l.fillStyle = "#374151";
|
|
1245
|
+
let ae = Me;
|
|
1246
|
+
if (l.measureText(ae).width > me && me > 0) {
|
|
1247
|
+
for (; ae.length > 0 && l.measureText(ae + "…").width > me; )
|
|
1248
|
+
ae = ae.slice(0, -1);
|
|
1249
|
+
ae = ae + "…";
|
|
1241
1250
|
}
|
|
1242
|
-
l.fillText(
|
|
1251
|
+
l.fillText(ae, oe, ee + r / 2);
|
|
1243
1252
|
}
|
|
1244
1253
|
l.restore();
|
|
1245
1254
|
}
|
|
1246
|
-
if (l.save(), l.translate(0, 0), l.fillStyle = "#f9fafb", l.fillRect(0, 0,
|
|
1247
|
-
const
|
|
1248
|
-
for (const
|
|
1249
|
-
|
|
1250
|
-
let
|
|
1251
|
-
const
|
|
1252
|
-
if (
|
|
1253
|
-
const
|
|
1254
|
-
if (!
|
|
1255
|
-
const
|
|
1256
|
-
l.strokeStyle = "#d1d5db", l.lineWidth = 1, l.beginPath(), l.moveTo(
|
|
1255
|
+
if (l.save(), l.translate(0, 0), l.fillStyle = "#f9fafb", l.fillRect(0, 0, u, H), l.fillStyle = "#d1d5db", l.fillRect(0, 0, u, 1), l.strokeStyle = "#d1d5db", l.lineWidth = 1, l.beginPath(), l.moveTo(0, H), l.lineTo(u, H), l.stroke(), l.fillStyle = "#f9fafb", l.fillRect(0, 0, c, H), l.strokeStyle = "#d1d5db", l.lineWidth = 1, l.beginPath(), l.moveTo(c, 0), l.lineTo(c, H), l.stroke(), W && n) {
|
|
1256
|
+
const k = /* @__PURE__ */ new Map();
|
|
1257
|
+
for (const oe of n)
|
|
1258
|
+
k.set(oe.id, oe);
|
|
1259
|
+
let ne, Z = 0, Se = 0;
|
|
1260
|
+
const ee = (oe, Me, me) => {
|
|
1261
|
+
if (oe === void 0 || me <= 0) return;
|
|
1262
|
+
const ae = k.get(oe);
|
|
1263
|
+
if (!ae) return;
|
|
1264
|
+
const ze = c + Me;
|
|
1265
|
+
l.strokeStyle = "#d1d5db", l.lineWidth = 1, l.beginPath(), l.moveTo(ze, et), l.lineTo(ze + me, et), l.stroke(), l.font = "600 11px system-ui, sans-serif", l.fillStyle = "#6b7280", l.textBaseline = "middle", l.textAlign = "left", l.fillText(ae.title, ze + 8, et / 2);
|
|
1257
1266
|
};
|
|
1258
|
-
for (const
|
|
1259
|
-
const Me = o.getColumnX(
|
|
1260
|
-
|
|
1267
|
+
for (const oe of M) {
|
|
1268
|
+
const Me = o.getColumnX(oe.id);
|
|
1269
|
+
oe.group !== ne ? (ee(ne, Z, Se), ne = oe.group, Z = Me, Se = oe.width) : Se += oe.width;
|
|
1261
1270
|
}
|
|
1262
|
-
|
|
1263
|
-
}
|
|
1264
|
-
const
|
|
1265
|
-
if (
|
|
1266
|
-
let
|
|
1267
|
-
for (;
|
|
1268
|
-
|
|
1269
|
-
return
|
|
1271
|
+
ee(ne, Z, Se);
|
|
1272
|
+
}
|
|
1273
|
+
const Ce = W ? et : 0, Te = (k, ne) => {
|
|
1274
|
+
if (ne <= 0 || l.measureText(k).width <= ne) return k;
|
|
1275
|
+
let Z = k;
|
|
1276
|
+
for (; Z.length > 0 && l.measureText(Z + "…").width > ne; )
|
|
1277
|
+
Z = Z.slice(0, -1);
|
|
1278
|
+
return Z + "…";
|
|
1270
1279
|
};
|
|
1271
|
-
for (const
|
|
1272
|
-
const
|
|
1273
|
-
if (l.strokeStyle = "#d1d5db", l.lineWidth = 1, l.beginPath(), l.moveTo(
|
|
1274
|
-
if (l.fillStyle = "#6b7280", l.textBaseline = "middle",
|
|
1275
|
-
const
|
|
1276
|
-
l.save(), l.translate(
|
|
1280
|
+
for (const k of M) {
|
|
1281
|
+
const ne = o.getColumnX(k.id), Z = c + ne, Se = g === "vertical" && k.pinned !== "left";
|
|
1282
|
+
if (l.strokeStyle = "#d1d5db", l.lineWidth = 1, l.beginPath(), l.moveTo(Z + k.width, Ce), l.lineTo(Z + k.width, H), l.stroke(), !!k.title)
|
|
1283
|
+
if (l.fillStyle = "#6b7280", l.textBaseline = "middle", Se) {
|
|
1284
|
+
const ee = O - 12;
|
|
1285
|
+
l.save(), l.translate(Z + k.width / 2 + 4, H - 6), l.rotate(-Math.PI / 2), l.font = "11px system-ui, sans-serif", l.textAlign = "left", l.fillText(Te(k.title, ee), 0, 0, ee), l.restore();
|
|
1277
1286
|
} else {
|
|
1278
1287
|
l.font = "600 12px system-ui, sans-serif", l.textAlign = "left";
|
|
1279
|
-
const
|
|
1280
|
-
l.fillText(
|
|
1288
|
+
const ee = k.width - 16, oe = g === "vertical" ? H - 14 : Ce + O / 2;
|
|
1289
|
+
l.fillText(Te(k.title, ee), Z + 8, oe, ee);
|
|
1281
1290
|
}
|
|
1282
1291
|
}
|
|
1283
|
-
return l.restore(), l.fillStyle = "#d1d5db", l.fillRect(0, 0,
|
|
1292
|
+
return l.restore(), l.fillStyle = "#d1d5db", l.fillRect(0, 0, u, 1), l.fillRect(0, x - 1, u, 1), l.fillRect(0, 0, 1, x), l.fillRect(u - 1, 0, 1, x), S;
|
|
1284
1293
|
}
|
|
1285
|
-
const
|
|
1286
|
-
function
|
|
1294
|
+
const jt = 180, Zt = 32, $n = 28, Jt = 200, Fn = 150;
|
|
1295
|
+
function Qt(t, e, o) {
|
|
1287
1296
|
const n = o ?? (t === "vertical" ? 120 : 32);
|
|
1288
|
-
return e ?
|
|
1297
|
+
return e ? $n + n : n;
|
|
1289
1298
|
}
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1299
|
+
const Nn = Cn(
|
|
1300
|
+
yn(function(e, o) {
|
|
1301
|
+
var Wt, Dt;
|
|
1292
1302
|
const {
|
|
1293
1303
|
rows: n,
|
|
1294
1304
|
columns: r,
|
|
1295
1305
|
columnGroups: c,
|
|
1296
1306
|
getCellData: a,
|
|
1297
|
-
cellRenderer:
|
|
1298
|
-
sidebarRenderer:
|
|
1299
|
-
sidebarWidth:
|
|
1300
|
-
rowHeight: W =
|
|
1301
|
-
headerOrientation:
|
|
1302
|
-
columnHeaderHeight:
|
|
1303
|
-
maxHeight:
|
|
1304
|
-
rowStyle:
|
|
1307
|
+
cellRenderer: h,
|
|
1308
|
+
sidebarRenderer: g,
|
|
1309
|
+
sidebarWidth: R = jt,
|
|
1310
|
+
rowHeight: W = Zt,
|
|
1311
|
+
headerOrientation: O = "horizontal",
|
|
1312
|
+
columnHeaderHeight: H,
|
|
1313
|
+
maxHeight: M,
|
|
1314
|
+
rowStyle: X,
|
|
1305
1315
|
selection: B,
|
|
1306
|
-
onSelectionChange:
|
|
1307
|
-
onCellClick:
|
|
1308
|
-
onCellDoubleClick:
|
|
1309
|
-
onCellContextMenu:
|
|
1310
|
-
onCellHover:
|
|
1311
|
-
onColumnHeaderClick:
|
|
1312
|
-
onTreeToggle:
|
|
1313
|
-
defaultExpandedRows:
|
|
1314
|
-
onExpandChange:
|
|
1315
|
-
onLoadMore:
|
|
1316
|
-
hasMore:
|
|
1317
|
-
loading:
|
|
1316
|
+
onSelectionChange: G,
|
|
1317
|
+
onCellClick: P,
|
|
1318
|
+
onCellDoubleClick: j,
|
|
1319
|
+
onCellContextMenu: F,
|
|
1320
|
+
onCellHover: D,
|
|
1321
|
+
onColumnHeaderClick: u,
|
|
1322
|
+
onTreeToggle: x,
|
|
1323
|
+
defaultExpandedRows: z,
|
|
1324
|
+
onExpandChange: v,
|
|
1325
|
+
onLoadMore: m,
|
|
1326
|
+
hasMore: _,
|
|
1327
|
+
loading: S,
|
|
1318
1328
|
hoverContent: l,
|
|
1319
|
-
hoverPosition:
|
|
1320
|
-
showColumnVisibilityMenu:
|
|
1321
|
-
ariaLabel:
|
|
1322
|
-
} = e, [
|
|
1323
|
-
() => new Set(
|
|
1324
|
-
), [
|
|
1325
|
-
|
|
1326
|
-
|
|
1329
|
+
hoverPosition: q,
|
|
1330
|
+
showColumnVisibilityMenu: ge,
|
|
1331
|
+
ariaLabel: Pe = "Data grid"
|
|
1332
|
+
} = e, [Re, d] = we(
|
|
1333
|
+
() => new Set(z ?? [])
|
|
1334
|
+
), [E, $] = we(0), [Y, V] = we(0), [Q, K] = we({ width: 0, height: 0 }), [le, Ce] = we(!1), [Te, Ee] = we(!1), [Ie, k] = we(r), [ne, Z] = we(null), [Se, ee] = we(""), [oe, Me] = we(null), me = re(null), ae = re(null);
|
|
1335
|
+
be(() => {
|
|
1336
|
+
k(r);
|
|
1327
1337
|
}, [r]);
|
|
1328
|
-
const
|
|
1338
|
+
const ze = re(null), He = re([]), he = re(new en({ rowHeight: W })), N = re(null), A = re(e), ye = re(null), Ye = re(null), tt = re(!1), Ct = re(0);
|
|
1329
1339
|
A.current = e;
|
|
1330
|
-
const
|
|
1331
|
-
() => new
|
|
1332
|
-
[n,
|
|
1333
|
-
),
|
|
1334
|
-
|
|
1335
|
-
const
|
|
1336
|
-
const
|
|
1337
|
-
if (!
|
|
1338
|
-
const { treeEngine: C, columnEngine:
|
|
1339
|
-
if (!
|
|
1340
|
-
const y =
|
|
1341
|
-
i === "grid" ?
|
|
1340
|
+
const Ve = wt(
|
|
1341
|
+
() => new Sn(n, Re),
|
|
1342
|
+
[n, Re]
|
|
1343
|
+
), fe = wt(() => new Ae(Ie), [Ie]), yt = wt(() => new _n(B), [B]);
|
|
1344
|
+
ye.current = { treeEngine: Ve, columnEngine: fe, selectionEngine: yt };
|
|
1345
|
+
const dt = fe.getPinnedColumns().length > 0, Fe = dt ? 0 : R, xt = se((i) => {
|
|
1346
|
+
const f = ye.current;
|
|
1347
|
+
if (!f) return;
|
|
1348
|
+
const { treeEngine: C, columnEngine: I, selectionEngine: b } = f, w = he.current, s = i === "grid" ? 0 : i === "cells" ? 1 : 2, p = He.current[s];
|
|
1349
|
+
if (!p) return;
|
|
1350
|
+
const y = kn(p, w.canvasWidth, w.canvasHeight);
|
|
1351
|
+
i === "grid" ? tn(y, w, C, I, { rowStyle: A.current.rowStyle }) : i === "cells" ? nn(y, w, C, I, b, {
|
|
1342
1352
|
cellRenderer: A.current.cellRenderer,
|
|
1343
1353
|
getCellData: A.current.getCellData,
|
|
1344
|
-
hoveredCell:
|
|
1345
|
-
}) :
|
|
1346
|
-
hoveredCell:
|
|
1347
|
-
hoveredRowId:
|
|
1348
|
-
selectedCell:
|
|
1349
|
-
resizingColumn:
|
|
1354
|
+
hoveredCell: Ye.current
|
|
1355
|
+
}) : Hn(y, w, C, I, b, {
|
|
1356
|
+
hoveredCell: Ye.current,
|
|
1357
|
+
hoveredRowId: me.current,
|
|
1358
|
+
selectedCell: ae.current,
|
|
1359
|
+
resizingColumn: ne ?? void 0,
|
|
1350
1360
|
loading: A.current.loading
|
|
1351
1361
|
});
|
|
1352
|
-
}, [
|
|
1353
|
-
|
|
1354
|
-
const i =
|
|
1355
|
-
let
|
|
1356
|
-
for (const
|
|
1357
|
-
|
|
1358
|
-
const s = [],
|
|
1362
|
+
}, [ne]);
|
|
1363
|
+
be(() => {
|
|
1364
|
+
const i = fe.getPinnedColumns(), f = fe.getScrollableColumns(), C = fe.getPinnedWidth(), I = [], b = [];
|
|
1365
|
+
let w = 0;
|
|
1366
|
+
for (const ie of i)
|
|
1367
|
+
I.push(w), b.push(ie.width), w += ie.width;
|
|
1368
|
+
const s = [], p = [];
|
|
1359
1369
|
let y = 0;
|
|
1360
|
-
for (const
|
|
1361
|
-
s.push(y),
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1364
|
-
const
|
|
1365
|
-
let
|
|
1366
|
-
for (const
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
}, [
|
|
1370
|
-
const i = new
|
|
1371
|
-
return
|
|
1372
|
-
i.destroy(),
|
|
1370
|
+
for (const ie of f)
|
|
1371
|
+
s.push(y), p.push(ie.width), y += ie.width;
|
|
1372
|
+
const L = he.current;
|
|
1373
|
+
L.pinnedWidth = C, L.setPinnedOffsets(I, b), L.setScrollableOffsets(s, p);
|
|
1374
|
+
const U = fe.getVisibleColumns(), J = [], ue = [];
|
|
1375
|
+
let pe = 0;
|
|
1376
|
+
for (const ie of U)
|
|
1377
|
+
J.push(pe), ue.push(ie.width), pe += ie.width;
|
|
1378
|
+
L.setColumnOffsets(J), L.setColumnWidths(ue), L.update({ rowHeight: W });
|
|
1379
|
+
}, [fe, W]), be(() => {
|
|
1380
|
+
const i = new In(xt);
|
|
1381
|
+
return N.current = i, i.markAllDirty(), () => {
|
|
1382
|
+
i.destroy(), N.current = null;
|
|
1373
1383
|
};
|
|
1374
|
-
}, [
|
|
1375
|
-
const i =
|
|
1384
|
+
}, [xt]), be(() => {
|
|
1385
|
+
const i = ze.current;
|
|
1376
1386
|
if (!i) return;
|
|
1377
|
-
const
|
|
1378
|
-
var
|
|
1379
|
-
for (const
|
|
1380
|
-
const { width: s, height:
|
|
1381
|
-
|
|
1387
|
+
const f = new ResizeObserver((C) => {
|
|
1388
|
+
var I, b;
|
|
1389
|
+
for (const w of C) {
|
|
1390
|
+
const { width: s, height: p } = w.contentRect, y = s - Fe, L = Qt(A.current.headerOrientation ?? "horizontal", (((I = A.current.columnGroups) == null ? void 0 : I.length) ?? 0) > 0, A.current.columnHeaderHeight), U = p - L;
|
|
1391
|
+
he.current.update({
|
|
1382
1392
|
canvasWidth: Math.max(0, y),
|
|
1383
|
-
canvasHeight: Math.max(0,
|
|
1384
|
-
}),
|
|
1393
|
+
canvasHeight: Math.max(0, U)
|
|
1394
|
+
}), K({
|
|
1385
1395
|
width: Math.max(0, y),
|
|
1386
|
-
height: Math.max(0,
|
|
1387
|
-
}), (
|
|
1396
|
+
height: Math.max(0, U)
|
|
1397
|
+
}), (b = N.current) == null || b.markAllDirty();
|
|
1388
1398
|
}
|
|
1389
1399
|
});
|
|
1390
|
-
return
|
|
1391
|
-
}, [
|
|
1400
|
+
return f.observe(i), () => f.disconnect();
|
|
1401
|
+
}, [Fe]), be(() => {
|
|
1392
1402
|
var i;
|
|
1393
|
-
(i =
|
|
1394
|
-
}, [
|
|
1403
|
+
(i = N.current) == null || i.markAllDirty();
|
|
1404
|
+
}, [Ve, fe, yt]), be(() => {
|
|
1395
1405
|
var i;
|
|
1396
|
-
(i =
|
|
1397
|
-
}, [
|
|
1398
|
-
const
|
|
1399
|
-
var
|
|
1406
|
+
(i = N.current) == null || i.markDirty("overlay");
|
|
1407
|
+
}, [S]);
|
|
1408
|
+
const at = se((i) => {
|
|
1409
|
+
var ue, pe, ie, Le;
|
|
1400
1410
|
i.preventDefault();
|
|
1401
|
-
const
|
|
1411
|
+
const f = he.current, C = ye.current;
|
|
1402
1412
|
if (!C) return;
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1413
|
+
const I = C.treeEngine.flattenedRows.length * f.rowHeight, b = C.columnEngine.getTotalWidth(), w = Math.max(0, I - f.canvasHeight), s = b - C.columnEngine.getPinnedWidth(), p = f.canvasWidth - C.columnEngine.getPinnedWidth(), y = Math.max(0, s - p), L = Math.max(0, Math.min(w, f.scrollY + i.deltaY)), U = Math.max(0, Math.min(y, f.scrollX + i.deltaX));
|
|
1414
|
+
f.update({ scrollY: L, scrollX: U }), $(L), V(U), (ue = N.current) == null || ue.markAllDirty(), Ct.current = i.timeStamp, Ye.current && (Ye.current = null, me.current = null, Me(null), (pe = N.current) == null || pe.markDirty("overlay"), (Le = (ie = A.current).onCellHover) == null || Le.call(ie, null, null, new PointerEvent("pointerleave")));
|
|
1415
|
+
const J = A.current;
|
|
1416
|
+
J.hasMore && J.onLoadMore && !J.loading && w - L < Jt ? tt.current || (tt.current = !0, J.onLoadMore()) : w - L >= Jt && (tt.current = !1);
|
|
1407
1417
|
}, []);
|
|
1408
|
-
|
|
1409
|
-
const i =
|
|
1418
|
+
be(() => {
|
|
1419
|
+
const i = He.current[2];
|
|
1410
1420
|
if (i)
|
|
1411
|
-
return i.addEventListener("wheel",
|
|
1412
|
-
}, [
|
|
1413
|
-
|
|
1414
|
-
}, [
|
|
1415
|
-
const
|
|
1416
|
-
var
|
|
1417
|
-
const
|
|
1418
|
-
if (!
|
|
1419
|
-
const C =
|
|
1420
|
-
if (!C) return;
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1423
|
-
}, []),
|
|
1424
|
-
|
|
1425
|
-
var
|
|
1426
|
-
const C = new Set(
|
|
1427
|
-
return C.has(i) ? (C.delete(i),
|
|
1421
|
+
return i.addEventListener("wheel", at, { passive: !1 }), () => i.removeEventListener("wheel", at);
|
|
1422
|
+
}, [at]), be(() => {
|
|
1423
|
+
S || (tt.current = !1);
|
|
1424
|
+
}, [S]);
|
|
1425
|
+
const on = se((i) => {
|
|
1426
|
+
var p, y, L;
|
|
1427
|
+
const f = ye.current;
|
|
1428
|
+
if (!f) return;
|
|
1429
|
+
const C = He.current[2];
|
|
1430
|
+
if (!C || i.timeStamp - Ct.current < Fn) return;
|
|
1431
|
+
const I = C.getBoundingClientRect(), b = i.clientX - I.left, w = i.clientY - I.top, s = rt(b, w, he.current, f.treeEngine, f.columnEngine);
|
|
1432
|
+
Ye.current = s, me.current = (s == null ? void 0 : s.rowId) ?? null, Me((s == null ? void 0 : s.rowId) ?? null), (p = N.current) == null || p.markDirty("overlay"), (L = (y = A.current).onCellHover) == null || L.call(y, (s == null ? void 0 : s.rowId) ?? null, (s == null ? void 0 : s.colId) ?? null, i.nativeEvent);
|
|
1433
|
+
}, []), ht = se((i) => {
|
|
1434
|
+
d((f) => {
|
|
1435
|
+
var I, b;
|
|
1436
|
+
const C = new Set(f);
|
|
1437
|
+
return C.has(i) ? (C.delete(i), ee(`Row ${i} collapsed`)) : (C.add(i), ee(`Row ${i} expanded`)), (b = (I = A.current).onExpandChange) == null || b.call(I, [...C]), C;
|
|
1428
1438
|
});
|
|
1429
|
-
}, []),
|
|
1430
|
-
var
|
|
1431
|
-
const
|
|
1432
|
-
if (!
|
|
1433
|
-
const C =
|
|
1439
|
+
}, []), ln = se((i) => {
|
|
1440
|
+
var qe, Ne, je, Ze, Je;
|
|
1441
|
+
const f = ye.current;
|
|
1442
|
+
if (!f) return;
|
|
1443
|
+
const C = He.current[2];
|
|
1434
1444
|
if (!C) return;
|
|
1435
|
-
const
|
|
1445
|
+
const I = C.getBoundingClientRect(), b = i.clientX - I.left, w = i.clientY - I.top, s = rt(b, w, he.current, f.treeEngine, f.columnEngine);
|
|
1436
1446
|
if (!s) return;
|
|
1437
|
-
const { treeEngine:
|
|
1438
|
-
if (
|
|
1439
|
-
const
|
|
1440
|
-
if (
|
|
1441
|
-
A.current.onTreeToggle ? A.current.onTreeToggle(s.rowId) :
|
|
1447
|
+
const { treeEngine: p, columnEngine: y, selectionEngine: L } = f, U = y.getPinnedColumns();
|
|
1448
|
+
if (U.length > 0) {
|
|
1449
|
+
const _e = U[0].id;
|
|
1450
|
+
if (p.hasChildren(s.rowId) && s.colId === _e) {
|
|
1451
|
+
A.current.onTreeToggle ? A.current.onTreeToggle(s.rowId) : ht(s.rowId);
|
|
1442
1452
|
return;
|
|
1443
1453
|
}
|
|
1444
1454
|
}
|
|
1445
|
-
const
|
|
1446
|
-
i.ctrlKey || i.metaKey ?
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1449
|
-
}, [
|
|
1450
|
-
var
|
|
1451
|
-
const
|
|
1452
|
-
if (!
|
|
1453
|
-
const C =
|
|
1455
|
+
const J = p.flattenedRows.map((_e) => _e.id), ue = y.getVisibleColumns().map((_e) => _e.id);
|
|
1456
|
+
i.ctrlKey || i.metaKey ? L.ctrlClick(s.rowId, s.colId) : i.shiftKey ? L.shiftClick(s.rowId, s.colId, J, ue) : L.click(s.rowId, s.colId, J, ue), ae.current = { rowId: s.rowId, colId: s.colId }, (Ne = (qe = A.current).onSelectionChange) == null || Ne.call(qe, L.getSelection()), (Ze = (je = A.current).onCellClick) == null || Ze.call(je, s.rowId, s.colId, i.nativeEvent), (Je = N.current) == null || Je.markDirty("overlay");
|
|
1457
|
+
const pe = String(s.rowId), ie = y.getVisibleColumns().find((_e) => _e.id === s.colId), Le = (ie == null ? void 0 : ie.title) ?? s.colId;
|
|
1458
|
+
ee(`Row ${pe}, Column ${Le} selected`);
|
|
1459
|
+
}, [ht]), sn = se((i) => {
|
|
1460
|
+
var p, y;
|
|
1461
|
+
const f = ye.current;
|
|
1462
|
+
if (!f) return;
|
|
1463
|
+
const C = He.current[2];
|
|
1454
1464
|
if (!C) return;
|
|
1455
|
-
const
|
|
1456
|
-
s && ((y = (
|
|
1457
|
-
}, []),
|
|
1458
|
-
var
|
|
1465
|
+
const I = C.getBoundingClientRect(), b = i.clientX - I.left, w = i.clientY - I.top, s = rt(b, w, he.current, f.treeEngine, f.columnEngine);
|
|
1466
|
+
s && ((y = (p = A.current).onCellDoubleClick) == null || y.call(p, s.rowId, s.colId, i.nativeEvent));
|
|
1467
|
+
}, []), rn = se((i) => {
|
|
1468
|
+
var p, y;
|
|
1459
1469
|
i.preventDefault();
|
|
1460
|
-
const
|
|
1461
|
-
if (!
|
|
1462
|
-
const C =
|
|
1470
|
+
const f = ye.current;
|
|
1471
|
+
if (!f) return;
|
|
1472
|
+
const C = He.current[2];
|
|
1463
1473
|
if (!C) return;
|
|
1464
|
-
const
|
|
1465
|
-
s && ((y = (
|
|
1466
|
-
}, []),
|
|
1467
|
-
var i,
|
|
1468
|
-
|
|
1469
|
-
}, []),
|
|
1470
|
-
(i,
|
|
1471
|
-
var C,
|
|
1472
|
-
(
|
|
1474
|
+
const I = C.getBoundingClientRect(), b = i.clientX - I.left, w = i.clientY - I.top, s = rt(b, w, he.current, f.treeEngine, f.columnEngine);
|
|
1475
|
+
s && ((y = (p = A.current).onCellContextMenu) == null || y.call(p, s.rowId, s.colId, i.nativeEvent));
|
|
1476
|
+
}, []), cn = se(() => {
|
|
1477
|
+
var i, f, C;
|
|
1478
|
+
Ye.current = null, me.current = null, Me(null), (i = N.current) == null || i.markDirty("overlay"), (C = (f = A.current).onCellHover) == null || C.call(f, null, null, new PointerEvent("pointerleave"));
|
|
1479
|
+
}, []), dn = se(
|
|
1480
|
+
(i, f) => {
|
|
1481
|
+
var C, I;
|
|
1482
|
+
(I = (C = A.current).onColumnHeaderClick) == null || I.call(C, i, f.nativeEvent);
|
|
1473
1483
|
},
|
|
1474
1484
|
[]
|
|
1475
|
-
),
|
|
1476
|
-
(i,
|
|
1477
|
-
var
|
|
1478
|
-
|
|
1479
|
-
if (
|
|
1480
|
-
const
|
|
1481
|
-
return { ...
|
|
1485
|
+
), an = se(
|
|
1486
|
+
(i, f) => {
|
|
1487
|
+
var I, b, w, s;
|
|
1488
|
+
k((p) => p.map((L) => {
|
|
1489
|
+
if (L.id !== i) return L;
|
|
1490
|
+
const U = L.minWidth ?? 30;
|
|
1491
|
+
return { ...L, width: Math.max(U, f) };
|
|
1482
1492
|
}));
|
|
1483
|
-
const C = (
|
|
1493
|
+
const C = (I = ye.current) == null ? void 0 : I.columnEngine;
|
|
1484
1494
|
if (C) {
|
|
1485
|
-
const
|
|
1495
|
+
const p = C.getColumnX(i), y = C.getVisibleColumns().find((L) => L.id === i);
|
|
1486
1496
|
if (y) {
|
|
1487
|
-
const
|
|
1488
|
-
|
|
1497
|
+
const U = y.pinned === "left" ? p + Math.max(y.minWidth ?? 30, f) : p + Math.max(y.minWidth ?? 30, f) - he.current.scrollX;
|
|
1498
|
+
Z({ colId: i, x: U });
|
|
1489
1499
|
}
|
|
1490
1500
|
}
|
|
1491
|
-
(
|
|
1501
|
+
(w = (b = A.current).onColumnResize) == null || w.call(b, i, f), (s = N.current) == null || s.markAllDirty();
|
|
1492
1502
|
},
|
|
1493
1503
|
[]
|
|
1494
1504
|
);
|
|
1495
|
-
|
|
1505
|
+
be(() => {
|
|
1496
1506
|
const i = () => {
|
|
1497
|
-
|
|
1507
|
+
Z(null);
|
|
1498
1508
|
};
|
|
1499
1509
|
return document.addEventListener("mouseup", i), () => document.removeEventListener("mouseup", i);
|
|
1500
1510
|
}, []);
|
|
1501
|
-
const
|
|
1502
|
-
(i,
|
|
1503
|
-
var C,
|
|
1504
|
-
|
|
1505
|
-
const s = [...
|
|
1506
|
-
if (
|
|
1507
|
-
const [y] = s.splice(
|
|
1508
|
-
return s.splice(
|
|
1509
|
-
}), (
|
|
1511
|
+
const hn = se(
|
|
1512
|
+
(i, f) => {
|
|
1513
|
+
var C, I, b;
|
|
1514
|
+
k((w) => {
|
|
1515
|
+
const s = [...w], p = s.findIndex((U) => U.id === i);
|
|
1516
|
+
if (p === -1) return w;
|
|
1517
|
+
const [y] = s.splice(p, 1), L = Math.max(0, Math.min(f, s.length));
|
|
1518
|
+
return s.splice(L, 0, y), s;
|
|
1519
|
+
}), (I = (C = A.current).onColumnReorder) == null || I.call(C, i, f), (b = N.current) == null || b.markAllDirty();
|
|
1510
1520
|
},
|
|
1511
1521
|
[]
|
|
1512
|
-
),
|
|
1513
|
-
(i,
|
|
1514
|
-
var C,
|
|
1515
|
-
|
|
1516
|
-
(
|
|
1517
|
-
), (
|
|
1522
|
+
), fn = se(
|
|
1523
|
+
(i, f) => {
|
|
1524
|
+
var C, I, b;
|
|
1525
|
+
k(
|
|
1526
|
+
(w) => w.map((s) => s.id === i ? { ...s, hidden: !f } : s)
|
|
1527
|
+
), (I = (C = A.current).onColumnVisibilityChange) == null || I.call(C, i, f), (b = N.current) == null || b.markAllDirty();
|
|
1518
1528
|
},
|
|
1519
1529
|
[]
|
|
1520
|
-
),
|
|
1521
|
-
(i,
|
|
1522
|
-
|
|
1523
|
-
const
|
|
1524
|
-
var
|
|
1525
|
-
const
|
|
1526
|
-
i === "y" ? (
|
|
1527
|
-
},
|
|
1528
|
-
|
|
1530
|
+
), Rt = se(
|
|
1531
|
+
(i, f, C, I) => {
|
|
1532
|
+
f.preventDefault(), f.stopPropagation(), Ee(!0);
|
|
1533
|
+
const b = i === "y" ? f.clientY : f.clientX, w = i === "y" ? he.current.scrollY : he.current.scrollX, s = (y) => {
|
|
1534
|
+
var pe;
|
|
1535
|
+
const L = (i === "y" ? y.clientY : y.clientX) - b, U = C > 0 ? L / C * I : 0, J = Math.max(0, Math.min(I, w + U)), ue = he.current;
|
|
1536
|
+
i === "y" ? (ue.update({ scrollY: J }), $(J)) : (ue.update({ scrollX: J }), V(J)), (pe = N.current) == null || pe.markAllDirty();
|
|
1537
|
+
}, p = () => {
|
|
1538
|
+
Ee(!1), document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", p);
|
|
1529
1539
|
};
|
|
1530
|
-
document.addEventListener("mousemove", s), document.addEventListener("mouseup",
|
|
1540
|
+
document.addEventListener("mousemove", s), document.addEventListener("mouseup", p);
|
|
1531
1541
|
},
|
|
1532
1542
|
[]
|
|
1533
|
-
),
|
|
1534
|
-
var
|
|
1535
|
-
const
|
|
1536
|
-
if (!
|
|
1537
|
-
const { treeEngine: C, columnEngine:
|
|
1538
|
-
if (s.length === 0 ||
|
|
1539
|
-
const y =
|
|
1540
|
-
const
|
|
1541
|
-
let
|
|
1542
|
-
|
|
1543
|
-
const
|
|
1544
|
-
let
|
|
1545
|
-
|
|
1546
|
-
},
|
|
1547
|
-
var
|
|
1548
|
-
let
|
|
1549
|
-
|
|
1550
|
-
const lt = Math.max(0, Math.min(s.length - 1,
|
|
1551
|
-
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1543
|
+
), un = se((i) => {
|
|
1544
|
+
var ue, pe, ie, Le, qe, Ne, je, Ze, Je, _e, mt, Xt, Pt, Et, Lt, Ot, At, zt, Yt, Vt, Bt, Gt, $t, Ft;
|
|
1545
|
+
const f = ye.current;
|
|
1546
|
+
if (!f) return;
|
|
1547
|
+
const { treeEngine: C, columnEngine: I, selectionEngine: b } = f, w = he.current, s = C.flattenedRows.map((te) => te.id), p = I.getVisibleColumns().map((te) => te.id);
|
|
1548
|
+
if (s.length === 0 || p.length === 0) return;
|
|
1549
|
+
const y = b.getSelection().anchor, L = i.ctrlKey || i.metaKey, U = (te, ce) => {
|
|
1550
|
+
const de = s.length * w.rowHeight, We = I.getTotalWidth(), De = Math.max(0, de - w.canvasHeight), lt = Math.max(0, We - w.canvasWidth), Oe = te * w.rowHeight, Ge = Oe + w.rowHeight;
|
|
1551
|
+
let xe = w.scrollY;
|
|
1552
|
+
Oe < w.scrollY ? xe = Oe : Ge > w.scrollY + w.canvasHeight && (xe = Ge - w.canvasHeight), xe = Math.max(0, Math.min(De, xe));
|
|
1553
|
+
const Xe = I.getVisibleColumns()[ce], Qe = Xe ? I.getColumnX(Xe.id) : 0, st = Qe + ((Xe == null ? void 0 : Xe.width) ?? 0);
|
|
1554
|
+
let ke = w.scrollX;
|
|
1555
|
+
Qe < w.scrollX ? ke = Qe : st > w.scrollX + w.canvasWidth && (ke = st - w.canvasWidth), ke = Math.max(0, Math.min(lt, ke)), (xe !== w.scrollY || ke !== w.scrollX) && (w.update({ scrollY: xe, scrollX: ke }), $(xe), V(ke));
|
|
1556
|
+
}, J = (te, ce, de) => {
|
|
1557
|
+
var Kt, Ut, qt;
|
|
1558
|
+
let We = y ? s.indexOf(y.rowId) : -1, De = y ? p.indexOf(y.colId) : -1;
|
|
1559
|
+
We === -1 && (We = 0), De === -1 && (De = 0);
|
|
1560
|
+
const lt = Math.max(0, Math.min(s.length - 1, We + te)), Oe = Math.max(0, Math.min(p.length - 1, De + ce)), Ge = s[lt], xe = p[Oe];
|
|
1561
|
+
de ? b.shiftClick(Ge, xe, s, p) : b.click(Ge, xe, s, p), (Ut = (Kt = A.current).onSelectionChange) == null || Ut.call(Kt, b.getSelection()), (qt = N.current) == null || qt.markDirty("overlay"), U(lt, Oe);
|
|
1562
|
+
const Xe = I.getVisibleColumns()[Oe], Qe = String(Ge), st = (Xe == null ? void 0 : Xe.title) ?? String(xe), ke = b.getSelection().cells.size;
|
|
1563
|
+
ke > 1 ? ee(`${ke} cells selected`) : ee(`Row ${Qe}, Column ${st} selected`);
|
|
1554
1564
|
};
|
|
1555
1565
|
switch (i.key) {
|
|
1556
1566
|
case "ArrowUp":
|
|
1557
|
-
i.preventDefault(),
|
|
1567
|
+
i.preventDefault(), J(-1, 0, i.shiftKey);
|
|
1558
1568
|
break;
|
|
1559
1569
|
case "ArrowDown":
|
|
1560
|
-
i.preventDefault(),
|
|
1570
|
+
i.preventDefault(), J(1, 0, i.shiftKey);
|
|
1561
1571
|
break;
|
|
1562
1572
|
case "ArrowLeft":
|
|
1563
|
-
i.preventDefault(),
|
|
1573
|
+
i.preventDefault(), J(0, -1, i.shiftKey);
|
|
1564
1574
|
break;
|
|
1565
1575
|
case "ArrowRight":
|
|
1566
|
-
i.preventDefault(),
|
|
1576
|
+
i.preventDefault(), J(0, 1, i.shiftKey);
|
|
1567
1577
|
break;
|
|
1568
1578
|
case "Tab": {
|
|
1569
1579
|
if (i.preventDefault(), i.shiftKey) {
|
|
1570
|
-
const
|
|
1571
|
-
if ((y ?
|
|
1572
|
-
|
|
1580
|
+
const te = y ? s.indexOf(y.rowId) : 0;
|
|
1581
|
+
if ((y ? p.indexOf(y.colId) : 0) > 0)
|
|
1582
|
+
J(0, -1, !1);
|
|
1573
1583
|
else {
|
|
1574
|
-
const
|
|
1575
|
-
|
|
1584
|
+
const de = Math.max(0, (te === -1 ? 0 : te) - 1), We = s[de], De = p[p.length - 1];
|
|
1585
|
+
b.click(We, De, s, p), (qe = (Le = A.current).onSelectionChange) == null || qe.call(Le, b.getSelection()), (Ne = N.current) == null || Ne.markDirty("overlay"), U(de, p.length - 1);
|
|
1576
1586
|
}
|
|
1577
1587
|
} else {
|
|
1578
|
-
const
|
|
1579
|
-
if ((y ?
|
|
1580
|
-
|
|
1588
|
+
const te = y ? s.indexOf(y.rowId) : 0;
|
|
1589
|
+
if ((y ? p.indexOf(y.colId) : -1) < p.length - 1)
|
|
1590
|
+
J(0, 1, !1);
|
|
1581
1591
|
else {
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1592
|
+
const de = Math.min(s.length - 1, (te === -1 ? 0 : te) + 1), We = s[de], De = p[0];
|
|
1593
|
+
b.click(We, De, s, p), (pe = (ue = A.current).onSelectionChange) == null || pe.call(ue, b.getSelection()), (ie = N.current) == null || ie.markDirty("overlay"), U(de, 0);
|
|
1584
1594
|
}
|
|
1585
1595
|
}
|
|
1586
1596
|
break;
|
|
1587
1597
|
}
|
|
1588
1598
|
case "Escape":
|
|
1589
|
-
i.preventDefault(),
|
|
1599
|
+
i.preventDefault(), b.clear(), (Ze = (je = A.current).onSelectionChange) == null || Ze.call(je, b.getSelection()), (Je = N.current) == null || Je.markDirty("overlay"), ee("Selection cleared");
|
|
1590
1600
|
break;
|
|
1591
1601
|
case "a":
|
|
1592
1602
|
case "A":
|
|
1593
|
-
if (
|
|
1603
|
+
if (L) {
|
|
1594
1604
|
i.preventDefault();
|
|
1595
|
-
for (const
|
|
1596
|
-
for (const
|
|
1597
|
-
|
|
1598
|
-
(
|
|
1605
|
+
for (const te of s)
|
|
1606
|
+
for (const ce of p)
|
|
1607
|
+
b.ctrlClick(te, ce);
|
|
1608
|
+
(mt = (_e = A.current).onSelectionChange) == null || mt.call(_e, b.getSelection()), (Xt = N.current) == null || Xt.markDirty("overlay"), ee(`${s.length * p.length} cells selected`);
|
|
1599
1609
|
}
|
|
1600
1610
|
break;
|
|
1601
1611
|
case "Home": {
|
|
1602
1612
|
i.preventDefault();
|
|
1603
|
-
const
|
|
1604
|
-
if (
|
|
1605
|
-
|
|
1613
|
+
const te = y ? s.indexOf(y.rowId) : 0;
|
|
1614
|
+
if (L)
|
|
1615
|
+
b.click(s[0], p[0], s, p), (Et = (Pt = A.current).onSelectionChange) == null || Et.call(Pt, b.getSelection()), (Lt = N.current) == null || Lt.markDirty("overlay"), U(0, 0);
|
|
1606
1616
|
else {
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1617
|
+
const ce = te === -1 ? 0 : te;
|
|
1618
|
+
b.click(s[ce], p[0], s, p), (At = (Ot = A.current).onSelectionChange) == null || At.call(Ot, b.getSelection()), (zt = N.current) == null || zt.markDirty("overlay"), U(ce, 0);
|
|
1609
1619
|
}
|
|
1610
1620
|
break;
|
|
1611
1621
|
}
|
|
1612
1622
|
case "End": {
|
|
1613
1623
|
i.preventDefault();
|
|
1614
|
-
const
|
|
1615
|
-
if (
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1624
|
+
const te = y ? s.indexOf(y.rowId) : 0;
|
|
1625
|
+
if (L) {
|
|
1626
|
+
const ce = s.length - 1, de = p.length - 1;
|
|
1627
|
+
b.click(s[ce], p[de], s, p), (Vt = (Yt = A.current).onSelectionChange) == null || Vt.call(Yt, b.getSelection()), (Bt = N.current) == null || Bt.markDirty("overlay"), U(ce, de);
|
|
1618
1628
|
} else {
|
|
1619
|
-
const
|
|
1620
|
-
|
|
1629
|
+
const ce = te === -1 ? 0 : te, de = p.length - 1;
|
|
1630
|
+
b.click(s[ce], p[de], s, p), ($t = (Gt = A.current).onSelectionChange) == null || $t.call(Gt, b.getSelection()), (Ft = N.current) == null || Ft.markDirty("overlay"), U(ce, de);
|
|
1621
1631
|
}
|
|
1622
1632
|
break;
|
|
1623
1633
|
}
|
|
1624
1634
|
}
|
|
1625
1635
|
}, []);
|
|
1626
|
-
|
|
1636
|
+
xn(o, () => ({
|
|
1627
1637
|
captureToCanvas(i) {
|
|
1628
|
-
const
|
|
1629
|
-
if (!
|
|
1638
|
+
const f = ye.current;
|
|
1639
|
+
if (!f)
|
|
1630
1640
|
throw new Error("CanvasGrid: engines not initialized");
|
|
1631
|
-
const { treeEngine: C, columnEngine:
|
|
1632
|
-
return
|
|
1641
|
+
const { treeEngine: C, columnEngine: I, selectionEngine: b } = f, w = A.current, s = w.rowHeight ?? Zt, p = w.sidebarWidth ?? jt;
|
|
1642
|
+
return Gn({
|
|
1633
1643
|
treeEngine: C,
|
|
1634
|
-
columnEngine:
|
|
1635
|
-
selectionEngine:
|
|
1636
|
-
columnGroups:
|
|
1644
|
+
columnEngine: I,
|
|
1645
|
+
selectionEngine: b,
|
|
1646
|
+
columnGroups: w.columnGroups,
|
|
1637
1647
|
rowHeight: s,
|
|
1638
|
-
sidebarWidth:
|
|
1639
|
-
headerOrientation:
|
|
1640
|
-
columnHeaderHeight:
|
|
1641
|
-
gridLayerConfig: { rowStyle:
|
|
1648
|
+
sidebarWidth: p,
|
|
1649
|
+
headerOrientation: w.headerOrientation ?? "horizontal",
|
|
1650
|
+
columnHeaderHeight: w.columnHeaderHeight,
|
|
1651
|
+
gridLayerConfig: { rowStyle: w.rowStyle },
|
|
1642
1652
|
cellLayerConfig: {
|
|
1643
|
-
cellRenderer:
|
|
1644
|
-
getCellData:
|
|
1653
|
+
cellRenderer: w.cellRenderer,
|
|
1654
|
+
getCellData: w.getCellData,
|
|
1645
1655
|
hoveredCell: null
|
|
1646
1656
|
},
|
|
1647
1657
|
scale: (i == null ? void 0 : i.scale) ?? 2,
|
|
@@ -1650,40 +1660,40 @@ const Gn = wn(
|
|
|
1650
1660
|
},
|
|
1651
1661
|
getRowCount() {
|
|
1652
1662
|
var i;
|
|
1653
|
-
return ((i =
|
|
1663
|
+
return ((i = ye.current) == null ? void 0 : i.treeEngine.flattenedRows.length) ?? 0;
|
|
1654
1664
|
}
|
|
1655
1665
|
}), []);
|
|
1656
|
-
const
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
),
|
|
1661
|
-
|
|
1662
|
-
Math.max(
|
|
1663
|
-
),
|
|
1664
|
-
|
|
1666
|
+
const gn = c != null && c.length > 0, It = Qt(
|
|
1667
|
+
O ?? "horizontal",
|
|
1668
|
+
gn,
|
|
1669
|
+
H
|
|
1670
|
+
), pn = Fe + fe.getTotalWidth() + 2, mn = It + Ve.flattenedRows.length * W + 2, Be = 12, St = 24, nt = le || Te, Mt = Ve.flattenedRows.length * W, wn = fe.getTotalWidth(), ft = fe.getPinnedWidth(), ot = Math.max(0, Mt - Q.height), _t = wn - ft, ut = Math.max(0, Q.width - ft), it = Math.max(0, _t - ut), kt = 2, Tt = ot > kt && Q.height > 0, Ht = it > kt && Q.width > 0, Ke = Q.height - (Ht ? Be : 0), gt = Math.min(
|
|
1671
|
+
Ke,
|
|
1672
|
+
Math.max(St, Ke * (Q.height / Mt))
|
|
1673
|
+
), bn = ot > 0 ? E / ot * (Ke - gt) : 0, Ue = ut - (Tt ? Be : 0), pt = Math.min(
|
|
1674
|
+
Ue,
|
|
1665
1675
|
Math.max(
|
|
1666
|
-
|
|
1667
|
-
|
|
1676
|
+
St,
|
|
1677
|
+
Ue * (ut / _t)
|
|
1668
1678
|
)
|
|
1669
|
-
),
|
|
1670
|
-
return /* @__PURE__ */
|
|
1679
|
+
), vn = it > 0 ? Y / it * (Ue - pt) : 0;
|
|
1680
|
+
return /* @__PURE__ */ ve(
|
|
1671
1681
|
"div",
|
|
1672
1682
|
{
|
|
1673
|
-
ref:
|
|
1683
|
+
ref: ze,
|
|
1674
1684
|
tabIndex: 0,
|
|
1675
1685
|
role: "grid",
|
|
1676
|
-
"aria-label":
|
|
1677
|
-
"aria-rowcount":
|
|
1678
|
-
"aria-colcount":
|
|
1679
|
-
onKeyDown:
|
|
1686
|
+
"aria-label": Pe,
|
|
1687
|
+
"aria-rowcount": Ve.flattenedRows.length,
|
|
1688
|
+
"aria-colcount": fe.getVisibleColumns().length,
|
|
1689
|
+
onKeyDown: un,
|
|
1680
1690
|
style: {
|
|
1681
1691
|
display: "flex",
|
|
1682
1692
|
flexDirection: "column",
|
|
1683
|
-
width:
|
|
1684
|
-
height:
|
|
1693
|
+
width: pn,
|
|
1694
|
+
height: mn,
|
|
1685
1695
|
maxWidth: "100%",
|
|
1686
|
-
maxHeight:
|
|
1696
|
+
maxHeight: M ?? "100%",
|
|
1687
1697
|
overflow: "hidden",
|
|
1688
1698
|
fontFamily: "system-ui, sans-serif",
|
|
1689
1699
|
outline: "none",
|
|
@@ -1691,12 +1701,12 @@ const Gn = wn(
|
|
|
1691
1701
|
borderRadius: 4
|
|
1692
1702
|
},
|
|
1693
1703
|
children: [
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
!
|
|
1704
|
+
/* @__PURE__ */ ve("div", { style: { display: "flex", flexDirection: "row", height: It, flexShrink: 0 }, children: [
|
|
1705
|
+
!dt && /* @__PURE__ */ T(
|
|
1696
1706
|
"div",
|
|
1697
1707
|
{
|
|
1698
1708
|
style: {
|
|
1699
|
-
width:
|
|
1709
|
+
width: Fe,
|
|
1700
1710
|
flexShrink: 0,
|
|
1701
1711
|
borderRight: "1px solid #e5e7eb",
|
|
1702
1712
|
borderBottom: "1px solid #e5e7eb",
|
|
@@ -1705,113 +1715,114 @@ const Gn = wn(
|
|
|
1705
1715
|
flexDirection: "column",
|
|
1706
1716
|
overflow: "hidden"
|
|
1707
1717
|
},
|
|
1708
|
-
children: e.sidebarHeaderRenderer ? /* @__PURE__ */
|
|
1709
|
-
|
|
1718
|
+
children: e.sidebarHeaderRenderer ? /* @__PURE__ */ T("div", { style: { width: "100%", flex: 1 }, children: e.sidebarHeaderRenderer() }) : ge ? /* @__PURE__ */ T("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", flex: 1 }, children: /* @__PURE__ */ T(
|
|
1719
|
+
An,
|
|
1710
1720
|
{
|
|
1711
|
-
columnEngine:
|
|
1712
|
-
onColumnVisibilityChange:
|
|
1721
|
+
columnEngine: fe,
|
|
1722
|
+
onColumnVisibilityChange: fn
|
|
1713
1723
|
}
|
|
1714
1724
|
) }) : null
|
|
1715
1725
|
}
|
|
1716
1726
|
),
|
|
1717
|
-
/* @__PURE__ */
|
|
1718
|
-
|
|
1727
|
+
/* @__PURE__ */ T(
|
|
1728
|
+
On,
|
|
1719
1729
|
{
|
|
1720
|
-
columnEngine:
|
|
1730
|
+
columnEngine: fe,
|
|
1721
1731
|
columnGroups: c,
|
|
1722
|
-
scrollX:
|
|
1723
|
-
orientation:
|
|
1724
|
-
columnHeaderHeight:
|
|
1725
|
-
onColumnClick:
|
|
1726
|
-
onColumnResize: e.onColumnResize !== void 0 ?
|
|
1727
|
-
onColumnReorder: e.onColumnReorder !== void 0 ?
|
|
1732
|
+
scrollX: Y,
|
|
1733
|
+
orientation: O,
|
|
1734
|
+
columnHeaderHeight: H,
|
|
1735
|
+
onColumnClick: u ? dn : void 0,
|
|
1736
|
+
onColumnResize: e.onColumnResize !== void 0 ? an : void 0,
|
|
1737
|
+
onColumnReorder: e.onColumnReorder !== void 0 ? hn : void 0,
|
|
1728
1738
|
onColumnFilterClick: e.onColumnFilterClick,
|
|
1739
|
+
selectedColId: ((Dt = (Wt = e.selection) == null ? void 0 : Wt.anchor) == null ? void 0 : Dt.colId) ?? null,
|
|
1729
1740
|
columnHeaderRenderer: e.columnHeaderRenderer
|
|
1730
1741
|
}
|
|
1731
1742
|
)
|
|
1732
1743
|
] }),
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
!
|
|
1735
|
-
|
|
1744
|
+
/* @__PURE__ */ ve("div", { style: { display: "flex", flexDirection: "row", flex: 1, overflow: "hidden" }, children: [
|
|
1745
|
+
!dt && /* @__PURE__ */ T(
|
|
1746
|
+
Wn,
|
|
1736
1747
|
{
|
|
1737
|
-
treeEngine:
|
|
1738
|
-
width:
|
|
1748
|
+
treeEngine: Ve,
|
|
1749
|
+
width: Fe,
|
|
1739
1750
|
rowHeight: W,
|
|
1740
|
-
scrollTop:
|
|
1741
|
-
viewportHeight:
|
|
1742
|
-
sidebarRenderer:
|
|
1743
|
-
onToggle:
|
|
1744
|
-
onRowClick: e.onRowHeaderClick ? (i,
|
|
1745
|
-
hoveredRowId:
|
|
1751
|
+
scrollTop: E,
|
|
1752
|
+
viewportHeight: he.current.canvasHeight || 600,
|
|
1753
|
+
sidebarRenderer: g,
|
|
1754
|
+
onToggle: ht,
|
|
1755
|
+
onRowClick: e.onRowHeaderClick ? (i, f) => e.onRowHeaderClick(i, f.nativeEvent) : void 0,
|
|
1756
|
+
hoveredRowId: oe,
|
|
1746
1757
|
onRowHover: (i) => {
|
|
1747
|
-
var
|
|
1748
|
-
|
|
1758
|
+
var f;
|
|
1759
|
+
me.current = i, Me(i), (f = N.current) == null || f.markDirty("overlay");
|
|
1749
1760
|
}
|
|
1750
1761
|
}
|
|
1751
1762
|
),
|
|
1752
|
-
/* @__PURE__ */
|
|
1763
|
+
/* @__PURE__ */ ve(
|
|
1753
1764
|
"div",
|
|
1754
1765
|
{
|
|
1755
1766
|
style: { flex: 1, position: "relative", overflow: "hidden" },
|
|
1756
|
-
onMouseEnter: () =>
|
|
1757
|
-
onMouseLeave: () =>
|
|
1767
|
+
onMouseEnter: () => Ce(!0),
|
|
1768
|
+
onMouseLeave: () => Ce(!1),
|
|
1758
1769
|
children: [
|
|
1759
|
-
/* @__PURE__ */
|
|
1770
|
+
/* @__PURE__ */ T(
|
|
1760
1771
|
"canvas",
|
|
1761
1772
|
{
|
|
1762
1773
|
ref: (i) => {
|
|
1763
|
-
i && (
|
|
1774
|
+
i && (He.current[0] = i);
|
|
1764
1775
|
},
|
|
1765
1776
|
style: { position: "absolute", top: 0, left: 0, zIndex: 0 }
|
|
1766
1777
|
}
|
|
1767
1778
|
),
|
|
1768
|
-
/* @__PURE__ */
|
|
1779
|
+
/* @__PURE__ */ T(
|
|
1769
1780
|
"canvas",
|
|
1770
1781
|
{
|
|
1771
1782
|
ref: (i) => {
|
|
1772
|
-
i && (
|
|
1783
|
+
i && (He.current[1] = i);
|
|
1773
1784
|
},
|
|
1774
1785
|
style: { position: "absolute", top: 0, left: 0, zIndex: 1 }
|
|
1775
1786
|
}
|
|
1776
1787
|
),
|
|
1777
|
-
/* @__PURE__ */
|
|
1788
|
+
/* @__PURE__ */ T(
|
|
1778
1789
|
"canvas",
|
|
1779
1790
|
{
|
|
1780
1791
|
ref: (i) => {
|
|
1781
|
-
i && (
|
|
1792
|
+
i && (He.current[2] = i);
|
|
1782
1793
|
},
|
|
1783
1794
|
style: { position: "absolute", top: 0, left: 0, zIndex: 2 },
|
|
1784
|
-
onPointerMove:
|
|
1785
|
-
onPointerDown:
|
|
1786
|
-
onDoubleClick:
|
|
1787
|
-
onContextMenu:
|
|
1788
|
-
onPointerLeave:
|
|
1795
|
+
onPointerMove: on,
|
|
1796
|
+
onPointerDown: ln,
|
|
1797
|
+
onDoubleClick: sn,
|
|
1798
|
+
onContextMenu: rn,
|
|
1799
|
+
onPointerLeave: cn
|
|
1789
1800
|
}
|
|
1790
1801
|
),
|
|
1791
|
-
|
|
1802
|
+
Tt && /* @__PURE__ */ T(
|
|
1792
1803
|
"div",
|
|
1793
1804
|
{
|
|
1794
1805
|
style: {
|
|
1795
1806
|
position: "absolute",
|
|
1796
1807
|
top: 0,
|
|
1797
1808
|
right: 0,
|
|
1798
|
-
width:
|
|
1799
|
-
height:
|
|
1809
|
+
width: Be,
|
|
1810
|
+
height: Ke,
|
|
1800
1811
|
zIndex: 3,
|
|
1801
|
-
opacity:
|
|
1812
|
+
opacity: nt ? 1 : 0,
|
|
1802
1813
|
transition: "opacity 150ms ease",
|
|
1803
|
-
pointerEvents:
|
|
1814
|
+
pointerEvents: nt ? "auto" : "none"
|
|
1804
1815
|
},
|
|
1805
|
-
children: /* @__PURE__ */
|
|
1816
|
+
children: /* @__PURE__ */ T(
|
|
1806
1817
|
"div",
|
|
1807
1818
|
{
|
|
1808
|
-
onMouseDown: (i) =>
|
|
1819
|
+
onMouseDown: (i) => Rt("y", i, Ke - gt, ot),
|
|
1809
1820
|
style: {
|
|
1810
1821
|
position: "absolute",
|
|
1811
|
-
top:
|
|
1822
|
+
top: bn,
|
|
1812
1823
|
left: 2,
|
|
1813
|
-
width:
|
|
1814
|
-
height:
|
|
1824
|
+
width: Be - 4,
|
|
1825
|
+
height: gt,
|
|
1815
1826
|
borderRadius: 8,
|
|
1816
1827
|
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
1817
1828
|
cursor: "pointer"
|
|
@@ -1820,30 +1831,30 @@ const Gn = wn(
|
|
|
1820
1831
|
)
|
|
1821
1832
|
}
|
|
1822
1833
|
),
|
|
1823
|
-
|
|
1834
|
+
Ht && /* @__PURE__ */ T(
|
|
1824
1835
|
"div",
|
|
1825
1836
|
{
|
|
1826
1837
|
style: {
|
|
1827
1838
|
position: "absolute",
|
|
1828
1839
|
bottom: 0,
|
|
1829
|
-
left:
|
|
1830
|
-
height:
|
|
1831
|
-
width:
|
|
1840
|
+
left: ft,
|
|
1841
|
+
height: Be,
|
|
1842
|
+
width: Ue,
|
|
1832
1843
|
zIndex: 3,
|
|
1833
|
-
opacity:
|
|
1844
|
+
opacity: nt ? 1 : 0,
|
|
1834
1845
|
transition: "opacity 150ms ease",
|
|
1835
|
-
pointerEvents:
|
|
1846
|
+
pointerEvents: nt ? "auto" : "none"
|
|
1836
1847
|
},
|
|
1837
|
-
children: /* @__PURE__ */
|
|
1848
|
+
children: /* @__PURE__ */ T(
|
|
1838
1849
|
"div",
|
|
1839
1850
|
{
|
|
1840
|
-
onMouseDown: (i) =>
|
|
1851
|
+
onMouseDown: (i) => Rt("x", i, Ue - pt, it),
|
|
1841
1852
|
style: {
|
|
1842
1853
|
position: "absolute",
|
|
1843
|
-
left:
|
|
1854
|
+
left: vn,
|
|
1844
1855
|
top: 2,
|
|
1845
|
-
height:
|
|
1846
|
-
width:
|
|
1856
|
+
height: Be - 4,
|
|
1857
|
+
width: pt,
|
|
1847
1858
|
borderRadius: 8,
|
|
1848
1859
|
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
1849
1860
|
cursor: "pointer"
|
|
@@ -1856,18 +1867,18 @@ const Gn = wn(
|
|
|
1856
1867
|
}
|
|
1857
1868
|
)
|
|
1858
1869
|
] }),
|
|
1859
|
-
l != null &&
|
|
1860
|
-
/* @__PURE__ */
|
|
1870
|
+
l != null && q != null && /* @__PURE__ */ T(zn, { content: l, position: q }),
|
|
1871
|
+
/* @__PURE__ */ T(Yn, { message: Se })
|
|
1861
1872
|
]
|
|
1862
1873
|
}
|
|
1863
1874
|
);
|
|
1864
1875
|
})
|
|
1865
1876
|
);
|
|
1866
1877
|
export {
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1878
|
+
Nn as CanvasGrid,
|
|
1879
|
+
Ae as ColumnEngine,
|
|
1880
|
+
_n as SelectionEngine,
|
|
1881
|
+
Sn as TreeEngine,
|
|
1882
|
+
en as ViewState,
|
|
1883
|
+
Tn as createDrawHelpers
|
|
1873
1884
|
};
|