@vdhewei/xlsx-template-lib 1.6.11 → 1.6.12
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/README.md +63 -52
- package/README.zh-CN.md +69 -57
- package/dist/bin.js.map +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/{chunk-NSFBG6PV.mjs → chunk-BPKRWKLJ.mjs} +20 -1
- package/dist/{chunk-NSFBG6PV.mjs.map → chunk-BPKRWKLJ.mjs.map} +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -470,6 +470,7 @@ declare const compileRuleSheetName = "export_metadata.config";
|
|
|
470
470
|
declare const mergeMap: (source: Map<string, string>, dest: Map<string, string>) => Map<string, string>;
|
|
471
471
|
declare const autoRegisterAlias: (values: Object, configure: RuleResult) => Object;
|
|
472
472
|
declare const generateCommandsXlsxTemplateWithCompile: <T extends JsZip.OutputType>(data: Buffer, values: Object, compileOptions: AutoOptions, options?: JsZip.JSZipGeneratorOptions<T> & FullOptions) => Promise<OutputByType[T]>;
|
|
473
|
+
declare const compileCommandsXlsxTemplate: (data: Buffer, values: Object, compileOptions: AutoOptions, options?: JsZip.JSZipGeneratorOptions & FullOptions) => Promise<Buffer>;
|
|
473
474
|
declare const compileAll: (buf: Buffer, compileOpts: AutoOptions, renderData?: Object) => Promise<Buffer>;
|
|
474
475
|
|
|
475
476
|
type CustomChecker = (data: Buffer, options: FullOptions & {
|
|
@@ -501,4 +502,4 @@ declare class ZipXlsxTemplateApp {
|
|
|
501
502
|
static compileTo(data: Buffer, opts: CustomCheckerOptions, values?: Record<string, any> | Object): Promise<Buffer>;
|
|
502
503
|
}
|
|
503
504
|
|
|
504
|
-
export { AddCommand, AddCommandMust, type AfterReplaceHook, type Argument, ArgumentData, ArgumentValue, ArgumentValueLoader, type AutoOptions, type BeforeReplaceHook, BufferType, type CellPosition, type CmdFunction, CompileContext, type CompileResult, type CustomChecker, type CustomCheckerOptions, type CustomFormatter, type CustomPlaceholderExtractor, type CustomReplacer, DefaultPlaceholderCellValue, type DrawingInfo, ExprResolver, type ExtensionOptions, type ExtractMacroArgs, type FilterMacroResult, type FullOptions, type MacroArgs, type MacroUnitHelper, type OutputByType, type Placeholder, type PlaceholderCellValue, type QueryFunction, type Range, type Ref, type RelsInfo, RuleMapOptions, type RuleOptions, type RuleResult, RuleToken, type SheetInfo, type TableInfo, TokenParserManger, Workbook, type WorkbookOptions, XlsxRender, ZipXlsxTemplateApp, autoRegisterAlias, columnLetterToNumber, columnNumberToLetter, commandExtendQuery, compileAll, compileRuleSheetName, compileWorkSheet, compileWorkSheetPlaceholder, defaultExtractPlaceholders, defaultFormatters, defaultValueDotGet, generateCommandsXlsxTemplate, generateCommandsXlsxTemplateWithCompile, generateXlsxTemplate, getCommands, getTokenParser, hasGeneratorToken, isRuleToken, isUrl, loadCompileSheets, loadWorkbook, mergeMap, parseWorkSheetRules, registerTokenParser, registerTokenParserMust, resolveArgument, scanCellSetPlaceholder, toArrayBuffer, toCellValue, valueDotGet, workSheetSetPlaceholder };
|
|
505
|
+
export { AddCommand, AddCommandMust, type AfterReplaceHook, type Argument, ArgumentData, ArgumentValue, ArgumentValueLoader, type AutoOptions, type BeforeReplaceHook, BufferType, type CellPosition, type CmdFunction, CompileContext, type CompileResult, type CustomChecker, type CustomCheckerOptions, type CustomFormatter, type CustomPlaceholderExtractor, type CustomReplacer, DefaultPlaceholderCellValue, type DrawingInfo, ExprResolver, type ExtensionOptions, type ExtractMacroArgs, type FilterMacroResult, type FullOptions, type MacroArgs, type MacroUnitHelper, type OutputByType, type Placeholder, type PlaceholderCellValue, type QueryFunction, type Range, type Ref, type RelsInfo, RuleMapOptions, type RuleOptions, type RuleResult, RuleToken, type SheetInfo, type TableInfo, TokenParserManger, Workbook, type WorkbookOptions, XlsxRender, ZipXlsxTemplateApp, autoRegisterAlias, columnLetterToNumber, columnNumberToLetter, commandExtendQuery, compileAll, compileCommandsXlsxTemplate, compileRuleSheetName, compileWorkSheet, compileWorkSheetPlaceholder, defaultExtractPlaceholders, defaultFormatters, defaultValueDotGet, generateCommandsXlsxTemplate, generateCommandsXlsxTemplateWithCompile, generateXlsxTemplate, getCommands, getTokenParser, hasGeneratorToken, isRuleToken, isUrl, loadCompileSheets, loadWorkbook, mergeMap, parseWorkSheetRules, registerTokenParser, registerTokenParserMust, resolveArgument, scanCellSetPlaceholder, toArrayBuffer, toCellValue, valueDotGet, workSheetSetPlaceholder };
|
package/dist/index.d.ts
CHANGED
|
@@ -470,6 +470,7 @@ declare const compileRuleSheetName = "export_metadata.config";
|
|
|
470
470
|
declare const mergeMap: (source: Map<string, string>, dest: Map<string, string>) => Map<string, string>;
|
|
471
471
|
declare const autoRegisterAlias: (values: Object, configure: RuleResult) => Object;
|
|
472
472
|
declare const generateCommandsXlsxTemplateWithCompile: <T extends JsZip.OutputType>(data: Buffer, values: Object, compileOptions: AutoOptions, options?: JsZip.JSZipGeneratorOptions<T> & FullOptions) => Promise<OutputByType[T]>;
|
|
473
|
+
declare const compileCommandsXlsxTemplate: (data: Buffer, values: Object, compileOptions: AutoOptions, options?: JsZip.JSZipGeneratorOptions & FullOptions) => Promise<Buffer>;
|
|
473
474
|
declare const compileAll: (buf: Buffer, compileOpts: AutoOptions, renderData?: Object) => Promise<Buffer>;
|
|
474
475
|
|
|
475
476
|
type CustomChecker = (data: Buffer, options: FullOptions & {
|
|
@@ -501,4 +502,4 @@ declare class ZipXlsxTemplateApp {
|
|
|
501
502
|
static compileTo(data: Buffer, opts: CustomCheckerOptions, values?: Record<string, any> | Object): Promise<Buffer>;
|
|
502
503
|
}
|
|
503
504
|
|
|
504
|
-
export { AddCommand, AddCommandMust, type AfterReplaceHook, type Argument, ArgumentData, ArgumentValue, ArgumentValueLoader, type AutoOptions, type BeforeReplaceHook, BufferType, type CellPosition, type CmdFunction, CompileContext, type CompileResult, type CustomChecker, type CustomCheckerOptions, type CustomFormatter, type CustomPlaceholderExtractor, type CustomReplacer, DefaultPlaceholderCellValue, type DrawingInfo, ExprResolver, type ExtensionOptions, type ExtractMacroArgs, type FilterMacroResult, type FullOptions, type MacroArgs, type MacroUnitHelper, type OutputByType, type Placeholder, type PlaceholderCellValue, type QueryFunction, type Range, type Ref, type RelsInfo, RuleMapOptions, type RuleOptions, type RuleResult, RuleToken, type SheetInfo, type TableInfo, TokenParserManger, Workbook, type WorkbookOptions, XlsxRender, ZipXlsxTemplateApp, autoRegisterAlias, columnLetterToNumber, columnNumberToLetter, commandExtendQuery, compileAll, compileRuleSheetName, compileWorkSheet, compileWorkSheetPlaceholder, defaultExtractPlaceholders, defaultFormatters, defaultValueDotGet, generateCommandsXlsxTemplate, generateCommandsXlsxTemplateWithCompile, generateXlsxTemplate, getCommands, getTokenParser, hasGeneratorToken, isRuleToken, isUrl, loadCompileSheets, loadWorkbook, mergeMap, parseWorkSheetRules, registerTokenParser, registerTokenParserMust, resolveArgument, scanCellSetPlaceholder, toArrayBuffer, toCellValue, valueDotGet, workSheetSetPlaceholder };
|
|
505
|
+
export { AddCommand, AddCommandMust, type AfterReplaceHook, type Argument, ArgumentData, ArgumentValue, ArgumentValueLoader, type AutoOptions, type BeforeReplaceHook, BufferType, type CellPosition, type CmdFunction, CompileContext, type CompileResult, type CustomChecker, type CustomCheckerOptions, type CustomFormatter, type CustomPlaceholderExtractor, type CustomReplacer, DefaultPlaceholderCellValue, type DrawingInfo, ExprResolver, type ExtensionOptions, type ExtractMacroArgs, type FilterMacroResult, type FullOptions, type MacroArgs, type MacroUnitHelper, type OutputByType, type Placeholder, type PlaceholderCellValue, type QueryFunction, type Range, type Ref, type RelsInfo, RuleMapOptions, type RuleOptions, type RuleResult, RuleToken, type SheetInfo, type TableInfo, TokenParserManger, Workbook, type WorkbookOptions, XlsxRender, ZipXlsxTemplateApp, autoRegisterAlias, columnLetterToNumber, columnNumberToLetter, commandExtendQuery, compileAll, compileCommandsXlsxTemplate, compileRuleSheetName, compileWorkSheet, compileWorkSheetPlaceholder, defaultExtractPlaceholders, defaultFormatters, defaultValueDotGet, generateCommandsXlsxTemplate, generateCommandsXlsxTemplateWithCompile, generateXlsxTemplate, getCommands, getTokenParser, hasGeneratorToken, isRuleToken, isUrl, loadCompileSheets, loadWorkbook, mergeMap, parseWorkSheetRules, registerTokenParser, registerTokenParserMust, resolveArgument, scanCellSetPlaceholder, toArrayBuffer, toCellValue, valueDotGet, workSheetSetPlaceholder };
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
columnNumberToLetter: () => columnNumberToLetter,
|
|
51
51
|
commandExtendQuery: () => commandExtendQuery,
|
|
52
52
|
compileAll: () => compileAll,
|
|
53
|
+
compileCommandsXlsxTemplate: () => compileCommandsXlsxTemplate,
|
|
53
54
|
compileRuleSheetName: () => compileRuleSheetName,
|
|
54
55
|
compileWorkSheet: () => compileWorkSheet,
|
|
55
56
|
compileWorkSheetPlaceholder: () => compileWorkSheetPlaceholder,
|
|
@@ -4085,6 +4086,24 @@ var generateCommandsXlsxTemplateWithCompile = async function(data, values, compi
|
|
|
4085
4086
|
await w.substituteAll(values);
|
|
4086
4087
|
return w.generate(options);
|
|
4087
4088
|
};
|
|
4089
|
+
var compileCommandsXlsxTemplate = async function(data, values, compileOptions, options) {
|
|
4090
|
+
if (compileOptions.sheetName === void 0 || compileOptions.sheetName === "") {
|
|
4091
|
+
compileOptions.sheetName = compileRuleSheetName;
|
|
4092
|
+
}
|
|
4093
|
+
const result = await ExprResolver.compile(data, compileOptions.sheetName, compileOptions);
|
|
4094
|
+
if (result.errs !== void 0 && result.errs.length > 0) {
|
|
4095
|
+
throw result.errs[0];
|
|
4096
|
+
}
|
|
4097
|
+
values = autoRegisterAlias(values, result.configure);
|
|
4098
|
+
result.workbook = ExprResolver.removeUnExportSheets(result.workbook, compileOptions);
|
|
4099
|
+
const wb = await ExprResolver.toBuffer(result.workbook);
|
|
4100
|
+
await saveCompile(compileOptions, wb);
|
|
4101
|
+
const w = await Workbook.parse(wb, options);
|
|
4102
|
+
w.setQueryFunctionHandler(commandExtendQuery);
|
|
4103
|
+
await w.substituteAll(values);
|
|
4104
|
+
await w.generate(options);
|
|
4105
|
+
return wb;
|
|
4106
|
+
};
|
|
4088
4107
|
var compileAll = async (buf, compileOpts, renderData) => {
|
|
4089
4108
|
if (compileOpts === void 0 || compileOpts.sheetName === "") {
|
|
4090
4109
|
return buf;
|
|
@@ -4271,6 +4290,7 @@ var ZipXlsxTemplateApp = class _ZipXlsxTemplateApp {
|
|
|
4271
4290
|
columnNumberToLetter,
|
|
4272
4291
|
commandExtendQuery,
|
|
4273
4292
|
compileAll,
|
|
4293
|
+
compileCommandsXlsxTemplate,
|
|
4274
4294
|
compileRuleSheetName,
|
|
4275
4295
|
compileWorkSheet,
|
|
4276
4296
|
compileWorkSheetPlaceholder,
|