@pagent-libs/core 0.1.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/README.md +32 -0
- package/dist/canvas/cell-renderer.d.ts +45 -0
- package/dist/canvas/cell-renderer.d.ts.map +1 -0
- package/dist/canvas/grid-renderer.d.ts +29 -0
- package/dist/canvas/grid-renderer.d.ts.map +1 -0
- package/dist/canvas/header-renderer.d.ts +58 -0
- package/dist/canvas/header-renderer.d.ts.map +1 -0
- package/dist/canvas/hit-testing.d.ts +81 -0
- package/dist/canvas/hit-testing.d.ts.map +1 -0
- package/dist/canvas/index.d.ts +9 -0
- package/dist/canvas/index.d.ts.map +1 -0
- package/dist/canvas/renderer.d.ts +140 -0
- package/dist/canvas/renderer.d.ts.map +1 -0
- package/dist/canvas/selection-renderer.d.ts +55 -0
- package/dist/canvas/selection-renderer.d.ts.map +1 -0
- package/dist/canvas/text-renderer.d.ts +49 -0
- package/dist/canvas/text-renderer.d.ts.map +1 -0
- package/dist/canvas/types.d.ts +200 -0
- package/dist/canvas/types.d.ts.map +1 -0
- package/dist/collaboration/firebase-provider.d.ts +13 -0
- package/dist/collaboration/firebase-provider.d.ts.map +1 -0
- package/dist/collaboration/index.d.ts +3 -0
- package/dist/collaboration/index.d.ts.map +1 -0
- package/dist/collaboration/types.d.ts +34 -0
- package/dist/collaboration/types.d.ts.map +1 -0
- package/dist/event-emitter.d.ts +13 -0
- package/dist/event-emitter.d.ts.map +1 -0
- package/dist/export/csv.d.ts +5 -0
- package/dist/export/csv.d.ts.map +1 -0
- package/dist/export/index.d.ts +2 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/features/filter.d.ts +58 -0
- package/dist/features/filter.d.ts.map +1 -0
- package/dist/features/freeze.d.ts +86 -0
- package/dist/features/freeze.d.ts.map +1 -0
- package/dist/features/index.d.ts +4 -0
- package/dist/features/index.d.ts.map +1 -0
- package/dist/features/sort.d.ts +15 -0
- package/dist/features/sort.d.ts.map +1 -0
- package/dist/format-pool.d.ts +17 -0
- package/dist/format-pool.d.ts.map +1 -0
- package/dist/formula-graph.d.ts +12 -0
- package/dist/formula-graph.d.ts.map +1 -0
- package/dist/formula-parser/cell-reference.d.ts +7 -0
- package/dist/formula-parser/cell-reference.d.ts.map +1 -0
- package/dist/formula-parser/formula-adjust.d.ts +13 -0
- package/dist/formula-parser/formula-adjust.d.ts.map +1 -0
- package/dist/formula-parser/formula-ranges.d.ts +22 -0
- package/dist/formula-parser/formula-ranges.d.ts.map +1 -0
- package/dist/formula-parser/index.d.ts +6 -0
- package/dist/formula-parser/index.d.ts.map +1 -0
- package/dist/formula-parser/parser.d.ts +18 -0
- package/dist/formula-parser/parser.d.ts.map +1 -0
- package/dist/formula-parser/types.d.ts +33 -0
- package/dist/formula-parser/types.d.ts.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +5823 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +5885 -0
- package/dist/index.js.map +1 -0
- package/dist/sheet.d.ts +119 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/style-pool.d.ts +17 -0
- package/dist/style-pool.d.ts.map +1 -0
- package/dist/types.d.ts +260 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/cell-key.d.ts +7 -0
- package/dist/utils/cell-key.d.ts.map +1 -0
- package/dist/utils/format-utils.d.ts +75 -0
- package/dist/utils/format-utils.d.ts.map +1 -0
- package/dist/utils/range.d.ts +13 -0
- package/dist/utils/range.d.ts.map +1 -0
- package/dist/workbook.d.ts +155 -0
- package/dist/workbook.d.ts.map +1 -0
- package/package.json +46 -0
- package/src/canvas/cell-renderer.ts +181 -0
- package/src/canvas/grid-renderer.ts +238 -0
- package/src/canvas/header-renderer.ts +402 -0
- package/src/canvas/hit-testing.ts +537 -0
- package/src/canvas/index.ts +16 -0
- package/src/canvas/renderer.ts +1056 -0
- package/src/canvas/selection-renderer.ts +604 -0
- package/src/canvas/text-renderer.ts +321 -0
- package/src/canvas/types.ts +289 -0
- package/src/collaboration/firebase-provider.ts +48 -0
- package/src/collaboration/index.ts +5 -0
- package/src/collaboration/types.ts +38 -0
- package/src/event-emitter.ts +73 -0
- package/src/export/csv.ts +101 -0
- package/src/export/index.ts +4 -0
- package/src/features/filter.ts +231 -0
- package/src/features/freeze.ts +271 -0
- package/src/features/index.ts +5 -0
- package/src/features/sort.ts +282 -0
- package/src/format-pool.ts +61 -0
- package/src/formula-graph.ts +84 -0
- package/src/formula-parser/cell-reference.ts +99 -0
- package/src/formula-parser/formula-adjust.ts +129 -0
- package/src/formula-parser/formula-ranges.ts +159 -0
- package/src/formula-parser/index.ts +8 -0
- package/src/formula-parser/parser.ts +438 -0
- package/src/formula-parser/types.ts +39 -0
- package/src/index.ts +25 -0
- package/src/sheet.ts +502 -0
- package/src/style-pool.ts +62 -0
- package/src/types.ts +291 -0
- package/src/utils/cell-key.ts +19 -0
- package/src/utils/format-utils.ts +515 -0
- package/src/utils/range.ts +53 -0
- package/src/workbook.ts +1031 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
export type CellValue = string | number | boolean | null;
|
|
2
|
+
export interface CellStyle {
|
|
3
|
+
bold?: boolean;
|
|
4
|
+
italic?: boolean;
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
fontSize?: number;
|
|
7
|
+
fontColor?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
10
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
11
|
+
borderTop?: string;
|
|
12
|
+
borderRight?: string;
|
|
13
|
+
borderBottom?: string;
|
|
14
|
+
borderLeft?: string;
|
|
15
|
+
textWrap?: boolean;
|
|
16
|
+
textDecoration?: 'none' | 'underline' | 'line-through';
|
|
17
|
+
}
|
|
18
|
+
export type FormatType = 'text' | 'number' | 'currency' | 'accounting' | 'percentage' | 'scientific' | 'fraction' | 'date' | 'time' | 'datetime' | 'duration' | 'custom' | undefined;
|
|
19
|
+
export interface CellFormat {
|
|
20
|
+
type?: FormatType;
|
|
21
|
+
decimalPlaces?: number;
|
|
22
|
+
useThousandsSeparator?: boolean;
|
|
23
|
+
currencyCode?: string;
|
|
24
|
+
currencySymbolPosition?: 'prefix' | 'suffix';
|
|
25
|
+
negativeFormat?: 'minus' | 'parentheses' | 'red';
|
|
26
|
+
dateFormat?: string;
|
|
27
|
+
timeFormat?: string;
|
|
28
|
+
fractionType?: 'upToOne' | 'upToTwo' | 'upToThree' | 'asHalves' | 'asQuarters' | 'asEighths' | 'asSixteenths' | 'asTenths' | 'asHundredths';
|
|
29
|
+
durationFormat?: 'hours' | 'minutes' | 'seconds' | 'milliseconds';
|
|
30
|
+
pattern?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface Cell {
|
|
33
|
+
value: CellValue;
|
|
34
|
+
formula?: string;
|
|
35
|
+
styleId?: string;
|
|
36
|
+
formatId?: string;
|
|
37
|
+
comment?: string;
|
|
38
|
+
hyperlink?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface Range {
|
|
41
|
+
startRow: number;
|
|
42
|
+
startCol: number;
|
|
43
|
+
endRow: number;
|
|
44
|
+
endCol: number;
|
|
45
|
+
}
|
|
46
|
+
export interface Selection {
|
|
47
|
+
ranges: Range[];
|
|
48
|
+
activeCell: {
|
|
49
|
+
row: number;
|
|
50
|
+
col: number;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface SortOrder {
|
|
54
|
+
column: number;
|
|
55
|
+
direction: 'asc' | 'desc';
|
|
56
|
+
}
|
|
57
|
+
export interface ColumnFilter {
|
|
58
|
+
column: number;
|
|
59
|
+
type: 'text' | 'number' | 'date';
|
|
60
|
+
criteria: FilterCriteria;
|
|
61
|
+
}
|
|
62
|
+
export type FilterCriteria = {
|
|
63
|
+
type: 'equals';
|
|
64
|
+
value: string | number;
|
|
65
|
+
} | {
|
|
66
|
+
type: 'notEquals';
|
|
67
|
+
value: string | number;
|
|
68
|
+
} | {
|
|
69
|
+
type: 'contains';
|
|
70
|
+
value: string;
|
|
71
|
+
} | {
|
|
72
|
+
type: 'notContains';
|
|
73
|
+
value: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'startsWith';
|
|
76
|
+
value: string;
|
|
77
|
+
} | {
|
|
78
|
+
type: 'endsWith';
|
|
79
|
+
value: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'greaterThan';
|
|
82
|
+
value: number;
|
|
83
|
+
} | {
|
|
84
|
+
type: 'lessThan';
|
|
85
|
+
value: number;
|
|
86
|
+
} | {
|
|
87
|
+
type: 'greaterThanOrEqual';
|
|
88
|
+
value: number;
|
|
89
|
+
} | {
|
|
90
|
+
type: 'lessThanOrEqual';
|
|
91
|
+
value: number;
|
|
92
|
+
} | {
|
|
93
|
+
type: 'between';
|
|
94
|
+
min: number;
|
|
95
|
+
max: number;
|
|
96
|
+
} | {
|
|
97
|
+
type: 'custom';
|
|
98
|
+
values: Set<string | number>;
|
|
99
|
+
};
|
|
100
|
+
export interface SheetConfig {
|
|
101
|
+
defaultRowHeight?: number;
|
|
102
|
+
defaultColWidth?: number;
|
|
103
|
+
rowHeights?: Map<number, number>;
|
|
104
|
+
colWidths?: Map<number, number>;
|
|
105
|
+
hiddenRows?: Set<number>;
|
|
106
|
+
hiddenCols?: Set<number>;
|
|
107
|
+
frozenRows?: number;
|
|
108
|
+
frozenCols?: number;
|
|
109
|
+
showGridLines?: boolean;
|
|
110
|
+
sortOrder?: SortOrder[];
|
|
111
|
+
filters?: Map<number, ColumnFilter>;
|
|
112
|
+
}
|
|
113
|
+
export interface Sheet {
|
|
114
|
+
id: string;
|
|
115
|
+
name: string;
|
|
116
|
+
cells: Map<string, Cell>;
|
|
117
|
+
config: SheetConfig;
|
|
118
|
+
rowCount: number;
|
|
119
|
+
colCount: number;
|
|
120
|
+
getCell(row: number, col: number): Cell | undefined;
|
|
121
|
+
setCell(row: number, col: number, cell: Partial<Cell>): void;
|
|
122
|
+
deleteCell(row: number, col: number): void;
|
|
123
|
+
getCellValue(row: number, col: number): unknown;
|
|
124
|
+
setCellValue(row: number, col: number, value: unknown): void;
|
|
125
|
+
getRange(range: Range): Map<string, Cell>;
|
|
126
|
+
setRange(range: Range, cells: Map<string, Cell> | Cell[][]): void;
|
|
127
|
+
clearRange(range: Range): void;
|
|
128
|
+
getRowHeight(row: number): number;
|
|
129
|
+
setRowHeight(row: number, height: number): void;
|
|
130
|
+
getColWidth(col: number): number;
|
|
131
|
+
setColWidth(col: number, width: number): void;
|
|
132
|
+
insertRows(startRow: number, count: number): void;
|
|
133
|
+
deleteRows(startRow: number, count: number): void;
|
|
134
|
+
insertCols(startCol: number, count: number): void;
|
|
135
|
+
deleteCols(startCol: number, count: number): void;
|
|
136
|
+
isRowHidden(row: number): boolean;
|
|
137
|
+
hideRow(row: number): void;
|
|
138
|
+
showRow(row: number): void;
|
|
139
|
+
isColHidden(col: number): boolean;
|
|
140
|
+
hideCol(col: number): void;
|
|
141
|
+
showCol(col: number): void;
|
|
142
|
+
getHiddenColsAdjacent(col: number): {
|
|
143
|
+
before: number[];
|
|
144
|
+
after: number[];
|
|
145
|
+
};
|
|
146
|
+
getHiddenRowsAdjacent(row: number): {
|
|
147
|
+
above: number[];
|
|
148
|
+
below: number[];
|
|
149
|
+
};
|
|
150
|
+
showColsInRange(startCol: number, endCol: number): void;
|
|
151
|
+
showRowsInRange(startRow: number, endRow: number): void;
|
|
152
|
+
getFrozenRows(): number;
|
|
153
|
+
setFrozenRows(count: number): void;
|
|
154
|
+
getFrozenCols(): number;
|
|
155
|
+
setFrozenCols(count: number): void;
|
|
156
|
+
setFreeze(rows: number, cols: number): void;
|
|
157
|
+
clearFreeze(): void;
|
|
158
|
+
hasFrozenPanes(): boolean;
|
|
159
|
+
setSortOrder(sortOrder: SortOrder[]): void;
|
|
160
|
+
getSortOrder(): SortOrder[];
|
|
161
|
+
clearSort(): void;
|
|
162
|
+
hasSort(): boolean;
|
|
163
|
+
setFilter(column: number, filter: ColumnFilter): void;
|
|
164
|
+
clearFilter(column: number): void;
|
|
165
|
+
getFilters(): Map<number, ColumnFilter>;
|
|
166
|
+
hasFilter(column: number): boolean;
|
|
167
|
+
clearAllFilters(): void;
|
|
168
|
+
}
|
|
169
|
+
export interface Workbook {
|
|
170
|
+
id: string;
|
|
171
|
+
name: string;
|
|
172
|
+
sheets: Map<string, Sheet>;
|
|
173
|
+
activeSheetId: string;
|
|
174
|
+
defaultRowHeight: number;
|
|
175
|
+
defaultColWidth: number;
|
|
176
|
+
recordHistory(): void;
|
|
177
|
+
undo(): boolean;
|
|
178
|
+
redo(): boolean;
|
|
179
|
+
canUndo(): boolean;
|
|
180
|
+
canRedo(): boolean;
|
|
181
|
+
setSortOrder(sortOrder: SortOrder[], sheetId?: string): void;
|
|
182
|
+
getSortOrder(sheetId?: string): SortOrder[];
|
|
183
|
+
clearSort(sheetId?: string): void;
|
|
184
|
+
sortSheet(sheetId?: string): void;
|
|
185
|
+
setFilter(column: number, filter: ColumnFilter, sheetId?: string): void;
|
|
186
|
+
clearFilter(column: number, sheetId?: string): void;
|
|
187
|
+
getFilters(sheetId?: string): Map<number, ColumnFilter>;
|
|
188
|
+
clearAllFilters(sheetId?: string): void;
|
|
189
|
+
getData(): WorkbookData;
|
|
190
|
+
setData(data: WorkbookData): void;
|
|
191
|
+
}
|
|
192
|
+
export interface StylePool {
|
|
193
|
+
styles: Map<string, CellStyle>;
|
|
194
|
+
getOrCreate(style: CellStyle): string;
|
|
195
|
+
get(styleId: string): CellStyle | undefined;
|
|
196
|
+
getAllStyles(): Map<string, CellStyle>;
|
|
197
|
+
}
|
|
198
|
+
export interface FormatPool {
|
|
199
|
+
getOrCreate(format: CellFormat): string;
|
|
200
|
+
get(formatId: string): CellFormat | undefined;
|
|
201
|
+
getAllFormats(): Map<string, CellFormat>;
|
|
202
|
+
}
|
|
203
|
+
export interface WorkbookData {
|
|
204
|
+
id: string;
|
|
205
|
+
name: string;
|
|
206
|
+
activeSheetId: string;
|
|
207
|
+
defaultRowHeight: number;
|
|
208
|
+
defaultColWidth: number;
|
|
209
|
+
stylePool: Record<string, CellStyle>;
|
|
210
|
+
formatPool?: Record<string, CellFormat>;
|
|
211
|
+
sheets: SheetData[];
|
|
212
|
+
selection?: Selection;
|
|
213
|
+
}
|
|
214
|
+
export interface SheetData {
|
|
215
|
+
id: string;
|
|
216
|
+
name: string;
|
|
217
|
+
cells: Array<{
|
|
218
|
+
key: string;
|
|
219
|
+
cell: Cell;
|
|
220
|
+
}>;
|
|
221
|
+
config: {
|
|
222
|
+
defaultRowHeight?: number;
|
|
223
|
+
defaultColWidth?: number;
|
|
224
|
+
rowHeights?: Array<[number, number]>;
|
|
225
|
+
colWidths?: Array<[number, number]>;
|
|
226
|
+
hiddenRows?: number[];
|
|
227
|
+
hiddenCols?: number[];
|
|
228
|
+
frozenRows?: number;
|
|
229
|
+
frozenCols?: number;
|
|
230
|
+
showGridLines?: boolean;
|
|
231
|
+
sortOrder?: SortOrder[];
|
|
232
|
+
filters?: Array<[number, ColumnFilter]>;
|
|
233
|
+
};
|
|
234
|
+
rowCount: number;
|
|
235
|
+
colCount: number;
|
|
236
|
+
}
|
|
237
|
+
export interface FormulaNode {
|
|
238
|
+
cellKey: string;
|
|
239
|
+
formula: string;
|
|
240
|
+
dependencies: Set<string>;
|
|
241
|
+
dependents: Set<string>;
|
|
242
|
+
cachedValue?: CellValue;
|
|
243
|
+
isDirty: boolean;
|
|
244
|
+
}
|
|
245
|
+
export interface FormulaGraph {
|
|
246
|
+
nodes: Map<string, FormulaNode>;
|
|
247
|
+
addFormula(cellKey: string, formula: string, dependencies: Set<string>): void;
|
|
248
|
+
removeFormula(cellKey: string): void;
|
|
249
|
+
getDependents(cellKey: string): Set<string>;
|
|
250
|
+
getDependencies(cellKey: string): Set<string>;
|
|
251
|
+
invalidate(cellKey: string): void;
|
|
252
|
+
getDirtyCells(): Set<string>;
|
|
253
|
+
}
|
|
254
|
+
export type EventType = 'cellChange' | 'cellSelection' | 'sheetChange' | 'sheetAdd' | 'sheetDelete' | 'sheetRename' | 'workbookChange';
|
|
255
|
+
export interface EventData {
|
|
256
|
+
type: EventType;
|
|
257
|
+
payload: unknown;
|
|
258
|
+
}
|
|
259
|
+
export type EventHandler = (data: EventData) => void;
|
|
260
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEzD,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACxC,aAAa,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,cAAc,CAAC;CACxD;AAED,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,QAAQ,GACR,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,MAAM,GACN,MAAM,GACN,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,UAA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@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell-key.d.ts","sourceRoot":"","sources":["../../src/utils/cell-key.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAGtE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAMnD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { CellFormat, FormatType } from '../../src/types';
|
|
2
|
+
/**
|
|
3
|
+
* Main number formatter that delegates to specific format handlers
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatNumber(value: number, format: CellFormat): string;
|
|
6
|
+
/**
|
|
7
|
+
* Format plain numbers with decimal places and thousands separator
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatPlainNumber(value: number, format: CellFormat): string;
|
|
10
|
+
/**
|
|
11
|
+
* Format currency values
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatCurrency(value: number, format: CellFormat): string;
|
|
14
|
+
/**
|
|
15
|
+
* Format accounting style (currency symbol aligned left)
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatAccounting(value: number, format: CellFormat): string;
|
|
18
|
+
/**
|
|
19
|
+
* Format percentage values
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatPercentage(value: number, format: CellFormat): string;
|
|
22
|
+
/**
|
|
23
|
+
* Format scientific notation
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatScientific(value: number, format: CellFormat): string;
|
|
26
|
+
/**
|
|
27
|
+
* Format fraction values
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatFraction(value: number, format: CellFormat): string;
|
|
30
|
+
/**
|
|
31
|
+
* Format date values from Excel date serial
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatDate(value: number, format: CellFormat): string;
|
|
34
|
+
/**
|
|
35
|
+
* Format time values
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatTime(value: number, format: CellFormat): string;
|
|
38
|
+
/**
|
|
39
|
+
* Format combined date and time
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatDateTime(value: number, format: CellFormat): string;
|
|
42
|
+
/**
|
|
43
|
+
* Format duration values
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatDuration(value: number, format: CellFormat): string;
|
|
46
|
+
/**
|
|
47
|
+
* Format custom pattern
|
|
48
|
+
*/
|
|
49
|
+
export declare function formatCustomPattern(value: number, pattern: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Convert Excel date serial to JavaScript Date
|
|
52
|
+
*/
|
|
53
|
+
export declare function excelDateToJS(serial: number): Date;
|
|
54
|
+
/**
|
|
55
|
+
* Convert JavaScript Date to Excel date serial
|
|
56
|
+
*/
|
|
57
|
+
export declare function jsToExcelDate(date: Date): number;
|
|
58
|
+
/**
|
|
59
|
+
* Parse common date string formats and return Excel date serial
|
|
60
|
+
* Supports formats like: YYYY/MM/DD, YYYY-MM-DD, DD-MM-YYYY, MM/DD/YYYY, etc.
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseDateString(dateStr: string): number | null;
|
|
63
|
+
/**
|
|
64
|
+
* Format JavaScript Date according to pattern
|
|
65
|
+
*/
|
|
66
|
+
export declare function formatJSDate(date: Date, pattern: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Check if two formats are equivalent
|
|
69
|
+
*/
|
|
70
|
+
export declare function areFormatsEqual(format1: CellFormat | undefined, format2: CellFormat | undefined): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Get default format for a format type
|
|
73
|
+
*/
|
|
74
|
+
export declare function getDefaultFormatForType(type: FormatType): CellFormat;
|
|
75
|
+
//# sourceMappingURL=format-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-utils.d.ts","sourceRo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AgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAc1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAMlD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAMhD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA+D9D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAmBhE;AA6CD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAKzG;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CA4BpE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Range } from '../../src/types';
|
|
2
|
+
export declare function normalizeRange(range: Range): Range;
|
|
3
|
+
export declare function rangeContains(range: Range, row: number, col: number): boolean;
|
|
4
|
+
export declare function rangeIntersects(range1: Range, range2: Range): boolean;
|
|
5
|
+
export declare function getRangeCells(range: Range): Array<{
|
|
6
|
+
row: number;
|
|
7
|
+
col: number;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function getRangeSize(range: Range): {
|
|
10
|
+
rows: number;
|
|
11
|
+
cols: number;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../src/utils/range.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAOlD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAQ7E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CASrE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAS/E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAMzE"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { Workbook, Sheet, Cell, Selection, SortOrder, EventType, EventHandler } from '../src/types';
|
|
2
|
+
import { SheetImpl } from '../src/sheet';
|
|
3
|
+
import { FormulaGraphImpl } from '../src/formula-graph';
|
|
4
|
+
import { StylePool } from '../src/style-pool';
|
|
5
|
+
import { FormatPool } from '../src/format-pool';
|
|
6
|
+
export declare class WorkbookImpl implements Workbook {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
sheets: Map<string, Sheet>;
|
|
10
|
+
activeSheetId: string;
|
|
11
|
+
defaultRowHeight: number;
|
|
12
|
+
defaultColWidth: number;
|
|
13
|
+
private events;
|
|
14
|
+
private formulaGraph;
|
|
15
|
+
private stylePool;
|
|
16
|
+
private formatPool;
|
|
17
|
+
private formulaParser;
|
|
18
|
+
private selection;
|
|
19
|
+
private evaluatingCells;
|
|
20
|
+
private undoStack;
|
|
21
|
+
private redoStack;
|
|
22
|
+
private maxHistorySize;
|
|
23
|
+
private isUndoing;
|
|
24
|
+
private isRedoing;
|
|
25
|
+
private isBatching;
|
|
26
|
+
constructor(id: string, name: string);
|
|
27
|
+
addSheet(name: string): Sheet;
|
|
28
|
+
deleteSheet(sheetId: string): void;
|
|
29
|
+
getSheet(sheetId?: string): SheetImpl;
|
|
30
|
+
setActiveSheet(sheetId: string): void;
|
|
31
|
+
renameSheet(sheetId: string, newName: string): void;
|
|
32
|
+
getSheetIdByName(sheetName: string): string | undefined;
|
|
33
|
+
getCell(sheetId: string | undefined, row: number, col: number): Cell | undefined;
|
|
34
|
+
setCell(sheetId: string | undefined, row: number, col: number, cell: Partial<Cell>): void;
|
|
35
|
+
setCellValue(sheetId: string | undefined, row: number, col: number, value: unknown): void;
|
|
36
|
+
getCellValue(sheetId: string | undefined, row: number, col: number): unknown;
|
|
37
|
+
setFormula(sheetId: string | undefined, row: number, col: number, formula: string): void;
|
|
38
|
+
getSelection(): Selection;
|
|
39
|
+
setSelection(selection: Selection): void;
|
|
40
|
+
batch(operations: () => void): void;
|
|
41
|
+
on(event: EventType, handler: EventHandler): () => void;
|
|
42
|
+
off(event: EventType, handler: EventHandler): void;
|
|
43
|
+
getFormulaGraph(): FormulaGraphImpl;
|
|
44
|
+
getStylePool(): StylePool;
|
|
45
|
+
getFormatPool(): FormatPool;
|
|
46
|
+
/**
|
|
47
|
+
* Get the calculated value of a cell (evaluates formulas)
|
|
48
|
+
*/
|
|
49
|
+
getCellCalculatedValue(sheetId: string | undefined, row: number, col: number): unknown;
|
|
50
|
+
/**
|
|
51
|
+
* Evaluate a formula and store the result
|
|
52
|
+
*/
|
|
53
|
+
private evaluateFormula;
|
|
54
|
+
/**
|
|
55
|
+
* Get values from a range for formula evaluation
|
|
56
|
+
* Note: Range references are already resolved to absolute positions during parsing,
|
|
57
|
+
* but we keep the currentRow/currentCol parameters for consistency with the API
|
|
58
|
+
*/
|
|
59
|
+
private getRangeValues;
|
|
60
|
+
/**
|
|
61
|
+
* Recalculate all cells that depend on the given cell
|
|
62
|
+
*/
|
|
63
|
+
private recalculateDependents;
|
|
64
|
+
/**
|
|
65
|
+
* Create a snapshot of the current workbook state
|
|
66
|
+
*/
|
|
67
|
+
private createSnapshot;
|
|
68
|
+
/**
|
|
69
|
+
* Restore workbook state from a snapshot
|
|
70
|
+
*/
|
|
71
|
+
private restoreSnapshot;
|
|
72
|
+
/**
|
|
73
|
+
* Record current state for undo
|
|
74
|
+
*/
|
|
75
|
+
recordHistory(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Undo the last operation
|
|
78
|
+
*/
|
|
79
|
+
undo(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Redo the last undone operation
|
|
82
|
+
*/
|
|
83
|
+
redo(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Check if undo is available
|
|
86
|
+
*/
|
|
87
|
+
canUndo(): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Check if redo is available
|
|
90
|
+
*/
|
|
91
|
+
canRedo(): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Get complete workbook data for serialization
|
|
94
|
+
*/
|
|
95
|
+
getData(): import('../src/types').WorkbookData;
|
|
96
|
+
/**
|
|
97
|
+
* Set complete workbook data from serialized data
|
|
98
|
+
*/
|
|
99
|
+
setData(data: import('../src/types').WorkbookData): void;
|
|
100
|
+
/**
|
|
101
|
+
* Clean up format object to only include properties relevant to the format type
|
|
102
|
+
*/
|
|
103
|
+
private cleanFormat;
|
|
104
|
+
/**
|
|
105
|
+
* Rebuild formula graph from current cells and evaluate all formulas
|
|
106
|
+
*/
|
|
107
|
+
private rebuildFormulaGraph;
|
|
108
|
+
/**
|
|
109
|
+
* Set the sort order for a sheet
|
|
110
|
+
* @param sortOrder Sort order to apply
|
|
111
|
+
* @param sheetId Target sheet ID (defaults to active sheet)
|
|
112
|
+
*/
|
|
113
|
+
setSortOrder(sortOrder: SortOrder[], sheetId?: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* Get the sort order for a sheet
|
|
116
|
+
* @param sheetId Target sheet ID (defaults to active sheet)
|
|
117
|
+
* @returns Current sort order
|
|
118
|
+
*/
|
|
119
|
+
getSortOrder(sheetId?: string): SortOrder[];
|
|
120
|
+
/**
|
|
121
|
+
* Clear sorting for a sheet
|
|
122
|
+
* @param sheetId Target sheet ID (defaults to active sheet)
|
|
123
|
+
*/
|
|
124
|
+
clearSort(sheetId?: string): void;
|
|
125
|
+
/**
|
|
126
|
+
* Sort the sheet data according to current sort order
|
|
127
|
+
* @param sheetId Target sheet ID (defaults to active sheet)
|
|
128
|
+
*/
|
|
129
|
+
sortSheet(sheetId?: string): void;
|
|
130
|
+
/**
|
|
131
|
+
* Set a filter for a column
|
|
132
|
+
* @param column Column index
|
|
133
|
+
* @param filter Filter configuration
|
|
134
|
+
* @param sheetId Target sheet ID (defaults to active sheet)
|
|
135
|
+
*/
|
|
136
|
+
setFilter(column: number, filter: import('../src/types').ColumnFilter, sheetId?: string): void;
|
|
137
|
+
/**
|
|
138
|
+
* Clear filter for a specific column
|
|
139
|
+
* @param column Column index
|
|
140
|
+
* @param sheetId Target sheet ID (defaults to active sheet)
|
|
141
|
+
*/
|
|
142
|
+
clearFilter(column: number, sheetId?: string): void;
|
|
143
|
+
/**
|
|
144
|
+
* Get all active filters for a sheet
|
|
145
|
+
* @param sheetId Target sheet ID (defaults to active sheet)
|
|
146
|
+
* @returns Map of column -> filter
|
|
147
|
+
*/
|
|
148
|
+
getFilters(sheetId?: string): Map<number, import('../src/types').ColumnFilter>;
|
|
149
|
+
/**
|
|
150
|
+
* Clear all filters for a sheet
|
|
151
|
+
* @param sheetId Target sheet ID (defaults to active sheet)
|
|
152
|
+
*/
|
|
153
|
+
clearAllFilters(sheetId?: string): void;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=workbook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workbook.d.ts","sourceRoot":"","sources":["../src/workbook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAa,SAAS,EAAyB,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtI,OAAO,EA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CAYxC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pagent-libs/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Core spreadsheet engine for pagent-sheets",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.esm.js",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rollup -c",
|
|
22
|
+
"dev": "rollup -c -w",
|
|
23
|
+
"type-check": "tsc --noEmit",
|
|
24
|
+
"test": "jest",
|
|
25
|
+
"clean": "rm -rf dist"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"spreadsheet",
|
|
29
|
+
"sheet",
|
|
30
|
+
"excel",
|
|
31
|
+
"data-table"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"immer": "^10.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@rollup/plugin-typescript": "^11.1.0",
|
|
39
|
+
"@types/jest": "^29.5.0",
|
|
40
|
+
"jest": "^29.7.0",
|
|
41
|
+
"rollup": "^4.0.0",
|
|
42
|
+
"ts-jest": "^29.1.0",
|
|
43
|
+
"typescript": "^5.2.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|