@vxe-ui/plugin-render-antd 3.3.0 → 3.4.0

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.
@@ -1,583 +1,607 @@
1
- import { CreateElement } from 'vue'
2
- import XEUtils from 'xe-utils'
3
-
4
- import type { VxeUIExport, VxeGlobalRendererHandles } from 'vxe-pc-ui'
5
- import type { VxeTableDefines, VxeColumnPropTypes } from 'vxe-table'
6
-
7
- /**
8
- * 表格 - 渲染器
9
- */
10
- export function defineTableRender (VxeUI: VxeUIExport) {
11
- function isEmptyValue (cellValue: any) {
12
- return cellValue === null || cellValue === undefined || cellValue === ''
13
- }
14
-
15
- function getOnName (type: string) {
16
- return XEUtils.kebabCase(type)
17
- }
18
-
19
- function getModelProp (renderOpts: VxeGlobalRendererHandles.RenderOptions) {
20
- let prop = 'value'
21
- switch (renderOpts.name) {
22
- case 'ASwitch':
23
- prop = 'checked'
24
- break
25
- }
26
- return prop
27
- }
28
-
29
- function getModelEvent (renderOpts: VxeGlobalRendererHandles.RenderOptions) {
30
- let type = 'change'
31
- switch (renderOpts.name) {
32
- case 'AInput':
33
- type = 'change.value'
34
- break
35
- case 'ARadio':
36
- case 'ACheckbox':
37
- type = 'input'
38
- break
39
- }
40
- return type
41
- }
42
-
43
- function dateFormatToVxeFormat (format: string) {
44
- if (format) {
45
- return `${format}`.replace('YYYY', 'yyyy').replace('DD', 'dd')
46
- }
47
- return format
48
- }
49
-
50
- function getChangeEvent (renderOpts: VxeGlobalRendererHandles.RenderOptions) {
51
- return 'change'
52
- }
53
-
54
- function getCellEditFilterProps (renderOpts: any, params: VxeGlobalRendererHandles.RenderEditParams | VxeGlobalRendererHandles.RenderFilterParams, value: any, defaultProps?: { [prop: string]: any }) {
55
- return XEUtils.assign({}, defaultProps, renderOpts.props, { [getModelProp(renderOpts)]: value })
56
- }
57
-
58
- function formatText (cellValue: any) {
59
- return '' + (isEmptyValue(cellValue) ? '' : cellValue)
60
- }
61
-
62
- function getCellLabelVNs (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams, cellLabel: any) {
63
- const { placeholder } = renderOpts
64
- return [
65
- h('span', {
66
- class: 'vxe-cell--label'
67
- }, placeholder && isEmptyValue(cellLabel)
68
- ? [
69
- h('span', {
70
- class: 'vxe-cell--placeholder'
71
- }, formatText(placeholder))
72
- ]
73
- : formatText(cellLabel))
74
- ]
75
- }
76
-
77
- function getOns (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderParams, inputFunc?: Function, changeFunc?: Function) {
78
- const { events } = renderOpts
79
- const modelEvent = getModelEvent(renderOpts)
80
- const changeEvent = getChangeEvent(renderOpts)
81
- const isSameEvent = changeEvent === modelEvent
82
- const ons: { [type: string]: Function } = {}
83
- XEUtils.objectEach(events, (func: Function, key: string) => {
84
- ons[getOnName(key)] = function (...args: any[]) {
85
- func(params, ...args)
86
- }
87
- })
88
- if (inputFunc) {
89
- ons[getOnName(modelEvent)] = function (targetEvnt: any) {
90
- inputFunc(targetEvnt)
91
- if (events && events[modelEvent]) {
92
- events[modelEvent](params, targetEvnt)
93
- }
94
- if (isSameEvent && changeFunc) {
95
- changeFunc(targetEvnt)
96
- }
97
- }
98
- }
99
- if (!isSameEvent && changeFunc) {
100
- ons[getOnName(changeEvent)] = function (...args: any[]) {
101
- changeFunc(...args)
102
- if (events && events[changeEvent]) {
103
- events[changeEvent](params, ...args)
104
- }
105
- }
106
- }
107
- return ons
108
- }
109
-
110
- function getEditOns (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
111
- const { $table, row, column } = params
112
- return getOns(renderOpts, params, (value: any) => {
113
- // 处理 model 值双向绑定
114
- XEUtils.set(row, column.field, value)
115
- }, () => {
116
- // 处理 change 事件相关逻辑
117
- $table.updateStatus(params)
118
- })
119
- }
120
-
121
- function getFilterOns (renderOpts: any, params: VxeGlobalRendererHandles.RenderFilterParams, option: VxeTableDefines.FilterOption, changeFunc: Function) {
122
- return getOns(renderOpts, params, (value: any) => {
123
- // 处理 model 值双向绑定
124
- option.data = value
125
- }, changeFunc)
126
- }
127
-
128
- function matchCascaderData (index: number, list: any[], values: any[], labels: any[]) {
129
- const val = values[index]
130
- if (list && values.length > index) {
131
- XEUtils.each(list, (item) => {
132
- if (item.value === val) {
133
- labels.push(item.label)
134
- matchCascaderData(++index, item.children, values, labels)
135
- }
136
- })
137
- }
138
- }
139
-
140
- function formatDatePicker (defaultFormat?: string) {
141
- return function (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams) {
142
- return getCellLabelVNs(h, renderOpts, params, getDatePickerCellValue(renderOpts, params, defaultFormat))
143
- }
144
- }
145
-
146
- function formatTimePicker (defaultFormat?: string) {
147
- return function (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams) {
148
- const { props = {} } = renderOpts
149
- const { row, column } = params
150
- let cellValue = XEUtils.get(row, column.field)
151
- try {
152
- if (cellValue) {
153
- if (!XEUtils.isString(cellValue)) {
154
- cellValue = cellValue.format ? cellValue.format(props.format || props.valueFormat || defaultFormat) : XEUtils.toDateString(cellValue, dateFormatToVxeFormat(props.format || props.valueFormat || defaultFormat))
155
- }
156
- }
157
- } catch (e) {}
158
- return getCellLabelVNs(h, renderOpts, params, cellValue)
159
- }
160
- }
161
-
162
- function getSelectCellValue (renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams) {
163
- const { options = [], optionGroups, props = {}, optionProps = {}, optionGroupProps = {} } = renderOpts
164
- const { row, column } = params
165
- const labelProp = optionProps.label || 'label'
166
- const valueProp = optionProps.value || 'value'
167
- const groupOptions = optionGroupProps.options || 'options'
168
- const cellValue = XEUtils.get(row, column.field)
169
- if (!isEmptyValue(cellValue)) {
170
- return XEUtils.map(props.mode === 'multiple' ? cellValue : [cellValue], optionGroups
171
- ? (value) => {
172
- let selectItem
173
- for (let index = 0; index < optionGroups.length; index++) {
174
- selectItem = XEUtils.find(optionGroups[index][groupOptions], (item) => item[valueProp] === value)
175
- if (selectItem) {
176
- break
177
- }
178
- }
179
- return selectItem ? selectItem[labelProp] : value
180
- }
181
- : (value) => {
182
- const selectItem = XEUtils.find(options, (item) => item[valueProp] === value)
183
- return selectItem ? selectItem[labelProp] : value
184
- }).join(', ')
185
- }
186
- return ''
187
- }
188
-
189
- function getCascaderCellValue (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.ExportMethodParams) {
190
- const { props = {} } = renderOpts
191
- const { row, column } = params
192
- const cellValue = XEUtils.get(row, column.field)
193
- const values = cellValue || []
194
- const labels: Array<any> = []
195
- matchCascaderData(0, props.options, values, labels)
196
- return (props.showAllLevels === false ? labels.slice(labels.length - 1, labels.length) : labels).join(` ${props.separator || '/'} `)
197
- }
198
-
199
- function getRangePickerCellValue (renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.RenderEditParams) {
200
- const { props = {} } = renderOpts
201
- const { row, column } = params
202
- let cellValue = XEUtils.get(row, column.field)
203
- if (cellValue) {
204
- cellValue = XEUtils.map(cellValue, (date: any) => {
205
- return date && date.format ? date.format(props.format || 'YYYY-MM-DD') : XEUtils.toDateString(date, dateFormatToVxeFormat(props.format || 'YYYY-MM-DD'))
206
- }).join(' ~ ')
207
- }
208
- return cellValue
209
- }
210
-
211
- function getTreeSelectCellValue (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.RenderEditParams) {
212
- const { props = {} } = renderOpts
213
- const { treeData, treeCheckable } = props
214
- const { row, column } = params
215
- const cellValue = XEUtils.get(row, column.field)
216
- if (!isEmptyValue(cellValue)) {
217
- return XEUtils.map(treeCheckable ? cellValue : [cellValue], (value) => {
218
- const matchObj = XEUtils.findTree(treeData, (item: any) => item.value === value, { children: 'children' })
219
- return matchObj ? matchObj.item.title : value
220
- }).join(', ')
221
- }
222
- return cellValue
223
- }
224
-
225
- function getDatePickerCellValue (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.ExportMethodParams, defaultFormat?: string) {
226
- const { props = {} } = renderOpts
227
- const { row, column } = params
228
- let cellValue = XEUtils.get(row, column.field)
229
- try {
230
- if (cellValue) {
231
- if (!defaultFormat) {
232
- if (renderOpts.name === 'ADatePicker') {
233
- switch (props.picker) {
234
- case 'week':
235
- defaultFormat = 'YYYY-WW周'
236
- break
237
- case 'month':
238
- defaultFormat = 'YYYY-MM'
239
- break
240
- case 'year':
241
- defaultFormat = 'YYYY'
242
- break
243
- default:
244
- defaultFormat = props.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'
245
- break
246
- }
247
- }
248
- }
249
- cellValue = cellValue.format ? cellValue.format(props.format || defaultFormat) : XEUtils.toDateString(cellValue, dateFormatToVxeFormat(props.format || defaultFormat))
250
- }
251
- } catch (e) {}
252
- return cellValue
253
- }
254
-
255
- function createEditRender (defaultProps?: { [key: string]: any }) {
256
- return function (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender & { name: string }, params: VxeGlobalRendererHandles.RenderEditParams) {
257
- const { row, column } = params
258
- const { name, attrs } = renderOpts
259
- const cellValue = XEUtils.get(row, column.field)
260
- return [
261
- h(name, {
262
- attrs,
263
- props: getCellEditFilterProps(renderOpts, params, cellValue, defaultProps),
264
- on: getEditOns(renderOpts, params)
265
- })
266
- ]
267
- }
268
- }
269
-
270
- function defaultButtonEditRender (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderEditParams) {
271
- const { attrs } = renderOpts
272
- return [
273
- h('a-button', {
274
- attrs,
275
- props: getCellEditFilterProps(renderOpts, params, null),
276
- on: getOns(renderOpts, params)
277
- }, cellText(renderOpts.content))
278
- ]
279
- }
280
-
281
- function defaultButtonsEditRender (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderEditParams) {
282
- const { children } = renderOpts
283
- if (children) {
284
- return children.map((childRenderOpts: VxeColumnPropTypes.EditRender) => defaultButtonEditRender(h, childRenderOpts, params)[0])
285
- }
286
- return []
287
- }
288
-
289
- function createFilterRender (defaultProps?: { [key: string]: any }) {
290
- return function (h: CreateElement, renderOpts: VxeColumnPropTypes.FilterRender & { name: string }, params: VxeGlobalRendererHandles.RenderFilterParams) {
291
- const { column } = params
292
- const { name, attrs } = renderOpts
293
- return [
294
- h('div', {
295
- class: 'vxe-table--filter-antd-wrapper'
296
- }, column.filters.map((option, oIndex) => {
297
- const optionValue = option.data
298
- return h(name, {
299
- key: oIndex,
300
- attrs,
301
- props: {
302
- ...getCellEditFilterProps(renderOpts, params, optionValue, defaultProps)
303
- },
304
- on: getFilterOns(renderOpts, params, option, () => {
305
- // 处理 change 事件相关逻辑
306
- handleConfirmFilter(params, !!option.data, option)
307
- })
308
- })
309
- }))
310
- ]
311
- }
312
- }
313
-
314
- function handleConfirmFilter (params: VxeGlobalRendererHandles.RenderFilterParams, checked: boolean, option: VxeTableDefines.FilterOption) {
315
- const { $panel } = params
316
- $panel.changeOption(null, checked, option)
317
- }
318
-
319
- /**
320
- * 模糊匹配
321
- * @param params
322
- */
323
- function defaultFuzzyFilterMethod (params: VxeGlobalRendererHandles.FilterMethodParams) {
324
- const { option, row, column } = params
325
- const { data } = option
326
- const cellValue = XEUtils.get(row, column.field)
327
- return XEUtils.toValueString(cellValue).indexOf(data) > -1
328
- }
329
-
330
- /**
331
- * 精确匹配
332
- * @param params
333
- */
334
- function defaultExactFilterMethod (params: VxeGlobalRendererHandles.FilterMethodParams) {
335
- const { option, row, column } = params
336
- const { data } = option
337
- const cellValue = XEUtils.get(row, column.field)
338
- /* eslint-disable eqeqeq */
339
- return cellValue === data
340
- }
341
-
342
- function renderOptions (h: CreateElement, options: any[], optionProps: VxeGlobalRendererHandles.RenderOptionProps) {
343
- const labelProp = optionProps.label || 'label'
344
- const valueProp = optionProps.value || 'value'
345
- return XEUtils.map(options, (item, oIndex) => {
346
- return h('a-select-option', {
347
- key: oIndex,
348
- props: {
349
- value: item[valueProp],
350
- disabled: item.disabled
351
- }
352
- }, item[labelProp])
353
- })
354
- }
355
-
356
- function cellText (cellValue: any): string[] {
357
- return [formatText(cellValue)]
358
- }
359
-
360
- function createDatePickerExportMethod (defaultFormat?: string) {
361
- return function (params: VxeGlobalRendererHandles.ExportMethodParams) {
362
- const { row, column, options } = params
363
- return options && options.original ? XEUtils.get(row, column.field) : getDatePickerCellValue(column.editRender || column.cellRender, params, defaultFormat)
364
- }
365
- }
366
-
367
- function createExportMethod (getExportCellValue: Function) {
368
- return function (params: VxeGlobalRendererHandles.ExportMethodParams) {
369
- const { row, column, options } = params
370
- return options && options.original ? XEUtils.get(row, column.field) : getExportCellValue(column.editRender || column.cellRender, params)
371
- }
372
- }
373
-
374
- VxeUI.renderer.mixin({
375
- AAutoComplete: {
376
- tableAutoFocus: 'input',
377
- renderTableDefault: createEditRender(),
378
- renderTableEdit: createEditRender(),
379
- renderTableFilter: createFilterRender(),
380
- tableFilterDefaultMethod: defaultFuzzyFilterMethod
381
- },
382
- AInput: {
383
- tableAutoFocus: 'input',
384
- renderTableDefault: createEditRender(),
385
- renderTableEdit: createEditRender(),
386
- renderTableFilter: createFilterRender(),
387
- tableFilterDefaultMethod: defaultFuzzyFilterMethod
388
- },
389
- AInputNumber: {
390
- tableAutoFocus: 'input',
391
- renderTableDefault: createEditRender(),
392
- renderTableEdit: createEditRender(),
393
- renderTableFilter: createFilterRender(),
394
- tableFilterDefaultMethod: defaultFuzzyFilterMethod
395
- },
396
- ASelect: {
397
- renderTableEdit (h, renderOpts, params) {
398
- const { options = [], optionGroups, optionProps = {}, optionGroupProps = {} } = renderOpts
399
- const { row, column } = params
400
- const { attrs } = renderOpts
401
- const cellValue = XEUtils.get(row, column.field)
402
- const props = getCellEditFilterProps(renderOpts, params, cellValue)
403
- const ons = getEditOns(renderOpts, params)
404
- if (optionGroups) {
405
- const groupOptions = optionGroupProps.options || 'options'
406
- const groupLabel = optionGroupProps.label || 'label'
407
- return [
408
- h('a-select', {
409
- attrs,
410
- props: {
411
- ...props,
412
- options: undefined
413
- },
414
- on: ons
415
- }, XEUtils.map(optionGroups, (group: any, gIndex: any) => {
416
- return h('a-select-opt-group', {
417
- key: gIndex
418
- }, [
419
- h('span', {
420
- slot: 'label'
421
- }, group[groupLabel])
422
- ].concat(
423
- renderOptions(h, group[groupOptions], optionProps)
424
- ))
425
- }))
426
- ]
427
- }
428
- return [
429
- h('a-select', {
430
- attrs,
431
- props: {
432
- ...props,
433
- options: props.options || options
434
- },
435
- on: ons
436
- })
437
- ]
438
- },
439
- renderTableCell (h, renderOpts, params) {
440
- return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params))
441
- },
442
- renderTableFilter (h, renderOpts, params) {
443
- const { options = [], optionGroups, optionGroupProps = {} } = renderOpts
444
- const groupOptions = optionGroupProps.options || 'options'
445
- const { column } = params
446
- const { attrs } = renderOpts
447
- return [
448
- h('div', {
449
- class: 'vxe-table--filter-antd-wrapper'
450
- }, optionGroups
451
- ? column.filters.map((option, oIndex) => {
452
- const optionValue = option.data
453
- const props = getCellEditFilterProps(renderOpts, params, optionValue)
454
- return h('a-select', {
455
- key: oIndex,
456
- attrs,
457
- props: {
458
- ...props,
459
- options: groupOptions
460
- },
461
- on: getFilterOns(renderOpts, params, option, () => {
462
- // 处理 change 事件相关逻辑
463
- handleConfirmFilter(params, props.mode === 'multiple' ? (option.data && option.data.length > 0) : !XEUtils.eqNull(option.data), option)
464
- })
465
- })
466
- })
467
- : column.filters.map((option, oIndex) => {
468
- const optionValue = option.data
469
- const props = getCellEditFilterProps(renderOpts, params, optionValue)
470
- return h('a-select', {
471
- key: oIndex,
472
- attrs,
473
- props: {
474
- ...props,
475
- options: props.options || options
476
- },
477
- on: getFilterOns(renderOpts, params, option, () => {
478
- // 处理 change 事件相关逻辑
479
- handleConfirmFilter(params, props.mode === 'multiple' ? (option.data && option.data.length > 0) : !XEUtils.eqNull(option.data), option)
480
- })
481
- })
482
- }))
483
- ]
484
- },
485
- tableFilterDefaultMethod (params) {
486
- const { option, row, column } = params
487
- const { data } = option
488
- const { field, filterRender: renderOpts } = column
489
- const { props = {} } = renderOpts
490
- const cellValue = XEUtils.get(row, field)
491
- if (props.mode === 'multiple') {
492
- if (XEUtils.isArray(cellValue)) {
493
- return XEUtils.includeArrays(cellValue, data)
494
- }
495
- return data.indexOf(cellValue) > -1
496
- }
497
- /* eslint-disable eqeqeq */
498
- return cellValue == data
499
- },
500
- tableExportMethod: createExportMethod(getSelectCellValue)
501
- },
502
- ACascader: {
503
- renderTableEdit: createEditRender(),
504
- renderTableCell (h, renderOpts, params) {
505
- return getCellLabelVNs(h, renderOpts, params, getCascaderCellValue(renderOpts, params))
506
- },
507
- tableExportMethod: createExportMethod(getCascaderCellValue)
508
- },
509
- ADatePicker: {
510
- renderTableEdit: createEditRender(),
511
- renderTableCell: formatDatePicker(),
512
- tableExportMethod: createDatePickerExportMethod()
513
- },
514
- AMonthPicker: {
515
- renderTableEdit: createEditRender(),
516
- renderTableCell: formatDatePicker('YYYY-MM'),
517
- tableExportMethod: createDatePickerExportMethod('YYYY-MM')
518
- },
519
- ARangePicker: {
520
- renderTableEdit: createEditRender(),
521
- renderTableCell (h, renderOpts, params) {
522
- return getCellLabelVNs(h, renderOpts, params, getRangePickerCellValue(renderOpts, params))
523
- },
524
- tableExportMethod: createExportMethod(getRangePickerCellValue)
525
- },
526
- AWeekPicker: {
527
- renderTableEdit: createEditRender(),
528
- renderTableCell: formatDatePicker('YYYY-WW周'),
529
- tableExportMethod: createDatePickerExportMethod('YYYY-WW周')
530
- },
531
- ATimePicker: {
532
- renderTableEdit: createEditRender(),
533
- renderTableCell: formatTimePicker('HH:mm:ss'),
534
- tableExportMethod: createDatePickerExportMethod('HH:mm:ss')
535
- },
536
- ATreeSelect: {
537
- renderTableEdit: createEditRender(),
538
- renderTableCell (h, renderOpts, params) {
539
- return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params))
540
- },
541
- tableExportMethod: createExportMethod(getTreeSelectCellValue)
542
- },
543
- ARate: {
544
- renderTableDefault: createEditRender(),
545
- renderTableEdit: createEditRender(),
546
- renderTableFilter: createFilterRender(),
547
- tableFilterDefaultMethod: defaultExactFilterMethod
548
- },
549
- ASwitch: {
550
- renderTableDefault: createEditRender(),
551
- renderTableEdit: createEditRender(),
552
- renderTableFilter (h, renderOpts, params) {
553
- const { column } = params
554
- const { name, attrs } = renderOpts
555
- return [
556
- h('div', {
557
- class: 'vxe-table--filter-antd-wrapper'
558
- }, column.filters.map((option, oIndex) => {
559
- const optionValue = option.data
560
- return h(name as string, {
561
- key: oIndex,
562
- attrs,
563
- props: getCellEditFilterProps(renderOpts, params, optionValue),
564
- on: getFilterOns(renderOpts, params, option, () => {
565
- // 处理 change 事件相关逻辑
566
- handleConfirmFilter(params, XEUtils.isBoolean(option.data), option)
567
- })
568
- })
569
- }))
570
- ]
571
- },
572
- tableFilterDefaultMethod: defaultExactFilterMethod
573
- },
574
- AButton: {
575
- renderTableEdit: defaultButtonEditRender,
576
- renderTableDefault: defaultButtonEditRender
577
- },
578
- AButtons: {
579
- renderTableEdit: defaultButtonsEditRender,
580
- renderTableDefault: defaultButtonsEditRender
581
- }
582
- })
583
- }
1
+ import { CreateElement } from 'vue'
2
+ import XEUtils from 'xe-utils'
3
+
4
+ import type { VxeUIExport, VxeGlobalRendererHandles } from 'vxe-pc-ui'
5
+ import type { VxeTableDefines, VxeColumnPropTypes } from 'vxe-table'
6
+
7
+ /**
8
+ * 表格 - 渲染器
9
+ */
10
+ export function defineTableRender (VxeUI: VxeUIExport) {
11
+ function isEmptyValue (cellValue: any) {
12
+ return cellValue === null || cellValue === undefined || cellValue === ''
13
+ }
14
+
15
+ function getOnName (type: string) {
16
+ return XEUtils.kebabCase(type)
17
+ }
18
+
19
+ function getModelProp (renderOpts: VxeGlobalRendererHandles.RenderOptions) {
20
+ let prop = 'value'
21
+ switch (renderOpts.name) {
22
+ case 'ASwitch':
23
+ prop = 'checked'
24
+ break
25
+ }
26
+ return prop
27
+ }
28
+
29
+ function getModelEvent (renderOpts: VxeGlobalRendererHandles.RenderOptions) {
30
+ let type = 'change'
31
+ switch (renderOpts.name) {
32
+ case 'AInput':
33
+ type = 'change.value'
34
+ break
35
+ case 'ARadio':
36
+ case 'ACheckbox':
37
+ type = 'input'
38
+ break
39
+ }
40
+ return type
41
+ }
42
+
43
+ function dateFormatToVxeFormat (format: string) {
44
+ if (format) {
45
+ return `${format}`.replace('YYYY', 'yyyy').replace('DD', 'dd')
46
+ }
47
+ return format
48
+ }
49
+
50
+ function getChangeEvent (renderOpts: VxeGlobalRendererHandles.RenderOptions) {
51
+ return 'change'
52
+ }
53
+
54
+ function getCellEditFilterProps (renderOpts: any, params: VxeGlobalRendererHandles.RenderEditParams | VxeGlobalRendererHandles.RenderFilterParams, value: any, defaultProps?: { [prop: string]: any }) {
55
+ return XEUtils.assign({}, defaultProps, renderOpts.props, { [getModelProp(renderOpts)]: value })
56
+ }
57
+
58
+ function formatText (cellValue: any) {
59
+ return '' + (isEmptyValue(cellValue) ? '' : cellValue)
60
+ }
61
+
62
+ function getCellLabelVNs (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams, cellLabel: any) {
63
+ const { placeholder } = renderOpts
64
+ return [
65
+ h('span', {
66
+ class: 'vxe-cell--label'
67
+ }, placeholder && isEmptyValue(cellLabel)
68
+ ? [
69
+ h('span', {
70
+ class: 'vxe-cell--placeholder'
71
+ }, formatText(placeholder))
72
+ ]
73
+ : formatText(cellLabel))
74
+ ]
75
+ }
76
+
77
+ function getOns (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderParams, inputFunc?: Function, changeFunc?: Function) {
78
+ const { events } = renderOpts
79
+ const modelEvent = getModelEvent(renderOpts)
80
+ const changeEvent = getChangeEvent(renderOpts)
81
+ const isSameEvent = changeEvent === modelEvent
82
+ const ons: { [type: string]: Function } = {}
83
+ XEUtils.objectEach(events, (func: Function, key: string) => {
84
+ ons[getOnName(key)] = function (...args: any[]) {
85
+ func(params, ...args)
86
+ }
87
+ })
88
+ if (inputFunc) {
89
+ ons[getOnName(modelEvent)] = function (targetEvnt: any) {
90
+ inputFunc(targetEvnt)
91
+ if (events && events[modelEvent]) {
92
+ events[modelEvent](params, targetEvnt)
93
+ }
94
+ if (isSameEvent && changeFunc) {
95
+ changeFunc(targetEvnt)
96
+ }
97
+ }
98
+ }
99
+ if (!isSameEvent && changeFunc) {
100
+ ons[getOnName(changeEvent)] = function (...args: any[]) {
101
+ changeFunc(...args)
102
+ if (events && events[changeEvent]) {
103
+ events[changeEvent](params, ...args)
104
+ }
105
+ }
106
+ }
107
+ return ons
108
+ }
109
+
110
+ function getEditOns (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
111
+ const { $table, row, column } = params
112
+ return getOns(renderOpts, params, (value: any) => {
113
+ // 处理 model 值双向绑定
114
+ XEUtils.set(row, column.field, value)
115
+ }, () => {
116
+ // 处理 change 事件相关逻辑
117
+ $table.updateStatus(params)
118
+ })
119
+ }
120
+
121
+ function getFilterOns (renderOpts: any, params: VxeGlobalRendererHandles.RenderFilterParams, option: VxeTableDefines.FilterOption, changeFunc: Function) {
122
+ return getOns(renderOpts, params, (value: any) => {
123
+ // 处理 model 值双向绑定
124
+ option.data = value
125
+ }, changeFunc)
126
+ }
127
+
128
+ function matchCascaderData (index: number, list: any[], values: any[], labels: any[]) {
129
+ const val = values[index]
130
+ if (list && values.length > index) {
131
+ XEUtils.each(list, (item) => {
132
+ if (item.value === val) {
133
+ labels.push(item.label)
134
+ matchCascaderData(++index, item.children, values, labels)
135
+ }
136
+ })
137
+ }
138
+ }
139
+
140
+ function formatDatePicker (defaultFormat?: string) {
141
+ return function (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams) {
142
+ return getCellLabelVNs(h, renderOpts, params, getDatePickerCellValue(renderOpts, params, defaultFormat))
143
+ }
144
+ }
145
+
146
+ function formatTimePicker (defaultFormat?: string) {
147
+ return function (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams) {
148
+ const { props = {} } = renderOpts
149
+ const { row, column } = params
150
+ let cellValue = XEUtils.get(row, column.field)
151
+ try {
152
+ if (cellValue) {
153
+ if (!XEUtils.isString(cellValue)) {
154
+ cellValue = cellValue.format ? cellValue.format(props.format || props.valueFormat || defaultFormat) : XEUtils.toDateString(cellValue, dateFormatToVxeFormat(props.format || props.valueFormat || defaultFormat))
155
+ }
156
+ }
157
+ } catch (e) {}
158
+ return getCellLabelVNs(h, renderOpts, params, cellValue)
159
+ }
160
+ }
161
+
162
+ function handleSelectCellValue (cellValue: any, renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions) {
163
+ const { options = [], optionGroups, props = {}, optionProps = {}, optionGroupProps = {} } = renderOpts
164
+ const labelProp = optionProps.label || 'label'
165
+ const valueProp = optionProps.value || 'value'
166
+ const groupOptions = optionGroupProps.options || 'options'
167
+ if (!isEmptyValue(cellValue)) {
168
+ return XEUtils.map(props.mode === 'multiple' ? cellValue : [cellValue], optionGroups
169
+ ? (value) => {
170
+ let selectItem
171
+ for (let index = 0; index < optionGroups.length; index++) {
172
+ selectItem = XEUtils.find(optionGroups[index][groupOptions], (item) => item[valueProp] === value)
173
+ if (selectItem) {
174
+ break
175
+ }
176
+ }
177
+ return selectItem ? selectItem[labelProp] : value
178
+ }
179
+ : (value) => {
180
+ const selectItem = XEUtils.find(options, (item) => item[valueProp] === value)
181
+ return selectItem ? selectItem[labelProp] : value
182
+ }).join(', ')
183
+ }
184
+ return ''
185
+ }
186
+
187
+ function getSelectCellValue (renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams) {
188
+ const { row, column } = params
189
+ const cellValue = XEUtils.get(row, column.field)
190
+ return handleSelectCellValue(cellValue, renderOpts)
191
+ }
192
+
193
+ function getCascaderCellValue (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.ExportMethodParams) {
194
+ const { props = {} } = renderOpts
195
+ const { row, column } = params
196
+ const cellValue = XEUtils.get(row, column.field)
197
+ const values = cellValue || []
198
+ const labels: Array<any> = []
199
+ matchCascaderData(0, props.options, values, labels)
200
+ return (props.showAllLevels === false ? labels.slice(labels.length - 1, labels.length) : labels).join(` ${props.separator || '/'} `)
201
+ }
202
+
203
+ function getRangePickerCellValue (renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.RenderEditParams) {
204
+ const { props = {} } = renderOpts
205
+ const { row, column } = params
206
+ let cellValue = XEUtils.get(row, column.field)
207
+ if (cellValue) {
208
+ cellValue = XEUtils.map(cellValue, (date: any) => {
209
+ return date && date.format ? date.format(props.format || 'YYYY-MM-DD') : XEUtils.toDateString(date, dateFormatToVxeFormat(props.format || 'YYYY-MM-DD'))
210
+ }).join(' ~ ')
211
+ }
212
+ return cellValue
213
+ }
214
+
215
+ function getTreeSelectCellValue (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.RenderEditParams) {
216
+ const { props = {} } = renderOpts
217
+ const { treeData, treeCheckable } = props
218
+ const { row, column } = params
219
+ const cellValue = XEUtils.get(row, column.field)
220
+ if (!isEmptyValue(cellValue)) {
221
+ return XEUtils.map(treeCheckable ? cellValue : [cellValue], (value) => {
222
+ const matchObj = XEUtils.findTree(treeData, (item: any) => item.value === value, { children: 'children' })
223
+ return matchObj ? matchObj.item.title : value
224
+ }).join(', ')
225
+ }
226
+ return cellValue
227
+ }
228
+
229
+ function getDatePickerCellValue (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.ExportMethodParams, defaultFormat?: string) {
230
+ const { props = {} } = renderOpts
231
+ const { row, column } = params
232
+ let cellValue = XEUtils.get(row, column.field)
233
+ try {
234
+ if (cellValue) {
235
+ if (!defaultFormat) {
236
+ if (renderOpts.name === 'ADatePicker') {
237
+ switch (props.picker) {
238
+ case 'week':
239
+ defaultFormat = 'YYYY-WW周'
240
+ break
241
+ case 'month':
242
+ defaultFormat = 'YYYY-MM'
243
+ break
244
+ case 'year':
245
+ defaultFormat = 'YYYY'
246
+ break
247
+ default:
248
+ defaultFormat = props.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'
249
+ break
250
+ }
251
+ }
252
+ }
253
+ cellValue = cellValue.format ? cellValue.format(props.format || defaultFormat) : XEUtils.toDateString(cellValue, dateFormatToVxeFormat(props.format || defaultFormat))
254
+ }
255
+ } catch (e) {}
256
+ return cellValue
257
+ }
258
+
259
+ function createEditRender (defaultProps?: { [key: string]: any }) {
260
+ return function (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender & { name: string }, params: VxeGlobalRendererHandles.RenderEditParams) {
261
+ const { row, column } = params
262
+ const { name, attrs } = renderOpts
263
+ const cellValue = XEUtils.get(row, column.field)
264
+ return [
265
+ h(name, {
266
+ attrs,
267
+ props: getCellEditFilterProps(renderOpts, params, cellValue, defaultProps),
268
+ on: getEditOns(renderOpts, params)
269
+ })
270
+ ]
271
+ }
272
+ }
273
+
274
+ function defaultButtonEditRender (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderEditParams) {
275
+ const { attrs } = renderOpts
276
+ return [
277
+ h('a-button', {
278
+ attrs,
279
+ props: getCellEditFilterProps(renderOpts, params, null),
280
+ on: getOns(renderOpts, params)
281
+ }, cellText(renderOpts.content))
282
+ ]
283
+ }
284
+
285
+ function defaultButtonsEditRender (h: CreateElement, renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderEditParams) {
286
+ const { children } = renderOpts
287
+ if (children) {
288
+ return children.map((childRenderOpts: VxeColumnPropTypes.EditRender) => defaultButtonEditRender(h, childRenderOpts, params)[0])
289
+ }
290
+ return []
291
+ }
292
+
293
+ function createFilterRender (defaultProps?: { [key: string]: any }) {
294
+ return function (h: CreateElement, renderOpts: VxeColumnPropTypes.FilterRender & { name: string }, params: VxeGlobalRendererHandles.RenderFilterParams) {
295
+ const { column } = params
296
+ const { name, attrs } = renderOpts
297
+ return [
298
+ h('div', {
299
+ class: 'vxe-table--filter-antd-wrapper'
300
+ }, column.filters.map((option, oIndex) => {
301
+ const optionValue = option.data
302
+ return h(name, {
303
+ key: oIndex,
304
+ attrs,
305
+ props: {
306
+ ...getCellEditFilterProps(renderOpts, params, optionValue, defaultProps)
307
+ },
308
+ on: getFilterOns(renderOpts, params, option, () => {
309
+ // 处理 change 事件相关逻辑
310
+ handleConfirmFilter(params, !!option.data, option)
311
+ })
312
+ })
313
+ }))
314
+ ]
315
+ }
316
+ }
317
+
318
+ function handleConfirmFilter (params: VxeGlobalRendererHandles.RenderFilterParams, checked: boolean, option: VxeTableDefines.FilterOption) {
319
+ const { $panel } = params
320
+ $panel.changeOption(null, checked, option)
321
+ }
322
+
323
+ /**
324
+ * 模糊匹配
325
+ * @param params
326
+ */
327
+ function defaultFuzzyFilterMethod (params: VxeGlobalRendererHandles.FilterMethodParams) {
328
+ const { option, row, column } = params
329
+ const { data } = option
330
+ const cellValue = XEUtils.get(row, column.field)
331
+ return XEUtils.toValueString(cellValue).indexOf(data) > -1
332
+ }
333
+
334
+ /**
335
+ * 精确匹配
336
+ * @param params
337
+ */
338
+ function defaultExactFilterMethod (params: VxeGlobalRendererHandles.FilterMethodParams) {
339
+ const { option, row, column } = params
340
+ const { data } = option
341
+ const cellValue = XEUtils.get(row, column.field)
342
+ /* eslint-disable eqeqeq */
343
+ return cellValue === data
344
+ }
345
+
346
+ function renderOptions (h: CreateElement, options: any[], optionProps: VxeGlobalRendererHandles.RenderOptionProps) {
347
+ const labelProp = optionProps.label || 'label'
348
+ const valueProp = optionProps.value || 'value'
349
+ return XEUtils.map(options, (item, oIndex) => {
350
+ return h('a-select-option', {
351
+ key: oIndex,
352
+ props: {
353
+ value: item[valueProp],
354
+ disabled: item.disabled
355
+ }
356
+ }, item[labelProp])
357
+ })
358
+ }
359
+
360
+ function cellText (cellValue: any): string[] {
361
+ return [formatText(cellValue)]
362
+ }
363
+
364
+ function createDatePickerExportMethod (defaultFormat?: string) {
365
+ return function (params: VxeGlobalRendererHandles.ExportMethodParams) {
366
+ const { row, column, options } = params
367
+ return options && options.original ? XEUtils.get(row, column.field) : getDatePickerCellValue(column.editRender || column.cellRender, params, defaultFormat)
368
+ }
369
+ }
370
+
371
+ function createExportMethod (getExportCellValue: Function) {
372
+ return function (params: VxeGlobalRendererHandles.ExportMethodParams) {
373
+ const { row, column, options } = params
374
+ return options && options.original ? XEUtils.get(row, column.field) : getExportCellValue(column.editRender || column.cellRender, params)
375
+ }
376
+ }
377
+
378
+ VxeUI.renderer.mixin({
379
+ AAutoComplete: {
380
+ tableAutoFocus: 'input',
381
+ renderTableDefault: createEditRender(),
382
+ renderTableEdit: createEditRender(),
383
+ renderTableFilter: createFilterRender(),
384
+ tableFilterDefaultMethod: defaultFuzzyFilterMethod
385
+ },
386
+ AInput: {
387
+ tableAutoFocus: 'input',
388
+ renderTableDefault: createEditRender(),
389
+ renderTableEdit: createEditRender(),
390
+ renderTableFilter: createFilterRender(),
391
+ tableFilterDefaultMethod: defaultFuzzyFilterMethod
392
+ },
393
+ AInputNumber: {
394
+ tableAutoFocus: 'input',
395
+ renderTableDefault: createEditRender(),
396
+ renderTableEdit: createEditRender(),
397
+ renderTableFilter: createFilterRender(),
398
+ tableFilterDefaultMethod: defaultFuzzyFilterMethod
399
+ },
400
+ ASelect: {
401
+ renderTableEdit (h, renderOpts, params) {
402
+ const { options = [], optionGroups, optionProps = {}, optionGroupProps = {} } = renderOpts
403
+ const { row, column } = params
404
+ const { attrs } = renderOpts
405
+ const cellValue = XEUtils.get(row, column.field)
406
+ const props = getCellEditFilterProps(renderOpts, params, cellValue)
407
+ const ons = getEditOns(renderOpts, params)
408
+ if (optionGroups) {
409
+ const groupOptions = optionGroupProps.options || 'options'
410
+ const groupLabel = optionGroupProps.label || 'label'
411
+ return [
412
+ h('a-select', {
413
+ attrs,
414
+ props: {
415
+ ...props,
416
+ options: undefined
417
+ },
418
+ on: ons
419
+ }, XEUtils.map(optionGroups, (group: any, gIndex: any) => {
420
+ return h('a-select-opt-group', {
421
+ key: gIndex
422
+ }, [
423
+ h('span', {
424
+ slot: 'label'
425
+ }, group[groupLabel])
426
+ ].concat(
427
+ renderOptions(h, group[groupOptions], optionProps)
428
+ ))
429
+ }))
430
+ ]
431
+ }
432
+ return [
433
+ h('a-select', {
434
+ attrs,
435
+ props: {
436
+ ...props,
437
+ options: props.options || options
438
+ },
439
+ on: ons
440
+ })
441
+ ]
442
+ },
443
+ renderTableCell (h, renderOpts, params) {
444
+ const { options, optionGroups } = renderOpts
445
+ const { $table, row, column } = params
446
+ const opSize = options ? options.length : null
447
+ const ogSize = optionGroups ? optionGroups.length : null
448
+ if ($table.effectCellData) {
449
+ const { cellResult } = $table.effectCellData(row, column, {
450
+ key: 'render_table_cell',
451
+ isChanged ({ oldValue, cellValue }) {
452
+ return oldValue && oldValue[0] === cellValue && oldValue[1] === opSize && oldValue[2] === ogSize
453
+ },
454
+ setValue ({ cellValue }) {
455
+ return [cellValue, opSize, ogSize]
456
+ },
457
+ getResult ({ cellValue }) {
458
+ return handleSelectCellValue(cellValue, renderOpts)
459
+ }
460
+ })
461
+ return getCellLabelVNs(h, renderOpts, params, cellResult)
462
+ }
463
+ const cellResult = getSelectCellValue(renderOpts, params)
464
+ return getCellLabelVNs(h, renderOpts, params, cellResult)
465
+ },
466
+ renderTableFilter (h, renderOpts, params) {
467
+ const { options = [], optionGroups, optionGroupProps = {} } = renderOpts
468
+ const groupOptions = optionGroupProps.options || 'options'
469
+ const { column } = params
470
+ const { attrs } = renderOpts
471
+ return [
472
+ h('div', {
473
+ class: 'vxe-table--filter-antd-wrapper'
474
+ }, optionGroups
475
+ ? column.filters.map((option, oIndex) => {
476
+ const optionValue = option.data
477
+ const props = getCellEditFilterProps(renderOpts, params, optionValue)
478
+ return h('a-select', {
479
+ key: oIndex,
480
+ attrs,
481
+ props: {
482
+ ...props,
483
+ options: groupOptions
484
+ },
485
+ on: getFilterOns(renderOpts, params, option, () => {
486
+ // 处理 change 事件相关逻辑
487
+ handleConfirmFilter(params, props.mode === 'multiple' ? (option.data && option.data.length > 0) : !XEUtils.eqNull(option.data), option)
488
+ })
489
+ })
490
+ })
491
+ : column.filters.map((option, oIndex) => {
492
+ const optionValue = option.data
493
+ const props = getCellEditFilterProps(renderOpts, params, optionValue)
494
+ return h('a-select', {
495
+ key: oIndex,
496
+ attrs,
497
+ props: {
498
+ ...props,
499
+ options: props.options || options
500
+ },
501
+ on: getFilterOns(renderOpts, params, option, () => {
502
+ // 处理 change 事件相关逻辑
503
+ handleConfirmFilter(params, props.mode === 'multiple' ? (option.data && option.data.length > 0) : !XEUtils.eqNull(option.data), option)
504
+ })
505
+ })
506
+ }))
507
+ ]
508
+ },
509
+ tableFilterDefaultMethod (params) {
510
+ const { option, row, column } = params
511
+ const { data } = option
512
+ const { field, filterRender: renderOpts } = column
513
+ const { props = {} } = renderOpts
514
+ const cellValue = XEUtils.get(row, field)
515
+ if (props.mode === 'multiple') {
516
+ if (XEUtils.isArray(cellValue)) {
517
+ return XEUtils.includeArrays(cellValue, data)
518
+ }
519
+ return data.indexOf(cellValue) > -1
520
+ }
521
+ /* eslint-disable eqeqeq */
522
+ return cellValue == data
523
+ },
524
+ tableExportMethod: createExportMethod(getSelectCellValue)
525
+ },
526
+ ACascader: {
527
+ renderTableEdit: createEditRender(),
528
+ renderTableCell (h, renderOpts, params) {
529
+ return getCellLabelVNs(h, renderOpts, params, getCascaderCellValue(renderOpts, params))
530
+ },
531
+ tableExportMethod: createExportMethod(getCascaderCellValue)
532
+ },
533
+ ADatePicker: {
534
+ renderTableEdit: createEditRender(),
535
+ renderTableCell: formatDatePicker(),
536
+ tableExportMethod: createDatePickerExportMethod()
537
+ },
538
+ AMonthPicker: {
539
+ renderTableEdit: createEditRender(),
540
+ renderTableCell: formatDatePicker('YYYY-MM'),
541
+ tableExportMethod: createDatePickerExportMethod('YYYY-MM')
542
+ },
543
+ ARangePicker: {
544
+ renderTableEdit: createEditRender(),
545
+ renderTableCell (h, renderOpts, params) {
546
+ return getCellLabelVNs(h, renderOpts, params, getRangePickerCellValue(renderOpts, params))
547
+ },
548
+ tableExportMethod: createExportMethod(getRangePickerCellValue)
549
+ },
550
+ AWeekPicker: {
551
+ renderTableEdit: createEditRender(),
552
+ renderTableCell: formatDatePicker('YYYY-WW周'),
553
+ tableExportMethod: createDatePickerExportMethod('YYYY-WW周')
554
+ },
555
+ ATimePicker: {
556
+ renderTableEdit: createEditRender(),
557
+ renderTableCell: formatTimePicker('HH:mm:ss'),
558
+ tableExportMethod: createDatePickerExportMethod('HH:mm:ss')
559
+ },
560
+ ATreeSelect: {
561
+ renderTableEdit: createEditRender(),
562
+ renderTableCell (h, renderOpts, params) {
563
+ return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params))
564
+ },
565
+ tableExportMethod: createExportMethod(getTreeSelectCellValue)
566
+ },
567
+ ARate: {
568
+ renderTableDefault: createEditRender(),
569
+ renderTableEdit: createEditRender(),
570
+ renderTableFilter: createFilterRender(),
571
+ tableFilterDefaultMethod: defaultExactFilterMethod
572
+ },
573
+ ASwitch: {
574
+ renderTableDefault: createEditRender(),
575
+ renderTableEdit: createEditRender(),
576
+ renderTableFilter (h, renderOpts, params) {
577
+ const { column } = params
578
+ const { name, attrs } = renderOpts
579
+ return [
580
+ h('div', {
581
+ class: 'vxe-table--filter-antd-wrapper'
582
+ }, column.filters.map((option, oIndex) => {
583
+ const optionValue = option.data
584
+ return h(name as string, {
585
+ key: oIndex,
586
+ attrs,
587
+ props: getCellEditFilterProps(renderOpts, params, optionValue),
588
+ on: getFilterOns(renderOpts, params, option, () => {
589
+ // 处理 change 事件相关逻辑
590
+ handleConfirmFilter(params, XEUtils.isBoolean(option.data), option)
591
+ })
592
+ })
593
+ }))
594
+ ]
595
+ },
596
+ tableFilterDefaultMethod: defaultExactFilterMethod
597
+ },
598
+ AButton: {
599
+ renderTableEdit: defaultButtonEditRender,
600
+ renderTableDefault: defaultButtonEditRender
601
+ },
602
+ AButtons: {
603
+ renderTableEdit: defaultButtonsEditRender,
604
+ renderTableDefault: defaultButtonsEditRender
605
+ }
606
+ })
607
+ }