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