@particle-academy/fancy-sheets 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +21 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2039,6 +2039,26 @@ function tsvToCells(tsv) {
|
|
|
2039
2039
|
const cols = Math.max(...values.map((v) => v.length));
|
|
2040
2040
|
return { values, rows, cols };
|
|
2041
2041
|
}
|
|
2042
|
+
function renderMenuItems(items, activeCell) {
|
|
2043
|
+
return items.map((item, i) => {
|
|
2044
|
+
if (item.items && item.items.length > 0) {
|
|
2045
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactFancy.ContextMenu.Sub, { children: [
|
|
2046
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactFancy.ContextMenu.SubTrigger, { children: item.label }),
|
|
2047
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactFancy.ContextMenu.SubContent, { children: renderMenuItems(item.items, activeCell) })
|
|
2048
|
+
] }, i);
|
|
2049
|
+
}
|
|
2050
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2051
|
+
reactFancy.ContextMenu.Item,
|
|
2052
|
+
{
|
|
2053
|
+
onClick: () => item.onClick?.(activeCell),
|
|
2054
|
+
disabled: typeof item.disabled === "function" ? item.disabled(activeCell) : item.disabled,
|
|
2055
|
+
danger: item.danger,
|
|
2056
|
+
children: item.label
|
|
2057
|
+
},
|
|
2058
|
+
i
|
|
2059
|
+
);
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2042
2062
|
function SpreadsheetGrid({ className }) {
|
|
2043
2063
|
const {
|
|
2044
2064
|
columnCount,
|
|
@@ -2258,16 +2278,7 @@ function SpreadsheetGrid({ className }) {
|
|
|
2258
2278
|
if (!items || items.length === 0) return null;
|
|
2259
2279
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2260
2280
|
/* @__PURE__ */ jsxRuntime.jsx(reactFancy.ContextMenu.Separator, {}),
|
|
2261
|
-
items
|
|
2262
|
-
reactFancy.ContextMenu.Item,
|
|
2263
|
-
{
|
|
2264
|
-
onClick: () => item.onClick(selection.activeCell),
|
|
2265
|
-
disabled: typeof item.disabled === "function" ? item.disabled(selection.activeCell) : item.disabled,
|
|
2266
|
-
danger: item.danger,
|
|
2267
|
-
children: item.label
|
|
2268
|
-
},
|
|
2269
|
-
i
|
|
2270
|
-
))
|
|
2281
|
+
renderMenuItems(items, selection.activeCell)
|
|
2271
2282
|
] });
|
|
2272
2283
|
})()
|
|
2273
2284
|
] })
|