@visactor/vtable-export 0.16.4-alpha.2
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 +97 -0
- package/cjs/csv/index.d.ts +4 -0
- package/cjs/csv/index.js +33 -0
- package/cjs/csv/index.js.map +1 -0
- package/cjs/excel/index.d.ts +3 -0
- package/cjs/excel/index.js +92 -0
- package/cjs/excel/index.js.map +1 -0
- package/cjs/excel/style.d.ts +6 -0
- package/cjs/excel/style.js +84 -0
- package/cjs/excel/style.js.map +1 -0
- package/cjs/index.d.ts +4 -0
- package/cjs/index.js +41 -0
- package/cjs/index.js.map +1 -0
- package/cjs/util/color.d.ts +152 -0
- package/cjs/util/color.js +193 -0
- package/cjs/util/color.js.map +1 -0
- package/cjs/util/download.d.ts +2 -0
- package/cjs/util/download.js +30 -0
- package/cjs/util/download.js.map +1 -0
- package/cjs/util/encode.d.ts +3 -0
- package/cjs/util/encode.js +17 -0
- package/cjs/util/encode.js.map +1 -0
- package/cjs/util/type.d.ts +6 -0
- package/cjs/util/type.js +6 -0
- package/cjs/util/type.js.map +1 -0
- package/dist/vtable-export.js +76258 -0
- package/dist/vtable-export.min.js +92 -0
- package/es/csv/index.d.ts +4 -0
- package/es/csv/index.js +25 -0
- package/es/csv/index.js.map +1 -0
- package/es/excel/index.d.ts +3 -0
- package/es/excel/index.js +82 -0
- package/es/excel/index.js.map +1 -0
- package/es/excel/style.d.ts +6 -0
- package/es/excel/style.js +75 -0
- package/es/excel/style.js.map +1 -0
- package/es/index.d.ts +4 -0
- package/es/index.js +7 -0
- package/es/index.js.map +1 -0
- package/es/util/color.d.ts +152 -0
- package/es/util/color.js +186 -0
- package/es/util/color.js.map +1 -0
- package/es/util/download.d.ts +2 -0
- package/es/util/download.js +22 -0
- package/es/util/download.js.map +1 -0
- package/es/util/encode.d.ts +3 -0
- package/es/util/encode.js +10 -0
- package/es/util/encode.js.map +1 -0
- package/es/util/type.d.ts +6 -0
- package/es/util/type.js +2 -0
- package/es/util/type.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function colorStringToRGB(colorString) {
|
|
4
|
+
if (colorString.startsWith("#")) {
|
|
5
|
+
let hex = colorString.substring(1);
|
|
6
|
+
3 === hex.length && (hex = hex.replace(/(.)/g, "$1$1"));
|
|
7
|
+
return [ parseInt(hex.substring(0, 2), 16), parseInt(hex.substring(2, 4), 16), parseInt(hex.substring(4, 6), 16) ];
|
|
8
|
+
}
|
|
9
|
+
if (colorString.startsWith("rgb(")) {
|
|
10
|
+
return colorString.substring(4, colorString.length - 1).split(",").map(Number);
|
|
11
|
+
}
|
|
12
|
+
if (colorString.startsWith("rgba(")) {
|
|
13
|
+
return colorString.substring(5, colorString.length - 1).split(",").map(Number);
|
|
14
|
+
}
|
|
15
|
+
if (exports.DEFAULT_COLORS[colorString]) return rgb(exports.DEFAULT_COLORS[colorString]);
|
|
16
|
+
if (DEFAULT_COLORS_OPACITY[colorString]) return rgba(DEFAULT_COLORS_OPACITY[colorString]);
|
|
17
|
+
throw new Error("Unsupported color format");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function rgbaToHex(rgbaArray) {
|
|
21
|
+
if (3 === rgbaArray.length && rgbaArray.push(1), 4 !== rgbaArray.length) throw new Error("Invalid RGBA array");
|
|
22
|
+
const [r, g, b, a] = rgbaArray.map(Math.round);
|
|
23
|
+
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")}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function rgb(value) {
|
|
27
|
+
return [ value >> 16, value >> 8 & 255, 255 & value, 1 ];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function rgba(value) {
|
|
31
|
+
return [ value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value ];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: !0
|
|
36
|
+
}), exports.DEFAULT_COLORS = exports.rgbaToHex = exports.colorStringToRGB = void 0,
|
|
37
|
+
exports.colorStringToRGB = colorStringToRGB, exports.rgbaToHex = rgbaToHex;
|
|
38
|
+
|
|
39
|
+
const DEFAULT_COLORS_OPACITY = {
|
|
40
|
+
transparent: 4294967040
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.DEFAULT_COLORS = {
|
|
44
|
+
aliceblue: 15792383,
|
|
45
|
+
antiquewhite: 16444375,
|
|
46
|
+
aqua: 65535,
|
|
47
|
+
aquamarine: 8388564,
|
|
48
|
+
azure: 15794175,
|
|
49
|
+
beige: 16119260,
|
|
50
|
+
bisque: 16770244,
|
|
51
|
+
black: 0,
|
|
52
|
+
blanchedalmond: 16772045,
|
|
53
|
+
blue: 255,
|
|
54
|
+
blueviolet: 9055202,
|
|
55
|
+
brown: 10824234,
|
|
56
|
+
burlywood: 14596231,
|
|
57
|
+
cadetblue: 6266528,
|
|
58
|
+
chartreuse: 8388352,
|
|
59
|
+
chocolate: 13789470,
|
|
60
|
+
coral: 16744272,
|
|
61
|
+
cornflowerblue: 6591981,
|
|
62
|
+
cornsilk: 16775388,
|
|
63
|
+
crimson: 14423100,
|
|
64
|
+
cyan: 65535,
|
|
65
|
+
darkblue: 139,
|
|
66
|
+
darkcyan: 35723,
|
|
67
|
+
darkgoldenrod: 12092939,
|
|
68
|
+
darkgray: 11119017,
|
|
69
|
+
darkgreen: 25600,
|
|
70
|
+
darkgrey: 11119017,
|
|
71
|
+
darkkhaki: 12433259,
|
|
72
|
+
darkmagenta: 9109643,
|
|
73
|
+
darkolivegreen: 5597999,
|
|
74
|
+
darkorange: 16747520,
|
|
75
|
+
darkorchid: 10040012,
|
|
76
|
+
darkred: 9109504,
|
|
77
|
+
darksalmon: 15308410,
|
|
78
|
+
darkseagreen: 9419919,
|
|
79
|
+
darkslateblue: 4734347,
|
|
80
|
+
darkslategray: 3100495,
|
|
81
|
+
darkslategrey: 3100495,
|
|
82
|
+
darkturquoise: 52945,
|
|
83
|
+
darkviolet: 9699539,
|
|
84
|
+
deeppink: 16716947,
|
|
85
|
+
deepskyblue: 49151,
|
|
86
|
+
dimgray: 6908265,
|
|
87
|
+
dimgrey: 6908265,
|
|
88
|
+
dodgerblue: 2003199,
|
|
89
|
+
firebrick: 11674146,
|
|
90
|
+
floralwhite: 16775920,
|
|
91
|
+
forestgreen: 2263842,
|
|
92
|
+
fuchsia: 16711935,
|
|
93
|
+
gainsboro: 14474460,
|
|
94
|
+
ghostwhite: 16316671,
|
|
95
|
+
gold: 16766720,
|
|
96
|
+
goldenrod: 14329120,
|
|
97
|
+
gray: 8421504,
|
|
98
|
+
green: 32768,
|
|
99
|
+
greenyellow: 11403055,
|
|
100
|
+
grey: 8421504,
|
|
101
|
+
honeydew: 15794160,
|
|
102
|
+
hotpink: 16738740,
|
|
103
|
+
indianred: 13458524,
|
|
104
|
+
indigo: 4915330,
|
|
105
|
+
ivory: 16777200,
|
|
106
|
+
khaki: 15787660,
|
|
107
|
+
lavender: 15132410,
|
|
108
|
+
lavenderblush: 16773365,
|
|
109
|
+
lawngreen: 8190976,
|
|
110
|
+
lemonchiffon: 16775885,
|
|
111
|
+
lightblue: 11393254,
|
|
112
|
+
lightcoral: 15761536,
|
|
113
|
+
lightcyan: 14745599,
|
|
114
|
+
lightgoldenrodyellow: 16448210,
|
|
115
|
+
lightgray: 13882323,
|
|
116
|
+
lightgreen: 9498256,
|
|
117
|
+
lightgrey: 13882323,
|
|
118
|
+
lightpink: 16758465,
|
|
119
|
+
lightsalmon: 16752762,
|
|
120
|
+
lightseagreen: 2142890,
|
|
121
|
+
lightskyblue: 8900346,
|
|
122
|
+
lightslategray: 7833753,
|
|
123
|
+
lightslategrey: 7833753,
|
|
124
|
+
lightsteelblue: 11584734,
|
|
125
|
+
lightyellow: 16777184,
|
|
126
|
+
lime: 65280,
|
|
127
|
+
limegreen: 3329330,
|
|
128
|
+
linen: 16445670,
|
|
129
|
+
magenta: 16711935,
|
|
130
|
+
maroon: 8388608,
|
|
131
|
+
mediumaquamarine: 6737322,
|
|
132
|
+
mediumblue: 205,
|
|
133
|
+
mediumorchid: 12211667,
|
|
134
|
+
mediumpurple: 9662683,
|
|
135
|
+
mediumseagreen: 3978097,
|
|
136
|
+
mediumslateblue: 8087790,
|
|
137
|
+
mediumspringgreen: 64154,
|
|
138
|
+
mediumturquoise: 4772300,
|
|
139
|
+
mediumvioletred: 13047173,
|
|
140
|
+
midnightblue: 1644912,
|
|
141
|
+
mintcream: 16121850,
|
|
142
|
+
mistyrose: 16770273,
|
|
143
|
+
moccasin: 16770229,
|
|
144
|
+
navajowhite: 16768685,
|
|
145
|
+
navy: 128,
|
|
146
|
+
oldlace: 16643558,
|
|
147
|
+
olive: 8421376,
|
|
148
|
+
olivedrab: 7048739,
|
|
149
|
+
orange: 16753920,
|
|
150
|
+
orangered: 16729344,
|
|
151
|
+
orchid: 14315734,
|
|
152
|
+
palegoldenrod: 15657130,
|
|
153
|
+
palegreen: 10025880,
|
|
154
|
+
paleturquoise: 11529966,
|
|
155
|
+
palevioletred: 14381203,
|
|
156
|
+
papayawhip: 16773077,
|
|
157
|
+
peachpuff: 16767673,
|
|
158
|
+
peru: 13468991,
|
|
159
|
+
pink: 16761035,
|
|
160
|
+
plum: 14524637,
|
|
161
|
+
powderblue: 11591910,
|
|
162
|
+
purple: 8388736,
|
|
163
|
+
rebeccapurple: 6697881,
|
|
164
|
+
red: 16711680,
|
|
165
|
+
rosybrown: 12357519,
|
|
166
|
+
royalblue: 4286945,
|
|
167
|
+
saddlebrown: 9127187,
|
|
168
|
+
salmon: 16416882,
|
|
169
|
+
sandybrown: 16032864,
|
|
170
|
+
seagreen: 3050327,
|
|
171
|
+
seashell: 16774638,
|
|
172
|
+
sienna: 10506797,
|
|
173
|
+
silver: 12632256,
|
|
174
|
+
skyblue: 8900331,
|
|
175
|
+
slateblue: 6970061,
|
|
176
|
+
slategray: 7372944,
|
|
177
|
+
slategrey: 7372944,
|
|
178
|
+
snow: 16775930,
|
|
179
|
+
springgreen: 65407,
|
|
180
|
+
steelblue: 4620980,
|
|
181
|
+
tan: 13808780,
|
|
182
|
+
teal: 32896,
|
|
183
|
+
thistle: 14204888,
|
|
184
|
+
tomato: 16737095,
|
|
185
|
+
turquoise: 4251856,
|
|
186
|
+
violet: 15631086,
|
|
187
|
+
wheat: 16113331,
|
|
188
|
+
white: 16777215,
|
|
189
|
+
whitesmoke: 16119285,
|
|
190
|
+
yellow: 16776960,
|
|
191
|
+
yellowgreen: 10145074
|
|
192
|
+
};
|
|
193
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["util/color.ts"],"names":[],"mappings":";;;AAAA,SAAgB,gBAAgB,CAAC,WAAmB;IAClD,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAE/B,IAAI,GAAG,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAGnC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YACpB,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SACnC;QAED,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KAClB;SAAM,IAAI,WAA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AQ;IACvB,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,QAAQ;IACvB,GAAG,EAAE,QAAQ;IACb,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,WAAW,EAAE,QAAQ;IACrB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,QAAQ;IACpB,QAAQ,EAAE,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":["export function colorStringToRGB(colorString: string) {\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 (DEFAULT_COLORS[colorString]) {\n return rgb(DEFAULT_COLORS[colorString]);\n } else if (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,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.downloadExcel = exports.downloadCsv = void 0;
|
|
6
|
+
|
|
7
|
+
const file_saver_1 = require("file-saver");
|
|
8
|
+
|
|
9
|
+
function downloadCsv(str, name) {
|
|
10
|
+
const blob = new Blob([ `\ufeff${str}` ], {
|
|
11
|
+
type: "text/csv;charset=utf-8"
|
|
12
|
+
});
|
|
13
|
+
(0, file_saver_1.saveAs)(blob, `${name}.csv`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function downloadExcel(arrayBuffer, name) {
|
|
17
|
+
const blob = new Blob([ arrayBuffer ], {
|
|
18
|
+
type: "application/octet-stream"
|
|
19
|
+
});
|
|
20
|
+
(0, file_saver_1.saveAs)(blob, `${name}.xlsx`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function workSheetStr2ArrayBuffer(workSheetStr) {
|
|
24
|
+
const buffer = new ArrayBuffer(workSheetStr.length), arrayBuffer = new Uint8Array(buffer);
|
|
25
|
+
for (let i = 0; i < workSheetStr.length; ++i) arrayBuffer[i] = 255 & workSheetStr.charCodeAt(i);
|
|
26
|
+
return buffer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=download.js.map
|
|
30
|
+
exports.downloadCsv = downloadCsv, exports.downloadExcel = downloadExcel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["util/download.ts"],"names":[],"mappings":";;;AAAA,2CAAoC;AAEpC,SAAgB,WAAW,CAAC,GAAW,EAAE,IAAY;IACnD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE;QACtC,IAAI,EAAE,wBAAwB;KAC/B,CAAC,CAAC;IAEH,IAAA,mBAAM,EAAC,IAAI,EAAE,GAAG,IAAI,MAAM,CAAC,CAAC;AAC9B,CAAC;AAND,kCAMC;AAED,SAAgB,aAAa,CAAC,WAAwB,EAAE,IAAY;IAElE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,WAAW,CAAC,EAAE;QACnC,IAAI,EAAE,0BAA0B;KACjC,CAAC,CAAC;IAEH,IAAA,mBAAM,EAAC,IAAI,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;AAC/B,CAAC;AAPD,sCAOC;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 function downloadCsv(str: string, name: string) {\n const blob = new Blob([`\\ufeff${str}`], {\n type: 'text/csv;charset=utf-8'\n });\n\n saveAs(blob, `${name}.csv`);\n}\n\nexport 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 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,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function encodeCellRange(cellRange) {
|
|
4
|
+
return `${encodeCellAddress(cellRange.start.col, cellRange.start.row)}:${encodeCellAddress(cellRange.end.col, cellRange.end.row)}`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function encodeCellAddress(col, row) {
|
|
8
|
+
let s = "";
|
|
9
|
+
for (let column = col + 1; column > 0; column = Math.floor((column - 1) / 26)) s = String.fromCharCode((column - 1) % 26 + 65) + s;
|
|
10
|
+
return s + (row + 1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, "__esModule", {
|
|
14
|
+
value: !0
|
|
15
|
+
}), exports.encodeCellAddress = exports.encodeCellRange = void 0, exports.encodeCellRange = encodeCellRange,
|
|
16
|
+
exports.encodeCellAddress = encodeCellAddress;
|
|
17
|
+
//# sourceMappingURL=encode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["util/encode.ts"],"names":[],"mappings":";;;AAOA,SAAgB,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;AAJD,0CAIC;AAQD,SAAgB,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;AAND,8CAMC","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,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;
|
package/cjs/util/type.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["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"]}
|