excellentexport 3.9.0 → 3.9.1
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 +4 -0
- package/dist/excellentexport.js +1 -1
- package/dist/format.d.ts +4 -3
- package/dist/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/excellentexport.ts +3 -3
- package/src/format.ts +18 -14
- package/src/index.ts +4 -0
package/dist/format.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare enum
|
|
1
|
+
export declare enum CellTypes {
|
|
2
2
|
TEXT = "s",
|
|
3
3
|
NUMBER = "n",
|
|
4
4
|
DATE = "d",
|
|
5
5
|
BOOLEAN = "b"
|
|
6
6
|
}
|
|
7
|
-
export declare enum
|
|
7
|
+
export declare enum CellPatterns {
|
|
8
8
|
INTEGER = "0",
|
|
9
9
|
DECIMAL = "0.00",
|
|
10
10
|
DATE = "dd/mm/yyyy",
|
|
@@ -15,9 +15,10 @@ export declare enum CellPattern {
|
|
|
15
15
|
EXPONENT = "0.00E+00",
|
|
16
16
|
TEXT = "@"
|
|
17
17
|
}
|
|
18
|
+
export type CellType = 's' | 'n' | 'd' | 'b';
|
|
18
19
|
export interface CellFormat {
|
|
19
20
|
type: CellType;
|
|
20
|
-
pattern?:
|
|
21
|
+
pattern?: string;
|
|
21
22
|
}
|
|
22
23
|
export interface CellFormats {
|
|
23
24
|
[key: string]: CellFormat;
|
package/dist/index.d.ts
ADDED
package/package.json
CHANGED
package/src/excellentexport.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import * as XLSX from 'xlsx';
|
|
11
|
-
import {
|
|
11
|
+
import { CellTypes, FormatDefinition, PredefinedFormat } from './format';
|
|
12
12
|
|
|
13
13
|
import * as utils from './utils';
|
|
14
14
|
|
|
@@ -44,7 +44,7 @@ export interface SheetOptions {
|
|
|
44
44
|
|
|
45
45
|
const ExcellentExport = function() {
|
|
46
46
|
|
|
47
|
-
const version = "3.9.
|
|
47
|
+
const version = "3.9.1";
|
|
48
48
|
|
|
49
49
|
/*
|
|
50
50
|
ExcellentExport.convert(options, sheets);
|
|
@@ -153,7 +153,7 @@ const ExcellentExport = function() {
|
|
|
153
153
|
cell.t = f.format.type;
|
|
154
154
|
|
|
155
155
|
// type fix
|
|
156
|
-
if (f.format?.type ==
|
|
156
|
+
if (f.format?.type == CellTypes.BOOLEAN) {
|
|
157
157
|
const v = cell.v.toString().toLowerCase();
|
|
158
158
|
if (v == 'true' || v == '1') cell.v = true;
|
|
159
159
|
if (v == 'false' || v == '0') cell.v = false;
|
package/src/format.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
// Constants for cell types
|
|
3
|
+
export enum CellTypes {
|
|
3
4
|
TEXT = 's',
|
|
4
5
|
NUMBER = 'n',
|
|
5
6
|
DATE = 'd',
|
|
6
7
|
BOOLEAN = 'b',
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
// Constants for cell patterns
|
|
11
|
+
export enum CellPatterns {
|
|
10
12
|
INTEGER = '0',
|
|
11
13
|
DECIMAL = '0.00',
|
|
12
14
|
DATE = 'dd/mm/yyyy',
|
|
@@ -18,9 +20,11 @@ export enum CellPattern {
|
|
|
18
20
|
TEXT = '@',
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
export type CellType = 's' | 'n' | 'd' | 'b';
|
|
24
|
+
|
|
21
25
|
export interface CellFormat {
|
|
22
26
|
type: CellType,
|
|
23
|
-
pattern?:
|
|
27
|
+
pattern?: string,
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
// Define structure for predefined formats
|
|
@@ -28,21 +32,21 @@ export interface CellFormats {
|
|
|
28
32
|
[key: string]: CellFormat
|
|
29
33
|
}
|
|
30
34
|
export const PredefinedFormat : CellFormats = {
|
|
31
|
-
NUMBER: { type:
|
|
32
|
-
INTEGER: { type:
|
|
33
|
-
DECIMAL: { type:
|
|
34
|
-
CURRENCY: { type:
|
|
35
|
-
PERCENTAGE: { type:
|
|
36
|
-
EXPONENT: { type:
|
|
35
|
+
NUMBER: { type: CellTypes.NUMBER},
|
|
36
|
+
INTEGER: { type: CellTypes.NUMBER, pattern: CellPatterns.INTEGER },
|
|
37
|
+
DECIMAL: { type: CellTypes.NUMBER, pattern: CellPatterns.DECIMAL },
|
|
38
|
+
CURRENCY: { type: CellTypes.NUMBER, pattern: CellPatterns.CURRENCY },
|
|
39
|
+
PERCENTAGE: { type: CellTypes.NUMBER, pattern: CellPatterns.PERCENTAGE },
|
|
40
|
+
EXPONENT: { type: CellTypes.NUMBER, pattern: CellPatterns.EXPONENT },
|
|
37
41
|
|
|
38
|
-
DATE: { type:
|
|
42
|
+
DATE: { type: CellTypes.DATE, pattern: CellPatterns.DATE },
|
|
39
43
|
|
|
40
|
-
TIME: { type:
|
|
41
|
-
DATETIME: { type:
|
|
44
|
+
TIME: { type: CellTypes.DATE, pattern: CellPatterns.TIME },
|
|
45
|
+
DATETIME: { type: CellTypes.DATE, pattern: CellPatterns.DATETIME },
|
|
42
46
|
|
|
43
|
-
TEXT: { type:
|
|
47
|
+
TEXT: { type: CellTypes.TEXT, pattern: CellPatterns.TEXT },
|
|
44
48
|
|
|
45
|
-
BOOLEAN: { type:
|
|
49
|
+
BOOLEAN: { type: CellTypes.BOOLEAN },
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
export interface FormatDefinition {
|
package/src/index.ts
ADDED