vxe-table 4.19.0-beta.3 → 4.19.0-beta.4

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