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