vxe-table 3.19.39 → 3.20.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.esm.js +2 -1
  3. package/es/index.min.css +1 -1
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/table/module/custom/mixin.js +6 -4
  7. package/es/table/module/custom/panel.js +806 -799
  8. package/es/table/module/edit/mixin.js +43 -31
  9. package/es/table/module/export/export-panel.js +511 -458
  10. package/es/table/module/export/import-panel.js +224 -192
  11. package/es/table/module/keyboard/mixin.js +2 -2
  12. package/es/table/module/menu/panel.js +165 -161
  13. package/es/table/module/validator/mixin.js +255 -236
  14. package/es/table/src/body.js +2 -1
  15. package/es/table/src/cell.js +2 -2
  16. package/es/table/src/methods.js +33 -43
  17. package/es/table/src/table.js +13 -249
  18. package/es/table/src/util.js +242 -0
  19. package/es/table/style.css +23 -50
  20. package/es/table/style.min.css +1 -1
  21. package/es/ui/index.js +2 -2
  22. package/es/ui/src/dom.js +22 -0
  23. package/es/ui/src/log.js +1 -1
  24. package/es/vxe-table/style.css +23 -50
  25. package/es/vxe-table/style.min.css +1 -1
  26. package/lib/index.common.js +2 -1
  27. package/lib/index.css +1 -1
  28. package/lib/index.min.css +1 -1
  29. package/lib/index.umd.js +3640 -4790
  30. package/lib/index.umd.min.js +1 -1
  31. package/lib/style.css +1 -1
  32. package/lib/style.min.css +1 -1
  33. package/lib/table/module/custom/mixin.js +6 -4
  34. package/lib/table/module/custom/mixin.min.js +1 -1
  35. package/lib/table/module/custom/panel.js +693 -685
  36. package/lib/table/module/custom/panel.min.js +1 -1
  37. package/lib/table/module/edit/mixin.js +47 -31
  38. package/lib/table/module/edit/mixin.min.js +1 -1
  39. package/lib/table/module/export/export-panel.js +450 -384
  40. package/lib/table/module/export/export-panel.min.js +1 -1
  41. package/lib/table/module/export/import-panel.js +200 -159
  42. package/lib/table/module/export/import-panel.min.js +1 -1
  43. package/lib/table/module/keyboard/mixin.js +2 -2
  44. package/lib/table/module/keyboard/mixin.min.js +1 -1
  45. package/lib/table/module/menu/panel.js +119 -114
  46. package/lib/table/module/menu/panel.min.js +1 -1
  47. package/lib/table/module/validator/mixin.js +271 -259
  48. package/lib/table/module/validator/mixin.min.js +1 -1
  49. package/lib/table/src/body.js +2 -1
  50. package/lib/table/src/body.min.js +1 -1
  51. package/lib/table/src/cell.js +2 -2
  52. package/lib/table/src/cell.min.js +1 -1
  53. package/lib/table/src/methods.js +33 -45
  54. package/lib/table/src/methods.min.js +1 -1
  55. package/lib/table/src/table.js +12 -248
  56. package/lib/table/src/table.min.js +1 -1
  57. package/lib/table/src/util.js +243 -0
  58. package/lib/table/src/util.min.js +1 -1
  59. package/lib/table/style/style.css +23 -50
  60. package/lib/table/style/style.min.css +1 -1
  61. package/lib/ui/index.js +2 -2
  62. package/lib/ui/index.min.js +1 -1
  63. package/lib/ui/src/dom.js +22 -0
  64. package/lib/ui/src/dom.min.js +1 -1
  65. package/lib/ui/src/log.js +1 -1
  66. package/lib/ui/src/log.min.js +1 -1
  67. package/lib/v-x-e-table/index.js +2 -1
  68. package/lib/v-x-e-table/index.min.js +1 -1
  69. package/lib/vxe-colgroup/index.js +2 -1
  70. package/lib/vxe-colgroup/index.min.js +1 -1
  71. package/lib/vxe-column/index.js +2 -1
  72. package/lib/vxe-column/index.min.js +1 -1
  73. package/lib/vxe-grid/index.js +2 -1
  74. package/lib/vxe-grid/index.min.js +1 -1
  75. package/lib/vxe-table/index.js +2 -1
  76. package/lib/vxe-table/index.min.js +1 -1
  77. package/lib/vxe-table/style/style.css +23 -50
  78. package/lib/vxe-table/style/style.min.css +1 -1
  79. package/lib/vxe-toolbar/index.js +2 -1
  80. package/lib/vxe-toolbar/index.min.js +1 -1
  81. package/lib/vxe-ui/index.js +2 -1
  82. package/lib/vxe-ui/index.min.js +1 -1
  83. package/lib/vxe-v-x-e-table/index.js +2 -1
  84. package/lib/vxe-v-x-e-table/index.min.js +1 -1
  85. package/package.json +1 -1
  86. package/packages/table/module/custom/mixin.ts +7 -4
  87. package/packages/table/module/custom/panel.ts +846 -839
  88. package/packages/table/module/edit/mixin.ts +55 -35
  89. package/packages/table/module/export/export-panel.ts +545 -469
  90. package/packages/table/module/export/import-panel.ts +245 -202
  91. package/packages/table/module/filter/panel.ts +4 -18
  92. package/packages/table/module/keyboard/mixin.ts +2 -2
  93. package/packages/table/module/menu/panel.ts +171 -163
  94. package/packages/table/module/validator/mixin.ts +279 -240
  95. package/packages/table/src/body.ts +2 -1
  96. package/packages/table/src/cell.ts +2 -2
  97. package/packages/table/src/methods.ts +43 -45
  98. package/packages/table/src/table.ts +14 -260
  99. package/packages/table/src/util.ts +254 -0
  100. package/packages/ui/index.ts +1 -1
  101. package/packages/ui/src/dom.ts +22 -0
  102. package/styles/components/table.scss +5 -2
  103. package/styles/theme/base.scss +2 -1
  104. /package/es/{iconfont.1767145426781.ttf → iconfont.1767492234857.ttf} +0 -0
  105. /package/es/{iconfont.1767145426781.woff → iconfont.1767492234857.woff} +0 -0
  106. /package/es/{iconfont.1767145426781.woff2 → iconfont.1767492234857.woff2} +0 -0
  107. /package/lib/{iconfont.1767145426781.ttf → iconfont.1767492234857.ttf} +0 -0
  108. /package/lib/{iconfont.1767145426781.woff → iconfont.1767492234857.woff} +0 -0
  109. /package/lib/{iconfont.1767145426781.woff2 → iconfont.1767492234857.woff2} +0 -0
@@ -1,3 +1,4 @@
1
+ import { defineVxeComponent } from '../../../ui/src/comp';
1
2
  import { VxeUI } from '../../../ui';
2
3
  import XEUtils from 'xe-utils';
3
4
  import { formatText } from '../../../ui/src/utils';
@@ -9,15 +10,14 @@ export default {
9
10
  globalMixins.sizeMixin
10
11
  ],
11
12
  props: {
12
- defaultOptions: Object,
13
- storeData: Object
14
- },
15
- components: {
16
- // VxeModal,
17
- // VxeInput,
18
- // VxeCheckbox,
19
- // VxeSelect,
20
- // VxeOption
13
+ defaultOptions: {
14
+ type: Object,
15
+ default: () => ({})
16
+ },
17
+ storeData: {
18
+ type: Object,
19
+ default: () => ({})
20
+ }
21
21
  },
22
22
  inject: {
23
23
  $xeTable: {
@@ -25,32 +25,45 @@ export default {
25
25
  }
26
26
  },
27
27
  data() {
28
- return {
28
+ const reactData = {
29
29
  isAll: false,
30
30
  isIndeterminate: false,
31
31
  loading: false
32
32
  };
33
+ return {
34
+ reactData
35
+ };
33
36
  },
34
- computed: {
35
- checkedAll() {
36
- return this.storeData.columns.every((column) => column.checked);
37
+ computed: Object.assign(Object.assign({}, {}), { computeCheckedAll() {
38
+ const $xeExportPanel = this;
39
+ const props = $xeExportPanel;
40
+ const { storeData } = props;
41
+ return storeData.columns.every((column) => column.checked);
37
42
  },
38
- showSheet() {
39
- return ['html', 'xml', 'xlsx', 'pdf'].indexOf(this.defaultOptions.type) > -1;
43
+ computeShowSheet() {
44
+ const $xeExportPanel = this;
45
+ const props = $xeExportPanel;
46
+ const { defaultOptions } = props;
47
+ return ['html', 'xml', 'xlsx', 'pdf'].indexOf(defaultOptions.type) > -1;
40
48
  },
41
- supportMerge() {
42
- const { storeData, defaultOptions } = this;
49
+ computeSupportMerge() {
50
+ const $xeExportPanel = this;
51
+ const props = $xeExportPanel;
52
+ const { storeData, defaultOptions } = props;
43
53
  return !defaultOptions.original && defaultOptions.mode === 'current' && (storeData.isPrint || ['html', 'xlsx'].indexOf(defaultOptions.type) > -1);
44
54
  },
45
55
  // computeSupportGroup () {
46
- // const { defaultOptions } = this
56
+ // const $xeExportPanel = this
57
+ // const props = $xeExportPanel
58
+ // const { defaultOptions } = props
47
59
  // return ['html', 'xlsx', 'csv', 'txt'].indexOf(defaultOptions.type) > -1
48
60
  // },
49
- supportStyle() {
50
- const { defaultOptions } = this;
61
+ computeSupportStyle() {
62
+ const $xeExportPanel = this;
63
+ const props = $xeExportPanel;
64
+ const { defaultOptions } = props;
51
65
  return !defaultOptions.original && ['xlsx'].indexOf(defaultOptions.type) > -1;
52
- }
53
- },
66
+ } }),
54
67
  created() {
55
68
  const $xeTableExportPanel = this;
56
69
  const VxeUIModalComponent = VxeUI.getComponent('VxeModal');
@@ -76,462 +89,72 @@ export default {
76
89
  }
77
90
  });
78
91
  },
79
- render(h) {
80
- const $xeTable = this.$xeTable;
81
- const $xeGrid = $xeTable.$xeGrid;
82
- const $xeGantt = $xeTable.$xeGantt;
83
- const { _e, checkedAll, isAll: isAllChecked, isIndeterminate: isAllIndeterminate, showSheet, supportMerge, supportStyle, defaultOptions, storeData } = this;
84
- const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData;
85
- const { isHeader } = defaultOptions;
86
- // const supportGroup = this.computeSupportGroup
87
- const slots = defaultOptions.slots || {};
88
- const topSlot = slots.top;
89
- const bottomSlot = slots.bottom;
90
- const defaultSlot = slots.default;
91
- const footerSlot = slots.footer;
92
- const parameterSlot = slots.parameter;
93
- const cols = [];
94
- XEUtils.eachTree(columns, column => {
95
- const colTitle = formatText(column.getTitle(), 1);
96
- const isColGroup = column.children && column.children.length;
97
- const isChecked = column.checked;
98
- const indeterminate = column.halfChecked;
99
- const isHtml = column.type === 'html';
100
- cols.push(h('li', {
101
- class: ['vxe-table-export--panel-column-option', `level--${column.level}`, {
102
- 'is--group': isColGroup,
103
- 'is--checked': isChecked,
104
- 'is--indeterminate': indeterminate,
105
- 'is--disabled': column.disabled
106
- }],
107
- attrs: {
108
- title: colTitle
109
- },
110
- on: {
111
- click: () => {
112
- if (!column.disabled) {
113
- this.changeOption(column);
114
- }
115
- }
116
- }
117
- }, [
118
- h('span', {
119
- class: ['vxe-checkbox--icon', indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
120
- }),
121
- isHtml
122
- ? h('span', {
123
- key: '1',
124
- class: 'vxe-checkbox--label',
125
- domProps: {
126
- innerHTML: colTitle
127
- }
128
- })
129
- : h('span', {
130
- key: '0',
131
- class: 'vxe-checkbox--label'
132
- }, colTitle)
133
- ]));
134
- });
135
- return h('vxe-modal', {
136
- ref: 'modal',
137
- props: {
138
- id: 'VXE_EXPORT_MODAL',
139
- value: storeData.visible,
140
- title: getI18n(isPrint ? 'vxe.export.printTitle' : 'vxe.export.expTitle'),
141
- width: 660,
142
- minWidth: 500,
143
- minHeight: 400,
144
- mask: true,
145
- lockView: true,
146
- showFooter: true,
147
- escClosable: true,
148
- maskClosable: true,
149
- showMaximize: true,
150
- resize: true,
151
- loading: this.loading
152
- },
153
- on: {
154
- input(value) {
155
- storeData.visible = value;
156
- },
157
- show: this.showEvent
158
- },
159
- scopedSlots: {
160
- default: () => {
161
- const params = {
162
- $table: $xeTable,
163
- $grid: $xeGrid,
164
- $gantt: $xeGantt,
165
- options: defaultOptions,
166
- columns,
167
- params: defaultOptions.params
168
- };
169
- const hasEmptyData = defaultOptions.mode === 'empty';
170
- return h('div', {
171
- class: 'vxe-table-export--panel'
172
- }, [
173
- topSlot
174
- ? h('div', {
175
- class: 'vxe-table-export--panel-top'
176
- }, $xeTable.callSlot(topSlot, params, h))
177
- : renderEmptyElement(this),
178
- h('div', {
179
- class: 'vxe-table-export--panel-body'
180
- }, defaultSlot
181
- ? $xeTable.callSlot(defaultSlot, params, h)
182
- : [
183
- h('table', {
184
- attrs: {
185
- class: 'vxe-table-export--panel-table',
186
- cellspacing: 0,
187
- cellpadding: 0,
188
- border: 0
189
- }
190
- }, [
191
- h('tbody', [
192
- [
193
- isPrint
194
- ? _e()
195
- : h('tr', [
196
- h('td', getI18n('vxe.export.expName')),
197
- h('td', [
198
- h('vxe-input', {
199
- ref: 'filename',
200
- props: {
201
- value: defaultOptions.filename,
202
- type: 'text',
203
- clearable: true,
204
- placeholder: getI18n('vxe.export.expNamePlaceholder')
205
- },
206
- on: {
207
- modelValue(value) {
208
- defaultOptions.filename = value;
209
- }
210
- }
211
- })
212
- ])
213
- ]),
214
- isPrint
215
- ? _e()
216
- : h('tr', [
217
- h('td', getI18n('vxe.export.expType')),
218
- h('td', [
219
- h('vxe-select', {
220
- props: {
221
- value: defaultOptions.type,
222
- options: storeData.typeList
223
- },
224
- on: {
225
- modelValue(value) {
226
- defaultOptions.type = value;
227
- }
228
- }
229
- })
230
- ])
231
- ]),
232
- isPrint || showSheet
233
- ? h('tr', [
234
- h('td', getI18n('vxe.export.expSheetName')),
235
- h('td', [
236
- h('vxe-input', {
237
- ref: 'sheetname',
238
- props: {
239
- value: defaultOptions.sheetName,
240
- type: 'text',
241
- clearable: true,
242
- placeholder: getI18n('vxe.export.expSheetNamePlaceholder')
243
- },
244
- on: {
245
- modelValue(value) {
246
- defaultOptions.sheetName = value;
247
- }
248
- }
249
- })
250
- ])
251
- ])
252
- : _e(),
253
- h('tr', [
254
- h('td', getI18n('vxe.export.expMode')),
255
- h('td', [
256
- h('vxe-select', {
257
- props: {
258
- value: defaultOptions.mode,
259
- options: storeData.modeList
260
- },
261
- on: {
262
- modelValue(value) {
263
- defaultOptions.mode = value;
264
- }
265
- }
266
- })
267
- ])
268
- ]),
269
- h('tr', [
270
- h('td', [getI18n('vxe.export.expColumn')]),
271
- h('td', [
272
- h('div', {
273
- class: 'vxe-table-export--panel-column'
274
- }, [
275
- h('ul', {
276
- class: 'vxe-table-export--panel-column-header'
277
- }, [
278
- h('li', {
279
- class: ['vxe-table-export--panel-column-option', {
280
- 'is--checked': isAllChecked,
281
- 'is--indeterminate': isAllIndeterminate
282
- }],
283
- attrs: {
284
- title: getI18n('vxe.table.allTitle')
285
- },
286
- on: {
287
- click: this.allColumnEvent
288
- }
289
- }, [
290
- h('span', {
291
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
292
- }),
293
- h('span', {
294
- class: 'vxe-checkbox--label'
295
- }, getI18n('vxe.export.expCurrentColumn'))
296
- ])
297
- ]),
298
- h('ul', {
299
- class: 'vxe-table-export--panel-column-body'
300
- }, cols)
301
- ])
302
- ])
303
- ]),
304
- h('tr', [
305
- h('td', getI18n('vxe.export.expOpts')),
306
- parameterSlot
307
- ? h('td', [
308
- h('div', {
309
- class: 'vxe-table-export--panel-option-row'
310
- }, $xeTable.callSlot(parameterSlot, params, h))
311
- ])
312
- : h('td', [
313
- h('div', {
314
- class: 'vxe-table-export--panel-option-row'
315
- }, [
316
- h('vxe-checkbox', {
317
- props: {
318
- value: hasEmptyData || isHeader,
319
- disabled: hasEmptyData,
320
- title: getI18n('vxe.export.expHeaderTitle'),
321
- content: getI18n('vxe.export.expOptHeader')
322
- },
323
- on: {
324
- input(value) {
325
- defaultOptions.isHeader = value;
326
- }
327
- }
328
- }),
329
- h('vxe-checkbox', {
330
- props: {
331
- value: isHeader ? defaultOptions.isTitle : false,
332
- disabled: !isHeader,
333
- title: getI18n('vxe.export.expTitleTitle'),
334
- content: getI18n('vxe.export.expOptTitle')
335
- },
336
- on: {
337
- input(value) {
338
- defaultOptions.isTitle = value;
339
- }
340
- }
341
- }),
342
- h('vxe-checkbox', {
343
- props: {
344
- value: isHeader && hasColgroup && supportMerge ? defaultOptions.isColgroup : false,
345
- disabled: !isHeader || !hasColgroup || !supportMerge,
346
- title: getI18n('vxe.export.expColgroupTitle'),
347
- content: getI18n('vxe.export.expOptColgroup')
348
- },
349
- on: {
350
- input(value) {
351
- defaultOptions.isColgroup = value;
352
- }
353
- }
354
- })
355
- ]),
356
- h('div', {
357
- class: 'vxe-table-export--panel-option-row'
358
- }, [
359
- h('vxe-checkbox', {
360
- props: {
361
- value: hasEmptyData ? false : defaultOptions.original,
362
- disabled: hasEmptyData,
363
- title: getI18n('vxe.export.expOriginalTitle'),
364
- content: getI18n('vxe.export.expOptOriginal')
365
- },
366
- on: {
367
- input(value) {
368
- defaultOptions.original = value;
369
- }
370
- }
371
- }),
372
- h('vxe-checkbox', {
373
- props: {
374
- value: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false,
375
- disabled: hasEmptyData || !hasMerge || !supportMerge || !checkedAll,
376
- title: getI18n('vxe.export.expMergeTitle'),
377
- content: getI18n('vxe.export.expOptMerge')
378
- },
379
- on: {
380
- input(value) {
381
- defaultOptions.isMerge = value;
382
- }
383
- }
384
- }),
385
- isPrint
386
- ? _e()
387
- : h('vxe-checkbox', {
388
- props: {
389
- value: supportStyle ? defaultOptions.useStyle : false,
390
- disabled: !supportStyle,
391
- title: getI18n('vxe.export.expUseStyleTitle'),
392
- content: getI18n('vxe.export.expOptUseStyle')
393
- },
394
- on: {
395
- input(value) {
396
- defaultOptions.useStyle = value;
397
- }
398
- }
399
- }),
400
- h('vxe-checkbox', {
401
- props: {
402
- value: hasTree ? defaultOptions.isAllExpand : false,
403
- disabled: hasEmptyData || !hasTree,
404
- title: getI18n('vxe.export.expAllExpandTitle'),
405
- content: getI18n('vxe.export.expOptAllExpand')
406
- },
407
- on: {
408
- input(value) {
409
- defaultOptions.isAllExpand = value;
410
- }
411
- }
412
- })
413
- ]),
414
- h('div', {
415
- class: 'vxe-table-export--panel-option-row'
416
- }, [
417
- h('vxe-checkbox', {
418
- props: {
419
- value: defaultOptions.isFooter,
420
- disabled: !storeData.hasFooter,
421
- title: getI18n('vxe.export.expFooterTitle'),
422
- content: getI18n('vxe.export.expOptFooter')
423
- },
424
- on: {
425
- input(value) {
426
- defaultOptions.isFooter = value;
427
- }
428
- }
429
- })
430
- ])
431
- ])
432
- ])
433
- ]
434
- ])
435
- ])
436
- ]),
437
- bottomSlot
438
- ? h('div', {
439
- class: 'vxe-table-export--panel-bottom'
440
- }, $xeTable.callSlot(bottomSlot, params, h))
441
- : renderEmptyElement(this)
442
- ]);
443
- },
444
- footer: () => {
445
- const params = {
446
- $table: $xeTable,
447
- $grid: $xeGrid,
448
- $gantt: $xeGantt,
449
- options: defaultOptions,
450
- columns,
451
- params: defaultOptions.params
452
- };
453
- return h('div', {
454
- class: 'vxe-table-export--panel-footer'
455
- }, footerSlot
456
- ? $xeTable.callSlot(footerSlot, params, h)
457
- : [
458
- h('div', {
459
- class: 'vxe-table-export--panel-btns'
460
- }, [
461
- h('vxe-button', {
462
- props: {
463
- content: getI18n('vxe.export.expCancel')
464
- },
465
- on: {
466
- click: this.cancelEvent
467
- }
468
- }),
469
- h('vxe-button', {
470
- ref: 'confirmBtn',
471
- props: {
472
- status: 'primary',
473
- content: getI18n(isPrint ? 'vxe.export.expPrint' : 'vxe.export.expConfirm')
474
- },
475
- on: {
476
- click: this.confirmEvent
477
- }
478
- })
479
- ])
480
- ]);
481
- }
482
- }
483
- });
484
- },
485
92
  methods: {
486
93
  changeOption(column) {
94
+ const $xeExportPanel = this;
487
95
  const isChecked = !column.checked;
488
96
  XEUtils.eachTree([column], (item) => {
489
97
  item.checked = isChecked;
490
98
  item.halfChecked = false;
491
99
  });
492
- this.handleOptionCheck(column);
493
- this.checkStatus();
100
+ $xeExportPanel.handleOptionCheck(column);
101
+ $xeExportPanel.checkStatus();
494
102
  },
495
103
  handleOptionCheck(column) {
496
- const matchObj = XEUtils.findTree(this.storeData.columns, item => item === column);
104
+ const $xeExportPanel = this;
105
+ const props = $xeExportPanel;
106
+ const { storeData } = props;
107
+ const matchObj = XEUtils.findTree(storeData.columns, item => item === column);
497
108
  if (matchObj && matchObj.parent) {
498
109
  const { parent } = matchObj;
499
110
  if (parent.children && parent.children.length) {
500
111
  parent.checked = parent.children.every((column) => column.checked);
501
112
  parent.halfChecked = !parent.checked && parent.children.some((column) => column.checked || column.halfChecked);
502
- this.handleOptionCheck(parent);
113
+ $xeExportPanel.handleOptionCheck(parent);
503
114
  }
504
115
  }
505
116
  },
506
117
  checkStatus() {
507
- const columns = this.storeData.columns;
508
- this.isAll = columns.every((column) => column.disabled || column.checked);
509
- this.isIndeterminate = !this.isAll && columns.some((column) => !column.disabled && (column.checked || column.halfChecked));
118
+ const $xeExportPanel = this;
119
+ const props = $xeExportPanel;
120
+ const reactData = $xeExportPanel.reactData;
121
+ const { storeData } = props;
122
+ const columns = storeData.columns;
123
+ reactData.isAll = columns.every((column) => column.disabled || column.checked);
124
+ reactData.isIndeterminate = !reactData.isAll && columns.some((column) => !column.disabled && (column.checked || column.halfChecked));
510
125
  },
511
126
  allColumnEvent() {
512
- const isAll = !this.isAll;
513
- XEUtils.eachTree(this.storeData.columns, column => {
127
+ const $xeExportPanel = this;
128
+ const props = $xeExportPanel;
129
+ const reactData = $xeExportPanel.reactData;
130
+ const { storeData } = props;
131
+ const isAll = !reactData.isAll;
132
+ XEUtils.eachTree(storeData.columns, column => {
514
133
  if (!column.disabled) {
515
134
  column.checked = isAll;
516
135
  column.halfChecked = false;
517
136
  }
518
137
  });
519
- this.isAll = isAll;
520
- this.checkStatus();
138
+ reactData.isAll = isAll;
139
+ $xeExportPanel.checkStatus();
521
140
  },
522
141
  showEvent() {
523
- this.$nextTick(() => {
524
- const { $refs } = this;
525
- const targetElem = $refs.filename || $refs.sheetname || $refs.confirmBtn;
142
+ const $xeExportPanel = this;
143
+ $xeExportPanel.$nextTick(() => {
144
+ const targetElem = ($xeExportPanel.$refs.filename || $xeExportPanel.$refs.sheetname || $xeExportPanel.$refs.confirmBtn);
526
145
  if (targetElem) {
527
146
  targetElem.focus();
528
147
  }
529
148
  });
530
- this.checkStatus();
149
+ $xeExportPanel.checkStatus();
531
150
  },
532
151
  getExportOption() {
533
- const { checkedAll, storeData, defaultOptions, supportMerge } = this;
152
+ const $xeExportPanel = this;
153
+ const props = $xeExportPanel;
154
+ const { storeData, defaultOptions } = props;
534
155
  const { hasMerge, columns } = storeData;
156
+ const checkedAll = $xeExportPanel.computeCheckedAll;
157
+ const supportMerge = $xeExportPanel.computeSupportMerge;
535
158
  const expColumns = XEUtils.searchTree(columns, column => column.checked, { children: 'children', mapChildren: 'childNodes', original: true });
536
159
  return Object.assign({}, defaultOptions, {
537
160
  columns: expColumns,
@@ -539,31 +162,461 @@ export default {
539
162
  });
540
163
  },
541
164
  cancelEvent() {
542
- this.storeData.visible = false;
165
+ const $xeExportPanel = this;
166
+ const props = $xeExportPanel;
167
+ const { storeData } = props;
168
+ storeData.visible = false;
543
169
  },
544
- confirmEvent(evnt) {
545
- if (this.storeData.isPrint) {
546
- this.printEvent(evnt);
170
+ confirmEvent() {
171
+ const $xeExportPanel = this;
172
+ const props = $xeExportPanel;
173
+ const { storeData } = props;
174
+ if (storeData.isPrint) {
175
+ $xeExportPanel.printEvent();
547
176
  }
548
177
  else {
549
- this.exportEvent(evnt);
178
+ $xeExportPanel.exportEvent();
550
179
  }
551
180
  },
552
181
  printEvent() {
553
- const $xeTable = this.$parent;
554
- this.storeData.visible = false;
555
- $xeTable.print(Object.assign({}, $xeTable.printOpts, this.getExportOption()));
182
+ const $xeExportPanel = this;
183
+ const props = $xeExportPanel;
184
+ const $xeTable = $xeExportPanel.$xeTable;
185
+ const { storeData } = props;
186
+ storeData.visible = false;
187
+ $xeTable.print(Object.assign({}, $xeTable.printOpts, $xeExportPanel.getExportOption()));
556
188
  },
557
189
  exportEvent() {
558
- const $xeTable = this.$xeTable;
190
+ const $xeExportPanel = this;
191
+ const props = $xeExportPanel;
192
+ const reactData = $xeExportPanel.reactData;
193
+ const $xeTable = $xeExportPanel.$xeTable;
194
+ const { storeData } = props;
559
195
  const exportOpts = $xeTable.exportOpts;
560
- this.loading = true;
561
- $xeTable.exportData(Object.assign({}, exportOpts, this.getExportOption())).then(() => {
562
- this.loading = false;
563
- this.storeData.visible = false;
196
+ reactData.loading = true;
197
+ $xeTable.exportData(Object.assign({}, exportOpts, $xeExportPanel.getExportOption())).then(() => {
198
+ reactData.loading = false;
199
+ storeData.visible = false;
564
200
  }).catch(() => {
565
- this.loading = false;
201
+ reactData.loading = false;
202
+ });
203
+ },
204
+ renderVN(h) {
205
+ const $xeExportPanel = this;
206
+ const props = $xeExportPanel;
207
+ const reactData = $xeExportPanel.reactData;
208
+ const $xeTable = $xeExportPanel.$xeTable;
209
+ const $xeGrid = $xeTable.$xeGrid;
210
+ const $xeGantt = $xeTable.$xeGantt;
211
+ const { defaultOptions, storeData } = props;
212
+ const { isAll: isAllChecked, isIndeterminate: isAllIndeterminate } = reactData;
213
+ const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData;
214
+ const { isHeader } = defaultOptions;
215
+ const colVNs = [];
216
+ const checkedAll = $xeExportPanel.computeCheckedAll;
217
+ const showSheet = $xeExportPanel.computeShowSheet;
218
+ const supportMerge = $xeExportPanel.computeSupportMerge;
219
+ const supportStyle = $xeExportPanel.computeSupportStyle;
220
+ // const supportGroup = $xeExportPanel.computeSupportGroup
221
+ const slots = defaultOptions.slots || {};
222
+ const topSlot = slots.top;
223
+ const bottomSlot = slots.bottom;
224
+ const defaultSlot = slots.default;
225
+ const footerSlot = slots.footer;
226
+ const parameterSlot = slots.parameter;
227
+ XEUtils.eachTree(columns, column => {
228
+ const colTitle = formatText(column.getTitle(), 1);
229
+ const isColGroup = column.children && column.children.length;
230
+ const isChecked = column.checked;
231
+ const indeterminate = column.halfChecked;
232
+ const isHtml = column.type === 'html';
233
+ colVNs.push(h('li', {
234
+ class: ['vxe-table-export--panel-column-option', `level--${column.level}`, {
235
+ 'is--group': isColGroup,
236
+ 'is--checked': isChecked,
237
+ 'is--indeterminate': indeterminate,
238
+ 'is--disabled': column.disabled
239
+ }],
240
+ attrs: {
241
+ title: colTitle
242
+ },
243
+ on: {
244
+ click: () => {
245
+ if (!column.disabled) {
246
+ $xeExportPanel.changeOption(column);
247
+ }
248
+ }
249
+ }
250
+ }, [
251
+ h('span', {
252
+ class: ['vxe-checkbox--icon', indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
253
+ }),
254
+ isHtml
255
+ ? h('span', {
256
+ key: '1',
257
+ class: 'vxe-checkbox--label',
258
+ domProps: {
259
+ innerHTML: colTitle
260
+ }
261
+ })
262
+ : h('span', {
263
+ key: '0',
264
+ class: 'vxe-checkbox--label'
265
+ }, colTitle)
266
+ ]));
267
+ });
268
+ return h('vxe-modal', {
269
+ ref: 'modal',
270
+ props: {
271
+ id: 'VXE_EXPORT_MODAL',
272
+ value: storeData.visible,
273
+ title: getI18n(isPrint ? 'vxe.export.printTitle' : 'vxe.export.expTitle'),
274
+ width: 660,
275
+ minWidth: 500,
276
+ minHeight: 400,
277
+ mask: true,
278
+ lockView: true,
279
+ showFooter: true,
280
+ escClosable: true,
281
+ maskClosable: true,
282
+ showMaximize: true,
283
+ resize: true,
284
+ loading: reactData.loading
285
+ },
286
+ on: {
287
+ input(value) {
288
+ storeData.visible = value;
289
+ },
290
+ show: $xeExportPanel.showEvent
291
+ },
292
+ scopedSlots: {
293
+ default() {
294
+ const params = {
295
+ $table: $xeTable,
296
+ $grid: $xeGrid,
297
+ $gantt: $xeGantt,
298
+ options: defaultOptions,
299
+ columns,
300
+ params: defaultOptions.params
301
+ };
302
+ const hasEmptyData = defaultOptions.mode === 'empty';
303
+ return h('div', {
304
+ class: 'vxe-table-export--panel'
305
+ }, [
306
+ topSlot
307
+ ? h('div', {
308
+ class: 'vxe-table-export--panel-top'
309
+ }, $xeTable.callSlot(topSlot, params, h))
310
+ : renderEmptyElement($xeTable),
311
+ h('div', {
312
+ class: 'vxe-table-export--panel-body'
313
+ }, defaultSlot
314
+ ? $xeTable.callSlot(defaultSlot, params, h)
315
+ : [
316
+ h('table', {
317
+ attrs: {
318
+ class: 'vxe-table-export--panel-table',
319
+ cellspacing: 0,
320
+ cellpadding: 0,
321
+ border: 0
322
+ }
323
+ }, [
324
+ h('tbody', [
325
+ [
326
+ isPrint
327
+ ? renderEmptyElement($xeTable)
328
+ : h('tr', [
329
+ h('td', getI18n('vxe.export.expName')),
330
+ h('td', [
331
+ h('vxe-input', {
332
+ ref: 'filename',
333
+ props: {
334
+ value: defaultOptions.filename,
335
+ type: 'text',
336
+ clearable: true,
337
+ placeholder: getI18n('vxe.export.expNamePlaceholder')
338
+ },
339
+ on: {
340
+ modelValue(value) {
341
+ defaultOptions.filename = value;
342
+ }
343
+ }
344
+ })
345
+ ])
346
+ ]),
347
+ isPrint
348
+ ? renderEmptyElement($xeTable)
349
+ : h('tr', [
350
+ h('td', getI18n('vxe.export.expType')),
351
+ h('td', [
352
+ h('vxe-select', {
353
+ props: {
354
+ value: defaultOptions.type,
355
+ options: storeData.typeList
356
+ },
357
+ on: {
358
+ modelValue(value) {
359
+ defaultOptions.type = value;
360
+ }
361
+ }
362
+ })
363
+ ])
364
+ ]),
365
+ isPrint || showSheet
366
+ ? h('tr', [
367
+ h('td', getI18n('vxe.export.expSheetName')),
368
+ h('td', [
369
+ h('vxe-input', {
370
+ ref: 'sheetname',
371
+ props: {
372
+ value: defaultOptions.sheetName,
373
+ type: 'text',
374
+ clearable: true,
375
+ placeholder: getI18n('vxe.export.expSheetNamePlaceholder')
376
+ },
377
+ on: {
378
+ modelValue(value) {
379
+ defaultOptions.sheetName = value;
380
+ }
381
+ }
382
+ })
383
+ ])
384
+ ])
385
+ : renderEmptyElement($xeTable),
386
+ h('tr', [
387
+ h('td', getI18n('vxe.export.expMode')),
388
+ h('td', [
389
+ h('vxe-select', {
390
+ props: {
391
+ value: defaultOptions.mode,
392
+ options: storeData.modeList
393
+ },
394
+ on: {
395
+ modelValue(value) {
396
+ defaultOptions.mode = value;
397
+ }
398
+ }
399
+ })
400
+ ])
401
+ ]),
402
+ h('tr', [
403
+ h('td', [getI18n('vxe.export.expColumn')]),
404
+ h('td', [
405
+ h('div', {
406
+ class: 'vxe-table-export--panel-column'
407
+ }, [
408
+ h('ul', {
409
+ class: 'vxe-table-export--panel-column-header'
410
+ }, [
411
+ h('li', {
412
+ class: ['vxe-table-export--panel-column-option', {
413
+ 'is--checked': isAllChecked,
414
+ 'is--indeterminate': isAllIndeterminate
415
+ }],
416
+ attrs: {
417
+ title: getI18n('vxe.table.allTitle')
418
+ },
419
+ on: {
420
+ click: $xeExportPanel.allColumnEvent
421
+ }
422
+ }, [
423
+ h('span', {
424
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
425
+ }),
426
+ h('span', {
427
+ class: 'vxe-checkbox--label'
428
+ }, getI18n('vxe.export.expCurrentColumn'))
429
+ ])
430
+ ]),
431
+ h('ul', {
432
+ class: 'vxe-table-export--panel-column-body'
433
+ }, colVNs)
434
+ ])
435
+ ])
436
+ ]),
437
+ h('tr', [
438
+ h('td', getI18n('vxe.export.expOpts')),
439
+ parameterSlot
440
+ ? h('td', [
441
+ h('div', {
442
+ class: 'vxe-table-export--panel-option-row'
443
+ }, $xeTable.callSlot(parameterSlot, params, h))
444
+ ])
445
+ : h('td', [
446
+ h('div', {
447
+ class: 'vxe-table-export--panel-option-row'
448
+ }, [
449
+ h('vxe-checkbox', {
450
+ props: {
451
+ value: hasEmptyData || isHeader,
452
+ disabled: hasEmptyData,
453
+ title: getI18n('vxe.export.expHeaderTitle'),
454
+ content: getI18n('vxe.export.expOptHeader')
455
+ },
456
+ on: {
457
+ input(value) {
458
+ defaultOptions.isHeader = value;
459
+ }
460
+ }
461
+ }),
462
+ h('vxe-checkbox', {
463
+ props: {
464
+ value: isHeader ? defaultOptions.isTitle : false,
465
+ disabled: !isHeader,
466
+ title: getI18n('vxe.export.expTitleTitle'),
467
+ content: getI18n('vxe.export.expOptTitle')
468
+ },
469
+ on: {
470
+ input(value) {
471
+ defaultOptions.isTitle = value;
472
+ }
473
+ }
474
+ }),
475
+ h('vxe-checkbox', {
476
+ props: {
477
+ value: isHeader && hasColgroup && supportMerge ? defaultOptions.isColgroup : false,
478
+ disabled: !isHeader || !hasColgroup || !supportMerge,
479
+ title: getI18n('vxe.export.expColgroupTitle'),
480
+ content: getI18n('vxe.export.expOptColgroup')
481
+ },
482
+ on: {
483
+ input(value) {
484
+ defaultOptions.isColgroup = value;
485
+ }
486
+ }
487
+ })
488
+ ]),
489
+ h('div', {
490
+ class: 'vxe-table-export--panel-option-row'
491
+ }, [
492
+ h('vxe-checkbox', {
493
+ props: {
494
+ value: hasEmptyData ? false : defaultOptions.original,
495
+ disabled: hasEmptyData,
496
+ title: getI18n('vxe.export.expOriginalTitle'),
497
+ content: getI18n('vxe.export.expOptOriginal')
498
+ },
499
+ on: {
500
+ input(value) {
501
+ defaultOptions.original = value;
502
+ }
503
+ }
504
+ }),
505
+ h('vxe-checkbox', {
506
+ props: {
507
+ value: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false,
508
+ disabled: hasEmptyData || !hasMerge || !supportMerge || !checkedAll,
509
+ title: getI18n('vxe.export.expMergeTitle'),
510
+ content: getI18n('vxe.export.expOptMerge')
511
+ },
512
+ on: {
513
+ input(value) {
514
+ defaultOptions.isMerge = value;
515
+ }
516
+ }
517
+ }),
518
+ isPrint
519
+ ? renderEmptyElement($xeTable)
520
+ : h('vxe-checkbox', {
521
+ props: {
522
+ value: supportStyle ? defaultOptions.useStyle : false,
523
+ disabled: !supportStyle,
524
+ title: getI18n('vxe.export.expUseStyleTitle'),
525
+ content: getI18n('vxe.export.expOptUseStyle')
526
+ },
527
+ on: {
528
+ input(value) {
529
+ defaultOptions.useStyle = value;
530
+ }
531
+ }
532
+ }),
533
+ h('vxe-checkbox', {
534
+ props: {
535
+ value: hasTree ? defaultOptions.isAllExpand : false,
536
+ disabled: hasEmptyData || !hasTree,
537
+ title: getI18n('vxe.export.expAllExpandTitle'),
538
+ content: getI18n('vxe.export.expOptAllExpand')
539
+ },
540
+ on: {
541
+ input(value) {
542
+ defaultOptions.isAllExpand = value;
543
+ }
544
+ }
545
+ })
546
+ ]),
547
+ h('div', {
548
+ class: 'vxe-table-export--panel-option-row'
549
+ }, [
550
+ h('vxe-checkbox', {
551
+ props: {
552
+ value: defaultOptions.isFooter,
553
+ disabled: !storeData.hasFooter,
554
+ title: getI18n('vxe.export.expFooterTitle'),
555
+ content: getI18n('vxe.export.expOptFooter')
556
+ },
557
+ on: {
558
+ input(value) {
559
+ defaultOptions.isFooter = value;
560
+ }
561
+ }
562
+ })
563
+ ])
564
+ ])
565
+ ])
566
+ ]
567
+ ])
568
+ ])
569
+ ]),
570
+ bottomSlot
571
+ ? h('div', {
572
+ class: 'vxe-table-export--panel-bottom'
573
+ }, $xeTable.callSlot(bottomSlot, params, h))
574
+ : renderEmptyElement($xeTable)
575
+ ]);
576
+ },
577
+ footer() {
578
+ const params = {
579
+ $table: $xeTable,
580
+ $grid: $xeGrid,
581
+ $gantt: $xeGantt,
582
+ options: defaultOptions,
583
+ columns,
584
+ params: defaultOptions.params
585
+ };
586
+ return h('div', {
587
+ class: 'vxe-table-export--panel-footer'
588
+ }, footerSlot
589
+ ? $xeTable.callSlot(footerSlot, params, h)
590
+ : [
591
+ h('div', {
592
+ class: 'vxe-table-export--panel-btns'
593
+ }, [
594
+ h('vxe-button', {
595
+ props: {
596
+ content: getI18n('vxe.export.expCancel')
597
+ },
598
+ on: {
599
+ click: $xeExportPanel.cancelEvent
600
+ }
601
+ }),
602
+ h('vxe-button', {
603
+ ref: 'confirmBtn',
604
+ props: {
605
+ status: 'primary',
606
+ content: getI18n(isPrint ? 'vxe.export.expPrint' : 'vxe.export.expConfirm')
607
+ },
608
+ on: {
609
+ click: $xeExportPanel.confirmEvent
610
+ }
611
+ })
612
+ ])
613
+ ]);
614
+ }
615
+ }
566
616
  });
567
617
  }
618
+ },
619
+ render(h) {
620
+ return this.renderVN(h);
568
621
  }
569
622
  };