vxe-table 4.23.18 → 4.23.20

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 (135) hide show
  1. package/dist/all.esm.js +301 -274
  2. package/dist/all.esm.min.js +3 -3
  3. package/dist/style.css +4 -1
  4. package/dist/style.mini.css +1 -1
  5. package/es/components.d.ts +1 -3
  6. package/es/components.js +1 -2
  7. package/es/esm.index.d.ts +7 -0
  8. package/es/esm.index.js +8 -0
  9. package/es/style.css +4 -1
  10. package/es/style.mini.css +1 -1
  11. package/es/table/module/edit/hook.js +2 -4
  12. package/es/table/module/export/export-panel.js +5 -5
  13. package/es/table/module/export/hook.js +8 -10
  14. package/es/table/module/export/import-panel.js +5 -5
  15. package/es/table/src/table.js +0 -1
  16. package/es/table/style.css +4 -1
  17. package/es/table/style.mini.css +1 -1
  18. package/es/ui/abandon.d.ts +82 -0
  19. package/es/ui/abandon.js +90 -0
  20. package/es/ui/index.d.ts +1 -82
  21. package/es/ui/index.js +2 -88
  22. package/es/ui/src/log.js +1 -1
  23. package/es/vxe-table/style.css +4 -1
  24. package/es/vxe-table/style.mini.css +1 -1
  25. package/lib/components.d.ts +1 -3
  26. package/lib/components.js +1 -2
  27. package/lib/esm.index.d.ts +7 -0
  28. package/lib/esm.index.js +39 -0
  29. package/lib/index.umd.js +266 -270
  30. package/lib/index.umd.min.js +3 -3
  31. package/lib/style.css +4 -1
  32. package/lib/style.mini.css +1 -1
  33. package/lib/table/module/edit/hook.js +2 -4
  34. package/lib/table/module/export/export-panel.js +5 -5
  35. package/lib/table/module/export/hook.js +8 -10
  36. package/lib/table/module/export/import-panel.js +5 -5
  37. package/lib/table/src/table.js +0 -1
  38. package/lib/table/style/style.css +4 -1
  39. package/lib/table/style/style.mini.css +1 -1
  40. package/lib/ui/abandon.d.ts +82 -0
  41. package/lib/ui/abandon.js +110 -0
  42. package/lib/ui/index.d.ts +1 -82
  43. package/lib/ui/index.js +3 -88
  44. package/lib/ui/src/log.js +1 -1
  45. package/lib/vxe-table/style/style.css +4 -1
  46. package/lib/vxe-table/style/style.mini.css +1 -1
  47. package/package.json +2 -2
  48. package/packages/colgroup/index.ts +22 -22
  49. package/packages/column/index.ts +22 -22
  50. package/packages/components.ts +42 -45
  51. package/packages/esm.index.ts +10 -0
  52. package/packages/grid/index.ts +18 -18
  53. package/packages/grid/src/emits.ts +5 -5
  54. package/packages/grid/src/grid.ts +2220 -2220
  55. package/packages/grid/src/props.ts +22 -22
  56. package/packages/index.ts +13 -13
  57. package/packages/locale/lang/ar-EG.ts +914 -914
  58. package/packages/locale/lang/de-DE.ts +914 -914
  59. package/packages/locale/lang/en-US.ts +914 -914
  60. package/packages/locale/lang/es-ES.ts +914 -914
  61. package/packages/locale/lang/fr-FR.ts +914 -914
  62. package/packages/locale/lang/hu-HU.ts +914 -914
  63. package/packages/locale/lang/hy-AM.ts +914 -914
  64. package/packages/locale/lang/id-ID.ts +914 -914
  65. package/packages/locale/lang/it-IT.ts +914 -914
  66. package/packages/locale/lang/ja-JP.ts +914 -914
  67. package/packages/locale/lang/ko-KR.ts +914 -914
  68. package/packages/locale/lang/ms-MY.ts +914 -914
  69. package/packages/locale/lang/nb-NO.ts +914 -914
  70. package/packages/locale/lang/pt-BR.ts +914 -914
  71. package/packages/locale/lang/ru-RU.ts +914 -914
  72. package/packages/locale/lang/th-TH.ts +914 -914
  73. package/packages/locale/lang/ug-CN.ts +914 -914
  74. package/packages/locale/lang/uk-UA.ts +914 -914
  75. package/packages/locale/lang/uz-UZ.ts +914 -914
  76. package/packages/locale/lang/vi-VN.ts +914 -914
  77. package/packages/locale/lang/zh-CHT.ts +914 -914
  78. package/packages/locale/lang/zh-CN.ts +914 -914
  79. package/packages/locale/lang/zh-HK.ts +914 -914
  80. package/packages/locale/lang/zh-MO.ts +914 -914
  81. package/packages/locale/lang/zh-TC.ts +914 -914
  82. package/packages/locale/lang/zh-TW.ts +914 -914
  83. package/packages/table/index.ts +26 -26
  84. package/packages/table/module/custom/hook.ts +510 -510
  85. package/packages/table/module/custom/panel.ts +2002 -2002
  86. package/packages/table/module/edit/hook.ts +1232 -1235
  87. package/packages/table/module/export/export-panel.ts +697 -697
  88. package/packages/table/module/export/hook.ts +2158 -2160
  89. package/packages/table/module/export/import-panel.ts +319 -319
  90. package/packages/table/module/export/util.ts +25 -25
  91. package/packages/table/module/filter/hook.ts +505 -505
  92. package/packages/table/module/filter/panel.ts +368 -368
  93. package/packages/table/module/keyboard/hook.ts +498 -498
  94. package/packages/table/module/menu/hook.ts +330 -330
  95. package/packages/table/module/menu/panel.ts +272 -272
  96. package/packages/table/module/validator/hook.ts +653 -653
  97. package/packages/table/render/index.ts +1819 -1819
  98. package/packages/table/src/body.ts +1078 -1078
  99. package/packages/table/src/cell.ts +1524 -1524
  100. package/packages/table/src/column.ts +192 -192
  101. package/packages/table/src/columnInfo.ts +232 -232
  102. package/packages/table/src/emits.ts +134 -134
  103. package/packages/table/src/footer.ts +425 -425
  104. package/packages/table/src/group.ts +67 -67
  105. package/packages/table/src/header.ts +661 -661
  106. package/packages/table/src/props.ts +336 -336
  107. package/packages/table/src/store.ts +14 -14
  108. package/packages/table/src/table.ts +0 -1
  109. package/packages/table/src/use/cell-view.ts +41 -41
  110. package/packages/table/src/use/index.ts +1 -1
  111. package/packages/table/src/util.ts +1206 -1206
  112. package/packages/toolbar/index.ts +18 -18
  113. package/packages/toolbar/src/toolbar.ts +768 -768
  114. package/packages/ui/abandon.ts +136 -0
  115. package/packages/ui/index.ts +404 -520
  116. package/packages/ui/src/anime.ts +51 -51
  117. package/packages/ui/src/comp.ts +3 -3
  118. package/packages/ui/src/dom.ts +466 -466
  119. package/packages/ui/src/log.ts +19 -19
  120. package/packages/ui/src/utils.ts +66 -66
  121. package/packages/ui/src/vn.ts +55 -55
  122. package/packages/v-x-e-table/index.d.ts +3 -3
  123. package/packages/v-x-e-table/index.ts +3 -3
  124. package/styles/components/table.scss +2 -1
  125. package/types/all.d.ts +76 -76
  126. package/types/index.d.ts +4 -4
  127. /package/dist/{iconfont.1794366305845.ttf → iconfont.1794633824975.ttf} +0 -0
  128. /package/dist/{iconfont.1794366305845.woff → iconfont.1794633824975.woff} +0 -0
  129. /package/dist/{iconfont.1794366305845.woff2 → iconfont.1794633824975.woff2} +0 -0
  130. /package/es/{iconfont.1794366305845.ttf → iconfont.1794633824975.ttf} +0 -0
  131. /package/es/{iconfont.1794366305845.woff → iconfont.1794633824975.woff} +0 -0
  132. /package/es/{iconfont.1794366305845.woff2 → iconfont.1794633824975.woff2} +0 -0
  133. /package/lib/{iconfont.1794366305845.ttf → iconfont.1794633824975.ttf} +0 -0
  134. /package/lib/{iconfont.1794366305845.woff → iconfont.1794633824975.woff} +0 -0
  135. /package/lib/{iconfont.1794366305845.woff2 → iconfont.1794633824975.woff2} +0 -0
@@ -1,697 +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 '@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 /* define-vxe-component start */ 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
- }) /* define-vxe-component end */
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 /* define-vxe-component start */ 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: getDefaultConfig(modelOptions.title, getI18n(isPrint ? 'vxe.export.printTitle' : 'vxe.export.expTitle')),
267
+ className: 'vxe-table-export-popup-wrapper' + (modelOptions.className ? ` ${modelOptions.className}` : ''),
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: getDefaultConfig(modelOptions.showFooter, true),
275
+ escClosable: getDefaultConfig(modelOptions.escClosable, true),
276
+ maskClosable: getDefaultConfig(modelOptions.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
+ }) /* define-vxe-component end */