@vdhewei/xlsx-template-lib 1.3.3 → 1.3.5
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +32 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2998,11 +2998,11 @@ var extractMacro = function(expr, options) {
|
|
|
2998
2998
|
return extracResult;
|
|
2999
2999
|
};
|
|
3000
3000
|
var __codeKey = (str) => {
|
|
3001
|
-
const replaces = [
|
|
3002
|
-
for (const k
|
|
3003
|
-
str = str.
|
|
3001
|
+
const replaces = [" ", `-`, `/`, `,`, `'`, `&`, `.`, `(`, `)`, `{`, `}`, `@`, `\\`, `[`, `]`, `#`, `:`];
|
|
3002
|
+
for (const k of replaces) {
|
|
3003
|
+
str = str.replaceAll(k, "_").trim();
|
|
3004
3004
|
if (str.indexOf("__") >= 0) {
|
|
3005
|
-
str = str.
|
|
3005
|
+
str = str.replaceAll("__", "_");
|
|
3006
3006
|
}
|
|
3007
3007
|
}
|
|
3008
3008
|
if (str.startsWith("_")) {
|
|
@@ -3051,6 +3051,29 @@ var toCellRow = (rowVals, setup) => {
|
|
|
3051
3051
|
var toCellColumn = (columnVals, setup) => {
|
|
3052
3052
|
return toCellRow(columnVals, setup);
|
|
3053
3053
|
};
|
|
3054
|
+
var toCellValue = (value) => {
|
|
3055
|
+
if (typeof value !== "string") {
|
|
3056
|
+
const rText = value;
|
|
3057
|
+
if (rText !== void 0 && rText.richText !== void 0 && rText.richText.length > 0) {
|
|
3058
|
+
const values = [];
|
|
3059
|
+
for (const [_, v] of rText.richText.entries()) {
|
|
3060
|
+
if (v === void 0 || v === null) {
|
|
3061
|
+
continue;
|
|
3062
|
+
}
|
|
3063
|
+
const text = v.text !== void 0 && v.text !== null ? v.text : void 0;
|
|
3064
|
+
if (text !== void 0 && text !== "" && text !== "[object]") {
|
|
3065
|
+
values.push(text.trim());
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
return values.join(" ");
|
|
3069
|
+
}
|
|
3070
|
+
const hText = value;
|
|
3071
|
+
if (hText !== void 0 && hText.text !== null && hText.hyperlink !== null) {
|
|
3072
|
+
return `[${hText.text}](${hText.hyperlink})`;
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
return value.toString();
|
|
3076
|
+
};
|
|
3054
3077
|
var resolveCompileMacroExpr = (ctx, macroExpr, macroTokens2, currentCellIndex, totalCells) => {
|
|
3055
3078
|
if (macroTokens2 === void 0 || macroTokens2.length <= 0) {
|
|
3056
3079
|
return macroExpr;
|
|
@@ -3107,8 +3130,9 @@ var resolveCompileMacroExpr = (ctx, macroExpr, macroTokens2, currentCellIndex, t
|
|
|
3107
3130
|
if (cellValue === void 0 || cellValue.value === null) {
|
|
3108
3131
|
return;
|
|
3109
3132
|
}
|
|
3110
|
-
const value =
|
|
3111
|
-
|
|
3133
|
+
const value = toCellValue(cellValue.value);
|
|
3134
|
+
let exprValue2 = execMacroFormat(value, formatter);
|
|
3135
|
+
parts.push(exprValue2);
|
|
3112
3136
|
});
|
|
3113
3137
|
});
|
|
3114
3138
|
}
|
|
@@ -3995,6 +4019,7 @@ export {
|
|
|
3995
4019
|
resolveArgument,
|
|
3996
4020
|
scanCellSetPlaceholder,
|
|
3997
4021
|
toArrayBuffer,
|
|
4022
|
+
toCellValue,
|
|
3998
4023
|
valueDotGet,
|
|
3999
4024
|
workSheetSetPlaceholder
|
|
4000
4025
|
};
|