@visactor/vtable-plugins 1.19.5 → 1.19.7

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.
Files changed (85) hide show
  1. package/cjs/index.d.ts +1 -0
  2. package/cjs/index.js +2 -1
  3. package/cjs/index.js.map +1 -1
  4. package/cjs/table-export/csv/index.d.ts +12 -0
  5. package/cjs/table-export/csv/index.js +54 -0
  6. package/cjs/table-export/csv/index.js.map +1 -0
  7. package/cjs/table-export/excel/index.d.ts +21 -0
  8. package/cjs/table-export/excel/index.js +243 -0
  9. package/cjs/table-export/excel/index.js.map +1 -0
  10. package/cjs/table-export/excel/style.d.ts +6 -0
  11. package/cjs/table-export/excel/style.js +89 -0
  12. package/cjs/table-export/excel/style.js.map +1 -0
  13. package/cjs/table-export/index.d.ts +7 -0
  14. package/cjs/table-export/index.js +38 -0
  15. package/cjs/table-export/index.js.map +1 -0
  16. package/cjs/table-export/util/color.d.ts +152 -0
  17. package/cjs/table-export/util/color.js +197 -0
  18. package/cjs/table-export/util/color.js.map +1 -0
  19. package/cjs/table-export/util/download.d.ts +2 -0
  20. package/cjs/table-export/util/download.js +60 -0
  21. package/cjs/table-export/util/download.js.map +1 -0
  22. package/cjs/table-export/util/encode.d.ts +3 -0
  23. package/cjs/table-export/util/encode.js +17 -0
  24. package/cjs/table-export/util/encode.js.map +1 -0
  25. package/cjs/table-export/util/indent.d.ts +2 -0
  26. package/cjs/table-export/util/indent.js +27 -0
  27. package/cjs/table-export/util/indent.js.map +1 -0
  28. package/cjs/table-export/util/pagination.d.ts +5 -0
  29. package/cjs/table-export/util/pagination.js +24 -0
  30. package/cjs/table-export/util/pagination.js.map +1 -0
  31. package/cjs/table-export/util/promise.d.ts +1 -0
  32. package/cjs/table-export/util/promise.js +10 -0
  33. package/cjs/table-export/util/promise.js.map +1 -0
  34. package/cjs/table-export/util/type.d.ts +6 -0
  35. package/cjs/table-export/util/type.js +6 -0
  36. package/cjs/table-export/util/type.js.map +1 -0
  37. package/cjs/table-export.d.ts +17 -0
  38. package/cjs/table-export.js +93 -0
  39. package/cjs/table-export.js.map +1 -0
  40. package/cjs/types.js +1 -2
  41. package/cjs/wps-fill-handle.js +1 -0
  42. package/dist/vtable-plugins.js +1179 -185
  43. package/dist/vtable-plugins.min.js +14 -14
  44. package/es/index.d.ts +1 -0
  45. package/es/index.js +2 -0
  46. package/es/index.js.map +1 -1
  47. package/es/table-export/csv/index.d.ts +12 -0
  48. package/es/table-export/csv/index.js +47 -0
  49. package/es/table-export/csv/index.js.map +1 -0
  50. package/es/table-export/excel/index.d.ts +21 -0
  51. package/es/table-export/excel/index.js +242 -0
  52. package/es/table-export/excel/index.js.map +1 -0
  53. package/es/table-export/excel/style.d.ts +6 -0
  54. package/es/table-export/excel/style.js +80 -0
  55. package/es/table-export/excel/style.js.map +1 -0
  56. package/es/table-export/index.d.ts +7 -0
  57. package/es/table-export/index.js +8 -0
  58. package/es/table-export/index.js.map +1 -0
  59. package/es/table-export/util/color.d.ts +152 -0
  60. package/es/table-export/util/color.js +189 -0
  61. package/es/table-export/util/color.js.map +1 -0
  62. package/es/table-export/util/download.d.ts +2 -0
  63. package/es/table-export/util/download.js +52 -0
  64. package/es/table-export/util/download.js.map +1 -0
  65. package/es/table-export/util/encode.d.ts +3 -0
  66. package/es/table-export/util/encode.js +10 -0
  67. package/es/table-export/util/encode.js.map +1 -0
  68. package/es/table-export/util/indent.d.ts +2 -0
  69. package/es/table-export/util/indent.js +19 -0
  70. package/es/table-export/util/indent.js.map +1 -0
  71. package/es/table-export/util/pagination.d.ts +5 -0
  72. package/es/table-export/util/pagination.js +16 -0
  73. package/es/table-export/util/pagination.js.map +1 -0
  74. package/es/table-export/util/promise.d.ts +1 -0
  75. package/es/table-export/util/promise.js +4 -0
  76. package/es/table-export/util/promise.js.map +1 -0
  77. package/es/table-export/util/type.d.ts +6 -0
  78. package/es/table-export/util/type.js +2 -0
  79. package/es/table-export/util/type.js.map +1 -0
  80. package/es/table-export.d.ts +17 -0
  81. package/es/table-export.js +62 -0
  82. package/es/table-export.js.map +1 -0
  83. package/es/types.js +1 -2
  84. package/es/wps-fill-handle.js +2 -1
  85. 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,197 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.DEFAULT_COLORS = exports.rgbaToHex = exports.colorStringToRGB = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils");
8
+
9
+ function colorStringToRGB(colorString) {
10
+ if (!colorString) return [ 0, 0, 0 ];
11
+ if (colorString.startsWith("#")) {
12
+ let hex = colorString.substring(1);
13
+ 3 === hex.length && (hex = hex.replace(/(.)/g, "$1$1"));
14
+ return [ parseInt(hex.substring(0, 2), 16), parseInt(hex.substring(2, 4), 16), parseInt(hex.substring(4, 6), 16) ];
15
+ }
16
+ if (colorString.startsWith("rgb(")) {
17
+ return colorString.substring(4, colorString.length - 1).split(",").map(Number);
18
+ }
19
+ if (colorString.startsWith("rgba(")) {
20
+ return colorString.substring(5, colorString.length - 1).split(",").map(Number);
21
+ }
22
+ if ((0, vutils_1.isNumber)(exports.DEFAULT_COLORS[colorString])) return rgb(exports.DEFAULT_COLORS[colorString]);
23
+ if ((0, vutils_1.isNumber)(DEFAULT_COLORS_OPACITY[colorString])) return rgba(DEFAULT_COLORS_OPACITY[colorString]);
24
+ throw new Error("Unsupported color format");
25
+ }
26
+
27
+ function rgbaToHex(rgbaArray) {
28
+ if (3 === rgbaArray.length && rgbaArray.push(1), 4 !== rgbaArray.length) throw new Error("Invalid RGBA array");
29
+ const [r, g, b, a] = rgbaArray.map(Math.round);
30
+ 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")}`;
31
+ }
32
+
33
+ function rgb(value) {
34
+ return [ value >> 16, value >> 8 & 255, 255 & value, 1 ];
35
+ }
36
+
37
+ function rgba(value) {
38
+ return [ value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value ];
39
+ }
40
+
41
+ exports.colorStringToRGB = colorStringToRGB, exports.rgbaToHex = rgbaToHex;
42
+
43
+ const DEFAULT_COLORS_OPACITY = {
44
+ transparent: 4294967040
45
+ };
46
+
47
+ exports.DEFAULT_COLORS = {
48
+ aliceblue: 15792383,
49
+ antiquewhite: 16444375,
50
+ aqua: 65535,
51
+ aquamarine: 8388564,
52
+ azure: 15794175,
53
+ beige: 16119260,
54
+ bisque: 16770244,
55
+ black: 0,
56
+ blanchedalmond: 16772045,
57
+ blue: 255,
58
+ blueviolet: 9055202,
59
+ brown: 10824234,
60
+ burlywood: 14596231,
61
+ cadetblue: 6266528,
62
+ chartreuse: 8388352,
63
+ chocolate: 13789470,
64
+ coral: 16744272,
65
+ cornflowerblue: 6591981,
66
+ cornsilk: 16775388,
67
+ crimson: 14423100,
68
+ cyan: 65535,
69
+ darkblue: 139,
70
+ darkcyan: 35723,
71
+ darkgoldenrod: 12092939,
72
+ darkgray: 11119017,
73
+ darkgreen: 25600,
74
+ darkgrey: 11119017,
75
+ darkkhaki: 12433259,
76
+ darkmagenta: 9109643,
77
+ darkolivegreen: 5597999,
78
+ darkorange: 16747520,
79
+ darkorchid: 10040012,
80
+ darkred: 9109504,
81
+ darksalmon: 15308410,
82
+ darkseagreen: 9419919,
83
+ darkslateblue: 4734347,
84
+ darkslategray: 3100495,
85
+ darkslategrey: 3100495,
86
+ darkturquoise: 52945,
87
+ darkviolet: 9699539,
88
+ deeppink: 16716947,
89
+ deepskyblue: 49151,
90
+ dimgray: 6908265,
91
+ dimgrey: 6908265,
92
+ dodgerblue: 2003199,
93
+ firebrick: 11674146,
94
+ floralwhite: 16775920,
95
+ forestgreen: 2263842,
96
+ fuchsia: 16711935,
97
+ gainsboro: 14474460,
98
+ ghostwhite: 16316671,
99
+ gold: 16766720,
100
+ goldenrod: 14329120,
101
+ gray: 8421504,
102
+ green: 32768,
103
+ greenyellow: 11403055,
104
+ grey: 8421504,
105
+ honeydew: 15794160,
106
+ hotpink: 16738740,
107
+ indianred: 13458524,
108
+ indigo: 4915330,
109
+ ivory: 16777200,
110
+ khaki: 15787660,
111
+ lavender: 15132410,
112
+ lavenderblush: 16773365,
113
+ lawngreen: 8190976,
114
+ lemonchiffon: 16775885,
115
+ lightblue: 11393254,
116
+ lightcoral: 15761536,
117
+ lightcyan: 14745599,
118
+ lightgoldenrodyellow: 16448210,
119
+ lightgray: 13882323,
120
+ lightgreen: 9498256,
121
+ lightgrey: 13882323,
122
+ lightpink: 16758465,
123
+ lightsalmon: 16752762,
124
+ lightseagreen: 2142890,
125
+ lightskyblue: 8900346,
126
+ lightslategray: 7833753,
127
+ lightslategrey: 7833753,
128
+ lightsteelblue: 11584734,
129
+ lightyellow: 16777184,
130
+ lime: 65280,
131
+ limegreen: 3329330,
132
+ linen: 16445670,
133
+ magenta: 16711935,
134
+ maroon: 8388608,
135
+ mediumaquamarine: 6737322,
136
+ mediumblue: 205,
137
+ mediumorchid: 12211667,
138
+ mediumpurple: 9662683,
139
+ mediumseagreen: 3978097,
140
+ mediumslateblue: 8087790,
141
+ mediumspringgreen: 64154,
142
+ mediumturquoise: 4772300,
143
+ mediumvioletred: 13047173,
144
+ midnightblue: 1644912,
145
+ mintcream: 16121850,
146
+ mistyrose: 16770273,
147
+ moccasin: 16770229,
148
+ navajowhite: 16768685,
149
+ navy: 128,
150
+ oldlace: 16643558,
151
+ olive: 8421376,
152
+ olivedrab: 7048739,
153
+ orange: 16753920,
154
+ orangered: 16729344,
155
+ orchid: 14315734,
156
+ palegoldenrod: 15657130,
157
+ palegreen: 10025880,
158
+ paleturquoise: 11529966,
159
+ palevioletred: 14381203,
160
+ papayawhip: 16773077,
161
+ peachpuff: 16767673,
162
+ peru: 13468991,
163
+ pink: 16761035,
164
+ plum: 14524637,
165
+ powderblue: 11591910,
166
+ purple: 8388736,
167
+ rebeccapurple: 6697881,
168
+ red: 16711680,
169
+ rosybrown: 12357519,
170
+ royalblue: 4286945,
171
+ saddlebrown: 9127187,
172
+ salmon: 16416882,
173
+ sandybrown: 16032864,
174
+ seagreen: 3050327,
175
+ seashell: 16774638,
176
+ sienna: 10506797,
177
+ silver: 12632256,
178
+ skyblue: 8900331,
179
+ slateblue: 6970061,
180
+ slategray: 7372944,
181
+ slategrey: 7372944,
182
+ snow: 16775930,
183
+ springgreen: 65407,
184
+ steelblue: 4620980,
185
+ tan: 13808780,
186
+ teal: 32896,
187
+ thistle: 14204888,
188
+ tomato: 16737095,
189
+ turquoise: 4251856,
190
+ violet: 15631086,
191
+ wheat: 16113331,
192
+ white: 16777215,
193
+ whitesmoke: 16119285,
194
+ yellow: 16776960,
195
+ yellowgreen: 10145074
196
+ };
197
+ //# sourceMappingURL=color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["table-export/util/color.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAE5C,SAAgB,gBAAgB,CAAC,WAAmB;IAClD,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KAClB;IACD,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,WAAW,CAAC,UAAU,CAAC,MAA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QAAQ;IACvB,aAAa,EAAE,QAAQ;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":["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,2 @@
1
+ export declare function downloadCsv(str: string, name: string): Promise<void>;
2
+ export declare function downloadExcel(arrayBuffer: ArrayBuffer, name: string): Promise<void>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
4
+ return new (P || (P = Promise))((function(resolve, reject) {
5
+ function fulfilled(value) {
6
+ try {
7
+ step(generator.next(value));
8
+ } catch (e) {
9
+ reject(e);
10
+ }
11
+ }
12
+ function rejected(value) {
13
+ try {
14
+ step(generator.throw(value));
15
+ } catch (e) {
16
+ reject(e);
17
+ }
18
+ }
19
+ function step(result) {
20
+ var value;
21
+ result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P((function(resolve) {
22
+ resolve(value);
23
+ }))).then(fulfilled, rejected);
24
+ }
25
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
26
+ }));
27
+ };
28
+
29
+ Object.defineProperty(exports, "__esModule", {
30
+ value: !0
31
+ }), exports.downloadExcel = exports.downloadCsv = void 0;
32
+
33
+ const file_saver_1 = require("file-saver");
34
+
35
+ function downloadCsv(str, name) {
36
+ return __awaiter(this, void 0, void 0, (function*() {
37
+ const blob = new Blob([ `\ufeff${str}` ], {
38
+ type: "text/csv;charset=utf-8"
39
+ });
40
+ yield (0, file_saver_1.saveAs)(blob, `${name}.csv`);
41
+ }));
42
+ }
43
+
44
+ function downloadExcel(arrayBuffer, name) {
45
+ return __awaiter(this, void 0, void 0, (function*() {
46
+ const blob = new Blob([ arrayBuffer ], {
47
+ type: "application/octet-stream"
48
+ });
49
+ yield (0, file_saver_1.saveAs)(blob, `${name}.xlsx`);
50
+ }));
51
+ }
52
+
53
+ function workSheetStr2ArrayBuffer(workSheetStr) {
54
+ const buffer = new ArrayBuffer(workSheetStr.length), arrayBuffer = new Uint8Array(buffer);
55
+ for (let i = 0; i < workSheetStr.length; ++i) arrayBuffer[i] = 255 & workSheetStr.charCodeAt(i);
56
+ return buffer;
57
+ }
58
+
59
+ //# sourceMappingURL=download.js.map
60
+ exports.downloadCsv = downloadCsv, exports.downloadExcel = downloadExcel;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["table-export/util/download.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAoC;AAEpC,SAAsB,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,IAAA,mBAAM,EAAC,IAAI,EAAE,GAAG,IAAI,MAAM,CAAC,CAAC;IACpC,CAAC;CAAA;AAND,kCAMC;AAED,SAAsB,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,IAAA,mBAAM,EAAC,IAAI,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;IACrC,CAAC;CAAA;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 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,3 @@
1
+ import type { CellRange } from './type';
2
+ export declare function encodeCellRange(cellRange: CellRange): string;
3
+ export declare function encodeCellAddress(col: number, row: number): string;
@@ -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":["table-export/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,2 @@
1
+ import type { IVTable } from './type';
2
+ export declare function getHierarchyOffset(col: number, row: number, table: IVTable): number;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.getHierarchyOffset = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils");
8
+
9
+ function getHierarchyOffset(col, row, table) {
10
+ var _a, _b, _c;
11
+ let cellHierarchyIndent = 0;
12
+ const layoutMap = table.internalProps.layoutMap;
13
+ if (layoutMap.isHeader(col, row)) {
14
+ const hd = layoutMap.getHeader(col, row);
15
+ (0, vutils_1.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));
16
+ } else {
17
+ const define = table.getBodyColumnDefine(col, row);
18
+ if (null == define ? void 0 : define.tree) {
19
+ const indexArr = table.dataSource.getIndexKey(table.getRecordShowIndexByCell(col, row));
20
+ cellHierarchyIndent = Array.isArray(indexArr) && "none" !== table.getHierarchyState(col, row) ? (indexArr.length - 1) * (null !== (_c = layoutMap.hierarchyIndent) && void 0 !== _c ? _c : 0) : 0;
21
+ }
22
+ }
23
+ return cellHierarchyIndent;
24
+ }
25
+
26
+ exports.getHierarchyOffset = getHierarchyOffset;
27
+ //# sourceMappingURL=indent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["table-export/util/indent.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAI3C,SAAgB,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,IAAA,gBAAO,EAAC,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;AAxBD,gDAwBC","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,5 @@
1
+ import type { IVTable } from './type';
2
+ export declare function handlePaginationExport(table: IVTable, exportAllData: boolean): {
3
+ reset: () => void;
4
+ handleRowCount: () => number;
5
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.handlePaginationExport = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils");
8
+
9
+ function handlePaginationExport(table, exportAllData) {
10
+ const pagination = (0, vutils_1.cloneDeep)(table.pagination), isPivot = table.isPivotTable(), layoutMap = table.internalProps.layoutMap;
11
+ let maxRow = table.rowCount - 1;
12
+ return {
13
+ reset: () => {
14
+ isPivot && exportAllData && pagination && (table.internalProps.layoutMap.setPagination(pagination),
15
+ table.refreshRowColCount());
16
+ },
17
+ handleRowCount: () => (exportAllData && pagination && (isPivot ? (table.internalProps.layoutMap.setPagination(void 0),
18
+ table.refreshRowColCount(), maxRow = table.rowCount - 1) : maxRow = table.recordsCount * layoutMap.bodyRowSpanCount + layoutMap.headerLevelCount),
19
+ maxRow)
20
+ };
21
+ }
22
+
23
+ exports.handlePaginationExport = handlePaginationExport;
24
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["table-export/util/pagination.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAG7C,SAAgB,sBAAsB,CAAC,KAAc,EAAE,aAAsB;IAC3E,MAAM,UAAU,GAAG,IAAA,kBAAS,EAAC,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;AAhCD,wDAgCC","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,10 @@
1
+ "use strict";
2
+
3
+ function isPromise(obj) {
4
+ return !!obj && ("object" == typeof obj || "function" == typeof obj) && "function" == typeof obj.then;
5
+ }
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: !0
9
+ }), exports.isPromise = void 0, exports.isPromise = isPromise;
10
+ //# sourceMappingURL=promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["table-export/util/promise.ts"],"names":[],"mappings":";;;AAAA,SAAgB,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;AAFD,8BAEC","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,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ });
6
+ //# sourceMappingURL=type.js.map
@@ -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
+ }