1 | import { VXEComponent } from '../component'
|
2 | import { VxeTablePropTypes, VxeTableConstructor, VxeTableDataRow } from '../table'
|
3 | import { VxeGridConstructor } from '../grid'
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export const VxeTableExportModule: VXEComponent<{ [key: string]: any }>
|
11 |
|
12 |
|
13 |
|
14 | export const Export: VXEComponent<{ [key: string]: any }>
|
15 |
|
16 | export interface TableExportMethods<D = VxeTableDataRow> {
|
17 | |
18 |
|
19 |
|
20 |
|
21 | openExport(options?: VxeTablePropTypes.ExportConfig): void
|
22 | |
23 |
|
24 |
|
25 |
|
26 | exportData(options?: VxeTablePropTypes.ExportConfig): Promise<any>
|
27 | |
28 |
|
29 |
|
30 |
|
31 | openImport(options?: VxeTablePropTypes.ImportConfig): void
|
32 | |
33 |
|
34 |
|
35 |
|
36 | importData(options?: VxeTablePropTypes.ImportConfig): Promise<any>
|
37 | |
38 |
|
39 |
|
40 |
|
41 |
|
42 | importByFile(file: File, options: VxeTablePropTypes.ImportConfig): Promise<any>
|
43 | |
44 |
|
45 |
|
46 |
|
47 | saveFile: SaveFileFunction
|
48 | |
49 |
|
50 |
|
51 |
|
52 | readFile: ReadFileFunction
|
53 | |
54 |
|
55 |
|
56 |
|
57 | print: PrintFunction
|
58 | |
59 |
|
60 |
|
61 |
|
62 | openPrint(options?: VxeTablePropTypes.PrintConfig): void
|
63 | }
|
64 |
|
65 | export interface TableExportPrivateMethods<D = VxeTableDataRow> { }
|
66 |
|
67 | declare module '../grid' {
|
68 | export interface VxeGridMethods<D = VxeTableDataRow> extends TableExportMethods<D> { }
|
69 | }
|
70 |
|
71 | declare module '../table' {
|
72 | export interface VxeTableMethods<D = VxeTableDataRow> extends TableExportMethods<D> { }
|
73 | export interface VxeTablePrivateMethods<D = VxeTableDataRow> extends TableExportPrivateMethods<D> { }
|
74 | export namespace VxeTableDefines {
|
75 | export interface ExtortSheetMethodParams {
|
76 | $table: VxeTableConstructor
|
77 | $grid?: VxeGridConstructor
|
78 | options: VxeTablePropTypes.ExportHandleOptions
|
79 | datas: any[]
|
80 | columns: VxeTableDefines.ColumnInfo[]
|
81 | colgroups: VxeTableDefines.ColumnInfo[][]
|
82 | }
|
83 | }
|
84 | export namespace VxeTablePropTypes {
|
85 | |
86 |
|
87 |
|
88 | export interface ImportConfig {
|
89 |
|
90 | _typeMaps?: Record<string, number>
|
91 |
|
92 | |
93 |
|
94 |
|
95 | types?: string[]
|
96 | |
97 |
|
98 |
|
99 | mode?: string
|
100 | modes?: string[]
|
101 | |
102 |
|
103 |
|
104 | message?: boolean
|
105 | |
106 |
|
107 |
|
108 | remote?: boolean
|
109 | encoding?: string
|
110 | |
111 |
|
112 |
|
113 | importMethod?(params: {
|
114 | $table: VxeTableConstructor
|
115 | $grid: VxeGridConstructor
|
116 | file: File
|
117 | options: ImportHandleOptions
|
118 | }): Promise<any>
|
119 | beforeImportMethod?(params: {
|
120 | $table: VxeTableConstructor
|
121 | options: any
|
122 | }): void
|
123 | afterImportMethod?(params: {
|
124 | $table: VxeTableConstructor
|
125 | options: any
|
126 | status: boolean
|
127 | }): void
|
128 | }
|
129 | export interface ImportOpts extends ImportConfig {
|
130 | modes: string[]
|
131 | }
|
132 | export interface ImportHandleOptions extends ImportConfig {
|
133 | data: any[]
|
134 | columns: VxeTableDefines.ColumnInfo[]
|
135 | colgroups: VxeTableDefines.ColumnInfo[][]
|
136 | }
|
137 |
|
138 | export interface ExportOrPrintColumnOption {
|
139 | colid?: number
|
140 | type?: string
|
141 | field?: string
|
142 | }
|
143 |
|
144 | |
145 |
|
146 |
|
147 | export interface ExportConfig {
|
148 |
|
149 | _typeMaps?: Record<string, number>
|
150 |
|
151 | |
152 |
|
153 |
|
154 | filename?: string
|
155 | |
156 |
|
157 |
|
158 | sheetName?: string
|
159 | |
160 |
|
161 |
|
162 | type?: string
|
163 | |
164 |
|
165 |
|
166 | types?: string[]
|
167 | |
168 |
|
169 |
|
170 | mode?: string
|
171 | |
172 |
|
173 |
|
174 | modes?: string[]
|
175 | |
176 |
|
177 |
|
178 | original?: boolean
|
179 | |
180 |
|
181 |
|
182 | message?: boolean
|
183 | |
184 |
|
185 |
|
186 | isHeader?: boolean
|
187 | |
188 |
|
189 |
|
190 | isFooter?: boolean
|
191 | isMerge?: boolean
|
192 | isColgroup?: boolean
|
193 | |
194 |
|
195 |
|
196 | download?: boolean
|
197 | |
198 |
|
199 |
|
200 | data?: any[]
|
201 | |
202 |
|
203 |
|
204 | columns?: VxeTableDefines.ColumnInfo[] | ExportOrPrintColumnOption[]
|
205 | |
206 |
|
207 |
|
208 | columnFilterMethod?(params: { column: VxeTableDefines.ColumnInfo, $columnIndex: number }): boolean
|
209 | |
210 |
|
211 |
|
212 | dataFilterMethod?(params: { row: any, $rowIndex: number }): boolean
|
213 | |
214 |
|
215 |
|
216 | footerFilterMethod?(params: { items: any[], $rowIndex: number }): boolean
|
217 | |
218 |
|
219 |
|
220 | remote?: boolean
|
221 | |
222 |
|
223 |
|
224 | useStyle?: boolean
|
225 | sheetMethod?(params: VxeTableDefines.ExtortSheetMethodParams): void
|
226 | |
227 |
|
228 |
|
229 | exportMethod?(params: {
|
230 | $table: VxeTableConstructor
|
231 | $grid?: VxeGridConstructor
|
232 | options: ExportHandleOptions
|
233 | }): Promise<any>
|
234 | beforeExportMethod?(params: {
|
235 | options: ExportHandleOptions
|
236 | }): void
|
237 | afterExportMethod?(params: {
|
238 | options: ExportHandleOptions
|
239 | }): void
|
240 | }
|
241 | export interface ExportOpts extends ExportConfig { }
|
242 | export interface ExportHandleOptions extends ExportConfig {
|
243 | data: any[]
|
244 | columns: VxeTableDefines.ColumnInfo[]
|
245 | colgroups: VxeTableDefines.ColumnInfo[][]
|
246 | }
|
247 |
|
248 | |
249 |
|
250 |
|
251 | export interface PrintConfig {
|
252 | |
253 |
|
254 |
|
255 | sheetName?: string
|
256 | |
257 |
|
258 |
|
259 | mode?: string
|
260 | |
261 |
|
262 |
|
263 | modes?: string[]
|
264 | |
265 |
|
266 |
|
267 | original?: boolean
|
268 | |
269 |
|
270 |
|
271 | isHeader?: boolean
|
272 | |
273 |
|
274 |
|
275 | isFooter?: boolean
|
276 | |
277 |
|
278 |
|
279 | data?: any[]
|
280 | |
281 |
|
282 |
|
283 | columns?: VxeTableDefines.ColumnInfo[] | ExportOrPrintColumnOption[]
|
284 | |
285 |
|
286 |
|
287 | style?: string
|
288 | |
289 |
|
290 |
|
291 | content?: string
|
292 | |
293 |
|
294 |
|
295 | columnFilterMethod?(params: { column: VxeTableDefines.ColumnInfo, $columnIndex: number }): boolean
|
296 | |
297 |
|
298 |
|
299 | dataFilterMethod?(params: { row: any, $rowIndex: number }): boolean
|
300 | |
301 |
|
302 |
|
303 | footerFilterMethod?(params: { items: any[], $rowIndex: number }): boolean
|
304 | |
305 |
|
306 |
|
307 | beforePrintMethod?(params: {
|
308 | $table: VxeTableConstructor | null
|
309 | content: string
|
310 | options: PrintHandleOptions
|
311 | }): string
|
312 | }
|
313 | export interface PrintOpts extends PrintConfig { }
|
314 | export interface PrintHandleOptions extends PrintConfig { }
|
315 | }
|
316 | }
|
317 |
|
318 | export type SaveFileFunction = (options: {
|
319 | filename: string
|
320 | type: string
|
321 | content: string | Blob
|
322 | }) => Promise<any>
|
323 |
|
324 | export type ReadFileFunction = (options?: {
|
325 | multiple?: boolean
|
326 | types?: string[]
|
327 | message?: boolean
|
328 | }) => Promise<{
|
329 | status: boolean
|
330 | files: FileList
|
331 | file: File
|
332 | }>
|
333 |
|
334 | export type PrintFunction = (options?: VxeTablePropTypes.PrintConfig) => any
|