mirror of
https://github.com/optilude/xlsx-template.git
synced 2026-07-02 08:27:39 +08:00
Convert to class and by conincidence fix bug in findMaxFileId which take only last file name (which can lead to problem if XLSX template was generated)
This commit is contained in:
+2
-1
@@ -9,4 +9,5 @@ atlassian-ide-plugin.xml
|
||||
.vs/
|
||||
lib/*.js
|
||||
lib/*.d.ts
|
||||
!lib/index.d.ts
|
||||
!lib/index.d.ts
|
||||
*.map
|
||||
|
||||
Generated
+1
-8
@@ -6,7 +6,7 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "xlsx-template",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@kant2002/jszip": "2.7.1",
|
||||
@@ -15,7 +15,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/jszip": "0.0.27",
|
||||
"@types/node": "^14.0.27",
|
||||
"jest": "^27.5.1",
|
||||
"ts-jest": "^27.1.3",
|
||||
@@ -985,12 +984,6 @@
|
||||
"pretty-format": "^27.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/jszip": {
|
||||
"version": "0.0.27",
|
||||
"resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-0.0.27.tgz",
|
||||
"integrity": "sha1-pLb9+Z7cV6XtJ/Ai5QGgchyeFxM=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "14.0.27",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.27.tgz",
|
||||
|
||||
+2
-3
@@ -56,13 +56,12 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@kant2002/jszip": "2.7.1",
|
||||
"elementtree": "^0.1.7",
|
||||
"image-size": "^0.3.5",
|
||||
"@kant2002/jszip": "2.7.1"
|
||||
"image-size": "^0.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/jszip": "0.0.27",
|
||||
"@types/node": "^14.0.27",
|
||||
"jest": "^27.5.1",
|
||||
"ts-jest": "^27.1.3",
|
||||
|
||||
Vendored
+193
@@ -0,0 +1,193 @@
|
||||
// Type definitions for JSZip
|
||||
// Project: http://stuk.github.com/jszip/
|
||||
// Definitions by: mzeiher <https://github.com/mzeiher>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface JSZip {
|
||||
/**
|
||||
* Get a file from the archive
|
||||
*
|
||||
* @param Path relative path to file
|
||||
* @return File matching path, null if no file found
|
||||
*/
|
||||
file(path: string): JSZipObject;
|
||||
|
||||
/**
|
||||
* Get files matching a RegExp from archive
|
||||
*
|
||||
* @param path RegExp to match
|
||||
* @return Return all matching files or an empty array
|
||||
*/
|
||||
file(path: RegExp): JSZipObject[];
|
||||
|
||||
/**
|
||||
* Add a file to the archive
|
||||
*
|
||||
* @param path Relative path to file
|
||||
* @param content Content of the file
|
||||
* @param options Optional information about the file
|
||||
* @return JSZip object
|
||||
*/
|
||||
file(path: string, data: any, options?: JSZipFileOptions): JSZip;
|
||||
|
||||
files: JSZipObject[];
|
||||
|
||||
/**
|
||||
* Return an new JSZip instance with the given folder as root
|
||||
*
|
||||
* @param name Name of the folder
|
||||
* @return New JSZip object with the given folder as root or null
|
||||
*/
|
||||
folder(name: string): JSZip;
|
||||
|
||||
/**
|
||||
* Returns new JSZip instances with the matching folders as root
|
||||
*
|
||||
* @param name RegExp to match
|
||||
* @return New array of JSZipFile objects which match the RegExp
|
||||
*/
|
||||
folder(name: RegExp): JSZipObject[];
|
||||
|
||||
/**
|
||||
* Get all files wchich match the given filter function
|
||||
*
|
||||
* @param predicate Filter function
|
||||
* @return Array of matched elements
|
||||
*/
|
||||
filter(predicate: (relativePath: string, file: JSZipObject) => boolean): JSZipObject[];
|
||||
|
||||
/**
|
||||
* Removes the file or folder from the archive
|
||||
*
|
||||
* @param path Relative path of file or folder
|
||||
* @return Returns the JSZip instance
|
||||
*/
|
||||
remove(path: string): JSZip;
|
||||
|
||||
/**
|
||||
* Generates a new archive
|
||||
*
|
||||
* @param options Optional options for the generator
|
||||
* @return The serialized archive
|
||||
*/
|
||||
generate(options?: JSZipGeneratorOptions): any;
|
||||
|
||||
/**
|
||||
* Deserialize zip file
|
||||
*
|
||||
* @param data Serialized zip file
|
||||
* @param options Options for deserializing
|
||||
* @return Returns the JSZip instance
|
||||
*/
|
||||
load(data: any, options: JSZipLoadOptions): JSZip;
|
||||
}
|
||||
|
||||
interface JSZipObject {
|
||||
name: string;
|
||||
dir: boolean;
|
||||
date: Date;
|
||||
comment: string;
|
||||
options: JSZipObjectOptions;
|
||||
|
||||
asText(): string;
|
||||
asBinary(): string;
|
||||
asArrayBuffer(): ArrayBuffer;
|
||||
asUint8Array(): Uint8Array;
|
||||
//asNodeBuffer(): Buffer;
|
||||
}
|
||||
|
||||
interface JSZipFileOptions {
|
||||
base64?: boolean;
|
||||
binary?: boolean;
|
||||
date?: Date;
|
||||
compression?: string;
|
||||
comment?: string;
|
||||
optimizedBinaryString?: boolean;
|
||||
createFolders?: boolean;
|
||||
}
|
||||
|
||||
interface JSZipObjectOptions {
|
||||
/** deprecated */
|
||||
base64: boolean;
|
||||
/** deprecated */
|
||||
binary: boolean;
|
||||
/** deprecated */
|
||||
dir: boolean;
|
||||
/** deprecated */
|
||||
date: Date;
|
||||
compression: string;
|
||||
}
|
||||
|
||||
interface JSZipGeneratorOptions {
|
||||
/** deprecated */
|
||||
base64?: boolean;
|
||||
/** DEFLATE or STORE */
|
||||
compression?: string;
|
||||
/** base64 (default), string, uint8array, blob */
|
||||
type?: string;
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
interface JSZipLoadOptions {
|
||||
base64?: boolean;
|
||||
checkCRC32?: boolean;
|
||||
optimizedBinaryString?: boolean;
|
||||
createFolders?: boolean;
|
||||
}
|
||||
|
||||
interface JSZipSupport {
|
||||
arraybuffer: boolean;
|
||||
uint8array: boolean;
|
||||
blob: boolean;
|
||||
nodebuffer: boolean;
|
||||
}
|
||||
|
||||
interface DEFLATE {
|
||||
/** pako.deflateRaw, level:0-9 */
|
||||
compress(input: string, compressionOptions: {level:number}): Uint8Array;
|
||||
compress(input: number[], compressionOptions: {level:number}): Uint8Array;
|
||||
compress(input: Uint8Array, compressionOptions: {level:number}): Uint8Array;
|
||||
|
||||
/** pako.inflateRaw */
|
||||
uncompress(input: string): Uint8Array;
|
||||
uncompress(input: number[]): Uint8Array;
|
||||
uncompress(input: Uint8Array): Uint8Array;
|
||||
}
|
||||
|
||||
declare var JSZip: {
|
||||
/**
|
||||
* Create JSZip instance
|
||||
*/
|
||||
(): JSZip;
|
||||
/**
|
||||
* Create JSZip instance
|
||||
* If no parameters given an empty zip archive will be created
|
||||
*
|
||||
* @param data Serialized zip archive
|
||||
* @param options Description of the serialized zip archive
|
||||
*/
|
||||
(data: any, options?: JSZipLoadOptions): JSZip;
|
||||
|
||||
/**
|
||||
* Create JSZip instance
|
||||
*/
|
||||
new (): JSZip;
|
||||
/**
|
||||
* Create JSZip instance
|
||||
* If no parameters given an empty zip archive will be created
|
||||
*
|
||||
* @param data Serialized zip archive
|
||||
* @param options Description of the serialized zip archive
|
||||
*/
|
||||
new (data: any, options?: JSZipLoadOptions): JSZip;
|
||||
|
||||
prototype: JSZip;
|
||||
support: JSZipSupport;
|
||||
compressions: {
|
||||
DEFLATE: DEFLATE;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "@kant2002/jszip" {
|
||||
export = JSZip;
|
||||
}
|
||||
+571
-708
File diff suppressed because it is too large
Load Diff
+4
-2
@@ -9,9 +9,11 @@
|
||||
"noImplicitAny": false,
|
||||
"alwaysStrict": true,
|
||||
"esModuleInterop": true,
|
||||
"outDir": "lib"
|
||||
"outDir": "lib",
|
||||
"sourceMap": true
|
||||
},
|
||||
"files": [
|
||||
"src/index.js"
|
||||
"src/index.js",
|
||||
"src/augment.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user