@visactor/vtable-sheet 1.22.7 → 1.22.8-alpha.13
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/cjs/components/sheet-tab-event-handler.js +3 -2
- package/cjs/components/sheet-tab-event-handler.js.map +1 -1
- package/cjs/components/vtable-sheet.d.ts +2 -1
- package/cjs/components/vtable-sheet.js +9 -1
- package/cjs/components/vtable-sheet.js.map +1 -1
- package/cjs/core/WorkSheet.d.ts +1 -1
- package/cjs/core/WorkSheet.js.map +1 -1
- package/cjs/core/table-plugins.js +7 -5
- package/cjs/core/table-plugins.js.map +1 -1
- package/cjs/formula/cell-highlight-manager.d.ts +1 -0
- package/cjs/formula/cell-highlight-manager.js +27 -22
- package/cjs/formula/cell-highlight-manager.js.map +1 -1
- package/cjs/formula/cross-sheet-data-synchronizer.d.ts +48 -0
- package/cjs/formula/cross-sheet-data-synchronizer.js +159 -0
- package/cjs/formula/cross-sheet-data-synchronizer.js.map +1 -0
- package/cjs/formula/cross-sheet-formula-handler.d.ts +58 -0
- package/cjs/formula/cross-sheet-formula-handler.js +240 -0
- package/cjs/formula/cross-sheet-formula-handler.js.map +1 -0
- package/cjs/formula/cross-sheet-formula-manager.d.ts +52 -0
- package/cjs/formula/cross-sheet-formula-manager.js +235 -0
- package/cjs/formula/cross-sheet-formula-manager.js.map +1 -0
- package/cjs/formula/cross-sheet-formula-validator.d.ts +56 -0
- package/cjs/formula/cross-sheet-formula-validator.js +271 -0
- package/cjs/formula/cross-sheet-formula-validator.js.map +1 -0
- package/cjs/formula/formula-engine.d.ts +4 -1
- package/cjs/formula/formula-engine.js +132 -25
- package/cjs/formula/formula-engine.js.map +1 -1
- package/cjs/formula/formula-paste-processor.d.ts +3 -3
- package/cjs/formula/formula-paste-processor.js.map +1 -1
- package/cjs/formula/formula-reference-adjustor.d.ts +1 -1
- package/cjs/formula/formula-reference-adjustor.js.map +1 -1
- package/cjs/formula/index.d.ts +8 -0
- package/cjs/formula/index.js +40 -3
- package/cjs/formula/index.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/managers/formula-manager.d.ts +17 -2
- package/cjs/managers/formula-manager.js +150 -12
- package/cjs/managers/formula-manager.js.map +1 -1
- package/cjs/styles/menu.js +2 -1
- package/cjs/styles/sheet-tab.js +1 -2
- package/cjs/tools/index.js +2 -1
- package/dist/vtable-sheet.js +11322 -331
- package/dist/vtable-sheet.min.js +1 -1
- package/es/components/sheet-tab-event-handler.js +3 -2
- package/es/components/sheet-tab-event-handler.js.map +1 -1
- package/es/components/vtable-sheet.d.ts +2 -1
- package/es/components/vtable-sheet.js +9 -1
- package/es/components/vtable-sheet.js.map +1 -1
- package/es/core/WorkSheet.d.ts +1 -1
- package/es/core/WorkSheet.js.map +1 -1
- package/es/core/table-plugins.js +7 -5
- package/es/core/table-plugins.js.map +1 -1
- package/es/formula/cell-highlight-manager.d.ts +1 -0
- package/es/formula/cell-highlight-manager.js +27 -22
- package/es/formula/cell-highlight-manager.js.map +1 -1
- package/es/formula/cross-sheet-data-synchronizer.d.ts +48 -0
- package/es/formula/cross-sheet-data-synchronizer.js +151 -0
- package/es/formula/cross-sheet-data-synchronizer.js.map +1 -0
- package/es/formula/cross-sheet-formula-handler.d.ts +58 -0
- package/es/formula/cross-sheet-formula-handler.js +236 -0
- package/es/formula/cross-sheet-formula-handler.js.map +1 -0
- package/es/formula/cross-sheet-formula-manager.d.ts +52 -0
- package/es/formula/cross-sheet-formula-manager.js +227 -0
- package/es/formula/cross-sheet-formula-manager.js.map +1 -0
- package/es/formula/cross-sheet-formula-validator.d.ts +56 -0
- package/es/formula/cross-sheet-formula-validator.js +263 -0
- package/es/formula/cross-sheet-formula-validator.js.map +1 -0
- package/es/formula/formula-engine.d.ts +4 -1
- package/es/formula/formula-engine.js +132 -25
- package/es/formula/formula-engine.js.map +1 -1
- package/es/formula/formula-paste-processor.d.ts +3 -3
- package/es/formula/formula-paste-processor.js.map +1 -1
- package/es/formula/formula-reference-adjustor.d.ts +1 -1
- package/es/formula/formula-reference-adjustor.js.map +1 -1
- package/es/formula/index.d.ts +8 -0
- package/es/formula/index.js +8 -0
- package/es/formula/index.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/managers/formula-manager.d.ts +17 -2
- package/es/managers/formula-manager.js +152 -11
- package/es/managers/formula-manager.js.map +1 -1
- package/es/styles/menu.js +2 -1
- package/es/styles/sheet-tab.js +1 -2
- package/es/tools/index.js +2 -1
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/formula/cross-sheet-formula-validator.ts"],"names":[],"mappings":"AA8BA,MAAM,OAAO,0BAA0B;IAerC,YACE,aAA4B,EAC5B,iBAA2C,EAC3C,YAAsF;QAbhF,oBAAe,GAAkC,IAAI,GAAG,EAAE,CAAC;QAClD,cAAS,GAAG,IAAI,CAAC;QAE1B,mBAAc,GAAsB;YAC1C,uBAAuB,EAAE,IAAI;YAC7B,sBAAsB,EAAE,IAAI;YAC5B,eAAe,EAAE,IAAI;YACrB,iBAAiB,EAAE,GAAG;SACvB,CAAC;QAOA,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAKD,aAAa,CAAC,KAAa,EAAE,OAAoC;QAC/D,MAAM,iBAAiB,mCAAQ,IAAI,CAAC,cAAc,GAAK,OAAO,CAAE,CAAC;QACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QAG5D,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,G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AI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAKD,OAAO;QACL,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;CACF","file":"cross-sheet-formula-validator.js","sourcesContent":["/**\n * 跨sheet公式验证器\n * 验证跨sheet引用的有效性和完整性\n */\n\nimport type { FormulaCell } from '../ts-types/formula';\nimport type { FormulaEngine } from './formula-engine';\nimport type { CrossSheetFormulaManager } from './cross-sheet-formula-manager';\n\nexport interface ValidationError {\n type: 'INVALID_SHEET' | 'INVALID_CELL' | 'CIRCULAR_REFERENCE' | 'MISSING_REFERENCE';\n message: string;\n sheet: string;\n cell: FormulaCell;\n target?: string;\n}\n\nexport interface ValidationResult {\n valid: boolean;\n errors: ValidationError[];\n warnings: string[];\n}\n\nexport interface ValidationOptions {\n checkCircularReferences: boolean;\n checkMissingReferences: boolean;\n checkCellBounds: boolean;\n maxRecursionDepth: number;\n}\n\nexport class CrossSheetFormulaValidator {\n private formulaEngine: FormulaEngine;\n private crossSheetManager: CrossSheetFormulaManager;\n private sheetManager: { getAllSheets: () => Array<{ sheetKey: string; sheetTitle: string }> } | undefined; // SheetManager reference\n\n private validationCache: Map<string, ValidationResult> = new Map();\n private readonly CACHE_TTL = 5000; // 5秒缓存\n\n private defaultOptions: ValidationOptions = {\n checkCircularReferences: true,\n checkMissingReferences: true,\n checkCellBounds: true,\n maxRecursionDepth: 100\n };\n\n constructor(\n formulaEngine: FormulaEngine,\n crossSheetManager: CrossSheetFormulaManager,\n sheetManager?: { getAllSheets: () => Array<{ sheetKey: string; sheetTitle: string }> }\n ) {\n this.formulaEngine = formulaEngine;\n this.crossSheetManager = crossSheetManager;\n this.sheetManager = sheetManager;\n }\n\n /**\n * 验证指定sheet的所有跨sheet公式\n */\n validateSheet(sheet: string, options?: Partial<ValidationOptions>): ValidationResult {\n const validationOptions = { ...this.defaultOptions, ...options };\n const cacheKey = this.getCacheKey(sheet, validationOptions);\n\n // 检查缓存\n const cached = this.validationCache.get(cacheKey);\n if (cached && Date.now() - this.getCacheTimestamp(cacheKey) < this.CACHE_TTL) {\n return cached;\n }\n\n const errors: ValidationError[] = [];\n const warnings: string[] = [];\n\n try {\n // 获取sheet的所有公式\n const formulas = this.formulaEngine.exportFormulas(sheet);\n\n // 验证每个公式\n for (const [cellRef, formula] of Object.entries(formulas)) {\n const cell = this.parseA1Notation(cellRef);\n const cellWithSheet: FormulaCell = { sheet, row: cell.row, col: cell.col };\n\n const formulaErrors = this.validateFormula(formula, cellWithSheet, validationOptions);\n errors.push(...formulaErrors);\n }\n\n // 检查循环依赖\n if (validationOptions.checkCircularReferences) {\n const circularErrors = this.checkCircularReferences(sheet);\n errors.push(...circularErrors);\n }\n\n // 检查缺失的引用\n if (validationOptions.checkMissingReferences) {\n const missingErrors = this.checkMissingReferences(sheet);\n errors.push(...missingErrors);\n }\n } catch (error) {\n errors.push({\n type: 'MISSING_REFERENCE',\n message: `Validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n sheet,\n cell: { sheet, row: 0, col: 0 }\n });\n }\n\n const result: ValidationResult = {\n valid: errors.length === 0,\n errors,\n warnings\n };\n\n // 缓存结果\n this.validationCache.set(cacheKey, result);\n\n return result;\n }\n\n /**\n * 验证单个公式\n */\n private validateFormula(formula: string, cell: FormulaCell, options: ValidationOptions): ValidationError[] {\n const errors: ValidationError[] = [];\n\n if (!formula.startsWith('=')) {\n return errors;\n }\n\n try {\n // 提取跨sheet引用\n const crossSheetRefs = this.extractCrossSheetReferences(formula);\n\n for (const ref of crossSheetRefs) {\n // 验证sheet是否存在\n if (!this.isValidSheet(ref.targetSheet)) {\n errors.push({\n type: 'INVALID_SHEET',\n message: `Invalid sheet reference: ${ref.targetSheet}`,\n sheet: cell.sheet,\n cell,\n target: ref.targetSheet\n });\n continue;\n }\n\n // 验证单元格是否存在\n if (options.checkCellBounds) {\n const cellErrors = this.validateCellReferences(ref, cell);\n errors.push(...cellErrors);\n }\n }\n } catch (error) {\n errors.push({\n type: 'MISSING_REFERENCE',\n message: `Formula validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n sheet: cell.sheet,\n cell\n });\n }\n\n return errors;\n }\n\n /**\n * 提取跨sheet引用\n */\n private extractCrossSheetReferences(formula: string): Array<{\n targetSheet: string;\n targetCells: FormulaCell[];\n }> {\n const references: Array<{\n targetSheet: string;\n targetCells: FormulaCell[];\n }> = [];\n\n // 匹配带sheet前缀的引用,如:\n // - Sheet1!A1\n // - Sheet1!A1:B2\n // - Sheet1!A1:Sheet1!B2\n // - Sheet1!A1:Sheet1!B2\n // - 'My Sheet'!A1:'My Sheet'!B2\n const sheetRefPattern = /'?([^'!!]+)'?[!!]([A-Z]+[0-9]+)(?:\\s*:\\s*(?:'?([^'!!]+)'?[!!])?([A-Z]+[0-9]+))?/g;\n let match: RegExpExecArray | null;\n\n while ((match = sheetRefPattern.exec(formula)) !== null) {\n const targetSheet = match[1];\n const startRef = match[2];\n const endSheetMaybe = match[3];\n const endRef = match[4];\n\n const targetCells: FormulaCell[] = [];\n\n if (endRef) {\n // 范围引用\n // 若右侧带了sheet前缀,仅支持与左侧相同(否则为 3D 引用,当前不展开)\n if (endSheetMaybe && endSheetMaybe.toLowerCase() !== targetSheet.toLowerCase()) {\n // 3D 引用:Sheet1!A1:Sheet2!B2(当前不支持)\n continue;\n }\n const startCell = this.parseA1Notation(startRef);\n const endCell = this.parseA1Notation(endRef);\n\n for (let row = Math.min(startCell.row, endCell.row); row <= Math.max(startCell.row, endCell.row); row++) {\n for (let col = Math.min(startCell.col, endCell.col); col <= Math.max(startCell.col, endCell.col); col++) {\n targetCells.push({ sheet: targetSheet, row, col });\n }\n }\n } else {\n // 单个单元格引用,如 A1\n const cell = this.parseA1Notation(startRef);\n targetCells.push({ sheet: targetSheet, row: cell.row, col: cell.col });\n }\n\n references.push({\n targetSheet,\n targetCells\n });\n }\n\n return references;\n }\n\n /**\n * 验证单元格引用\n */\n private validateCellReferences(\n ref: {\n targetSheet: string;\n targetCells: FormulaCell[];\n },\n sourceCell: FormulaCell\n ): ValidationError[] {\n const errors: ValidationError[] = [];\n\n for (const targetCell of ref.targetCells) {\n try {\n // 检查单元格是否有效\n const cellValue = this.formulaEngine.getCellValue(targetCell);\n\n if (cellValue.error) {\n const targetRef = `${ref.targetSheet}!${this.getA1Notation(targetCell.row, targetCell.col)}`;\n errors.push({\n type: 'INVALID_CELL',\n message: `Invalid cell reference: ${targetRef} - ${cellValue.error}`,\n sheet: sourceCell.sheet,\n cell: sourceCell,\n target: targetRef\n });\n }\n } catch (error) {\n errors.push({\n type: 'INVALID_CELL',\n message: `Cell validation failed: ${ref.targetSheet}!${this.getA1Notation(targetCell.row, targetCell.col)}`,\n sheet: sourceCell.sheet,\n cell: sourceCell,\n target: `${ref.targetSheet}!${this.getA1Notation(targetCell.row, targetCell.col)}`\n });\n }\n }\n\n return errors;\n }\n\n /**\n * 检查循环依赖\n */\n private checkCircularReferences(sheet: string): ValidationError[] {\n const errors: ValidationError[] = [];\n const visited = new Set<string>();\n const recursionStack = new Set<string>();\n\n const dfs = (currentSheet: string, path: string[]): boolean => {\n const key = currentSheet;\n\n if (recursionStack.has(key)) {\n // 发现循环依赖\n const cycleStart = path.indexOf(currentSheet);\n const cycle = path.slice(cycleStart).concat([currentSheet]);\n\n errors.push({\n type: 'CIRCULAR_REFERENCE',\n message: `Circular reference detected: ${cycle.join(' -> ')}`,\n sheet: currentSheet,\n cell: { sheet: currentSheet, row: 0, col: 0 }\n });\n\n return true;\n }\n\n if (visited.has(key)) {\n return false;\n }\n\n visited.add(key);\n recursionStack.add(key);\n\n const dependencies = this.crossSheetManager.getCrossSheetDependencies(currentSheet);\n\n for (const dep of dependencies) {\n if (dfs(dep.precedentSheet, [...path, currentSheet])) {\n return true;\n }\n }\n\n recursionStack.delete(key);\n return false;\n };\n\n dfs(sheet, []);\n return errors;\n }\n\n /**\n * 检查缺失的引用\n */\n private checkMissingReferences(sheet: string): ValidationError[] {\n const errors: ValidationError[] = [];\n const allSheets = this.formulaEngine.getAllSheets();\n const existingSheets = new Set(allSheets.map(s => s.key));\n\n const formulas = this.formulaEngine.exportFormulas(sheet);\n\n for (const [cellRef, formula] of Object.entries(formulas)) {\n const cell = this.parseA1Notation(cellRef);\n const cellWithSheet: FormulaCell = { sheet, row: cell.row, col: cell.col };\n\n const crossSheetRefs = this.extractCrossSheetReferences(formula);\n\n for (const ref of crossSheetRefs) {\n if (!existingSheets.has(ref.targetSheet)) {\n errors.push({\n type: 'MISSING_REFERENCE',\n message: `Missing sheet reference: ${ref.targetSheet}`,\n sheet,\n cell: cellWithSheet,\n target: ref.targetSheet\n });\n }\n }\n }\n\n return errors;\n }\n\n /**\n * 验证所有sheet的跨sheet公式\n */\n validateAllSheets(options?: Partial<ValidationOptions>): Map<string, ValidationResult> {\n const results = new Map<string, ValidationResult>();\n const allSheets = this.formulaEngine.getAllSheets();\n\n for (const sheetInfo of allSheets) {\n const result = this.validateSheet(sheetInfo.key, options);\n results.set(sheetInfo.key, result);\n }\n\n return results;\n }\n\n /**\n * 验证公式语法(不执行计算)\n */\n validateFormulaSyntax(formula: string): { valid: boolean; error?: string } {\n try {\n if (!formula.startsWith('=')) {\n return { valid: true };\n }\n\n const expression = formula.substring(1).trim();\n\n // 基本语法检查\n this.validateExpressionStructure(expression);\n\n // 检查跨sheet引用格式 - 支持中英文、数字、下划线,以及中英文感叹号\n const crossSheetPattern = /([A-Za-z0-9_一-龥]+)[!!]([A-Z]+[0-9]+(?::[A-Z]+[0-9]+)?)/g;\n let match;\n\n while ((match = crossSheetPattern.exec(expression)) !== null) {\n const sheetName = match[1];\n const cellRef = match[2];\n\n // 验证sheet名称格式\n if (!this.isValidSheetName(sheetName)) {\n return { valid: false, error: `Invalid sheet name: ${sheetName}` };\n }\n\n // 验证sheet是否存在\n if (!this.isValidSheet(sheetName)) {\n return { valid: false, error: `Invalid sheet name: ${sheetName}` };\n }\n\n // 验证单元格引用格式\n if (!this.isValidCellReference(cellRef)) {\n return { valid: false, error: `Invalid cell reference: ${cellRef}` };\n }\n }\n\n return { valid: true };\n } catch (error) {\n return {\n valid: false,\n error: error instanceof Error ? error.message : 'Syntax validation failed'\n };\n }\n }\n\n /**\n * 验证表达式结构\n */\n private validateExpressionStructure(expression: string): void {\n // 检查括号匹配\n const openParenCount = (expression.match(/\\(/g) || []).length;\n const closeParenCount = (expression.match(/\\)/g) || []).length;\n\n if (openParenCount !== closeParenCount) {\n throw new Error('Unmatched parentheses');\n }\n\n // 检查引号匹配\n const doubleQuoteCount = (expression.match(/\"/g) || []).length;\n if (doubleQuoteCount % 2 !== 0) {\n throw new Error('Unmatched quotes');\n }\n }\n\n /**\n * 验证sheet名称\n */\n private isValidSheetName(sheetName: string): boolean {\n // Sheet名称规则:支持中英文、数字、下划线,不能以数字开头\n const validPattern = /^[A-Za-z_一-龥][A-Za-z0-9_一-龥]*$/;\n return validPattern.test(sheetName);\n }\n\n /**\n * 验证单元格引用格式\n */\n private isValidCellReference(cellRef: string): boolean {\n // 支持单个单元格如 A1 或范围如 A1:B2\n const singleCellPattern = /^[A-Z]+[0-9]+$/;\n const rangePattern = /^[A-Z]+[0-9]+:[A-Z]+[0-9]+$/;\n\n return singleCellPattern.test(cellRef) || rangePattern.test(cellRef);\n }\n\n /**\n * 验证sheet是否存在(使用sheetTitle而不是sheetKey)\n * 检查所有存在的sheet,包括未激活的sheet\n */\n private isValidSheet(sheetName: string): boolean {\n // 优先使用sheetManager检查所有存在的sheet(包括未激活的)\n if (this.sheetManager) {\n const allSheets = this.sheetManager.getAllSheets();\n return allSheets.some(sheet => sheet.sheetTitle.toLowerCase() === sheetName.toLowerCase());\n }\n\n // 回退到formulaEngine中已注册的sheet\n const allSheets = this.formulaEngine.getAllSheets();\n return allSheets.some(sheet => sheet.title.toLowerCase() === sheetName.toLowerCase());\n }\n\n /**\n * 工具方法:A1表示法解析\n */\n private parseA1Notation(a1Notation: string): { row: number; col: number } {\n const match = a1Notation.match(/^([A-Z]+)([0-9]+)$/);\n if (!match) {\n throw new Error(`Invalid cell reference: ${a1Notation}`);\n }\n\n const colLetters = match[1];\n const rowNumber = parseInt(match[2], 10);\n\n let col = 0;\n for (let i = 0; i < colLetters.length; i++) {\n col = col * 26 + (colLetters.charCodeAt(i) - 65);\n }\n\n return { row: rowNumber - 1, col };\n }\n\n /**\n * 工具方法:A1表示法生成\n */\n private getA1Notation(row: number, col: number): string {\n let colStr = '';\n let tempCol = col;\n\n do {\n colStr = String.fromCharCode(65 + (tempCol % 26)) + colStr;\n tempCol = Math.floor(tempCol / 26) - 1;\n } while (tempCol >= 0);\n\n return `${colStr}${row + 1}`;\n }\n\n /**\n * 获取缓存键\n */\n private getCacheKey(sheet: string, options: ValidationOptions): string {\n return `${sheet}_${JSON.stringify(options)}`;\n }\n\n /**\n * 获取缓存时间戳\n */\n private getCacheTimestamp(_cacheKey: string): number {\n // 简单的实现,实际应该存储时间戳\n return Date.now();\n }\n\n /**\n * 清除验证缓存\n */\n clearCache(): void {\n this.validationCache.clear();\n }\n\n /**\n * 销毁验证器\n */\n destroy(): void {\n this.clearCache();\n }\n}\n"]}
|
|
@@ -14,6 +14,7 @@ export interface FormulaEngineConfig {
|
|
|
14
14
|
export declare class FormulaEngine {
|
|
15
15
|
private sheets;
|
|
16
16
|
private reverseSheets;
|
|
17
|
+
private sheetTitles;
|
|
17
18
|
private sheetData;
|
|
18
19
|
private formulaCells;
|
|
19
20
|
private dependencies;
|
|
@@ -24,6 +25,7 @@ export declare class FormulaEngine {
|
|
|
24
25
|
setActiveSheet(sheetKey: string): void;
|
|
25
26
|
getActiveSheet(): string | null;
|
|
26
27
|
addSheet(sheetKey: string, data?: unknown[][]): number;
|
|
28
|
+
setSheetTitle(sheetKey: string, sheetTitle: string): void;
|
|
27
29
|
updateSheetData(sheetKey: string, data: unknown[][]): void;
|
|
28
30
|
private normalizeData;
|
|
29
31
|
getSheetId(sheetKey: string): number;
|
|
@@ -87,10 +89,11 @@ export declare class FormulaEngine {
|
|
|
87
89
|
private validateExpressionStructure;
|
|
88
90
|
release(): void;
|
|
89
91
|
exportFormulas(sheetKey: string): Record<string, string>;
|
|
92
|
+
getSheetTitle(sheetKey: string): string | undefined;
|
|
90
93
|
getAllSheets(): Array<{
|
|
91
94
|
key: string;
|
|
92
95
|
id: number;
|
|
93
|
-
|
|
96
|
+
title: string;
|
|
94
97
|
}>;
|
|
95
98
|
sortFormulasByDependency(sheetKey: string, formulas: Record<string, string>): [string, string][];
|
|
96
99
|
removeSheet(sheetKey: string): void;
|
|
@@ -2,8 +2,9 @@ import { supportedFunctions } from "./formula-helper";
|
|
|
2
2
|
|
|
3
3
|
export class FormulaEngine {
|
|
4
4
|
constructor(_config = {}) {
|
|
5
|
-
this.sheets = new Map, this.reverseSheets = new Map, this.
|
|
6
|
-
this.
|
|
5
|
+
this.sheets = new Map, this.reverseSheets = new Map, this.sheetTitles = new Map,
|
|
6
|
+
this.sheetData = new Map, this.formulaCells = new Map, this.dependencies = new Map,
|
|
7
|
+
this.dependents = new Map, this.nextSheetId = 0, this.activeSheetKey = null;
|
|
7
8
|
}
|
|
8
9
|
setActiveSheet(sheetKey) {
|
|
9
10
|
this.sheets.has(sheetKey) && (this.activeSheetKey = sheetKey);
|
|
@@ -18,6 +19,9 @@ export class FormulaEngine {
|
|
|
18
19
|
const sheetData = data || [ [ "" ] ];
|
|
19
20
|
return this.sheetData.set(sheetId, sheetData), sheetId;
|
|
20
21
|
}
|
|
22
|
+
setSheetTitle(sheetKey, sheetTitle) {
|
|
23
|
+
this.sheets.has(sheetKey) && this.sheetTitles.set(sheetKey, sheetTitle);
|
|
24
|
+
}
|
|
21
25
|
updateSheetData(sheetKey, data) {
|
|
22
26
|
const sheetId = this.sheets.get(sheetKey);
|
|
23
27
|
null != sheetId && this.sheetData.set(sheetId, data);
|
|
@@ -114,7 +118,11 @@ export class FormulaEngine {
|
|
|
114
118
|
};
|
|
115
119
|
}
|
|
116
120
|
parseCellKey(cellKey) {
|
|
117
|
-
|
|
121
|
+
let parts;
|
|
122
|
+
if (cellKey.includes("!")) parts = cellKey.split("!"); else {
|
|
123
|
+
if (!cellKey.includes("!")) return null;
|
|
124
|
+
parts = cellKey.split("!");
|
|
125
|
+
}
|
|
118
126
|
if (2 !== parts.length) return null;
|
|
119
127
|
const [sheet, a1Notation] = parts;
|
|
120
128
|
try {
|
|
@@ -153,7 +161,26 @@ export class FormulaEngine {
|
|
|
153
161
|
const expression = formula.substring(1);
|
|
154
162
|
let inQuotes = !1, quoteChar = "", i = 0;
|
|
155
163
|
for (;i < expression.length; ) {
|
|
156
|
-
const char = expression[i];
|
|
164
|
+
const char = expression[i], quotedSheetCellMatchCN = expression.substring(i).match(/^'([A-Za-z0-9_\s一-龥]+)'\s*!\s*([A-Za-z]+[0-9]+)/);
|
|
165
|
+
if (quotedSheetCellMatchCN) {
|
|
166
|
+
const fullRef = quotedSheetCellMatchCN[0], sheetNameMatch = fullRef.match(/^'([^']+)'\s*!\s*(.+)$/);
|
|
167
|
+
if (sheetNameMatch) {
|
|
168
|
+
const originalSheetName = sheetNameMatch[1], cellRef = sheetNameMatch[2], correctedSheetName = this.findOriginalSheetName(originalSheetName), letters = cellRef.replace(/[0-9]/g, ""), numbers = cellRef.replace(/[A-Za-z]/g, "");
|
|
169
|
+
corrected += "'" + (correctedSheetName || originalSheetName) + "'!" + letters.toUpperCase() + numbers,
|
|
170
|
+
i += fullRef.length;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const quotedSheetCellMatch = expression.substring(i).match(/^'([A-Za-z0-9_\s一-龥]+)'![A-Za-z]+[0-9]+/);
|
|
175
|
+
if (quotedSheetCellMatch) {
|
|
176
|
+
const fullRef = quotedSheetCellMatch[0], sheetNameMatch = fullRef.match(/^'([^']+)'!(.+)$/);
|
|
177
|
+
if (sheetNameMatch) {
|
|
178
|
+
const originalSheetName = sheetNameMatch[1], cellRef = sheetNameMatch[2], correctedSheetName = this.findOriginalSheetName(originalSheetName), letters = cellRef.replace(/[0-9]/g, ""), numbers = cellRef.replace(/[A-Za-z]/g, "");
|
|
179
|
+
corrected += "'" + (correctedSheetName || originalSheetName) + "'!" + letters.toUpperCase() + numbers,
|
|
180
|
+
i += fullRef.length;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
157
184
|
if (!('"' !== char && "'" !== char || 0 !== i && "\\" === expression[i - 1])) {
|
|
158
185
|
inQuotes ? char === quoteChar && (inQuotes = !1, quoteChar = "") : (inQuotes = !0,
|
|
159
186
|
quoteChar = char), corrected += char, i++;
|
|
@@ -169,13 +196,37 @@ export class FormulaEngine {
|
|
|
169
196
|
for (corrected += funcName.toUpperCase() + "(", i += funcName.length + 1; i < expression.length && " " === expression[i]; ) i++;
|
|
170
197
|
continue;
|
|
171
198
|
}
|
|
172
|
-
const
|
|
199
|
+
const sheetCellMatchCN = expression.substring(i).match(/^[A-Za-z0-9_\s一-龥]+!([A-Za-z]+[0-9]+)/);
|
|
200
|
+
if (sheetCellMatchCN) {
|
|
201
|
+
const fullRef = sheetCellMatchCN[0], [sheetName, cellRef] = fullRef.split("!"), originalSheetName = this.findOriginalSheetName(sheetName), letters = cellRef.replace(/[0-9]/g, ""), numbers = cellRef.replace(/[A-Za-z]/g, "");
|
|
202
|
+
corrected += (originalSheetName || sheetName) + "!" + letters.toUpperCase() + numbers,
|
|
203
|
+
i += fullRef.length;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
const sheetCellMatch = expression.substring(i).match(/^[A-Za-z0-9_\s一-龥]+![A-Za-z]+[0-9]+/);
|
|
173
207
|
if (sheetCellMatch) {
|
|
174
208
|
const fullRef = sheetCellMatch[0], [sheetName, cellRef] = fullRef.split("!"), originalSheetName = this.findOriginalSheetName(sheetName), letters = cellRef.replace(/[0-9]/g, ""), numbers = cellRef.replace(/[A-Za-z]/g, "");
|
|
175
209
|
corrected += (originalSheetName || sheetName) + "!" + letters.toUpperCase() + numbers,
|
|
176
210
|
i += fullRef.length;
|
|
177
211
|
continue;
|
|
178
212
|
}
|
|
213
|
+
const quotedSheetRangeMatchCN = expression.substring(i).match(/^'([A-Za-z0-9_\s一-龥]+)'![A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+/);
|
|
214
|
+
if (quotedSheetRangeMatchCN) {
|
|
215
|
+
const fullRangeRef = quotedSheetRangeMatchCN[0], sheetNameMatch = fullRangeRef.match(/^'([^']+)'!(.+)$/);
|
|
216
|
+
if (sheetNameMatch) {
|
|
217
|
+
const originalSheetName = sheetNameMatch[1], rangePart = sheetNameMatch[2], [startCell, endCell] = rangePart.split(":"), correctedSheetName = this.findOriginalSheetName(originalSheetName), startLetters = startCell.replace(/[0-9]/g, ""), startNumbers = startCell.replace(/[A-Za-z]/g, ""), newStartCell = startLetters.toUpperCase() + startNumbers, endLetters = endCell.replace(/[0-9]/g, ""), endNumbers = endCell.replace(/[A-Za-z]/g, "");
|
|
218
|
+
corrected += "'" + (correctedSheetName || originalSheetName) + "'!" + newStartCell + ":" + (endLetters.toUpperCase() + endNumbers),
|
|
219
|
+
i += fullRangeRef.length;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const sheetRangeMatchCN = expression.substring(i).match(/^[A-Za-z0-9_\s一-龥]+![A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+/);
|
|
224
|
+
if (sheetRangeMatchCN) {
|
|
225
|
+
const fullRangeRef = sheetRangeMatchCN[0], [sheetPart, rangePart] = fullRangeRef.split("!"), [startCell, endCell] = rangePart.split(":"), originalSheetName = this.findOriginalSheetName(sheetPart), startLetters = startCell.replace(/[0-9]/g, ""), startNumbers = startCell.replace(/[A-Za-z]/g, ""), newStartCell = startLetters.toUpperCase() + startNumbers, endLetters = endCell.replace(/[0-9]/g, ""), endNumbers = endCell.replace(/[A-Za-z]/g, "");
|
|
226
|
+
corrected += (originalSheetName || sheetPart) + "!" + newStartCell + ":" + (endLetters.toUpperCase() + endNumbers),
|
|
227
|
+
i += fullRangeRef.length;
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
179
230
|
const sheetRangeMatch = expression.substring(i).match(/^[A-Za-z0-9_]+![A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+/);
|
|
180
231
|
if (sheetRangeMatch) {
|
|
181
232
|
const fullRangeRef = sheetRangeMatch[0], [sheetPart, rangePart] = fullRangeRef.split("!"), [startCell, endCell] = rangePart.split(":"), originalSheetName = this.findOriginalSheetName(sheetPart), startLetters = startCell.replace(/[0-9]/g, ""), startNumbers = startCell.replace(/[A-Za-z]/g, ""), newStartCell = startLetters.toUpperCase() + startNumbers, endLetters = endCell.replace(/[0-9]/g, ""), endNumbers = endCell.replace(/[A-Za-z]/g, "");
|
|
@@ -198,8 +249,10 @@ export class FormulaEngine {
|
|
|
198
249
|
return corrected;
|
|
199
250
|
}
|
|
200
251
|
findOriginalSheetName(sheetName) {
|
|
201
|
-
|
|
252
|
+
for (const sheetTitle of this.sheetTitles.values()) if (sheetTitle === sheetName) return sheetTitle;
|
|
202
253
|
const lowerSheetName = sheetName.toLowerCase();
|
|
254
|
+
for (const sheetTitle of this.sheetTitles.values()) if (sheetTitle.toLowerCase() === lowerSheetName) return sheetTitle;
|
|
255
|
+
if (this.sheets.has(sheetName)) return sheetName;
|
|
203
256
|
for (const [existingSheetName] of this.sheets.entries()) if (existingSheetName.toLowerCase() === lowerSheetName) return existingSheetName;
|
|
204
257
|
return null;
|
|
205
258
|
}
|
|
@@ -290,7 +343,7 @@ export class FormulaEngine {
|
|
|
290
343
|
value: expr.slice(1, -1),
|
|
291
344
|
error: void 0
|
|
292
345
|
};
|
|
293
|
-
if (/^([A-Za-z0-9_]+!)?[A-Z]+[0-9]+$/.test(expr)) return {
|
|
346
|
+
if (/^([A-Za-z0-9_\s一-龥]+!)?[A-Z]+[0-9]+$/.test(expr)) return {
|
|
294
347
|
value: this.getCellValueByA1(expr),
|
|
295
348
|
error: void 0
|
|
296
349
|
};
|
|
@@ -298,7 +351,7 @@ export class FormulaEngine {
|
|
|
298
351
|
value: Number(expr),
|
|
299
352
|
error: void 0
|
|
300
353
|
};
|
|
301
|
-
if (/^([A-Za-z0-9_]+!)?[A-Z]+[0-9]+:[A-Z]+[0-9]+$/.test(expr)) {
|
|
354
|
+
if (/^([A-Za-z0-9_\s一-龥]+!)?[A-Z]+[0-9]+:[A-Z]+[0-9]+$/.test(expr)) {
|
|
302
355
|
return {
|
|
303
356
|
value: this.getRangeValuesFromExpr(expr),
|
|
304
357
|
error: void 0
|
|
@@ -723,7 +776,7 @@ export class FormulaEngine {
|
|
|
723
776
|
};
|
|
724
777
|
functionValues.push(funcResult.value), processedExpr = processedExpr.replace(funcMatch.match, `__FUNC_${functionValues.length - 1}__`);
|
|
725
778
|
}
|
|
726
|
-
const cellRefs = processedExpr.match(/[A-Z]+[0-9]+/g) || [];
|
|
779
|
+
const cellRefs = processedExpr.match(/('[^']+'!)?([A-Za-z0-9_\s一-龥]+!)?[A-Z]+[0-9]+/g) || [];
|
|
727
780
|
for (const cellRef of cellRefs) {
|
|
728
781
|
const value = this.getCellValueByA1(cellRef);
|
|
729
782
|
processedExpr = processedExpr.replace(cellRef, String(value));
|
|
@@ -741,11 +794,21 @@ export class FormulaEngine {
|
|
|
741
794
|
}
|
|
742
795
|
}
|
|
743
796
|
getCellValueByA1(a1Notation) {
|
|
797
|
+
var _a, _b;
|
|
744
798
|
try {
|
|
745
799
|
let sheetKey = this.activeSheetKey || this.reverseSheets.get(0) || "Sheet1", cellRef = a1Notation;
|
|
746
|
-
if (a1Notation.includes("!")) {
|
|
747
|
-
|
|
748
|
-
|
|
800
|
+
if (a1Notation.includes("!") || a1Notation.includes("!")) {
|
|
801
|
+
let parts;
|
|
802
|
+
if (parts = a1Notation.includes("!") ? a1Notation.split("!") : a1Notation.split("!"),
|
|
803
|
+
2 === parts.length) {
|
|
804
|
+
let sheetTitle = parts[0];
|
|
805
|
+
sheetTitle.startsWith("'") && sheetTitle.endsWith("'") && (sheetTitle = sheetTitle.slice(1, -1));
|
|
806
|
+
let foundSheetKey = null === (_a = Array.from(this.sheetTitles.entries()).find((([_, value]) => value.toLowerCase() === sheetTitle.toLowerCase()))) || void 0 === _a ? void 0 : _a[0];
|
|
807
|
+
foundSheetKey || (foundSheetKey = null === (_b = Array.from(this.sheets.entries()).find((([key, _]) => key.toLowerCase() === sheetTitle.toLowerCase()))) || void 0 === _b ? void 0 : _b[0]),
|
|
808
|
+
!foundSheetKey && this.sheets && this.sheets.has(sheetTitle) && (foundSheetKey = sheetTitle),
|
|
809
|
+
foundSheetKey ? (sheetKey = foundSheetKey, cellRef = parts[1]) : (sheetKey = sheetTitle,
|
|
810
|
+
cellRef = parts[1]);
|
|
811
|
+
}
|
|
749
812
|
}
|
|
750
813
|
const {row: row, col: col} = this.parseA1Notation(cellRef), cell = {
|
|
751
814
|
sheet: sheetKey,
|
|
@@ -753,19 +816,38 @@ export class FormulaEngine {
|
|
|
753
816
|
col: col
|
|
754
817
|
};
|
|
755
818
|
return this.getCellValue(cell).value;
|
|
756
|
-
} catch (
|
|
819
|
+
} catch (_c) {
|
|
757
820
|
return 0;
|
|
758
821
|
}
|
|
759
822
|
}
|
|
760
823
|
getRangeValuesFromExpr(expr) {
|
|
761
824
|
try {
|
|
762
825
|
if (!expr.includes(":")) return [ this.getCellValueByA1(expr) ];
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
826
|
+
const defaultSheetKey = this.activeSheetKey || this.reverseSheets.get(0) || "Sheet1", parseSheetAndCell = part => {
|
|
827
|
+
var _a, _b;
|
|
828
|
+
let sheetKey = defaultSheetKey, cellRef = part.trim(), hasSheetPrefix = !1;
|
|
829
|
+
const hasEn = cellRef.includes("!"), hasCn = cellRef.includes("!");
|
|
830
|
+
if (hasEn || hasCn) {
|
|
831
|
+
const sep = hasEn ? "!" : "!", parts = cellRef.split(sep);
|
|
832
|
+
if (2 === parts.length) {
|
|
833
|
+
hasSheetPrefix = !0;
|
|
834
|
+
let sheetTitle = parts[0].trim();
|
|
835
|
+
cellRef = parts[1].trim(), sheetTitle.startsWith("'") && sheetTitle.endsWith("'") && (sheetTitle = sheetTitle.slice(1, -1));
|
|
836
|
+
const foundSheetKeyFromTitles = null === (_a = Array.from(this.sheetTitles.entries()).find((([_, value]) => value.toLowerCase() === sheetTitle.toLowerCase()))) || void 0 === _a ? void 0 : _a[0], foundSheetKeyFromKeys = null === (_b = Array.from(this.sheets.entries()).find((([sheetKey]) => sheetKey.toLowerCase() === sheetTitle.toLowerCase()))) || void 0 === _b ? void 0 : _b[0];
|
|
837
|
+
let foundSheetKey = foundSheetKeyFromTitles || foundSheetKeyFromKeys;
|
|
838
|
+
!foundSheetKey && this.sheets && this.sheets.has(sheetTitle) && (foundSheetKey = sheetTitle),
|
|
839
|
+
sheetKey = foundSheetKey || sheetTitle;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return {
|
|
843
|
+
sheetKey: sheetKey,
|
|
844
|
+
cellRef: cellRef,
|
|
845
|
+
hasSheetPrefix: hasSheetPrefix
|
|
846
|
+
};
|
|
847
|
+
}, [startRaw, endRaw] = expr.split(":"), startParsed = parseSheetAndCell(startRaw), endParsed = parseSheetAndCell(endRaw);
|
|
848
|
+
if (startParsed.hasSheetPrefix && !endParsed.hasSheetPrefix ? endParsed.sheetKey = startParsed.sheetKey : !startParsed.hasSheetPrefix && endParsed.hasSheetPrefix && (startParsed.sheetKey = endParsed.sheetKey),
|
|
849
|
+
startParsed.sheetKey.toLowerCase() !== endParsed.sheetKey.toLowerCase()) return [];
|
|
850
|
+
const sheetKey = startParsed.sheetKey, startCell = this.parseA1Notation(startParsed.cellRef), endCell = this.parseA1Notation(endParsed.cellRef), values = [];
|
|
769
851
|
for (let row = startCell.row; row <= endCell.row; row++) for (let col = startCell.col; col <= endCell.col; col++) {
|
|
770
852
|
const cell = {
|
|
771
853
|
sheet: sheetKey,
|
|
@@ -781,6 +863,10 @@ export class FormulaEngine {
|
|
|
781
863
|
}
|
|
782
864
|
getCellValue(cell) {
|
|
783
865
|
try {
|
|
866
|
+
if (!this.sheets) return {
|
|
867
|
+
value: null,
|
|
868
|
+
error: "FormulaEngine not properly initialized: sheets Map is undefined"
|
|
869
|
+
};
|
|
784
870
|
const sheetId = this.sheets.get(cell.sheet);
|
|
785
871
|
if (void 0 === sheetId) return {
|
|
786
872
|
value: "",
|
|
@@ -891,14 +977,17 @@ export class FormulaEngine {
|
|
|
891
977
|
}
|
|
892
978
|
return result;
|
|
893
979
|
}
|
|
980
|
+
getSheetTitle(sheetKey) {
|
|
981
|
+
return this.sheetTitles.get(sheetKey);
|
|
982
|
+
}
|
|
894
983
|
getAllSheets() {
|
|
895
984
|
const result = [];
|
|
896
985
|
for (const entry of Array.from(this.sheets.entries())) {
|
|
897
|
-
const [sheetKey, sheetId] = entry;
|
|
986
|
+
const [sheetKey, sheetId] = entry, sheetTitle = this.sheetTitles.get(sheetKey) || sheetKey;
|
|
898
987
|
result.push({
|
|
899
988
|
key: sheetKey,
|
|
900
989
|
id: sheetId,
|
|
901
|
-
|
|
990
|
+
title: sheetTitle
|
|
902
991
|
});
|
|
903
992
|
}
|
|
904
993
|
return result;
|
|
@@ -919,7 +1008,7 @@ export class FormulaEngine {
|
|
|
919
1008
|
if (tempVisited.has(cellKey)) return;
|
|
920
1009
|
tempVisited.add(cellKey);
|
|
921
1010
|
const deps = tempDependencies.get(cellKey) || new Set;
|
|
922
|
-
for (const dep of deps) tempDependencies.has(dep) && visit(dep);
|
|
1011
|
+
for (const dep of deps) tempDependencies && tempDependencies.has(dep) && visit(dep);
|
|
923
1012
|
tempVisited.delete(cellKey), visited.add(cellKey);
|
|
924
1013
|
const cellRef = cellKey.substring(sheetKey.length + 1), formula = formulas[cellRef];
|
|
925
1014
|
formula && result.push([ cellRef, formula ]);
|
|
@@ -997,6 +1086,8 @@ export class FormulaEngine {
|
|
|
997
1086
|
}
|
|
998
1087
|
updateDependencies(cellKey, formula) {
|
|
999
1088
|
var _a;
|
|
1089
|
+
if (!this.dependencies) return;
|
|
1090
|
+
if (!this.dependents) return;
|
|
1000
1091
|
const oldDeps = this.dependencies.get(cellKey) || new Set;
|
|
1001
1092
|
for (const dep of oldDeps) {
|
|
1002
1093
|
const depDependents = this.dependents.get(dep) || new Set;
|
|
@@ -1018,10 +1109,27 @@ export class FormulaEngine {
|
|
|
1018
1109
|
return [ ...new Set(references) ];
|
|
1019
1110
|
}
|
|
1020
1111
|
extractReferencesFromExpression(expr, references, currentSheet = "Sheet1") {
|
|
1112
|
+
const repeatedSheetRangePattern = new RegExp("([A-Za-z0-9_\\s一-龥]+)[!!]([A-Z]+[0-9]+)\\s*:\\s*([A-Za-z0-9_\\s一-龥]+)[!!]([A-Z]+[0-9]+)", "g");
|
|
1113
|
+
let repeatedMatch;
|
|
1114
|
+
for (;null !== (repeatedMatch = repeatedSheetRangePattern.exec(expr)); ) {
|
|
1115
|
+
const sheet1 = repeatedMatch[1], startCell = repeatedMatch[2], sheet2 = repeatedMatch[3], endCell = repeatedMatch[4];
|
|
1116
|
+
if (sheet1.toLowerCase() === sheet2.toLowerCase()) {
|
|
1117
|
+
const expandedRefs = this.expandRangeToCells(sheet1, startCell, endCell);
|
|
1118
|
+
references.push(...expandedRefs);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
const chineseExclamationPattern = /([A-Za-z0-9_\s一-龥]+)!([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g;
|
|
1122
|
+
let match;
|
|
1123
|
+
for (;null !== (match = chineseExclamationPattern.exec(expr)); ) {
|
|
1124
|
+
const sheetName = match[1], startCell = match[2], endCell = match[3];
|
|
1125
|
+
if (endCell) {
|
|
1126
|
+
const expandedRefs = this.expandRangeToCells(sheetName, startCell, endCell);
|
|
1127
|
+
references.push(...expandedRefs);
|
|
1128
|
+
} else references.push(`${sheetName}!${startCell}`);
|
|
1129
|
+
}
|
|
1021
1130
|
let cleanExpr = expr.replace(/"[^"]*"/g, "");
|
|
1022
1131
|
cleanExpr = cleanExpr.replace(/'[^']*'/g, "");
|
|
1023
1132
|
const cellRefPattern = /(?:([A-Za-z0-9_]+)!)?([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g;
|
|
1024
|
-
let match;
|
|
1025
1133
|
for (;null !== (match = cellRefPattern.exec(cleanExpr)); ) {
|
|
1026
1134
|
const sheetName = match[1] || currentSheet, startCell = match[2], endCell = match[3];
|
|
1027
1135
|
if (endCell) {
|
|
@@ -1475,5 +1583,4 @@ class FormulaError {
|
|
|
1475
1583
|
constructor(message, type = "VALUE") {
|
|
1476
1584
|
this.message = message, this.type = type;
|
|
1477
1585
|
}
|
|
1478
|
-
}
|
|
1479
|
-
//# sourceMappingURL=formula-engine.js.map
|
|
1586
|
+
}
|