vxe-table 4.23.7 → 4.23.9

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