@vdhewei/xlsx-template-lib 1.2.2 → 1.2.4
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3497,8 +3497,7 @@ var compile = async function(data, ruleSheetName, options) {
|
|
|
3497
3497
|
const sheet = workbook.getWorksheet(ruleSheetName);
|
|
3498
3498
|
if (sheet === void 0) {
|
|
3499
3499
|
return {
|
|
3500
|
-
workbook
|
|
3501
|
-
errs: [new Error(`compile error, ${ruleSheetName} not exists!`)]
|
|
3500
|
+
workbook
|
|
3502
3501
|
};
|
|
3503
3502
|
}
|
|
3504
3503
|
if (workbook.worksheets === void 0) {
|
|
@@ -3876,6 +3875,14 @@ var mergeMap = function(source, dest) {
|
|
|
3876
3875
|
}
|
|
3877
3876
|
return source;
|
|
3878
3877
|
};
|
|
3878
|
+
var autoRegisterAlias = function(values, configure) {
|
|
3879
|
+
let alias = ExprResolver.fetchAlias(configure);
|
|
3880
|
+
if (values[aliasKey] !== void 0 && values[aliasKey] instanceof Map) {
|
|
3881
|
+
alias = mergeMap(alias, values[aliasKey]);
|
|
3882
|
+
}
|
|
3883
|
+
values[aliasKey] = alias;
|
|
3884
|
+
return values;
|
|
3885
|
+
};
|
|
3879
3886
|
var generateCommandsXlsxTemplateWithCompile = async function(data, values, compileOptions, options) {
|
|
3880
3887
|
if (compileOptions.sheetName === void 0 || compileOptions.sheetName === "") {
|
|
3881
3888
|
compileOptions.sheetName = compileRuleSheetName;
|
|
@@ -3884,11 +3891,7 @@ var generateCommandsXlsxTemplateWithCompile = async function(data, values, compi
|
|
|
3884
3891
|
if (result.errs !== void 0 && result.errs.length > 0) {
|
|
3885
3892
|
throw result.errs[0];
|
|
3886
3893
|
}
|
|
3887
|
-
|
|
3888
|
-
if (values[aliasKey] !== void 0 && values[aliasKey] instanceof Map) {
|
|
3889
|
-
alias = mergeMap(alias, values[aliasKey]);
|
|
3890
|
-
}
|
|
3891
|
-
values[aliasKey] = alias;
|
|
3894
|
+
values = autoRegisterAlias(values, result.configure);
|
|
3892
3895
|
result.workbook = ExprResolver.removeUnExportSheets(result.workbook, compileOptions);
|
|
3893
3896
|
const wb = await ExprResolver.toBuffer(result.workbook);
|
|
3894
3897
|
const w = await Workbook.parse(wb, options);
|
|
@@ -3910,6 +3913,7 @@ export {
|
|
|
3910
3913
|
RuleToken,
|
|
3911
3914
|
TokenParserManger,
|
|
3912
3915
|
Workbook,
|
|
3916
|
+
autoRegisterAlias,
|
|
3913
3917
|
columnLetterToNumber,
|
|
3914
3918
|
columnNumberToLetter,
|
|
3915
3919
|
commandExtendQuery,
|
|
@@ -3929,6 +3933,7 @@ export {
|
|
|
3929
3933
|
isRuleToken,
|
|
3930
3934
|
isUrl,
|
|
3931
3935
|
loadWorkbook,
|
|
3936
|
+
mergeMap,
|
|
3932
3937
|
parseWorkSheetRules,
|
|
3933
3938
|
registerTokenParser,
|
|
3934
3939
|
registerTokenParserMust,
|