@particle-academy/fancy-sheets 0.7.4 → 0.7.6
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/README.md +2 -0
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default, { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/** Column-letter + row-number string, e.g. "A1", "BC42" */
|
|
5
5
|
type CellAddress = string;
|
|
@@ -202,7 +202,7 @@ interface SpreadsheetContextValue {
|
|
|
202
202
|
interface SpreadsheetGridProps {
|
|
203
203
|
className?: string;
|
|
204
204
|
}
|
|
205
|
-
declare function SpreadsheetGrid({ className }: SpreadsheetGridProps):
|
|
205
|
+
declare function SpreadsheetGrid({ className }: SpreadsheetGridProps): react.JSX.Element;
|
|
206
206
|
declare namespace SpreadsheetGrid {
|
|
207
207
|
var displayName: string;
|
|
208
208
|
}
|
|
@@ -210,14 +210,14 @@ declare namespace SpreadsheetGrid {
|
|
|
210
210
|
/** Toolbar button groups that can be toggled on/off */
|
|
211
211
|
type ToolbarButton = "undo" | "bold" | "align" | "freeze" | "format" | "decimals" | "formulaBar";
|
|
212
212
|
interface SpreadsheetToolbarProps {
|
|
213
|
-
children?:
|
|
213
|
+
children?: react__default.ReactNode;
|
|
214
214
|
className?: string;
|
|
215
215
|
/** Additional toolbar content appended after default buttons */
|
|
216
|
-
extra?:
|
|
216
|
+
extra?: react__default.ReactNode;
|
|
217
217
|
/** Which built-in button groups to show (default: all). Omit to show everything. */
|
|
218
218
|
buttons?: ToolbarButton[];
|
|
219
219
|
}
|
|
220
|
-
declare function SpreadsheetToolbar({ children, className, extra, buttons: buttonsProp }: SpreadsheetToolbarProps):
|
|
220
|
+
declare function SpreadsheetToolbar({ children, className, extra, buttons: buttonsProp }: SpreadsheetToolbarProps): react__default.JSX.Element;
|
|
221
221
|
declare namespace SpreadsheetToolbar {
|
|
222
222
|
var displayName: string;
|
|
223
223
|
}
|
|
@@ -225,12 +225,12 @@ declare namespace SpreadsheetToolbar {
|
|
|
225
225
|
interface SpreadsheetSheetTabsProps {
|
|
226
226
|
className?: string;
|
|
227
227
|
}
|
|
228
|
-
declare function SpreadsheetSheetTabs({ className }: SpreadsheetSheetTabsProps):
|
|
228
|
+
declare function SpreadsheetSheetTabs({ className }: SpreadsheetSheetTabsProps): react.JSX.Element;
|
|
229
229
|
declare namespace SpreadsheetSheetTabs {
|
|
230
230
|
var displayName: string;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
declare function SpreadsheetRoot({ children, className, data, defaultData, onChange, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, contextMenuItems, highlights, onActiveCellChange, }: SpreadsheetProps):
|
|
233
|
+
declare function SpreadsheetRoot({ children, className, data, defaultData, onChange, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, contextMenuItems, highlights, onActiveCellChange, }: SpreadsheetProps): react.JSX.Element;
|
|
234
234
|
declare namespace SpreadsheetRoot {
|
|
235
235
|
var displayName: string;
|
|
236
236
|
}
|
|
@@ -265,7 +265,7 @@ interface SheetProps {
|
|
|
265
265
|
/** Fires when the active cell changes */
|
|
266
266
|
onActiveCellChange?: (address: string, cell: CellData | undefined) => void;
|
|
267
267
|
}
|
|
268
|
-
declare function Sheet({ data, onChange, contextMenuItems, highlights, onActiveCellChange, ...props }: SheetProps):
|
|
268
|
+
declare function Sheet({ data, onChange, contextMenuItems, highlights, onActiveCellChange, ...props }: SheetProps): react.JSX.Element;
|
|
269
269
|
declare namespace Sheet {
|
|
270
270
|
var displayName: string;
|
|
271
271
|
}
|
|
@@ -303,7 +303,7 @@ interface SheetWorkbookProps {
|
|
|
303
303
|
/** Fires when the active cell changes */
|
|
304
304
|
onActiveCellChange?: (address: string, cell: CellData | undefined) => void;
|
|
305
305
|
}
|
|
306
|
-
declare function SheetWorkbook({ hideToolbar, hideTabs, toolbarExtra, toolbarButtons, contextMenuItems, highlights, onActiveCellChange, ...props }: SheetWorkbookProps):
|
|
306
|
+
declare function SheetWorkbook({ hideToolbar, hideTabs, toolbarExtra, toolbarButtons, contextMenuItems, highlights, onActiveCellChange, ...props }: SheetWorkbookProps): react.JSX.Element;
|
|
307
307
|
declare namespace SheetWorkbook {
|
|
308
308
|
var displayName: string;
|
|
309
309
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default, { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/** Column-letter + row-number string, e.g. "A1", "BC42" */
|
|
5
5
|
type CellAddress = string;
|
|
@@ -202,7 +202,7 @@ interface SpreadsheetContextValue {
|
|
|
202
202
|
interface SpreadsheetGridProps {
|
|
203
203
|
className?: string;
|
|
204
204
|
}
|
|
205
|
-
declare function SpreadsheetGrid({ className }: SpreadsheetGridProps):
|
|
205
|
+
declare function SpreadsheetGrid({ className }: SpreadsheetGridProps): react.JSX.Element;
|
|
206
206
|
declare namespace SpreadsheetGrid {
|
|
207
207
|
var displayName: string;
|
|
208
208
|
}
|
|
@@ -210,14 +210,14 @@ declare namespace SpreadsheetGrid {
|
|
|
210
210
|
/** Toolbar button groups that can be toggled on/off */
|
|
211
211
|
type ToolbarButton = "undo" | "bold" | "align" | "freeze" | "format" | "decimals" | "formulaBar";
|
|
212
212
|
interface SpreadsheetToolbarProps {
|
|
213
|
-
children?:
|
|
213
|
+
children?: react__default.ReactNode;
|
|
214
214
|
className?: string;
|
|
215
215
|
/** Additional toolbar content appended after default buttons */
|
|
216
|
-
extra?:
|
|
216
|
+
extra?: react__default.ReactNode;
|
|
217
217
|
/** Which built-in button groups to show (default: all). Omit to show everything. */
|
|
218
218
|
buttons?: ToolbarButton[];
|
|
219
219
|
}
|
|
220
|
-
declare function SpreadsheetToolbar({ children, className, extra, buttons: buttonsProp }: SpreadsheetToolbarProps):
|
|
220
|
+
declare function SpreadsheetToolbar({ children, className, extra, buttons: buttonsProp }: SpreadsheetToolbarProps): react__default.JSX.Element;
|
|
221
221
|
declare namespace SpreadsheetToolbar {
|
|
222
222
|
var displayName: string;
|
|
223
223
|
}
|
|
@@ -225,12 +225,12 @@ declare namespace SpreadsheetToolbar {
|
|
|
225
225
|
interface SpreadsheetSheetTabsProps {
|
|
226
226
|
className?: string;
|
|
227
227
|
}
|
|
228
|
-
declare function SpreadsheetSheetTabs({ className }: SpreadsheetSheetTabsProps):
|
|
228
|
+
declare function SpreadsheetSheetTabs({ className }: SpreadsheetSheetTabsProps): react.JSX.Element;
|
|
229
229
|
declare namespace SpreadsheetSheetTabs {
|
|
230
230
|
var displayName: string;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
declare function SpreadsheetRoot({ children, className, data, defaultData, onChange, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, contextMenuItems, highlights, onActiveCellChange, }: SpreadsheetProps):
|
|
233
|
+
declare function SpreadsheetRoot({ children, className, data, defaultData, onChange, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, contextMenuItems, highlights, onActiveCellChange, }: SpreadsheetProps): react.JSX.Element;
|
|
234
234
|
declare namespace SpreadsheetRoot {
|
|
235
235
|
var displayName: string;
|
|
236
236
|
}
|
|
@@ -265,7 +265,7 @@ interface SheetProps {
|
|
|
265
265
|
/** Fires when the active cell changes */
|
|
266
266
|
onActiveCellChange?: (address: string, cell: CellData | undefined) => void;
|
|
267
267
|
}
|
|
268
|
-
declare function Sheet({ data, onChange, contextMenuItems, highlights, onActiveCellChange, ...props }: SheetProps):
|
|
268
|
+
declare function Sheet({ data, onChange, contextMenuItems, highlights, onActiveCellChange, ...props }: SheetProps): react.JSX.Element;
|
|
269
269
|
declare namespace Sheet {
|
|
270
270
|
var displayName: string;
|
|
271
271
|
}
|
|
@@ -303,7 +303,7 @@ interface SheetWorkbookProps {
|
|
|
303
303
|
/** Fires when the active cell changes */
|
|
304
304
|
onActiveCellChange?: (address: string, cell: CellData | undefined) => void;
|
|
305
305
|
}
|
|
306
|
-
declare function SheetWorkbook({ hideToolbar, hideTabs, toolbarExtra, toolbarButtons, contextMenuItems, highlights, onActiveCellChange, ...props }: SheetWorkbookProps):
|
|
306
|
+
declare function SheetWorkbook({ hideToolbar, hideTabs, toolbarExtra, toolbarButtons, contextMenuItems, highlights, onActiveCellChange, ...props }: SheetWorkbookProps): react.JSX.Element;
|
|
307
307
|
declare namespace SheetWorkbook {
|
|
308
308
|
var displayName: string;
|
|
309
309
|
}
|
package/dist/index.js
CHANGED
|
@@ -1555,7 +1555,7 @@ function reducer(state, action) {
|
|
|
1555
1555
|
};
|
|
1556
1556
|
}
|
|
1557
1557
|
case "SET_WORKBOOK":
|
|
1558
|
-
return { ...state, workbook: action.workbook };
|
|
1558
|
+
return { ...state, workbook: recalculateWorkbook(action.workbook) };
|
|
1559
1559
|
default:
|
|
1560
1560
|
return state;
|
|
1561
1561
|
}
|
|
@@ -2254,7 +2254,13 @@ function SpreadsheetGrid({ className }) {
|
|
|
2254
2254
|
return /* @__PURE__ */ jsxs(
|
|
2255
2255
|
"div",
|
|
2256
2256
|
{
|
|
2257
|
-
className:
|
|
2257
|
+
className: cn(
|
|
2258
|
+
"flex",
|
|
2259
|
+
// Frozen rows need a solid background so scrolling content
|
|
2260
|
+
// doesn't bleed through any cell-level transparency
|
|
2261
|
+
// (highlight overlays, alpha format colors, etc.).
|
|
2262
|
+
isFrozenRow && "bg-white dark:bg-zinc-900"
|
|
2263
|
+
),
|
|
2258
2264
|
style: isFrozenRow ? {
|
|
2259
2265
|
position: "sticky",
|
|
2260
2266
|
top: rowHeight + rowIdx * rowHeight,
|
|
@@ -2268,6 +2274,12 @@ function SpreadsheetGrid({ className }) {
|
|
|
2268
2274
|
return /* @__PURE__ */ jsx(
|
|
2269
2275
|
"div",
|
|
2270
2276
|
{
|
|
2277
|
+
className: cn(
|
|
2278
|
+
// Same solid-background guarantee for frozen
|
|
2279
|
+
// columns — keeps the column opaque while content
|
|
2280
|
+
// scrolls horizontally underneath.
|
|
2281
|
+
isFrozenCol && "bg-white dark:bg-zinc-900"
|
|
2282
|
+
),
|
|
2271
2283
|
style: isFrozenCol ? {
|
|
2272
2284
|
position: "sticky",
|
|
2273
2285
|
left: 48 + Array.from({ length: colIdx }, (_3, c) => getColumnWidth(c)).reduce((a, b) => a + b, 0),
|