@fileverse-dev/dsheet 2.1.5 → 3.0.1-formula-1
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/{constants-yStXQJiK.js → constants-Cdz6oSCq.js} +5 -7
- package/dist/constants.js +1 -1
- package/dist/editor/components/api-key-modal/api-key-input.d.ts +5 -0
- package/dist/editor/components/api-key-modal/api-key-modal.d.ts +7 -0
- package/dist/editor/components/api-key-modal/rate-limit-info.d.ts +4 -0
- package/dist/editor/components/comments/comment-actions-dropdown.d.ts +19 -0
- package/dist/editor/components/comments/comment-cell-popup.d.ts +4 -0
- package/dist/editor/components/comments/comment-input.d.ts +4 -0
- package/dist/editor/components/comments/comment-item.d.ts +4 -0
- package/dist/editor/components/comments/comment-sidebar-empty.d.ts +4 -0
- package/dist/editor/components/comments/comment-sidebar.d.ts +4 -0
- package/dist/editor/components/comments/ens/ens-cache.d.ts +10 -0
- package/dist/editor/components/comments/ens/use-ens-status.d.ts +10 -0
- package/dist/editor/components/comments/use-comment-cell-popup.d.ts +12 -0
- package/dist/editor/components/comments/use-comment-permissions.d.ts +15 -0
- package/dist/editor/components/editor-workbook-sync.d.ts +1 -1
- package/dist/editor/components/editor-workbook.d.ts +11 -17
- package/dist/editor/components/sidebar/editor-right-sidebar.d.ts +20 -0
- package/dist/editor/components/sidebar/right-sidebar.d.ts +14 -0
- package/dist/editor/components/sidebar/sidebar-context.d.ts +17 -0
- package/dist/editor/components/sidebar/sidebar-portal-registry.d.ts +20 -0
- package/dist/editor/components/sidebar/use-right-panels.d.ts +12 -0
- package/dist/editor/components/sidebars/conditional-format.d.ts +2 -0
- package/dist/editor/components/sidebars/data-verification.d.ts +2 -0
- package/dist/editor/components/sidebars/function/function-categories-logic.d.ts +11 -0
- package/dist/editor/components/sidebars/function/function-categories.d.ts +6 -0
- package/dist/editor/components/sidebars/function/function-metadata.d.ts +7 -0
- package/dist/editor/components/sidebars/function/functionList.d.ts +8 -0
- package/dist/editor/components/sidebars/function/types.d.ts +24 -0
- package/dist/editor/components/sidebars/function/use-functions.d.ts +20 -0
- package/dist/editor/components/sidebars/function-content.d.ts +8 -0
- package/dist/editor/components/sidebars/named-ranges.d.ts +2 -0
- package/dist/editor/components/sidebars/template-ui.d.ts +22 -0
- package/dist/editor/components/sidebars/templates.d.ts +9 -0
- package/dist/editor/components/smart-contract/error-toast.d.ts +11 -0
- package/dist/editor/components/smart-contract/modal/abi-input-section.d.ts +11 -0
- package/dist/editor/components/smart-contract/modal/contract-name-section.d.ts +13 -0
- package/dist/editor/components/smart-contract/modal/file-upload-section.d.ts +12 -0
- package/dist/editor/components/smart-contract/modal/import-section.d.ts +8 -0
- package/dist/editor/components/smart-contract/modal/modal-header.d.ts +17 -0
- package/dist/editor/components/smart-contract/smart-contract-list-item.d.ts +8 -0
- package/dist/editor/components/smart-contract/smart-contract-modal-ui.d.ts +33 -0
- package/dist/editor/components/smart-contract/smart-contract-modal.d.ts +12 -0
- package/dist/editor/components/smart-contract/smart-contract-reading-intro.d.ts +4 -0
- package/dist/editor/components/smart-contract/smart-contract-view-list.d.ts +6 -0
- package/dist/editor/components/smart-contract/use-address-validation.d.ts +5 -0
- package/dist/editor/components/smart-contract/use-modal-outside-click.d.ts +18 -0
- package/dist/editor/components/smart-contract/use-smart-contract-modal.d.ts +38 -0
- package/dist/editor/constants/shared-constants.d.ts +0 -2
- package/dist/editor/contexts/editor-context.d.ts +20 -5
- package/dist/editor/dsheet-editor.d.ts +1 -1
- package/dist/editor/hooks/live-query/use-live-query.d.ts +4 -2
- package/dist/editor/hooks/use-celldata-compaction.d.ts +23 -0
- package/dist/editor/hooks/use-editor-data.d.ts +4 -2
- package/dist/editor/hooks/use-smart-contract.d.ts +26 -0
- package/dist/editor/hooks/use-xlsx-import-impl.d.ts +8 -1
- package/dist/editor/hooks/use-xlsx-import.d.ts +2 -1
- package/dist/editor/types/comments.d.ts +134 -0
- package/dist/editor/types/smart-contract.d.ts +88 -0
- package/dist/editor/types.d.ts +39 -32
- package/dist/editor/utils/after-update-cell.d.ts +13 -8
- package/dist/editor/utils/api-key-storage.d.ts +6 -0
- package/dist/editor/utils/api-keys-local-storage.d.ts +19 -0
- package/dist/editor/utils/cell-comment-marker.d.ts +30 -0
- package/dist/editor/utils/comment-key-utils.d.ts +7 -0
- package/dist/editor/utils/compact-committed-celldata.d.ts +28 -0
- package/dist/editor/utils/config-ydoc-update.d.ts +20 -0
- package/dist/editor/utils/csv-import.d.ts +3 -1
- package/dist/editor/utils/data-block-error-handler.d.ts +21 -0
- package/dist/editor/utils/datablock-error-utils.d.ts +1 -0
- package/dist/editor/utils/defined-names-ydoc.d.ts +31 -0
- package/dist/editor/utils/sheet-editor-safe.d.ts +26 -0
- package/dist/editor/utils/smart-contract/constants.d.ts +488 -0
- package/dist/editor/utils/smart-contract/error-helper.d.ts +20 -0
- package/dist/editor/utils/smart-contract/helpers.d.ts +4 -0
- package/dist/editor/utils/smart-contract/reading-utils.d.ts +34 -0
- package/dist/editor/utils/smart-contract/signature-utils.d.ts +9 -0
- package/dist/editor/utils/spreadsheet-import.d.ts +12 -0
- package/dist/editor/utils/update-ydoc.d.ts +2 -2
- package/dist/editor/utils/xlsx-defined-names.d.ts +41 -0
- package/dist/executeStringFunction-DMPoSj5F.js +32826 -0
- package/dist/formula.js +1 -1
- package/dist/index-DAVuAF9T.js +55303 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.es.js +55 -49
- package/dist/jszip.min-CEyB-71x.js +2319 -0
- package/dist/sheet-engine/core/api/cell.d.ts +0 -20
- package/dist/sheet-engine/core/api/common.d.ts +2 -1
- package/dist/sheet-engine/core/api/index.d.ts +1 -0
- package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.d.ts +17 -0
- package/dist/sheet-engine/core/api/sheet.d.ts +5 -0
- package/dist/sheet-engine/core/context.d.ts +8 -1
- package/dist/sheet-engine/core/index.d.ts +2 -2
- package/dist/sheet-engine/core/modules/formula-async-eval.d.ts +53 -0
- package/dist/sheet-engine/core/modules/formula-eval.worker.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula-range-cache.d.ts +20 -0
- package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +51 -0
- package/dist/sheet-engine/core/modules/formula-transitive-deps.d.ts +7 -0
- package/dist/sheet-engine/core/modules/formula-worker-bridge.d.ts +17 -0
- package/dist/sheet-engine/core/modules/formula-worker-types.d.ts +24 -0
- package/dist/sheet-engine/core/modules/formula.d.ts +53 -1
- package/dist/sheet-engine/core/modules/index.d.ts +5 -2
- package/dist/sheet-engine/core/modules/namedRanges.d.ts +53 -0
- package/dist/sheet-engine/core/modules/sheet-metadata-hooks.d.ts +4 -0
- package/dist/sheet-engine/core/modules/sheet.d.ts +17 -1
- package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +23 -0
- package/dist/sheet-engine/core/settings.d.ts +3 -1
- package/dist/sheet-engine/core/theme.d.ts +67 -0
- package/dist/sheet-engine/core/types.d.ts +20 -0
- package/dist/sheet-engine/core/utils/border-config-utils.d.ts +16 -0
- package/dist/sheet-engine/core/utils/cell-persist-utils.d.ts +10 -0
- package/dist/sheet-engine/core/utils/range-format.d.ts +71 -0
- package/dist/sheet-engine/core/utils/ydoc-celldata-changes.d.ts +40 -0
- package/dist/sheet-engine/react/components/NamedRanges/index.d.ts +4 -0
- package/dist/sheet-engine/react/components/SheetOverlay/Icon.d.ts +5 -4
- package/dist/sheet-engine/react/components/SheetOverlay/LucideIcon.d.ts +4 -4
- package/dist/sheet-engine/react/components/SidebarPanelPortals/index.d.ts +17 -0
- package/dist/sheet-engine/react/components/Workbook/api.d.ts +8 -1
- package/dist/sheet-engine/react/components/Workbook/index.d.ts +11 -1
- package/dist/sheet-engine/react/components/index.d.ts +1 -0
- package/dist/sheet-engine/react/utils/datepickerStyles.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/use-xlsx-import-impl-DzthrhwA.js +1595 -0
- package/dist/xlsx-defined-names-D2KoICbm.js +117 -0
- package/dist/xlsx-export-impl-b2z4De4f.js +818 -0
- package/package.json +6 -4
- package/dist/executeStringFunction-BkmJj04p.js +0 -27295
- package/dist/index-Drl8OuI3.js +0 -52659
- package/dist/sheet-engine/react/components/Toolbar/conditionalFormatPortal.d.ts +0 -7
- package/dist/sheet-engine/react/components/Toolbar/dataVerificationPortal.d.ts +0 -6
- package/dist/use-xlsx-import-impl-DC_BfAcT.js +0 -1527
- package/dist/xlsx-export-impl-DP_eK3zS.js +0 -3126
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grid (canvas) theming — the single source of truth for the JS-painted grid's per-theme colors.
|
|
3
|
+
*
|
|
4
|
+
* The chrome (toolbar, sidebars, comments) themes passively via `@fileverse/ui` `.color-*`
|
|
5
|
+
* utilities + the `<html>` class. The canvas grid cannot read CSS variables, so `canvas.ts`
|
|
6
|
+
* resolves its colors from `activePalette` here. On theme change the host threads a `theme` prop
|
|
7
|
+
* to the engine, which calls `setActiveGridPalette` and repaints via `jfrefreshgrid`.
|
|
8
|
+
*
|
|
9
|
+
* `ThemeKey` is copied verbatim from `fileverse-ddoc` `package/types.ts` so the dsheet `theme`
|
|
10
|
+
* prop is type-identical to ddoc's and a host app can pass the same value to both editors.
|
|
11
|
+
*
|
|
12
|
+
* See docs/DROP-IN-PACKAGE-AND-THEMING.md §7 (Theming)
|
|
13
|
+
*/
|
|
14
|
+
export type ThemeKey = 'light' | 'dark' | 'theme-sepia' | 'theme-pink' | 'theme-green';
|
|
15
|
+
export declare const DEFAULT_THEME: ThemeKey;
|
|
16
|
+
/**
|
|
17
|
+
* dsheet selection-accent brand color. Constant across all five themes (readable on every
|
|
18
|
+
* background) — intentionally NOT a per-theme palette slot. Used for the fill handle, selection
|
|
19
|
+
* border, and marching ants.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SELECTION_ACCENT = "#EFC703";
|
|
22
|
+
/**
|
|
23
|
+
* One slot per neutral grid-chrome color role painted in `canvas.ts`. User-authored cell colors
|
|
24
|
+
* (cell `bg`/`fc`/border, conditional-format colors) are NOT here — they render literally in every
|
|
25
|
+
* theme and are read straight from cell data.
|
|
26
|
+
*/
|
|
27
|
+
export interface GridPalette {
|
|
28
|
+
/** Unset cell background + main-area canvas clear (the `!fillStyle` fallback branch). */
|
|
29
|
+
cellBg: string;
|
|
30
|
+
/** Gridlines. */
|
|
31
|
+
gridLine: string;
|
|
32
|
+
/** Default cell text (cells with no user `fc`). */
|
|
33
|
+
cellText: string;
|
|
34
|
+
/** Row/column header background. */
|
|
35
|
+
headerBg: string;
|
|
36
|
+
/** Row/column header text. */
|
|
37
|
+
headerText: string;
|
|
38
|
+
/** Secondary fill for on-canvas chips (e.g. data-verification dropdown). */
|
|
39
|
+
secondaryFill: string;
|
|
40
|
+
/** Frozen-pane divider line. */
|
|
41
|
+
freezeLine: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Per-theme grid palettes.
|
|
45
|
+
*
|
|
46
|
+
* `light` holds the EXACT pre-theming hex from `canvas.ts`, so the default theme renders
|
|
47
|
+
* pixel-identical to before this change (regression guard).
|
|
48
|
+
*
|
|
49
|
+
* [Unverified] The four non-light palettes are reasonable design-guess values derived from each
|
|
50
|
+
* theme's surface swatch — NOT final brand colors; they need design sign-off. The mechanism is
|
|
51
|
+
* independent of the exact values.
|
|
52
|
+
*/
|
|
53
|
+
export declare const GRID_THEMES: Record<ThemeKey, GridPalette>;
|
|
54
|
+
export declare const resolveGridPalette: (theme?: ThemeKey) => GridPalette;
|
|
55
|
+
/**
|
|
56
|
+
* The palette the canvas paints from. Module-level so the imperative canvas reads it on every
|
|
57
|
+
* repaint without prop threading inside the engine. `canvas.ts` imports this as a live binding and
|
|
58
|
+
* reads `activePalette.<slot>` at paint time; reassigning it here updates every reader.
|
|
59
|
+
*
|
|
60
|
+
* NOTE: this is a module singleton — multiple workbooks with different themes on one page would
|
|
61
|
+
* share it. dsheet renders one editor per page (like ddoc), so this is acceptable. If multi-instance
|
|
62
|
+
* is ever needed, move the palette onto `sheetCtx`.
|
|
63
|
+
*/
|
|
64
|
+
export declare let activePalette: GridPalette;
|
|
65
|
+
/** Swap the active grid palette. Returns true if it actually changed (caller decides to repaint). */
|
|
66
|
+
export declare const setActiveGridPalette: (theme?: ThemeKey) => boolean;
|
|
67
|
+
export declare const getActiveTheme: () => ThemeKey;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Patch as ImmerPatch } from 'immer';
|
|
2
2
|
import { PatchOptions } from './utils';
|
|
3
|
+
import { CellFormatRange } from './utils/range-format';
|
|
3
4
|
|
|
4
5
|
export type Op = {
|
|
5
6
|
op: 'replace' | 'remove' | 'add' | 'insertRowCol' | 'deleteRowCol' | 'addSheet' | 'deleteSheet';
|
|
@@ -140,10 +141,29 @@ export type SheetConfig = {
|
|
|
140
141
|
customHeight?: Record<string, number>;
|
|
141
142
|
customWidth?: Record<string, number>;
|
|
142
143
|
borderInfo?: any[];
|
|
144
|
+
/** Range-level cell formatting for empty cells (toolbar bulk format). */
|
|
145
|
+
cellFormatRanges?: CellFormatRange[];
|
|
143
146
|
authority?: any;
|
|
144
147
|
rowReadOnly?: Record<number, number>;
|
|
145
148
|
colReadOnly?: Record<number, number>;
|
|
146
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* Workbook-level named range (Google Sheets / Excel definedNames).
|
|
152
|
+
* Runtime list lives on Context; persisted in Yjs as `${dsheetId}:definedNames`.
|
|
153
|
+
*/
|
|
154
|
+
export type DefinedName = {
|
|
155
|
+
id: string;
|
|
156
|
+
name: string;
|
|
157
|
+
sheetId: string;
|
|
158
|
+
range: {
|
|
159
|
+
row: [number, number];
|
|
160
|
+
column: [number, number];
|
|
161
|
+
};
|
|
162
|
+
scope: 'workbook' | 'sheet';
|
|
163
|
+
/** When scope === 'sheet', which sheet owns the name. */
|
|
164
|
+
localSheetId?: string;
|
|
165
|
+
comment?: string;
|
|
166
|
+
};
|
|
147
167
|
export type Image = {
|
|
148
168
|
id: string;
|
|
149
169
|
width: number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Context } from '../context';
|
|
2
|
+
|
|
3
|
+
export type BorderSelection = {
|
|
4
|
+
row: [number, number];
|
|
5
|
+
column: [number, number];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Remap borderInfo after a row/column reorder (header drag).
|
|
9
|
+
* Uses the same old→new index map as remapCellFormatRanges.
|
|
10
|
+
* O(border entries × span) — only runs on drag drop, not per-frame.
|
|
11
|
+
*/
|
|
12
|
+
export declare function remapBorderInfo(borderInfo: any[] | undefined, axis: 'row' | 'column', indexMap: Record<number, number>): any[];
|
|
13
|
+
/** Remove border entries overlapping a single selection (cell + range types). */
|
|
14
|
+
export declare function removeBorderInfoForSelection(borderInfo: any[], rowSt: number, rowEd: number, colSt: number, colEd: number): any[];
|
|
15
|
+
export declare function removeBorderInfoInSelections(borderInfo: any[] | undefined, selections: BorderSelection[]): any[];
|
|
16
|
+
export declare function syncBorderInfoToYdoc(ctx: Context, borderInfo: any[]): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Cell } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare const CELL_FORMAT_ATTRS: readonly ["tb", "ht", "vt", "tr", "fs", "ff", "fc", "bl", "it", "un", "cl", "bg", "ct"];
|
|
4
|
+
export type CellFormatAttr = (typeof CELL_FORMAT_ATTRS)[number];
|
|
5
|
+
export declare function hasCellMeaningfulContent(cell: Cell | string | number | boolean | null | undefined): boolean;
|
|
6
|
+
export declare function isFormatOnlyEmptyCell(cell: Cell | string | number | boolean | null | undefined): boolean;
|
|
7
|
+
/** Pull only present format attrs from a format-only empty cell (cheap, no clone). */
|
|
8
|
+
export declare function extractCellFormatAttrs(cell: Cell | string | number | boolean | null | undefined): Partial<Record<CellFormatAttr, unknown>> | null;
|
|
9
|
+
export declare function shouldPersistCelldataCell(cell: Cell | string | number | boolean | null | undefined): boolean;
|
|
10
|
+
export declare function celldataEntryEqual(existing: unknown, next: unknown): boolean;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Cell, CellMatrix, CellWithRowAndCol, Sheet } from '../types';
|
|
2
|
+
|
|
3
|
+
export type CellFormatRange = {
|
|
4
|
+
row: [number, number];
|
|
5
|
+
column: [number, number];
|
|
6
|
+
tb?: string;
|
|
7
|
+
ht?: number | string;
|
|
8
|
+
vt?: number | string;
|
|
9
|
+
tr?: string;
|
|
10
|
+
fs?: number;
|
|
11
|
+
ff?: number | string;
|
|
12
|
+
fc?: string;
|
|
13
|
+
bl?: number;
|
|
14
|
+
it?: number;
|
|
15
|
+
un?: number;
|
|
16
|
+
cl?: number;
|
|
17
|
+
bg?: string;
|
|
18
|
+
ct?: Cell["ct"];
|
|
19
|
+
};
|
|
20
|
+
declare function rangesEqual(a: CellFormatRange[] | undefined, b: CellFormatRange[] | undefined): boolean;
|
|
21
|
+
/** Merge overlapping/adjacent ranges that carry identical format attrs. */
|
|
22
|
+
export declare function normalizeCellFormatRanges(ranges: CellFormatRange[] | undefined): CellFormatRange[];
|
|
23
|
+
/**
|
|
24
|
+
* Remap format ranges after a row or column permutation, such as header
|
|
25
|
+
* drag-and-drop. A contiguous source range can become multiple rectangles
|
|
26
|
+
* when the moved indices are no longer contiguous.
|
|
27
|
+
*/
|
|
28
|
+
export declare function remapCellFormatRanges(ranges: CellFormatRange[] | undefined, axis: "row" | "column", indexMap: Record<number, number>): CellFormatRange[];
|
|
29
|
+
/**
|
|
30
|
+
* Move format ranges with a cut-and-paste cell block move. Formatting in both
|
|
31
|
+
* the old source and the overwritten destination is cleared; only the source
|
|
32
|
+
* intersection is translated to the target rectangle.
|
|
33
|
+
*/
|
|
34
|
+
export declare function moveCellFormatRanges(ranges: CellFormatRange[] | undefined, source: Pick<CellFormatRange, "row" | "column">, target: Pick<CellFormatRange, "row" | "column">): CellFormatRange[];
|
|
35
|
+
export declare function getCellFormatRangeGridBounds(ranges: CellFormatRange[] | undefined): {
|
|
36
|
+
maxRow: number;
|
|
37
|
+
maxCol: number;
|
|
38
|
+
} | null;
|
|
39
|
+
export declare function upsertCellFormatRange(ranges: CellFormatRange[] | undefined, rowSt: number, rowEd: number, colSt: number, colEd: number, attrs: Partial<CellFormatRange>): {
|
|
40
|
+
ranges: CellFormatRange[];
|
|
41
|
+
changed: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* When a cell loses meaningful content but keeps style, put that style back
|
|
45
|
+
* into cellFormatRanges as a 1x1 (normalize merges with neighbours).
|
|
46
|
+
*/
|
|
47
|
+
export declare function migrateFormatOnlyCellIntoRanges(ranges: CellFormatRange[] | undefined, r: number, c: number, cell: Cell | string | number | boolean | null | undefined): {
|
|
48
|
+
ranges: CellFormatRange[];
|
|
49
|
+
changed: boolean;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Scan a dense-data rectangle and move any format-only cells into
|
|
53
|
+
* cellFormatRanges. Adjacent identical styles merge via normalize.
|
|
54
|
+
*/
|
|
55
|
+
export declare function migrateFormatOnlyCellsFromData(ranges: CellFormatRange[] | undefined, data: CellMatrix | null | undefined, r1: number, r2: number, c1: number, c2: number): {
|
|
56
|
+
ranges: CellFormatRange[];
|
|
57
|
+
changed: boolean;
|
|
58
|
+
};
|
|
59
|
+
export declare function punchHoleInCellFormatRanges(ranges: CellFormatRange[] | undefined, r: number, c: number): CellFormatRange[];
|
|
60
|
+
export declare function punchRectHoleInCellFormatRanges(ranges: CellFormatRange[] | undefined, rowSt: number, rowEd: number, colSt: number, colEd: number): CellFormatRange[];
|
|
61
|
+
export declare function shiftCellFormatRangesOnInsert(ranges: CellFormatRange[] | undefined, type: "row" | "column", index: number, count: number, direction: "lefttop" | "rightbottom"): CellFormatRange[];
|
|
62
|
+
export declare function shiftCellFormatRangesOnDelete(ranges: CellFormatRange[] | undefined, type: "row" | "column", start: number, end: number): CellFormatRange[];
|
|
63
|
+
export declare function applyCellFormatRangesToData(data: CellMatrix | null | undefined, ranges: CellFormatRange[] | undefined): void;
|
|
64
|
+
export declare function buildSheetDataMatrixForExport(sheet: {
|
|
65
|
+
data?: CellMatrix | null;
|
|
66
|
+
celldata?: CellWithRowAndCol[];
|
|
67
|
+
row?: number;
|
|
68
|
+
column?: number;
|
|
69
|
+
config?: Sheet["config"];
|
|
70
|
+
}): CellMatrix;
|
|
71
|
+
export { rangesEqual };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Context } from '../context';
|
|
2
|
+
import { Cell, CellWithRowAndCol } from '../types';
|
|
3
|
+
|
|
4
|
+
export type CelldataYdocChange = {
|
|
5
|
+
sheetId: string;
|
|
6
|
+
path: string[];
|
|
7
|
+
key?: string;
|
|
8
|
+
value: any;
|
|
9
|
+
type?: 'update' | 'delete';
|
|
10
|
+
};
|
|
11
|
+
/** Cheap equality before deep compare — hot path for structural diffs. */
|
|
12
|
+
export declare function cellsEqualForYdocPersist(before: unknown, after: unknown): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Snapshot persisted cells in a range.
|
|
15
|
+
* Prefer sparse `celldata` when provided — O(populated cells), not O(range area).
|
|
16
|
+
*/
|
|
17
|
+
export declare function snapshotPersistedCelldataInRange(data: unknown[][] | null | undefined, r1: number, r2: number, c1: number, c2: number, celldata?: CellWithRowAndCol[] | null): Map<string, Cell | string | number | boolean>;
|
|
18
|
+
export declare function appendCelldataDiffChange(changes: CelldataYdocChange[], sheetId: string, r: number, c: number, cell: unknown, beforePersisted?: Map<string, Cell | string | number | boolean>): void;
|
|
19
|
+
export declare function buildCelldataChangesForRange(sheetId: string, data: unknown[][], r1: number, r2: number, c1: number, c2: number, beforePersisted?: Map<string, Cell | string | number | boolean>): CelldataYdocChange[];
|
|
20
|
+
export declare function emitCelldataRangeDiffToYdoc(ctx: Context, sheetId: string, data: unknown[][], r1: number, r2: number, c1: number, c2: number, beforePersisted?: Map<string, Cell | string | number | boolean>): void;
|
|
21
|
+
export type MergeBounds = {
|
|
22
|
+
minR: number;
|
|
23
|
+
minC: number;
|
|
24
|
+
maxR: number;
|
|
25
|
+
maxC: number;
|
|
26
|
+
};
|
|
27
|
+
/** Disturbed range for insert row/col — snapshot only rows/cols that may shift. */
|
|
28
|
+
export declare function getInsertRowColSnapshotBounds(type: 'row' | 'column', index: number, direction: 'lefttop' | 'rightbottom', rowCount: number, colCount: number, mergeBounds: MergeBounds | null): {
|
|
29
|
+
r1: number;
|
|
30
|
+
r2: number;
|
|
31
|
+
c1: number;
|
|
32
|
+
c2: number;
|
|
33
|
+
};
|
|
34
|
+
/** Disturbed range for delete row/col — from deletion point to sheet edge. */
|
|
35
|
+
export declare function getDeleteRowColSnapshotBounds(type: 'row' | 'column', start: number, rowCount: number, colCount: number, mergeBounds: MergeBounds | null): {
|
|
36
|
+
r1: number;
|
|
37
|
+
r2: number;
|
|
38
|
+
c1: number;
|
|
39
|
+
c2: number;
|
|
40
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { LucideIconProps } from './LucideIcon';
|
|
2
3
|
|
|
3
4
|
export declare const LucideIcons: {
|
|
@@ -11,10 +12,10 @@ export declare const LucideIcons: {
|
|
|
11
12
|
Farcaster: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
Warpcast: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
DSheetTextDisabled: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
AddColLeft: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
AddColRight: () => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
AddRowBelowLocal: () => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
AddRowAboveLocal: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
AddColLeft: ({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
AddColRight: ({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
AddRowBelowLocal: ({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
AddRowAboveLocal: ({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
DSheetOnlyText: () => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
Orb: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
Lens: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,10 +11,10 @@ export declare const UltimateIcons: {
|
|
|
11
11
|
Farcaster: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
Warpcast: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
DSheetTextDisabled: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
AddColLeft: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
AddColRight: () => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
AddRowBelowLocal: () => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
AddRowAboveLocal: () => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
AddColLeft: ({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
AddColRight: ({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
AddRowBelowLocal: ({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
AddRowAboveLocal: ({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
DSheetOnlyText: () => import("react/jsx-runtime").JSX.Element;
|
|
19
19
|
Orb: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
Lens: ({ width, height, ...props }: LucideIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Context } from '../../../core';
|
|
3
|
+
import { default as WorkbookContext } from '../../context';
|
|
4
|
+
|
|
5
|
+
export type SidebarPortalTargets = Record<string, HTMLElement | undefined>;
|
|
6
|
+
export type SidebarPortalRegistryHandle = {
|
|
7
|
+
getTargets: () => SidebarPortalTargets;
|
|
8
|
+
subscribe: (onStoreChange: () => void) => () => void;
|
|
9
|
+
};
|
|
10
|
+
export type SidebarPortalRenderer = (workbook: React.ContextType<typeof WorkbookContext>) => React.ReactNode;
|
|
11
|
+
interface SidebarPanelPortalsProps {
|
|
12
|
+
activePanel: string | null;
|
|
13
|
+
portalRegistry?: SidebarPortalRegistryHandle | null;
|
|
14
|
+
extraPortals?: Record<string, SidebarPortalRenderer>;
|
|
15
|
+
}
|
|
16
|
+
export declare function SidebarPanelPortals({ activePanel, portalRegistry, extraPortals, }: Readonly<SidebarPanelPortalsProps>): React.ReactPortal | null;
|
|
17
|
+
export type { Context };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CellFormatRange } from '../../../core/utils/range-format';
|
|
1
2
|
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache, LiveQueryData } from '../../../core';
|
|
2
3
|
import { getCryptoPrice } from '../../utils/cryptoApi';
|
|
3
4
|
import { SetContextOptions } from '../../context';
|
|
@@ -148,6 +149,12 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
148
149
|
} | null;
|
|
149
150
|
}, options?: api.CommonOptions) => void;
|
|
150
151
|
setSheetMapField: (field: string, value: Record<string, any> | null | undefined, options?: api.CommonOptions) => void;
|
|
152
|
+
/** Merge keys into a map-backed sheet field without replacing the whole map. */
|
|
153
|
+
patchSheetMapField: (field: string, updates: Record<string, any>, deleteKeys?: string[], options?: api.CommonOptions) => void;
|
|
154
|
+
/** Merge sub-keys into sheet.config without replacing the whole config object. */
|
|
155
|
+
setSheetConfigFields: (partial: Record<string, any>, options?: api.CommonOptions & {
|
|
156
|
+
deleteKeys?: string[];
|
|
157
|
+
}) => void;
|
|
151
158
|
setSheetConditionFormatRules: (rules: any[], options?: api.CommonOptions) => void;
|
|
152
159
|
scroll: (options: {
|
|
153
160
|
scrollLeft?: number;
|
|
@@ -166,7 +173,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
166
173
|
calculateSubSheetFormula: (id: string) => void;
|
|
167
174
|
calculateCellReferencedSubSheetFormula: (id: string, refCell?: string[]) => void;
|
|
168
175
|
dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
|
|
169
|
-
celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number) => CellMatrix | null;
|
|
176
|
+
celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number, cellFormatRanges?: CellFormatRange[]) => CellMatrix | null;
|
|
170
177
|
insertFunction: (selectedFuncIndex: number, filteredFunctionList: any[], callback?: () => void) => void;
|
|
171
178
|
getLocaleContext: () => any;
|
|
172
179
|
getWorkbookContext: () => Context;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { Settings, Context, CellWithRowAndCol, Sheet as SheetType, Op, CellMatrix, api } from '../../../core';
|
|
2
|
+
import { ThemeKey } from '../../../core/theme';
|
|
2
3
|
import { default as React } from 'react';
|
|
3
4
|
import { getCryptoPrice } from '../../utils/cryptoApi';
|
|
4
5
|
import { SetContextOptions } from '../../context';
|
|
5
6
|
import { generateAPIs } from './api';
|
|
7
|
+
import { SidebarPortalRegistryHandle, SidebarPortalRenderer } from '../SidebarPanelPortals';
|
|
6
8
|
|
|
7
9
|
export type WorkbookInstance = ReturnType<typeof generateAPIs>;
|
|
8
10
|
type AdditionalProps = {
|
|
9
11
|
onOp?: (op: Op[]) => void;
|
|
12
|
+
sidebarActivePanel?: string | null;
|
|
13
|
+
sidebarPortalRegistry?: SidebarPortalRegistryHandle | null;
|
|
14
|
+
sidebarPortalRenderers?: Record<string, SidebarPortalRenderer>;
|
|
15
|
+
theme?: ThemeKey;
|
|
10
16
|
};
|
|
11
17
|
declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalProps & React.RefAttributes<{
|
|
12
18
|
applyOp: (ops: Op[]) => void;
|
|
@@ -144,6 +150,10 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
144
150
|
} | null;
|
|
145
151
|
}, options?: api.CommonOptions) => void;
|
|
146
152
|
setSheetMapField: (field: string, value: Record<string, any> | null | undefined, options?: api.CommonOptions) => void;
|
|
153
|
+
patchSheetMapField: (field: string, updates: Record<string, any>, deleteKeys?: string[], options?: api.CommonOptions) => void;
|
|
154
|
+
setSheetConfigFields: (partial: Record<string, any>, options?: api.CommonOptions & {
|
|
155
|
+
deleteKeys?: string[];
|
|
156
|
+
}) => void;
|
|
147
157
|
setSheetConditionFormatRules: (rules: any[], options?: api.CommonOptions) => void;
|
|
148
158
|
scroll: (options: {
|
|
149
159
|
scrollLeft?: number;
|
|
@@ -162,7 +172,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
162
172
|
calculateSubSheetFormula: (id: string) => void;
|
|
163
173
|
calculateCellReferencedSubSheetFormula: (id: string, refCell?: string[]) => void;
|
|
164
174
|
dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
|
|
165
|
-
celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number) => CellMatrix | null;
|
|
175
|
+
celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number, cellFormatRanges?: import('../../../core/utils/range-format').CellFormatRange[]) => CellMatrix | null;
|
|
166
176
|
insertFunction: (selectedFuncIndex: number, filteredFunctionList: any[], callback?: () => void) => void;
|
|
167
177
|
getLocaleContext: () => any;
|
|
168
178
|
getWorkbookContext: () => Context;
|
|
@@ -3,5 +3,6 @@ import { default as Workbook } from './Workbook';
|
|
|
3
3
|
export { ERROR_MESSAGES_FLAG, SERVICES_API_KEY, } from '@fileverse-dev/formulajs/crypto-constants';
|
|
4
4
|
export { Workbook };
|
|
5
5
|
export type { WorkbookInstance } from './Workbook';
|
|
6
|
+
export type { SidebarPortalRenderer, SidebarPortalRegistryHandle, SidebarPortalTargets, } from './SidebarPanelPortals';
|
|
6
7
|
export type { Cell, Sheet, LiveQueryData } from '../../core';
|
|
7
8
|
export { markCellChanged as animateChangedCell } from '../../core';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const datepickerStyles = "\n .datepicker-toggle {\n display: inline-block;\n position: relative;\n width: 100%;\n }\n \n .datepicker-toggle-button {\n opacity: 0.3;\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n width: 16px;\n height: 16px;\n background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxyZWN0IHg9IjMiIHk9IjQiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgcng9IjIiIHJ5PSIyIj48L3JlY3Q+PGxpbmUgeDE9IjE2IiB5MT0iMiIgeDI9IjE2IiB5Mj0iNiI+PC9saW5lPjxsaW5lIHgxPSI4IiB5MT0iMiIgeDI9IjgiIHkyPSI2Ij48L2xpbmU+PGxpbmUgeDE9IjMiIHkxPSIxMCIgeDI9IjIxIiB5Mj0iMTAiPjwvbGluZT48L3N2Zz4=');\n background-repeat: no-repeat;\n background-position: center;\n pointer-events: none;\n }\n \n .datepicker-input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid
|
|
1
|
+
export declare const datepickerStyles = "\n .datepicker-toggle {\n display: inline-block;\n position: relative;\n width: 100%;\n }\n \n .datepicker-toggle-button {\n opacity: 0.3;\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n width: 16px;\n height: 16px;\n background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxyZWN0IHg9IjMiIHk9IjQiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgcng9IjIiIHJ5PSIyIj48L3JlY3Q+PGxpbmUgeDE9IjE2IiB5MT0iMiIgeDI9IjE2IiB5Mj0iNiI+PC9saW5lPjxsaW5lIHgxPSI4IiB5MT0iMiIgeDI9IjgiIHkyPSI2Ij48L2xpbmU+PGxpbmUgeDE9IjMiIHkxPSIxMCIgeDI9IjIxIiB5Mj0iMTAiPjwvbGluZT48L3N2Zz4=');\n background-repeat: no-repeat;\n background-position: center;\n pointer-events: none;\n }\n \n .datepicker-input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid hsl(var(--color-border-default));\n border-radius: 6px;\n font-size: 14px;\n line-height: 1.5;\n color: hsl(var(--color-text-default));\n background-color: hsl(var(--color-bg-default));\n cursor: pointer;\n color: hsl(var(--color-text-secondary));\n }\n \n .datepicker-input::-webkit-calendar-picker-indicator {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n cursor: pointer;\n opacity: 0;\n }\n \n .datepicker-input:focus {\n outline: none;\n border-color: #0188fb;\n box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);\n }\n";
|
|
2
2
|
export declare const injectDatepickerStyles: () => void;
|