@vdhewei/xlsx-template-lib 1.3.0 → 1.3.2

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/index.js CHANGED
@@ -3091,7 +3091,7 @@ var __numberKey = (str) => {
3091
3091
  var __codeAliasKey = (str) => {
3092
3092
  const key = __codeKey(str);
3093
3093
  if (key !== "") {
3094
- return `${defaultRuleTokenParserMap.get("@" /* UseAliasToken */)}${key}`;
3094
+ return `${defaultRuleTokenMap.get("@" /* UseAliasToken */)}${key}`;
3095
3095
  }
3096
3096
  return "";
3097
3097
  };
@@ -3179,8 +3179,8 @@ var resolveCompileMacroExpr = (ctx, macroExpr, macroTokens2, currentCellIndex, t
3179
3179
  if (cellValue === void 0 || cellValue.value === null) {
3180
3180
  return;
3181
3181
  }
3182
- const value = cellValue.value;
3183
- parts.push(execMacroFormat(value.toString(), formatter));
3182
+ const value = execMacroFormat(cellValue.value.toString(), formatter);
3183
+ parts.push(value);
3184
3184
  });
3185
3185
  });
3186
3186
  }
@@ -3513,21 +3513,26 @@ var compileRowCells = function(ctx, expr, cellPoints, rowIndex, errs) {
3513
3513
  return;
3514
3514
  }
3515
3515
  ctx.currentExpr = expr;
3516
- cellPoints.forEach((cellPoint, index) => {
3517
- const r = cellPoint.Row;
3518
- const sheet = ctx.sheet;
3519
- const c = cellPoint.Column;
3520
- const cell = sheet.findCell(r, c);
3521
- if (cell === void 0 || cell.value !== void 0 && cell.value !== null && cell.value !== "") {
3522
- return;
3523
- }
3524
- let templateValue = String(expr.value);
3525
- const macroTokens2 = getMacroTokens(expr);
3526
- templateValue = resolveFunctionExpr(ctx, templateValue, expr);
3527
- templateValue = resolveCompileMacroExpr(ctx, templateValue, macroTokens2, index, cellPoints.length);
3528
- templateValue = resolveAliasExpr(ctx, templateValue, index);
3529
- cell.value = resolveValueExpr(ctx, templateValue);
3530
- });
3516
+ try {
3517
+ cellPoints.forEach((cellPoint, index) => {
3518
+ const r = cellPoint.Row;
3519
+ const sheet = ctx.sheet;
3520
+ const c = cellPoint.Column;
3521
+ const cell = sheet.findCell(r, c);
3522
+ if (cell === void 0 || cell.value !== void 0 && cell.value !== null && cell.value !== "") {
3523
+ return;
3524
+ }
3525
+ let templateValue = String(expr.value);
3526
+ const macroTokens2 = getMacroTokens(expr);
3527
+ templateValue = resolveFunctionExpr(ctx, templateValue, expr);
3528
+ templateValue = resolveCompileMacroExpr(ctx, templateValue, macroTokens2, index, cellPoints.length);
3529
+ templateValue = resolveAliasExpr(ctx, templateValue, index);
3530
+ cell.value = resolveValueExpr(ctx, templateValue);
3531
+ });
3532
+ } catch (err) {
3533
+ const msg = err.message;
3534
+ throw new Error(`expr:${expr.express}, resolve error: ${msg}`);
3535
+ }
3531
3536
  };
3532
3537
  var generateWorkSheetCellsPlaceholder = function(ctx, expr, sheet) {
3533
3538
  const errs = [];