@vdhewei/xlsx-template-lib 1.4.2 → 1.4.3

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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ExprResolver
4
- } from "./chunk-XYVHFW4V.mjs";
4
+ } from "./chunk-2UQSPJKC.mjs";
5
5
 
6
6
  // src/bin.ts
7
7
  import chalk from "chalk";
@@ -2997,7 +2997,7 @@ var extractMacro = function(expr, options) {
2997
2997
  }
2998
2998
  return extracResult;
2999
2999
  };
3000
- var __codeKey = (str) => {
3000
+ var __codeKey = (str, expr) => {
3001
3001
  const replaces = [" ", `-`, `/`, `,`, `'`, `&`, `.`, `(`, `)`, `{`, `}`, `@`, `\\`, `[`, `]`, `#`, `:`];
3002
3002
  for (const k of replaces) {
3003
3003
  str = str.replaceAll(k, "_").trim();
@@ -3013,12 +3013,15 @@ var __codeKey = (str) => {
3013
3013
  }
3014
3014
  return str.toUpperCase();
3015
3015
  };
3016
- var __numberKey = (str) => {
3016
+ var __numberKey = (str, expr) => {
3017
3017
  return Number.parseInt(str, 10).toString();
3018
3018
  };
3019
- var __codeAliasKey = (str) => {
3019
+ var __codeAliasKey = (str, expr) => {
3020
3020
  const key = __codeKey(str);
3021
3021
  if (key !== "") {
3022
+ if (expr !== void 0 && expr.tokens.length > 0) {
3023
+ expr.tokens.push("@" /* UseAliasToken */);
3024
+ }
3022
3025
  return `${defaultRuleTokenMap.get("@" /* UseAliasToken */)}${key}`;
3023
3026
  }
3024
3027
  return "";
@@ -3029,11 +3032,11 @@ var macroFormatter = /* @__PURE__ */ new Map([
3029
3032
  [codeAliasKey, __codeAliasKey],
3030
3033
  [defaultKey, (v) => v]
3031
3034
  ]);
3032
- var execMacroFormat = function(value, formatter) {
3035
+ var execMacroFormat = function(value, formatter, expr) {
3033
3036
  if (!macroFormatter.has(formatter)) {
3034
3037
  return value;
3035
3038
  }
3036
- return macroFormatter.get(formatter)(value);
3039
+ return macroFormatter.get(formatter)(value, expr);
3037
3040
  };
3038
3041
  var toCellRow = (rowVals, setup) => {
3039
3042
  if (setup === void 0) {
@@ -3131,7 +3134,7 @@ var resolveCompileMacroExpr = (ctx, macroExpr, macroTokens2, currentCellIndex, t
3131
3134
  return;
3132
3135
  }
3133
3136
  const value = toCellValue(cellValue.value);
3134
- let exprValue2 = execMacroFormat(value, formatter);
3137
+ let exprValue2 = execMacroFormat(value, formatter, ctx.currentExpr || void 0);
3135
3138
  parts.push(exprValue2);
3136
3139
  });
3137
3140
  });
@@ -3159,6 +3162,8 @@ var resolveCompileMacroExpr = (ctx, macroExpr, macroTokens2, currentCellIndex, t
3159
3162
  exprValue = resolveCompileMacroGen(ctx, macroCurrent, currentCellIndex);
3160
3163
  }
3161
3164
  macroExpr = exprValue;
3165
+ } else {
3166
+ macroExpr = resolveAliasExpr(ctx, macroExpr, currentCellIndex);
3162
3167
  }
3163
3168
  return macroExpr;
3164
3169
  };
@@ -4024,4 +4029,4 @@ export {
4024
4029
  autoRegisterAlias,
4025
4030
  generateCommandsXlsxTemplateWithCompile
4026
4031
  };
4027
- //# sourceMappingURL=chunk-XYVHFW4V.mjs.map
4032
+ //# sourceMappingURL=chunk-2UQSPJKC.mjs.map