vxe-table 4.23.7 → 4.23.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/all.esm.js +5859 -4018
  2. package/es/colgroup/index.js +1 -1
  3. package/es/column/index.js +1 -1
  4. package/es/components.d.ts +3 -0
  5. package/es/components.js +4 -8
  6. package/es/grid/index.js +1 -1
  7. package/es/grid/src/emits.js +1 -15
  8. package/es/grid/src/grid.js +398 -121
  9. package/es/grid/src/props.js +1 -1
  10. package/es/index.esm.js +6 -0
  11. package/es/index.js +6 -0
  12. package/es/table/index.js +1 -1
  13. package/es/table/module/custom/hook.js +50 -43
  14. package/es/table/module/custom/panel.js +778 -528
  15. package/es/table/module/edit/hook.js +141 -63
  16. package/es/table/module/export/export-panel.js +400 -317
  17. package/es/table/module/export/hook.js +396 -338
  18. package/es/table/module/export/import-panel.js +153 -124
  19. package/es/table/module/filter/hook.js +17 -3
  20. package/es/table/module/filter/panel.js +147 -85
  21. package/es/table/module/keyboard/hook.js +9 -5
  22. package/es/table/module/menu/hook.js +1 -1
  23. package/es/table/module/menu/panel.js +198 -127
  24. package/es/table/module/validator/hook.js +1 -1
  25. package/es/table/render/index.js +152 -99
  26. package/es/table/src/body.js +356 -234
  27. package/es/table/src/cell.js +427 -270
  28. package/es/table/src/columnInfo.js +2 -1
  29. package/es/table/src/footer.js +145 -100
  30. package/es/table/src/group.js +7 -3
  31. package/es/table/src/header.js +230 -173
  32. package/es/table/src/props.js +1 -1
  33. package/es/table/src/table.js +1504 -1031
  34. package/es/table/src/util.js +15 -19
  35. package/es/toolbar/index.js +1 -1
  36. package/es/toolbar/src/toolbar.js +133 -76
  37. package/es/ui/index.d.ts +0 -1
  38. package/es/ui/index.js +1 -2
  39. package/es/ui/src/dom.js +9 -6
  40. package/es/ui/src/log.js +1 -1
  41. package/es/ui/src/utils.d.ts +1 -1
  42. package/es/v-x-e-table/index.d.ts +0 -1
  43. package/es/v-x-e-table/index.js +0 -1
  44. package/lib/colgroup/index.js +5 -5
  45. package/lib/column/index.js +5 -5
  46. package/lib/components.js +8 -12
  47. package/lib/grid/index.js +4 -4
  48. package/lib/grid/src/emits.js +1 -15
  49. package/lib/grid/src/grid.js +419 -142
  50. package/lib/grid/src/props.js +2 -2
  51. package/lib/index.common.js +6 -0
  52. package/lib/index.js +6 -0
  53. package/lib/index.umd.js +5825 -3945
  54. package/lib/index.umd.min.js +3 -3
  55. package/lib/table/index.js +5 -5
  56. package/lib/table/module/custom/hook.js +51 -44
  57. package/lib/table/module/custom/panel.js +790 -540
  58. package/lib/table/module/edit/hook.js +142 -64
  59. package/lib/table/module/export/export-panel.js +406 -323
  60. package/lib/table/module/export/hook.js +419 -361
  61. package/lib/table/module/export/import-panel.js +157 -128
  62. package/lib/table/module/filter/hook.js +18 -4
  63. package/lib/table/module/filter/panel.js +149 -87
  64. package/lib/table/module/keyboard/hook.js +10 -6
  65. package/lib/table/module/menu/hook.js +2 -2
  66. package/lib/table/module/menu/panel.js +199 -128
  67. package/lib/table/module/validator/hook.js +2 -2
  68. package/lib/table/render/index.js +153 -100
  69. package/lib/table/src/body.js +357 -235
  70. package/lib/table/src/cell.js +428 -271
  71. package/lib/table/src/columnInfo.js +3 -2
  72. package/lib/table/src/footer.js +146 -101
  73. package/lib/table/src/group.js +7 -3
  74. package/lib/table/src/header.js +231 -174
  75. package/lib/table/src/props.js +2 -2
  76. package/lib/table/src/table.js +1487 -1045
  77. package/lib/table/src/util.js +15 -19
  78. package/lib/toolbar/index.js +4 -4
  79. package/lib/toolbar/src/toolbar.js +135 -78
  80. package/lib/ui/index.js +1 -3
  81. package/lib/ui/src/dom.js +9 -6
  82. package/lib/ui/src/log.js +1 -1
  83. package/lib/v-x-e-table/index.js +0 -2
  84. package/package.json +8 -3
  85. package/packages/colgroup/index.ts +22 -22
  86. package/packages/column/index.ts +22 -22
  87. package/packages/components.ts +41 -43
  88. package/packages/grid/index.ts +18 -18
  89. package/packages/grid/src/emits.ts +5 -19
  90. package/packages/grid/src/grid.ts +2229 -1925
  91. package/packages/grid/src/props.ts +22 -23
  92. package/packages/index.ts +11 -4
  93. package/packages/locale/lang/fr-FR.ts +15 -15
  94. package/packages/locale/lang/it-IT.ts +4 -4
  95. package/packages/locale/lang/uk-UA.ts +1 -1
  96. package/packages/locale/lang/uz-UZ.ts +13 -13
  97. package/packages/locale/lang/zh-CN.ts +907 -907
  98. package/packages/table/index.ts +26 -26
  99. package/packages/table/module/custom/hook.ts +510 -503
  100. package/packages/table/module/custom/panel.ts +2002 -1743
  101. package/packages/table/module/edit/hook.ts +1224 -1131
  102. package/packages/table/module/export/export-panel.ts +697 -611
  103. package/packages/table/module/export/hook.ts +2160 -2059
  104. package/packages/table/module/export/import-panel.ts +319 -279
  105. package/packages/table/module/export/util.ts +25 -24
  106. package/packages/table/module/filter/hook.ts +519 -501
  107. package/packages/table/module/filter/panel.ts +368 -304
  108. package/packages/table/module/keyboard/hook.ts +498 -494
  109. package/packages/table/module/menu/hook.ts +330 -330
  110. package/packages/table/module/menu/panel.ts +272 -201
  111. package/packages/table/module/validator/hook.ts +653 -635
  112. package/packages/table/render/index.ts +1819 -1744
  113. package/packages/table/src/body.ts +1078 -955
  114. package/packages/table/src/cell.ts +1524 -1359
  115. package/packages/table/src/column.ts +192 -192
  116. package/packages/table/src/columnInfo.ts +232 -232
  117. package/packages/table/src/emits.ts +134 -134
  118. package/packages/table/src/footer.ts +425 -380
  119. package/packages/table/src/group.ts +67 -63
  120. package/packages/table/src/header.ts +642 -581
  121. package/packages/table/src/props.ts +336 -336
  122. package/packages/table/src/store.ts +14 -14
  123. package/packages/table/src/table.ts +16011 -15454
  124. package/packages/table/src/use/cell-view.ts +41 -44
  125. package/packages/table/src/use/index.ts +1 -1
  126. package/packages/table/src/util.ts +1206 -1216
  127. package/packages/toolbar/index.ts +18 -18
  128. package/packages/toolbar/src/toolbar.ts +768 -706
  129. package/packages/ui/index.ts +519 -521
  130. package/packages/ui/src/anime.ts +51 -52
  131. package/packages/ui/src/comp.ts +3 -3
  132. package/packages/ui/src/dom.ts +466 -463
  133. package/packages/ui/src/log.ts +19 -19
  134. package/packages/ui/src/utils.ts +66 -66
  135. package/packages/ui/src/vn.ts +55 -55
  136. package/packages/v-x-e-table/index.d.ts +3 -4
  137. package/packages/v-x-e-table/index.ts +3 -4
  138. package/types/all.d.ts +76 -76
  139. package/types/index.d.ts +4 -4
  140. /package/dist/{iconfont.1792979665397.ttf → iconfont.1793009263429.ttf} +0 -0
  141. /package/dist/{iconfont.1792979665397.woff → iconfont.1793009263429.woff} +0 -0
  142. /package/dist/{iconfont.1792979665397.woff2 → iconfont.1793009263429.woff2} +0 -0
  143. /package/es/{iconfont.1792979665397.ttf → iconfont.1793009263429.ttf} +0 -0
  144. /package/es/{iconfont.1792979665397.woff → iconfont.1793009263429.woff} +0 -0
  145. /package/es/{iconfont.1792979665397.woff2 → iconfont.1793009263429.woff2} +0 -0
  146. /package/lib/{iconfont.1792979665397.ttf → iconfont.1793009263429.ttf} +0 -0
  147. /package/lib/{iconfont.1792979665397.woff → iconfont.1793009263429.woff} +0 -0
  148. /package/lib/{iconfont.1792979665397.woff2 → iconfont.1793009263429.woff2} +0 -0
@@ -1,304 +1,368 @@
1
- import { h, ref, computed, inject, Teleport, PropType } from 'vue'
2
- import { defineVxeComponent } from '../../../ui/src/comp'
3
- import { VxeUI } from '../../../ui'
4
- import { formatText, isEnableConf } from '../../../ui/src/utils'
5
- import { getPropClass } from '../../../ui/src/dom'
6
- import { getSlotVNs } from '../../../ui/src/vn'
7
- import { createComponentLog } from '../../../ui/src/log'
8
- import XEUtils from 'xe-utils'
9
-
10
- import type { VxeGlobalRendererOptions } from 'vxe-pc-ui'
11
- import type { VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods, VxeColumnPropTypes, VxeTableDefines } from '../../../../types'
12
-
13
- const { warnLog } = createComponentLog('table')
14
-
15
- const { getI18n, getIcon, renderer, renderEmptyElement } = VxeUI
16
-
17
- export default defineVxeComponent({
18
- name: 'VxeTableFilterPanel',
19
- props: {
20
- filterStore: {
21
- type: Object as PropType<VxeTableDefines.FilterStoreObj>,
22
- default: () => ({} as VxeTableDefines.FilterStoreObj)
23
- }
24
- },
25
- setup (props, context) {
26
- const xID = XEUtils.uniqueId()
27
-
28
- const VxeUIScrollbarComponent = VxeUI.getComponent('VxeScrollbar')
29
-
30
- const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
31
- const { reactData: tableReactData, internalData: tableInternalData, getComputeMaps } = $xeTable
32
- const { computeFilterOpts, computeRendererOpts } = getComputeMaps()
33
-
34
- const refElem = ref<HTMLDivElement>()
35
-
36
- const refMaps = {
37
- refElem
38
- }
39
-
40
- const $xeFilterPanel: any = {
41
- xID,
42
- props,
43
- context,
44
- getRefMaps: () => refMaps
45
- }
46
-
47
- const computeHasCheckOption = computed(() => {
48
- const { filterStore } = props
49
- const { column } = filterStore
50
- return column && column.filters && column.filters.some((option) => option.checked)
51
- })
52
-
53
- // 全部筛选事件
54
- const filterCheckAllEvent = (evnt: Event, value: any) => {
55
- const { filterStore } = props
56
- const { column } = filterStore
57
- if (column && column.filters) {
58
- column.filters.forEach((option: any) => {
59
- option._checked = value
60
- option.checked = value
61
- })
62
- }
63
- filterStore.isAllSelected = value
64
- filterStore.isIndeterminate = false
65
- }
66
-
67
- /*************************
68
- * Publish methods
69
- *************************/
70
- // 确认筛选
71
- const confirmFilter = (evnt: Event) => {
72
- const { filterStore } = props
73
- if (!evnt) {
74
- warnLog('vxe.error.delFunc', ['confirmFilter', 'saveFilterPanelByEvent'])
75
- }
76
- $xeTable.handleFilterConfirmFilter(evnt || new Event('click'), filterStore.column || null)
77
- }
78
-
79
- // (单选)筛选发生改变
80
- const changeRadioOption = (evnt: Event, checked: boolean, item: any) => {
81
- $xeTable.handleFilterChangeRadioOption(evnt, checked, item)
82
- }
83
-
84
- /**
85
- * 重置筛选
86
- * 当筛选面板中的重置按钮被按下时触发
87
- * @param {Event} evnt 事件
88
- */
89
- const resetFilter = (evnt: Event) => {
90
- const { filterStore } = props
91
- $xeTable.handleFilterResetFilter(evnt, filterStore.column || null)
92
- }
93
-
94
- // (多选)筛选发生改变
95
- const changeMultipleOption = (evnt: Event, checked: boolean, item: any) => {
96
- $xeTable.handleFilterChangeMultipleOption(evnt, checked, item)
97
- }
98
-
99
- // 筛选发生改变
100
- const changeOption = (evnt: Event, checked: boolean, item: any) => {
101
- $xeTable.handleFilterChangeOption(evnt, checked, item)
102
- }
103
-
104
- const changeAllOption = (evnt: Event, checked: boolean) => {
105
- const { filterStore } = props
106
- const { column } = filterStore
107
- if (column && column.filterMultiple) {
108
- filterCheckAllEvent(evnt, checked)
109
- } else {
110
- resetFilter(evnt)
111
- }
112
- }
113
- /*************************
114
- * Publish methods
115
- *************************/
116
-
117
- const filterPanelMethods = {
118
- changeRadioOption,
119
- changeMultipleOption,
120
- changeAllOption,
121
- changeOption,
122
- confirmFilter,
123
- resetFilter
124
- }
125
- Object.assign($xeFilterPanel, filterPanelMethods)
126
-
127
- const renderOptions = (filterRender: VxeColumnPropTypes.FilterRender | null, compConf: VxeGlobalRendererOptions | null) => {
128
- const { filterStore } = props
129
- const { column } = filterStore
130
- if (!column) {
131
- return []
132
- }
133
- const filterOpts = computeFilterOpts.value
134
- const { useScrollbar } = filterOpts
135
- const { filterMultiple, filters, slots } = column
136
- const filterOptions = (filters || []) as VxeTableDefines.FilterOption[]
137
- const filterSlot = slots ? slots.filter : null
138
- const params = Object.assign({}, tableInternalData._currFilterParams, { option: filterOptions[0], $panel: $xeFilterPanel, $table: $xeTable })
139
- const rtFilter = compConf ? (compConf.renderTableFilter || compConf.renderFilter) : null
140
- if (filterSlot) {
141
- return [
142
- h('div', {
143
- class: 'vxe-table--filter-template'
144
- }, $xeTable.callSlot(filterSlot, params))
145
- ]
146
- } else if (filterRender && rtFilter) {
147
- return [
148
- h('div', {
149
- class: 'vxe-table--filter-template'
150
- }, getSlotVNs(rtFilter(filterRender, params)))
151
- ]
152
- }
153
- const isAllChecked = filterMultiple ? filterStore.isAllSelected : !filterOptions.some((item) => item._checked)
154
- const isAllIndeterminate = filterMultiple && filterStore.isIndeterminate
155
-
156
- const optVNs = filterOptions.map((item: any) => {
157
- const isChecked = item._checked
158
- const isIndeterminate = false
159
- return h('div', {
160
- class: ['vxe-table--filter-option', {
161
- 'is--checked': item._checked
162
- }],
163
- title: item.label,
164
- onClick: (evnt: MouseEvent) => {
165
- changeOption(evnt, !item._checked, item)
166
- }
167
- }, (filterMultiple
168
- ? [
169
- h('span', {
170
- class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
171
- })
172
- ]
173
- : []).concat([
174
- h('span', {
175
- class: 'vxe-checkbox--label'
176
- }, formatText(item.label, 1))
177
- ]))
178
- })
179
-
180
- return [
181
- h('div', {
182
- class: 'vxe-table--filter-header'
183
- }, [
184
- h('div', {
185
- class: ['vxe-table--filter-option', {
186
- 'is--checked': isAllChecked,
187
- 'is--indeterminate': isAllIndeterminate
188
- }],
189
- title: getI18n(filterMultiple ? 'vxe.table.allTitle' : 'vxe.table.allFilter'),
190
- onClick: (evnt: MouseEvent) => {
191
- changeAllOption(evnt, !filterStore.isAllSelected)
192
- }
193
- }, (filterMultiple
194
- ? [
195
- h('span', {
196
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
197
- })
198
- ]
199
- : []).concat([
200
- h('span', {
201
- class: 'vxe-checkbox--label'
202
- }, getI18n('vxe.table.allFilter'))
203
- ]))
204
- ]),
205
- useScrollbar
206
- ? h(VxeUIScrollbarComponent, {
207
- class: 'vxe-table--scrollbar-filter-body',
208
- viewClassName: 'vxe-table--scrollbar-filter-body-view'
209
- }, {
210
- default: () => optVNs
211
- })
212
- : h('div', {
213
- class: 'vxe-table--filter-body'
214
- }, optVNs)
215
- ]
216
- }
217
-
218
- const renderFooters = () => {
219
- const { filterStore } = props
220
- const { column } = filterStore
221
- if (!column) {
222
- return []
223
- }
224
- const filterOpts = computeFilterOpts.value
225
- const rendererOpts = computeRendererOpts.value
226
- const hasCheckOption = computeHasCheckOption.value
227
- const { filterRender, filterMultiple } = column
228
- const { confirmButtonText, resetButtonText, showFooter } = filterOpts
229
- const compConf = filterRender && isEnableConf(filterRender) && filterRender.name ? (rendererOpts[filterRender.name] || renderer.get(filterRender.name)) : null
230
- const isDisabled = !hasCheckOption && !filterStore.isAllSelected && !filterStore.isIndeterminate
231
- let showFlFoot = !!filterMultiple
232
- if (XEUtils.isBoolean(showFooter)) {
233
- showFlFoot = showFooter
234
- } else if (compConf) {
235
- showFlFoot = !(compConf.showTableFilterFooter === false || compConf.showFilterFooter === false || compConf.isFooter === false)
236
- }
237
- return showFlFoot
238
- ? [
239
- h('div', {
240
- class: 'vxe-table--filter-footer'
241
- }, [
242
- h('button', {
243
- class: {
244
- 'is--disabled': isDisabled
245
- },
246
- disabled: isDisabled,
247
- onClick: confirmFilter
248
- }, confirmButtonText || getI18n('vxe.table.confirmFilter')),
249
- h('button', {
250
- onClick: resetFilter
251
- }, resetButtonText || getI18n('vxe.table.resetFilter'))
252
- ])
253
- ]
254
- : []
255
- }
256
-
257
- const renderVN = () => {
258
- const { filterStore } = props
259
- const { initStore } = tableReactData
260
- const { visible, column } = filterStore
261
- if (!column) {
262
- return renderEmptyElement($xeFilterPanel)
263
- }
264
- const rendererOpts = computeRendererOpts.value
265
- const filterRender = column ? column.filterRender : null
266
- const compConf = filterRender && isEnableConf(filterRender) && filterRender.name ? (rendererOpts[filterRender.name] || renderer.get(filterRender.name)) : null
267
- const filterClassName = compConf ? (compConf.tableFilterClassName || compConf.filterClassName) : ''
268
- const params = Object.assign({}, tableInternalData._currFilterParams, { $panel: $xeFilterPanel, $table: $xeTable })
269
- const tableProps = $xeTable.props
270
- const { computeSize } = $xeTable.getComputeMaps()
271
- const vSize = computeSize.value
272
- const filterOpts = computeFilterOpts.value
273
- const { transfer, destroyOnClose, className } = filterOpts
274
- return h(Teleport, {
275
- to: 'body',
276
- disabled: !transfer
277
- }, [
278
- h('div', {
279
- ref: refElem,
280
- class: [
281
- 'vxe-table--filter-wrapper',
282
- 'filter--prevent-default',
283
- className,
284
- getPropClass(filterClassName, params),
285
- {
286
- [`size--${vSize}`]: vSize,
287
- 'is--animat': tableProps.animat,
288
- 'is--multiple': column.filterMultiple,
289
- 'is--active': visible
290
- }
291
- ],
292
- style: filterStore.style
293
- }, initStore.filter && (destroyOnClose ? visible : true) && column ? renderOptions(filterRender, compConf).concat(renderFooters()) : [])
294
- ])
295
- }
296
-
297
- $xeFilterPanel.renderVN = renderVN
298
-
299
- return $xeFilterPanel
300
- },
301
- render () {
302
- return this.renderVN()
303
- }
304
- })
1
+ import { h, ref, computed, inject, Teleport, PropType } from 'vue'
2
+ import { defineVxeComponent } from '../../../ui/src/comp'
3
+ import { VxeUI } from '@vxe-ui/core'
4
+ import { formatText, isEnableConf } from '../../../ui/src/utils'
5
+ import { getPropClass } from '../../../ui/src/dom'
6
+ import { getSlotVNs } from '../../../ui/src/vn'
7
+ import { createComponentLog } from '../../../ui/src/log'
8
+ import XEUtils from 'xe-utils'
9
+
10
+ import type { VxeGlobalRendererOptions } from 'vxe-pc-ui'
11
+ import type { VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods, VxeColumnPropTypes, VxeTableDefines } from '../../../../types'
12
+
13
+ const { warnLog } = createComponentLog('table')
14
+
15
+ const { getI18n, getIcon, renderer, renderEmptyElement } = VxeUI
16
+
17
+ export default defineVxeComponent({
18
+ name: 'VxeTableFilterPanel',
19
+ props: {
20
+ filterStore: {
21
+ type: Object as PropType<VxeTableDefines.FilterStoreObj>,
22
+ default: () => ({}) as VxeTableDefines.FilterStoreObj
23
+ }
24
+ },
25
+ setup(props, context) {
26
+ const xID = XEUtils.uniqueId()
27
+
28
+ const VxeUIScrollbarComponent = VxeUI.getComponent('VxeScrollbar')
29
+
30
+ const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
31
+ const { reactData: tableReactData, internalData: tableInternalData, getComputeMaps } = $xeTable
32
+ const { computeFilterOpts, computeRendererOpts } = getComputeMaps()
33
+
34
+ const refElem = ref<HTMLDivElement>()
35
+
36
+ const refMaps = {
37
+ refElem
38
+ }
39
+
40
+ const $xeFilterPanel: any = {
41
+ xID,
42
+ props,
43
+ context,
44
+ getRefMaps: () => refMaps
45
+ }
46
+
47
+ const computeHasCheckOption = computed(() => {
48
+ const { filterStore } = props
49
+ const { column } = filterStore
50
+ return column && column.filters && column.filters.some((option) => option.checked)
51
+ })
52
+
53
+ // 全部筛选事件
54
+ const filterCheckAllEvent = (evnt: Event, value: any) => {
55
+ const { filterStore } = props
56
+ const { column } = filterStore
57
+ if (column && column.filters) {
58
+ column.filters.forEach((option: any) => {
59
+ option._checked = value
60
+ option.checked = value
61
+ })
62
+ }
63
+ filterStore.isAllSelected = value
64
+ filterStore.isIndeterminate = false
65
+ }
66
+
67
+ /*************************
68
+ * Publish methods
69
+ *************************/
70
+ // 确认筛选
71
+ const confirmFilter = (evnt: Event) => {
72
+ const { filterStore } = props
73
+ if (!evnt) {
74
+ warnLog('vxe.error.delFunc', ['confirmFilter', 'saveFilterPanelByEvent'])
75
+ }
76
+ $xeTable.handleFilterConfirmFilter(evnt || new Event('click'), filterStore.column || null)
77
+ }
78
+
79
+ // (单选)筛选发生改变
80
+ const changeRadioOption = (evnt: Event, checked: boolean, item: any) => {
81
+ $xeTable.handleFilterChangeRadioOption(evnt, checked, item)
82
+ }
83
+
84
+ /**
85
+ * 重置筛选
86
+ * 当筛选面板中的重置按钮被按下时触发
87
+ * @param {Event} evnt 事件
88
+ */
89
+ const resetFilter = (evnt: Event) => {
90
+ const { filterStore } = props
91
+ $xeTable.handleFilterResetFilter(evnt, filterStore.column || null)
92
+ }
93
+
94
+ // (多选)筛选发生改变
95
+ const changeMultipleOption = (evnt: Event, checked: boolean, item: any) => {
96
+ $xeTable.handleFilterChangeMultipleOption(evnt, checked, item)
97
+ }
98
+
99
+ // 筛选发生改变
100
+ const changeOption = (evnt: Event, checked: boolean, item: any) => {
101
+ $xeTable.handleFilterChangeOption(evnt, checked, item)
102
+ }
103
+
104
+ const changeAllOption = (evnt: Event, checked: boolean) => {
105
+ const { filterStore } = props
106
+ const { column } = filterStore
107
+ if (column && column.filterMultiple) {
108
+ filterCheckAllEvent(evnt, checked)
109
+ } else {
110
+ resetFilter(evnt)
111
+ }
112
+ }
113
+ /*************************
114
+ * Publish methods
115
+ *************************/
116
+
117
+ const filterPanelMethods = {
118
+ changeRadioOption,
119
+ changeMultipleOption,
120
+ changeAllOption,
121
+ changeOption,
122
+ confirmFilter,
123
+ resetFilter
124
+ }
125
+ Object.assign($xeFilterPanel, filterPanelMethods)
126
+
127
+ const renderOptions = (filterRender: VxeColumnPropTypes.FilterRender | null, compConf: VxeGlobalRendererOptions | null) => {
128
+ const { filterStore } = props
129
+ const { column } = filterStore
130
+ if (!column) {
131
+ return []
132
+ }
133
+ const filterOpts = computeFilterOpts.value
134
+ const { useScrollbar } = filterOpts
135
+ const { filterMultiple, filters, slots } = column
136
+ const filterOptions = (filters || []) as VxeTableDefines.FilterOption[]
137
+ const filterSlot = slots ? slots.filter : null
138
+ const params = Object.assign({}, tableInternalData._currFilterParams, { option: filterOptions[0], $panel: $xeFilterPanel, $table: $xeTable })
139
+ const rtFilter = compConf ? compConf.renderTableFilter || compConf.renderFilter : null
140
+ if (filterSlot) {
141
+ return [
142
+ h(
143
+ 'div',
144
+ {
145
+ class: 'vxe-table--filter-template'
146
+ },
147
+ $xeTable.callSlot(filterSlot, params)
148
+ )
149
+ ]
150
+ } else if (filterRender && rtFilter) {
151
+ return [
152
+ h(
153
+ 'div',
154
+ {
155
+ class: 'vxe-table--filter-template'
156
+ },
157
+ getSlotVNs(rtFilter(filterRender, params))
158
+ )
159
+ ]
160
+ }
161
+ const isAllChecked = filterMultiple ? filterStore.isAllSelected : !filterOptions.some((item) => item._checked)
162
+ const isAllIndeterminate = filterMultiple && filterStore.isIndeterminate
163
+
164
+ const optVNs = filterOptions.map((item: any) => {
165
+ const isChecked = item._checked
166
+ const isIndeterminate = false
167
+ return h(
168
+ 'div',
169
+ {
170
+ class: [
171
+ 'vxe-table--filter-option',
172
+ {
173
+ 'is--checked': item._checked
174
+ }
175
+ ],
176
+ title: item.label,
177
+ onClick: (evnt: MouseEvent) => {
178
+ changeOption(evnt, !item._checked, item)
179
+ }
180
+ },
181
+ (filterMultiple
182
+ ? [
183
+ h('span', {
184
+ class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
185
+ })
186
+ ]
187
+ : []
188
+ ).concat([
189
+ h(
190
+ 'span',
191
+ {
192
+ class: 'vxe-checkbox--label'
193
+ },
194
+ formatText(item.label, 1)
195
+ )
196
+ ])
197
+ )
198
+ })
199
+
200
+ return [
201
+ h(
202
+ 'div',
203
+ {
204
+ class: 'vxe-table--filter-header'
205
+ },
206
+ [
207
+ h(
208
+ 'div',
209
+ {
210
+ class: [
211
+ 'vxe-table--filter-option',
212
+ {
213
+ 'is--checked': isAllChecked,
214
+ 'is--indeterminate': isAllIndeterminate
215
+ }
216
+ ],
217
+ title: getI18n(filterMultiple ? 'vxe.table.allTitle' : 'vxe.table.allFilter'),
218
+ onClick: (evnt: MouseEvent) => {
219
+ changeAllOption(evnt, !filterStore.isAllSelected)
220
+ }
221
+ },
222
+ (filterMultiple
223
+ ? [
224
+ h('span', {
225
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
226
+ })
227
+ ]
228
+ : []
229
+ ).concat([
230
+ h(
231
+ 'span',
232
+ {
233
+ class: 'vxe-checkbox--label'
234
+ },
235
+ getI18n('vxe.table.allFilter')
236
+ )
237
+ ])
238
+ )
239
+ ]
240
+ ),
241
+ useScrollbar
242
+ ? h(
243
+ VxeUIScrollbarComponent,
244
+ {
245
+ class: 'vxe-table--scrollbar-filter-body',
246
+ viewClassName: 'vxe-table--scrollbar-filter-body-view'
247
+ },
248
+ {
249
+ default: () => optVNs
250
+ }
251
+ )
252
+ : h(
253
+ 'div',
254
+ {
255
+ class: 'vxe-table--filter-body'
256
+ },
257
+ optVNs
258
+ )
259
+ ]
260
+ }
261
+
262
+ const renderFooters = () => {
263
+ const { filterStore } = props
264
+ const { column } = filterStore
265
+ if (!column) {
266
+ return []
267
+ }
268
+ const filterOpts = computeFilterOpts.value
269
+ const rendererOpts = computeRendererOpts.value
270
+ const hasCheckOption = computeHasCheckOption.value
271
+ const { filterRender, filterMultiple } = column
272
+ const { confirmButtonText, resetButtonText, showFooter } = filterOpts
273
+ const compConf = filterRender && isEnableConf(filterRender) && filterRender.name ? rendererOpts[filterRender.name] || renderer.get(filterRender.name) : null
274
+ const isDisabled = !hasCheckOption && !filterStore.isAllSelected && !filterStore.isIndeterminate
275
+ let showFlFoot = !!filterMultiple
276
+ if (XEUtils.isBoolean(showFooter)) {
277
+ showFlFoot = showFooter
278
+ } else if (compConf) {
279
+ showFlFoot = !(compConf.showTableFilterFooter === false || compConf.showFilterFooter === false || compConf.isFooter === false)
280
+ }
281
+ return showFlFoot
282
+ ? [
283
+ h(
284
+ 'div',
285
+ {
286
+ class: 'vxe-table--filter-footer'
287
+ },
288
+ [
289
+ h(
290
+ 'button',
291
+ {
292
+ class: {
293
+ 'is--disabled': isDisabled
294
+ },
295
+ disabled: isDisabled,
296
+ onClick: confirmFilter
297
+ },
298
+ confirmButtonText || getI18n('vxe.table.confirmFilter')
299
+ ),
300
+ h(
301
+ 'button',
302
+ {
303
+ onClick: resetFilter
304
+ },
305
+ resetButtonText || getI18n('vxe.table.resetFilter')
306
+ )
307
+ ]
308
+ )
309
+ ]
310
+ : []
311
+ }
312
+
313
+ const renderVN = () => {
314
+ const { filterStore } = props
315
+ const { initStore } = tableReactData
316
+ const { visible, column } = filterStore
317
+ if (!column) {
318
+ return renderEmptyElement($xeFilterPanel)
319
+ }
320
+ const rendererOpts = computeRendererOpts.value
321
+ const filterRender = column ? column.filterRender : null
322
+ const compConf = filterRender && isEnableConf(filterRender) && filterRender.name ? rendererOpts[filterRender.name] || renderer.get(filterRender.name) : null
323
+ const filterClassName = compConf ? compConf.tableFilterClassName || compConf.filterClassName : ''
324
+ const params = Object.assign({}, tableInternalData._currFilterParams, { $panel: $xeFilterPanel, $table: $xeTable })
325
+ const tableProps = $xeTable.props
326
+ const { computeSize } = $xeTable.getComputeMaps()
327
+ const vSize = computeSize.value
328
+ const filterOpts = computeFilterOpts.value
329
+ const { transfer, destroyOnClose, className } = filterOpts
330
+ return h(
331
+ Teleport,
332
+ {
333
+ to: 'body',
334
+ disabled: !transfer
335
+ },
336
+ [
337
+ h(
338
+ 'div',
339
+ {
340
+ ref: refElem,
341
+ class: [
342
+ 'vxe-table--filter-wrapper',
343
+ 'filter--prevent-default',
344
+ className,
345
+ getPropClass(filterClassName, params),
346
+ {
347
+ [`size--${vSize}`]: vSize,
348
+ 'is--animat': tableProps.animat,
349
+ 'is--multiple': column.filterMultiple,
350
+ 'is--active': visible
351
+ }
352
+ ],
353
+ style: filterStore.style
354
+ },
355
+ initStore.filter && (destroyOnClose ? visible : true) && column ? renderOptions(filterRender, compConf).concat(renderFooters()) : []
356
+ )
357
+ ]
358
+ )
359
+ }
360
+
361
+ $xeFilterPanel.renderVN = renderVN
362
+
363
+ return $xeFilterPanel
364
+ },
365
+ render() {
366
+ return this.renderVN()
367
+ }
368
+ })