@ishibashi0112/spreadsheet-grid 1.2.1 → 1.3.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 +69 -23
- package/README.md +2 -2
- package/dist/CellEditorLayer.d.ts +2 -1
- package/dist/ColumnFilterPopover-BkvL8LdP.js +1062 -0
- package/dist/ColumnFilterPopover-cNVxOkoI.cjs +1 -0
- package/dist/editors/CustomCellEditor.d.ts +3 -2
- package/dist/editors/DateCellEditor.d.ts +2 -1
- package/dist/editors/NumberCellEditor.d.ts +2 -1
- package/dist/editors/SelectCellEditor.d.ts +5 -2
- package/dist/editors/TextCellEditor.d.ts +2 -1
- package/dist/hooks/useGridEditController.d.ts +1 -0
- package/dist/hooks/useGridTooltip.d.ts +3 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +2758 -2790
- package/dist/lite/ColumnFilterPopover-BXsxUZ-l.cjs +1 -0
- package/dist/lite/ColumnFilterPopover-DGBKLT_x.js +1063 -0
- package/dist/lite/contextMenu-C_EUynb4.cjs +1 -0
- package/dist/lite/contextMenu-Cb9KT0FS.js +109 -0
- package/dist/lite/createSpreadsheetGrid-CJinhQgY.js +4353 -0
- package/dist/lite/createSpreadsheetGrid-CQDpzjaZ.cjs +6 -0
- package/dist/lite/createSpreadsheetGrid.cjs +1 -1
- package/dist/lite/createSpreadsheetGrid.js +1 -1
- package/dist/lite/features/contextMenu.cjs +1 -1
- package/dist/lite/features/contextMenu.js +1 -1
- package/dist/lite/features/fillHandle.cjs +1 -1
- package/dist/lite/features/fillHandle.js +1 -1
- package/dist/lite/features/filtering.cjs +1 -1
- package/dist/lite/features/filtering.js +1 -1
- package/dist/lite/features/rowDrag.cjs +1 -1
- package/dist/lite/features/rowDrag.js +1 -1
- package/dist/lite/features/standard.cjs +1 -1
- package/dist/lite/features/standard.js +2 -2
- package/dist/lite/features/toolPanel.cjs +1 -1
- package/dist/lite/features/toolPanel.js +1 -1
- package/dist/lite/fillHandle-4pow6QTn.cjs +1 -0
- package/dist/lite/{fillHandle-CzA_uxgV.js → fillHandle-pS7c7vQ2.js} +30 -29
- package/dist/lite/{filtering-ReroATyh.js → filtering-BGPDN-wq.js} +2 -2
- package/dist/lite/{filtering-DDIQnB3a.cjs → filtering-BKaFSWIN.cjs} +1 -1
- package/dist/lite/{lazyPopups-C7Y7Kx8w.js → lazyPopups-CeNdPYJh.js} +1 -1
- package/dist/lite/{lazyPopups-B0DhlAYW.cjs → lazyPopups-Czv43vuQ.cjs} +1 -1
- package/dist/lite/rowDrag-Bb1xlVXa.cjs +1 -0
- package/dist/lite/rowDrag-Dvg4JlGR.js +115 -0
- package/dist/lite/{toolPanel-H94h6g2U.cjs → toolPanel-BVq7WR1O.cjs} +1 -1
- package/dist/lite/{toolPanel-DXG3w8Zp.js → toolPanel-CsBenuFQ.js} +1 -1
- package/dist/lite/toolPanelViews-8HccPGgN.cjs +1 -0
- package/dist/lite/{toolPanelViews-DwUa6rm1.js → toolPanelViews-uCxtFwWO.js} +139 -138
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +7 -7
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/toolPanelViews-BJi7W0Tz.cjs +1 -0
- package/dist/{toolPanelViews-DCpqVIEd.js → toolPanelViews-Dsp5WVVa.js} +139 -138
- package/dist/view/DetailToggleButton.d.ts +2 -1
- package/package.json +2 -2
- package/dist/ColumnFilterPopover-BEZ0T7Qo.cjs +0 -1
- package/dist/ColumnFilterPopover-CnocXZZn.js +0 -1056
- package/dist/lite/ColumnFilterPopover-BUCdIETo.cjs +0 -1
- package/dist/lite/ColumnFilterPopover-ulqfKfmD.js +0 -1056
- package/dist/lite/contextMenu-B6cpSlFr.js +0 -168
- package/dist/lite/contextMenu-VLz_wVlY.cjs +0 -1
- package/dist/lite/createSpreadsheetGrid-BxaYty_c.js +0 -4290
- package/dist/lite/createSpreadsheetGrid-CfUnI6Xl.cjs +0 -6
- package/dist/lite/fillHandle-CHJESnrk.cjs +0 -1
- package/dist/lite/rowDrag-D17wXvSj.cjs +0 -1
- package/dist/lite/rowDrag-WVJUKKL8.js +0 -157
- package/dist/lite/toolPanelViews-C4qswcP_.cjs +0 -1
- package/dist/toolPanelViews-CKKThiAQ.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./useController-Zlv7BRoY.cjs"),t=require("./usePortalTokens-CUAiwfmK.cjs");let n=require("react"),r=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/cx"),i=require("react-dom"),a=require("react/jsx-runtime"),o=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures"),s=require("@ishibashi0112/spreadsheet-grid-core/internal/controllers/contextMenuController"),c=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/contextMenuTarget");function l({isOpen:e,themeClassName:n,slots:o,items:s,layout:c,popoverRef:l,onRequestClose:u,ariaLabel:d}){t.i(l,e&&c!==null,n,{layout:c});let f=t.r(e&&c!==null);if(!e||!c||!f)return null;let p={position:`fixed`,top:c.top,left:c.left,width:c.width,zIndex:1e3,...c.maxHeight===void 0?null:{maxHeight:c.maxHeight,overflowY:`auto`}};return(0,i.createPortal)((0,a.jsx)(`div`,{ref:l,role:`menu`,"aria-label":d,tabIndex:-1,onPointerDown:e=>{e.stopPropagation()},onKeyDown:e=>{e.stopPropagation()},onContextMenu:e=>{e.preventDefault()},className:(0,r.cx)(`ssg-menu-panel`,n,o?.popover?.className),style:{...o?.popover?.style,...p},children:s.map((e,t)=>e.kind===`separator`?(0,a.jsx)(`div`,{role:`separator`,className:`ssg-menu-separator`},e.id??`sep-${t}`):e.kind===`label`?(0,a.jsx)(`div`,{className:`ssg-menu-section-label`,role:`presentation`,children:e.label},e.id??`label-${t}`):e.kind===`custom`?(0,a.jsx)(`div`,{role:`none`,children:e.render({close:u})},e.id??`custom-${t}`):(0,a.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,onClick:()=>{e.onSelect(),u()},className:(0,r.cx)(`ssg-menu-item`,e.danger&&`ssg-menu-item--danger`,e.disabled&&`ssg-menu-item--disabled`,o?.menuItem?.className),style:o?.menuItem?.style,children:[(0,a.jsx)(`span`,{className:`ssg-menu-icon`,children:e.icon}),(0,a.jsx)(`span`,{className:`ssg-menu-label`,children:e.label})]},e.id??`action-${t}`))}),f)}var u=({gridRootRef:t})=>{let r=e.t(()=>(0,s.createContextMenuController)(),{gridRootRef:t}),i=(0,n.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot),a=i.layout;return{contextMenuState:i.state,contextMenuLayout:a,contextMenuRef:r.panelRef,isContextMenuOpen:i.state!==null,openContextMenu:r.open,closeContextMenu:r.close}},d=[],f={localeText:o.DEFAULT_CONTEXT_MENU_LOCALE_TEXT,useCellContextMenu:({gridRootRef:e,localeTexts:t})=>{let{contextMenuState:n,contextMenuLayout:r,contextMenuRef:i,isContextMenuOpen:o,openContextMenu:s,closeContextMenu:c}=u({gridRootRef:e});return{isContextMenuOpen:o,openContextMenu:s,renderContextMenuPopover:(e,s)=>(0,a.jsx)(l,{slots:e,themeClassName:s,isOpen:o,items:n?.items??d,layout:r,popoverRef:i,onRequestClose:c,ariaLabel:n?.params.target.type===`rowHeader`?t.contextMenuRow:t.contextMenuCell})}},buildBodyContextMenuParams:c.buildBodyContextMenuParams,buildCellContextMenuParams:c.buildCellContextMenuParams};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { t as e } from "./useController-zuzvTNo5.js";
|
|
2
|
+
import { i as t, r as n } from "./usePortalTokens-hsX2T3ep.js";
|
|
3
|
+
import { useSyncExternalStore as r } from "react";
|
|
4
|
+
import { cx as i } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cx";
|
|
5
|
+
import { createPortal as a } from "react-dom";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import { DEFAULT_CONTEXT_MENU_LOCALE_TEXT as c } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
8
|
+
import { createContextMenuController as l } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/contextMenuController";
|
|
9
|
+
import { buildBodyContextMenuParams as u, buildCellContextMenuParams as d } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/contextMenuTarget";
|
|
10
|
+
//#region src/view/CellContextMenuPopover.tsx
|
|
11
|
+
function f({ isOpen: e, themeClassName: r, slots: c, items: l, layout: u, popoverRef: d, onRequestClose: f, ariaLabel: p }) {
|
|
12
|
+
t(d, e && u !== null, r, { layout: u });
|
|
13
|
+
let m = n(e && u !== null);
|
|
14
|
+
if (!e || !u || !m) return null;
|
|
15
|
+
let h = {
|
|
16
|
+
position: "fixed",
|
|
17
|
+
top: u.top,
|
|
18
|
+
left: u.left,
|
|
19
|
+
width: u.width,
|
|
20
|
+
zIndex: 1e3,
|
|
21
|
+
...u.maxHeight === void 0 ? null : {
|
|
22
|
+
maxHeight: u.maxHeight,
|
|
23
|
+
overflowY: "auto"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return a(/* @__PURE__ */ o("div", {
|
|
27
|
+
ref: d,
|
|
28
|
+
role: "menu",
|
|
29
|
+
"aria-label": p,
|
|
30
|
+
tabIndex: -1,
|
|
31
|
+
onPointerDown: (e) => {
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
},
|
|
34
|
+
onKeyDown: (e) => {
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
},
|
|
37
|
+
onContextMenu: (e) => {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
},
|
|
40
|
+
className: i("ssg-menu-panel", r, c?.popover?.className),
|
|
41
|
+
style: {
|
|
42
|
+
...c?.popover?.style,
|
|
43
|
+
...h
|
|
44
|
+
},
|
|
45
|
+
children: l.map((e, t) => e.kind === "separator" ? /* @__PURE__ */ o("div", {
|
|
46
|
+
role: "separator",
|
|
47
|
+
className: "ssg-menu-separator"
|
|
48
|
+
}, e.id ?? `sep-${t}`) : e.kind === "label" ? /* @__PURE__ */ o("div", {
|
|
49
|
+
className: "ssg-menu-section-label",
|
|
50
|
+
role: "presentation",
|
|
51
|
+
children: e.label
|
|
52
|
+
}, e.id ?? `label-${t}`) : e.kind === "custom" ? /* @__PURE__ */ o("div", {
|
|
53
|
+
role: "none",
|
|
54
|
+
children: e.render({ close: f })
|
|
55
|
+
}, e.id ?? `custom-${t}`) : /* @__PURE__ */ s("button", {
|
|
56
|
+
type: "button",
|
|
57
|
+
role: "menuitem",
|
|
58
|
+
disabled: e.disabled,
|
|
59
|
+
onClick: () => {
|
|
60
|
+
e.onSelect(), f();
|
|
61
|
+
},
|
|
62
|
+
className: i("ssg-menu-item", e.danger && "ssg-menu-item--danger", e.disabled && "ssg-menu-item--disabled", c?.menuItem?.className),
|
|
63
|
+
style: c?.menuItem?.style,
|
|
64
|
+
children: [/* @__PURE__ */ o("span", {
|
|
65
|
+
className: "ssg-menu-icon",
|
|
66
|
+
children: e.icon
|
|
67
|
+
}), /* @__PURE__ */ o("span", {
|
|
68
|
+
className: "ssg-menu-label",
|
|
69
|
+
children: e.label
|
|
70
|
+
})]
|
|
71
|
+
}, e.id ?? `action-${t}`))
|
|
72
|
+
}), m);
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/hooks/useCellContextMenuController.ts
|
|
76
|
+
var p = ({ gridRootRef: t }) => {
|
|
77
|
+
let n = e(() => l(), { gridRootRef: t }), i = r(n.subscribe, n.getSnapshot, n.getSnapshot), a = i.layout;
|
|
78
|
+
return {
|
|
79
|
+
contextMenuState: i.state,
|
|
80
|
+
contextMenuLayout: a,
|
|
81
|
+
contextMenuRef: n.panelRef,
|
|
82
|
+
isContextMenuOpen: i.state !== null,
|
|
83
|
+
openContextMenu: n.open,
|
|
84
|
+
closeContextMenu: n.close
|
|
85
|
+
};
|
|
86
|
+
}, m = [], h = {
|
|
87
|
+
localeText: c,
|
|
88
|
+
useCellContextMenu: ({ gridRootRef: e, localeTexts: t }) => {
|
|
89
|
+
let { contextMenuState: n, contextMenuLayout: r, contextMenuRef: i, isContextMenuOpen: a, openContextMenu: s, closeContextMenu: c } = p({ gridRootRef: e });
|
|
90
|
+
return {
|
|
91
|
+
isContextMenuOpen: a,
|
|
92
|
+
openContextMenu: s,
|
|
93
|
+
renderContextMenuPopover: (e, s) => /* @__PURE__ */ o(f, {
|
|
94
|
+
slots: e,
|
|
95
|
+
themeClassName: s,
|
|
96
|
+
isOpen: a,
|
|
97
|
+
items: n?.items ?? m,
|
|
98
|
+
layout: r,
|
|
99
|
+
popoverRef: i,
|
|
100
|
+
onRequestClose: c,
|
|
101
|
+
ariaLabel: n?.params.target.type === "rowHeader" ? t.contextMenuRow : t.contextMenuCell
|
|
102
|
+
})
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
buildBodyContextMenuParams: u,
|
|
106
|
+
buildCellContextMenuParams: d
|
|
107
|
+
};
|
|
108
|
+
//#endregion
|
|
109
|
+
export { h as t };
|