@ishibashi0112/spreadsheet-grid 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API_REFERENCE.md +98 -28
- package/README.md +2 -2
- package/dist/GridShell.d.ts +1 -1
- package/dist/common.d.ts +1 -1
- package/dist/features/columnGroups.d.ts +2 -0
- package/dist/features/types.d.ts +18 -1
- package/dist/hooks/useColumnHeaderDragController.d.ts +1 -0
- package/dist/hooks/useGridBarContext.d.ts +2 -1
- package/dist/hooks/useGridPointerInteractions.d.ts +1 -0
- package/dist/hooks/useGridStore.d.ts +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +2695 -2363
- package/dist/lite/columnGroups-BO3v8R95.cjs +1 -0
- package/dist/lite/columnGroups-DQYKLqYn.js +186 -0
- package/dist/lite/{columnMenu-B_8gLraV.js → columnMenu-CpfckJa8.js} +84 -67
- package/dist/lite/columnMenu-DcjRobOG.cjs +1 -0
- package/dist/lite/{columnReorder-ka-NXl7f.js → columnReorder-DQZrQIYo.js} +4 -2
- package/dist/lite/columnReorder-Dp3-n6UT.cjs +1 -0
- package/dist/lite/createSpreadsheetGrid-CvNJLEhA.js +4536 -0
- package/dist/lite/createSpreadsheetGrid-iAPCKb03.cjs +6 -0
- package/dist/lite/createSpreadsheetGrid.cjs +1 -1
- package/dist/lite/createSpreadsheetGrid.js +1 -1
- package/dist/lite/features/columnGroups.cjs +1 -0
- package/dist/lite/features/columnGroups.js +2 -0
- package/dist/lite/features/columnMenu.cjs +1 -1
- package/dist/lite/features/columnMenu.js +1 -1
- package/dist/lite/features/columnReorder.cjs +1 -1
- package/dist/lite/features/columnReorder.js +1 -1
- package/dist/lite/features/filtering.cjs +1 -1
- package/dist/lite/features/filtering.js +1 -1
- package/dist/lite/features/standard.cjs +1 -1
- package/dist/lite/features/standard.js +3 -3
- package/dist/lite/features/toolPanel.cjs +1 -1
- package/dist/lite/features/toolPanel.js +1 -1
- package/dist/lite/filtering-BTAXzOAK.cjs +1 -0
- package/dist/lite/{filtering-BGPDN-wq.js → filtering-c1X_zP3o.js} +85 -83
- package/dist/lite/{lazyPopups-Czv43vuQ.cjs → lazyPopups-B1nKq4RV.cjs} +1 -1
- package/dist/lite/{lazyPopups-CeNdPYJh.js → lazyPopups-DV5yAqW8.js} +1 -1
- package/dist/lite/{toolPanel-CsBenuFQ.js → toolPanel-B1e18z68.js} +1 -1
- package/dist/lite/{toolPanel-BVq7WR1O.cjs → toolPanel-DQlOiytT.cjs} +1 -1
- package/dist/lite/{toolPanelViews-uCxtFwWO.js → toolPanelViews-PPO_KXMP.js} +159 -93
- package/dist/lite/toolPanelViews-WFJ3Pyv_.cjs +1 -0
- package/dist/lite.cjs +1 -1
- package/dist/lite.d.ts +1 -0
- package/dist/lite.js +20 -19
- package/dist/model/gridTypes.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/toolPanelViews-BAy-NXrx.cjs +1 -0
- package/dist/{toolPanelViews-Dsp5WVVa.js → toolPanelViews-Biz2p7sx.js} +159 -93
- package/dist/view/ColumnChooserPanel.d.ts +8 -1
- package/dist/view/ColumnMenuPopover.d.ts +7 -1
- package/dist/view/GridColumnGroupHeader.d.ts +41 -0
- package/dist/view/GridHeaderRow.d.ts +5 -1
- package/package.json +2 -2
- package/skills/spreadsheet-grid/SKILL.md +3 -2
- package/dist/lite/columnMenu-CBAvHYIy.cjs +0 -1
- package/dist/lite/columnReorder-CDG4Ngmm.cjs +0 -1
- package/dist/lite/createSpreadsheetGrid-CIhJGtmx.cjs +0 -6
- package/dist/lite/createSpreadsheetGrid-hzP2_i0i.js +0 -4395
- package/dist/lite/filtering-BKaFSWIN.cjs +0 -1
- package/dist/lite/toolPanelViews-8HccPGgN.cjs +0 -1
- package/dist/toolPanelViews-BJi7W0Tz.cjs +0 -1
|
@@ -284,16 +284,43 @@ function w({ entries: e, addableColumns: t, showGlobalFilterRow: r, globalFilter
|
|
|
284
284
|
}
|
|
285
285
|
//#endregion
|
|
286
286
|
//#region src/view/ColumnChooserPanel.tsx
|
|
287
|
-
|
|
287
|
+
function T(e) {
|
|
288
|
+
let t = [], n = [];
|
|
289
|
+
return e.forEach((e, r) => {
|
|
290
|
+
let i = e.groups ?? [], a = 0;
|
|
291
|
+
for (; a < n.length && a < i.length && n[a]?.key === i[a]?.key;) a += 1;
|
|
292
|
+
n.length = a;
|
|
293
|
+
for (let e = a; e < i.length; e += 1) {
|
|
294
|
+
let a = i[e];
|
|
295
|
+
if (a === void 0) break;
|
|
296
|
+
let o = {
|
|
297
|
+
kind: "group",
|
|
298
|
+
id: `${a.key}@${r}`,
|
|
299
|
+
key: a.key,
|
|
300
|
+
title: a.title,
|
|
301
|
+
children: [],
|
|
302
|
+
items: []
|
|
303
|
+
};
|
|
304
|
+
(n[e - 1]?.children ?? t).push(o), n.push(o);
|
|
305
|
+
}
|
|
306
|
+
(n[n.length - 1]?.children ?? t).push({
|
|
307
|
+
kind: "item",
|
|
308
|
+
item: e,
|
|
309
|
+
indexInPane: r
|
|
310
|
+
});
|
|
311
|
+
for (let t of n) t.items.push(e);
|
|
312
|
+
}), t;
|
|
313
|
+
}
|
|
314
|
+
var E = 28, D = 12, O = [
|
|
288
315
|
"left",
|
|
289
316
|
"center",
|
|
290
317
|
"right"
|
|
291
|
-
],
|
|
318
|
+
], k = {
|
|
292
319
|
left: "columnsPinnedLeft",
|
|
293
320
|
center: "columnsUnpinned",
|
|
294
321
|
right: "columnsPinnedRight"
|
|
295
322
|
};
|
|
296
|
-
function
|
|
323
|
+
function A(e, t, n) {
|
|
297
324
|
let r = e.find((e) => e.key === t);
|
|
298
325
|
if (!r) return null;
|
|
299
326
|
let i = r.pane, a = {
|
|
@@ -313,7 +340,7 @@ function k(e, t, n) {
|
|
|
313
340
|
...a.right
|
|
314
341
|
];
|
|
315
342
|
}
|
|
316
|
-
function
|
|
343
|
+
function j({ state: e, disabled: t }) {
|
|
317
344
|
return /* @__PURE__ */ h("span", {
|
|
318
345
|
className: l("ssg-checkbox", (e === "checked" || e === "indeterminate") && "ssg-checkbox--filled", t && "ssg-checkbox--disabled"),
|
|
319
346
|
"aria-hidden": !0,
|
|
@@ -332,7 +359,7 @@ function A({ state: e, disabled: t }) {
|
|
|
332
359
|
}), e === "indeterminate" && /* @__PURE__ */ m("span", { className: "ssg-checkbox-dash" })]
|
|
333
360
|
});
|
|
334
361
|
}
|
|
335
|
-
function
|
|
362
|
+
function M({ disabled: e }) {
|
|
336
363
|
return /* @__PURE__ */ m("svg", {
|
|
337
364
|
width: "10",
|
|
338
365
|
height: "16",
|
|
@@ -350,34 +377,35 @@ function j({ disabled: e }) {
|
|
|
350
377
|
}, `${t}-${e}`)))
|
|
351
378
|
});
|
|
352
379
|
}
|
|
353
|
-
function
|
|
354
|
-
let
|
|
380
|
+
function N({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColumns: u, onHideAllColumns: d, onResetColumns: g, onReorderColumns: v, onToggleColumnsVisibility: y, clampDropIndex: b }) {
|
|
381
|
+
let x = n(), [S, C] = c(""), w = s(null), [N] = c(() => typeof document < "u" && _()?.closest(".ssg-toolpanel") != null);
|
|
355
382
|
i(() => {
|
|
356
|
-
let e =
|
|
357
|
-
if (!e || !
|
|
383
|
+
let e = w.current;
|
|
384
|
+
if (!e || !N || typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches) return;
|
|
358
385
|
let t = requestAnimationFrame(() => {
|
|
359
386
|
e.focus();
|
|
360
387
|
});
|
|
361
388
|
return () => cancelAnimationFrame(t);
|
|
362
|
-
}, [
|
|
363
|
-
let
|
|
364
|
-
let t =
|
|
365
|
-
return t ? e.filter((e) => e.title.toLowerCase().includes(t)) : e;
|
|
366
|
-
}, [e,
|
|
389
|
+
}, [N]);
|
|
390
|
+
let P = o(() => e.filter((e) => e.grouped !== !0).length, [e]), F = o(() => e.filter((e) => e.visible && e.grouped !== !0).length, [e]), I = F === P && P > 0, L = I ? "checked" : "indeterminate", ee = I ? x.columnsHideAll : x.columnsShowAll, R = o(() => {
|
|
391
|
+
let t = S.trim().toLowerCase();
|
|
392
|
+
return t ? e.filter((e) => e.title.toLowerCase().includes(t) || (e.groups?.some((e) => e.title.toLowerCase().includes(t)) ?? !1)) : e;
|
|
393
|
+
}, [e, S]), z = o(() => {
|
|
367
394
|
let e = {
|
|
368
395
|
left: [],
|
|
369
396
|
center: [],
|
|
370
397
|
right: []
|
|
371
398
|
};
|
|
372
|
-
for (let t of
|
|
373
|
-
return
|
|
399
|
+
for (let t of R) e[t.pane].push(t);
|
|
400
|
+
return O.map((t) => ({
|
|
374
401
|
pane: t,
|
|
375
|
-
items: e[t]
|
|
402
|
+
items: e[t],
|
|
403
|
+
nodes: T(e[t])
|
|
376
404
|
})).filter((e) => e.items.length > 0);
|
|
377
|
-
}, [
|
|
378
|
-
let e =
|
|
405
|
+
}, [R]), te = z.length >= 2, B = t && S.trim() === "", V = s(null), [H, U] = c(null), W = s(!1), G = s(null), K = s(null), [q, J] = c(null), Y = s(0), X = s(null), Z = r(() => {
|
|
406
|
+
let e = V.current, t = K.current;
|
|
379
407
|
if (!e || !t) return;
|
|
380
|
-
let n = e.querySelectorAll(`[data-chooser-row][data-chooser-pane="${t}"]`), r =
|
|
408
|
+
let n = e.querySelectorAll(`[data-chooser-row][data-chooser-pane="${t}"]`), r = Y.current, i = n.length;
|
|
381
409
|
for (let e = 0; e < n.length; e += 1) {
|
|
382
410
|
let t = n[e].getBoundingClientRect();
|
|
383
411
|
if (r < t.top + t.height / 2) {
|
|
@@ -385,96 +413,134 @@ function M({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColum
|
|
|
385
413
|
break;
|
|
386
414
|
}
|
|
387
415
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
416
|
+
let a = G.current;
|
|
417
|
+
J(b && a !== null ? b(a, t, i) : i);
|
|
418
|
+
}, [b]), Q = r(function e() {
|
|
419
|
+
let t = V.current;
|
|
420
|
+
if (!t || !W.current) {
|
|
421
|
+
X.current = null;
|
|
393
422
|
return;
|
|
394
423
|
}
|
|
395
|
-
let n = t.getBoundingClientRect(), r =
|
|
396
|
-
if (r < n.top +
|
|
424
|
+
let n = t.getBoundingClientRect(), r = Y.current, i = 0;
|
|
425
|
+
if (r < n.top + E ? i = -12 : r > n.bottom - E && (i = D), i !== 0) {
|
|
397
426
|
let e = t.scrollTop;
|
|
398
|
-
t.scrollTop += i, t.scrollTop !== e &&
|
|
427
|
+
t.scrollTop += i, t.scrollTop !== e && Z();
|
|
399
428
|
}
|
|
400
|
-
|
|
401
|
-
}, [
|
|
402
|
-
|
|
403
|
-
let n =
|
|
404
|
-
if (
|
|
405
|
-
let t =
|
|
429
|
+
X.current = requestAnimationFrame(e);
|
|
430
|
+
}, [Z]), $ = r((t) => {
|
|
431
|
+
X.current !== null && (cancelAnimationFrame(X.current), X.current = null);
|
|
432
|
+
let n = H, r = q;
|
|
433
|
+
if (W.current = !1, K.current = null, G.current = null, U(null), J(null), t && n !== null && r !== null) {
|
|
434
|
+
let t = A(e, n, r);
|
|
406
435
|
t && v(t);
|
|
407
436
|
}
|
|
408
437
|
}, [
|
|
409
|
-
|
|
410
|
-
|
|
438
|
+
H,
|
|
439
|
+
q,
|
|
411
440
|
e,
|
|
412
441
|
v
|
|
413
|
-
]),
|
|
414
|
-
|
|
442
|
+
]), ne = r((e, t, n) => {
|
|
443
|
+
B && (n.preventDefault(), n.stopPropagation(), n.currentTarget.setPointerCapture(n.pointerId), W.current = !0, K.current = t, G.current = e, Y.current = n.clientY, U(e), Z(), X.current === null && (X.current = requestAnimationFrame(Q)));
|
|
415
444
|
}, [
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
]),
|
|
420
|
-
|
|
421
|
-
}, [
|
|
422
|
-
|
|
423
|
-
}, [
|
|
424
|
-
|
|
425
|
-
}, [
|
|
445
|
+
B,
|
|
446
|
+
Z,
|
|
447
|
+
Q
|
|
448
|
+
]), re = r((e) => {
|
|
449
|
+
W.current && (Y.current = e.clientY, Z());
|
|
450
|
+
}, [Z]), ie = r(() => {
|
|
451
|
+
W.current && $(!0);
|
|
452
|
+
}, [$]), ae = r(() => {
|
|
453
|
+
W.current && $(!1);
|
|
454
|
+
}, [$]);
|
|
426
455
|
i(() => () => {
|
|
427
|
-
|
|
456
|
+
X.current !== null && (cancelAnimationFrame(X.current), X.current = null);
|
|
428
457
|
}, []);
|
|
429
|
-
let
|
|
430
|
-
t && (
|
|
431
|
-
},
|
|
432
|
-
let i = e.visible &&
|
|
458
|
+
let oe = () => {
|
|
459
|
+
t && (I ? d() : u());
|
|
460
|
+
}, se = H === null ? null : e.find((e) => e.key === H)?.pane ?? null, ce = (e, n, r) => {
|
|
461
|
+
let i = e.visible && F === 1, o = !t || i || e.grouped === !0, s = H === e.key;
|
|
433
462
|
return /* @__PURE__ */ h("div", {
|
|
434
463
|
"data-chooser-row": "",
|
|
435
464
|
"data-chooser-pane": r,
|
|
436
|
-
className: l("ssg-chooser-row",
|
|
465
|
+
className: l("ssg-chooser-row", H !== null && se === r && q === n && "ssg-chooser-row--drop-before", s && "ssg-chooser-row--dragging"),
|
|
437
466
|
children: [/* @__PURE__ */ m("span", {
|
|
438
467
|
role: "button",
|
|
439
|
-
"aria-label":
|
|
440
|
-
"data-ssg-tooltip": t ?
|
|
441
|
-
onPointerDown: (t) =>
|
|
442
|
-
onPointerMove:
|
|
443
|
-
onPointerUp:
|
|
444
|
-
onPointerCancel:
|
|
445
|
-
className: l("ssg-chooser-handle", !
|
|
446
|
-
children: /* @__PURE__ */ m(
|
|
468
|
+
"aria-label": x.columnsDragToReorder,
|
|
469
|
+
"data-ssg-tooltip": t ? S.trim() === "" ? (e.groups?.length ?? 0) > 0 ? x.columnsDragWithinGroup : x.columnsDragWithinSection : x.columnsReorderWhileSearching : x.columnsReorderUnavailable,
|
|
470
|
+
onPointerDown: (t) => ne(e.key, r, t),
|
|
471
|
+
onPointerMove: re,
|
|
472
|
+
onPointerUp: ie,
|
|
473
|
+
onPointerCancel: ae,
|
|
474
|
+
className: l("ssg-chooser-handle", !B && "ssg-chooser-handle--disabled", s && "ssg-chooser-handle--dragging"),
|
|
475
|
+
children: /* @__PURE__ */ m(M, { disabled: !B })
|
|
447
476
|
}), /* @__PURE__ */ h("button", {
|
|
448
477
|
type: "button",
|
|
449
478
|
disabled: o,
|
|
450
479
|
"aria-pressed": e.visible && !e.grouped,
|
|
451
|
-
"data-ssg-tooltip": e.grouped ?
|
|
480
|
+
"data-ssg-tooltip": e.grouped ? x.columnsGroupedHint : void 0,
|
|
452
481
|
onClick: () => {
|
|
453
482
|
o || a(e.key, !e.visible);
|
|
454
483
|
},
|
|
455
484
|
className: "ssg-chooser-toggle",
|
|
456
|
-
children: [/* @__PURE__ */ m(
|
|
485
|
+
children: [/* @__PURE__ */ m(j, {
|
|
457
486
|
state: e.visible && !e.grouped ? "checked" : "unchecked",
|
|
458
487
|
disabled: o
|
|
459
488
|
}), /* @__PURE__ */ m("span", {
|
|
460
489
|
className: l("ssg-chooser-label", o && (!e.visible || e.grouped) && "ssg-chooser-label--muted"),
|
|
461
|
-
children: e.grouped ? f(
|
|
490
|
+
children: e.grouped ? f(x.groupedColumnTitle, { column: e.title }) : e.title
|
|
462
491
|
})]
|
|
463
492
|
})]
|
|
464
493
|
}, e.key);
|
|
465
|
-
}
|
|
494
|
+
}, le = (e, n) => e.map((e) => {
|
|
495
|
+
if (e.kind === "item") return ce(e.item, e.indexInPane, n);
|
|
496
|
+
let r = e.items.filter((e) => e.grouped !== !0), i = r.filter((e) => e.visible), a = r.length > 0 && i.length === r.length, o = a ? "checked" : i.length > 0 ? "indeterminate" : "unchecked", s;
|
|
497
|
+
a ? (s = i.map((e) => e.key), F - s.length <= 0 && (s = s.slice(1))) : s = r.filter((e) => !e.visible).map((e) => e.key);
|
|
498
|
+
let c = !t || y === void 0 || s.length === 0, u = f(x.columnsToggleGroup, { group: e.title });
|
|
499
|
+
return /* @__PURE__ */ h("div", {
|
|
500
|
+
role: "group",
|
|
501
|
+
"aria-label": e.title,
|
|
502
|
+
className: "ssg-chooser-group",
|
|
503
|
+
"data-chooser-group": e.key,
|
|
504
|
+
children: [/* @__PURE__ */ h("div", {
|
|
505
|
+
className: "ssg-chooser-group-heading",
|
|
506
|
+
children: [/* @__PURE__ */ m("span", {
|
|
507
|
+
"aria-hidden": !0,
|
|
508
|
+
className: "ssg-chooser-group-spacer"
|
|
509
|
+
}), /* @__PURE__ */ h("button", {
|
|
510
|
+
type: "button",
|
|
511
|
+
disabled: c,
|
|
512
|
+
"aria-pressed": o === "checked" ? !0 : o === "indeterminate" ? "mixed" : !1,
|
|
513
|
+
"data-ssg-tooltip": u,
|
|
514
|
+
onClick: () => {
|
|
515
|
+
c || y(s, !a);
|
|
516
|
+
},
|
|
517
|
+
className: "ssg-chooser-toggle",
|
|
518
|
+
children: [/* @__PURE__ */ m(j, {
|
|
519
|
+
state: o,
|
|
520
|
+
disabled: c
|
|
521
|
+
}), /* @__PURE__ */ m("span", {
|
|
522
|
+
className: l("ssg-chooser-label", "ssg-chooser-group-label"),
|
|
523
|
+
children: e.title
|
|
524
|
+
})]
|
|
525
|
+
})]
|
|
526
|
+
}), /* @__PURE__ */ m("div", {
|
|
527
|
+
className: "ssg-chooser-group-items",
|
|
528
|
+
children: le(e.children, n)
|
|
529
|
+
})]
|
|
530
|
+
}, e.id);
|
|
531
|
+
});
|
|
466
532
|
return /* @__PURE__ */ h(p, { children: [
|
|
467
533
|
/* @__PURE__ */ h("div", {
|
|
468
534
|
className: "ssg-chooser-search-row",
|
|
469
535
|
children: [/* @__PURE__ */ m("button", {
|
|
470
536
|
type: "button",
|
|
471
537
|
disabled: !t,
|
|
472
|
-
onClick:
|
|
473
|
-
"aria-label":
|
|
474
|
-
"data-ssg-tooltip":
|
|
538
|
+
onClick: oe,
|
|
539
|
+
"aria-label": ee,
|
|
540
|
+
"data-ssg-tooltip": ee,
|
|
475
541
|
className: "ssg-chooser-master-btn",
|
|
476
|
-
children: /* @__PURE__ */ m(
|
|
477
|
-
state:
|
|
542
|
+
children: /* @__PURE__ */ m(j, {
|
|
543
|
+
state: L,
|
|
478
544
|
disabled: !t
|
|
479
545
|
})
|
|
480
546
|
}), /* @__PURE__ */ h("div", {
|
|
@@ -484,32 +550,32 @@ function M({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColum
|
|
|
484
550
|
className: "ssg-chooser-search-icon",
|
|
485
551
|
children: "⌕"
|
|
486
552
|
}), /* @__PURE__ */ m("input", {
|
|
487
|
-
ref:
|
|
553
|
+
ref: w,
|
|
488
554
|
type: "text",
|
|
489
|
-
value:
|
|
490
|
-
onChange: (e) =>
|
|
491
|
-
placeholder:
|
|
492
|
-
"aria-label":
|
|
555
|
+
value: S,
|
|
556
|
+
onChange: (e) => C(e.target.value),
|
|
557
|
+
placeholder: x.columnsSearchPlaceholder,
|
|
558
|
+
"aria-label": x.columnsSearchPlaceholder,
|
|
493
559
|
className: "ssg-chooser-search-input"
|
|
494
560
|
})]
|
|
495
561
|
})]
|
|
496
562
|
}),
|
|
497
563
|
/* @__PURE__ */ m("div", {
|
|
498
|
-
ref:
|
|
564
|
+
ref: V,
|
|
499
565
|
className: "ssg-chooser-list",
|
|
500
566
|
tabIndex: t ? void 0 : 0,
|
|
501
|
-
children:
|
|
567
|
+
children: R.length === 0 ? /* @__PURE__ */ m("div", {
|
|
502
568
|
className: "ssg-chooser-empty",
|
|
503
|
-
children:
|
|
504
|
-
}) :
|
|
569
|
+
children: x.columnsNoMatches
|
|
570
|
+
}) : z.map((e) => /* @__PURE__ */ h("div", {
|
|
505
571
|
"data-chooser-section": e.pane,
|
|
506
572
|
children: [
|
|
507
|
-
|
|
573
|
+
te && /* @__PURE__ */ m("div", {
|
|
508
574
|
className: "ssg-chooser-section-heading",
|
|
509
|
-
children:
|
|
575
|
+
children: x[k[e.pane]]
|
|
510
576
|
}),
|
|
511
|
-
e.
|
|
512
|
-
|
|
577
|
+
le(e.nodes, e.pane),
|
|
578
|
+
H !== null && se === e.pane && q === e.items.length && /* @__PURE__ */ m("div", { className: "ssg-chooser-drop-end" })
|
|
513
579
|
]
|
|
514
580
|
}, e.pane))
|
|
515
581
|
}),
|
|
@@ -521,19 +587,19 @@ function M({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColum
|
|
|
521
587
|
onClick: () => {
|
|
522
588
|
t && g();
|
|
523
589
|
},
|
|
524
|
-
"data-ssg-tooltip":
|
|
590
|
+
"data-ssg-tooltip": x.resetColumnsHint,
|
|
525
591
|
className: "ssg-chooser-reset-btn",
|
|
526
|
-
children:
|
|
592
|
+
children: x.columnsReset
|
|
527
593
|
}), !t && /* @__PURE__ */ m("div", {
|
|
528
594
|
className: "ssg-chooser-note",
|
|
529
|
-
children:
|
|
595
|
+
children: x.columnsUnavailable
|
|
530
596
|
})]
|
|
531
597
|
})
|
|
532
598
|
] });
|
|
533
599
|
}
|
|
534
600
|
//#endregion
|
|
535
601
|
//#region src/view/SortManagementPanel.tsx
|
|
536
|
-
function
|
|
602
|
+
function P({ disabled: e }) {
|
|
537
603
|
return /* @__PURE__ */ m("svg", {
|
|
538
604
|
width: "10",
|
|
539
605
|
height: "16",
|
|
@@ -551,7 +617,7 @@ function N({ disabled: e }) {
|
|
|
551
617
|
}, `${t}-${e}`)))
|
|
552
618
|
});
|
|
553
619
|
}
|
|
554
|
-
function
|
|
620
|
+
function F({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirection: u, onChangeColumn: d, onRemoveLevel: f, onClearAll: g, onMove: _ }) {
|
|
555
621
|
let v = n(), y = o(() => new Set(e.map((e) => e.columnKey)), [e]), b = o(() => t.find((e) => !y.has(e.key)) ?? null, [t, y]), x = (e) => t.find((t) => t.key === e)?.title || e, S = i && e.length >= 2, C = s(null), [w, T] = c(null), E = s(!1), [D, O] = c(null), k = s(0), A = r(() => {
|
|
556
622
|
let e = C.current;
|
|
557
623
|
if (!e) return;
|
|
@@ -576,7 +642,7 @@ function P({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirectio
|
|
|
576
642
|
_
|
|
577
643
|
]), M = r((e, t) => {
|
|
578
644
|
S && (t.preventDefault(), t.stopPropagation(), t.currentTarget.setPointerCapture(t.pointerId), E.current = !0, k.current = t.clientY, T(e), A());
|
|
579
|
-
}, [S, A]),
|
|
645
|
+
}, [S, A]), N = r((e) => {
|
|
580
646
|
E.current && (k.current = e.clientY, A());
|
|
581
647
|
}, [A]), F = r(() => {
|
|
582
648
|
E.current && j(!0);
|
|
@@ -604,11 +670,11 @@ function P({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirectio
|
|
|
604
670
|
"aria-label": v.sortPanelDrag,
|
|
605
671
|
"data-ssg-tooltip": i ? e.length < 2 ? v.sortPanelNeedsTwo : v.sortPanelDrag : v.sortPanelDisabled,
|
|
606
672
|
onPointerDown: (e) => M(r, e),
|
|
607
|
-
onPointerMove:
|
|
673
|
+
onPointerMove: N,
|
|
608
674
|
onPointerUp: F,
|
|
609
675
|
onPointerCancel: I,
|
|
610
676
|
className: l("ssg-sort-handle", !S && "ssg-sort-handle--disabled", s && "ssg-sort-handle--dragging"),
|
|
611
|
-
children: /* @__PURE__ */ m(
|
|
677
|
+
children: /* @__PURE__ */ m(P, { disabled: !S })
|
|
612
678
|
}),
|
|
613
679
|
/* @__PURE__ */ m("span", {
|
|
614
680
|
"aria-hidden": !0,
|
|
@@ -687,4 +753,4 @@ function P({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirectio
|
|
|
687
753
|
] });
|
|
688
754
|
}
|
|
689
755
|
//#endregion
|
|
690
|
-
export {
|
|
756
|
+
export { N as ColumnChooserPanel, w as FilterManagementPanel, F as SortManagementPanel, x as ToolPanel };
|
|
@@ -5,6 +5,11 @@ export type ColumnChooserItem = {
|
|
|
5
5
|
visible: boolean;
|
|
6
6
|
pane: ColumnPane;
|
|
7
7
|
grouped?: boolean;
|
|
8
|
+
groups?: readonly ColumnChooserGroupRef[] | undefined;
|
|
9
|
+
};
|
|
10
|
+
export type ColumnChooserGroupRef = {
|
|
11
|
+
key: string;
|
|
12
|
+
title: string;
|
|
8
13
|
};
|
|
9
14
|
type ColumnChooserPanelProps = {
|
|
10
15
|
items: ColumnChooserItem[];
|
|
@@ -14,6 +19,8 @@ type ColumnChooserPanelProps = {
|
|
|
14
19
|
onHideAllColumns: () => void;
|
|
15
20
|
onResetColumns: () => void;
|
|
16
21
|
onReorderColumns: (orderedKeys: string[]) => void;
|
|
22
|
+
onToggleColumnsVisibility?: ((columnKeys: string[], nextVisible: boolean) => void) | undefined;
|
|
23
|
+
clampDropIndex?: ((columnKey: string, pane: ColumnPane, index: number) => number) | undefined;
|
|
17
24
|
};
|
|
18
|
-
export declare function ColumnChooserPanel({ items, canToggle, onToggleColumnVisibility, onShowAllColumns, onHideAllColumns, onResetColumns, onReorderColumns, }: ColumnChooserPanelProps): import("react").JSX.Element;
|
|
25
|
+
export declare function ColumnChooserPanel({ items, canToggle, onToggleColumnVisibility, onShowAllColumns, onHideAllColumns, onResetColumns, onReorderColumns, onToggleColumnsVisibility, clampDropIndex, }: ColumnChooserPanelProps): import("react").JSX.Element;
|
|
19
26
|
export default ColumnChooserPanel;
|
|
@@ -28,7 +28,13 @@ type ColumnMenuPopoverProps = {
|
|
|
28
28
|
onResetColumns: () => void;
|
|
29
29
|
onGroupByColumn?: () => void;
|
|
30
30
|
onUngroup?: () => void;
|
|
31
|
+
columnGroupToggles?: readonly {
|
|
32
|
+
key: string;
|
|
33
|
+
label: string;
|
|
34
|
+
open: boolean;
|
|
35
|
+
}[] | undefined;
|
|
36
|
+
onToggleColumnGroup?: ((groupKey: string, open: boolean) => void) | undefined;
|
|
31
37
|
onRequestClose: () => void;
|
|
32
38
|
};
|
|
33
|
-
export declare function ColumnMenuPopover({ isOpen, themeClassName, slots, title, columnKey, canFilter, onOpenFilter, canSort, sortDirection, onSortChange, onOpenSortManager, canManageFilters, onOpenFilterManager, pinned, canChangePinned, layout, popoverRef, onPinnedChange, onAutosizeColumn, onAutosizeAllColumns, onOpenColumnChooser, canResetColumns, onResetColumns, onGroupByColumn, onUngroup, onRequestClose, }: ColumnMenuPopoverProps): import("react").ReactPortal | null;
|
|
39
|
+
export declare function ColumnMenuPopover({ isOpen, themeClassName, slots, title, columnKey, canFilter, onOpenFilter, canSort, sortDirection, onSortChange, onOpenSortManager, canManageFilters, onOpenFilterManager, pinned, canChangePinned, layout, popoverRef, onPinnedChange, onAutosizeColumn, onAutosizeAllColumns, onOpenColumnChooser, canResetColumns, onResetColumns, onGroupByColumn, onUngroup, columnGroupToggles, onToggleColumnGroup, onRequestClose, }: ColumnMenuPopoverProps): import("react").ReactPortal | null;
|
|
34
40
|
export default ColumnMenuPopover;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type PointerEvent } from 'react';
|
|
2
|
+
import { type ColumnGroupResizeStart, type ColumnGroupTree } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/columnGroups';
|
|
3
|
+
import { type GridUiAction } from '@ishibashi0112/spreadsheet-grid-core/internal/model/gridActions';
|
|
4
|
+
import type { SelectionSnapshot } from '@ishibashi0112/spreadsheet-grid-core/internal/model/gridSelectors';
|
|
5
|
+
import type { GridResolvedSlots } from '../model/gridTypes.js';
|
|
6
|
+
import type { GridPaneKind } from './GridHeaderRow.js';
|
|
7
|
+
type GroupPaneEntry = {
|
|
8
|
+
column: {
|
|
9
|
+
key: string;
|
|
10
|
+
resizable?: boolean | undefined;
|
|
11
|
+
minWidth?: number | undefined;
|
|
12
|
+
maxWidth?: number | undefined;
|
|
13
|
+
};
|
|
14
|
+
logicalIndex: number;
|
|
15
|
+
paneLocalStart: number;
|
|
16
|
+
paneLocalSize: number;
|
|
17
|
+
};
|
|
18
|
+
type GridColumnGroupHeaderProps = {
|
|
19
|
+
pane: GridPaneKind;
|
|
20
|
+
tree: ColumnGroupTree;
|
|
21
|
+
groupRowHeight: number;
|
|
22
|
+
leadingWidth: number;
|
|
23
|
+
entries: readonly GroupPaneEntry[];
|
|
24
|
+
renderEntries?: readonly GroupPaneEntry[] | undefined;
|
|
25
|
+
closedKeys: ReadonlySet<string> | undefined;
|
|
26
|
+
selectionSnapshot: SelectionSnapshot;
|
|
27
|
+
isWholeGridSelected: boolean;
|
|
28
|
+
stickyInset: {
|
|
29
|
+
left: number;
|
|
30
|
+
right: number;
|
|
31
|
+
} | null;
|
|
32
|
+
enableColumnResize: boolean;
|
|
33
|
+
slots?: GridResolvedSlots | undefined;
|
|
34
|
+
dispatch: (action: GridUiAction) => void;
|
|
35
|
+
onGroupPointerDown: (firstCol: number, lastCol: number, event: PointerEvent<HTMLDivElement>) => void;
|
|
36
|
+
onResizePointerDown: (resize: ColumnGroupResizeStart, event: PointerEvent<HTMLDivElement>) => void;
|
|
37
|
+
onGripPointerDown?: ((groupKey: string, pane: GridPaneKind, event: PointerEvent<HTMLSpanElement>) => void) | undefined;
|
|
38
|
+
};
|
|
39
|
+
declare function GridColumnGroupHeaderInner({ pane, tree, groupRowHeight, leadingWidth, entries, renderEntries, closedKeys, selectionSnapshot, isWholeGridSelected, stickyInset, enableColumnResize, slots, dispatch, onGroupPointerDown, onResizePointerDown, onGripPointerDown, }: GridColumnGroupHeaderProps): import("react").JSX.Element;
|
|
40
|
+
export declare const GridColumnGroupHeader: import("react").MemoExoticComponent<typeof GridColumnGroupHeaderInner>;
|
|
41
|
+
export {};
|
|
@@ -36,7 +36,11 @@ type GridHeaderRowProps<T> = {
|
|
|
36
36
|
onColumnMenuButtonClick: (column: GridColumn<T>, event: MouseEvent<HTMLButtonElement>) => void;
|
|
37
37
|
onColumnHeaderContextMenu: (column: GridColumn<T>, event: MouseEvent<HTMLDivElement>) => void;
|
|
38
38
|
onColumnDragHandlePointerDown?: (column: GridColumn<T>, event: PointerEvent<HTMLSpanElement>) => void;
|
|
39
|
+
stickyTop?: number | undefined;
|
|
40
|
+
ariaRowIndex?: number | undefined;
|
|
41
|
+
getHeaderSpanRows?: ((columnKey: string) => number) | undefined;
|
|
42
|
+
groupRowHeight?: number | undefined;
|
|
39
43
|
};
|
|
40
|
-
declare function GridHeaderRowInner<T>({ pane, ownsRowHeader, leadingWidth, headerHeight, rowHeaderCellStyle, slots, isCornerHovered, isWholeGridSelected, showSelectAllCheckbox, selectAllState, filteredRowsLength, visibleColumnsLength, renderEntries, hoveredColumnIndex, selectionSnapshot, columnFilterValues, sortState, onCornerPointerDown, onCornerPointerEnter, onCornerPointerLeave, onColumnHeaderPointerDown, onColumnHeaderPointerEnter, onColumnHeaderPointerLeave, onColumnResizePointerDown, enableColumnResize, enableColumnMenu, openedMenuColumnKey, onColumnMenuButtonPointerDown, onColumnMenuButtonClick, onColumnHeaderContextMenu, onColumnDragHandlePointerDown, }: GridHeaderRowProps<T>): import("react").JSX.Element;
|
|
44
|
+
declare function GridHeaderRowInner<T>({ pane, ownsRowHeader, leadingWidth, headerHeight, rowHeaderCellStyle, slots, isCornerHovered, isWholeGridSelected, showSelectAllCheckbox, selectAllState, filteredRowsLength, visibleColumnsLength, renderEntries, hoveredColumnIndex, selectionSnapshot, columnFilterValues, sortState, onCornerPointerDown, onCornerPointerEnter, onCornerPointerLeave, onColumnHeaderPointerDown, onColumnHeaderPointerEnter, onColumnHeaderPointerLeave, onColumnResizePointerDown, enableColumnResize, enableColumnMenu, openedMenuColumnKey, onColumnMenuButtonPointerDown, onColumnMenuButtonClick, onColumnHeaderContextMenu, onColumnDragHandlePointerDown, stickyTop, ariaRowIndex, getHeaderSpanRows, groupRowHeight, }: GridHeaderRowProps<T>): import("react").JSX.Element;
|
|
41
45
|
export declare const GridHeaderRow: typeof GridHeaderRowInner;
|
|
42
46
|
export default GridHeaderRow;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ishibashi0112/spreadsheet-grid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "React 18.3 / 19 向けの仮想化データグリッド。SSRM(書き戻し付き)/ 行グルーピング + 集計 / Master/Detail / 範囲選択 + クリップボードを MIT で。IME に強い編集、100 万行の仮想化、Tailwind / Mantine / HeroUI と共存。コアは @ishibashi0112/spreadsheet-grid-core。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@tanstack/virtual-core": "^3.19.11",
|
|
114
|
-
"@ishibashi0112/spreadsheet-grid-core": "1.
|
|
114
|
+
"@ishibashi0112/spreadsheet-grid-core": "1.6.0"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@types/react": "^19.3.0",
|
|
@@ -66,8 +66,8 @@ export function Inventory() {
|
|
|
66
66
|
|
|
67
67
|
## 4. 入口の選び方
|
|
68
68
|
|
|
69
|
-
- `@ishibashi0112/spreadsheet-grid` の `SpreadsheetGrid`: 全部入り(初期 JS 約
|
|
70
|
-
- `@ishibashi0112/spreadsheet-grid/lite` の `createSpreadsheetGrid`: 使う機能だけを入れる(機能なしで約
|
|
69
|
+
- `@ishibashi0112/spreadsheet-grid` の `SpreadsheetGrid`: 全部入り(初期 JS 約 163KB gzip)。迷ったらこれ。
|
|
70
|
+
- `@ishibashi0112/spreadsheet-grid/lite` の `createSpreadsheetGrid`: 使う機能だけを入れる(機能なしで約 94KB、`standardFeatures` で約 118KB)。モジュールの先頭で 1 回だけ作ります。部品の名前は「キー + `Feature`」です(例: `{ ...standardFeatures, serverSide: serverSideFeature }`)。`standardFeatures` は `filtering` / `columnMenu` / `toolPanel` / `columnAutosize` / `export`。足りない機能は開発時に `console.warn` が名指しします。全部入りと同じアプリで混ぜると共通部分が二重に入るので、どちらかの入口に揃えます。
|
|
71
71
|
- `@ishibashi0112/spreadsheet-grid/ai`: `GridAskBar`(ことばで絞り込み。利用者の文から AI がフィルター・並び・検索を入れる)。グリッドの上に置いて `grid` に ref を渡します。AI は利用側の `ask`(自分のサーバー経由。API キーをブラウザに置かない)で呼び、行のデータは送りません。
|
|
72
72
|
- `@ishibashi0112/spreadsheet-grid/locales/en`: 英語の文言 `localeTextEn`(グリッドの `localeText` へ)と `gridAskLocaleTextEn`(`GridAskBar` の `localeText` へ)。
|
|
73
73
|
- `@ishibashi0112/spreadsheet-grid/testing`: jsdom のテストで行と列を描画させる `installJsdomLayoutStubs()`。仮想化は効いたままで、描かれるのはスタブの大きさ(既定 1200×600)に入る行・列だけ。貼り付けは `Ctrl+V` のキーではなく paste イベント(`user.paste`)。
|
|
@@ -88,6 +88,7 @@ export function Inventory() {
|
|
|
88
88
|
| サーバーから少しずつ読む(SSRM) | 「serverSide モード」「dataSource とパラメータ」「セル編集の書き戻し」 |
|
|
89
89
|
| グループと集計、合計行 | 「行グルーピング + 集計」「合計行」 |
|
|
90
90
|
| 目標値・前年の行を表の上下に固定する(`pinnedTopRows` / `pinnedBottomRows`) | 「固定行」 |
|
|
91
|
+
| 列見出しの上に、倉庫ごと・期ごとのようなまとめの見出しを足す(多段の列見出し。`columnGroups`) | 「列のグループ(多段の列見出し)」 |
|
|
91
92
|
| 展開行、見出し行、行のドラッグ | 「展開行(Master/Detail)」「ラベル行」「行ドラッグ並び替え」 |
|
|
92
93
|
| CSV / Excel への出力 | 「CSV エクスポート」「Excel / スプレッドシート エクスポート」 |
|
|
93
94
|
| スクロール・選択・undo をコードから | 「命令的 API」 |
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./useController-Zlv7BRoY.cjs"),t=require("./usePortalTokens-CUAiwfmK.cjs"),n=require("./useGridLocaleText-CRSWUb4o.cjs");let r=require("react"),i=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/cx"),a=require("react-dom"),o=require("react/jsx-runtime"),s=require("@ishibashi0112/spreadsheet-grid-core/internal/controllers/columnMenuController"),c=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures");var l=t=>{let n=e.t(()=>(0,s.createColumnMenuController)(),t),i=(0,r.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),a=i.columnKey,{visibleColumns:o}=t,c=(0,r.useMemo)(()=>a?o.find(e=>e.key===a)??null:null,[a,o]);return{columnMenuLayout:i.layout,columnMenuRef:n.panelRef,isColumnMenuOpen:a!==null,openedMenuColumnKey:a,openedMenuColumn:c,openColumnMenuFromButton:n.openFromButton,openColumnMenuFromButtonClick:n.openFromButtonClick,openColumnMenuFromContextMenu:n.openFromContextMenu,openColumnMenuFromKeyboard:n.openFromKeyboard,closeColumnMenu:n.close}},u=[{value:void 0,label:`menuPinNone`},{value:`left`,label:`menuPinLeft`},{value:`right`,label:`menuPinRight`}],d=180,f=4,p=8,m=`pin`,h=500,g=24,_=(e,t)=>e!==null&&t.detail>0&&t.timeStamp-e.at<h&&Math.abs(t.clientX-e.x)<=g&&Math.abs(t.clientY-e.y)<=g;function v({isOpen:s,themeClassName:c,slots:l,title:h,columnKey:g,canFilter:v,onOpenFilter:y,canSort:b,sortDirection:x,onSortChange:S,onOpenSortManager:C,canManageFilters:w,onOpenFilterManager:T,pinned:E,canChangePinned:D,layout:O,popoverRef:k,onPinnedChange:A,onAutosizeColumn:j,onAutosizeAllColumns:M,onOpenColumnChooser:N,canResetColumns:P,onResetColumns:F,onGroupByColumn:I,onUngroup:L,onRequestClose:R}){let z=n.r(),[B,V]=(0,r.useState)(null);(0,r.useEffect)(()=>{V(null)},[g,s]),e.r(()=>{let e=k.current;e&&(e.scrollTop=0)},[g,k]),t.i(k,s&&O!==null,c,{layout:O});let H=(0,r.useRef)(null);t.i(H,s&&O!==null&&B===m&&O.maxHeight===void 0,c,{origin:!1});let U=t.r(s&&O!==null),W=(0,r.useRef)(null),G=(0,r.useRef)(null),K=(0,r.useId)(),q=(0,r.useRef)(!1),J=()=>{let e=H.current?.querySelector(`.ssg-menu-item:not(:disabled)`);return e?.focus(),e!=null};if((0,r.useEffect)(()=>{if(B!==m)return;let e=H.current;e?.classList.contains(`ssg-menu-subgroup`)&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`}),q.current&&(q.current=!1,J())},[B]),!s||!O||!U)return null;let Y=B===m,X=O.maxHeight!==void 0,Z=()=>{X||V(null)},Q=O.left+O.width+f+d>window.innerWidth-p,$=Q&&O.left-f-d<p?Math.max(p,Math.min(window.innerWidth-p-d,O.left-f-d))-(O.left+9):void 0,ee={position:`fixed`,top:O.top,left:O.left,width:O.width,zIndex:1e3,...O.maxHeight===void 0?{}:{maxHeight:O.maxHeight,overflowY:`auto`}},te={position:`absolute`,top:-9,...$===void 0?Q?{right:`calc(100% + ${f}px)`}:{left:`calc(100% + ${f}px)`}:{left:$},width:d,zIndex:1};return(0,a.createPortal)((0,o.jsxs)(`div`,{ref:k,onPointerDown:e=>{e.stopPropagation()},onKeyDown:e=>{e.stopPropagation()},onContextMenu:e=>{e.preventDefault()},role:`menu`,"aria-label":h,tabIndex:-1,className:(0,i.cx)(`ssg-menu-panel`,c,l?.popover?.className),style:{...l?.popover?.style,...ee},children:[(0,o.jsx)(`div`,{className:`ssg-menu-title`,"aria-hidden":`true`,children:h}),v&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{y()},className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuFilter})]}),(0,o.jsx)(`div`,{role:`separator`,className:`ssg-menu-separator`})]}),b&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,onPointerEnter:Z,onClick:()=>{S(`asc`)},role:`menuitemradio`,"aria-checked":x===`asc`,className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:(0,i.cx)(`ssg-menu-sort-icon`,x===`asc`&&`ssg-menu-sort-icon--active`),"aria-hidden":`true`,children:x===`asc`?`✓`:`↑`}),(0,o.jsx)(`span`,{className:(0,i.cx)(`ssg-menu-label`,x===`asc`&&`ssg-menu-label--sorted`),children:z.menuSortAscending})]}),(0,o.jsxs)(`button`,{type:`button`,onPointerEnter:Z,onClick:()=>{S(`desc`)},role:`menuitemradio`,"aria-checked":x===`desc`,className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:(0,i.cx)(`ssg-menu-sort-icon`,x===`desc`&&`ssg-menu-sort-icon--active`),"aria-hidden":`true`,children:x===`desc`?`✓`:`↓`}),(0,o.jsx)(`span`,{className:(0,i.cx)(`ssg-menu-label`,x===`desc`&&`ssg-menu-label--sorted`),children:z.menuSortDescending})]}),C&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{C()},className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuManageSort})]})]}),w&&T&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{T()},className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuManageFilters})]}),(b||w&&T!==void 0)&&(0,o.jsx)(`div`,{role:`separator`,className:`ssg-menu-separator`}),I&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{I()},className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuGroupBy})]}),L&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{L()},className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuUngroup})]}),(I||L)&&(0,o.jsx)(`div`,{role:`separator`,className:`ssg-menu-separator`}),(0,o.jsxs)(`div`,{className:`ssg-menu-submenu-anchor`,role:`none`,children:[(0,o.jsxs)(`button`,{ref:W,type:`button`,role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":Y,onPointerEnter:e=>{e.pointerType===`mouse`&&!X&&V(m)},onClick:e=>{if(e.detail===0){if(Y){!J()&&X&&V(null);return}q.current=!0}else if(X&&Y){V(null);return}G.current=e.detail>0?{x:e.clientX,y:e.clientY,at:e.timeStamp}:null,V(m)},onKeyDown:e=>{if(e.key===`ArrowLeft`&&X&&Y){e.preventDefault(),V(null);return}e.key===`ArrowRight`&&(e.preventDefault(),Y?J():(q.current=!0,V(m)))},className:(0,i.cx)(`ssg-menu-item`,Y&&`ssg-menu-item--active`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuPin}),(0,o.jsx)(`span`,{className:`ssg-menu-caret`,"aria-hidden":`true`,children:`›`})]}),Y&&(0,o.jsxs)(`div`,{ref:H,role:`menu`,"aria-label":z.menuPin,className:X?`ssg-menu-subgroup`:(0,i.cx)(`ssg-menu-panel`,c,l?.popover?.className),style:X?void 0:{...l?.popover?.style,...te},onKeyDown:e=>{e.key===`ArrowLeft`&&(e.preventDefault(),V(null),W.current?.focus())},children:[u.map(e=>{let t=E===e.value;return(0,o.jsxs)(`button`,{type:`button`,disabled:!D,role:`menuitemradio`,"aria-checked":t,"aria-describedby":D?void 0:K,onClick:t=>{!D||X&&_(G.current,t)||A(g,e.value)},className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:(0,i.cx)(`ssg-menu-check`,!t&&`ssg-menu-check--hidden`),"aria-hidden":`true`,children:`✓`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z[e.label]})]},e.label)}),!D&&(0,o.jsx)(`div`,{id:K,role:`none`,className:`ssg-menu-note`,children:z.menuPinUnavailable})]})]}),j&&M&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{j(g)},className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuAutosize})]}),(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{M()},className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuAutosizeAll})]})]}),N&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{N()},className:(0,i.cx)(`ssg-menu-item`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuColumns})]}),(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-disabled":!P,tabIndex:P?0:-1,"data-ssg-tooltip":P?z.resetColumnsHint:z.menuResetUnavailable,onPointerEnter:Z,onClick:()=>{P&&F()},className:(0,i.cx)(`ssg-menu-item`,!P&&`ssg-menu-item--disabled`,l?.menuItem?.className),style:l?.menuItem?.style,children:[(0,o.jsx)(`span`,{className:`ssg-menu-icon`}),(0,o.jsx)(`span`,{className:`ssg-menu-label`,children:z.menuResetColumns})]}),(0,o.jsx)(`div`,{className:`ssg-menu-footer`,role:`none`,children:(0,o.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:R,className:`ssg-menu-close-btn`,children:z.close})})]}),U)}var y={useColumnMenu:e=>({available:!0,...l(e)}),ColumnMenuPopover:v,localeText:c.DEFAULT_COLUMN_MENU_LOCALE_TEXT};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return y}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./useController-Zlv7BRoY.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("@ishibashi0112/spreadsheet-grid-core/internal/controllers/columnHeaderDragController");var i=n=>{let i=(0,t.useRef)(null),a=(0,t.useRef)(null),o=(0,t.useRef)(null),s=e.t(()=>(0,r.createColumnHeaderDragController)(),{...n,leftIndicatorRef:i,centerIndicatorRef:a,rightIndicatorRef:o});return{onColumnDragHandlePointerDown:s.onColumnDragHandlePointerDown,leftIndicatorRef:i,centerIndicatorRef:a,rightIndicatorRef:o,applyReorderSettle:s.applyReorderSettle}},a={useColumnReorder:t=>{let{onColumnDragHandlePointerDown:r,leftIndicatorRef:a,centerIndicatorRef:o,rightIndicatorRef:s,applyReorderSettle:c}=i(t),{paneLayout:l}=t;return e.r(()=>{c()},[l,c]),{onColumnDragHandlePointerDown:r,renderDropIndicator:(e,t)=>(0,n.jsx)(`div`,{ref:e===`left`?a:e===`center`?o:s,className:`ssg-col-drop-indicator`,style:t})}}};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|