@vdhewei/xlsx-template-lib 1.5.1 → 1.6.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
@@ -3048,6 +3048,14 @@ var resolveCompileMacroGen = (ctx, expr, currentCellIndex) => {
3048
3048
  parts.push(resolveAliasExpr(ctx, item.value, currentCellIndex));
3049
3049
  }
3050
3050
  }
3051
+ if (parts.length === 1) {
3052
+ return parts[0];
3053
+ }
3054
+ let end = parts[parts.length - 1];
3055
+ if (end.startsWith('"') && end.length >= 3 && end.endsWith('"')) {
3056
+ join2 = end;
3057
+ return parts.slice(0, parts.length - 1).join(join2);
3058
+ }
3051
3059
  return parts.join(join2);
3052
3060
  };
3053
3061
  var getExprEnd = function(macroExpr, matchIndex, rparenToken) {
@@ -3096,7 +3104,17 @@ var __codeKey = (str, expr) => {
3096
3104
  return str.toUpperCase();
3097
3105
  };
3098
3106
  var __numberKey = (str, expr) => {
3099
- return Number.parseInt(str, 10).toString();
3107
+ if (str === "NaN" || str === "Infinity" || str === "null" || str === "[object object]") {
3108
+ return str;
3109
+ }
3110
+ if (str.startsWith("0x")) {
3111
+ return str.substring(2);
3112
+ }
3113
+ let v = Number.parseInt(str, 10);
3114
+ if (isNaN(v)) {
3115
+ return str;
3116
+ }
3117
+ return v.toString();
3100
3118
  };
3101
3119
  var __codeAliasKey = (str, expr) => {
3102
3120
  const key = __codeKey(str);
@@ -3725,7 +3743,7 @@ var fetchAlias = (m) => {
3725
3743
  return alias;
3726
3744
  };
3727
3745
  var removeUnExportSheets = (w, options) => {
3728
- const removes = [];
3746
+ let removes = [];
3729
3747
  if (typeof options.skipRemoveUnExportSheet === "boolean" && options.skipRemoveUnExportSheet === true) {
3730
3748
  return w;
3731
3749
  }
@@ -3743,6 +3761,9 @@ var removeUnExportSheets = (w, options) => {
3743
3761
  }
3744
3762
  }
3745
3763
  }
3764
+ if (removes.length === w.worksheets.length && w.worksheets[0].name === removes[0]) {
3765
+ removes = removes.slice(1, removes.length);
3766
+ }
3746
3767
  for (const [_, name] of removes.entries()) {
3747
3768
  w.removeWorksheet(name);
3748
3769
  }