@vdhewei/xlsx-template-lib 1.4.2 → 1.5.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/dist/bin.js CHANGED
@@ -976,7 +976,7 @@ var extractMacro = function(expr, options) {
976
976
  }
977
977
  return extracResult;
978
978
  };
979
- var __codeKey = (str) => {
979
+ var __codeKey = (str, expr) => {
980
980
  const replaces = [" ", `-`, `/`, `,`, `'`, `&`, `.`, `(`, `)`, `{`, `}`, `@`, `\\`, `[`, `]`, `#`, `:`];
981
981
  for (const k of replaces) {
982
982
  str = str.replaceAll(k, "_").trim();
@@ -992,12 +992,15 @@ var __codeKey = (str) => {
992
992
  }
993
993
  return str.toUpperCase();
994
994
  };
995
- var __numberKey = (str) => {
995
+ var __numberKey = (str, expr) => {
996
996
  return Number.parseInt(str, 10).toString();
997
997
  };
998
- var __codeAliasKey = (str) => {
998
+ var __codeAliasKey = (str, expr) => {
999
999
  const key = __codeKey(str);
1000
1000
  if (key !== "") {
1001
+ if (expr !== void 0 && expr.tokens.length > 0) {
1002
+ expr.tokens.push("@" /* UseAliasToken */);
1003
+ }
1001
1004
  return `${defaultRuleTokenMap.get("@" /* UseAliasToken */)}${key}`;
1002
1005
  }
1003
1006
  return "";
@@ -1008,11 +1011,11 @@ var macroFormatter = /* @__PURE__ */ new Map([
1008
1011
  [codeAliasKey, __codeAliasKey],
1009
1012
  [defaultKey, (v) => v]
1010
1013
  ]);
1011
- var execMacroFormat = function(value, formatter) {
1014
+ var execMacroFormat = function(value, formatter, expr) {
1012
1015
  if (!macroFormatter.has(formatter)) {
1013
1016
  return value;
1014
1017
  }
1015
- return macroFormatter.get(formatter)(value);
1018
+ return macroFormatter.get(formatter)(value, expr);
1016
1019
  };
1017
1020
  var toCellRow = (rowVals, setup) => {
1018
1021
  if (setup === void 0) {
@@ -1110,7 +1113,7 @@ var resolveCompileMacroExpr = (ctx, macroExpr, macroTokens2, currentCellIndex, t
1110
1113
  return;
1111
1114
  }
1112
1115
  const value = toCellValue(cellValue.value);
1113
- let exprValue2 = execMacroFormat(value, formatter);
1116
+ let exprValue2 = execMacroFormat(value, formatter, ctx.currentExpr || void 0);
1114
1117
  parts.push(exprValue2);
1115
1118
  });
1116
1119
  });
@@ -1138,6 +1141,8 @@ var resolveCompileMacroExpr = (ctx, macroExpr, macroTokens2, currentCellIndex, t
1138
1141
  exprValue = resolveCompileMacroGen(ctx, macroCurrent, currentCellIndex);
1139
1142
  }
1140
1143
  macroExpr = exprValue;
1144
+ } else {
1145
+ macroExpr = resolveAliasExpr(ctx, macroExpr, currentCellIndex);
1141
1146
  }
1142
1147
  return macroExpr;
1143
1148
  };
@@ -1610,6 +1615,11 @@ ExprResolver.resolveCompileMacroExpr = resolveCompileMacroExpr;
1610
1615
  // src/extends.ts
1611
1616
  var import_promises = __toESM(require("fs/promises"));
1612
1617
 
1618
+ // src/biz.ts
1619
+ var import_node_path = require("path");
1620
+ var import_lodash = require("lodash");
1621
+ var import_adm_zip = __toESM(require("adm-zip"));
1622
+
1613
1623
  // src/bin.ts
1614
1624
  var program = new import_commander.Command();
1615
1625
  program.name("xlsx-cli").version("1.0.0");