@ishibashi0112/spreadsheet-grid 1.5.1 → 1.7.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 +173 -34
- package/README.md +2 -2
- package/dist/CellEditorLayer.d.ts +5 -3
- package/dist/GridShell.d.ts +1 -1
- package/dist/common.d.ts +1 -1
- package/dist/editors/SearchSelectCellEditor.d.ts +24 -0
- package/dist/editors/SelectCellEditor.d.ts +1 -1
- package/dist/features/columnGroups.d.ts +2 -0
- package/dist/features/selectSearch.d.ts +2 -0
- package/dist/features/types.d.ts +22 -1
- package/dist/hooks/useColumnHeaderDragController.d.ts +1 -0
- package/dist/hooks/useGridBarContext.d.ts +2 -1
- package/dist/hooks/useGridEditController.d.ts +1 -1
- package/dist/hooks/useGridPointerInteractions.d.ts +1 -0
- package/dist/index.cjs +6 -6
- package/dist/index.js +3556 -2998
- 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-B4_L9K--.cjs +6 -0
- package/dist/lite/createSpreadsheetGrid-BlYZzGf-.js +4547 -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/selectSearch.cjs +1 -0
- package/dist/lite/features/selectSearch.js +2 -0
- 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/selectSearch-B1OSCMbw.js +204 -0
- package/dist/lite/selectSearch-BIeA4Xhg.cjs +1 -0
- 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/useTopAlignedInput-BAL_0rjw.cjs +1 -0
- package/dist/lite/useTopAlignedInput-CAagCTj-.js +37 -0
- package/dist/lite.cjs +1 -1
- package/dist/lite.d.ts +2 -0
- package/dist/lite.js +21 -19
- package/dist/model/gridTypes.d.ts +6 -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 +4 -2
- package/dist/lite/columnMenu-CBAvHYIy.cjs +0 -1
- package/dist/lite/columnReorder-CDG4Ngmm.cjs +0 -1
- package/dist/lite/createSpreadsheetGrid-7eNe2rg-.cjs +0 -6
- package/dist/lite/createSpreadsheetGrid-D9e_Gifn.js +0 -4398
- package/dist/lite/filtering-BKaFSWIN.cjs +0 -1
- package/dist/lite/toolPanelViews-8HccPGgN.cjs +0 -1
- package/dist/toolPanelViews-BJi7W0Tz.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./useGridLocaleText-CRSWUb4o.cjs");let t=require("react"),n=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/cx"),r=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards"),i=require("@ishibashi0112/spreadsheet-grid-core/internal/model/gridActions"),a=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText"),o=require("react/jsx-runtime"),s=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures"),c=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/columnGroups");var l=(e,t,n)=>(0,c.createColumnGroupResize)(e.slice(t.startIndex,t.endIndex+1).filter(e=>e.column.resizable??n).map(e=>({key:e.column.key,startWidth:e.paneLocalSize,minWidth:e.column.minWidth??60,maxWidth:e.column.maxWidth??1/0}))),u=e=>{e.stopPropagation(),e.pointerType===`mouse`&&e.preventDefault()},d=({open:e})=>(0,o.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,"aria-hidden":`true`,focusable:`false`,children:e?(0,o.jsx)(`path`,{d:`M10 3 5 8l5 5`,strokeLinecap:`round`,strokeLinejoin:`round`}):(0,o.jsx)(`path`,{d:`M6 3l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),f=(0,o.jsxs)(`svg`,{width:`8`,height:`14`,viewBox:`0 0 8 14`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:[(0,o.jsx)(`circle`,{cx:`2`,cy:`3`,r:`1`}),(0,o.jsx)(`circle`,{cx:`6`,cy:`3`,r:`1`}),(0,o.jsx)(`circle`,{cx:`2`,cy:`7`,r:`1`}),(0,o.jsx)(`circle`,{cx:`6`,cy:`7`,r:`1`}),(0,o.jsx)(`circle`,{cx:`2`,cy:`11`,r:`1`}),(0,o.jsx)(`circle`,{cx:`6`,cy:`11`,r:`1`})]});function p({pane:s,tree:p,groupRowHeight:m,leadingWidth:h,entries:g,renderEntries:_,closedKeys:v,selectionSnapshot:y,isWholeGridSelected:b,stickyInset:x,enableColumnResize:S,slots:C,dispatch:w,onGroupPointerDown:T,onResizePointerDown:E,onGripPointerDown:D}){let O=e.r(),k=(0,t.useMemo)(()=>(0,c.resolveColumnGroupCells)(p,g),[p,g]),A=(0,t.useMemo)(()=>{if(_===void 0||k.length===0)return k;let e=_[0],t=_[_.length-1];if(!e||!t)return[];let n=e.paneLocalStart,r=t.paneLocalStart+t.paneLocalSize,i=k.filter(e=>e.start<r&&e.start+e.size>n);return i.length===k.length?k:i},[k,_]),j=p.depth,M=Array.from({length:j},()=>[]);for(let e of A)M[e.level]?.push(e);return(0,o.jsx)(`div`,{"data-pane":s,className:`ssg-col-group-block`,style:{height:j*m},children:M.map((e,t)=>e.length===0?null:(0,o.jsx)(`div`,{role:`row`,"aria-rowindex":t+1,className:`ssg-col-group-row`,style:{top:t*m,height:m},children:e.map(e=>{let t=e.group,c=t.definition,p=!t.collapsible||!(v?.has(t.key)??!1),_=c.headerAlign??`left`,k=b||y.kind===`col`&&e.firstColIndex>=y.startCol&&e.lastColIndex<=y.endCol,A=x===null||_===`center`?void 0:_===`right`?{position:`sticky`,right:x.right+6}:{position:`sticky`,left:x.left+6},j={group:c,open:p,collapsible:t.collapsible,width:e.size},M=t.title||t.key,N=(0,a.formatLocaleText)(p?O.collapseColumnGroup:O.expandColumnGroup,{group:M}),P=l(g,e,S);return(0,o.jsxs)(`div`,{role:`columnheader`,"aria-colindex":e.firstColIndex+2,"aria-colspan":e.lastColIndex-e.firstColIndex+1,"data-ssg-col-group":t.key,className:(0,n.cx)(`ssg-header-cell`,`ssg-col-group-cell`,k&&`ssg-header-cell--selected`,_===`center`&&`ssg-col-group-cell--align-center`,_===`right`&&`ssg-col-group-cell--align-right`,!p&&`ssg-col-group-cell--closed`,C?.headerCell?.className,c.className),style:{...C?.headerCell?.style,left:h+e.start,width:e.size,minWidth:e.size,height:m},onPointerDown:t=>{c.renderHeader&&(0,r.isFromRenderHeaderControl)(t.target,t.currentTarget,`.ssg-col-group-label`)||T(e.firstColIndex,e.lastColIndex,t)},children:[(0,o.jsxs)(`div`,{className:`ssg-col-group-label`,style:A,children:[(0,o.jsx)(`span`,{className:(0,n.cx)(`ssg-col-group-title`,c.renderHeader&&`ssg-col-group-title--custom`),"data-ssg-tooltip":c.renderHeader?void 0:M,children:c.renderHeader?c.renderHeader(j):M}),t.collapsible&&(0,o.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-expanded":p,"aria-label":N,"data-ssg-tooltip":N,className:(0,n.cx)(`ssg-icon-btn`,`ssg-col-group-toggle`,C?.iconButton?.className),style:C?.iconButton?.style,onPointerDown:u,onClick:e=>{e.stopPropagation(),w(i.gridActions.setColumnGroupOpen(t.key,!p))},children:(0,o.jsx)(d,{open:p})}),D&&(0,o.jsx)(`span`,{"aria-hidden":`true`,className:`ssg-header-grip ssg-col-group-grip`,"data-ssg-tooltip":(0,a.formatLocaleText)(O.dragColumnGroup,{group:M}),onPointerDown:e=>D(t.key,s,e),children:f})]}),P!==null&&(0,o.jsx)(`div`,{className:`ssg-header-resize`,onPointerDown:e=>E(P,e)})]},e.id)})},t))})}var m=(0,t.memo)(p),h={buildColumnGroupTree:c.buildColumnGroupTree,warnUnknownColumnGroupKeys:c.warnUnknownColumnGroupKeys,resolveCollapsedColumnKeys:c.resolveCollapsedColumnKeys,followColumnKeysAfterColumnGroupChange:c.followColumnKeysAfterColumnGroupChange,placeUnpinnedColumnInGroup:c.placeUnpinnedColumnInGroup,resolveColumnMenuGroupToggles:c.resolveColumnMenuGroupToggles,resolveColumnGroupDistinctTitles:c.resolveColumnGroupDistinctTitles,columnHeaderSpanRows:c.columnHeaderSpanRows,createColumnChooserDropClamp:c.createColumnChooserDropClamp,resolveColumnDragItem:c.resolveColumnDragItem,resolveColumnGroupDragItem:c.resolveColumnGroupDragItem,resolveColumnGroupDropPlacement:c.resolveColumnGroupDropPlacement,computeColumnBlockReorderedKeys:c.computeColumnBlockReorderedKeys,ColumnGroupHeader:m,localeText:s.DEFAULT_COLUMN_GROUPS_LOCALE_TEXT};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { r as e } from "./useGridLocaleText-CpoTVgyp.js";
|
|
2
|
+
import { memo as t, useMemo as n } from "react";
|
|
3
|
+
import { cx as r } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cx";
|
|
4
|
+
import { isFromRenderHeaderControl as i } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
5
|
+
import { gridActions as a } from "@ishibashi0112/spreadsheet-grid-core/internal/model/gridActions";
|
|
6
|
+
import { formatLocaleText as o } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
7
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
import { DEFAULT_COLUMN_GROUPS_LOCALE_TEXT as l } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
9
|
+
import { buildColumnGroupTree as u, columnHeaderSpanRows as d, computeColumnBlockReorderedKeys as f, createColumnChooserDropClamp as p, createColumnGroupResize as m, followColumnKeysAfterColumnGroupChange as h, placeUnpinnedColumnInGroup as g, resolveCollapsedColumnKeys as _, resolveColumnDragItem as v, resolveColumnGroupCells as y, resolveColumnGroupDistinctTitles as b, resolveColumnGroupDragItem as x, resolveColumnGroupDropPlacement as S, resolveColumnMenuGroupToggles as C, warnUnknownColumnGroupKeys as w } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/columnGroups";
|
|
10
|
+
//#region src/view/GridColumnGroupHeader.tsx
|
|
11
|
+
var T = (e, t, n) => m(e.slice(t.startIndex, t.endIndex + 1).filter((e) => e.column.resizable ?? n).map((e) => ({
|
|
12
|
+
key: e.column.key,
|
|
13
|
+
startWidth: e.paneLocalSize,
|
|
14
|
+
minWidth: e.column.minWidth ?? 60,
|
|
15
|
+
maxWidth: e.column.maxWidth ?? Infinity
|
|
16
|
+
}))), E = (e) => {
|
|
17
|
+
e.stopPropagation(), e.pointerType === "mouse" && e.preventDefault();
|
|
18
|
+
}, D = ({ open: e }) => /* @__PURE__ */ s("svg", {
|
|
19
|
+
width: "10",
|
|
20
|
+
height: "10",
|
|
21
|
+
viewBox: "0 0 16 16",
|
|
22
|
+
fill: "none",
|
|
23
|
+
stroke: "currentColor",
|
|
24
|
+
strokeWidth: "2",
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
focusable: "false",
|
|
27
|
+
children: e ? /* @__PURE__ */ s("path", {
|
|
28
|
+
d: "M10 3 5 8l5 5",
|
|
29
|
+
strokeLinecap: "round",
|
|
30
|
+
strokeLinejoin: "round"
|
|
31
|
+
}) : /* @__PURE__ */ s("path", {
|
|
32
|
+
d: "M6 3l5 5-5 5",
|
|
33
|
+
strokeLinecap: "round",
|
|
34
|
+
strokeLinejoin: "round"
|
|
35
|
+
})
|
|
36
|
+
}), O = /* @__PURE__ */ c("svg", {
|
|
37
|
+
width: "8",
|
|
38
|
+
height: "14",
|
|
39
|
+
viewBox: "0 0 8 14",
|
|
40
|
+
fill: "currentColor",
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
focusable: "false",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ s("circle", {
|
|
45
|
+
cx: "2",
|
|
46
|
+
cy: "3",
|
|
47
|
+
r: "1"
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ s("circle", {
|
|
50
|
+
cx: "6",
|
|
51
|
+
cy: "3",
|
|
52
|
+
r: "1"
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ s("circle", {
|
|
55
|
+
cx: "2",
|
|
56
|
+
cy: "7",
|
|
57
|
+
r: "1"
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ s("circle", {
|
|
60
|
+
cx: "6",
|
|
61
|
+
cy: "7",
|
|
62
|
+
r: "1"
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ s("circle", {
|
|
65
|
+
cx: "2",
|
|
66
|
+
cy: "11",
|
|
67
|
+
r: "1"
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ s("circle", {
|
|
70
|
+
cx: "6",
|
|
71
|
+
cy: "11",
|
|
72
|
+
r: "1"
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
function k({ pane: t, tree: l, groupRowHeight: u, leadingWidth: d, entries: f, renderEntries: p, closedKeys: m, selectionSnapshot: h, isWholeGridSelected: g, stickyInset: _, enableColumnResize: v, slots: b, dispatch: x, onGroupPointerDown: S, onResizePointerDown: C, onGripPointerDown: w }) {
|
|
77
|
+
let k = e(), A = n(() => y(l, f), [l, f]), j = n(() => {
|
|
78
|
+
if (p === void 0 || A.length === 0) return A;
|
|
79
|
+
let e = p[0], t = p[p.length - 1];
|
|
80
|
+
if (!e || !t) return [];
|
|
81
|
+
let n = e.paneLocalStart, r = t.paneLocalStart + t.paneLocalSize, i = A.filter((e) => e.start < r && e.start + e.size > n);
|
|
82
|
+
return i.length === A.length ? A : i;
|
|
83
|
+
}, [A, p]), M = l.depth, N = Array.from({ length: M }, () => []);
|
|
84
|
+
for (let e of j) N[e.level]?.push(e);
|
|
85
|
+
return /* @__PURE__ */ s("div", {
|
|
86
|
+
"data-pane": t,
|
|
87
|
+
className: "ssg-col-group-block",
|
|
88
|
+
style: { height: M * u },
|
|
89
|
+
children: N.map((e, n) => e.length === 0 ? null : /* @__PURE__ */ s("div", {
|
|
90
|
+
role: "row",
|
|
91
|
+
"aria-rowindex": n + 1,
|
|
92
|
+
className: "ssg-col-group-row",
|
|
93
|
+
style: {
|
|
94
|
+
top: n * u,
|
|
95
|
+
height: u
|
|
96
|
+
},
|
|
97
|
+
children: e.map((e) => {
|
|
98
|
+
let n = e.group, l = n.definition, p = !n.collapsible || !(m?.has(n.key) ?? !1), y = l.headerAlign ?? "left", A = g || h.kind === "col" && e.firstColIndex >= h.startCol && e.lastColIndex <= h.endCol, j = _ === null || y === "center" ? void 0 : y === "right" ? {
|
|
99
|
+
position: "sticky",
|
|
100
|
+
right: _.right + 6
|
|
101
|
+
} : {
|
|
102
|
+
position: "sticky",
|
|
103
|
+
left: _.left + 6
|
|
104
|
+
}, M = {
|
|
105
|
+
group: l,
|
|
106
|
+
open: p,
|
|
107
|
+
collapsible: n.collapsible,
|
|
108
|
+
width: e.size
|
|
109
|
+
}, N = n.title || n.key, P = o(p ? k.collapseColumnGroup : k.expandColumnGroup, { group: N }), F = T(f, e, v);
|
|
110
|
+
return /* @__PURE__ */ c("div", {
|
|
111
|
+
role: "columnheader",
|
|
112
|
+
"aria-colindex": e.firstColIndex + 2,
|
|
113
|
+
"aria-colspan": e.lastColIndex - e.firstColIndex + 1,
|
|
114
|
+
"data-ssg-col-group": n.key,
|
|
115
|
+
className: r("ssg-header-cell", "ssg-col-group-cell", A && "ssg-header-cell--selected", y === "center" && "ssg-col-group-cell--align-center", y === "right" && "ssg-col-group-cell--align-right", !p && "ssg-col-group-cell--closed", b?.headerCell?.className, l.className),
|
|
116
|
+
style: {
|
|
117
|
+
...b?.headerCell?.style,
|
|
118
|
+
left: d + e.start,
|
|
119
|
+
width: e.size,
|
|
120
|
+
minWidth: e.size,
|
|
121
|
+
height: u
|
|
122
|
+
},
|
|
123
|
+
onPointerDown: (t) => {
|
|
124
|
+
l.renderHeader && i(t.target, t.currentTarget, ".ssg-col-group-label") || S(e.firstColIndex, e.lastColIndex, t);
|
|
125
|
+
},
|
|
126
|
+
children: [/* @__PURE__ */ c("div", {
|
|
127
|
+
className: "ssg-col-group-label",
|
|
128
|
+
style: j,
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ s("span", {
|
|
131
|
+
className: r("ssg-col-group-title", l.renderHeader && "ssg-col-group-title--custom"),
|
|
132
|
+
"data-ssg-tooltip": l.renderHeader ? void 0 : N,
|
|
133
|
+
children: l.renderHeader ? l.renderHeader(M) : N
|
|
134
|
+
}),
|
|
135
|
+
n.collapsible && /* @__PURE__ */ s("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
tabIndex: -1,
|
|
138
|
+
"aria-expanded": p,
|
|
139
|
+
"aria-label": P,
|
|
140
|
+
"data-ssg-tooltip": P,
|
|
141
|
+
className: r("ssg-icon-btn", "ssg-col-group-toggle", b?.iconButton?.className),
|
|
142
|
+
style: b?.iconButton?.style,
|
|
143
|
+
onPointerDown: E,
|
|
144
|
+
onClick: (e) => {
|
|
145
|
+
e.stopPropagation(), x(a.setColumnGroupOpen(n.key, !p));
|
|
146
|
+
},
|
|
147
|
+
children: /* @__PURE__ */ s(D, { open: p })
|
|
148
|
+
}),
|
|
149
|
+
w && /* @__PURE__ */ s("span", {
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
className: "ssg-header-grip ssg-col-group-grip",
|
|
152
|
+
"data-ssg-tooltip": o(k.dragColumnGroup, { group: N }),
|
|
153
|
+
onPointerDown: (e) => w(n.key, t, e),
|
|
154
|
+
children: O
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}), F !== null && /* @__PURE__ */ s("div", {
|
|
158
|
+
className: "ssg-header-resize",
|
|
159
|
+
onPointerDown: (e) => C(F, e)
|
|
160
|
+
})]
|
|
161
|
+
}, e.id);
|
|
162
|
+
})
|
|
163
|
+
}, n))
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/features/columnGroups.ts
|
|
168
|
+
var A = {
|
|
169
|
+
buildColumnGroupTree: u,
|
|
170
|
+
warnUnknownColumnGroupKeys: w,
|
|
171
|
+
resolveCollapsedColumnKeys: _,
|
|
172
|
+
followColumnKeysAfterColumnGroupChange: h,
|
|
173
|
+
placeUnpinnedColumnInGroup: g,
|
|
174
|
+
resolveColumnMenuGroupToggles: C,
|
|
175
|
+
resolveColumnGroupDistinctTitles: b,
|
|
176
|
+
columnHeaderSpanRows: d,
|
|
177
|
+
createColumnChooserDropClamp: p,
|
|
178
|
+
resolveColumnDragItem: v,
|
|
179
|
+
resolveColumnGroupDragItem: x,
|
|
180
|
+
resolveColumnGroupDropPlacement: S,
|
|
181
|
+
computeColumnBlockReorderedKeys: f,
|
|
182
|
+
ColumnGroupHeader: /* @__PURE__ */ t(k),
|
|
183
|
+
localeText: l
|
|
184
|
+
};
|
|
185
|
+
//#endregion
|
|
186
|
+
export { A as t };
|
|
@@ -22,7 +22,7 @@ var g = (e) => {
|
|
|
22
22
|
openColumnMenuFromKeyboard: n.openFromKeyboard,
|
|
23
23
|
closeColumnMenu: n.close
|
|
24
24
|
};
|
|
25
|
-
},
|
|
25
|
+
}, ne = [
|
|
26
26
|
{
|
|
27
27
|
value: void 0,
|
|
28
28
|
label: "menuPinNone"
|
|
@@ -35,47 +35,47 @@ var g = (e) => {
|
|
|
35
35
|
value: "right",
|
|
36
36
|
label: "menuPinRight"
|
|
37
37
|
}
|
|
38
|
-
],
|
|
39
|
-
function
|
|
38
|
+
], _ = 180, v = 4, y = 8, b = "pin", x = 500, S = 24, re = (e, t) => e !== null && t.detail > 0 && t.timeStamp - e.at < x && Math.abs(t.clientX - e.x) <= S && Math.abs(t.clientY - e.y) <= S;
|
|
39
|
+
function C({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, canFilter: g, onOpenFilter: x, canSort: S, sortDirection: C, onSortChange: w, onOpenSortManager: T, canManageFilters: E, onOpenFilterManager: D, pinned: ie, canChangePinned: O, layout: k, popoverRef: A, onPinnedChange: ae, onAutosizeColumn: j, onAutosizeAllColumns: M, onOpenColumnChooser: N, canResetColumns: P, onResetColumns: oe, onGroupByColumn: F, onUngroup: I, columnGroupToggles: L, onToggleColumnGroup: R, onRequestClose: se }) {
|
|
40
40
|
let z = i(), [B, V] = ee(null);
|
|
41
41
|
a(() => {
|
|
42
42
|
V(null);
|
|
43
43
|
}, [h, t]), e(() => {
|
|
44
|
-
let e =
|
|
44
|
+
let e = A.current;
|
|
45
45
|
e && (e.scrollTop = 0);
|
|
46
|
-
}, [h,
|
|
46
|
+
}, [h, A]), n(A, t && k !== null, s, { layout: k });
|
|
47
47
|
let H = c(null);
|
|
48
|
-
n(H, t &&
|
|
49
|
-
let U = r(t &&
|
|
48
|
+
n(H, t && k !== null && B === b && k.maxHeight === void 0, s, { origin: !1 });
|
|
49
|
+
let U = r(t && k !== null), W = c(null), G = c(null), K = o(), q = c(!1), J = () => {
|
|
50
50
|
let e = H.current?.querySelector(".ssg-menu-item:not(:disabled)");
|
|
51
51
|
return e?.focus(), e != null;
|
|
52
52
|
};
|
|
53
53
|
if (a(() => {
|
|
54
|
-
if (B !==
|
|
54
|
+
if (B !== b) return;
|
|
55
55
|
let e = H.current;
|
|
56
56
|
e?.classList.contains("ssg-menu-subgroup") && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" }), q.current && (q.current = !1, J());
|
|
57
|
-
}, [B]), !t || !
|
|
58
|
-
let Y = B ===
|
|
57
|
+
}, [B]), !t || !k || !U) return null;
|
|
58
|
+
let Y = B === b, X = k.maxHeight !== void 0, Z = () => {
|
|
59
59
|
X || V(null);
|
|
60
|
-
}, Q =
|
|
60
|
+
}, Q = k.left + k.width + v + _ > window.innerWidth - y, $ = Q && k.left - v - _ < y ? Math.max(y, Math.min(window.innerWidth - y - _, k.left - v - _)) - (k.left + 9) : void 0, ce = {
|
|
61
61
|
position: "fixed",
|
|
62
|
-
top:
|
|
63
|
-
left:
|
|
64
|
-
width:
|
|
62
|
+
top: k.top,
|
|
63
|
+
left: k.left,
|
|
64
|
+
width: k.width,
|
|
65
65
|
zIndex: 1e3,
|
|
66
|
-
...
|
|
67
|
-
maxHeight:
|
|
66
|
+
...k.maxHeight === void 0 ? {} : {
|
|
67
|
+
maxHeight: k.maxHeight,
|
|
68
68
|
overflowY: "auto"
|
|
69
69
|
}
|
|
70
|
-
},
|
|
70
|
+
}, le = {
|
|
71
71
|
position: "absolute",
|
|
72
72
|
top: -9,
|
|
73
|
-
...$ === void 0 ? Q ? { right: `calc(100% + ${
|
|
74
|
-
width:
|
|
73
|
+
...$ === void 0 ? Q ? { right: `calc(100% + ${v}px)` } : { left: `calc(100% + ${v}px)` } : { left: $ },
|
|
74
|
+
width: _,
|
|
75
75
|
zIndex: 1
|
|
76
76
|
};
|
|
77
77
|
return te(/* @__PURE__ */ p("div", {
|
|
78
|
-
ref:
|
|
78
|
+
ref: A,
|
|
79
79
|
onPointerDown: (e) => {
|
|
80
80
|
e.stopPropagation();
|
|
81
81
|
},
|
|
@@ -91,7 +91,7 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
91
91
|
className: u("ssg-menu-panel", s, l?.popover?.className),
|
|
92
92
|
style: {
|
|
93
93
|
...l?.popover?.style,
|
|
94
|
-
...
|
|
94
|
+
...ce
|
|
95
95
|
},
|
|
96
96
|
children: [
|
|
97
97
|
/* @__PURE__ */ f("div", {
|
|
@@ -99,12 +99,29 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
99
99
|
"aria-hidden": "true",
|
|
100
100
|
children: m
|
|
101
101
|
}),
|
|
102
|
+
R && L && L.length > 0 && /* @__PURE__ */ p(d, { children: [L.map((e) => /* @__PURE__ */ p("button", {
|
|
103
|
+
type: "button",
|
|
104
|
+
role: "menuitem",
|
|
105
|
+
onPointerEnter: Z,
|
|
106
|
+
onClick: () => {
|
|
107
|
+
R(e.key, !e.open);
|
|
108
|
+
},
|
|
109
|
+
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
110
|
+
style: l?.menuItem?.style,
|
|
111
|
+
children: [/* @__PURE__ */ f("span", { className: "ssg-menu-icon" }), /* @__PURE__ */ f("span", {
|
|
112
|
+
className: "ssg-menu-label",
|
|
113
|
+
children: e.label
|
|
114
|
+
})]
|
|
115
|
+
}, e.key)), /* @__PURE__ */ f("div", {
|
|
116
|
+
role: "separator",
|
|
117
|
+
className: "ssg-menu-separator"
|
|
118
|
+
})] }),
|
|
102
119
|
g && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("button", {
|
|
103
120
|
type: "button",
|
|
104
121
|
role: "menuitem",
|
|
105
122
|
onPointerEnter: Z,
|
|
106
123
|
onClick: () => {
|
|
107
|
-
|
|
124
|
+
x();
|
|
108
125
|
},
|
|
109
126
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
110
127
|
style: l?.menuItem?.style,
|
|
@@ -116,23 +133,23 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
116
133
|
role: "separator",
|
|
117
134
|
className: "ssg-menu-separator"
|
|
118
135
|
})] }),
|
|
119
|
-
|
|
136
|
+
S && /* @__PURE__ */ p(d, { children: [
|
|
120
137
|
/* @__PURE__ */ p("button", {
|
|
121
138
|
type: "button",
|
|
122
139
|
onPointerEnter: Z,
|
|
123
140
|
onClick: () => {
|
|
124
|
-
|
|
141
|
+
w("asc");
|
|
125
142
|
},
|
|
126
143
|
role: "menuitemradio",
|
|
127
|
-
"aria-checked":
|
|
144
|
+
"aria-checked": C === "asc",
|
|
128
145
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
129
146
|
style: l?.menuItem?.style,
|
|
130
147
|
children: [/* @__PURE__ */ f("span", {
|
|
131
|
-
className: u("ssg-menu-sort-icon",
|
|
148
|
+
className: u("ssg-menu-sort-icon", C === "asc" && "ssg-menu-sort-icon--active"),
|
|
132
149
|
"aria-hidden": "true",
|
|
133
|
-
children:
|
|
150
|
+
children: C === "asc" ? "✓" : "↑"
|
|
134
151
|
}), /* @__PURE__ */ f("span", {
|
|
135
|
-
className: u("ssg-menu-label",
|
|
152
|
+
className: u("ssg-menu-label", C === "asc" && "ssg-menu-label--sorted"),
|
|
136
153
|
children: z.menuSortAscending
|
|
137
154
|
})]
|
|
138
155
|
}),
|
|
@@ -140,27 +157,27 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
140
157
|
type: "button",
|
|
141
158
|
onPointerEnter: Z,
|
|
142
159
|
onClick: () => {
|
|
143
|
-
|
|
160
|
+
w("desc");
|
|
144
161
|
},
|
|
145
162
|
role: "menuitemradio",
|
|
146
|
-
"aria-checked":
|
|
163
|
+
"aria-checked": C === "desc",
|
|
147
164
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
148
165
|
style: l?.menuItem?.style,
|
|
149
166
|
children: [/* @__PURE__ */ f("span", {
|
|
150
|
-
className: u("ssg-menu-sort-icon",
|
|
167
|
+
className: u("ssg-menu-sort-icon", C === "desc" && "ssg-menu-sort-icon--active"),
|
|
151
168
|
"aria-hidden": "true",
|
|
152
|
-
children:
|
|
169
|
+
children: C === "desc" ? "✓" : "↓"
|
|
153
170
|
}), /* @__PURE__ */ f("span", {
|
|
154
|
-
className: u("ssg-menu-label",
|
|
171
|
+
className: u("ssg-menu-label", C === "desc" && "ssg-menu-label--sorted"),
|
|
155
172
|
children: z.menuSortDescending
|
|
156
173
|
})]
|
|
157
174
|
}),
|
|
158
|
-
|
|
175
|
+
T && /* @__PURE__ */ p("button", {
|
|
159
176
|
type: "button",
|
|
160
177
|
role: "menuitem",
|
|
161
178
|
onPointerEnter: Z,
|
|
162
179
|
onClick: () => {
|
|
163
|
-
|
|
180
|
+
T();
|
|
164
181
|
},
|
|
165
182
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
166
183
|
style: l?.menuItem?.style,
|
|
@@ -170,12 +187,12 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
170
187
|
})]
|
|
171
188
|
})
|
|
172
189
|
] }),
|
|
173
|
-
|
|
190
|
+
E && D && /* @__PURE__ */ p("button", {
|
|
174
191
|
type: "button",
|
|
175
192
|
role: "menuitem",
|
|
176
193
|
onPointerEnter: Z,
|
|
177
194
|
onClick: () => {
|
|
178
|
-
|
|
195
|
+
D();
|
|
179
196
|
},
|
|
180
197
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
181
198
|
style: l?.menuItem?.style,
|
|
@@ -184,16 +201,16 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
184
201
|
children: z.menuManageFilters
|
|
185
202
|
})]
|
|
186
203
|
}),
|
|
187
|
-
(
|
|
204
|
+
(S || E && D !== void 0) && /* @__PURE__ */ f("div", {
|
|
188
205
|
role: "separator",
|
|
189
206
|
className: "ssg-menu-separator"
|
|
190
207
|
}),
|
|
191
|
-
|
|
208
|
+
F && /* @__PURE__ */ p("button", {
|
|
192
209
|
type: "button",
|
|
193
210
|
role: "menuitem",
|
|
194
211
|
onPointerEnter: Z,
|
|
195
212
|
onClick: () => {
|
|
196
|
-
|
|
213
|
+
F();
|
|
197
214
|
},
|
|
198
215
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
199
216
|
style: l?.menuItem?.style,
|
|
@@ -202,12 +219,12 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
202
219
|
children: z.menuGroupBy
|
|
203
220
|
})]
|
|
204
221
|
}),
|
|
205
|
-
|
|
222
|
+
I && /* @__PURE__ */ p("button", {
|
|
206
223
|
type: "button",
|
|
207
224
|
role: "menuitem",
|
|
208
225
|
onPointerEnter: Z,
|
|
209
226
|
onClick: () => {
|
|
210
|
-
|
|
227
|
+
I();
|
|
211
228
|
},
|
|
212
229
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
213
230
|
style: l?.menuItem?.style,
|
|
@@ -216,7 +233,7 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
216
233
|
children: z.menuUngroup
|
|
217
234
|
})]
|
|
218
235
|
}),
|
|
219
|
-
(
|
|
236
|
+
(F || I) && /* @__PURE__ */ f("div", {
|
|
220
237
|
role: "separator",
|
|
221
238
|
className: "ssg-menu-separator"
|
|
222
239
|
}),
|
|
@@ -230,7 +247,7 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
230
247
|
"aria-haspopup": "menu",
|
|
231
248
|
"aria-expanded": Y,
|
|
232
249
|
onPointerEnter: (e) => {
|
|
233
|
-
e.pointerType === "mouse" && !X && V(
|
|
250
|
+
e.pointerType === "mouse" && !X && V(b);
|
|
234
251
|
},
|
|
235
252
|
onClick: (e) => {
|
|
236
253
|
if (e.detail === 0) {
|
|
@@ -247,14 +264,14 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
247
264
|
x: e.clientX,
|
|
248
265
|
y: e.clientY,
|
|
249
266
|
at: e.timeStamp
|
|
250
|
-
} : null, V(
|
|
267
|
+
} : null, V(b);
|
|
251
268
|
},
|
|
252
269
|
onKeyDown: (e) => {
|
|
253
270
|
if (e.key === "ArrowLeft" && X && Y) {
|
|
254
271
|
e.preventDefault(), V(null);
|
|
255
272
|
return;
|
|
256
273
|
}
|
|
257
|
-
e.key === "ArrowRight" && (e.preventDefault(), Y ? J() : (q.current = !0, V(
|
|
274
|
+
e.key === "ArrowRight" && (e.preventDefault(), Y ? J() : (q.current = !0, V(b)));
|
|
258
275
|
},
|
|
259
276
|
className: u("ssg-menu-item", Y && "ssg-menu-item--active", l?.menuItem?.className),
|
|
260
277
|
style: l?.menuItem?.style,
|
|
@@ -277,21 +294,21 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
277
294
|
className: X ? "ssg-menu-subgroup" : u("ssg-menu-panel", s, l?.popover?.className),
|
|
278
295
|
style: X ? void 0 : {
|
|
279
296
|
...l?.popover?.style,
|
|
280
|
-
...
|
|
297
|
+
...le
|
|
281
298
|
},
|
|
282
299
|
onKeyDown: (e) => {
|
|
283
300
|
e.key === "ArrowLeft" && (e.preventDefault(), V(null), W.current?.focus());
|
|
284
301
|
},
|
|
285
|
-
children: [
|
|
286
|
-
let t =
|
|
302
|
+
children: [ne.map((e) => {
|
|
303
|
+
let t = ie === e.value;
|
|
287
304
|
return /* @__PURE__ */ p("button", {
|
|
288
305
|
type: "button",
|
|
289
|
-
disabled: !
|
|
306
|
+
disabled: !O,
|
|
290
307
|
role: "menuitemradio",
|
|
291
308
|
"aria-checked": t,
|
|
292
|
-
"aria-describedby":
|
|
309
|
+
"aria-describedby": O ? void 0 : K,
|
|
293
310
|
onClick: (t) => {
|
|
294
|
-
!
|
|
311
|
+
!O || X && re(G.current, t) || ae(h, e.value);
|
|
295
312
|
},
|
|
296
313
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
297
314
|
style: l?.menuItem?.style,
|
|
@@ -304,7 +321,7 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
304
321
|
children: z[e.label]
|
|
305
322
|
})]
|
|
306
323
|
}, e.label);
|
|
307
|
-
}), !
|
|
324
|
+
}), !O && /* @__PURE__ */ f("div", {
|
|
308
325
|
id: K,
|
|
309
326
|
role: "none",
|
|
310
327
|
className: "ssg-menu-note",
|
|
@@ -312,12 +329,12 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
312
329
|
})]
|
|
313
330
|
})]
|
|
314
331
|
}),
|
|
315
|
-
|
|
332
|
+
j && M && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("button", {
|
|
316
333
|
type: "button",
|
|
317
334
|
role: "menuitem",
|
|
318
335
|
onPointerEnter: Z,
|
|
319
336
|
onClick: () => {
|
|
320
|
-
|
|
337
|
+
j(h);
|
|
321
338
|
},
|
|
322
339
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
323
340
|
style: l?.menuItem?.style,
|
|
@@ -330,7 +347,7 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
330
347
|
role: "menuitem",
|
|
331
348
|
onPointerEnter: Z,
|
|
332
349
|
onClick: () => {
|
|
333
|
-
|
|
350
|
+
M();
|
|
334
351
|
},
|
|
335
352
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
336
353
|
style: l?.menuItem?.style,
|
|
@@ -339,12 +356,12 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
339
356
|
children: z.menuAutosizeAll
|
|
340
357
|
})]
|
|
341
358
|
})] }),
|
|
342
|
-
|
|
359
|
+
N && /* @__PURE__ */ p("button", {
|
|
343
360
|
type: "button",
|
|
344
361
|
role: "menuitem",
|
|
345
362
|
onPointerEnter: Z,
|
|
346
363
|
onClick: () => {
|
|
347
|
-
|
|
364
|
+
N();
|
|
348
365
|
},
|
|
349
366
|
className: u("ssg-menu-item", l?.menuItem?.className),
|
|
350
367
|
style: l?.menuItem?.style,
|
|
@@ -356,14 +373,14 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
356
373
|
/* @__PURE__ */ p("button", {
|
|
357
374
|
type: "button",
|
|
358
375
|
role: "menuitem",
|
|
359
|
-
"aria-disabled": !
|
|
360
|
-
tabIndex:
|
|
361
|
-
"data-ssg-tooltip":
|
|
376
|
+
"aria-disabled": !P,
|
|
377
|
+
tabIndex: P ? 0 : -1,
|
|
378
|
+
"data-ssg-tooltip": P ? z.resetColumnsHint : z.menuResetUnavailable,
|
|
362
379
|
onPointerEnter: Z,
|
|
363
380
|
onClick: () => {
|
|
364
|
-
|
|
381
|
+
P && oe();
|
|
365
382
|
},
|
|
366
|
-
className: u("ssg-menu-item", !
|
|
383
|
+
className: u("ssg-menu-item", !P && "ssg-menu-item--disabled", l?.menuItem?.className),
|
|
367
384
|
style: l?.menuItem?.style,
|
|
368
385
|
children: [/* @__PURE__ */ f("span", { className: "ssg-menu-icon" }), /* @__PURE__ */ f("span", {
|
|
369
386
|
className: "ssg-menu-label",
|
|
@@ -376,7 +393,7 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
376
393
|
children: /* @__PURE__ */ f("button", {
|
|
377
394
|
type: "button",
|
|
378
395
|
role: "menuitem",
|
|
379
|
-
onClick:
|
|
396
|
+
onClick: se,
|
|
380
397
|
className: "ssg-menu-close-btn",
|
|
381
398
|
children: z.close
|
|
382
399
|
})
|
|
@@ -384,13 +401,13 @@ function w({ isOpen: t, themeClassName: s, slots: l, title: m, columnKey: h, can
|
|
|
384
401
|
]
|
|
385
402
|
}), U);
|
|
386
403
|
}
|
|
387
|
-
var
|
|
404
|
+
var w = {
|
|
388
405
|
useColumnMenu: (e) => ({
|
|
389
406
|
available: !0,
|
|
390
407
|
...g(e)
|
|
391
408
|
}),
|
|
392
|
-
ColumnMenuPopover:
|
|
409
|
+
ColumnMenuPopover: C,
|
|
393
410
|
localeText: h
|
|
394
411
|
};
|
|
395
412
|
//#endregion
|
|
396
|
-
export {
|
|
413
|
+
export { w as t };
|
|
@@ -0,0 +1 @@
|
|
|
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}},ee=[{value:void 0,label:`menuPinNone`},{value:`left`,label:`menuPinLeft`},{value:`right`,label:`menuPinRight`}],u=180,d=4,f=8,p=`pin`,m=500,h=24,g=(e,t)=>e!==null&&t.detail>0&&t.timeStamp-e.at<m&&Math.abs(t.clientX-e.x)<=h&&Math.abs(t.clientY-e.y)<=h;function _({isOpen:s,themeClassName:c,slots:l,title:m,columnKey:h,canFilter:_,onOpenFilter:v,canSort:y,sortDirection:b,onSortChange:x,onOpenSortManager:S,canManageFilters:C,onOpenFilterManager:w,pinned:T,canChangePinned:E,layout:D,popoverRef:O,onPinnedChange:te,onAutosizeColumn:k,onAutosizeAllColumns:A,onOpenColumnChooser:j,canResetColumns:M,onResetColumns:N,onGroupByColumn:P,onUngroup:F,columnGroupToggles:I,onToggleColumnGroup:L,onRequestClose:R}){let z=n.r(),[B,V]=(0,r.useState)(null);(0,r.useEffect)(()=>{V(null)},[h,s]),e.r(()=>{let e=O.current;e&&(e.scrollTop=0)},[h,O]),t.i(O,s&&D!==null,c,{layout:D});let H=(0,r.useRef)(null);t.i(H,s&&D!==null&&B===p&&D.maxHeight===void 0,c,{origin:!1});let U=t.r(s&&D!==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!==p)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||!D||!U)return null;let Y=B===p,X=D.maxHeight!==void 0,Z=()=>{X||V(null)},Q=D.left+D.width+d+u>window.innerWidth-f,$=Q&&D.left-d-u<f?Math.max(f,Math.min(window.innerWidth-f-u,D.left-d-u))-(D.left+9):void 0,ne={position:`fixed`,top:D.top,left:D.left,width:D.width,zIndex:1e3,...D.maxHeight===void 0?{}:{maxHeight:D.maxHeight,overflowY:`auto`}},re={position:`absolute`,top:-9,...$===void 0?Q?{right:`calc(100% + ${d}px)`}:{left:`calc(100% + ${d}px)`}:{left:$},width:u,zIndex:1};return(0,a.createPortal)((0,o.jsxs)(`div`,{ref:O,onPointerDown:e=>{e.stopPropagation()},onKeyDown:e=>{e.stopPropagation()},onContextMenu:e=>{e.preventDefault()},role:`menu`,"aria-label":m,tabIndex:-1,className:(0,i.cx)(`ssg-menu-panel`,c,l?.popover?.className),style:{...l?.popover?.style,...ne},children:[(0,o.jsx)(`div`,{className:`ssg-menu-title`,"aria-hidden":`true`,children:m}),L&&I&&I.length>0&&(0,o.jsxs)(o.Fragment,{children:[I.map(e=>(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{L(e.key,!e.open)},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:e.label})]},e.key)),(0,o.jsx)(`div`,{role:`separator`,className:`ssg-menu-separator`})]}),_&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{v()},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`})]}),y&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,onPointerEnter:Z,onClick:()=>{x(`asc`)},role:`menuitemradio`,"aria-checked":b===`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`,b===`asc`&&`ssg-menu-sort-icon--active`),"aria-hidden":`true`,children:b===`asc`?`✓`:`↑`}),(0,o.jsx)(`span`,{className:(0,i.cx)(`ssg-menu-label`,b===`asc`&&`ssg-menu-label--sorted`),children:z.menuSortAscending})]}),(0,o.jsxs)(`button`,{type:`button`,onPointerEnter:Z,onClick:()=>{x(`desc`)},role:`menuitemradio`,"aria-checked":b===`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`,b===`desc`&&`ssg-menu-sort-icon--active`),"aria-hidden":`true`,children:b===`desc`?`✓`:`↓`}),(0,o.jsx)(`span`,{className:(0,i.cx)(`ssg-menu-label`,b===`desc`&&`ssg-menu-label--sorted`),children:z.menuSortDescending})]}),S&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{S()},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})]})]}),C&&w&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{w()},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})]}),(y||C&&w!==void 0)&&(0,o.jsx)(`div`,{role:`separator`,className:`ssg-menu-separator`}),P&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{P()},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})]}),F&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{F()},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})]}),(P||F)&&(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(p)},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(p)},onKeyDown:e=>{if(e.key===`ArrowLeft`&&X&&Y){e.preventDefault(),V(null);return}e.key===`ArrowRight`&&(e.preventDefault(),Y?J():(q.current=!0,V(p)))},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,...re},onKeyDown:e=>{e.key===`ArrowLeft`&&(e.preventDefault(),V(null),W.current?.focus())},children:[ee.map(e=>{let t=T===e.value;return(0,o.jsxs)(`button`,{type:`button`,disabled:!E,role:`menuitemradio`,"aria-checked":t,"aria-describedby":E?void 0:K,onClick:t=>{!E||X&&g(G.current,t)||te(h,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)}),!E&&(0,o.jsx)(`div`,{id:K,role:`none`,className:`ssg-menu-note`,children:z.menuPinUnavailable})]})]}),k&&A&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{k(h)},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:()=>{A()},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})]})]}),j&&(0,o.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:Z,onClick:()=>{j()},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":!M,tabIndex:M?0:-1,"data-ssg-tooltip":M?z.resetColumnsHint:z.menuResetUnavailable,onPointerEnter:Z,onClick:()=>{M&&N()},className:(0,i.cx)(`ssg-menu-item`,!M&&`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 v={useColumnMenu:e=>({available:!0,...l(e)}),ColumnMenuPopover:_,localeText:c.DEFAULT_COLUMN_MENU_LOCALE_TEXT};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
|
|
@@ -12,17 +12,19 @@ var a = (e) => {
|
|
|
12
12
|
});
|
|
13
13
|
return {
|
|
14
14
|
onColumnDragHandlePointerDown: s.onColumnDragHandlePointerDown,
|
|
15
|
+
onColumnGroupDragHandlePointerDown: s.onColumnGroupDragHandlePointerDown,
|
|
15
16
|
leftIndicatorRef: r,
|
|
16
17
|
centerIndicatorRef: a,
|
|
17
18
|
rightIndicatorRef: o,
|
|
18
19
|
applyReorderSettle: s.applyReorderSettle
|
|
19
20
|
};
|
|
20
21
|
}, o = { useColumnReorder: (t) => {
|
|
21
|
-
let { onColumnDragHandlePointerDown: n, leftIndicatorRef: i, centerIndicatorRef: o, rightIndicatorRef: s, applyReorderSettle: c } = a(t), { paneLayout:
|
|
22
|
+
let { onColumnDragHandlePointerDown: n, leftIndicatorRef: i, centerIndicatorRef: o, rightIndicatorRef: s, applyReorderSettle: c, onColumnGroupDragHandlePointerDown: l } = a(t), { paneLayout: u } = t;
|
|
22
23
|
return e(() => {
|
|
23
24
|
c();
|
|
24
|
-
}, [
|
|
25
|
+
}, [u, c]), {
|
|
25
26
|
onColumnDragHandlePointerDown: n,
|
|
27
|
+
onColumnGroupDragHandlePointerDown: l,
|
|
26
28
|
renderDropIndicator: (e, t) => /* @__PURE__ */ r("div", {
|
|
27
29
|
ref: e === "left" ? i : e === "center" ? o : s,
|
|
28
30
|
className: "ssg-col-drop-indicator",
|
|
@@ -0,0 +1 @@
|
|
|
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,onColumnGroupDragHandlePointerDown:s.onColumnGroupDragHandlePointerDown,leftIndicatorRef:i,centerIndicatorRef:a,rightIndicatorRef:o,applyReorderSettle:s.applyReorderSettle}},a={useColumnReorder:t=>{let{onColumnDragHandlePointerDown:r,leftIndicatorRef:a,centerIndicatorRef:o,rightIndicatorRef:s,applyReorderSettle:c,onColumnGroupDragHandlePointerDown:l}=i(t),{paneLayout:u}=t;return e.r(()=>{c()},[u,c]),{onColumnDragHandlePointerDown:r,onColumnGroupDragHandlePointerDown:l,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}});
|