@visactor/vtable-plugins 1.19.5 → 1.19.6
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/cjs/index.d.ts +1 -0
- package/cjs/index.js +2 -1
- package/cjs/index.js.map +1 -1
- package/cjs/table-export/csv/index.d.ts +12 -0
- package/cjs/table-export/csv/index.js +54 -0
- package/cjs/table-export/csv/index.js.map +1 -0
- package/cjs/table-export/excel/index.d.ts +21 -0
- package/cjs/table-export/excel/index.js +243 -0
- package/cjs/table-export/excel/index.js.map +1 -0
- package/cjs/table-export/excel/style.d.ts +6 -0
- package/cjs/table-export/excel/style.js +89 -0
- package/cjs/table-export/excel/style.js.map +1 -0
- package/cjs/table-export/index.d.ts +7 -0
- package/cjs/table-export/index.js +38 -0
- package/cjs/table-export/index.js.map +1 -0
- package/cjs/table-export/util/color.d.ts +152 -0
- package/cjs/table-export/util/color.js +197 -0
- package/cjs/table-export/util/color.js.map +1 -0
- package/cjs/table-export/util/download.d.ts +2 -0
- package/cjs/table-export/util/download.js +60 -0
- package/cjs/table-export/util/download.js.map +1 -0
- package/cjs/table-export/util/encode.d.ts +3 -0
- package/cjs/table-export/util/encode.js +17 -0
- package/cjs/table-export/util/encode.js.map +1 -0
- package/cjs/table-export/util/indent.d.ts +2 -0
- package/cjs/table-export/util/indent.js +27 -0
- package/cjs/table-export/util/indent.js.map +1 -0
- package/cjs/table-export/util/pagination.d.ts +5 -0
- package/cjs/table-export/util/pagination.js +24 -0
- package/cjs/table-export/util/pagination.js.map +1 -0
- package/cjs/table-export/util/promise.d.ts +1 -0
- package/cjs/table-export/util/promise.js +10 -0
- package/cjs/table-export/util/promise.js.map +1 -0
- package/cjs/table-export/util/type.d.ts +6 -0
- package/cjs/table-export/util/type.js +6 -0
- package/cjs/table-export/util/type.js.map +1 -0
- package/cjs/table-export.d.ts +17 -0
- package/cjs/table-export.js +93 -0
- package/cjs/table-export.js.map +1 -0
- package/cjs/types.js +1 -2
- package/cjs/wps-fill-handle.js +1 -0
- package/dist/vtable-plugins.js +1173 -185
- package/dist/vtable-plugins.min.js +14 -14
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/es/table-export/csv/index.d.ts +12 -0
- package/es/table-export/csv/index.js +47 -0
- package/es/table-export/csv/index.js.map +1 -0
- package/es/table-export/excel/index.d.ts +21 -0
- package/es/table-export/excel/index.js +242 -0
- package/es/table-export/excel/index.js.map +1 -0
- package/es/table-export/excel/style.d.ts +6 -0
- package/es/table-export/excel/style.js +80 -0
- package/es/table-export/excel/style.js.map +1 -0
- package/es/table-export/index.d.ts +7 -0
- package/es/table-export/index.js +8 -0
- package/es/table-export/index.js.map +1 -0
- package/es/table-export/util/color.d.ts +152 -0
- package/es/table-export/util/color.js +189 -0
- package/es/table-export/util/color.js.map +1 -0
- package/es/table-export/util/download.d.ts +2 -0
- package/es/table-export/util/download.js +52 -0
- package/es/table-export/util/download.js.map +1 -0
- package/es/table-export/util/encode.d.ts +3 -0
- package/es/table-export/util/encode.js +10 -0
- package/es/table-export/util/encode.js.map +1 -0
- package/es/table-export/util/indent.d.ts +2 -0
- package/es/table-export/util/indent.js +19 -0
- package/es/table-export/util/indent.js.map +1 -0
- package/es/table-export/util/pagination.d.ts +5 -0
- package/es/table-export/util/pagination.js +16 -0
- package/es/table-export/util/pagination.js.map +1 -0
- package/es/table-export/util/promise.d.ts +1 -0
- package/es/table-export/util/promise.js +4 -0
- package/es/table-export/util/promise.js.map +1 -0
- package/es/table-export/util/type.d.ts +6 -0
- package/es/table-export/util/type.js +2 -0
- package/es/table-export/util/type.js.map +1 -0
- package/es/table-export.d.ts +17 -0
- package/es/table-export.js +62 -0
- package/es/table-export.js.map +1 -0
- package/es/types.js +1 -2
- package/es/wps-fill-handle.js +2 -1
- package/package.json +10 -8
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export declare function colorStringToRGB(colorString: string): number[];
|
|
2
|
+
export declare function rgbaToHex(rgbaArray: number[]): string;
|
|
3
|
+
export declare const DEFAULT_COLORS: {
|
|
4
|
+
aliceblue: number;
|
|
5
|
+
antiquewhite: number;
|
|
6
|
+
aqua: number;
|
|
7
|
+
aquamarine: number;
|
|
8
|
+
azure: number;
|
|
9
|
+
beige: number;
|
|
10
|
+
bisque: number;
|
|
11
|
+
black: number;
|
|
12
|
+
blanchedalmond: number;
|
|
13
|
+
blue: number;
|
|
14
|
+
blueviolet: number;
|
|
15
|
+
brown: number;
|
|
16
|
+
burlywood: number;
|
|
17
|
+
cadetblue: number;
|
|
18
|
+
chartreuse: number;
|
|
19
|
+
chocolate: number;
|
|
20
|
+
coral: number;
|
|
21
|
+
cornflowerblue: number;
|
|
22
|
+
cornsilk: number;
|
|
23
|
+
crimson: number;
|
|
24
|
+
cyan: number;
|
|
25
|
+
darkblue: number;
|
|
26
|
+
darkcyan: number;
|
|
27
|
+
darkgoldenrod: number;
|
|
28
|
+
darkgray: number;
|
|
29
|
+
darkgreen: number;
|
|
30
|
+
darkgrey: number;
|
|
31
|
+
darkkhaki: number;
|
|
32
|
+
darkmagenta: number;
|
|
33
|
+
darkolivegreen: number;
|
|
34
|
+
darkorange: number;
|
|
35
|
+
darkorchid: number;
|
|
36
|
+
darkred: number;
|
|
37
|
+
darksalmon: number;
|
|
38
|
+
darkseagreen: number;
|
|
39
|
+
darkslateblue: number;
|
|
40
|
+
darkslategray: number;
|
|
41
|
+
darkslategrey: number;
|
|
42
|
+
darkturquoise: number;
|
|
43
|
+
darkviolet: number;
|
|
44
|
+
deeppink: number;
|
|
45
|
+
deepskyblue: number;
|
|
46
|
+
dimgray: number;
|
|
47
|
+
dimgrey: number;
|
|
48
|
+
dodgerblue: number;
|
|
49
|
+
firebrick: number;
|
|
50
|
+
floralwhite: number;
|
|
51
|
+
forestgreen: number;
|
|
52
|
+
fuchsia: number;
|
|
53
|
+
gainsboro: number;
|
|
54
|
+
ghostwhite: number;
|
|
55
|
+
gold: number;
|
|
56
|
+
goldenrod: number;
|
|
57
|
+
gray: number;
|
|
58
|
+
green: number;
|
|
59
|
+
greenyellow: number;
|
|
60
|
+
grey: number;
|
|
61
|
+
honeydew: number;
|
|
62
|
+
hotpink: number;
|
|
63
|
+
indianred: number;
|
|
64
|
+
indigo: number;
|
|
65
|
+
ivory: number;
|
|
66
|
+
khaki: number;
|
|
67
|
+
lavender: number;
|
|
68
|
+
lavenderblush: number;
|
|
69
|
+
lawngreen: number;
|
|
70
|
+
lemonchiffon: number;
|
|
71
|
+
lightblue: number;
|
|
72
|
+
lightcoral: number;
|
|
73
|
+
lightcyan: number;
|
|
74
|
+
lightgoldenrodyellow: number;
|
|
75
|
+
lightgray: number;
|
|
76
|
+
lightgreen: number;
|
|
77
|
+
lightgrey: number;
|
|
78
|
+
lightpink: number;
|
|
79
|
+
lightsalmon: number;
|
|
80
|
+
lightseagreen: number;
|
|
81
|
+
lightskyblue: number;
|
|
82
|
+
lightslategray: number;
|
|
83
|
+
lightslategrey: number;
|
|
84
|
+
lightsteelblue: number;
|
|
85
|
+
lightyellow: number;
|
|
86
|
+
lime: number;
|
|
87
|
+
limegreen: number;
|
|
88
|
+
linen: number;
|
|
89
|
+
magenta: number;
|
|
90
|
+
maroon: number;
|
|
91
|
+
mediumaquamarine: number;
|
|
92
|
+
mediumblue: number;
|
|
93
|
+
mediumorchid: number;
|
|
94
|
+
mediumpurple: number;
|
|
95
|
+
mediumseagreen: number;
|
|
96
|
+
mediumslateblue: number;
|
|
97
|
+
mediumspringgreen: number;
|
|
98
|
+
mediumturquoise: number;
|
|
99
|
+
mediumvioletred: number;
|
|
100
|
+
midnightblue: number;
|
|
101
|
+
mintcream: number;
|
|
102
|
+
mistyrose: number;
|
|
103
|
+
moccasin: number;
|
|
104
|
+
navajowhite: number;
|
|
105
|
+
navy: number;
|
|
106
|
+
oldlace: number;
|
|
107
|
+
olive: number;
|
|
108
|
+
olivedrab: number;
|
|
109
|
+
orange: number;
|
|
110
|
+
orangered: number;
|
|
111
|
+
orchid: number;
|
|
112
|
+
palegoldenrod: number;
|
|
113
|
+
palegreen: number;
|
|
114
|
+
paleturquoise: number;
|
|
115
|
+
palevioletred: number;
|
|
116
|
+
papayawhip: number;
|
|
117
|
+
peachpuff: number;
|
|
118
|
+
peru: number;
|
|
119
|
+
pink: number;
|
|
120
|
+
plum: number;
|
|
121
|
+
powderblue: number;
|
|
122
|
+
purple: number;
|
|
123
|
+
rebeccapurple: number;
|
|
124
|
+
red: number;
|
|
125
|
+
rosybrown: number;
|
|
126
|
+
royalblue: number;
|
|
127
|
+
saddlebrown: number;
|
|
128
|
+
salmon: number;
|
|
129
|
+
sandybrown: number;
|
|
130
|
+
seagreen: number;
|
|
131
|
+
seashell: number;
|
|
132
|
+
sienna: number;
|
|
133
|
+
silver: number;
|
|
134
|
+
skyblue: number;
|
|
135
|
+
slateblue: number;
|
|
136
|
+
slategray: number;
|
|
137
|
+
slategrey: number;
|
|
138
|
+
snow: number;
|
|
139
|
+
springgreen: number;
|
|
140
|
+
steelblue: number;
|
|
141
|
+
tan: number;
|
|
142
|
+
teal: number;
|
|
143
|
+
thistle: number;
|
|
144
|
+
tomato: number;
|
|
145
|
+
turquoise: number;
|
|
146
|
+
violet: number;
|
|
147
|
+
wheat: number;
|
|
148
|
+
white: number;
|
|
149
|
+
whitesmoke: number;
|
|
150
|
+
yellow: number;
|
|
151
|
+
yellowgreen: number;
|
|
152
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { isNumber } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
export function colorStringToRGB(colorString) {
|
|
4
|
+
if (!colorString) return [ 0, 0, 0 ];
|
|
5
|
+
if (colorString.startsWith("#")) {
|
|
6
|
+
let hex = colorString.substring(1);
|
|
7
|
+
3 === hex.length && (hex = hex.replace(/(.)/g, "$1$1"));
|
|
8
|
+
return [ parseInt(hex.substring(0, 2), 16), parseInt(hex.substring(2, 4), 16), parseInt(hex.substring(4, 6), 16) ];
|
|
9
|
+
}
|
|
10
|
+
if (colorString.startsWith("rgb(")) {
|
|
11
|
+
return colorString.substring(4, colorString.length - 1).split(",").map(Number);
|
|
12
|
+
}
|
|
13
|
+
if (colorString.startsWith("rgba(")) {
|
|
14
|
+
return colorString.substring(5, colorString.length - 1).split(",").map(Number);
|
|
15
|
+
}
|
|
16
|
+
if (isNumber(DEFAULT_COLORS[colorString])) return rgb(DEFAULT_COLORS[colorString]);
|
|
17
|
+
if (isNumber(DEFAULT_COLORS_OPACITY[colorString])) return rgba(DEFAULT_COLORS_OPACITY[colorString]);
|
|
18
|
+
throw new Error("Unsupported color format");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function rgbaToHex(rgbaArray) {
|
|
22
|
+
if (3 === rgbaArray.length && rgbaArray.push(1), 4 !== rgbaArray.length) throw new Error("Invalid RGBA array");
|
|
23
|
+
const [r, g, b, a] = rgbaArray.map(Math.round);
|
|
24
|
+
return `${Math.round(255 * a).toString(16).padStart(2, "0")}${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function rgb(value) {
|
|
28
|
+
return [ value >> 16, value >> 8 & 255, 255 & value, 1 ];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function rgba(value) {
|
|
32
|
+
return [ value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value ];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const DEFAULT_COLORS_OPACITY = {
|
|
36
|
+
transparent: 4294967040
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const DEFAULT_COLORS = {
|
|
40
|
+
aliceblue: 15792383,
|
|
41
|
+
antiquewhite: 16444375,
|
|
42
|
+
aqua: 65535,
|
|
43
|
+
aquamarine: 8388564,
|
|
44
|
+
azure: 15794175,
|
|
45
|
+
beige: 16119260,
|
|
46
|
+
bisque: 16770244,
|
|
47
|
+
black: 0,
|
|
48
|
+
blanchedalmond: 16772045,
|
|
49
|
+
blue: 255,
|
|
50
|
+
blueviolet: 9055202,
|
|
51
|
+
brown: 10824234,
|
|
52
|
+
burlywood: 14596231,
|
|
53
|
+
cadetblue: 6266528,
|
|
54
|
+
chartreuse: 8388352,
|
|
55
|
+
chocolate: 13789470,
|
|
56
|
+
coral: 16744272,
|
|
57
|
+
cornflowerblue: 6591981,
|
|
58
|
+
cornsilk: 16775388,
|
|
59
|
+
crimson: 14423100,
|
|
60
|
+
cyan: 65535,
|
|
61
|
+
darkblue: 139,
|
|
62
|
+
darkcyan: 35723,
|
|
63
|
+
darkgoldenrod: 12092939,
|
|
64
|
+
darkgray: 11119017,
|
|
65
|
+
darkgreen: 25600,
|
|
66
|
+
darkgrey: 11119017,
|
|
67
|
+
darkkhaki: 12433259,
|
|
68
|
+
darkmagenta: 9109643,
|
|
69
|
+
darkolivegreen: 5597999,
|
|
70
|
+
darkorange: 16747520,
|
|
71
|
+
darkorchid: 10040012,
|
|
72
|
+
darkred: 9109504,
|
|
73
|
+
darksalmon: 15308410,
|
|
74
|
+
darkseagreen: 9419919,
|
|
75
|
+
darkslateblue: 4734347,
|
|
76
|
+
darkslategray: 3100495,
|
|
77
|
+
darkslategrey: 3100495,
|
|
78
|
+
darkturquoise: 52945,
|
|
79
|
+
darkviolet: 9699539,
|
|
80
|
+
deeppink: 16716947,
|
|
81
|
+
deepskyblue: 49151,
|
|
82
|
+
dimgray: 6908265,
|
|
83
|
+
dimgrey: 6908265,
|
|
84
|
+
dodgerblue: 2003199,
|
|
85
|
+
firebrick: 11674146,
|
|
86
|
+
floralwhite: 16775920,
|
|
87
|
+
forestgreen: 2263842,
|
|
88
|
+
fuchsia: 16711935,
|
|
89
|
+
gainsboro: 14474460,
|
|
90
|
+
ghostwhite: 16316671,
|
|
91
|
+
gold: 16766720,
|
|
92
|
+
goldenrod: 14329120,
|
|
93
|
+
gray: 8421504,
|
|
94
|
+
green: 32768,
|
|
95
|
+
greenyellow: 11403055,
|
|
96
|
+
grey: 8421504,
|
|
97
|
+
honeydew: 15794160,
|
|
98
|
+
hotpink: 16738740,
|
|
99
|
+
indianred: 13458524,
|
|
100
|
+
indigo: 4915330,
|
|
101
|
+
ivory: 16777200,
|
|
102
|
+
khaki: 15787660,
|
|
103
|
+
lavender: 15132410,
|
|
104
|
+
lavenderblush: 16773365,
|
|
105
|
+
lawngreen: 8190976,
|
|
106
|
+
lemonchiffon: 16775885,
|
|
107
|
+
lightblue: 11393254,
|
|
108
|
+
lightcoral: 15761536,
|
|
109
|
+
lightcyan: 14745599,
|
|
110
|
+
lightgoldenrodyellow: 16448210,
|
|
111
|
+
lightgray: 13882323,
|
|
112
|
+
lightgreen: 9498256,
|
|
113
|
+
lightgrey: 13882323,
|
|
114
|
+
lightpink: 16758465,
|
|
115
|
+
lightsalmon: 16752762,
|
|
116
|
+
lightseagreen: 2142890,
|
|
117
|
+
lightskyblue: 8900346,
|
|
118
|
+
lightslategray: 7833753,
|
|
119
|
+
lightslategrey: 7833753,
|
|
120
|
+
lightsteelblue: 11584734,
|
|
121
|
+
lightyellow: 16777184,
|
|
122
|
+
lime: 65280,
|
|
123
|
+
limegreen: 3329330,
|
|
124
|
+
linen: 16445670,
|
|
125
|
+
magenta: 16711935,
|
|
126
|
+
maroon: 8388608,
|
|
127
|
+
mediumaquamarine: 6737322,
|
|
128
|
+
mediumblue: 205,
|
|
129
|
+
mediumorchid: 12211667,
|
|
130
|
+
mediumpurple: 9662683,
|
|
131
|
+
mediumseagreen: 3978097,
|
|
132
|
+
mediumslateblue: 8087790,
|
|
133
|
+
mediumspringgreen: 64154,
|
|
134
|
+
mediumturquoise: 4772300,
|
|
135
|
+
mediumvioletred: 13047173,
|
|
136
|
+
midnightblue: 1644912,
|
|
137
|
+
mintcream: 16121850,
|
|
138
|
+
mistyrose: 16770273,
|
|
139
|
+
moccasin: 16770229,
|
|
140
|
+
navajowhite: 16768685,
|
|
141
|
+
navy: 128,
|
|
142
|
+
oldlace: 16643558,
|
|
143
|
+
olive: 8421376,
|
|
144
|
+
olivedrab: 7048739,
|
|
145
|
+
orange: 16753920,
|
|
146
|
+
orangered: 16729344,
|
|
147
|
+
orchid: 14315734,
|
|
148
|
+
palegoldenrod: 15657130,
|
|
149
|
+
palegreen: 10025880,
|
|
150
|
+
paleturquoise: 11529966,
|
|
151
|
+
palevioletred: 14381203,
|
|
152
|
+
papayawhip: 16773077,
|
|
153
|
+
peachpuff: 16767673,
|
|
154
|
+
peru: 13468991,
|
|
155
|
+
pink: 16761035,
|
|
156
|
+
plum: 14524637,
|
|
157
|
+
powderblue: 11591910,
|
|
158
|
+
purple: 8388736,
|
|
159
|
+
rebeccapurple: 6697881,
|
|
160
|
+
red: 16711680,
|
|
161
|
+
rosybrown: 12357519,
|
|
162
|
+
royalblue: 4286945,
|
|
163
|
+
saddlebrown: 9127187,
|
|
164
|
+
salmon: 16416882,
|
|
165
|
+
sandybrown: 16032864,
|
|
166
|
+
seagreen: 3050327,
|
|
167
|
+
seashell: 16774638,
|
|
168
|
+
sienna: 10506797,
|
|
169
|
+
silver: 12632256,
|
|
170
|
+
skyblue: 8900331,
|
|
171
|
+
slateblue: 6970061,
|
|
172
|
+
slategray: 7372944,
|
|
173
|
+
slategrey: 7372944,
|
|
174
|
+
snow: 16775930,
|
|
175
|
+
springgreen: 65407,
|
|
176
|
+
steelblue: 4620980,
|
|
177
|
+
tan: 13808780,
|
|
178
|
+
teal: 32896,
|
|
179
|
+
thistle: 14204888,
|
|
180
|
+
tomato: 16737095,
|
|
181
|
+
turquoise: 4251856,
|
|
182
|
+
violet: 15631086,
|
|
183
|
+
wheat: 16113331,
|
|
184
|
+
white: 16777215,
|
|
185
|
+
whitesmoke: 16119285,
|
|
186
|
+
yellow: 16776960,
|
|
187
|
+
yellowgreen: 10145074
|
|
188
|
+
};
|
|
189
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-export/util/color.ts"],"names":[],"mappings":"AAAA,O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AE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;IACrB,SAAS,EAAE,QAAQ;IACnB,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,QAAQ;IACnB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,QAAQ;CACtB,CAAC","file":"color.js","sourcesContent":["import { isNumber } from '@visactor/vutils';\n\nexport function colorStringToRGB(colorString: string) {\n if (!colorString) {\n return [0, 0, 0];\n }\n if (colorString.startsWith('#')) {\n // 处理十六进制颜色值(例如:#RRGGBB 或 #RGB)\n let hex = colorString.substring(1);\n\n // 处理缩写的十六进制颜色值(例如:#RGB)\n if (hex.length === 3) {\n hex = hex.replace(/(.)/g, '$1$1');\n }\n\n const r = parseInt(hex.substring(0, 2), 16);\n const g = parseInt(hex.substring(2, 4), 16);\n const b = parseInt(hex.substring(4, 6), 16);\n return [r, g, b];\n } else if (colorString.startsWith('rgb(')) {\n // 处理RGB颜色值(例如:rgb(R, G, B))\n const values = colorString\n .substring(4, colorString.length - 1)\n .split(',')\n .map(Number);\n return values;\n } else if (colorString.startsWith('rgba(')) {\n // 处理RGBA颜色值(例如:rgba(R, G, B, A))\n const values = colorString\n .substring(5, colorString.length - 1)\n .split(',')\n .map(Number);\n return values;\n } else if (isNumber(DEFAULT_COLORS[colorString])) {\n return rgb(DEFAULT_COLORS[colorString]);\n } else if (isNumber(DEFAULT_COLORS_OPACITY[colorString])) {\n return rgba(DEFAULT_COLORS_OPACITY[colorString]);\n }\n\n throw new Error('Unsupported color format');\n}\n\nexport function rgbaToHex(rgbaArray: number[]) {\n if (rgbaArray.length === 3) {\n rgbaArray.push(1);\n }\n\n if (rgbaArray.length !== 4) {\n throw new Error('Invalid RGBA array');\n }\n\n const [r, g, b, a] = rgbaArray.map(Math.round);\n const alphaHex = Math.round(a * 255)\n .toString(16)\n .padStart(2, '0');\n\n return `${alphaHex}${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b\n .toString(16)\n .padStart(2, '0')}`;\n}\n\nfunction rgb(value: number) {\n return [(value as number) >> 16, ((value as number) >> 8) & 0xff, (value as number) & 0xff, 1];\n}\n\nfunction rgba(value: number) {\n return [\n (value as number) >>> 24,\n ((value as number) >>> 16) & 0xff,\n ((value as number) >>> 8) & 0xff,\n (value as number) & 0xff\n ];\n}\n\nconst DEFAULT_COLORS_OPACITY = {\n transparent: 0xffffff00\n};\n\nexport const DEFAULT_COLORS = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2
|
+
return new (P || (P = Promise))((function(resolve, reject) {
|
|
3
|
+
function fulfilled(value) {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function rejected(value) {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function step(result) {
|
|
18
|
+
var value;
|
|
19
|
+
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P((function(resolve) {
|
|
20
|
+
resolve(value);
|
|
21
|
+
}))).then(fulfilled, rejected);
|
|
22
|
+
}
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
import { saveAs } from "file-saver";
|
|
28
|
+
|
|
29
|
+
export function downloadCsv(str, name) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, (function*() {
|
|
31
|
+
const blob = new Blob([ `\ufeff${str}` ], {
|
|
32
|
+
type: "text/csv;charset=utf-8"
|
|
33
|
+
});
|
|
34
|
+
yield saveAs(blob, `${name}.csv`);
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function downloadExcel(arrayBuffer, name) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, (function*() {
|
|
40
|
+
const blob = new Blob([ arrayBuffer ], {
|
|
41
|
+
type: "application/octet-stream"
|
|
42
|
+
});
|
|
43
|
+
yield saveAs(blob, `${name}.xlsx`);
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function workSheetStr2ArrayBuffer(workSheetStr) {
|
|
48
|
+
const buffer = new ArrayBuffer(workSheetStr.length), arrayBuffer = new Uint8Array(buffer);
|
|
49
|
+
for (let i = 0; i < workSheetStr.length; ++i) arrayBuffer[i] = 255 & workSheetStr.charCodeAt(i);
|
|
50
|
+
return buffer;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-export/util/download.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,UAAgB,WAAW,CAAC,GAAW,EAAE,IAAY;;QACzD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE;YACtC,IAAI,EAAE,wBAAwB;SAC/B,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,MAAM,CAAC,CAAC;IACpC,CAAC;CAAA;AAED,MAAM,UAAgB,aAAa,CAAC,WAAwB,EAAE,IAAY;;QAExE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,WAAW,CAAC,EAAE;YACnC,IAAI,EAAE,0BAA0B;SACjC,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;IACrC,CAAC;CAAA;AAED,SAAS,wBAAwB,CAAC,YAAoB;IACpD,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QAC5C,WAAW,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;KACpD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","file":"download.js","sourcesContent":["import { saveAs } from 'file-saver';\n\nexport async function downloadCsv(str: string, name: string) {\n const blob = new Blob([`\\ufeff${str}`], {\n type: 'text/csv;charset=utf-8'\n });\n\n await saveAs(blob, `${name}.csv`);\n}\n\nexport async function downloadExcel(arrayBuffer: ArrayBuffer, name: string) {\n // const arrayBuffer = workSheetStr2ArrayBuffer(workSheetStr);\n const blob = new Blob([arrayBuffer], {\n type: 'application/octet-stream'\n });\n\n await saveAs(blob, `${name}.xlsx`);\n}\n\nfunction workSheetStr2ArrayBuffer(workSheetStr: string) {\n const buffer = new ArrayBuffer(workSheetStr.length);\n const arrayBuffer = new Uint8Array(buffer);\n\n for (let i = 0; i < workSheetStr.length; ++i) {\n arrayBuffer[i] = workSheetStr.charCodeAt(i) & 0xff;\n }\n\n return buffer;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function encodeCellRange(cellRange) {
|
|
2
|
+
return `${encodeCellAddress(cellRange.start.col, cellRange.start.row)}:${encodeCellAddress(cellRange.end.col, cellRange.end.row)}`;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function encodeCellAddress(col, row) {
|
|
6
|
+
let s = "";
|
|
7
|
+
for (let column = col + 1; column > 0; column = Math.floor((column - 1) / 26)) s = String.fromCharCode((column - 1) % 26 + 65) + s;
|
|
8
|
+
return s + (row + 1);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=encode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-export/util/encode.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,eAAe,CAAC,SAAoB;IAClD,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1E,MAAM,GAAG,GAAG,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpE,OAAO,GAAG,KAAK,IAAI,GAAG,EAAE,CAAC;AAC3B,CAAC;AAQD,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,GAAW;IACxD,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAK,IAAI,MAAM,GAAG,GAAG,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE;QAC7E,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;KACvD;IACD,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AACvB,CAAC","file":"encode.js","sourcesContent":["import type { CellRange } from './type';\n\n/**\n * @description: comvert cell range to code\n * @param {CellRange} cellRange\n * @return {*}\n */\nexport function encodeCellRange(cellRange: CellRange) {\n const start = encodeCellAddress(cellRange.start.col, cellRange.start.row);\n const end = encodeCellAddress(cellRange.end.col, cellRange.end.row);\n return `${start}:${end}`;\n}\n\n/**\n * @description: convert cell address to code\n * @param {number} col\n * @param {number} row\n * @return {*}\n */\nexport function encodeCellAddress(col: number, row: number) {\n let s = '';\n for (let column = col + 1; column > 0; column = Math.floor((column - 1) / 26)) {\n s = String.fromCharCode(((column - 1) % 26) + 65) + s;\n }\n return s + (row + 1);\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isValid } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
export function getHierarchyOffset(col, row, table) {
|
|
4
|
+
var _a, _b, _c;
|
|
5
|
+
let cellHierarchyIndent = 0;
|
|
6
|
+
const layoutMap = table.internalProps.layoutMap;
|
|
7
|
+
if (layoutMap.isHeader(col, row)) {
|
|
8
|
+
const hd = layoutMap.getHeader(col, row);
|
|
9
|
+
isValid(null == hd ? void 0 : hd.hierarchyLevel) && (cellHierarchyIndent = (null !== (_a = hd.hierarchyLevel) && void 0 !== _a ? _a : 0) * (null !== (_b = layoutMap.rowHierarchyIndent) && void 0 !== _b ? _b : 0));
|
|
10
|
+
} else {
|
|
11
|
+
const define = table.getBodyColumnDefine(col, row);
|
|
12
|
+
if (null == define ? void 0 : define.tree) {
|
|
13
|
+
const indexArr = table.dataSource.getIndexKey(table.getRecordShowIndexByCell(col, row));
|
|
14
|
+
cellHierarchyIndent = Array.isArray(indexArr) && "none" !== table.getHierarchyState(col, row) ? (indexArr.length - 1) * (null !== (_c = layoutMap.hierarchyIndent) && void 0 !== _c ? _c : 0) : 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return cellHierarchyIndent;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=indent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-export/util/indent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,MAAM,UAAU,kBAAkB,CAAC,GAAW,EAAE,GAAW,EAAE,KAAc;;IAEzE,IAAI,mBAAmB,GAAG,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC;IAEhD,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE;QAChC,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAQ,CAAC;QAChD,IAAI,OAAO,CAAC,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,cAAc,CAAC,EAAE;YAC/B,mBAAmB,GAAG,CAAC,MAAA,EAAE,CAAC,cAAc,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAC,SAAiB,CAAC,kBAAkB,mCAAI,CAAC,CAAC,CAAC;SAC/F;KACF;SAAM;QAGL,MAAM,MAAM,GAAG,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACnD,IAAK,MAAuB,aAAvB,MAAM,uBAAN,MAAM,CAAmB,IAAI,EAAE;YAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,wBAAwB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACxF,mBAAmB;gBACjB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,MAAM;oBACrE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,MAAC,SAAiB,CAAC,eAAe,mCAAI,CAAC,CAAC;oBACnE,CAAC,CAAC,CAAC,CAAC;SACT;KACF;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC","file":"indent.js","sourcesContent":["import { isValid } from '@visactor/vutils';\nimport type { IVTable } from './type';\nimport type { ColumnDefine } from '@visactor/vtable';\n\nexport function getHierarchyOffset(col: number, row: number, table: IVTable): number {\n // 处理树形展开\n let cellHierarchyIndent = 0;\n const layoutMap = table.internalProps.layoutMap;\n //判断是否为表头\n if (layoutMap.isHeader(col, row)) {\n const hd = layoutMap.getHeader(col, row) as any;\n if (isValid(hd?.hierarchyLevel)) {\n cellHierarchyIndent = (hd.hierarchyLevel ?? 0) * ((layoutMap as any).rowHierarchyIndent ?? 0);\n }\n } else {\n // 基本表格表身body单元格 如果是树形展开 需要考虑缩进值\n // const cellHierarchyState = table.getHierarchyState(col, row);\n const define = table.getBodyColumnDefine(col, row);\n if ((define as ColumnDefine)?.tree) {\n const indexArr = table.dataSource.getIndexKey(table.getRecordShowIndexByCell(col, row));\n cellHierarchyIndent =\n Array.isArray(indexArr) && table.getHierarchyState(col, row) !== 'none'\n ? (indexArr.length - 1) * ((layoutMap as any).hierarchyIndent ?? 0)\n : 0;\n }\n }\n\n return cellHierarchyIndent;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { cloneDeep } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
export function handlePaginationExport(table, exportAllData) {
|
|
4
|
+
const pagination = cloneDeep(table.pagination), isPivot = table.isPivotTable(), layoutMap = table.internalProps.layoutMap;
|
|
5
|
+
let maxRow = table.rowCount - 1;
|
|
6
|
+
return {
|
|
7
|
+
reset: () => {
|
|
8
|
+
isPivot && exportAllData && pagination && (table.internalProps.layoutMap.setPagination(pagination),
|
|
9
|
+
table.refreshRowColCount());
|
|
10
|
+
},
|
|
11
|
+
handleRowCount: () => (exportAllData && pagination && (isPivot ? (table.internalProps.layoutMap.setPagination(void 0),
|
|
12
|
+
table.refreshRowColCount(), maxRow = table.rowCount - 1) : maxRow = table.recordsCount * layoutMap.bodyRowSpanCount + layoutMap.headerLevelCount),
|
|
13
|
+
maxRow)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-export/util/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,UAAU,sBAAsB,CAAC,KAAc,EAAE,aAAsB;IAC3E,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;IACrC,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC;IAChD,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;IAChC,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,IAAI,aAAa,EAAE;YACjB,IAAI,UAAU,EAAE;gBACd,IAAI,OAAO,EAAE;oBACV,KAAK,CAAC,aAAa,CAAC,SAAkC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;oBACjF,KAAK,CAAC,kBAAkB,EAAE,CAAC;oBAC3B,MAAM,GAAG,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;iBAC7B;qBAAM;oBACL,MAAM,GAAG,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC,gBAAgB,GAAG,SAAS,CAAC,gBAAgB,CAAC;iBACvF;aACF;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,GAAG,EAAE;QAEjB,IAAI,OAAO,IAAI,aAAa,IAAI,UAAU,EAAE;YACzC,KAAK,CAAC,aAAa,CAAC,SAAkC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAElF,KAAK,CAAC,kBAAkB,EAAE,CAAC;SAC5B;IACH,CAAC,CAAC;IACF,OAAO;QACL,KAAK;QACL,cAAc;KACf,CAAC;AACJ,CAAC","file":"pagination.js","sourcesContent":["import { cloneDeep } from '@visactor/vutils';\nimport type { IVTable } from './type';\nimport type { PivotHeaderLayoutMap } from '@visactor/vtable/src/layout/pivot-header-layout';\nexport function handlePaginationExport(table: IVTable, exportAllData: boolean) {\n const pagination = cloneDeep(table.pagination);\n const isPivot = table.isPivotTable();\n const layoutMap = table.internalProps.layoutMap;\n let maxRow = table.rowCount - 1;\n const handleRowCount = () => {\n if (exportAllData) {\n if (pagination) {\n if (isPivot) {\n (table.internalProps.layoutMap as PivotHeaderLayoutMap).setPagination(undefined);\n table.refreshRowColCount();\n maxRow = table.rowCount - 1;\n } else {\n maxRow = table.recordsCount * layoutMap.bodyRowSpanCount + layoutMap.headerLevelCount;\n }\n }\n }\n return maxRow;\n };\n\n const reset = () => {\n // 恢复透视表的pagination配置\n if (isPivot && exportAllData && pagination) {\n (table.internalProps.layoutMap as PivotHeaderLayoutMap).setPagination(pagination);\n // 刷新,恢复分页时的rowCount,保证在导出时是正确的rowCount\n table.refreshRowColCount();\n }\n };\n return {\n reset,\n handleRowCount\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPromise(obj: any): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-export/util/promise.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,GAAQ;IAChC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,UAAU,CAAC,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC;AAC3G,CAAC","file":"promise.js","sourcesContent":["export function isPromise(obj: any) {\n return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as VTable from '@visactor/vtable';
|
|
2
|
+
export type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart;
|
|
3
|
+
export type CellRange = VTable.TYPES.CellRange;
|
|
4
|
+
export type CellStyle = VTable.TYPES.CellStyle;
|
|
5
|
+
export type LineDashsDef = VTable.TYPES.LineDashsDef;
|
|
6
|
+
export type CellType = VTable.TYPES.ColumnTypeOption;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-export/util/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type * as VTable from '@visactor/vtable';\n\nexport type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart;\nexport type CellRange = VTable.TYPES.CellRange;\nexport type CellStyle = VTable.TYPES.CellStyle;\nexport type LineDashsDef = VTable.TYPES.LineDashsDef;\nexport type CellType = VTable.TYPES.ColumnTypeOption;\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as VTable from '@visactor/vtable';
|
|
2
|
+
import type { ExportVTableToCsvOptions, ExportVTableToExcelOptions } from './table-export/index';
|
|
3
|
+
export type TableExportPluginOptions = {
|
|
4
|
+
exportExcelOptions?: ExportVTableToExcelOptions;
|
|
5
|
+
exportCsvOptions?: ExportVTableToCsvOptions;
|
|
6
|
+
exportOnIdle?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare class TableExportPlugin implements VTable.plugins.IVTablePlugin {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
runTime: any[];
|
|
12
|
+
private table;
|
|
13
|
+
private pluginOptions;
|
|
14
|
+
constructor(pluginOptions: TableExportPluginOptions);
|
|
15
|
+
run(...args: any[]): void;
|
|
16
|
+
release(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2
|
+
return new (P || (P = Promise))((function(resolve, reject) {
|
|
3
|
+
function fulfilled(value) {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function rejected(value) {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function step(result) {
|
|
18
|
+
var value;
|
|
19
|
+
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P((function(resolve) {
|
|
20
|
+
resolve(value);
|
|
21
|
+
}))).then(fulfilled, rejected);
|
|
22
|
+
}
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
import * as VTable from "@visactor/vtable";
|
|
28
|
+
|
|
29
|
+
import { exportVTableToCsv, exportVTableToExcel, downloadCsv, downloadExcel } from "./table-export/index";
|
|
30
|
+
|
|
31
|
+
export class TableExportPlugin {
|
|
32
|
+
constructor(pluginOptions) {
|
|
33
|
+
this.id = "table-export-plugin", this.name = "TableExport", this.runTime = [ VTable.TABLE_EVENT_TYPE.INITIALIZED ],
|
|
34
|
+
this.pluginOptions = Object.assign({
|
|
35
|
+
exportOnIdle: !1,
|
|
36
|
+
exportExcelOptions: {
|
|
37
|
+
downloadFile: !0,
|
|
38
|
+
fileName: "export"
|
|
39
|
+
},
|
|
40
|
+
exportCsvOptions: {
|
|
41
|
+
downloadFile: !0,
|
|
42
|
+
fileName: "export"
|
|
43
|
+
}
|
|
44
|
+
}, pluginOptions);
|
|
45
|
+
}
|
|
46
|
+
run(...args) {
|
|
47
|
+
if (args[1] === VTable.TABLE_EVENT_TYPE.INITIALIZED) {
|
|
48
|
+
args[0];
|
|
49
|
+
this.table = args[2], this.table.exportToCsv = () => {
|
|
50
|
+
const options = this.pluginOptions.exportCsvOptions;
|
|
51
|
+
return options.downloadFile ? downloadCsv(exportVTableToCsv(this.table, options), options.fileName || "export") : exportVTableToCsv(this.table, options);
|
|
52
|
+
}, this.table.exportToExcel = () => __awaiter(this, void 0, void 0, (function*() {
|
|
53
|
+
const options = this.pluginOptions.exportExcelOptions;
|
|
54
|
+
return options.downloadFile ? yield downloadExcel(yield exportVTableToExcel(this.table, options, this.pluginOptions.exportOnIdle), options.fileName || "export") : exportVTableToExcel(this.table, options, this.pluginOptions.exportOnIdle);
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
release() {
|
|
59
|
+
this.table && (delete this.table.exportToCsv, delete this.table.exportToExcel, this.table = null);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=table-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-export.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAoB1G,MAAM,OAAO,iBAAiB;IAM5B,YAAY,aAAuC;QALnD,OAAE,GAAG,qBAAqB,CAAC;QAC3B,SAAI,GAAG,aAAa,CAAC;QACrB,YAAO,GAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAIrD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAChC;YACE,YAAY,EAAE,KAAK;YACnB,kBAAkB,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE;YAC9D,gBAAgB,EAAE,EAAE,YAAY,EAAE,I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AAI,IAAI,CAAC,KAAK,EAAE;YACd,OAAQ,IAAI,CAAC,KAAa,CAAC,WAAW,CAAC;YACvC,OAAQ,IAAI,CAAC,KAAa,CAAC,aAAa,CAAC;YACzC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;SACnB;IACH,CAAC;CACF","file":"table-export.js","sourcesContent":["import * as VTable from '@visactor/vtable';\nimport type { ExportVTableToCsvOptions, ExportVTableToExcelOptions } from './table-export/index';\nimport { exportVTableToCsv, exportVTableToExcel, downloadCsv, downloadExcel } from './table-export/index';\n\n// // 扩展ListTable接口以包含导出方法\n// declare module '@visactor/vtable' {\n// interface ListTableAll {\n// exportToCsv: (options?: any) => void;\n// exportToExcel: (options?: any) => void;\n// }\n// }\n\nexport type TableExportPluginOptions = {\n exportExcelOptions?: ExportVTableToExcelOptions;\n exportCsvOptions?: ExportVTableToCsvOptions;\n exportOnIdle?: boolean; //是否空闲时导出下载,默认false\n};\n\n/**\n * 表格导出插件\n * 提供CSV和Excel格式的表格数据导出功能\n */\nexport class TableExportPlugin implements VTable.plugins.IVTablePlugin {\n id = 'table-export-plugin';\n name = 'TableExport';\n runTime: any[] = [VTable.TABLE_EVENT_TYPE.INITIALIZED];\n private table: VTable.ListTable;\n private pluginOptions: TableExportPluginOptions;\n constructor(pluginOptions: TableExportPluginOptions) {\n this.pluginOptions = Object.assign(\n {\n exportOnIdle: false,\n exportExcelOptions: { downloadFile: true, fileName: 'export' },\n exportCsvOptions: { downloadFile: true, fileName: 'export' }\n },\n pluginOptions\n );\n }\n /**\n * 插件初始化方法\n * @param tableInstance - 表格实例\n */\n run(...args: any[]) {\n // const eventArgs = args[0];\n const runTime = args[1];\n if (runTime === VTable.TABLE_EVENT_TYPE.INITIALIZED) {\n const eventArgs = args[0];\n this.table = args[2];\n // 挂载导出方法到表格实例\n (this.table as any).exportToCsv = () => {\n const options = this.pluginOptions.exportCsvOptions;\n if (options.downloadFile) {\n return downloadCsv(exportVTableToCsv(this.table, options), options.fileName || 'export');\n }\n return exportVTableToCsv(this.table, options);\n };\n (this.table as any).exportToExcel = async () => {\n const options = this.pluginOptions.exportExcelOptions;\n if (options.downloadFile) {\n return await downloadExcel(\n (await exportVTableToExcel(this.table, options, this.pluginOptions.exportOnIdle)) as ArrayBuffer,\n options.fileName || 'export'\n );\n }\n return exportVTableToExcel(this.table, options, this.pluginOptions.exportOnIdle);\n };\n }\n }\n\n /**\n * 插件销毁方法\n * 清理挂载到表格实例的方法\n */\n release() {\n if (this.table) {\n delete (this.table as any).exportToCsv;\n delete (this.table as any).exportToExcel;\n this.table = null;\n }\n }\n}\n"]}
|
package/es/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { };
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
export { };
|
package/es/wps-fill-handle.js
CHANGED
|
@@ -65,4 +65,5 @@ export class WpsFillHandlePlugin {
|
|
|
65
65
|
|
|
66
66
|
function deleteSelectRange(selectCells, tableInstance) {
|
|
67
67
|
for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, "");
|
|
68
|
-
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=wps-fill-handle.js.map
|