@ricsam/formula-engine 0.0.16 → 0.0.18
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/cjs/core/api/api-builder.cjs +67 -0
- package/dist/cjs/core/api/api-builder.cjs.map +10 -0
- package/dist/cjs/core/api/api-helpers.cjs +191 -0
- package/dist/cjs/core/api/api-helpers.cjs.map +10 -0
- package/dist/cjs/core/api/api.cjs +65 -0
- package/dist/cjs/core/api/api.cjs.map +10 -0
- package/dist/cjs/core/api/cell-orm.cjs +80 -0
- package/dist/cjs/core/api/cell-orm.cjs.map +10 -0
- package/dist/cjs/core/api/table-orm.cjs +171 -0
- package/dist/cjs/core/api/table-orm.cjs.map +10 -0
- package/dist/cjs/core/autofill-utils.cjs +75 -39
- package/dist/cjs/core/autofill-utils.cjs.map +3 -3
- package/dist/cjs/core/cell-mover.cjs +178 -0
- package/dist/cjs/core/cell-mover.cjs.map +10 -0
- package/dist/cjs/core/commands/command-executor.cjs +140 -0
- package/dist/cjs/core/commands/command-executor.cjs.map +10 -0
- package/dist/cjs/core/commands/content-commands.cjs +574 -0
- package/dist/cjs/core/commands/content-commands.cjs.map +10 -0
- package/dist/cjs/core/commands/index.cjs +95 -0
- package/dist/cjs/core/commands/index.cjs.map +10 -0
- package/dist/cjs/core/commands/metadata-commands.cjs +150 -0
- package/dist/cjs/core/commands/metadata-commands.cjs.map +10 -0
- package/dist/cjs/core/commands/named-expression-commands.cjs +238 -0
- package/dist/cjs/core/commands/named-expression-commands.cjs.map +10 -0
- package/dist/cjs/core/commands/structure-commands.cjs +495 -0
- package/dist/cjs/core/commands/structure-commands.cjs.map +10 -0
- package/dist/cjs/core/commands/style-commands.cjs +219 -0
- package/dist/cjs/core/commands/style-commands.cjs.map +10 -0
- package/dist/cjs/core/commands/table-commands.cjs +226 -0
- package/dist/cjs/core/commands/table-commands.cjs.map +10 -0
- package/dist/cjs/core/commands/types.cjs +72 -0
- package/dist/cjs/core/commands/types.cjs.map +10 -0
- package/dist/cjs/core/engine.cjs +218 -263
- package/dist/cjs/core/engine.cjs.map +3 -3
- package/dist/cjs/core/managers/api-schema-manager.cjs +304 -0
- package/dist/cjs/core/managers/api-schema-manager.cjs.map +10 -0
- package/dist/cjs/core/managers/copy-manager.cjs +336 -82
- package/dist/cjs/core/managers/copy-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/reference-manager.cjs +124 -0
- package/dist/cjs/core/managers/reference-manager.cjs.map +10 -0
- package/dist/cjs/core/managers/style-manager.cjs +115 -147
- package/dist/cjs/core/managers/style-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/workbook-manager.cjs +87 -3
- package/dist/cjs/core/managers/workbook-manager.cjs.map +3 -3
- package/dist/cjs/core/types.cjs.map +1 -1
- package/dist/cjs/lib.cjs +13 -2
- package/dist/cjs/lib.cjs.map +3 -3
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/core/api/api-builder.mjs +37 -0
- package/dist/mjs/core/api/api-builder.mjs.map +10 -0
- package/dist/mjs/core/api/api-helpers.mjs +161 -0
- package/dist/mjs/core/api/api-helpers.mjs.map +10 -0
- package/dist/mjs/core/api/api.mjs +35 -0
- package/dist/mjs/core/api/api.mjs.map +10 -0
- package/dist/mjs/core/api/cell-orm.mjs +49 -0
- package/dist/mjs/core/api/cell-orm.mjs.map +10 -0
- package/dist/mjs/core/api/table-orm.mjs +148 -0
- package/dist/mjs/core/api/table-orm.mjs.map +10 -0
- package/dist/mjs/core/autofill-utils.mjs +75 -39
- package/dist/mjs/core/autofill-utils.mjs.map +3 -3
- package/dist/mjs/core/cell-mover.mjs +148 -0
- package/dist/mjs/core/cell-mover.mjs.map +10 -0
- package/dist/mjs/core/commands/command-executor.mjs +109 -0
- package/dist/mjs/core/commands/command-executor.mjs.map +10 -0
- package/dist/mjs/core/commands/content-commands.mjs +544 -0
- package/dist/mjs/core/commands/content-commands.mjs.map +10 -0
- package/dist/mjs/core/commands/index.mjs +87 -0
- package/dist/mjs/core/commands/index.mjs.map +10 -0
- package/dist/mjs/core/commands/metadata-commands.mjs +120 -0
- package/dist/mjs/core/commands/metadata-commands.mjs.map +10 -0
- package/dist/mjs/core/commands/named-expression-commands.mjs +208 -0
- package/dist/mjs/core/commands/named-expression-commands.mjs.map +10 -0
- package/dist/mjs/core/commands/structure-commands.mjs +465 -0
- package/dist/mjs/core/commands/structure-commands.mjs.map +10 -0
- package/dist/mjs/core/commands/style-commands.mjs +189 -0
- package/dist/mjs/core/commands/style-commands.mjs.map +10 -0
- package/dist/mjs/core/commands/table-commands.mjs +196 -0
- package/dist/mjs/core/commands/table-commands.mjs.map +10 -0
- package/dist/mjs/core/commands/types.mjs +42 -0
- package/dist/mjs/core/commands/types.mjs.map +10 -0
- package/dist/mjs/core/engine.mjs +253 -263
- package/dist/mjs/core/engine.mjs.map +3 -3
- package/dist/mjs/core/managers/api-schema-manager.mjs +274 -0
- package/dist/mjs/core/managers/api-schema-manager.mjs.map +10 -0
- package/dist/mjs/core/managers/copy-manager.mjs +338 -82
- package/dist/mjs/core/managers/copy-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/reference-manager.mjs +93 -0
- package/dist/mjs/core/managers/reference-manager.mjs.map +10 -0
- package/dist/mjs/core/managers/style-manager.mjs +115 -147
- package/dist/mjs/core/managers/style-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/workbook-manager.mjs +87 -3
- package/dist/mjs/core/managers/workbook-manager.mjs.map +3 -3
- package/dist/mjs/core/types.mjs.map +1 -1
- package/dist/mjs/lib.mjs +13 -2
- package/dist/mjs/lib.mjs.map +3 -3
- package/dist/mjs/package.json +1 -1
- package/dist/types/core/api/api-builder.d.ts +16 -0
- package/dist/types/core/api/api-helpers.d.ts +37 -0
- package/dist/types/core/api/api.d.ts +83 -0
- package/dist/types/core/api/api.type-test.d.ts +1 -0
- package/dist/types/core/api/cell-orm.d.ts +29 -0
- package/dist/types/core/api/table-orm.d.ts +46 -0
- package/dist/types/core/autofill-utils.d.ts +6 -9
- package/dist/types/core/cell-mover.d.ts +63 -0
- package/dist/types/core/commands/command-executor.d.ts +83 -0
- package/dist/types/core/commands/content-commands.d.ts +142 -0
- package/dist/types/core/commands/index.d.ts +16 -0
- package/dist/types/core/commands/metadata-commands.d.ts +55 -0
- package/dist/types/core/commands/named-expression-commands.d.ts +115 -0
- package/dist/types/core/commands/structure-commands.d.ts +132 -0
- package/dist/types/core/commands/style-commands.d.ts +76 -0
- package/dist/types/core/commands/table-commands.d.ts +104 -0
- package/dist/types/core/commands/types.d.ts +114 -0
- package/dist/types/core/engine.d.ts +241 -23
- package/dist/types/core/managers/api-schema-manager.d.ts +121 -0
- package/dist/types/core/managers/copy-manager.d.ts +47 -2
- package/dist/types/core/managers/reference-manager.d.ts +54 -0
- package/dist/types/core/managers/style-manager.d.ts +6 -6
- package/dist/types/core/managers/workbook-manager.d.ts +39 -1
- package/dist/types/core/types.d.ts +52 -11
- package/dist/types/lib.d.ts +8 -0
- package/package.json +1 -1
|
@@ -72,6 +72,7 @@ export declare class WorkbookManager {
|
|
|
72
72
|
newSheetName: string;
|
|
73
73
|
}): Sheet;
|
|
74
74
|
updateAllFormulas(updateCallback: (formula: string) => string): void;
|
|
75
|
+
updateFormulasExcluding(excludeCellsSet: Set<string>, updateCallback: (formula: string) => string): void;
|
|
75
76
|
updateFormulasForWorkbook(workbookName: string, updateCallback: (formula: string) => string): void;
|
|
76
77
|
getSheetSerialized({ workbookName, sheetName, }: {
|
|
77
78
|
workbookName: string;
|
|
@@ -104,6 +105,43 @@ export declare class WorkbookManager {
|
|
|
104
105
|
*/
|
|
105
106
|
buildingFromScratch?: boolean;
|
|
106
107
|
}): void;
|
|
108
|
+
/**
|
|
109
|
+
* Set metadata for a cell
|
|
110
|
+
*/
|
|
111
|
+
setCellMetadata<TMetadata = unknown>(address: CellAddress, metadata: TMetadata | undefined): void;
|
|
112
|
+
/**
|
|
113
|
+
* Get metadata for a cell
|
|
114
|
+
*/
|
|
115
|
+
getCellMetadata<TMetadata = unknown>(address: CellAddress): TMetadata | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Get all metadata for a sheet
|
|
118
|
+
*/
|
|
119
|
+
getSheetMetadataSerialized<TMetadata = unknown>(opts: {
|
|
120
|
+
sheetName: string;
|
|
121
|
+
workbookName: string;
|
|
122
|
+
}): Map<string, TMetadata>;
|
|
123
|
+
/**
|
|
124
|
+
* Set metadata for a sheet
|
|
125
|
+
*/
|
|
126
|
+
setSheetMetadata<TSheetMetadata = unknown>(opts: {
|
|
127
|
+
workbookName: string;
|
|
128
|
+
sheetName: string;
|
|
129
|
+
}, metadata: TSheetMetadata): void;
|
|
130
|
+
/**
|
|
131
|
+
* Get metadata for a sheet
|
|
132
|
+
*/
|
|
133
|
+
getSheetMetadata<TSheetMetadata = unknown>(opts: {
|
|
134
|
+
workbookName: string;
|
|
135
|
+
sheetName: string;
|
|
136
|
+
}): TSheetMetadata | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Set metadata for a workbook
|
|
139
|
+
*/
|
|
140
|
+
setWorkbookMetadata<TWorkbookMetadata = unknown>(workbookName: string, metadata: TWorkbookMetadata): void;
|
|
141
|
+
/**
|
|
142
|
+
* Get metadata for a workbook
|
|
143
|
+
*/
|
|
144
|
+
getWorkbookMetadata<TWorkbookMetadata = unknown>(workbookName: string): TWorkbookMetadata | undefined;
|
|
107
145
|
/**
|
|
108
146
|
* Replace all content for a sheet (safely, without breaking references)
|
|
109
147
|
* This method clears the existing Map and repopulates it rather than replacing the Map reference
|
|
@@ -124,7 +162,7 @@ export declare class WorkbookManager {
|
|
|
124
162
|
*/
|
|
125
163
|
iterateCellsInRange(address: RangeAddress): Generator<CellAddress>;
|
|
126
164
|
getCellsInRange(address: RangeAddress): CellAddress[];
|
|
127
|
-
|
|
165
|
+
getCellContent(cellAddress: CellAddress): SerializedCellValue;
|
|
128
166
|
getSerializedCellValue(cellAddress: CellAddress): SerializedCellValue;
|
|
129
167
|
isCellEmpty(cellAddress: CellAddress): boolean;
|
|
130
168
|
isFormulaCell(cellAddress: CellAddress): boolean;
|
|
@@ -109,14 +109,42 @@ export declare enum FormulaError {
|
|
|
109
109
|
ERROR = "#ERROR!",
|
|
110
110
|
SPILL = "#SPILL!"
|
|
111
111
|
}
|
|
112
|
-
export interface Sheet {
|
|
112
|
+
export interface Sheet<TCellMetadata = unknown, TSheetMetadata = unknown> {
|
|
113
113
|
name: string;
|
|
114
114
|
index: number;
|
|
115
115
|
content: Map<string, SerializedCellValue>;
|
|
116
|
+
/**
|
|
117
|
+
* Cell metadata - arbitrary consumer-defined data per cell
|
|
118
|
+
* Examples: rich text content, links, comments, custom app data
|
|
119
|
+
* The engine stores and copies this data but doesn't interpret it
|
|
120
|
+
* Keyed by cell reference (e.g., "A1")
|
|
121
|
+
*/
|
|
122
|
+
metadata: Map<string, TCellMetadata>;
|
|
123
|
+
/**
|
|
124
|
+
* Sheet-level metadata - arbitrary consumer-defined data for the entire sheet
|
|
125
|
+
* Examples: text boxes, drawings, frozen panes, print settings
|
|
126
|
+
* The engine stores and copies this data but doesn't interpret it
|
|
127
|
+
*/
|
|
128
|
+
sheetMetadata: TSheetMetadata;
|
|
116
129
|
}
|
|
117
|
-
export interface Workbook {
|
|
130
|
+
export interface Workbook<TCellMetadata = unknown, TSheetMetadata = unknown, TWorkbookMetadata = unknown> {
|
|
118
131
|
name: string;
|
|
119
|
-
sheets: Map<string, Sheet
|
|
132
|
+
sheets: Map<string, Sheet<TCellMetadata, TSheetMetadata>>;
|
|
133
|
+
/**
|
|
134
|
+
* Workbook-level metadata - arbitrary consumer-defined data for the entire workbook
|
|
135
|
+
* Examples: themes, custom ribbons, document properties, workbook settings
|
|
136
|
+
* The engine stores and copies this data but doesn't interpret it
|
|
137
|
+
*/
|
|
138
|
+
workbookMetadata: TWorkbookMetadata;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Tracked reference - a stable reference to a range that updates automatically
|
|
142
|
+
* when workbooks/sheets are renamed and becomes invalid when they're deleted
|
|
143
|
+
*/
|
|
144
|
+
export interface TrackedReference {
|
|
145
|
+
id: string;
|
|
146
|
+
address: RangeAddress;
|
|
147
|
+
isValid: boolean;
|
|
120
148
|
}
|
|
121
149
|
export type ValueEvaluationResult = {
|
|
122
150
|
type: "value";
|
|
@@ -301,11 +329,11 @@ export interface GradientStyleCondition {
|
|
|
301
329
|
}
|
|
302
330
|
export type StyleCondition = FormulaStyleCondition | GradientStyleCondition;
|
|
303
331
|
export interface ConditionalStyle {
|
|
304
|
-
|
|
332
|
+
areas: RangeAddress[];
|
|
305
333
|
condition: StyleCondition;
|
|
306
334
|
}
|
|
307
335
|
export interface DirectCellStyle {
|
|
308
|
-
|
|
336
|
+
areas: RangeAddress[];
|
|
309
337
|
style: CellStyle;
|
|
310
338
|
}
|
|
311
339
|
export interface CellStyle {
|
|
@@ -317,19 +345,32 @@ export interface CellStyle {
|
|
|
317
345
|
underline?: boolean;
|
|
318
346
|
}
|
|
319
347
|
export interface CopyCellsOptions {
|
|
320
|
-
cut: boolean;
|
|
321
348
|
/**
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
|
|
349
|
+
* Whether this is a cut operation (clears source cells after copying)
|
|
350
|
+
* @default false
|
|
351
|
+
*/
|
|
352
|
+
cut?: boolean;
|
|
353
|
+
/**
|
|
354
|
+
* What to include in the copy operation.
|
|
355
|
+
* - Use 'all' as shorthand for ['content', 'style', 'metadata']
|
|
356
|
+
* - Use array for fine-grained control over what to copy:
|
|
357
|
+
* - ['content'] - copy only values/formulas
|
|
358
|
+
* - ['style'] - copy only formatting
|
|
359
|
+
* - ['metadata'] - copy only metadata (rich text, links, etc.)
|
|
360
|
+
* - ['content', 'style'] - copy content and formatting
|
|
361
|
+
* - ['content', 'metadata'] - copy content and metadata
|
|
362
|
+
* - ['style', 'metadata'] - copy formatting and metadata
|
|
363
|
+
* - ['content', 'style', 'metadata'] - same as 'all'
|
|
364
|
+
* @default 'all'
|
|
325
365
|
*/
|
|
326
|
-
|
|
366
|
+
include?: "all" | ("content" | "style" | "metadata")[];
|
|
327
367
|
/**
|
|
328
368
|
* The type of the content to copy
|
|
329
369
|
* value: Copy the value from the source to the target,
|
|
330
370
|
* e.g. if the cell has the formula =123 + 123 then the value is 246
|
|
331
371
|
* formula: Copy the formula from the source to the target,
|
|
332
372
|
* e.g. if the cell has the formula =123 + 123 then the formula is =123 + 123 is copied
|
|
373
|
+
* @default 'formula'
|
|
333
374
|
*/
|
|
334
|
-
type
|
|
375
|
+
type?: "value" | "formula";
|
|
335
376
|
}
|
package/dist/types/lib.d.ts
CHANGED
|
@@ -2,3 +2,11 @@ export { FormulaEngine } from "./core/engine";
|
|
|
2
2
|
export * from "./core/types";
|
|
3
3
|
export * from "./core/utils";
|
|
4
4
|
export * from "./core/utils/color-utils";
|
|
5
|
+
export { defineApi, createApi } from "./core/api/api";
|
|
6
|
+
export type { CreateApi, Declaration, Api, TableApi, CellApi } from "./core/api/api";
|
|
7
|
+
export { TableOrm } from "./core/api/table-orm";
|
|
8
|
+
export { CellOrm } from "./core/api/cell-orm";
|
|
9
|
+
export { SchemaValidationError } from "./core/managers/api-schema-manager";
|
|
10
|
+
export type { ValidationResult } from "./core/managers/api-schema-manager";
|
|
11
|
+
export { SchemaIntegrityError } from "./core/commands";
|
|
12
|
+
export type { EngineAction, EngineCommand } from "./core/commands";
|