vxe-table 4.23.8 → 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.
- package/dist/all.esm.js +5715 -3783
- package/es/components.d.ts +1 -0
- package/es/components.js +2 -7
- package/es/grid/src/emits.js +1 -15
- package/es/grid/src/grid.js +397 -120
- package/es/index.esm.js +1 -0
- package/es/index.js +1 -0
- package/es/table/module/custom/hook.js +49 -42
- package/es/table/module/custom/panel.js +777 -527
- package/es/table/module/edit/hook.js +140 -62
- package/es/table/module/export/export-panel.js +399 -316
- package/es/table/module/export/hook.js +395 -337
- package/es/table/module/export/import-panel.js +152 -123
- package/es/table/module/filter/hook.js +16 -2
- package/es/table/module/filter/panel.js +146 -84
- package/es/table/module/keyboard/hook.js +8 -4
- package/es/table/module/menu/panel.js +197 -126
- package/es/table/render/index.js +151 -98
- package/es/table/src/body.js +355 -233
- package/es/table/src/cell.js +426 -269
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/footer.js +144 -99
- package/es/table/src/group.js +7 -3
- package/es/table/src/header.js +229 -172
- package/es/table/src/table.js +1503 -1030
- package/es/table/src/util.js +15 -19
- package/es/toolbar/src/toolbar.js +132 -75
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +9 -6
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.d.ts +1 -1
- package/lib/components.js +2 -7
- package/lib/grid/src/emits.js +1 -15
- package/lib/grid/src/grid.js +397 -120
- package/lib/index.common.js +1 -0
- package/lib/index.js +1 -0
- package/lib/index.umd.js +5732 -3800
- package/lib/index.umd.min.js +3 -3
- package/lib/table/module/custom/hook.js +49 -42
- package/lib/table/module/custom/panel.js +777 -527
- package/lib/table/module/edit/hook.js +140 -62
- package/lib/table/module/export/export-panel.js +399 -316
- package/lib/table/module/export/hook.js +395 -337
- package/lib/table/module/export/import-panel.js +152 -123
- package/lib/table/module/filter/hook.js +16 -2
- package/lib/table/module/filter/panel.js +146 -84
- package/lib/table/module/keyboard/hook.js +8 -4
- package/lib/table/module/menu/panel.js +197 -126
- package/lib/table/render/index.js +151 -98
- package/lib/table/src/body.js +355 -233
- package/lib/table/src/cell.js +426 -269
- package/lib/table/src/columnInfo.js +1 -0
- package/lib/table/src/footer.js +144 -99
- package/lib/table/src/group.js +7 -3
- package/lib/table/src/header.js +229 -172
- package/lib/table/src/table.js +1471 -1029
- package/lib/table/src/util.js +15 -19
- package/lib/toolbar/src/toolbar.js +132 -75
- package/lib/ui/index.js +1 -1
- package/lib/ui/src/dom.js +9 -6
- package/lib/ui/src/log.js +1 -1
- package/package.json +2 -2
- package/packages/colgroup/index.ts +22 -22
- package/packages/column/index.ts +22 -22
- package/packages/components.ts +41 -44
- package/packages/grid/index.ts +18 -18
- package/packages/grid/src/emits.ts +5 -19
- package/packages/grid/src/grid.ts +2229 -1925
- package/packages/grid/src/props.ts +22 -23
- package/packages/index.ts +11 -11
- package/packages/locale/lang/fr-FR.ts +15 -15
- package/packages/locale/lang/it-IT.ts +4 -4
- package/packages/locale/lang/uk-UA.ts +1 -1
- package/packages/locale/lang/uz-UZ.ts +13 -13
- package/packages/locale/lang/zh-CN.ts +907 -907
- package/packages/table/index.ts +26 -26
- package/packages/table/module/custom/hook.ts +510 -503
- package/packages/table/module/custom/panel.ts +2002 -1743
- package/packages/table/module/edit/hook.ts +1224 -1131
- package/packages/table/module/export/export-panel.ts +697 -611
- package/packages/table/module/export/hook.ts +2160 -2059
- package/packages/table/module/export/import-panel.ts +319 -279
- package/packages/table/module/export/util.ts +25 -24
- package/packages/table/module/filter/hook.ts +519 -501
- package/packages/table/module/filter/panel.ts +368 -304
- package/packages/table/module/keyboard/hook.ts +498 -494
- package/packages/table/module/menu/hook.ts +330 -330
- package/packages/table/module/menu/panel.ts +272 -201
- package/packages/table/module/validator/hook.ts +653 -635
- package/packages/table/render/index.ts +1819 -1744
- package/packages/table/src/body.ts +1078 -955
- package/packages/table/src/cell.ts +1524 -1359
- package/packages/table/src/column.ts +192 -192
- package/packages/table/src/columnInfo.ts +232 -232
- package/packages/table/src/emits.ts +134 -134
- package/packages/table/src/footer.ts +425 -380
- package/packages/table/src/group.ts +67 -63
- package/packages/table/src/header.ts +642 -581
- package/packages/table/src/props.ts +336 -336
- package/packages/table/src/store.ts +14 -14
- package/packages/table/src/table.ts +16011 -15454
- package/packages/table/src/use/cell-view.ts +41 -44
- package/packages/table/src/use/index.ts +1 -1
- package/packages/table/src/util.ts +1206 -1216
- package/packages/toolbar/index.ts +18 -18
- package/packages/toolbar/src/toolbar.ts +768 -706
- package/packages/ui/index.ts +519 -520
- package/packages/ui/src/anime.ts +51 -52
- package/packages/ui/src/comp.ts +3 -3
- package/packages/ui/src/dom.ts +466 -463
- package/packages/ui/src/log.ts +19 -19
- package/packages/ui/src/utils.ts +66 -66
- package/packages/ui/src/vn.ts +55 -55
- package/packages/v-x-e-table/index.d.ts +3 -3
- package/packages/v-x-e-table/index.ts +3 -3
- package/types/all.d.ts +76 -76
- package/types/index.d.ts +4 -4
- /package/dist/{iconfont.1793007753347.ttf → iconfont.1793009263429.ttf} +0 -0
- /package/dist/{iconfont.1793007753347.woff → iconfont.1793009263429.woff} +0 -0
- /package/dist/{iconfont.1793007753347.woff2 → iconfont.1793009263429.woff2} +0 -0
- /package/es/{iconfont.1793007753347.ttf → iconfont.1793009263429.ttf} +0 -0
- /package/es/{iconfont.1793007753347.woff → iconfont.1793009263429.woff} +0 -0
- /package/es/{iconfont.1793007753347.woff2 → iconfont.1793009263429.woff2} +0 -0
- /package/lib/{iconfont.1793007753347.ttf → iconfont.1793009263429.ttf} +0 -0
- /package/lib/{iconfont.1793007753347.woff → iconfont.1793009263429.woff} +0 -0
- /package/lib/{iconfont.1793007753347.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 '@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
|
|
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 ?
|
|
140
|
-
if (filterSlot) {
|
|
141
|
-
return [
|
|
142
|
-
h(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
const
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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
|
+
})
|