@vdhewei/xlsx-template-lib 1.3.1 → 1.3.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/index.js +32 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2998,14 +2998,20 @@ var extractMacro = function(expr, options) {
|
|
|
2998
2998
|
return extracResult;
|
|
2999
2999
|
};
|
|
3000
3000
|
var __codeKey = (str) => {
|
|
3001
|
-
|
|
3002
|
-
for (
|
|
3003
|
-
|
|
3001
|
+
const replaces = [` `, `-`, `/`, `,`, `'`, `&`, `.`, `(`, `)`, `{`, `}`, `@`, `\\`, `[`, `]`, `#`, `:`];
|
|
3002
|
+
for (const k in replaces) {
|
|
3003
|
+
str = str.replace(k, "_").trim();
|
|
3004
|
+
if (str.indexOf("__") >= 0) {
|
|
3005
|
+
str = str.replace("__", "_");
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
if (str.startsWith("_")) {
|
|
3009
|
+
str = str.substring(1);
|
|
3004
3010
|
}
|
|
3005
|
-
|
|
3006
|
-
|
|
3011
|
+
if (str.endsWith("_")) {
|
|
3012
|
+
str = str.substring(0, str.length - 1);
|
|
3007
3013
|
}
|
|
3008
|
-
return
|
|
3014
|
+
return str.toUpperCase();
|
|
3009
3015
|
};
|
|
3010
3016
|
var __numberKey = (str) => {
|
|
3011
3017
|
return Number.parseInt(str, 10).toString();
|
|
@@ -3435,21 +3441,26 @@ var compileRowCells = function(ctx, expr, cellPoints, rowIndex, errs) {
|
|
|
3435
3441
|
return;
|
|
3436
3442
|
}
|
|
3437
3443
|
ctx.currentExpr = expr;
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3444
|
+
try {
|
|
3445
|
+
cellPoints.forEach((cellPoint, index) => {
|
|
3446
|
+
const r = cellPoint.Row;
|
|
3447
|
+
const sheet = ctx.sheet;
|
|
3448
|
+
const c = cellPoint.Column;
|
|
3449
|
+
const cell = sheet.findCell(r, c);
|
|
3450
|
+
if (cell === void 0 || cell.value !== void 0 && cell.value !== null && cell.value !== "") {
|
|
3451
|
+
return;
|
|
3452
|
+
}
|
|
3453
|
+
let templateValue = String(expr.value);
|
|
3454
|
+
const macroTokens2 = getMacroTokens(expr);
|
|
3455
|
+
templateValue = resolveFunctionExpr(ctx, templateValue, expr);
|
|
3456
|
+
templateValue = resolveCompileMacroExpr(ctx, templateValue, macroTokens2, index, cellPoints.length);
|
|
3457
|
+
templateValue = resolveAliasExpr(ctx, templateValue, index);
|
|
3458
|
+
cell.value = resolveValueExpr(ctx, templateValue);
|
|
3459
|
+
});
|
|
3460
|
+
} catch (err) {
|
|
3461
|
+
const msg = err.message;
|
|
3462
|
+
throw new Error(`expr:${expr.express}, resolve error: ${msg}`);
|
|
3463
|
+
}
|
|
3453
3464
|
};
|
|
3454
3465
|
var generateWorkSheetCellsPlaceholder = function(ctx, expr, sheet) {
|
|
3455
3466
|
const errs = [];
|