Merge pull request #25724 from taoqf/master

upgrade jsreport-html-to-xlsx to 2.0
This commit is contained in:
Mine Starks
2018-06-11 10:27:49 -07:00
committed by GitHub
5 changed files with 73 additions and 1 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for jsreport-html-to-xlsx 1.4
// Type definitions for jsreport-html-to-xlsx 2.0
// Project: https://github.com/jsreport/jsreport-html-to-xlsx
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -8,7 +8,9 @@ import { ExtensionDefinition } from 'jsreport-core';
import { Options as BaseOptions } from 'jsreport-xlsx';
declare module 'jsreport-core' {
type htmlEngine = 'phantom' | 'chrome';
interface Template {
htmlToXlsx: { htmlEngine: htmlEngine; };
recipe: 'html-to-xlsx' | string;
}
}
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for jsreport-html-to-xlsx 1.4
// Project: https://github.com/jsreport/jsreport-html-to-xlsx
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { ExtensionDefinition } from 'jsreport-core';
import { Options as BaseOptions } from 'jsreport-xlsx';
declare module 'jsreport-core' {
interface Template {
recipe: 'html-to-xlsx' | string;
}
}
declare namespace JsReportHtml2Xlsx {
interface Options extends BaseOptions {
strategy: string;
}
}
declare function JsReportHtml2Xlsx(options?: Partial<JsReportHtml2Xlsx.Options>): ExtensionDefinition;
export = JsReportHtml2Xlsx;
@@ -0,0 +1,19 @@
import JsReport = require('jsreport-core');
import JsreportHtml2Xlsx = require('jsreport-html-to-xlsx');
import JsreportXlsx = require('jsreport-xlsx');
const jsreport = JsReport();
jsreport.use(JsreportXlsx());
jsreport.use(JsreportHtml2Xlsx());
(async () => {
const content = `<table><tr><td>test</td></tr></table>`;
await jsreport.init();
const resp = await jsreport.render({
template: {
content,
engine: 'none',
recipe: 'xlsx'
}
});
})();
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"esnext"
],
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"jsreport-html-to-xlsx": [ "jsreport-html-to-xlsx/v1" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jsreport-html-to-xlsx-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }