vxe-table 3.20.4 → 3.20.6

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