vxe-table 3.20.7 → 3.20.8

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 (144) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +106 -106
  3. package/es/index.esm.js +2 -1
  4. package/es/style.css +1 -1
  5. package/es/table/src/methods.js +75 -78
  6. package/es/table/src/table.js +10 -1
  7. package/es/table/src/util.js +6 -0
  8. package/es/table/style.css +18 -48
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/dom.js +19 -20
  11. package/es/ui/src/log.js +1 -1
  12. package/es/vxe-table/style.css +18 -48
  13. package/lib/index.common.js +2 -1
  14. package/lib/index.umd.js +1912 -3228
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/style.css +1 -1
  17. package/lib/table/src/methods.js +12 -10
  18. package/lib/table/src/methods.min.js +1 -1
  19. package/lib/table/src/table.js +9 -1
  20. package/lib/table/src/table.min.js +1 -1
  21. package/lib/table/src/util.js +6 -0
  22. package/lib/table/src/util.min.js +1 -1
  23. package/lib/table/style/style.css +18 -48
  24. package/lib/ui/index.js +1 -1
  25. package/lib/ui/index.min.js +1 -1
  26. package/lib/ui/src/dom.js +21 -20
  27. package/lib/ui/src/dom.min.js +1 -1
  28. package/lib/ui/src/log.js +1 -1
  29. package/lib/ui/src/log.min.js +1 -1
  30. package/lib/v-x-e-table/index.js +2 -1
  31. package/lib/v-x-e-table/index.min.js +1 -1
  32. package/lib/vxe-colgroup/index.js +2 -1
  33. package/lib/vxe-colgroup/index.min.js +1 -1
  34. package/lib/vxe-column/index.js +2 -1
  35. package/lib/vxe-column/index.min.js +1 -1
  36. package/lib/vxe-grid/index.js +2 -1
  37. package/lib/vxe-grid/index.min.js +1 -1
  38. package/lib/vxe-table/index.js +2 -1
  39. package/lib/vxe-table/index.min.js +1 -1
  40. package/lib/vxe-table/style/style.css +18 -48
  41. package/lib/vxe-toolbar/index.js +2 -1
  42. package/lib/vxe-toolbar/index.min.js +1 -1
  43. package/lib/vxe-ui/index.js +2 -1
  44. package/lib/vxe-ui/index.min.js +1 -1
  45. package/lib/vxe-v-x-e-table/index.js +2 -1
  46. package/lib/vxe-v-x-e-table/index.min.js +1 -1
  47. package/package.json +93 -93
  48. package/packages/colgroup/index.ts +22 -22
  49. package/packages/column/index.ts +22 -22
  50. package/packages/components.ts +42 -42
  51. package/packages/grid/index.ts +22 -22
  52. package/packages/grid/src/grid.ts +1935 -1935
  53. package/packages/index.ts +4 -4
  54. package/packages/locale/lang/ar-EG.ts +832 -832
  55. package/packages/locale/lang/de-DE.ts +832 -832
  56. package/packages/locale/lang/en-US.ts +832 -832
  57. package/packages/locale/lang/es-ES.ts +832 -832
  58. package/packages/locale/lang/fr-FR.ts +832 -832
  59. package/packages/locale/lang/hu-HU.ts +832 -832
  60. package/packages/locale/lang/hy-AM.ts +832 -832
  61. package/packages/locale/lang/id-ID.ts +832 -832
  62. package/packages/locale/lang/it-IT.ts +832 -832
  63. package/packages/locale/lang/ja-JP.ts +832 -832
  64. package/packages/locale/lang/ko-KR.ts +832 -832
  65. package/packages/locale/lang/ms-MY.ts +832 -832
  66. package/packages/locale/lang/nb-NO.ts +832 -832
  67. package/packages/locale/lang/pt-BR.ts +832 -832
  68. package/packages/locale/lang/ru-RU.ts +832 -832
  69. package/packages/locale/lang/th-TH.ts +832 -832
  70. package/packages/locale/lang/ug-CN.ts +832 -832
  71. package/packages/locale/lang/uk-UA.ts +832 -832
  72. package/packages/locale/lang/uz-UZ.ts +832 -832
  73. package/packages/locale/lang/vi-VN.ts +832 -832
  74. package/packages/locale/lang/zh-CHT.ts +832 -832
  75. package/packages/locale/lang/zh-CN.ts +832 -832
  76. package/packages/locale/lang/zh-HK.ts +3 -3
  77. package/packages/locale/lang/zh-MO.ts +3 -3
  78. package/packages/locale/lang/zh-TC.ts +3 -3
  79. package/packages/locale/lang/zh-TW.ts +3 -3
  80. package/packages/table/index.ts +49 -49
  81. package/packages/table/module/custom/mixin.ts +369 -369
  82. package/packages/table/module/custom/panel.ts +1461 -1461
  83. package/packages/table/module/edit/mixin.ts +1123 -1123
  84. package/packages/table/module/export/export-panel.ts +658 -658
  85. package/packages/table/module/export/import-panel.ts +319 -319
  86. package/packages/table/module/export/mixin.ts +1693 -1693
  87. package/packages/table/module/export/util.ts +24 -24
  88. package/packages/table/module/filter/mixin.ts +507 -507
  89. package/packages/table/module/filter/panel.ts +329 -329
  90. package/packages/table/module/keyboard/mixin.ts +513 -513
  91. package/packages/table/module/menu/mixin.ts +329 -329
  92. package/packages/table/module/menu/panel.ts +212 -212
  93. package/packages/table/module/validator/mixin.ts +626 -626
  94. package/packages/table/render/index.ts +1456 -1456
  95. package/packages/table/src/body.ts +969 -969
  96. package/packages/table/src/cell.ts +1285 -1285
  97. package/packages/table/src/column.ts +205 -205
  98. package/packages/table/src/columnInfo.ts +228 -228
  99. package/packages/table/src/footer.ts +388 -388
  100. package/packages/table/src/group.ts +51 -51
  101. package/packages/table/src/header.ts +602 -602
  102. package/packages/table/src/methods.ts +12936 -12939
  103. package/packages/table/src/props.ts +311 -311
  104. package/packages/table/src/store.ts +15 -15
  105. package/packages/table/src/table.ts +2513 -2505
  106. package/packages/table/src/util.ts +1018 -1012
  107. package/packages/toolbar/index.ts +18 -18
  108. package/packages/toolbar/src/toolbar.ts +856 -856
  109. package/packages/ui/index.ts +530 -530
  110. package/packages/ui/src/anime.ts +52 -52
  111. package/packages/ui/src/comp.ts +3 -3
  112. package/packages/ui/src/dom.ts +237 -236
  113. package/packages/ui/src/log.ts +8 -8
  114. package/packages/ui/src/utils.ts +56 -56
  115. package/packages/ui/src/vn.ts +65 -65
  116. package/packages/v-x-e-table/index.ts +4 -4
  117. package/styles/all.scss +7 -7
  118. package/styles/base.scss +16 -16
  119. package/styles/components/grid.scss +89 -89
  120. package/styles/components/icon.scss +225 -225
  121. package/styles/components/old-icon.scss +715 -715
  122. package/styles/components/table-module/all.scss +6 -6
  123. package/styles/components/table-module/custom.scss +527 -527
  124. package/styles/components/table-module/export.scss +130 -130
  125. package/styles/components/table-module/filter.scss +130 -130
  126. package/styles/components/table-module/menu.scss +81 -81
  127. package/styles/components/table.scss +2679 -2679
  128. package/styles/components/toolbar.scss +119 -119
  129. package/styles/default.scss +2 -2
  130. package/styles/helpers/baseMixin.scss +95 -95
  131. package/styles/index.scss +3 -3
  132. package/styles/modules.scss +5 -5
  133. package/styles/theme/base.scss +93 -93
  134. package/styles/theme/dark.scss +49 -49
  135. package/styles/theme/light.scss +44 -44
  136. package/styles/variable.scss +43 -43
  137. package/types/all.d.ts +53 -53
  138. package/types/index.d.ts +4 -4
  139. /package/es/{iconfont.1773991883171.ttf → iconfont.1774240303597.ttf} +0 -0
  140. /package/es/{iconfont.1773991883171.woff → iconfont.1774240303597.woff} +0 -0
  141. /package/es/{iconfont.1773991883171.woff2 → iconfont.1774240303597.woff2} +0 -0
  142. /package/lib/{iconfont.1773991883171.ttf → iconfont.1774240303597.ttf} +0 -0
  143. /package/lib/{iconfont.1773991883171.woff → iconfont.1774240303597.woff} +0 -0
  144. /package/lib/{iconfont.1773991883171.woff2 → iconfont.1774240303597.woff2} +0 -0
@@ -1,1461 +1,1461 @@
1
- import { CreateElement, VNode, PropType } from 'vue'
2
- import { defineVxeComponent } from '../../../ui/src/comp'
3
- import { VxeUI } from '../../../ui'
4
- import { formatText } from '../../../ui/src/utils'
5
- import { getTpImg, addClass, removeClass, hasControlKey, toCssUnit } from '../../../ui/src/dom'
6
- import { errLog } from '../../../ui/src/log'
7
- import XEUtils from 'xe-utils'
8
-
9
- import type { VxeTableDefines, VxeTableConstructor, VxeTablePrivateMethods, TableReactData, TableInternalData, VxeColumnPropTypes, VxeTableCustomPanelConstructor, TableCustomPanelReactData, TableCustomPanelInternalData } from '../../../../types'
10
- import type { VxeButtonDefines, VxeRadioGroupDefines, VxeComponentStyleType } from 'vxe-pc-ui'
11
-
12
- const { getI18n, getIcon, renderEmptyElement } = VxeUI
13
-
14
- function showDropTip ($xeTableCustomPanel: VxeTableCustomPanelConstructor, evnt: DragEvent | MouseEvent, optEl: HTMLElement | null, showLine: boolean, dragPos: string) {
15
- const customPanelInternalData = $xeTableCustomPanel.internalData
16
-
17
- const bodyWrapperElem = $xeTableCustomPanel.$refs.refBodyWrapperElem as HTMLDivElement
18
- if (!bodyWrapperElem) {
19
- return
20
- }
21
- const customBodyElem = $xeTableCustomPanel.$refs.refCustomBodyElem as HTMLDivElement
22
- if (!customBodyElem) {
23
- return
24
- }
25
- const { prevDragToChild } = customPanelInternalData
26
- const bodyWrapperRect = bodyWrapperElem.getBoundingClientRect()
27
- const customBodyRect = customBodyElem.getBoundingClientRect()
28
- const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem as HTMLDivElement
29
- if (optEl) {
30
- if (dragLineEl) {
31
- if (showLine) {
32
- const optRect = optEl.getBoundingClientRect()
33
- dragLineEl.style.display = 'block'
34
- dragLineEl.style.left = `${Math.max(0, customBodyRect.x - bodyWrapperRect.x)}px`
35
- dragLineEl.style.top = `${Math.max(1, optRect.y + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`
36
- dragLineEl.style.height = `${optRect.height}px`
37
- dragLineEl.style.width = `${optRect.width}px`
38
- dragLineEl.setAttribute('drag-pos', dragPos)
39
- dragLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n')
40
- } else {
41
- dragLineEl.style.display = ''
42
- }
43
- }
44
- } else {
45
- if (dragLineEl) {
46
- dragLineEl.style.display = 'node'
47
- }
48
- }
49
- const dragTipEl = $xeTableCustomPanel.$refs.refDragTipElem as HTMLDivElement
50
- if (dragTipEl) {
51
- dragTipEl.style.display = 'block'
52
- dragTipEl.style.top = `${Math.min(bodyWrapperElem.clientHeight + bodyWrapperElem.scrollTop - dragTipEl.clientHeight, evnt.clientY + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`
53
- dragTipEl.style.left = `${Math.min(bodyWrapperElem.clientWidth + bodyWrapperElem.scrollLeft - dragTipEl.clientWidth, evnt.clientX + bodyWrapperElem.scrollLeft - bodyWrapperRect.x)}px`
54
- dragTipEl.setAttribute('drag-status', showLine ? (prevDragToChild ? 'sub' : 'normal') : 'disabled')
55
- }
56
- }
57
-
58
- function hideDropTip ($xeTableCustomPanel: VxeTableCustomPanelConstructor) {
59
- const dragTipEl = $xeTableCustomPanel.$refs.refDragTipElem as HTMLDivElement
60
- const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem as HTMLDivElement
61
- if (dragTipEl) {
62
- dragTipEl.style.display = ''
63
- }
64
- if (dragLineEl) {
65
- dragLineEl.style.display = ''
66
- }
67
- }
68
-
69
- export default /* define-vxe-component start */ defineVxeComponent({
70
- name: 'VxeTableCustomPanel',
71
- props: {
72
- customStore: {
73
- type: Object as PropType<VxeTableDefines.VxeTableCustomStoreObj>,
74
- default: () => ({} as VxeTableDefines.VxeTableCustomStoreObj)
75
- }
76
- },
77
- provide () {
78
- const $xeTableCustomPanel = this
79
-
80
- return {
81
- $xeTableCustomPanel
82
- }
83
- },
84
- inject: {
85
- $xeTable: {
86
- default: null
87
- }
88
- },
89
- data () {
90
- const reactData: TableCustomPanelReactData = {
91
- dragCol: null,
92
- dragGroupField: null,
93
- dragAggFnCol: null,
94
- dragTipText: ''
95
- }
96
-
97
- const internalData: TableCustomPanelInternalData = {
98
- // prevDragCol: undefined,
99
- // prevDragGroupField: undefined,
100
- // prevDragAggFnColid: undefined,
101
- // prevDragToChild: false,
102
- // prevDragPos: null
103
- }
104
-
105
- return {
106
- reactData,
107
- internalData
108
- }
109
- },
110
- computed: {
111
- ...({} as {
112
- $xeTable(): VxeTableConstructor & VxeTablePrivateMethods
113
- })
114
- },
115
- created () {
116
- const $xeTableCustomPanel = this
117
-
118
- const VxeUIModalComponent = VxeUI.getComponent('VxeModal')
119
- const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer')
120
- const VxeUIButtonComponent = VxeUI.getComponent('VxeButton')
121
- const VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput')
122
- const VxeUIRadioGroupComponent = VxeUI.getComponent('VxeRadioGroup')
123
-
124
- $xeTableCustomPanel.$nextTick(() => {
125
- const $xeTable = $xeTableCustomPanel.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
126
-
127
- const { customOpts } = $xeTable
128
- const { mode } = customOpts
129
- if (!VxeUIModalComponent && (mode === 'modal')) {
130
- errLog('vxe.error.reqComp', ['vxe-modal'])
131
- }
132
- if (!VxeUIDrawerComponent && (mode === 'drawer')) {
133
- errLog('vxe.error.reqComp', ['vxe-drawer'])
134
- }
135
- if (!VxeUIButtonComponent) {
136
- errLog('vxe.error.reqComp', ['vxe-button'])
137
- }
138
- if (!VxeUINumberInputComponent) {
139
- errLog('vxe.error.reqComp', ['vxe-number-input'])
140
- }
141
- if (!VxeUIRadioGroupComponent) {
142
- errLog('vxe.error.reqComp', ['vxe-radio-group'])
143
- }
144
- })
145
- },
146
- methods: {
147
- handleWrapperMouseenterEvent (evnt: any) {
148
- const $xeTableCustomPanel = this
149
- const props = $xeTableCustomPanel
150
- const $xeTable = $xeTableCustomPanel.$xeTable
151
-
152
- const { customStore } = props
153
- customStore.activeWrapper = true
154
- $xeTable.customOpenEvent(evnt)
155
- },
156
- handleWrapperMouseleaveEvent (evnt: any) {
157
- const $xeTableCustomPanel = this
158
- const $xeTable = $xeTableCustomPanel.$xeTable
159
- const props = $xeTableCustomPanel
160
-
161
- const { customStore } = props
162
- customStore.activeWrapper = false
163
- setTimeout(() => {
164
- if (!customStore.activeBtn && !customStore.activeWrapper) {
165
- $xeTable.customCloseEvent(evnt)
166
- }
167
- }, 300)
168
- },
169
- getStoreData () {
170
- return {}
171
- },
172
- confirmCustomEvent ({ $event }: VxeButtonDefines.ClickEventParams) {
173
- const $xeTableCustomPanel = this
174
- const $xeTable = $xeTableCustomPanel.$xeTable
175
- const tableReactData = $xeTable as unknown as TableReactData
176
-
177
- tableReactData.isCustomStatus = true
178
- $xeTable.saveCustom()
179
- $xeTable.closeCustom()
180
- $xeTable.emitCustomEvent('confirm', $event)
181
- $xeTable.emitCustomEvent('close', $event)
182
- },
183
- cancelCloseEvent ({ $event }: VxeButtonDefines.ClickEventParams) {
184
- const $xeTableCustomPanel = this
185
- const $xeTable = $xeTableCustomPanel.$xeTable
186
-
187
- $xeTable.closeCustom()
188
- $xeTable.emitCustomEvent('close', $event)
189
- },
190
- cancelCustomEvent ({ $event }: VxeButtonDefines.ClickEventParams) {
191
- const $xeTableCustomPanel = this
192
- const $xeTable = $xeTableCustomPanel.$xeTable
193
-
194
- $xeTable.cancelCustom()
195
- $xeTable.closeCustom()
196
- $xeTable.emitCustomEvent('cancel', $event)
197
- $xeTable.emitCustomEvent('close', $event)
198
- },
199
- handleResetCustomEvent (evnt: Event) {
200
- const $xeTableCustomPanel = this
201
- const $xeTable = $xeTableCustomPanel.$xeTable
202
-
203
- $xeTable.resetCustom(true)
204
- $xeTable.closeCustom()
205
- $xeTable.emitCustomEvent('reset', evnt)
206
- $xeTable.emitCustomEvent('close', evnt)
207
- },
208
- resetCustomEvent (evnt: Event) {
209
- if (VxeUI.modal) {
210
- VxeUI.modal.confirm({
211
- content: getI18n('vxe.custom.cstmConfirmRestore'),
212
- className: 'vxe-table--ignore-clear',
213
- escClosable: true
214
- }).then(type => {
215
- if (type === 'confirm') {
216
- this.handleResetCustomEvent(evnt)
217
- }
218
- })
219
- } else {
220
- this.handleResetCustomEvent(evnt)
221
- }
222
- },
223
- handleOptionCheck (column: VxeTableDefines.ColumnInfo) {
224
- const $xeTableCustomPanel = this
225
- const $xeTable = $xeTableCustomPanel.$xeTable
226
- const tableReactData = $xeTable as unknown as TableReactData
227
-
228
- const { customColumnList } = tableReactData
229
- const matchObj = XEUtils.findTree(customColumnList, item => item === column)
230
- if (matchObj && matchObj.parent) {
231
- const { parent } = matchObj
232
- if (parent.children && parent.children.length) {
233
- parent.renderVisible = parent.children.every((column) => column.renderVisible)
234
- parent.halfVisible = !parent.renderVisible && parent.children.some((column) => column.renderVisible || column.halfVisible)
235
- this.handleOptionCheck(parent)
236
- }
237
- }
238
- },
239
- changeCheckboxOption (column: VxeTableDefines.ColumnInfo, evnt: MouseEvent) {
240
- const $xeTableCustomPanel = this
241
- const $xeTable = $xeTableCustomPanel.$xeTable
242
- const tableReactData = $xeTable as unknown as TableReactData
243
-
244
- const isChecked = !column.renderVisible
245
- const customOpts = $xeTable.computeCustomOpts
246
- if (customOpts.immediate) {
247
- XEUtils.eachTree([column], (item) => {
248
- item.visible = isChecked
249
- item.renderVisible = isChecked
250
- item.halfVisible = false
251
- })
252
- tableReactData.isCustomStatus = true
253
- $xeTable.handleCustom()
254
- $xeTable.saveCustomStore('update:visible')
255
- } else {
256
- XEUtils.eachTree([column], (item) => {
257
- item.renderVisible = isChecked
258
- item.halfVisible = false
259
- })
260
- }
261
- this.handleOptionCheck(column)
262
- $xeTable.checkCustomStatus()
263
- $xeTable.dispatchEvent('custom-visible-change', { column, checked: isChecked }, evnt)
264
- },
265
- changeColumnWidth (column: VxeTableDefines.ColumnInfo) {
266
- const $xeTableCustomPanel = this
267
- const $xeTable = $xeTableCustomPanel.$xeTable
268
- const tableReactData = $xeTable as unknown as TableReactData
269
-
270
- const customOpts = $xeTable.computeCustomOpts
271
- if (customOpts.immediate) {
272
- if (column.renderResizeWidth !== column.renderWidth) {
273
- column.resizeWidth = column.renderResizeWidth
274
- column.renderWidth = column.renderResizeWidth
275
- tableReactData.isCustomStatus = true
276
- $xeTable.handleCustom()
277
- $xeTable.saveCustomStore('update:width')
278
- }
279
- }
280
- },
281
- changeFixedOption (column: VxeTableDefines.ColumnInfo, colFixed: VxeColumnPropTypes.Fixed, evnt: Event) {
282
- const $xeTableCustomPanel = this
283
- const $xeTable = $xeTableCustomPanel.$xeTable
284
- const tableReactData = $xeTable as unknown as TableReactData
285
-
286
- const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
287
- const customOpts = $xeTable.computeCustomOpts
288
- let targetFixed: VxeColumnPropTypes.Fixed = null
289
- if (customOpts.immediate) {
290
- if (column.renderFixed === colFixed) {
291
- targetFixed = ''
292
- XEUtils.eachTree([column], col => {
293
- col.fixed = ''
294
- col.renderFixed = ''
295
- })
296
- } else {
297
- if (!isMaxFixedColumn || column.renderFixed) {
298
- targetFixed = colFixed
299
- XEUtils.eachTree([column], col => {
300
- col.fixed = colFixed
301
- col.renderFixed = colFixed
302
- })
303
- }
304
- }
305
- tableReactData.isCustomStatus = true
306
- $xeTable.handleCustom()
307
- $xeTable.saveCustomStore('update:fixed')
308
- } else {
309
- if (column.renderFixed === colFixed) {
310
- targetFixed = ''
311
- XEUtils.eachTree([column], col => {
312
- col.renderFixed = ''
313
- })
314
- } else {
315
- if (!isMaxFixedColumn || column.renderFixed) {
316
- targetFixed = colFixed
317
- XEUtils.eachTree([column], col => {
318
- col.renderFixed = colFixed
319
- })
320
- }
321
- }
322
- }
323
- if (targetFixed !== null) {
324
- $xeTable.dispatchEvent('custom-fixed-change', { column, fixed: targetFixed }, evnt)
325
- }
326
- },
327
- allOptionEvent (evnt: MouseEvent) {
328
- const $xeTableCustomPanel = this
329
- const $xeTable = $xeTableCustomPanel.$xeTable
330
- const tableReactData = $xeTable as unknown as TableReactData
331
-
332
- const { customStore } = tableReactData
333
- const isAll = !customStore.isAll
334
- $xeTable.toggleCustomAllCheckbox()
335
- $xeTable.dispatchEvent('custom-visible-all', { checked: isAll }, evnt)
336
- },
337
- updateColDropTipContent () {
338
- const $xeTableCustomPanel = this
339
- const $xeTable = $xeTableCustomPanel.$xeTable
340
- const customPanelReactData = $xeTableCustomPanel.reactData
341
-
342
- const { dragCol } = customPanelReactData
343
- const columnDragOpts = $xeTable.computeColumnDragOpts
344
- const { tooltipMethod } = columnDragOpts
345
- let tipContent = ''
346
- if (tooltipMethod) {
347
- const dtParams = {
348
- $table: $xeTable,
349
- column: dragCol as VxeTableDefines.ColumnInfo
350
- }
351
- tipContent = `${tooltipMethod(dtParams) || ''}`
352
- } else {
353
- tipContent = getI18n('vxe.custom.cstmDragTarget', [dragCol && dragCol.type !== 'html' ? dragCol.getTitle() : ''])
354
- }
355
- customPanelReactData.dragTipText = tipContent
356
- },
357
- sortMousedownEvent (evnt: MouseEvent) {
358
- const $xeTableCustomPanel = this
359
- const $xeTable = $xeTableCustomPanel.$xeTable
360
- const customPanelReactData = $xeTableCustomPanel.reactData
361
-
362
- const btnEl = evnt.currentTarget as HTMLElement
363
- const cellEl = btnEl.parentElement as HTMLElement
364
- const tdEl = cellEl.parentElement as HTMLElement
365
- const trEl = tdEl.parentElement as HTMLElement
366
- const colid = trEl.getAttribute('colid')
367
- const column = $xeTable.getColumnById(colid)
368
- trEl.draggable = true
369
- customPanelReactData.dragCol = column
370
- customPanelReactData.dragGroupField = null
371
- customPanelReactData.dragAggFnCol = null
372
- this.updateColDropTipContent()
373
- addClass(trEl, 'active--drag-origin')
374
- },
375
- sortMouseupEvent (evnt: MouseEvent) {
376
- const $xeTableCustomPanel = this as unknown as VxeTableCustomPanelConstructor
377
- const customPanelReactData = $xeTableCustomPanel.reactData
378
-
379
- const btnEl = evnt.currentTarget as HTMLElement
380
- const cellEl = btnEl.parentElement as HTMLElement
381
- const tdEl = cellEl.parentElement as HTMLElement
382
- const trEl = tdEl.parentElement as HTMLElement
383
- hideDropTip($xeTableCustomPanel)
384
- trEl.draggable = false
385
- customPanelReactData.dragCol = null
386
- customPanelReactData.dragGroupField = null
387
- customPanelReactData.dragAggFnCol = null
388
- removeClass(trEl, 'active--drag-origin')
389
- },
390
- sortDragstartEvent (evnt: any) {
391
- const $xeTableCustomPanel = this
392
- const customPanelInternalData = $xeTableCustomPanel.internalData
393
-
394
- if (evnt.dataTransfer) {
395
- evnt.dataTransfer.setDragImage(getTpImg(), 0, 0)
396
- }
397
- customPanelInternalData.prevDragGroupField = null
398
- customPanelInternalData.prevDragAggFnColid = null
399
- },
400
- sortDragendEvent (evnt: any) {
401
- const $xeTableCustomPanel = this as unknown as VxeTableCustomPanelConstructor
402
- const $xeTable = $xeTableCustomPanel.$xeTable
403
- const tableProps = $xeTable
404
- const tableReactData = $xeTable as unknown as TableReactData
405
- const tableInternalData = $xeTable as unknown as TableInternalData
406
- const customPanelReactData = $xeTableCustomPanel.reactData
407
- const customPanelInternalData = $xeTableCustomPanel.internalData
408
-
409
- const { mouseConfig } = tableProps
410
- const { customColumnList } = tableReactData
411
- const { collectColumn } = tableInternalData
412
- const customOpts = $xeTable.computeCustomOpts
413
- const { immediate } = customOpts
414
- const trEl = evnt.currentTarget as HTMLElement
415
- const columnDragOpts = $xeTable.computeColumnDragOpts
416
- const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
417
- const { dragCol } = customPanelReactData
418
- const { prevDragCol, prevDragGroupField, prevDragAggFnColid, prevDragPos, prevDragToChild } = customPanelInternalData
419
- const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
420
-
421
- if (prevDragGroupField || prevDragAggFnColid) {
422
- if ($xeTable.handlePivotTableAggregatePanelDragendEvent) {
423
- $xeTable.handlePivotTableAggregatePanelDragendEvent(evnt)
424
- }
425
- } else if (prevDragCol && dragCol) {
426
- // 判断是否有拖动
427
- if (prevDragCol !== dragCol) {
428
- const dragColumn: VxeTableDefines.ColumnInfo = dragCol
429
- const newColumn: VxeTableDefines.ColumnInfo = prevDragCol
430
- Promise.resolve(
431
- dragEndMethod
432
- ? dragEndMethod({
433
- oldColumn: dragColumn,
434
- newColumn,
435
- dragColumn,
436
- dragPos: prevDragPos as any,
437
- dragToChild: !!prevDragToChild,
438
- offsetIndex: dragOffsetIndex
439
- })
440
- : true
441
- ).then((status) => {
442
- if (!status) {
443
- return
444
- }
445
-
446
- let oafIndex = -1
447
- let nafIndex = -1
448
-
449
- const oldAllMaps: Record<string, any> = {}
450
- XEUtils.eachTree([dragColumn], column => {
451
- oldAllMaps[column.id] = column
452
- })
453
-
454
- let isSelfToChildStatus = false
455
-
456
- // 只有实时拖拽支持跨层级
457
- if (immediate) {
458
- if (dragColumn.parentId && newColumn.parentId) {
459
- // 子到子
460
-
461
- if (!isCrossDrag) {
462
- return
463
- }
464
- if (oldAllMaps[newColumn.id]) {
465
- isSelfToChildStatus = true
466
- if (!(isCrossDrag && isSelfToChildDrag)) {
467
- if (VxeUI.modal) {
468
- VxeUI.modal.message({
469
- status: 'error',
470
- content: getI18n('vxe.error.treeDragChild')
471
- })
472
- }
473
- return
474
- }
475
- }
476
- } else if (dragColumn.parentId) {
477
- // 子到根
478
-
479
- if (!isCrossDrag) {
480
- return
481
- }
482
- } else if (newColumn.parentId) {
483
- // 根到子
484
-
485
- if (!isCrossDrag) {
486
- return
487
- }
488
- if (oldAllMaps[newColumn.id]) {
489
- isSelfToChildStatus = true
490
- if (!(isCrossDrag && isSelfToChildDrag)) {
491
- if (VxeUI.modal) {
492
- VxeUI.modal.message({
493
- status: 'error',
494
- content: getI18n('vxe.error.treeDragChild')
495
- })
496
- }
497
- return
498
- }
499
- }
500
- } else {
501
- // 根到根
502
- }
503
-
504
- const oldewMatchRest = XEUtils.findTree(collectColumn as VxeTableDefines.ColumnInfo[], item => item.id === dragColumn.id)
505
-
506
- // 改变层级
507
- if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
508
- if (oldewMatchRest) {
509
- const { items: oCols, index: oIndex } = oldewMatchRest
510
- const childList = dragColumn.children || []
511
- childList.forEach(column => {
512
- column.parentId = dragColumn.parentId
513
- })
514
- oCols.splice(oIndex, 1, ...childList)
515
- dragColumn.children = []
516
- }
517
- } else {
518
- if (oldewMatchRest) {
519
- const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest
520
- oCols.splice(oIndex, 1)
521
- if (!oParent) {
522
- oafIndex = oIndex
523
- }
524
- }
525
- }
526
-
527
- const newMatchRest = XEUtils.findTree(collectColumn as VxeTableDefines.ColumnInfo[], item => item.id === newColumn.id)
528
- if (newMatchRest) {
529
- const { items: nCols, index: nIndex, parent: nParent } = newMatchRest
530
- // 转子级
531
- if ((isCrossDrag && isToChildDrag) && prevDragToChild) {
532
- dragColumn.parentId = newColumn.id
533
- newColumn.children = (newColumn.children || []).concat([dragColumn])
534
- } else {
535
- dragColumn.parentId = newColumn.parentId
536
- nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn)
537
- }
538
- if (!nParent) {
539
- nafIndex = nIndex
540
- }
541
- }
542
-
543
- XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
544
- if (!parent) {
545
- const sortIndex = index + 1
546
- column.renderSortNumber = sortIndex
547
- }
548
- })
549
- } else {
550
- oafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === dragColumn.id)
551
- customColumnList.splice(oafIndex, 1)
552
-
553
- nafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === newColumn.id)
554
- customColumnList.splice(nafIndex + dragOffsetIndex, 0, dragColumn)
555
- }
556
-
557
- if (mouseConfig) {
558
- if ($xeTable.clearSelected) {
559
- $xeTable.clearSelected()
560
- }
561
- if ($xeTable.clearCellAreas) {
562
- $xeTable.clearCellAreas()
563
- $xeTable.clearCopyCellArea()
564
- }
565
- }
566
-
567
- const csParams = {
568
- oldColumn: dragColumn,
569
- newColumn,
570
- dragColumn,
571
- dragPos: prevDragPos,
572
- offsetIndex: dragOffsetIndex,
573
- _index: {
574
- newIndex: nafIndex,
575
- oldIndex: oafIndex
576
- }
577
- }
578
- $xeTable.dispatchEvent('custom-sort-change', csParams, evnt)
579
- $xeTable.dispatchEvent('column-dragend', csParams, evnt)
580
-
581
- if (immediate) {
582
- tableReactData.customColumnList = collectColumn.slice(0)
583
- $xeTable.handleColDragSwapColumn()
584
- }
585
- }).catch(() => {
586
- })
587
- }
588
- }
589
-
590
- hideDropTip($xeTableCustomPanel)
591
- customPanelReactData.dragCol = null
592
- customPanelReactData.dragGroupField = null
593
- customPanelReactData.dragAggFnCol = null
594
- customPanelInternalData.prevDragGroupField = null
595
- customPanelInternalData.prevDragAggFnColid = null
596
- trEl.draggable = false
597
- trEl.removeAttribute('drag-pos')
598
- removeClass(trEl, 'active--drag-target')
599
- removeClass(trEl, 'active--drag-origin')
600
- },
601
- sortDragoverEvent (evnt: DragEvent) {
602
- const $xeTableCustomPanel = this as unknown as VxeTableCustomPanelConstructor
603
- const $xeTable = $xeTableCustomPanel.$xeTable
604
- const customPanelReactData = $xeTableCustomPanel.reactData
605
- const customPanelInternalData = $xeTableCustomPanel.internalData
606
-
607
- const { dragCol } = customPanelReactData
608
- const customOpts = $xeTable.computeCustomOpts
609
- const { immediate } = customOpts
610
- const columnDragOpts = $xeTable.computeColumnDragOpts
611
- const { isCrossDrag, isToChildDrag } = columnDragOpts
612
- const optEl = evnt.currentTarget as HTMLElement
613
- const isControlKey = hasControlKey(evnt)
614
- const colid = optEl.getAttribute('colid')
615
- const column = $xeTable.getColumnById(colid)
616
- customPanelInternalData.prevDragGroupField = null
617
- customPanelInternalData.prevDragAggFnColid = null
618
- // 是否移入有效列
619
- if (column && (isCrossDrag || column.level === 1)) {
620
- evnt.preventDefault()
621
- const offsetY = evnt.clientY - optEl.getBoundingClientRect().y
622
- const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom'
623
- if (
624
- !dragCol ||
625
- (dragCol && dragCol.id === column.id) ||
626
- (!isCrossDrag && column.level > 1) ||
627
- (!immediate && column.level > 1)
628
- ) {
629
- showDropTip($xeTableCustomPanel, evnt, optEl, false, dragPos)
630
- return
631
- }
632
- customPanelInternalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) && isControlKey && immediate)
633
- customPanelInternalData.prevDragCol = column
634
- customPanelInternalData.prevDragPos = dragPos
635
- showDropTip($xeTableCustomPanel, evnt, optEl, true, dragPos)
636
- }
637
- },
638
-
639
- renderDragTip (h: CreateElement) {
640
- const $xeTableCustomPanel = this
641
- const $xeTable = $xeTableCustomPanel.$xeTable
642
- const customPanelReactData = $xeTableCustomPanel.reactData
643
-
644
- const { dragTipText } = customPanelReactData
645
- const columnDragOpts = $xeTable.computeColumnDragOpts
646
- return h('div', {}, [
647
- h('div', {
648
- ref: 'refDragLineElem',
649
- class: ['vxe-table-custom-popup--drag-line', {
650
- 'is--guides': columnDragOpts.showGuidesStatus
651
- }]
652
- }),
653
- h('div', {
654
- ref: 'refDragTipElem',
655
- class: 'vxe-table-custom-popup--drag-tip'
656
- }, [
657
- h('div', {
658
- class: 'vxe-table-custom-popup--drag-tip-wrapper'
659
- }, [
660
- h('div', {
661
- class: 'vxe-table-custom-popup--drag-tip-status'
662
- }, [
663
- h('span', {
664
- class: ['vxe-table-custom-popup--drag-tip-normal-status', getIcon().TABLE_DRAG_STATUS_ROW]
665
- }),
666
- h('span', {
667
- class: ['vxe-table-custom-popup--drag-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
668
- }),
669
- h('span', {
670
- class: ['vxe-table-custom-popup--drag-tip-group-status', getIcon().TABLE_DRAG_STATUS_AGG_GROUP]
671
- }),
672
- h('span', {
673
- class: ['vxe-table-custom-popup--drag-tip-values-status', getIcon().TABLE_DRAG_STATUS_AGG_VALUES]
674
- }),
675
- h('span', {
676
- class: ['vxe-table-custom-popup--drag-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
677
- })
678
- ]),
679
- h('div', {
680
- class: 'vxe-table-custom-popup--drag-tip-content'
681
- }, `${dragTipText || ''}`)
682
- ])
683
- ])
684
- ])
685
- },
686
- renderSimplePanel (h: CreateElement) {
687
- const VxeUIButtonComponent = VxeUI.getComponent('VxeButton')
688
-
689
- const $xeTableCustomPanel = this
690
- const props = $xeTableCustomPanel
691
- const $xeTable = $xeTableCustomPanel.$xeTable
692
-
693
- const tableProps = $xeTable
694
- const tableReactData = $xeTable as unknown as TableReactData
695
- const $xeGrid = $xeTable.$xeGrid
696
- const $xeGantt = $xeTable.$xeGantt
697
-
698
- const { customStore } = props
699
- const { treeConfig, rowGroupConfig, aggregateConfig } = tableProps
700
- const { isCustomStatus, customColumnList } = tableReactData
701
- const customOpts = $xeTable.computeCustomOpts
702
- const { immediate } = customOpts
703
- const columnDragOpts = $xeTable.computeColumnDragOpts
704
- const { maxHeight, popupTop } = customStore
705
- const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts
706
- const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
707
- const { isCrossDrag } = columnDragOpts
708
- const slots = customOpts.slots || {}
709
- const headerSlot = slots.header
710
- const topSlot = slots.top
711
- const bottomSlot = slots.bottom
712
- const defaultSlot = slots.default
713
- const footerSlot = slots.footer
714
- const colVNs: any[] = []
715
- const customWrapperOns: any = {}
716
- const isAllChecked = customStore.isAll
717
- const isAllIndeterminate = customStore.isIndeterminate
718
- // hover 触发
719
- if (trigger === 'hover') {
720
- customWrapperOns.mouseenter = $xeTableCustomPanel.handleWrapperMouseenterEvent
721
- customWrapperOns.mouseleave = $xeTableCustomPanel.handleWrapperMouseleaveEvent
722
- }
723
- const params = {
724
- $table: $xeTable,
725
- $grid: $xeGrid,
726
- $gantt: $xeGantt,
727
- columns: customColumnList,
728
- isAllChecked,
729
- isAllIndeterminate,
730
- isCustomStatus
731
- }
732
- XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
733
- const isVisible = visibleMethod ? visibleMethod({ $table: $xeTable, column }) : true
734
- if (isVisible) {
735
- const isChecked = column.renderVisible
736
- const isIndeterminate = column.halfVisible
737
- const isColGroup = column.children && column.children.length
738
- const colTitle = formatText(column.getTitle(), 1)
739
- const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
740
- const isHidden = !isChecked
741
- colVNs.push(
742
- h('li', {
743
- key: column.id,
744
- attrs: {
745
- colid: column.id
746
- },
747
- class: ['vxe-table-custom--option', `level--${column.level}`, {
748
- 'is--hidden': isDisabled || isHidden,
749
- 'is--group': isColGroup
750
- }],
751
- on: {
752
- dragstart: $xeTableCustomPanel.sortDragstartEvent,
753
- dragend: $xeTableCustomPanel.sortDragendEvent,
754
- dragover: $xeTableCustomPanel.sortDragoverEvent
755
- }
756
- }, [
757
- allowVisible
758
- ? h('div', {
759
- class: ['vxe-table-custom--checkbox-option', {
760
- 'is--checked': isChecked,
761
- 'is--indeterminate': isIndeterminate,
762
- 'is--disabled': isDisabled
763
- }],
764
- attrs: {
765
- title: getI18n('vxe.custom.setting.colVisible')
766
- },
767
- on: {
768
- click: (evnt: MouseEvent) => {
769
- if (!isDisabled) {
770
- $xeTableCustomPanel.changeCheckboxOption(column, evnt)
771
- }
772
- }
773
- }
774
- }, [
775
- h('span', {
776
- class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
777
- })
778
- ])
779
- : renderEmptyElement($xeTable),
780
- h('div', {
781
- class: 'vxe-table-custom--name-option'
782
- }, [
783
- allowSort && ((isCrossDrag ? immediate : false) || column.level === 1)
784
- ? h('div', {
785
- class: 'vxe-table-custom--sort-option'
786
- }, [
787
- h('span', {
788
- class: ['vxe-table-custom--sort-btn', {
789
- 'is--disabled': isHidden
790
- }],
791
- attrs: {
792
- title: getI18n('vxe.custom.setting.sortHelpTip')
793
- },
794
- on: isHidden
795
- ? {}
796
- : {
797
- mousedown: $xeTableCustomPanel.sortMousedownEvent,
798
- mouseup: $xeTableCustomPanel.sortMouseupEvent
799
- }
800
- }, [
801
- h('i', {
802
- class: getIcon().TABLE_CUSTOM_SORT
803
- })
804
- ])
805
- ])
806
- : renderEmptyElement($xeTable),
807
- column.type === 'html'
808
- ? h('div', {
809
- key: '1',
810
- class: 'vxe-table-custom--checkbox-label',
811
- domProps: {
812
- innerHTML: colTitle
813
- }
814
- })
815
- : h('div', {
816
- key: '0',
817
- class: 'vxe-table-custom--checkbox-label',
818
- attrs: {
819
- title: colTitle
820
- }
821
- }, colTitle)
822
- ]),
823
- !parent && allowFixed
824
- ? h('div', {
825
- class: 'vxe-table-custom--fixed-option'
826
- }, [
827
- h(VxeUIButtonComponent, {
828
- props: {
829
- mode: 'text',
830
- icon: column.renderFixed === 'left' ? getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_LEFT,
831
- status: column.renderFixed === 'left' ? 'primary' : '',
832
- disabled: isHidden || (isMaxFixedColumn && !column.renderFixed),
833
- title: getI18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft')
834
- },
835
- on: {
836
- click: ({ $event }: VxeButtonDefines.ClickEventParams) => {
837
- $xeTableCustomPanel.changeFixedOption(column, 'left', $event)
838
- }
839
- }
840
- }),
841
- h(VxeUIButtonComponent, {
842
- props: {
843
- mode: 'text',
844
- icon: column.renderFixed === 'right' ? getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,
845
- status: column.renderFixed === 'right' ? 'primary' : '',
846
- disabled: isHidden || (isMaxFixedColumn && !column.renderFixed),
847
- title: getI18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight')
848
- },
849
- on: {
850
- click: ({ $event }: VxeButtonDefines.ClickEventParams) => {
851
- $xeTableCustomPanel.changeFixedOption(column, 'right', $event)
852
- }
853
- }
854
- })
855
- ])
856
- : renderEmptyElement($xeTable)
857
- ])
858
- )
859
- }
860
- })
861
- const popupStys: VxeComponentStyleType = {}
862
- if (maxHeight && !['left', 'right'].includes(placement || '')) {
863
- if (popupTop) {
864
- popupStys.top = toCssUnit(popupTop)
865
- }
866
- popupStys.maxHeight = toCssUnit(maxHeight)
867
- }
868
- return h('div', {
869
- ref: 'refElem',
870
- key: 'simple',
871
- class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
872
- 'is--active': customStore.visible
873
- }],
874
- style: popupStys
875
- }, customStore.visible
876
- ? [
877
- h('div', {
878
- ref: 'refBodyWrapperElem',
879
- class: 'vxe-table-custom-simple--body-wrapper'
880
- }, [
881
- !treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregateSimplePanel
882
- ? h($xeTable.getPivotTableAggregateSimplePanel(), {
883
- props: {
884
- customStore
885
- }
886
- })
887
- : renderEmptyElement($xeTable),
888
- h('div', {
889
- ref: 'refCustomBodyElem',
890
- class: 'vxe-table-custom--handle-wrapper'
891
- }, [
892
- h('div', {
893
- class: 'vxe-table-custom--header'
894
- }, headerSlot
895
- ? $xeTable.callSlot(headerSlot, params, h)
896
- : [
897
- h('ul', {
898
- class: 'vxe-table-custom--panel-list'
899
- }, [
900
- h('li', {
901
- class: 'vxe-table-custom--option'
902
- }, [
903
- allowVisible
904
- ? h('div', {
905
- class: ['vxe-table-custom--checkbox-option', {
906
- 'is--checked': isAllChecked,
907
- 'is--indeterminate': isAllIndeterminate
908
- }],
909
- attrs: {
910
- title: getI18n('vxe.table.allTitle')
911
- },
912
- on: {
913
- click: $xeTableCustomPanel.allOptionEvent
914
- }
915
- }, [
916
- h('span', {
917
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
918
- }),
919
- h('span', {
920
- class: 'vxe-checkbox--label'
921
- }, getI18n('vxe.toolbar.customAll'))
922
- ])
923
- : h('span', {
924
- class: 'vxe-checkbox--label'
925
- }, getI18n('vxe.table.customTitle'))
926
- ])
927
- ])
928
- ]),
929
- h('div', {
930
- class: 'vxe-table-custom--body'
931
- }, [
932
- topSlot
933
- ? h('div', {
934
- class: 'vxe-table-custom--panel-top'
935
- }, $xeTable.callSlot(topSlot, params, h))
936
- : renderEmptyElement($xeTable),
937
- defaultSlot
938
- ? h('div', {
939
- class: 'vxe-table-custom--panel-body'
940
- }, $xeTable.callSlot(defaultSlot, params, h))
941
- : h('transition-group', {
942
- class: 'vxe-table-custom--panel-list',
943
- props: {
944
- name: 'vxe-table-custom--list',
945
- tag: 'ul'
946
- },
947
- on: customWrapperOns
948
- }, colVNs),
949
- bottomSlot
950
- ? h('div', {
951
- class: 'vxe-table-custom--panel-bottom'
952
- }, $xeTable.callSlot(bottomSlot, params, h))
953
- : renderEmptyElement($xeTable)
954
- ]),
955
- customOpts.showFooter
956
- ? h('div', {
957
- class: 'vxe-table-custom--footer'
958
- }, footerSlot
959
- ? $xeTable.callSlot(footerSlot, params, h)
960
- : [
961
- h('div', {
962
- class: 'vxe-table-custom--footer-buttons'
963
- }, [
964
- h(VxeUIButtonComponent, {
965
- props: {
966
- mode: 'text',
967
- content: customOpts.resetButtonText || getI18n('vxe.table.customRestore'),
968
- disabled: !isCustomStatus
969
- },
970
- on: {
971
- click: $xeTableCustomPanel.resetCustomEvent
972
- }
973
- }),
974
- immediate
975
- ? h(VxeUIButtonComponent, {
976
- props: {
977
- mode: 'text',
978
- content: customOpts.closeButtonText || getI18n('vxe.table.customClose')
979
- },
980
- on: {
981
- click: $xeTableCustomPanel.cancelCloseEvent
982
- }
983
- })
984
- : h(VxeUIButtonComponent, {
985
- props: {
986
- mode: 'text',
987
- content: customOpts.resetButtonText || getI18n('vxe.table.customCancel')
988
- },
989
- on: {
990
- click: $xeTableCustomPanel.cancelCustomEvent
991
- }
992
- }),
993
- immediate
994
- ? renderEmptyElement($xeTable)
995
- : h(VxeUIButtonComponent, {
996
- props: {
997
- mode: 'text',
998
- status: 'primary',
999
- content: customOpts.confirmButtonText || getI18n('vxe.table.customConfirm')
1000
- },
1001
- on: {
1002
- click: $xeTableCustomPanel.confirmCustomEvent
1003
- }
1004
- })
1005
- ])
1006
- ])
1007
- : null
1008
- ]),
1009
- $xeTableCustomPanel.renderDragTip(h)
1010
- ])
1011
- ]
1012
- : [])
1013
- },
1014
- renderPopupPanel (h: CreateElement) {
1015
- const VxeUIModalComponent = VxeUI.getComponent('VxeModal')
1016
- const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer')
1017
- const VxeUIButtonComponent = VxeUI.getComponent('VxeButton')
1018
- const VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput')
1019
-
1020
- const $xeTableCustomPanel = this
1021
- const props = $xeTableCustomPanel
1022
- const $xeTable = $xeTableCustomPanel.$xeTable
1023
- const tableProps = $xeTable
1024
- const tableReactData = $xeTable as unknown as TableReactData
1025
- const $xeGrid = $xeTable.$xeGrid
1026
- const $xeGantt = $xeTable.$xeGantt
1027
-
1028
- const { customStore } = props
1029
- const { treeConfig, rowGroupConfig, aggregateConfig, resizable: allResizable } = tableProps
1030
- const { isCustomStatus, customColumnList } = tableReactData
1031
- const customOpts = $xeTable.computeCustomOpts
1032
- const { immediate } = customOpts
1033
- const columnDragOpts = $xeTable.computeColumnDragOpts
1034
- const { mode, modalOptions, drawerOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts
1035
- const columnOpts = $xeTable.computeColumnOpts
1036
- const { maxFixedSize } = columnOpts
1037
- const resizableOpts = $xeTable.computeResizableOpts
1038
- const { minWidth: reMinWidth, maxWidth: reMaxWidth } = resizableOpts
1039
- const modalOpts = Object.assign({}, modalOptions)
1040
- const drawerOpts = Object.assign({}, drawerOptions)
1041
- const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
1042
- const { isCrossDrag } = columnDragOpts
1043
- const slots = customOpts.slots || {}
1044
- const headerSlot = slots.header
1045
- const topSlot = slots.top
1046
- const bottomSlot = slots.bottom
1047
- const defaultSlot = slots.default
1048
- const footerSlot = slots.footer
1049
- const trVNs: VNode[] = []
1050
- const isAllChecked = customStore.isAll
1051
- const isAllIndeterminate = customStore.isIndeterminate
1052
- const params = {
1053
- $table: $xeTable,
1054
- $grid: $xeGrid,
1055
- $gantt: $xeGantt,
1056
- columns: customColumnList,
1057
- isAllChecked,
1058
- isAllIndeterminate,
1059
- isCustomStatus
1060
- }
1061
- XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
1062
- const isVisible = visibleMethod ? visibleMethod({ $table: $xeTable, column }) : true
1063
- if (isVisible) {
1064
- // 默认继承调整宽度
1065
- let customMinWidth = 0
1066
- let customMaxWidth = 0
1067
- if (allowResizable) {
1068
- const resizeParams = {
1069
- $table: $xeTable,
1070
- column,
1071
- columnIndex: index,
1072
- $columnIndex: index,
1073
- $rowIndex: -1
1074
- }
1075
- if (reMinWidth) {
1076
- customMinWidth = XEUtils.toNumber(XEUtils.isFunction(reMinWidth) ? reMinWidth(resizeParams) : reMinWidth)
1077
- }
1078
- if (reMaxWidth) {
1079
- customMaxWidth = XEUtils.toNumber(XEUtils.isFunction(reMaxWidth) ? reMaxWidth(resizeParams) : reMaxWidth)
1080
- }
1081
- }
1082
-
1083
- const isChecked = column.renderVisible
1084
- const isIndeterminate = column.halfVisible
1085
- const colTitle = formatText(column.getTitle(), 1)
1086
- const isColGroup = column.children && column.children.length
1087
- const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
1088
- const isHidden = !isChecked
1089
- trVNs.push(
1090
- h('tr', {
1091
- key: column.id,
1092
- attrs: {
1093
- colid: column.id
1094
- },
1095
- class: [`vxe-table-custom-popup--row level--${column.level}`, {
1096
- 'is--group': isColGroup
1097
- }],
1098
- on: {
1099
- dragstart: $xeTableCustomPanel.sortDragstartEvent,
1100
- dragend: $xeTableCustomPanel.sortDragendEvent,
1101
- dragover: $xeTableCustomPanel.sortDragoverEvent
1102
- }
1103
- }, [
1104
- allowVisible
1105
- ? h('td', {
1106
- class: 'vxe-table-custom-popup--column-item col--visible'
1107
- }, [
1108
- h('div', {
1109
- class: ['vxe-table-custom--checkbox-option', {
1110
- 'is--checked': isChecked,
1111
- 'is--indeterminate': isIndeterminate,
1112
- 'is--disabled': isDisabled
1113
- }],
1114
- attrs: {
1115
- title: getI18n('vxe.custom.setting.colVisible')
1116
- },
1117
- on: {
1118
- click: (evnt: MouseEvent) => {
1119
- if (!isDisabled) {
1120
- $xeTableCustomPanel.changeCheckboxOption(column, evnt)
1121
- }
1122
- }
1123
- }
1124
- }, [
1125
- h('span', {
1126
- class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
1127
- })
1128
- ])
1129
- ])
1130
- : renderEmptyElement($xeTable),
1131
- h('td', {
1132
- class: 'vxe-table-custom-popup--column-item col--name'
1133
- }, [
1134
- h('div', {
1135
- class: 'vxe-table-custom-popup--name'
1136
- }, [
1137
- allowSort
1138
- ? ((isCrossDrag ? immediate : false) || column.level === 1
1139
- ? h('div', {
1140
- class: ['vxe-table-custom-popup--column-sort-btn', {
1141
- 'is--disabled': isHidden
1142
- }],
1143
- attrs: {
1144
- title: getI18n('vxe.custom.setting.sortHelpTip')
1145
- },
1146
- on: (isHidden
1147
- ? {}
1148
- : {
1149
- mousedown: $xeTableCustomPanel.sortMousedownEvent,
1150
- mouseup: $xeTableCustomPanel.sortMouseupEvent
1151
- })
1152
- }, [
1153
- h('i', {
1154
- class: getIcon().TABLE_CUSTOM_SORT
1155
- })
1156
- ])
1157
- : h('div', {
1158
- class: 'vxe-table-custom-popup--column-sort-placeholder'
1159
- }))
1160
- : renderEmptyElement($xeTable),
1161
- column.type === 'html'
1162
- ? h('div', {
1163
- key: '1',
1164
- class: 'vxe-table-custom-popup--title',
1165
- domProps: {
1166
- innerHTML: colTitle
1167
- }
1168
- })
1169
- : h('div', {
1170
- key: '0',
1171
- class: 'vxe-table-custom-popup--title',
1172
- attrs: {
1173
- title: colTitle
1174
- }
1175
- }, colTitle)
1176
- ])
1177
- ]),
1178
- allowResizable
1179
- ? h('td', {
1180
- class: 'vxe-table-custom-popup--column-item col--resizable'
1181
- }, [
1182
- (
1183
- (column.children && column.children.length) ||
1184
- !(XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
1185
- )
1186
- ? h('span', '-')
1187
- : (VxeUINumberInputComponent
1188
- ? h(VxeUINumberInputComponent, {
1189
- props: {
1190
- type: 'integer',
1191
- immediate: false,
1192
- disabled: isHidden,
1193
- value: column.renderResizeWidth,
1194
- min: customMinWidth || undefined,
1195
- max: customMaxWidth || undefined
1196
- },
1197
- on: {
1198
- modelValue (value: any) {
1199
- column.renderResizeWidth = Math.max(0, Number(value))
1200
- },
1201
- change () {
1202
- $xeTableCustomPanel.changeColumnWidth(column)
1203
- }
1204
- }
1205
- })
1206
- : renderEmptyElement($xeTableCustomPanel)
1207
- )
1208
- ])
1209
- : renderEmptyElement($xeTable),
1210
- allowFixed
1211
- ? h('td', {
1212
- class: 'vxe-table-custom-popup--column-item col--fixed'
1213
- }, [
1214
- parent
1215
- ? h('span', '-')
1216
- : h('vxe-radio-group', {
1217
- props: {
1218
- value: column.renderFixed || '',
1219
- type: 'button',
1220
- size: 'mini',
1221
- disabled: isHidden,
1222
- options: [
1223
- { label: getI18n('vxe.custom.setting.fixedLeft'), value: 'left', disabled: isHidden || isMaxFixedColumn },
1224
- { label: getI18n('vxe.custom.setting.fixedUnset'), value: '', disabled: isHidden },
1225
- { label: getI18n('vxe.custom.setting.fixedRight'), value: 'right', disabled: isHidden || isMaxFixedColumn }
1226
- ]
1227
- },
1228
- on: {
1229
- change ({ label, $event }: VxeRadioGroupDefines.ChangeEventParams) {
1230
- $xeTableCustomPanel.changeFixedOption(column, label, $event)
1231
- }
1232
- }
1233
- })
1234
- ])
1235
- : renderEmptyElement($xeTable)
1236
- ])
1237
- )
1238
- }
1239
- })
1240
- const scopedSlots: Record<string, any> = {
1241
- default: () => {
1242
- return h('div', {
1243
- ref: 'refBodyWrapperElem',
1244
- class: 'vxe-table-custom-popup--body-wrapper'
1245
- }, defaultSlot
1246
- ? $xeTable.callSlot(defaultSlot, params, h)
1247
- : [
1248
- !treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregatePopupPanel
1249
- ? h($xeTable.getPivotTableAggregatePopupPanel(), {
1250
- props: {
1251
- customStore
1252
- }
1253
- })
1254
- : renderEmptyElement($xeTable),
1255
- h('div', {
1256
- ref: 'refCustomBodyElem',
1257
- class: 'vxe-table-custom-popup--handle-wrapper'
1258
- }, [
1259
- topSlot
1260
- ? h('div', {
1261
- class: 'vxe-table-custom-popup--table-top'
1262
- }, $xeTable.callSlot(topSlot, params, h))
1263
- : renderEmptyElement($xeTable),
1264
- h('div', {
1265
- class: 'vxe-table-custom-popup--table-wrapper'
1266
- }, [
1267
- h('table', {}, [
1268
- h('colgroup', {}, [
1269
- allowVisible
1270
- ? h('col', {
1271
- class: 'vxe-table-custom-popup--table-col-seq'
1272
- })
1273
- : renderEmptyElement($xeTable),
1274
- h('col', {
1275
- class: 'vxe-table-custom-popup--table-col-title'
1276
- }),
1277
- allowResizable
1278
- ? h('col', {
1279
- class: 'vxe-table-custom-popup--table-col-width'
1280
- })
1281
- : renderEmptyElement($xeTable),
1282
- allowFixed
1283
- ? h('col', {
1284
- class: 'vxe-table-custom-popup--table-col-fixed'
1285
- })
1286
- : renderEmptyElement($xeTable)
1287
- ]),
1288
- h('thead', {}, [
1289
- h('tr', {}, [
1290
- allowVisible
1291
- ? h('th', {}, [
1292
- h('div', {
1293
- class: ['vxe-table-custom--checkbox-option', {
1294
- 'is--checked': isAllChecked,
1295
- 'is--indeterminate': isAllIndeterminate
1296
- }],
1297
- attrs: {
1298
- title: getI18n('vxe.table.allTitle')
1299
- },
1300
- on: {
1301
- click: $xeTableCustomPanel.allOptionEvent
1302
- }
1303
-
1304
- }, [
1305
- h('span', {
1306
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
1307
- }),
1308
- h('span', {
1309
- class: 'vxe-checkbox--label'
1310
- }, getI18n('vxe.toolbar.customAll'))
1311
- ])
1312
- ])
1313
- : renderEmptyElement($xeTable),
1314
- h('th', {}, getI18n('vxe.custom.setting.colTitle')),
1315
- allowResizable
1316
- ? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
1317
- : renderEmptyElement($xeTable),
1318
- allowFixed
1319
- ? h('th', {}, getI18n(`vxe.custom.setting.${maxFixedSize ? 'colFixedMax' : 'colFixed'}`, [maxFixedSize]))
1320
- : renderEmptyElement($xeTable)
1321
- ])
1322
- ]),
1323
- h('transition-group', {
1324
- class: 'vxe-table-custom--panel-list',
1325
- props: {
1326
- tag: 'tbody',
1327
- name: 'vxe-table-custom--list'
1328
- }
1329
- }, trVNs)
1330
- ])
1331
- ]),
1332
- bottomSlot
1333
- ? h('div', {
1334
- class: 'vxe-table-custom-popup--table-bottom'
1335
- }, $xeTable.callSlot(bottomSlot, params, h))
1336
- : renderEmptyElement($xeTable),
1337
- $xeTableCustomPanel.renderDragTip(h)
1338
- ])
1339
- ])
1340
- },
1341
- footer: () => {
1342
- if (footerSlot) {
1343
- return $xeTable.callSlot(footerSlot, params, h)
1344
- }
1345
- return h('div', {
1346
- class: 'vxe-table-custom-popup--footer'
1347
- }, [
1348
- h(VxeUIButtonComponent, {
1349
- props: {
1350
- content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore'),
1351
- disabled: !isCustomStatus
1352
- },
1353
- on: {
1354
- click: $xeTableCustomPanel.resetCustomEvent
1355
- }
1356
- }),
1357
- immediate
1358
- ? h(VxeUIButtonComponent, {
1359
- props: {
1360
- content: customOpts.resetButtonText || getI18n('vxe.table.customClose')
1361
- },
1362
- on: {
1363
- click: $xeTableCustomPanel.cancelCloseEvent
1364
- }
1365
- })
1366
- : h(VxeUIButtonComponent, {
1367
- props: {
1368
- content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel')
1369
- },
1370
- on: {
1371
- click: $xeTableCustomPanel.cancelCustomEvent
1372
- }
1373
- }),
1374
- immediate
1375
- ? renderEmptyElement($xeTable)
1376
- : h(VxeUIButtonComponent, {
1377
- props: {
1378
- status: 'primary',
1379
- content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm')
1380
- },
1381
- on: {
1382
- click: $xeTableCustomPanel.confirmCustomEvent
1383
- }
1384
- })
1385
- ])
1386
- }
1387
- }
1388
- if (headerSlot) {
1389
- scopedSlots.header = () => $xeTable.callSlot(headerSlot, params, h)
1390
- }
1391
- if (mode === 'drawer') {
1392
- return VxeUIDrawerComponent
1393
- ? h(VxeUIDrawerComponent, {
1394
- key: 'drawer',
1395
- props: {
1396
- className: ['vxe-table-custom-drawer-wrapper', 'vxe-table--ignore-clear', drawerOpts.className || ''].join(' '),
1397
- value: customStore.visible,
1398
- title: drawerOpts.title || getI18n('vxe.custom.cstmTitle'),
1399
- width: drawerOpts.width || Math.min(880, Math.floor(document.documentElement.clientWidth * 0.6)),
1400
- position: drawerOpts.position,
1401
- resize: !!drawerOpts.resize,
1402
- escClosable: !!drawerOpts.escClosable,
1403
- maskClosable: !!drawerOpts.maskClosable,
1404
- destroyOnClose: true,
1405
- showFooter: true
1406
- },
1407
- on: {
1408
- input (value: any) {
1409
- customStore.visible = value
1410
- }
1411
- },
1412
- scopedSlots
1413
- })
1414
- : renderEmptyElement($xeTableCustomPanel)
1415
- }
1416
- return VxeUIModalComponent
1417
- ? h(VxeUIModalComponent, {
1418
- key: 'modal',
1419
- props: {
1420
- className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
1421
- value: customStore.visible,
1422
- title: modalOpts.title || getI18n('vxe.custom.cstmTitle'),
1423
- width: modalOpts.width || Math.min(880, document.documentElement.clientWidth),
1424
- minWidth: modalOpts.minWidth || 700,
1425
- height: modalOpts.height || Math.min(680, document.documentElement.clientHeight),
1426
- minHeight: modalOpts.minHeight || 400,
1427
- showZoom: modalOpts.showZoom,
1428
- showMaximize: modalOpts.showMaximize,
1429
- showMinimize: modalOpts.showMinimize,
1430
- mask: modalOpts.mask,
1431
- lockView: modalOpts.lockView,
1432
- resize: modalOpts.resize,
1433
- escClosable: !!modalOpts.escClosable,
1434
- maskClosable: !!modalOpts.maskClosable,
1435
- destroyOnClose: true,
1436
- showFooter: true
1437
- },
1438
- on: {
1439
- input (value: any) {
1440
- customStore.visible = value
1441
- }
1442
- },
1443
- scopedSlots
1444
- })
1445
- : renderEmptyElement($xeTableCustomPanel)
1446
- },
1447
- renderVN (h: CreateElement) {
1448
- const $xeTableCustomPanel = this
1449
- const $xeTable = $xeTableCustomPanel.$xeTable
1450
-
1451
- const customOpts = $xeTable.computeCustomOpts
1452
- if (['modal', 'drawer', 'popup'].includes(`${customOpts.mode}`)) {
1453
- return $xeTableCustomPanel.renderPopupPanel(h)
1454
- }
1455
- return $xeTableCustomPanel.renderSimplePanel(h)
1456
- }
1457
- },
1458
- render (h: CreateElement) {
1459
- return (this as any).renderVN(h)
1460
- }
1461
- }) /* define-vxe-component end */
1
+ import { CreateElement, VNode, PropType } from 'vue'
2
+ import { defineVxeComponent } from '../../../ui/src/comp'
3
+ import { VxeUI } from '../../../ui'
4
+ import { formatText } from '../../../ui/src/utils'
5
+ import { getTpImg, addClass, removeClass, hasControlKey, toCssUnit } from '../../../ui/src/dom'
6
+ import { errLog } from '../../../ui/src/log'
7
+ import XEUtils from 'xe-utils'
8
+
9
+ import type { VxeTableDefines, VxeTableConstructor, VxeTablePrivateMethods, TableReactData, TableInternalData, VxeColumnPropTypes, VxeTableCustomPanelConstructor, TableCustomPanelReactData, TableCustomPanelInternalData } from '../../../../types'
10
+ import type { VxeButtonDefines, VxeRadioGroupDefines, VxeComponentStyleType } from 'vxe-pc-ui'
11
+
12
+ const { getI18n, getIcon, renderEmptyElement } = VxeUI
13
+
14
+ function showDropTip ($xeTableCustomPanel: VxeTableCustomPanelConstructor, evnt: DragEvent | MouseEvent, optEl: HTMLElement | null, showLine: boolean, dragPos: string) {
15
+ const customPanelInternalData = $xeTableCustomPanel.internalData
16
+
17
+ const bodyWrapperElem = $xeTableCustomPanel.$refs.refBodyWrapperElem as HTMLDivElement
18
+ if (!bodyWrapperElem) {
19
+ return
20
+ }
21
+ const customBodyElem = $xeTableCustomPanel.$refs.refCustomBodyElem as HTMLDivElement
22
+ if (!customBodyElem) {
23
+ return
24
+ }
25
+ const { prevDragToChild } = customPanelInternalData
26
+ const bodyWrapperRect = bodyWrapperElem.getBoundingClientRect()
27
+ const customBodyRect = customBodyElem.getBoundingClientRect()
28
+ const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem as HTMLDivElement
29
+ if (optEl) {
30
+ if (dragLineEl) {
31
+ if (showLine) {
32
+ const optRect = optEl.getBoundingClientRect()
33
+ dragLineEl.style.display = 'block'
34
+ dragLineEl.style.left = `${Math.max(0, customBodyRect.x - bodyWrapperRect.x)}px`
35
+ dragLineEl.style.top = `${Math.max(1, optRect.y + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`
36
+ dragLineEl.style.height = `${optRect.height}px`
37
+ dragLineEl.style.width = `${optRect.width}px`
38
+ dragLineEl.setAttribute('drag-pos', dragPos)
39
+ dragLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n')
40
+ } else {
41
+ dragLineEl.style.display = ''
42
+ }
43
+ }
44
+ } else {
45
+ if (dragLineEl) {
46
+ dragLineEl.style.display = 'node'
47
+ }
48
+ }
49
+ const dragTipEl = $xeTableCustomPanel.$refs.refDragTipElem as HTMLDivElement
50
+ if (dragTipEl) {
51
+ dragTipEl.style.display = 'block'
52
+ dragTipEl.style.top = `${Math.min(bodyWrapperElem.clientHeight + bodyWrapperElem.scrollTop - dragTipEl.clientHeight, evnt.clientY + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`
53
+ dragTipEl.style.left = `${Math.min(bodyWrapperElem.clientWidth + bodyWrapperElem.scrollLeft - dragTipEl.clientWidth, evnt.clientX + bodyWrapperElem.scrollLeft - bodyWrapperRect.x)}px`
54
+ dragTipEl.setAttribute('drag-status', showLine ? (prevDragToChild ? 'sub' : 'normal') : 'disabled')
55
+ }
56
+ }
57
+
58
+ function hideDropTip ($xeTableCustomPanel: VxeTableCustomPanelConstructor) {
59
+ const dragTipEl = $xeTableCustomPanel.$refs.refDragTipElem as HTMLDivElement
60
+ const dragLineEl = $xeTableCustomPanel.$refs.refDragLineElem as HTMLDivElement
61
+ if (dragTipEl) {
62
+ dragTipEl.style.display = ''
63
+ }
64
+ if (dragLineEl) {
65
+ dragLineEl.style.display = ''
66
+ }
67
+ }
68
+
69
+ export default /* define-vxe-component start */ defineVxeComponent({
70
+ name: 'VxeTableCustomPanel',
71
+ props: {
72
+ customStore: {
73
+ type: Object as PropType<VxeTableDefines.VxeTableCustomStoreObj>,
74
+ default: () => ({} as VxeTableDefines.VxeTableCustomStoreObj)
75
+ }
76
+ },
77
+ provide () {
78
+ const $xeTableCustomPanel = this
79
+
80
+ return {
81
+ $xeTableCustomPanel
82
+ }
83
+ },
84
+ inject: {
85
+ $xeTable: {
86
+ default: null
87
+ }
88
+ },
89
+ data () {
90
+ const reactData: TableCustomPanelReactData = {
91
+ dragCol: null,
92
+ dragGroupField: null,
93
+ dragAggFnCol: null,
94
+ dragTipText: ''
95
+ }
96
+
97
+ const internalData: TableCustomPanelInternalData = {
98
+ // prevDragCol: undefined,
99
+ // prevDragGroupField: undefined,
100
+ // prevDragAggFnColid: undefined,
101
+ // prevDragToChild: false,
102
+ // prevDragPos: null
103
+ }
104
+
105
+ return {
106
+ reactData,
107
+ internalData
108
+ }
109
+ },
110
+ computed: {
111
+ ...({} as {
112
+ $xeTable(): VxeTableConstructor & VxeTablePrivateMethods
113
+ })
114
+ },
115
+ created () {
116
+ const $xeTableCustomPanel = this
117
+
118
+ const VxeUIModalComponent = VxeUI.getComponent('VxeModal')
119
+ const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer')
120
+ const VxeUIButtonComponent = VxeUI.getComponent('VxeButton')
121
+ const VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput')
122
+ const VxeUIRadioGroupComponent = VxeUI.getComponent('VxeRadioGroup')
123
+
124
+ $xeTableCustomPanel.$nextTick(() => {
125
+ const $xeTable = $xeTableCustomPanel.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
126
+
127
+ const { customOpts } = $xeTable
128
+ const { mode } = customOpts
129
+ if (!VxeUIModalComponent && (mode === 'modal')) {
130
+ errLog('vxe.error.reqComp', ['vxe-modal'])
131
+ }
132
+ if (!VxeUIDrawerComponent && (mode === 'drawer')) {
133
+ errLog('vxe.error.reqComp', ['vxe-drawer'])
134
+ }
135
+ if (!VxeUIButtonComponent) {
136
+ errLog('vxe.error.reqComp', ['vxe-button'])
137
+ }
138
+ if (!VxeUINumberInputComponent) {
139
+ errLog('vxe.error.reqComp', ['vxe-number-input'])
140
+ }
141
+ if (!VxeUIRadioGroupComponent) {
142
+ errLog('vxe.error.reqComp', ['vxe-radio-group'])
143
+ }
144
+ })
145
+ },
146
+ methods: {
147
+ handleWrapperMouseenterEvent (evnt: any) {
148
+ const $xeTableCustomPanel = this
149
+ const props = $xeTableCustomPanel
150
+ const $xeTable = $xeTableCustomPanel.$xeTable
151
+
152
+ const { customStore } = props
153
+ customStore.activeWrapper = true
154
+ $xeTable.customOpenEvent(evnt)
155
+ },
156
+ handleWrapperMouseleaveEvent (evnt: any) {
157
+ const $xeTableCustomPanel = this
158
+ const $xeTable = $xeTableCustomPanel.$xeTable
159
+ const props = $xeTableCustomPanel
160
+
161
+ const { customStore } = props
162
+ customStore.activeWrapper = false
163
+ setTimeout(() => {
164
+ if (!customStore.activeBtn && !customStore.activeWrapper) {
165
+ $xeTable.customCloseEvent(evnt)
166
+ }
167
+ }, 300)
168
+ },
169
+ getStoreData () {
170
+ return {}
171
+ },
172
+ confirmCustomEvent ({ $event }: VxeButtonDefines.ClickEventParams) {
173
+ const $xeTableCustomPanel = this
174
+ const $xeTable = $xeTableCustomPanel.$xeTable
175
+ const tableReactData = $xeTable as unknown as TableReactData
176
+
177
+ tableReactData.isCustomStatus = true
178
+ $xeTable.saveCustom()
179
+ $xeTable.closeCustom()
180
+ $xeTable.emitCustomEvent('confirm', $event)
181
+ $xeTable.emitCustomEvent('close', $event)
182
+ },
183
+ cancelCloseEvent ({ $event }: VxeButtonDefines.ClickEventParams) {
184
+ const $xeTableCustomPanel = this
185
+ const $xeTable = $xeTableCustomPanel.$xeTable
186
+
187
+ $xeTable.closeCustom()
188
+ $xeTable.emitCustomEvent('close', $event)
189
+ },
190
+ cancelCustomEvent ({ $event }: VxeButtonDefines.ClickEventParams) {
191
+ const $xeTableCustomPanel = this
192
+ const $xeTable = $xeTableCustomPanel.$xeTable
193
+
194
+ $xeTable.cancelCustom()
195
+ $xeTable.closeCustom()
196
+ $xeTable.emitCustomEvent('cancel', $event)
197
+ $xeTable.emitCustomEvent('close', $event)
198
+ },
199
+ handleResetCustomEvent (evnt: Event) {
200
+ const $xeTableCustomPanel = this
201
+ const $xeTable = $xeTableCustomPanel.$xeTable
202
+
203
+ $xeTable.resetCustom(true)
204
+ $xeTable.closeCustom()
205
+ $xeTable.emitCustomEvent('reset', evnt)
206
+ $xeTable.emitCustomEvent('close', evnt)
207
+ },
208
+ resetCustomEvent (evnt: Event) {
209
+ if (VxeUI.modal) {
210
+ VxeUI.modal.confirm({
211
+ content: getI18n('vxe.custom.cstmConfirmRestore'),
212
+ className: 'vxe-table--ignore-clear',
213
+ escClosable: true
214
+ }).then(type => {
215
+ if (type === 'confirm') {
216
+ this.handleResetCustomEvent(evnt)
217
+ }
218
+ })
219
+ } else {
220
+ this.handleResetCustomEvent(evnt)
221
+ }
222
+ },
223
+ handleOptionCheck (column: VxeTableDefines.ColumnInfo) {
224
+ const $xeTableCustomPanel = this
225
+ const $xeTable = $xeTableCustomPanel.$xeTable
226
+ const tableReactData = $xeTable as unknown as TableReactData
227
+
228
+ const { customColumnList } = tableReactData
229
+ const matchObj = XEUtils.findTree(customColumnList, item => item === column)
230
+ if (matchObj && matchObj.parent) {
231
+ const { parent } = matchObj
232
+ if (parent.children && parent.children.length) {
233
+ parent.renderVisible = parent.children.every((column) => column.renderVisible)
234
+ parent.halfVisible = !parent.renderVisible && parent.children.some((column) => column.renderVisible || column.halfVisible)
235
+ this.handleOptionCheck(parent)
236
+ }
237
+ }
238
+ },
239
+ changeCheckboxOption (column: VxeTableDefines.ColumnInfo, evnt: MouseEvent) {
240
+ const $xeTableCustomPanel = this
241
+ const $xeTable = $xeTableCustomPanel.$xeTable
242
+ const tableReactData = $xeTable as unknown as TableReactData
243
+
244
+ const isChecked = !column.renderVisible
245
+ const customOpts = $xeTable.computeCustomOpts
246
+ if (customOpts.immediate) {
247
+ XEUtils.eachTree([column], (item) => {
248
+ item.visible = isChecked
249
+ item.renderVisible = isChecked
250
+ item.halfVisible = false
251
+ })
252
+ tableReactData.isCustomStatus = true
253
+ $xeTable.handleCustom()
254
+ $xeTable.saveCustomStore('update:visible')
255
+ } else {
256
+ XEUtils.eachTree([column], (item) => {
257
+ item.renderVisible = isChecked
258
+ item.halfVisible = false
259
+ })
260
+ }
261
+ this.handleOptionCheck(column)
262
+ $xeTable.checkCustomStatus()
263
+ $xeTable.dispatchEvent('custom-visible-change', { column, checked: isChecked }, evnt)
264
+ },
265
+ changeColumnWidth (column: VxeTableDefines.ColumnInfo) {
266
+ const $xeTableCustomPanel = this
267
+ const $xeTable = $xeTableCustomPanel.$xeTable
268
+ const tableReactData = $xeTable as unknown as TableReactData
269
+
270
+ const customOpts = $xeTable.computeCustomOpts
271
+ if (customOpts.immediate) {
272
+ if (column.renderResizeWidth !== column.renderWidth) {
273
+ column.resizeWidth = column.renderResizeWidth
274
+ column.renderWidth = column.renderResizeWidth
275
+ tableReactData.isCustomStatus = true
276
+ $xeTable.handleCustom()
277
+ $xeTable.saveCustomStore('update:width')
278
+ }
279
+ }
280
+ },
281
+ changeFixedOption (column: VxeTableDefines.ColumnInfo, colFixed: VxeColumnPropTypes.Fixed, evnt: Event) {
282
+ const $xeTableCustomPanel = this
283
+ const $xeTable = $xeTableCustomPanel.$xeTable
284
+ const tableReactData = $xeTable as unknown as TableReactData
285
+
286
+ const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
287
+ const customOpts = $xeTable.computeCustomOpts
288
+ let targetFixed: VxeColumnPropTypes.Fixed = null
289
+ if (customOpts.immediate) {
290
+ if (column.renderFixed === colFixed) {
291
+ targetFixed = ''
292
+ XEUtils.eachTree([column], col => {
293
+ col.fixed = ''
294
+ col.renderFixed = ''
295
+ })
296
+ } else {
297
+ if (!isMaxFixedColumn || column.renderFixed) {
298
+ targetFixed = colFixed
299
+ XEUtils.eachTree([column], col => {
300
+ col.fixed = colFixed
301
+ col.renderFixed = colFixed
302
+ })
303
+ }
304
+ }
305
+ tableReactData.isCustomStatus = true
306
+ $xeTable.handleCustom()
307
+ $xeTable.saveCustomStore('update:fixed')
308
+ } else {
309
+ if (column.renderFixed === colFixed) {
310
+ targetFixed = ''
311
+ XEUtils.eachTree([column], col => {
312
+ col.renderFixed = ''
313
+ })
314
+ } else {
315
+ if (!isMaxFixedColumn || column.renderFixed) {
316
+ targetFixed = colFixed
317
+ XEUtils.eachTree([column], col => {
318
+ col.renderFixed = colFixed
319
+ })
320
+ }
321
+ }
322
+ }
323
+ if (targetFixed !== null) {
324
+ $xeTable.dispatchEvent('custom-fixed-change', { column, fixed: targetFixed }, evnt)
325
+ }
326
+ },
327
+ allOptionEvent (evnt: MouseEvent) {
328
+ const $xeTableCustomPanel = this
329
+ const $xeTable = $xeTableCustomPanel.$xeTable
330
+ const tableReactData = $xeTable as unknown as TableReactData
331
+
332
+ const { customStore } = tableReactData
333
+ const isAll = !customStore.isAll
334
+ $xeTable.toggleCustomAllCheckbox()
335
+ $xeTable.dispatchEvent('custom-visible-all', { checked: isAll }, evnt)
336
+ },
337
+ updateColDropTipContent () {
338
+ const $xeTableCustomPanel = this
339
+ const $xeTable = $xeTableCustomPanel.$xeTable
340
+ const customPanelReactData = $xeTableCustomPanel.reactData
341
+
342
+ const { dragCol } = customPanelReactData
343
+ const columnDragOpts = $xeTable.computeColumnDragOpts
344
+ const { tooltipMethod } = columnDragOpts
345
+ let tipContent = ''
346
+ if (tooltipMethod) {
347
+ const dtParams = {
348
+ $table: $xeTable,
349
+ column: dragCol as VxeTableDefines.ColumnInfo
350
+ }
351
+ tipContent = `${tooltipMethod(dtParams) || ''}`
352
+ } else {
353
+ tipContent = getI18n('vxe.custom.cstmDragTarget', [dragCol && dragCol.type !== 'html' ? dragCol.getTitle() : ''])
354
+ }
355
+ customPanelReactData.dragTipText = tipContent
356
+ },
357
+ sortMousedownEvent (evnt: MouseEvent) {
358
+ const $xeTableCustomPanel = this
359
+ const $xeTable = $xeTableCustomPanel.$xeTable
360
+ const customPanelReactData = $xeTableCustomPanel.reactData
361
+
362
+ const btnEl = evnt.currentTarget as HTMLElement
363
+ const cellEl = btnEl.parentElement as HTMLElement
364
+ const tdEl = cellEl.parentElement as HTMLElement
365
+ const trEl = tdEl.parentElement as HTMLElement
366
+ const colid = trEl.getAttribute('colid')
367
+ const column = $xeTable.getColumnById(colid)
368
+ trEl.draggable = true
369
+ customPanelReactData.dragCol = column
370
+ customPanelReactData.dragGroupField = null
371
+ customPanelReactData.dragAggFnCol = null
372
+ this.updateColDropTipContent()
373
+ addClass(trEl, 'active--drag-origin')
374
+ },
375
+ sortMouseupEvent (evnt: MouseEvent) {
376
+ const $xeTableCustomPanel = this as unknown as VxeTableCustomPanelConstructor
377
+ const customPanelReactData = $xeTableCustomPanel.reactData
378
+
379
+ const btnEl = evnt.currentTarget as HTMLElement
380
+ const cellEl = btnEl.parentElement as HTMLElement
381
+ const tdEl = cellEl.parentElement as HTMLElement
382
+ const trEl = tdEl.parentElement as HTMLElement
383
+ hideDropTip($xeTableCustomPanel)
384
+ trEl.draggable = false
385
+ customPanelReactData.dragCol = null
386
+ customPanelReactData.dragGroupField = null
387
+ customPanelReactData.dragAggFnCol = null
388
+ removeClass(trEl, 'active--drag-origin')
389
+ },
390
+ sortDragstartEvent (evnt: any) {
391
+ const $xeTableCustomPanel = this
392
+ const customPanelInternalData = $xeTableCustomPanel.internalData
393
+
394
+ if (evnt.dataTransfer) {
395
+ evnt.dataTransfer.setDragImage(getTpImg(), 0, 0)
396
+ }
397
+ customPanelInternalData.prevDragGroupField = null
398
+ customPanelInternalData.prevDragAggFnColid = null
399
+ },
400
+ sortDragendEvent (evnt: any) {
401
+ const $xeTableCustomPanel = this as unknown as VxeTableCustomPanelConstructor
402
+ const $xeTable = $xeTableCustomPanel.$xeTable
403
+ const tableProps = $xeTable
404
+ const tableReactData = $xeTable as unknown as TableReactData
405
+ const tableInternalData = $xeTable as unknown as TableInternalData
406
+ const customPanelReactData = $xeTableCustomPanel.reactData
407
+ const customPanelInternalData = $xeTableCustomPanel.internalData
408
+
409
+ const { mouseConfig } = tableProps
410
+ const { customColumnList } = tableReactData
411
+ const { collectColumn } = tableInternalData
412
+ const customOpts = $xeTable.computeCustomOpts
413
+ const { immediate } = customOpts
414
+ const trEl = evnt.currentTarget as HTMLElement
415
+ const columnDragOpts = $xeTable.computeColumnDragOpts
416
+ const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
417
+ const { dragCol } = customPanelReactData
418
+ const { prevDragCol, prevDragGroupField, prevDragAggFnColid, prevDragPos, prevDragToChild } = customPanelInternalData
419
+ const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
420
+
421
+ if (prevDragGroupField || prevDragAggFnColid) {
422
+ if ($xeTable.handlePivotTableAggregatePanelDragendEvent) {
423
+ $xeTable.handlePivotTableAggregatePanelDragendEvent(evnt)
424
+ }
425
+ } else if (prevDragCol && dragCol) {
426
+ // 判断是否有拖动
427
+ if (prevDragCol !== dragCol) {
428
+ const dragColumn: VxeTableDefines.ColumnInfo = dragCol
429
+ const newColumn: VxeTableDefines.ColumnInfo = prevDragCol
430
+ Promise.resolve(
431
+ dragEndMethod
432
+ ? dragEndMethod({
433
+ oldColumn: dragColumn,
434
+ newColumn,
435
+ dragColumn,
436
+ dragPos: prevDragPos as any,
437
+ dragToChild: !!prevDragToChild,
438
+ offsetIndex: dragOffsetIndex
439
+ })
440
+ : true
441
+ ).then((status) => {
442
+ if (!status) {
443
+ return
444
+ }
445
+
446
+ let oafIndex = -1
447
+ let nafIndex = -1
448
+
449
+ const oldAllMaps: Record<string, any> = {}
450
+ XEUtils.eachTree([dragColumn], column => {
451
+ oldAllMaps[column.id] = column
452
+ })
453
+
454
+ let isSelfToChildStatus = false
455
+
456
+ // 只有实时拖拽支持跨层级
457
+ if (immediate) {
458
+ if (dragColumn.parentId && newColumn.parentId) {
459
+ // 子到子
460
+
461
+ if (!isCrossDrag) {
462
+ return
463
+ }
464
+ if (oldAllMaps[newColumn.id]) {
465
+ isSelfToChildStatus = true
466
+ if (!(isCrossDrag && isSelfToChildDrag)) {
467
+ if (VxeUI.modal) {
468
+ VxeUI.modal.message({
469
+ status: 'error',
470
+ content: getI18n('vxe.error.treeDragChild')
471
+ })
472
+ }
473
+ return
474
+ }
475
+ }
476
+ } else if (dragColumn.parentId) {
477
+ // 子到根
478
+
479
+ if (!isCrossDrag) {
480
+ return
481
+ }
482
+ } else if (newColumn.parentId) {
483
+ // 根到子
484
+
485
+ if (!isCrossDrag) {
486
+ return
487
+ }
488
+ if (oldAllMaps[newColumn.id]) {
489
+ isSelfToChildStatus = true
490
+ if (!(isCrossDrag && isSelfToChildDrag)) {
491
+ if (VxeUI.modal) {
492
+ VxeUI.modal.message({
493
+ status: 'error',
494
+ content: getI18n('vxe.error.treeDragChild')
495
+ })
496
+ }
497
+ return
498
+ }
499
+ }
500
+ } else {
501
+ // 根到根
502
+ }
503
+
504
+ const oldewMatchRest = XEUtils.findTree(collectColumn as VxeTableDefines.ColumnInfo[], item => item.id === dragColumn.id)
505
+
506
+ // 改变层级
507
+ if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
508
+ if (oldewMatchRest) {
509
+ const { items: oCols, index: oIndex } = oldewMatchRest
510
+ const childList = dragColumn.children || []
511
+ childList.forEach(column => {
512
+ column.parentId = dragColumn.parentId
513
+ })
514
+ oCols.splice(oIndex, 1, ...childList)
515
+ dragColumn.children = []
516
+ }
517
+ } else {
518
+ if (oldewMatchRest) {
519
+ const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest
520
+ oCols.splice(oIndex, 1)
521
+ if (!oParent) {
522
+ oafIndex = oIndex
523
+ }
524
+ }
525
+ }
526
+
527
+ const newMatchRest = XEUtils.findTree(collectColumn as VxeTableDefines.ColumnInfo[], item => item.id === newColumn.id)
528
+ if (newMatchRest) {
529
+ const { items: nCols, index: nIndex, parent: nParent } = newMatchRest
530
+ // 转子级
531
+ if ((isCrossDrag && isToChildDrag) && prevDragToChild) {
532
+ dragColumn.parentId = newColumn.id
533
+ newColumn.children = (newColumn.children || []).concat([dragColumn])
534
+ } else {
535
+ dragColumn.parentId = newColumn.parentId
536
+ nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn)
537
+ }
538
+ if (!nParent) {
539
+ nafIndex = nIndex
540
+ }
541
+ }
542
+
543
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
544
+ if (!parent) {
545
+ const sortIndex = index + 1
546
+ column.renderSortNumber = sortIndex
547
+ }
548
+ })
549
+ } else {
550
+ oafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === dragColumn.id)
551
+ customColumnList.splice(oafIndex, 1)
552
+
553
+ nafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === newColumn.id)
554
+ customColumnList.splice(nafIndex + dragOffsetIndex, 0, dragColumn)
555
+ }
556
+
557
+ if (mouseConfig) {
558
+ if ($xeTable.clearSelected) {
559
+ $xeTable.clearSelected()
560
+ }
561
+ if ($xeTable.clearCellAreas) {
562
+ $xeTable.clearCellAreas()
563
+ $xeTable.clearCopyCellArea()
564
+ }
565
+ }
566
+
567
+ const csParams = {
568
+ oldColumn: dragColumn,
569
+ newColumn,
570
+ dragColumn,
571
+ dragPos: prevDragPos,
572
+ offsetIndex: dragOffsetIndex,
573
+ _index: {
574
+ newIndex: nafIndex,
575
+ oldIndex: oafIndex
576
+ }
577
+ }
578
+ $xeTable.dispatchEvent('custom-sort-change', csParams, evnt)
579
+ $xeTable.dispatchEvent('column-dragend', csParams, evnt)
580
+
581
+ if (immediate) {
582
+ tableReactData.customColumnList = collectColumn.slice(0)
583
+ $xeTable.handleColDragSwapColumn()
584
+ }
585
+ }).catch(() => {
586
+ })
587
+ }
588
+ }
589
+
590
+ hideDropTip($xeTableCustomPanel)
591
+ customPanelReactData.dragCol = null
592
+ customPanelReactData.dragGroupField = null
593
+ customPanelReactData.dragAggFnCol = null
594
+ customPanelInternalData.prevDragGroupField = null
595
+ customPanelInternalData.prevDragAggFnColid = null
596
+ trEl.draggable = false
597
+ trEl.removeAttribute('drag-pos')
598
+ removeClass(trEl, 'active--drag-target')
599
+ removeClass(trEl, 'active--drag-origin')
600
+ },
601
+ sortDragoverEvent (evnt: DragEvent) {
602
+ const $xeTableCustomPanel = this as unknown as VxeTableCustomPanelConstructor
603
+ const $xeTable = $xeTableCustomPanel.$xeTable
604
+ const customPanelReactData = $xeTableCustomPanel.reactData
605
+ const customPanelInternalData = $xeTableCustomPanel.internalData
606
+
607
+ const { dragCol } = customPanelReactData
608
+ const customOpts = $xeTable.computeCustomOpts
609
+ const { immediate } = customOpts
610
+ const columnDragOpts = $xeTable.computeColumnDragOpts
611
+ const { isCrossDrag, isToChildDrag } = columnDragOpts
612
+ const optEl = evnt.currentTarget as HTMLElement
613
+ const isControlKey = hasControlKey(evnt)
614
+ const colid = optEl.getAttribute('colid')
615
+ const column = $xeTable.getColumnById(colid)
616
+ customPanelInternalData.prevDragGroupField = null
617
+ customPanelInternalData.prevDragAggFnColid = null
618
+ // 是否移入有效列
619
+ if (column && (isCrossDrag || column.level === 1)) {
620
+ evnt.preventDefault()
621
+ const offsetY = evnt.clientY - optEl.getBoundingClientRect().y
622
+ const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom'
623
+ if (
624
+ !dragCol ||
625
+ (dragCol && dragCol.id === column.id) ||
626
+ (!isCrossDrag && column.level > 1) ||
627
+ (!immediate && column.level > 1)
628
+ ) {
629
+ showDropTip($xeTableCustomPanel, evnt, optEl, false, dragPos)
630
+ return
631
+ }
632
+ customPanelInternalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) && isControlKey && immediate)
633
+ customPanelInternalData.prevDragCol = column
634
+ customPanelInternalData.prevDragPos = dragPos
635
+ showDropTip($xeTableCustomPanel, evnt, optEl, true, dragPos)
636
+ }
637
+ },
638
+
639
+ renderDragTip (h: CreateElement) {
640
+ const $xeTableCustomPanel = this
641
+ const $xeTable = $xeTableCustomPanel.$xeTable
642
+ const customPanelReactData = $xeTableCustomPanel.reactData
643
+
644
+ const { dragTipText } = customPanelReactData
645
+ const columnDragOpts = $xeTable.computeColumnDragOpts
646
+ return h('div', {}, [
647
+ h('div', {
648
+ ref: 'refDragLineElem',
649
+ class: ['vxe-table-custom-popup--drag-line', {
650
+ 'is--guides': columnDragOpts.showGuidesStatus
651
+ }]
652
+ }),
653
+ h('div', {
654
+ ref: 'refDragTipElem',
655
+ class: 'vxe-table-custom-popup--drag-tip'
656
+ }, [
657
+ h('div', {
658
+ class: 'vxe-table-custom-popup--drag-tip-wrapper'
659
+ }, [
660
+ h('div', {
661
+ class: 'vxe-table-custom-popup--drag-tip-status'
662
+ }, [
663
+ h('span', {
664
+ class: ['vxe-table-custom-popup--drag-tip-normal-status', getIcon().TABLE_DRAG_STATUS_ROW]
665
+ }),
666
+ h('span', {
667
+ class: ['vxe-table-custom-popup--drag-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
668
+ }),
669
+ h('span', {
670
+ class: ['vxe-table-custom-popup--drag-tip-group-status', getIcon().TABLE_DRAG_STATUS_AGG_GROUP]
671
+ }),
672
+ h('span', {
673
+ class: ['vxe-table-custom-popup--drag-tip-values-status', getIcon().TABLE_DRAG_STATUS_AGG_VALUES]
674
+ }),
675
+ h('span', {
676
+ class: ['vxe-table-custom-popup--drag-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
677
+ })
678
+ ]),
679
+ h('div', {
680
+ class: 'vxe-table-custom-popup--drag-tip-content'
681
+ }, `${dragTipText || ''}`)
682
+ ])
683
+ ])
684
+ ])
685
+ },
686
+ renderSimplePanel (h: CreateElement) {
687
+ const VxeUIButtonComponent = VxeUI.getComponent('VxeButton')
688
+
689
+ const $xeTableCustomPanel = this
690
+ const props = $xeTableCustomPanel
691
+ const $xeTable = $xeTableCustomPanel.$xeTable
692
+
693
+ const tableProps = $xeTable
694
+ const tableReactData = $xeTable as unknown as TableReactData
695
+ const $xeGrid = $xeTable.$xeGrid
696
+ const $xeGantt = $xeTable.$xeGantt
697
+
698
+ const { customStore } = props
699
+ const { treeConfig, rowGroupConfig, aggregateConfig } = tableProps
700
+ const { isCustomStatus, customColumnList } = tableReactData
701
+ const customOpts = $xeTable.computeCustomOpts
702
+ const { immediate } = customOpts
703
+ const columnDragOpts = $xeTable.computeColumnDragOpts
704
+ const { maxHeight, popupTop } = customStore
705
+ const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts
706
+ const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
707
+ const { isCrossDrag } = columnDragOpts
708
+ const slots = customOpts.slots || {}
709
+ const headerSlot = slots.header
710
+ const topSlot = slots.top
711
+ const bottomSlot = slots.bottom
712
+ const defaultSlot = slots.default
713
+ const footerSlot = slots.footer
714
+ const colVNs: any[] = []
715
+ const customWrapperOns: any = {}
716
+ const isAllChecked = customStore.isAll
717
+ const isAllIndeterminate = customStore.isIndeterminate
718
+ // hover 触发
719
+ if (trigger === 'hover') {
720
+ customWrapperOns.mouseenter = $xeTableCustomPanel.handleWrapperMouseenterEvent
721
+ customWrapperOns.mouseleave = $xeTableCustomPanel.handleWrapperMouseleaveEvent
722
+ }
723
+ const params = {
724
+ $table: $xeTable,
725
+ $grid: $xeGrid,
726
+ $gantt: $xeGantt,
727
+ columns: customColumnList,
728
+ isAllChecked,
729
+ isAllIndeterminate,
730
+ isCustomStatus
731
+ }
732
+ XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
733
+ const isVisible = visibleMethod ? visibleMethod({ $table: $xeTable, column }) : true
734
+ if (isVisible) {
735
+ const isChecked = column.renderVisible
736
+ const isIndeterminate = column.halfVisible
737
+ const isColGroup = column.children && column.children.length
738
+ const colTitle = formatText(column.getTitle(), 1)
739
+ const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
740
+ const isHidden = !isChecked
741
+ colVNs.push(
742
+ h('li', {
743
+ key: column.id,
744
+ attrs: {
745
+ colid: column.id
746
+ },
747
+ class: ['vxe-table-custom--option', `level--${column.level}`, {
748
+ 'is--hidden': isDisabled || isHidden,
749
+ 'is--group': isColGroup
750
+ }],
751
+ on: {
752
+ dragstart: $xeTableCustomPanel.sortDragstartEvent,
753
+ dragend: $xeTableCustomPanel.sortDragendEvent,
754
+ dragover: $xeTableCustomPanel.sortDragoverEvent
755
+ }
756
+ }, [
757
+ allowVisible
758
+ ? h('div', {
759
+ class: ['vxe-table-custom--checkbox-option', {
760
+ 'is--checked': isChecked,
761
+ 'is--indeterminate': isIndeterminate,
762
+ 'is--disabled': isDisabled
763
+ }],
764
+ attrs: {
765
+ title: getI18n('vxe.custom.setting.colVisible')
766
+ },
767
+ on: {
768
+ click: (evnt: MouseEvent) => {
769
+ if (!isDisabled) {
770
+ $xeTableCustomPanel.changeCheckboxOption(column, evnt)
771
+ }
772
+ }
773
+ }
774
+ }, [
775
+ h('span', {
776
+ class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
777
+ })
778
+ ])
779
+ : renderEmptyElement($xeTable),
780
+ h('div', {
781
+ class: 'vxe-table-custom--name-option'
782
+ }, [
783
+ allowSort && ((isCrossDrag ? immediate : false) || column.level === 1)
784
+ ? h('div', {
785
+ class: 'vxe-table-custom--sort-option'
786
+ }, [
787
+ h('span', {
788
+ class: ['vxe-table-custom--sort-btn', {
789
+ 'is--disabled': isHidden
790
+ }],
791
+ attrs: {
792
+ title: getI18n('vxe.custom.setting.sortHelpTip')
793
+ },
794
+ on: isHidden
795
+ ? {}
796
+ : {
797
+ mousedown: $xeTableCustomPanel.sortMousedownEvent,
798
+ mouseup: $xeTableCustomPanel.sortMouseupEvent
799
+ }
800
+ }, [
801
+ h('i', {
802
+ class: getIcon().TABLE_CUSTOM_SORT
803
+ })
804
+ ])
805
+ ])
806
+ : renderEmptyElement($xeTable),
807
+ column.type === 'html'
808
+ ? h('div', {
809
+ key: '1',
810
+ class: 'vxe-table-custom--checkbox-label',
811
+ domProps: {
812
+ innerHTML: colTitle
813
+ }
814
+ })
815
+ : h('div', {
816
+ key: '0',
817
+ class: 'vxe-table-custom--checkbox-label',
818
+ attrs: {
819
+ title: colTitle
820
+ }
821
+ }, colTitle)
822
+ ]),
823
+ !parent && allowFixed
824
+ ? h('div', {
825
+ class: 'vxe-table-custom--fixed-option'
826
+ }, [
827
+ h(VxeUIButtonComponent, {
828
+ props: {
829
+ mode: 'text',
830
+ icon: column.renderFixed === 'left' ? getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_LEFT,
831
+ status: column.renderFixed === 'left' ? 'primary' : '',
832
+ disabled: isHidden || (isMaxFixedColumn && !column.renderFixed),
833
+ title: getI18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft')
834
+ },
835
+ on: {
836
+ click: ({ $event }: VxeButtonDefines.ClickEventParams) => {
837
+ $xeTableCustomPanel.changeFixedOption(column, 'left', $event)
838
+ }
839
+ }
840
+ }),
841
+ h(VxeUIButtonComponent, {
842
+ props: {
843
+ mode: 'text',
844
+ icon: column.renderFixed === 'right' ? getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,
845
+ status: column.renderFixed === 'right' ? 'primary' : '',
846
+ disabled: isHidden || (isMaxFixedColumn && !column.renderFixed),
847
+ title: getI18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight')
848
+ },
849
+ on: {
850
+ click: ({ $event }: VxeButtonDefines.ClickEventParams) => {
851
+ $xeTableCustomPanel.changeFixedOption(column, 'right', $event)
852
+ }
853
+ }
854
+ })
855
+ ])
856
+ : renderEmptyElement($xeTable)
857
+ ])
858
+ )
859
+ }
860
+ })
861
+ const popupStys: VxeComponentStyleType = {}
862
+ if (maxHeight && !['left', 'right'].includes(placement || '')) {
863
+ if (popupTop) {
864
+ popupStys.top = toCssUnit(popupTop)
865
+ }
866
+ popupStys.maxHeight = toCssUnit(maxHeight)
867
+ }
868
+ return h('div', {
869
+ ref: 'refElem',
870
+ key: 'simple',
871
+ class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
872
+ 'is--active': customStore.visible
873
+ }],
874
+ style: popupStys
875
+ }, customStore.visible
876
+ ? [
877
+ h('div', {
878
+ ref: 'refBodyWrapperElem',
879
+ class: 'vxe-table-custom-simple--body-wrapper'
880
+ }, [
881
+ !treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregateSimplePanel
882
+ ? h($xeTable.getPivotTableAggregateSimplePanel(), {
883
+ props: {
884
+ customStore
885
+ }
886
+ })
887
+ : renderEmptyElement($xeTable),
888
+ h('div', {
889
+ ref: 'refCustomBodyElem',
890
+ class: 'vxe-table-custom--handle-wrapper'
891
+ }, [
892
+ h('div', {
893
+ class: 'vxe-table-custom--header'
894
+ }, headerSlot
895
+ ? $xeTable.callSlot(headerSlot, params, h)
896
+ : [
897
+ h('ul', {
898
+ class: 'vxe-table-custom--panel-list'
899
+ }, [
900
+ h('li', {
901
+ class: 'vxe-table-custom--option'
902
+ }, [
903
+ allowVisible
904
+ ? h('div', {
905
+ class: ['vxe-table-custom--checkbox-option', {
906
+ 'is--checked': isAllChecked,
907
+ 'is--indeterminate': isAllIndeterminate
908
+ }],
909
+ attrs: {
910
+ title: getI18n('vxe.table.allTitle')
911
+ },
912
+ on: {
913
+ click: $xeTableCustomPanel.allOptionEvent
914
+ }
915
+ }, [
916
+ h('span', {
917
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
918
+ }),
919
+ h('span', {
920
+ class: 'vxe-checkbox--label'
921
+ }, getI18n('vxe.toolbar.customAll'))
922
+ ])
923
+ : h('span', {
924
+ class: 'vxe-checkbox--label'
925
+ }, getI18n('vxe.table.customTitle'))
926
+ ])
927
+ ])
928
+ ]),
929
+ h('div', {
930
+ class: 'vxe-table-custom--body'
931
+ }, [
932
+ topSlot
933
+ ? h('div', {
934
+ class: 'vxe-table-custom--panel-top'
935
+ }, $xeTable.callSlot(topSlot, params, h))
936
+ : renderEmptyElement($xeTable),
937
+ defaultSlot
938
+ ? h('div', {
939
+ class: 'vxe-table-custom--panel-body'
940
+ }, $xeTable.callSlot(defaultSlot, params, h))
941
+ : h('transition-group', {
942
+ class: 'vxe-table-custom--panel-list',
943
+ props: {
944
+ name: 'vxe-table-custom--list',
945
+ tag: 'ul'
946
+ },
947
+ on: customWrapperOns
948
+ }, colVNs),
949
+ bottomSlot
950
+ ? h('div', {
951
+ class: 'vxe-table-custom--panel-bottom'
952
+ }, $xeTable.callSlot(bottomSlot, params, h))
953
+ : renderEmptyElement($xeTable)
954
+ ]),
955
+ customOpts.showFooter
956
+ ? h('div', {
957
+ class: 'vxe-table-custom--footer'
958
+ }, footerSlot
959
+ ? $xeTable.callSlot(footerSlot, params, h)
960
+ : [
961
+ h('div', {
962
+ class: 'vxe-table-custom--footer-buttons'
963
+ }, [
964
+ h(VxeUIButtonComponent, {
965
+ props: {
966
+ mode: 'text',
967
+ content: customOpts.resetButtonText || getI18n('vxe.table.customRestore'),
968
+ disabled: !isCustomStatus
969
+ },
970
+ on: {
971
+ click: $xeTableCustomPanel.resetCustomEvent
972
+ }
973
+ }),
974
+ immediate
975
+ ? h(VxeUIButtonComponent, {
976
+ props: {
977
+ mode: 'text',
978
+ content: customOpts.closeButtonText || getI18n('vxe.table.customClose')
979
+ },
980
+ on: {
981
+ click: $xeTableCustomPanel.cancelCloseEvent
982
+ }
983
+ })
984
+ : h(VxeUIButtonComponent, {
985
+ props: {
986
+ mode: 'text',
987
+ content: customOpts.resetButtonText || getI18n('vxe.table.customCancel')
988
+ },
989
+ on: {
990
+ click: $xeTableCustomPanel.cancelCustomEvent
991
+ }
992
+ }),
993
+ immediate
994
+ ? renderEmptyElement($xeTable)
995
+ : h(VxeUIButtonComponent, {
996
+ props: {
997
+ mode: 'text',
998
+ status: 'primary',
999
+ content: customOpts.confirmButtonText || getI18n('vxe.table.customConfirm')
1000
+ },
1001
+ on: {
1002
+ click: $xeTableCustomPanel.confirmCustomEvent
1003
+ }
1004
+ })
1005
+ ])
1006
+ ])
1007
+ : null
1008
+ ]),
1009
+ $xeTableCustomPanel.renderDragTip(h)
1010
+ ])
1011
+ ]
1012
+ : [])
1013
+ },
1014
+ renderPopupPanel (h: CreateElement) {
1015
+ const VxeUIModalComponent = VxeUI.getComponent('VxeModal')
1016
+ const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer')
1017
+ const VxeUIButtonComponent = VxeUI.getComponent('VxeButton')
1018
+ const VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput')
1019
+
1020
+ const $xeTableCustomPanel = this
1021
+ const props = $xeTableCustomPanel
1022
+ const $xeTable = $xeTableCustomPanel.$xeTable
1023
+ const tableProps = $xeTable
1024
+ const tableReactData = $xeTable as unknown as TableReactData
1025
+ const $xeGrid = $xeTable.$xeGrid
1026
+ const $xeGantt = $xeTable.$xeGantt
1027
+
1028
+ const { customStore } = props
1029
+ const { treeConfig, rowGroupConfig, aggregateConfig, resizable: allResizable } = tableProps
1030
+ const { isCustomStatus, customColumnList } = tableReactData
1031
+ const customOpts = $xeTable.computeCustomOpts
1032
+ const { immediate } = customOpts
1033
+ const columnDragOpts = $xeTable.computeColumnDragOpts
1034
+ const { mode, modalOptions, drawerOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts
1035
+ const columnOpts = $xeTable.computeColumnOpts
1036
+ const { maxFixedSize } = columnOpts
1037
+ const resizableOpts = $xeTable.computeResizableOpts
1038
+ const { minWidth: reMinWidth, maxWidth: reMaxWidth } = resizableOpts
1039
+ const modalOpts = Object.assign({}, modalOptions)
1040
+ const drawerOpts = Object.assign({}, drawerOptions)
1041
+ const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
1042
+ const { isCrossDrag } = columnDragOpts
1043
+ const slots = customOpts.slots || {}
1044
+ const headerSlot = slots.header
1045
+ const topSlot = slots.top
1046
+ const bottomSlot = slots.bottom
1047
+ const defaultSlot = slots.default
1048
+ const footerSlot = slots.footer
1049
+ const trVNs: VNode[] = []
1050
+ const isAllChecked = customStore.isAll
1051
+ const isAllIndeterminate = customStore.isIndeterminate
1052
+ const params = {
1053
+ $table: $xeTable,
1054
+ $grid: $xeGrid,
1055
+ $gantt: $xeGantt,
1056
+ columns: customColumnList,
1057
+ isAllChecked,
1058
+ isAllIndeterminate,
1059
+ isCustomStatus
1060
+ }
1061
+ XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
1062
+ const isVisible = visibleMethod ? visibleMethod({ $table: $xeTable, column }) : true
1063
+ if (isVisible) {
1064
+ // 默认继承调整宽度
1065
+ let customMinWidth = 0
1066
+ let customMaxWidth = 0
1067
+ if (allowResizable) {
1068
+ const resizeParams = {
1069
+ $table: $xeTable,
1070
+ column,
1071
+ columnIndex: index,
1072
+ $columnIndex: index,
1073
+ $rowIndex: -1
1074
+ }
1075
+ if (reMinWidth) {
1076
+ customMinWidth = XEUtils.toNumber(XEUtils.isFunction(reMinWidth) ? reMinWidth(resizeParams) : reMinWidth)
1077
+ }
1078
+ if (reMaxWidth) {
1079
+ customMaxWidth = XEUtils.toNumber(XEUtils.isFunction(reMaxWidth) ? reMaxWidth(resizeParams) : reMaxWidth)
1080
+ }
1081
+ }
1082
+
1083
+ const isChecked = column.renderVisible
1084
+ const isIndeterminate = column.halfVisible
1085
+ const colTitle = formatText(column.getTitle(), 1)
1086
+ const isColGroup = column.children && column.children.length
1087
+ const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
1088
+ const isHidden = !isChecked
1089
+ trVNs.push(
1090
+ h('tr', {
1091
+ key: column.id,
1092
+ attrs: {
1093
+ colid: column.id
1094
+ },
1095
+ class: [`vxe-table-custom-popup--row level--${column.level}`, {
1096
+ 'is--group': isColGroup
1097
+ }],
1098
+ on: {
1099
+ dragstart: $xeTableCustomPanel.sortDragstartEvent,
1100
+ dragend: $xeTableCustomPanel.sortDragendEvent,
1101
+ dragover: $xeTableCustomPanel.sortDragoverEvent
1102
+ }
1103
+ }, [
1104
+ allowVisible
1105
+ ? h('td', {
1106
+ class: 'vxe-table-custom-popup--column-item col--visible'
1107
+ }, [
1108
+ h('div', {
1109
+ class: ['vxe-table-custom--checkbox-option', {
1110
+ 'is--checked': isChecked,
1111
+ 'is--indeterminate': isIndeterminate,
1112
+ 'is--disabled': isDisabled
1113
+ }],
1114
+ attrs: {
1115
+ title: getI18n('vxe.custom.setting.colVisible')
1116
+ },
1117
+ on: {
1118
+ click: (evnt: MouseEvent) => {
1119
+ if (!isDisabled) {
1120
+ $xeTableCustomPanel.changeCheckboxOption(column, evnt)
1121
+ }
1122
+ }
1123
+ }
1124
+ }, [
1125
+ h('span', {
1126
+ class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
1127
+ })
1128
+ ])
1129
+ ])
1130
+ : renderEmptyElement($xeTable),
1131
+ h('td', {
1132
+ class: 'vxe-table-custom-popup--column-item col--name'
1133
+ }, [
1134
+ h('div', {
1135
+ class: 'vxe-table-custom-popup--name'
1136
+ }, [
1137
+ allowSort
1138
+ ? ((isCrossDrag ? immediate : false) || column.level === 1
1139
+ ? h('div', {
1140
+ class: ['vxe-table-custom-popup--column-sort-btn', {
1141
+ 'is--disabled': isHidden
1142
+ }],
1143
+ attrs: {
1144
+ title: getI18n('vxe.custom.setting.sortHelpTip')
1145
+ },
1146
+ on: (isHidden
1147
+ ? {}
1148
+ : {
1149
+ mousedown: $xeTableCustomPanel.sortMousedownEvent,
1150
+ mouseup: $xeTableCustomPanel.sortMouseupEvent
1151
+ })
1152
+ }, [
1153
+ h('i', {
1154
+ class: getIcon().TABLE_CUSTOM_SORT
1155
+ })
1156
+ ])
1157
+ : h('div', {
1158
+ class: 'vxe-table-custom-popup--column-sort-placeholder'
1159
+ }))
1160
+ : renderEmptyElement($xeTable),
1161
+ column.type === 'html'
1162
+ ? h('div', {
1163
+ key: '1',
1164
+ class: 'vxe-table-custom-popup--title',
1165
+ domProps: {
1166
+ innerHTML: colTitle
1167
+ }
1168
+ })
1169
+ : h('div', {
1170
+ key: '0',
1171
+ class: 'vxe-table-custom-popup--title',
1172
+ attrs: {
1173
+ title: colTitle
1174
+ }
1175
+ }, colTitle)
1176
+ ])
1177
+ ]),
1178
+ allowResizable
1179
+ ? h('td', {
1180
+ class: 'vxe-table-custom-popup--column-item col--resizable'
1181
+ }, [
1182
+ (
1183
+ (column.children && column.children.length) ||
1184
+ !(XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
1185
+ )
1186
+ ? h('span', '-')
1187
+ : (VxeUINumberInputComponent
1188
+ ? h(VxeUINumberInputComponent, {
1189
+ props: {
1190
+ type: 'integer',
1191
+ immediate: false,
1192
+ disabled: isHidden,
1193
+ value: column.renderResizeWidth,
1194
+ min: customMinWidth || undefined,
1195
+ max: customMaxWidth || undefined
1196
+ },
1197
+ on: {
1198
+ modelValue (value: any) {
1199
+ column.renderResizeWidth = Math.max(0, Number(value))
1200
+ },
1201
+ change () {
1202
+ $xeTableCustomPanel.changeColumnWidth(column)
1203
+ }
1204
+ }
1205
+ })
1206
+ : renderEmptyElement($xeTableCustomPanel)
1207
+ )
1208
+ ])
1209
+ : renderEmptyElement($xeTable),
1210
+ allowFixed
1211
+ ? h('td', {
1212
+ class: 'vxe-table-custom-popup--column-item col--fixed'
1213
+ }, [
1214
+ parent
1215
+ ? h('span', '-')
1216
+ : h('vxe-radio-group', {
1217
+ props: {
1218
+ value: column.renderFixed || '',
1219
+ type: 'button',
1220
+ size: 'mini',
1221
+ disabled: isHidden,
1222
+ options: [
1223
+ { label: getI18n('vxe.custom.setting.fixedLeft'), value: 'left', disabled: isHidden || isMaxFixedColumn },
1224
+ { label: getI18n('vxe.custom.setting.fixedUnset'), value: '', disabled: isHidden },
1225
+ { label: getI18n('vxe.custom.setting.fixedRight'), value: 'right', disabled: isHidden || isMaxFixedColumn }
1226
+ ]
1227
+ },
1228
+ on: {
1229
+ change ({ label, $event }: VxeRadioGroupDefines.ChangeEventParams) {
1230
+ $xeTableCustomPanel.changeFixedOption(column, label, $event)
1231
+ }
1232
+ }
1233
+ })
1234
+ ])
1235
+ : renderEmptyElement($xeTable)
1236
+ ])
1237
+ )
1238
+ }
1239
+ })
1240
+ const scopedSlots: Record<string, any> = {
1241
+ default: () => {
1242
+ return h('div', {
1243
+ ref: 'refBodyWrapperElem',
1244
+ class: 'vxe-table-custom-popup--body-wrapper'
1245
+ }, defaultSlot
1246
+ ? $xeTable.callSlot(defaultSlot, params, h)
1247
+ : [
1248
+ !treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregatePopupPanel
1249
+ ? h($xeTable.getPivotTableAggregatePopupPanel(), {
1250
+ props: {
1251
+ customStore
1252
+ }
1253
+ })
1254
+ : renderEmptyElement($xeTable),
1255
+ h('div', {
1256
+ ref: 'refCustomBodyElem',
1257
+ class: 'vxe-table-custom-popup--handle-wrapper'
1258
+ }, [
1259
+ topSlot
1260
+ ? h('div', {
1261
+ class: 'vxe-table-custom-popup--table-top'
1262
+ }, $xeTable.callSlot(topSlot, params, h))
1263
+ : renderEmptyElement($xeTable),
1264
+ h('div', {
1265
+ class: 'vxe-table-custom-popup--table-wrapper'
1266
+ }, [
1267
+ h('table', {}, [
1268
+ h('colgroup', {}, [
1269
+ allowVisible
1270
+ ? h('col', {
1271
+ class: 'vxe-table-custom-popup--table-col-seq'
1272
+ })
1273
+ : renderEmptyElement($xeTable),
1274
+ h('col', {
1275
+ class: 'vxe-table-custom-popup--table-col-title'
1276
+ }),
1277
+ allowResizable
1278
+ ? h('col', {
1279
+ class: 'vxe-table-custom-popup--table-col-width'
1280
+ })
1281
+ : renderEmptyElement($xeTable),
1282
+ allowFixed
1283
+ ? h('col', {
1284
+ class: 'vxe-table-custom-popup--table-col-fixed'
1285
+ })
1286
+ : renderEmptyElement($xeTable)
1287
+ ]),
1288
+ h('thead', {}, [
1289
+ h('tr', {}, [
1290
+ allowVisible
1291
+ ? h('th', {}, [
1292
+ h('div', {
1293
+ class: ['vxe-table-custom--checkbox-option', {
1294
+ 'is--checked': isAllChecked,
1295
+ 'is--indeterminate': isAllIndeterminate
1296
+ }],
1297
+ attrs: {
1298
+ title: getI18n('vxe.table.allTitle')
1299
+ },
1300
+ on: {
1301
+ click: $xeTableCustomPanel.allOptionEvent
1302
+ }
1303
+
1304
+ }, [
1305
+ h('span', {
1306
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
1307
+ }),
1308
+ h('span', {
1309
+ class: 'vxe-checkbox--label'
1310
+ }, getI18n('vxe.toolbar.customAll'))
1311
+ ])
1312
+ ])
1313
+ : renderEmptyElement($xeTable),
1314
+ h('th', {}, getI18n('vxe.custom.setting.colTitle')),
1315
+ allowResizable
1316
+ ? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
1317
+ : renderEmptyElement($xeTable),
1318
+ allowFixed
1319
+ ? h('th', {}, getI18n(`vxe.custom.setting.${maxFixedSize ? 'colFixedMax' : 'colFixed'}`, [maxFixedSize]))
1320
+ : renderEmptyElement($xeTable)
1321
+ ])
1322
+ ]),
1323
+ h('transition-group', {
1324
+ class: 'vxe-table-custom--panel-list',
1325
+ props: {
1326
+ tag: 'tbody',
1327
+ name: 'vxe-table-custom--list'
1328
+ }
1329
+ }, trVNs)
1330
+ ])
1331
+ ]),
1332
+ bottomSlot
1333
+ ? h('div', {
1334
+ class: 'vxe-table-custom-popup--table-bottom'
1335
+ }, $xeTable.callSlot(bottomSlot, params, h))
1336
+ : renderEmptyElement($xeTable),
1337
+ $xeTableCustomPanel.renderDragTip(h)
1338
+ ])
1339
+ ])
1340
+ },
1341
+ footer: () => {
1342
+ if (footerSlot) {
1343
+ return $xeTable.callSlot(footerSlot, params, h)
1344
+ }
1345
+ return h('div', {
1346
+ class: 'vxe-table-custom-popup--footer'
1347
+ }, [
1348
+ h(VxeUIButtonComponent, {
1349
+ props: {
1350
+ content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore'),
1351
+ disabled: !isCustomStatus
1352
+ },
1353
+ on: {
1354
+ click: $xeTableCustomPanel.resetCustomEvent
1355
+ }
1356
+ }),
1357
+ immediate
1358
+ ? h(VxeUIButtonComponent, {
1359
+ props: {
1360
+ content: customOpts.resetButtonText || getI18n('vxe.table.customClose')
1361
+ },
1362
+ on: {
1363
+ click: $xeTableCustomPanel.cancelCloseEvent
1364
+ }
1365
+ })
1366
+ : h(VxeUIButtonComponent, {
1367
+ props: {
1368
+ content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel')
1369
+ },
1370
+ on: {
1371
+ click: $xeTableCustomPanel.cancelCustomEvent
1372
+ }
1373
+ }),
1374
+ immediate
1375
+ ? renderEmptyElement($xeTable)
1376
+ : h(VxeUIButtonComponent, {
1377
+ props: {
1378
+ status: 'primary',
1379
+ content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm')
1380
+ },
1381
+ on: {
1382
+ click: $xeTableCustomPanel.confirmCustomEvent
1383
+ }
1384
+ })
1385
+ ])
1386
+ }
1387
+ }
1388
+ if (headerSlot) {
1389
+ scopedSlots.header = () => $xeTable.callSlot(headerSlot, params, h)
1390
+ }
1391
+ if (mode === 'drawer') {
1392
+ return VxeUIDrawerComponent
1393
+ ? h(VxeUIDrawerComponent, {
1394
+ key: 'drawer',
1395
+ props: {
1396
+ className: ['vxe-table-custom-drawer-wrapper', 'vxe-table--ignore-clear', drawerOpts.className || ''].join(' '),
1397
+ value: customStore.visible,
1398
+ title: drawerOpts.title || getI18n('vxe.custom.cstmTitle'),
1399
+ width: drawerOpts.width || Math.min(880, Math.floor(document.documentElement.clientWidth * 0.6)),
1400
+ position: drawerOpts.position,
1401
+ resize: !!drawerOpts.resize,
1402
+ escClosable: !!drawerOpts.escClosable,
1403
+ maskClosable: !!drawerOpts.maskClosable,
1404
+ destroyOnClose: true,
1405
+ showFooter: true
1406
+ },
1407
+ on: {
1408
+ input (value: any) {
1409
+ customStore.visible = value
1410
+ }
1411
+ },
1412
+ scopedSlots
1413
+ })
1414
+ : renderEmptyElement($xeTableCustomPanel)
1415
+ }
1416
+ return VxeUIModalComponent
1417
+ ? h(VxeUIModalComponent, {
1418
+ key: 'modal',
1419
+ props: {
1420
+ className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
1421
+ value: customStore.visible,
1422
+ title: modalOpts.title || getI18n('vxe.custom.cstmTitle'),
1423
+ width: modalOpts.width || Math.min(880, document.documentElement.clientWidth),
1424
+ minWidth: modalOpts.minWidth || 700,
1425
+ height: modalOpts.height || Math.min(680, document.documentElement.clientHeight),
1426
+ minHeight: modalOpts.minHeight || 400,
1427
+ showZoom: modalOpts.showZoom,
1428
+ showMaximize: modalOpts.showMaximize,
1429
+ showMinimize: modalOpts.showMinimize,
1430
+ mask: modalOpts.mask,
1431
+ lockView: modalOpts.lockView,
1432
+ resize: modalOpts.resize,
1433
+ escClosable: !!modalOpts.escClosable,
1434
+ maskClosable: !!modalOpts.maskClosable,
1435
+ destroyOnClose: true,
1436
+ showFooter: true
1437
+ },
1438
+ on: {
1439
+ input (value: any) {
1440
+ customStore.visible = value
1441
+ }
1442
+ },
1443
+ scopedSlots
1444
+ })
1445
+ : renderEmptyElement($xeTableCustomPanel)
1446
+ },
1447
+ renderVN (h: CreateElement) {
1448
+ const $xeTableCustomPanel = this
1449
+ const $xeTable = $xeTableCustomPanel.$xeTable
1450
+
1451
+ const customOpts = $xeTable.computeCustomOpts
1452
+ if (['modal', 'drawer', 'popup'].includes(`${customOpts.mode}`)) {
1453
+ return $xeTableCustomPanel.renderPopupPanel(h)
1454
+ }
1455
+ return $xeTableCustomPanel.renderSimplePanel(h)
1456
+ }
1457
+ },
1458
+ render (h: CreateElement) {
1459
+ return (this as any).renderVN(h)
1460
+ }
1461
+ }) /* define-vxe-component end */