vxe-table 4.2.6-beta.3 → 4.2.6
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/README.md +1 -1
- package/README.zh-TW.md +0 -4
- package/es/edit/src/hook.js +2 -2
- package/es/export/src/export-panel.js +19 -19
- package/es/export/src/import-panel.js +9 -9
- package/es/filter/src/hook.js +5 -5
- package/es/form/src/form-item.js +1 -1
- package/es/form/src/render.js +1 -1
- package/es/grid/src/grid.js +12 -8
- package/es/input/src/input.js +19 -16
- package/es/locale/lang/en-US.js +2 -0
- package/es/locale/lang/ja-JP.js +2 -0
- package/es/locale/lang/zh-CN.js +2 -0
- package/es/locale/lang/zh-TC.js +2 -0
- package/es/menu/src/hooks.js +0 -6
- package/es/select/src/select.js +145 -15
- package/es/select/style.css +17 -3
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/body.js +1 -1
- package/es/table/src/cell.js +3 -3
- package/es/table/src/columnInfo.js +1 -1
- package/es/table/src/table.js +59 -47
- package/es/table/src/util.js +2 -2
- package/es/toolbar/style.css +11 -9
- package/es/tools/log.js +1 -1
- package/es/v-x-e-table/index.js +1 -1
- package/es/v-x-e-table/src/conf.js +2 -2
- package/lib/edit/src/hook.js +2 -2
- package/lib/filter/src/hook.js +8 -5
- package/lib/filter/src/hook.min.js +1 -1
- package/lib/form/src/form-item.js +1 -0
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/render.js +1 -0
- package/lib/form/src/render.min.js +1 -1
- package/lib/grid/src/grid.js +16 -11
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +327 -123
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +21 -18
- package/lib/input/src/input.min.js +1 -1
- package/lib/locale/lang/en-US.js +2 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -0
- package/lib/locale/lang/ja-JP.js +2 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -0
- package/lib/locale/lang/zh-CN.js +2 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -0
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +2 -0
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +2 -0
- package/lib/locale/lang/zh-TC.js +2 -0
- package/lib/locale/lang/zh-TC.min.js +1 -1
- package/lib/locale/lang/zh-TC.umd.js +2 -0
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +2 -0
- package/lib/menu/src/hooks.js +0 -6
- package/lib/select/src/select.js +194 -16
- package/lib/select/src/select.min.js +1 -1
- package/lib/select/style/style.css +17 -3
- package/lib/select/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +1 -1
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +3 -3
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -1
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/table.js +66 -51
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +2 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/style/style.css +11 -9
- package/lib/toolbar/style/style.min.css +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +2 -2
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/package.json +1 -1
- package/packages/edit/src/hook.ts +2 -2
- package/packages/export/src/export-panel.ts +19 -19
- package/packages/export/src/import-panel.ts +9 -9
- package/packages/filter/src/hook.ts +7 -7
- package/packages/form/src/form-item.ts +1 -1
- package/packages/form/src/render.ts +1 -1
- package/packages/grid/src/grid.ts +15 -9
- package/packages/input/src/input.ts +19 -16
- package/packages/locale/lang/en-US.ts +2 -0
- package/packages/locale/lang/ja-JP.ts +2 -0
- package/packages/locale/lang/zh-CN.ts +2 -0
- package/packages/locale/lang/zh-TC.ts +2 -0
- package/packages/menu/src/hooks.ts +0 -6
- package/packages/select/src/select.ts +146 -16
- package/packages/table/src/body.ts +1 -1
- package/packages/table/src/cell.ts +3 -3
- package/packages/table/src/columnInfo.ts +1 -1
- package/packages/table/src/table.ts +61 -49
- package/packages/table/src/util.ts +4 -4
- package/packages/v-x-e-table/src/conf.ts +2 -2
- package/styles/select.scss +24 -5
- package/styles/toolbar.scss +9 -5
- package/styles/variable.scss +0 -4
- package/types/form-item.d.ts +16 -1
- package/types/form.d.ts +1 -1
- package/types/input.d.ts +4 -0
- package/types/select.d.ts +19 -4
- package/types/table.d.ts +2 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { defineComponent, h, Teleport, PropType, ref, Ref, inject, VNode,
|
|
1
|
+
import { defineComponent, h, Teleport, PropType, ref, Ref, inject, VNode, computed, provide, onUnmounted, reactive, nextTick, watch, onMounted, createCommentVNode } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
4
4
|
import { useSize } from '../../hooks/size'
|
|
5
5
|
import { getEventTargetNode, getAbsolutePos } from '../../tools/dom'
|
|
6
6
|
import { getLastZIndex, nextZIndex, getFuncText, formatText } from '../../tools/utils'
|
|
7
7
|
import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
|
|
8
|
+
import VxeInputComponent from '../../input/src/input'
|
|
8
9
|
|
|
9
|
-
import { VxeSelectPropTypes, VxeSelectConstructor, SelectReactData, VxeSelectEmits, SelectMethods, SelectPrivateRef, VxeSelectMethods,
|
|
10
|
+
import { VxeSelectPropTypes, VxeSelectConstructor, SelectReactData, VxeSelectEmits, VxeInputConstructor, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeOptgroupProps, VxeOptionProps, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeInputDefines } from '../../../types/all'
|
|
10
11
|
|
|
11
12
|
function isOptionVisible (option: any) {
|
|
12
13
|
return option.visible !== false
|
|
@@ -35,6 +36,10 @@ export default defineComponent({
|
|
|
35
36
|
optionConfig: Object as PropType<VxeSelectPropTypes.OptionConfig>,
|
|
36
37
|
className: [String, Function] as PropType<VxeSelectPropTypes.ClassName>,
|
|
37
38
|
size: { type: String as PropType<VxeSelectPropTypes.Size>, default: () => GlobalConfig.select.size || GlobalConfig.size },
|
|
39
|
+
filterable: Boolean as PropType<VxeSelectPropTypes.Filterable>,
|
|
40
|
+
filterMethod: Function as PropType<VxeSelectPropTypes.FilterMethod>,
|
|
41
|
+
remote: Boolean as PropType<VxeSelectPropTypes.Remote>,
|
|
42
|
+
remoteMethod: Function as PropType<VxeSelectPropTypes.RemoteMethod>,
|
|
38
43
|
emptyText: String as PropType<VxeSelectPropTypes.EmptyText>,
|
|
39
44
|
// 已废弃,被 option-config.keyField 替换
|
|
40
45
|
optionId: { type: String as PropType<VxeSelectPropTypes.OptionId>, default: () => GlobalConfig.select.optionId },
|
|
@@ -63,17 +68,22 @@ export default defineComponent({
|
|
|
63
68
|
fullOptionList: [],
|
|
64
69
|
visibleGroupList: [],
|
|
65
70
|
visibleOptionList: [],
|
|
71
|
+
remoteValueList: [],
|
|
66
72
|
panelIndex: 0,
|
|
67
73
|
panelStyle: {},
|
|
68
74
|
panelPlacement: null,
|
|
75
|
+
currentOption: null,
|
|
69
76
|
currentValue: null,
|
|
70
77
|
visiblePanel: false,
|
|
71
78
|
animatVisible: false,
|
|
72
|
-
isActivated: false
|
|
79
|
+
isActivated: false,
|
|
80
|
+
searchValue: '',
|
|
81
|
+
searchLoading: false
|
|
73
82
|
})
|
|
74
83
|
|
|
75
84
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
76
85
|
const refInput = ref() as Ref<VxeInputConstructor>
|
|
86
|
+
const refInpSearch = ref() as Ref<VxeInputConstructor>
|
|
77
87
|
const refOptionWrapper = ref() as Ref<HTMLDivElement>
|
|
78
88
|
const refOptionPanel = ref() as Ref<HTMLDivElement>
|
|
79
89
|
|
|
@@ -163,6 +173,14 @@ export default defineComponent({
|
|
|
163
173
|
return fullOptionList.find((item) => optionValue === item[valueField])
|
|
164
174
|
}
|
|
165
175
|
|
|
176
|
+
const getRemoteSelectLabel = (value: any) => {
|
|
177
|
+
const { remoteValueList } = reactData
|
|
178
|
+
const labelField = computeLabelField.value
|
|
179
|
+
const remoteItem = remoteValueList.find(item => value === item.key)
|
|
180
|
+
const item = remoteItem ? remoteItem.result : null
|
|
181
|
+
return XEUtils.toValueString(item ? item[labelField] : value)
|
|
182
|
+
}
|
|
183
|
+
|
|
166
184
|
const getSelectLabel = (value: any) => {
|
|
167
185
|
const labelField = computeLabelField.value
|
|
168
186
|
const item = findOption(value)
|
|
@@ -170,10 +188,14 @@ export default defineComponent({
|
|
|
170
188
|
}
|
|
171
189
|
|
|
172
190
|
const computeSelectLabel = computed(() => {
|
|
173
|
-
const { modelValue, multiple } = props
|
|
191
|
+
const { modelValue, multiple, remote } = props
|
|
174
192
|
const multiMaxCharNum = computeMultiMaxCharNum.value
|
|
175
193
|
if (modelValue && multiple) {
|
|
176
|
-
|
|
194
|
+
const vals = XEUtils.isArray(modelValue) ? modelValue : [modelValue]
|
|
195
|
+
if (remote) {
|
|
196
|
+
return vals.map(val => getRemoteSelectLabel(val)).join(', ')
|
|
197
|
+
}
|
|
198
|
+
return vals.map((val) => {
|
|
177
199
|
const label = getSelectLabel(val)
|
|
178
200
|
if (multiMaxCharNum > 0 && label.length > multiMaxCharNum) {
|
|
179
201
|
return `${label.substring(0, multiMaxCharNum)}...`
|
|
@@ -181,6 +203,9 @@ export default defineComponent({
|
|
|
181
203
|
return label
|
|
182
204
|
}).join(', ')
|
|
183
205
|
}
|
|
206
|
+
if (remote) {
|
|
207
|
+
return getRemoteSelectLabel(modelValue)
|
|
208
|
+
}
|
|
184
209
|
return getSelectLabel(modelValue)
|
|
185
210
|
})
|
|
186
211
|
|
|
@@ -198,12 +223,27 @@ export default defineComponent({
|
|
|
198
223
|
* 刷新选项,当选项被动态显示/隐藏时可能会用到
|
|
199
224
|
*/
|
|
200
225
|
const refreshOption = () => {
|
|
201
|
-
const {
|
|
226
|
+
const { filterable, filterMethod } = props
|
|
227
|
+
const { fullOptionList, fullGroupList, searchValue } = reactData
|
|
202
228
|
const isGroup = computeIsGroup.value
|
|
229
|
+
const groupLabelField = computeGroupLabelField.value
|
|
230
|
+
const labelField = computeLabelField.value
|
|
203
231
|
if (isGroup) {
|
|
204
|
-
|
|
232
|
+
if (filterable && filterMethod) {
|
|
233
|
+
reactData.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && filterMethod({ group, option: null, searchValue }))
|
|
234
|
+
} else if (filterable) {
|
|
235
|
+
reactData.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && (!searchValue || `${group[groupLabelField]}`.indexOf(searchValue) > -1))
|
|
236
|
+
} else {
|
|
237
|
+
reactData.visibleGroupList = fullGroupList.filter(isOptionVisible)
|
|
238
|
+
}
|
|
205
239
|
} else {
|
|
206
|
-
|
|
240
|
+
if (filterable && filterMethod) {
|
|
241
|
+
reactData.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && filterMethod({ group: null, option, searchValue }))
|
|
242
|
+
} else if (filterable) {
|
|
243
|
+
reactData.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && (!searchValue || `${option[labelField]}`.indexOf(searchValue) > -1))
|
|
244
|
+
} else {
|
|
245
|
+
reactData.visibleOptionList = fullOptionList.filter(isOptionVisible)
|
|
246
|
+
}
|
|
207
247
|
}
|
|
208
248
|
return nextTick()
|
|
209
249
|
}
|
|
@@ -233,6 +273,7 @@ export default defineComponent({
|
|
|
233
273
|
const setCurrentOption = (option: any) => {
|
|
234
274
|
const valueField = computeValueField.value
|
|
235
275
|
if (option) {
|
|
276
|
+
reactData.currentOption = option
|
|
236
277
|
reactData.currentValue = option[valueField]
|
|
237
278
|
}
|
|
238
279
|
}
|
|
@@ -339,7 +380,7 @@ export default defineComponent({
|
|
|
339
380
|
let hidePanelTimeout: number
|
|
340
381
|
|
|
341
382
|
const showOptionPanel = () => {
|
|
342
|
-
const { loading, disabled } = props
|
|
383
|
+
const { loading, disabled, filterable } = props
|
|
343
384
|
if (!loading && !disabled) {
|
|
344
385
|
clearTimeout(hidePanelTimeout)
|
|
345
386
|
if (!reactData.inited) {
|
|
@@ -347,6 +388,9 @@ export default defineComponent({
|
|
|
347
388
|
}
|
|
348
389
|
reactData.isActivated = true
|
|
349
390
|
reactData.animatVisible = true
|
|
391
|
+
if (filterable) {
|
|
392
|
+
refreshOption()
|
|
393
|
+
}
|
|
350
394
|
setTimeout(() => {
|
|
351
395
|
const { modelValue, multiple } = props
|
|
352
396
|
const currOption = findOption(multiple && modelValue ? modelValue[0] : modelValue)
|
|
@@ -355,6 +399,7 @@ export default defineComponent({
|
|
|
355
399
|
setCurrentOption(currOption)
|
|
356
400
|
scrollToOption(currOption)
|
|
357
401
|
}
|
|
402
|
+
handleFocusSearch()
|
|
358
403
|
}, 10)
|
|
359
404
|
updateZindex()
|
|
360
405
|
updatePlacement()
|
|
@@ -362,6 +407,8 @@ export default defineComponent({
|
|
|
362
407
|
}
|
|
363
408
|
|
|
364
409
|
const hideOptionPanel = () => {
|
|
410
|
+
reactData.searchValue = ''
|
|
411
|
+
reactData.searchLoading = false
|
|
365
412
|
reactData.visiblePanel = false
|
|
366
413
|
hidePanelTimeout = window.setTimeout(() => {
|
|
367
414
|
reactData.animatVisible = false
|
|
@@ -380,6 +427,7 @@ export default defineComponent({
|
|
|
380
427
|
}
|
|
381
428
|
|
|
382
429
|
const clearValueEvent = (evnt: Event, selectValue: any) => {
|
|
430
|
+
reactData.remoteValueList = []
|
|
383
431
|
changeEvent(evnt, selectValue)
|
|
384
432
|
selectMethods.dispatchEvent('clear', { value: selectValue }, evnt)
|
|
385
433
|
}
|
|
@@ -389,8 +437,9 @@ export default defineComponent({
|
|
|
389
437
|
hideOptionPanel()
|
|
390
438
|
}
|
|
391
439
|
|
|
392
|
-
const changeOptionEvent = (evnt: Event, selectValue: any) => {
|
|
440
|
+
const changeOptionEvent = (evnt: Event, selectValue: any, option: any) => {
|
|
393
441
|
const { modelValue, multiple } = props
|
|
442
|
+
const { remoteValueList } = reactData
|
|
394
443
|
if (multiple) {
|
|
395
444
|
let multipleValue
|
|
396
445
|
if (modelValue) {
|
|
@@ -402,8 +451,15 @@ export default defineComponent({
|
|
|
402
451
|
} else {
|
|
403
452
|
multipleValue = [selectValue]
|
|
404
453
|
}
|
|
454
|
+
const remoteItem = remoteValueList.find(item => item.key === selectValue)
|
|
455
|
+
if (remoteItem) {
|
|
456
|
+
remoteItem.result = option
|
|
457
|
+
} else {
|
|
458
|
+
remoteValueList.push({ key: selectValue, result: option })
|
|
459
|
+
}
|
|
405
460
|
changeEvent(evnt, multipleValue)
|
|
406
461
|
} else {
|
|
462
|
+
reactData.remoteValueList = [{ key: selectValue, result: option }]
|
|
407
463
|
changeEvent(evnt, selectValue)
|
|
408
464
|
hideOptionPanel()
|
|
409
465
|
}
|
|
@@ -512,7 +568,7 @@ export default defineComponent({
|
|
|
512
568
|
|
|
513
569
|
const handleGlobalKeydownEvent = (evnt: KeyboardEvent) => {
|
|
514
570
|
const { clearable, disabled } = props
|
|
515
|
-
const { visiblePanel, currentValue } = reactData
|
|
571
|
+
const { visiblePanel, currentValue, currentOption } = reactData
|
|
516
572
|
if (!disabled) {
|
|
517
573
|
const isTab = hasEventKey(evnt, EVENT_KEYS.TAB)
|
|
518
574
|
const isEnter = hasEventKey(evnt, EVENT_KEYS.ENTER)
|
|
@@ -530,7 +586,7 @@ export default defineComponent({
|
|
|
530
586
|
} else if (isEnter) {
|
|
531
587
|
evnt.preventDefault()
|
|
532
588
|
evnt.stopPropagation()
|
|
533
|
-
changeOptionEvent(evnt, currentValue)
|
|
589
|
+
changeOptionEvent(evnt, currentValue, currentOption)
|
|
534
590
|
} else if (isUpArrow || isDwArrow) {
|
|
535
591
|
evnt.preventDefault()
|
|
536
592
|
let { firstOption, offsetOption } = findOffsetOption(currentValue, isUpArrow)
|
|
@@ -558,6 +614,17 @@ export default defineComponent({
|
|
|
558
614
|
hideOptionPanel()
|
|
559
615
|
}
|
|
560
616
|
|
|
617
|
+
const handleFocusSearch = () => {
|
|
618
|
+
if (props.filterable) {
|
|
619
|
+
nextTick(() => {
|
|
620
|
+
const inpSearch = refInpSearch.value
|
|
621
|
+
if (inpSearch) {
|
|
622
|
+
inpSearch.focus()
|
|
623
|
+
}
|
|
624
|
+
})
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
561
628
|
const focusEvent = () => {
|
|
562
629
|
if (!props.disabled) {
|
|
563
630
|
reactData.isActivated = true
|
|
@@ -568,6 +635,37 @@ export default defineComponent({
|
|
|
568
635
|
reactData.isActivated = false
|
|
569
636
|
}
|
|
570
637
|
|
|
638
|
+
const modelSearchEvent = (value: string) => {
|
|
639
|
+
reactData.searchValue = value
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
const focusSearchEvent = () => {
|
|
643
|
+
reactData.isActivated = true
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const keydownSearchEvent = (params: VxeInputDefines.KeydownEventParams) => {
|
|
647
|
+
const { $event } = params
|
|
648
|
+
const isEnter = hasEventKey($event, EVENT_KEYS.ENTER)
|
|
649
|
+
if (isEnter) {
|
|
650
|
+
$event.preventDefault()
|
|
651
|
+
$event.stopPropagation()
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
const triggerSearchEvent = XEUtils.debounce(function () {
|
|
656
|
+
const { remote, remoteMethod } = props
|
|
657
|
+
const { searchValue } = reactData
|
|
658
|
+
if (remote && remoteMethod) {
|
|
659
|
+
reactData.searchLoading = true
|
|
660
|
+
Promise.resolve(remoteMethod({ searchValue })).then(() => nextTick()).catch(() => nextTick()).finally(() => {
|
|
661
|
+
reactData.searchLoading = false
|
|
662
|
+
refreshOption()
|
|
663
|
+
})
|
|
664
|
+
} else {
|
|
665
|
+
refreshOption()
|
|
666
|
+
}
|
|
667
|
+
}, 350, { trailing: true })
|
|
668
|
+
|
|
571
669
|
const togglePanelEvent = (params: any) => {
|
|
572
670
|
const { $event } = params
|
|
573
671
|
$event.preventDefault()
|
|
@@ -611,7 +709,7 @@ export default defineComponent({
|
|
|
611
709
|
},
|
|
612
710
|
onClick: (evnt: MouseEvent) => {
|
|
613
711
|
if (!isDisabled) {
|
|
614
|
-
changeOptionEvent(evnt, optionValue)
|
|
712
|
+
changeOptionEvent(evnt, optionValue, option)
|
|
615
713
|
}
|
|
616
714
|
},
|
|
617
715
|
onMouseenter: () => {
|
|
@@ -654,8 +752,22 @@ export default defineComponent({
|
|
|
654
752
|
}
|
|
655
753
|
|
|
656
754
|
const renderOpts = () => {
|
|
657
|
-
const { visibleGroupList, visibleOptionList } = reactData
|
|
755
|
+
const { visibleGroupList, visibleOptionList, searchLoading } = reactData
|
|
658
756
|
const isGroup = computeIsGroup.value
|
|
757
|
+
if (searchLoading) {
|
|
758
|
+
return [
|
|
759
|
+
h('div', {
|
|
760
|
+
class: 'vxe-select--search-loading'
|
|
761
|
+
}, [
|
|
762
|
+
h('i', {
|
|
763
|
+
class: ['vxe-select--search-icon', GlobalConfig.icon.SELECT_LOADED]
|
|
764
|
+
}),
|
|
765
|
+
h('span', {
|
|
766
|
+
class: 'vxe-select--search-text'
|
|
767
|
+
}, GlobalConfig.i18n('vxe.select.loadingText'))
|
|
768
|
+
])
|
|
769
|
+
]
|
|
770
|
+
}
|
|
659
771
|
if (isGroup) {
|
|
660
772
|
if (visibleGroupList.length) {
|
|
661
773
|
return renderOptgroup()
|
|
@@ -763,7 +875,7 @@ export default defineComponent({
|
|
|
763
875
|
})
|
|
764
876
|
|
|
765
877
|
const renderVN = () => {
|
|
766
|
-
const { className, transfer, disabled, loading } = props
|
|
878
|
+
const { className, transfer, disabled, loading, filterable } = props
|
|
767
879
|
const { inited, isActivated, visiblePanel } = reactData
|
|
768
880
|
const vSize = computeSize.value
|
|
769
881
|
const selectLabel = computeSelectLabel.value
|
|
@@ -774,6 +886,7 @@ export default defineComponent({
|
|
|
774
886
|
[`size--${vSize}`]: vSize,
|
|
775
887
|
'is--visivle': visiblePanel,
|
|
776
888
|
'is--disabled': disabled,
|
|
889
|
+
'is--filter': filterable,
|
|
777
890
|
'is--loading': loading,
|
|
778
891
|
'is--active': isActivated
|
|
779
892
|
}]
|
|
@@ -782,7 +895,7 @@ export default defineComponent({
|
|
|
782
895
|
class: 'vxe-select-slots',
|
|
783
896
|
ref: 'hideOption'
|
|
784
897
|
}, slots.default ? slots.default({}) : []),
|
|
785
|
-
h(
|
|
898
|
+
h(VxeInputComponent, {
|
|
786
899
|
ref: refInput,
|
|
787
900
|
clearable: props.clearable,
|
|
788
901
|
placeholder: props.placeholder,
|
|
@@ -815,6 +928,23 @@ export default defineComponent({
|
|
|
815
928
|
placement: reactData.panelPlacement,
|
|
816
929
|
style: reactData.panelStyle
|
|
817
930
|
}, inited ? [
|
|
931
|
+
filterable ? h('div', {
|
|
932
|
+
class: 'vxe-select-filter--wrapper'
|
|
933
|
+
}, [
|
|
934
|
+
h(VxeInputComponent, {
|
|
935
|
+
ref: refInpSearch,
|
|
936
|
+
class: 'vxe-select-filter--input',
|
|
937
|
+
modelValue: reactData.searchValue,
|
|
938
|
+
clearable: true,
|
|
939
|
+
placeholder: GlobalConfig.i18n('vxe.select.search'),
|
|
940
|
+
prefixIcon: GlobalConfig.icon.INPUT_SEARCH,
|
|
941
|
+
'onUpdate:modelValue': modelSearchEvent,
|
|
942
|
+
onFocus: focusSearchEvent,
|
|
943
|
+
onKeydown: keydownSearchEvent,
|
|
944
|
+
onChange: triggerSearchEvent,
|
|
945
|
+
onSearch: triggerSearchEvent
|
|
946
|
+
})
|
|
947
|
+
]) : createCommentVNode(),
|
|
818
948
|
h('div', {
|
|
819
949
|
ref: refOptionWrapper,
|
|
820
950
|
class: 'vxe-select-option--wrapper'
|
|
@@ -234,7 +234,7 @@ export default defineComponent({
|
|
|
234
234
|
}
|
|
235
235
|
// 如果编辑列开启显示状态
|
|
236
236
|
if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
|
|
237
|
-
isDirty = $xetable.isUpdateByRow(row, column.
|
|
237
|
+
isDirty = $xetable.isUpdateByRow(row, column.field)
|
|
238
238
|
}
|
|
239
239
|
const tdVNs = []
|
|
240
240
|
if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
|
|
@@ -509,7 +509,7 @@ export const Cell = {
|
|
|
509
509
|
const { treeIndeterminates } = reactData
|
|
510
510
|
const { computeCheckboxOpts } = $table.getComputeMaps()
|
|
511
511
|
const checkboxOpts = computeCheckboxOpts.value
|
|
512
|
-
const { labelField, checkField
|
|
512
|
+
const { labelField, checkField, halfField, checkMethod, visibleMethod } = checkboxOpts
|
|
513
513
|
const { slots } = column
|
|
514
514
|
const defaultSlot = slots ? slots.default : null
|
|
515
515
|
const checkboxSlot = slots ? slots.checkbox : null
|
|
@@ -519,7 +519,7 @@ export const Cell = {
|
|
|
519
519
|
let isDisabled = !!checkMethod
|
|
520
520
|
let ons
|
|
521
521
|
if (!isHidden) {
|
|
522
|
-
isChecked = XEUtils.get(row,
|
|
522
|
+
isChecked = XEUtils.get(row, checkField as string)
|
|
523
523
|
ons = {
|
|
524
524
|
onClick (evnt: MouseEvent) {
|
|
525
525
|
if (!isDisabled && isVisible) {
|
|
@@ -742,7 +742,7 @@ export const Cell = {
|
|
|
742
742
|
const { sortable, filters, editRender } = column
|
|
743
743
|
let isRequired = false
|
|
744
744
|
if (editRules) {
|
|
745
|
-
const columnRules = XEUtils.get(editRules,
|
|
745
|
+
const columnRules = XEUtils.get(editRules, column.field) as VxeTableDefines.ValidatorRule[]
|
|
746
746
|
if (columnRules) {
|
|
747
747
|
isRequired = columnRules.some((rule) => rule.required)
|
|
748
748
|
}
|