vxe-table 3.5.8 → 3.5.9-beta.10
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/lib/edit/src/mixin.js +18 -14
- package/lib/edit/src/mixin.min.js +1 -1
- package/lib/export/src/mixin.js +1 -1
- package/lib/export/src/mixin.min.js +1 -1
- package/lib/filter/src/mixin.js +8 -5
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/filter/src/panel.js +7 -2
- package/lib/filter/src/panel.min.js +1 -1
- package/lib/form/src/form-config-item.js +2 -1
- package/lib/form/src/form-config-item.min.js +1 -1
- package/lib/form/src/form-item.js +3 -1
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +12 -7
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/render.js +1 -0
- package/lib/form/src/render.min.js +1 -1
- package/lib/form/style/style.css +2 -1
- package/lib/form/style/style.min.css +1 -1
- package/lib/grid/src/grid.js +14 -8
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +804 -496
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +20 -15
- package/lib/input/src/input.min.js +1 -1
- package/lib/list/src/list.js +12 -7
- package/lib/list/src/list.min.js +1 -1
- package/lib/loading/index.js +19 -0
- package/lib/loading/index.min.js +1 -0
- package/lib/loading/src/loading.js +36 -0
- package/lib/loading/src/loading.min.js +1 -0
- package/lib/locale/lang/en-US.js +5 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +5 -0
- package/lib/locale/lang/ja-JP.js +5 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +5 -0
- package/lib/locale/lang/zh-CN.js +5 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +5 -0
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +5 -0
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +5 -0
- package/lib/locale/lang/zh-TC.js +5 -0
- package/lib/locale/lang/zh-TC.min.js +1 -1
- package/lib/locale/lang/zh-TC.umd.js +5 -0
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +5 -0
- package/lib/modal/src/modal.js +28 -12
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/modal/style/style.css +1 -1
- package/lib/modal/style/style.min.css +1 -1
- package/lib/select/src/select.js +213 -33
- package/lib/select/src/select.min.js +1 -1
- package/lib/select/style/style.css +17 -72
- 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 +6 -3
- 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/methods.js +84 -62
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +12 -8
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +0 -68
- package/lib/table/style/style.min.css +1 -1
- package/lib/toolbar/style/style.css +13 -10
- 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/tools/utils.js +2 -2
- package/lib/tools/utils.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 +6 -2
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/lib/v-x-e-table/src/store.js +10 -5
- package/lib/v-x-e-table/src/store.min.js +1 -1
- package/lib/v-x-e-table/style/style.css +590 -0
- package/lib/v-x-e-table/style/style.min.css +1 -0
- package/package.json +1 -1
- package/packages/edit/src/mixin.js +17 -13
- package/packages/export/src/mixin.js +2 -2
- package/packages/filter/src/mixin.js +5 -5
- package/packages/filter/src/panel.js +13 -6
- package/packages/form/src/form-config-item.js +17 -9
- package/packages/form/src/form-item.js +16 -8
- package/packages/form/src/form.js +10 -9
- package/packages/form/src/render.js +1 -1
- package/packages/grid/src/grid.js +9 -7
- package/packages/input/src/input.js +17 -13
- package/packages/list/src/list.js +10 -9
- package/packages/loading/index.js +9 -0
- package/packages/loading/src/loading.js +31 -0
- package/packages/locale/lang/en-US.js +5 -0
- package/packages/locale/lang/ja-JP.js +5 -0
- package/packages/locale/lang/zh-CN.js +5 -0
- package/packages/locale/lang/zh-TC.js +5 -0
- package/packages/modal/src/modal.js +23 -14
- package/packages/select/src/select.js +139 -16
- package/packages/table/src/body.js +39 -24
- package/packages/table/src/cell.js +3 -3
- package/packages/table/src/columnInfo.js +1 -1
- package/packages/table/src/methods.js +68 -57
- package/packages/table/src/table.js +10 -9
- package/packages/tools/utils.js +2 -2
- package/packages/v-x-e-table/src/conf.js +6 -2
- package/packages/v-x-e-table/src/store.js +8 -4
- package/styles/form.scss +1 -0
- package/styles/{base/loading.scss → loading.scss} +17 -4
- package/styles/modal.scss +1 -1
- package/styles/modules.scss +1 -0
- package/styles/select.scss +24 -6
- package/styles/table.scss +0 -1
- package/styles/toolbar.scss +9 -5
- package/styles/v-x-e-table.scss +2 -0
- package/styles/variable.scss +0 -4
- package/types/form-item.d.ts +11 -8
- package/types/form.d.ts +5 -2
- package/types/table.d.ts +5 -0
- package/types/v-x-e-table/renderer.d.ts +15 -2
|
@@ -5,6 +5,7 @@ import UtilTools, { getFuncText } from '../../tools/utils'
|
|
|
5
5
|
import DomTools from '../../tools/dom'
|
|
6
6
|
import { GlobalEvent } from '../../tools/event'
|
|
7
7
|
import { errLog } from '../../tools/log'
|
|
8
|
+
import VxeLoading from '../../loading/index'
|
|
8
9
|
|
|
9
10
|
export const allActivedModals = []
|
|
10
11
|
export const msgQueue = []
|
|
@@ -68,7 +69,7 @@ export default {
|
|
|
68
69
|
modalTop: 0,
|
|
69
70
|
modalZindex: 0,
|
|
70
71
|
zoomLocat: null,
|
|
71
|
-
firstOpen:
|
|
72
|
+
firstOpen: true
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
75
|
computed: {
|
|
@@ -163,7 +164,7 @@ export default {
|
|
|
163
164
|
}, [
|
|
164
165
|
this.showHeader ? h('div', {
|
|
165
166
|
class: ['vxe-modal--header', {
|
|
166
|
-
'is--
|
|
167
|
+
'is--draggable': draggable,
|
|
167
168
|
'is--ellipsis': !isMsg && showTitleOverflow
|
|
168
169
|
}],
|
|
169
170
|
on: headerOns
|
|
@@ -203,15 +204,15 @@ export default {
|
|
|
203
204
|
h('div', {
|
|
204
205
|
class: 'vxe-modal--content'
|
|
205
206
|
}, defaultSlot ? (!inited || (destroyOnClose && !visible) ? [] : defaultSlot.call(this, { $modal: this }, h)) : getFuncText(content)),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
207
|
+
/**
|
|
208
|
+
* 加载中
|
|
209
|
+
*/
|
|
210
|
+
!isMsg ? h(VxeLoading, {
|
|
211
|
+
class: 'vxe-modal--loading',
|
|
212
|
+
props: {
|
|
213
|
+
loading
|
|
214
|
+
}
|
|
215
|
+
}) : null
|
|
215
216
|
]),
|
|
216
217
|
showFooter ? h('div', {
|
|
217
218
|
class: 'vxe-modal--footer'
|
|
@@ -346,18 +347,22 @@ export default {
|
|
|
346
347
|
} else {
|
|
347
348
|
this.$nextTick(() => {
|
|
348
349
|
const { firstOpen, fullscreen } = this
|
|
349
|
-
if (!remember ||
|
|
350
|
+
if (!remember || firstOpen) {
|
|
350
351
|
this.updatePosition().then(() => {
|
|
351
352
|
setTimeout(() => this.updatePosition(), 20)
|
|
352
353
|
})
|
|
353
354
|
}
|
|
354
|
-
if (
|
|
355
|
-
this.firstOpen =
|
|
355
|
+
if (firstOpen) {
|
|
356
|
+
this.firstOpen = false
|
|
356
357
|
if (this.hasPosStorage()) {
|
|
357
358
|
this.restorePosStorage()
|
|
358
359
|
} else if (fullscreen) {
|
|
359
360
|
this.$nextTick(() => this.maximize())
|
|
360
361
|
}
|
|
362
|
+
} else {
|
|
363
|
+
if (fullscreen) {
|
|
364
|
+
this.$nextTick(() => this.maximize())
|
|
365
|
+
}
|
|
361
366
|
}
|
|
362
367
|
})
|
|
363
368
|
}
|
|
@@ -575,6 +580,7 @@ export default {
|
|
|
575
580
|
}
|
|
576
581
|
modalBoxElem.style.left = `${left}px`
|
|
577
582
|
modalBoxElem.style.top = `${top}px`
|
|
583
|
+
modalBoxElem.className = modalBoxElem.className.replace(/\s?is--drag/, '') + ' is--drag'
|
|
578
584
|
}
|
|
579
585
|
document.onmouseup = () => {
|
|
580
586
|
document.onmousemove = domMousemove
|
|
@@ -584,6 +590,9 @@ export default {
|
|
|
584
590
|
this.savePosStorage()
|
|
585
591
|
})
|
|
586
592
|
}
|
|
593
|
+
setTimeout(() => {
|
|
594
|
+
modalBoxElem.className = modalBoxElem.className.replace(/\s?is--drag/, '')
|
|
595
|
+
}, 50)
|
|
587
596
|
}
|
|
588
597
|
}
|
|
589
598
|
},
|
|
@@ -4,7 +4,7 @@ import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
|
4
4
|
import vSize from '../../mixins/size'
|
|
5
5
|
import UtilTools, { getFuncText } from '../../tools/utils'
|
|
6
6
|
import DomTools from '../../tools/dom'
|
|
7
|
-
import { GlobalEvent } from '../../tools/event'
|
|
7
|
+
import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
|
|
8
8
|
|
|
9
9
|
function isOptionVisible (option) {
|
|
10
10
|
return option.visible !== false
|
|
@@ -112,6 +112,13 @@ function findOption (_vm, optionValue) {
|
|
|
112
112
|
return fullOptionList.find(item => optionValue === item[valueField])
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
function getRemoteSelectLabel (_vm, value) {
|
|
116
|
+
const { remoteValueList } = _vm
|
|
117
|
+
const remoteItem = remoteValueList.find(item => value === item.key)
|
|
118
|
+
const item = remoteItem ? remoteItem.result : null
|
|
119
|
+
return XEUtils.toValueString(item ? item[_vm.labelField] : value)
|
|
120
|
+
}
|
|
121
|
+
|
|
115
122
|
function getSelectLabel (_vm, value) {
|
|
116
123
|
const item = findOption(_vm, value)
|
|
117
124
|
return XEUtils.toValueString(item ? item[_vm.labelField] : value)
|
|
@@ -141,7 +148,7 @@ export function renderOption (h, _vm, list, group) {
|
|
|
141
148
|
mousedown: _vm.mousedownOptionEvent,
|
|
142
149
|
click: (evnt) => {
|
|
143
150
|
if (!isDisabled) {
|
|
144
|
-
_vm.changeOptionEvent(evnt, optionValue)
|
|
151
|
+
_vm.changeOptionEvent(evnt, optionValue, option)
|
|
145
152
|
}
|
|
146
153
|
},
|
|
147
154
|
mouseenter: () => {
|
|
@@ -182,7 +189,21 @@ export function renderOptgroup (h, _vm) {
|
|
|
182
189
|
}
|
|
183
190
|
|
|
184
191
|
function renderOpts (h, _vm) {
|
|
185
|
-
const { isGroup, visibleGroupList, visibleOptionList } = _vm
|
|
192
|
+
const { isGroup, visibleGroupList, visibleOptionList, searchLoading } = _vm
|
|
193
|
+
if (searchLoading) {
|
|
194
|
+
return [
|
|
195
|
+
h('div', {
|
|
196
|
+
class: 'vxe-select--search-loading'
|
|
197
|
+
}, [
|
|
198
|
+
h('i', {
|
|
199
|
+
class: ['vxe-select--search-icon', GlobalConfig.icon.SELECT_LOADED]
|
|
200
|
+
}),
|
|
201
|
+
h('span', {
|
|
202
|
+
class: 'vxe-select--search-text'
|
|
203
|
+
}, GlobalConfig.i18n('vxe.select.loadingText'))
|
|
204
|
+
])
|
|
205
|
+
]
|
|
206
|
+
}
|
|
186
207
|
if (isGroup) {
|
|
187
208
|
if (visibleGroupList.length) {
|
|
188
209
|
return renderOptgroup(h, _vm)
|
|
@@ -219,6 +240,10 @@ export default {
|
|
|
219
240
|
optionConfig: Object,
|
|
220
241
|
className: [String, Function],
|
|
221
242
|
size: { type: String, default: () => GlobalConfig.select.size || GlobalConfig.size },
|
|
243
|
+
filterable: Boolean,
|
|
244
|
+
filterMethod: Function,
|
|
245
|
+
remote: Boolean,
|
|
246
|
+
remoteMethod: Function,
|
|
222
247
|
emptyText: String,
|
|
223
248
|
// 已废弃,被 option-config.keyField 替换
|
|
224
249
|
optionId: { type: String, default: () => GlobalConfig.select.optionId },
|
|
@@ -250,13 +275,17 @@ export default {
|
|
|
250
275
|
fullOptionList: [],
|
|
251
276
|
visibleGroupList: [],
|
|
252
277
|
visibleOptionList: [],
|
|
278
|
+
remoteValueList: [],
|
|
253
279
|
panelIndex: 0,
|
|
254
280
|
panelStyle: null,
|
|
255
281
|
panelPlacement: null,
|
|
282
|
+
currentOption: null,
|
|
256
283
|
currentValue: null,
|
|
257
284
|
visiblePanel: false,
|
|
258
285
|
animatVisible: false,
|
|
259
|
-
isActivated: false
|
|
286
|
+
isActivated: false,
|
|
287
|
+
searchValue: '',
|
|
288
|
+
searchLoading: false
|
|
260
289
|
}
|
|
261
290
|
},
|
|
262
291
|
computed: {
|
|
@@ -288,9 +317,13 @@ export default {
|
|
|
288
317
|
return XEUtils.toNumber(this.multiCharOverflow)
|
|
289
318
|
},
|
|
290
319
|
selectLabel () {
|
|
291
|
-
const { value, multiple, multiMaxCharNum } = this
|
|
320
|
+
const { value, multiple, remote, multiMaxCharNum } = this
|
|
292
321
|
if (value && multiple) {
|
|
293
|
-
|
|
322
|
+
const vals = (XEUtils.isArray(value) ? value : [value])
|
|
323
|
+
if (remote) {
|
|
324
|
+
return vals.map(val => getRemoteSelectLabel(this, val)).join(', ')
|
|
325
|
+
}
|
|
326
|
+
return vals.map(val => {
|
|
294
327
|
const label = getSelectLabel(this, val)
|
|
295
328
|
if (multiMaxCharNum > 0 && label.length > multiMaxCharNum) {
|
|
296
329
|
return `${label.substring(0, multiMaxCharNum)}...`
|
|
@@ -298,6 +331,9 @@ export default {
|
|
|
298
331
|
return label
|
|
299
332
|
}).join(', ')
|
|
300
333
|
}
|
|
334
|
+
if (remote) {
|
|
335
|
+
return getRemoteSelectLabel(this, value)
|
|
336
|
+
}
|
|
301
337
|
return getSelectLabel(this, value)
|
|
302
338
|
}
|
|
303
339
|
},
|
|
@@ -349,13 +385,14 @@ export default {
|
|
|
349
385
|
GlobalEvent.off(this, 'blur')
|
|
350
386
|
},
|
|
351
387
|
render (h) {
|
|
352
|
-
const { $scopedSlots, vSize, className, inited, isActivated, loading, disabled, visiblePanel } = this
|
|
388
|
+
const { _e, $scopedSlots, vSize, className, inited, isActivated, loading, disabled, visiblePanel, filterable } = this
|
|
353
389
|
const prefixSlot = $scopedSlots.prefix
|
|
354
390
|
return h('div', {
|
|
355
391
|
class: ['vxe-select', className ? (XEUtils.isFunction(className) ? className({ $select: this }) : className) : '', {
|
|
356
392
|
[`size--${vSize}`]: vSize,
|
|
357
393
|
'is--visivle': visiblePanel,
|
|
358
394
|
'is--disabled': disabled,
|
|
395
|
+
'is--filter': filterable,
|
|
359
396
|
'is--loading': loading,
|
|
360
397
|
'is--active': isActivated
|
|
361
398
|
}]
|
|
@@ -400,6 +437,28 @@ export default {
|
|
|
400
437
|
},
|
|
401
438
|
style: this.panelStyle
|
|
402
439
|
}, inited ? [
|
|
440
|
+
filterable ? h('div', {
|
|
441
|
+
class: 'vxe-select-filter--wrapper'
|
|
442
|
+
}, [
|
|
443
|
+
h('vxe-input', {
|
|
444
|
+
ref: 'inpSearch',
|
|
445
|
+
class: 'vxe-select-filter--input',
|
|
446
|
+
props: {
|
|
447
|
+
value: this.searchValue,
|
|
448
|
+
type: 'text',
|
|
449
|
+
clearable: true,
|
|
450
|
+
placeholder: GlobalConfig.i18n('vxe.select.search'),
|
|
451
|
+
prefixIcon: GlobalConfig.icon.INPUT_SEARCH
|
|
452
|
+
},
|
|
453
|
+
on: {
|
|
454
|
+
modelValue: this.modelSearchEvent,
|
|
455
|
+
focus: this.focusSearchEvent,
|
|
456
|
+
keydown: this.keydownSearchEvent,
|
|
457
|
+
change: this.triggerSearchEvent,
|
|
458
|
+
search: this.triggerSearchEvent
|
|
459
|
+
}
|
|
460
|
+
})
|
|
461
|
+
]) : _e(),
|
|
403
462
|
h('div', {
|
|
404
463
|
ref: 'optWrapper',
|
|
405
464
|
class: 'vxe-select-option--wrapper'
|
|
@@ -441,19 +500,32 @@ export default {
|
|
|
441
500
|
this.refreshOption()
|
|
442
501
|
},
|
|
443
502
|
/**
|
|
444
|
-
*
|
|
503
|
+
* 刷新选项,当选项被搜索、动态显示/隐藏时可能会用到
|
|
445
504
|
*/
|
|
446
505
|
refreshOption () {
|
|
447
|
-
const { isGroup, fullOptionList, fullGroupList } = this
|
|
506
|
+
const { isGroup, fullOptionList, fullGroupList, filterable, filterMethod, searchValue, labelField, groupLabelField } = this
|
|
448
507
|
if (isGroup) {
|
|
449
|
-
|
|
508
|
+
if (filterable && filterMethod) {
|
|
509
|
+
this.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && filterMethod({ group, option: null, searchValue }))
|
|
510
|
+
} else if (filterable) {
|
|
511
|
+
this.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && (!searchValue || `${group[groupLabelField]}`.indexOf(searchValue) > -1))
|
|
512
|
+
} else {
|
|
513
|
+
this.visibleGroupList = fullGroupList.filter(isOptionVisible)
|
|
514
|
+
}
|
|
450
515
|
} else {
|
|
451
|
-
|
|
516
|
+
if (filterable && filterMethod) {
|
|
517
|
+
this.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && filterMethod({ group: null, option, searchValue }))
|
|
518
|
+
} else if (filterable) {
|
|
519
|
+
this.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && (!searchValue || `${option[labelField]}`.indexOf(searchValue) > -1))
|
|
520
|
+
} else {
|
|
521
|
+
this.visibleOptionList = fullOptionList.filter(isOptionVisible)
|
|
522
|
+
}
|
|
452
523
|
}
|
|
453
524
|
return this.$nextTick()
|
|
454
525
|
},
|
|
455
526
|
setCurrentOption (option) {
|
|
456
527
|
if (option) {
|
|
528
|
+
this.currentOption = option
|
|
457
529
|
this.currentValue = option[this.valueField]
|
|
458
530
|
}
|
|
459
531
|
},
|
|
@@ -484,6 +556,7 @@ export default {
|
|
|
484
556
|
this.hideOptionPanel()
|
|
485
557
|
},
|
|
486
558
|
clearValueEvent (evnt, selectValue) {
|
|
559
|
+
this.remoteValueList = []
|
|
487
560
|
this.changeEvent(evnt, selectValue)
|
|
488
561
|
this.$emit('clear', { value: selectValue, $event: evnt })
|
|
489
562
|
},
|
|
@@ -503,8 +576,8 @@ export default {
|
|
|
503
576
|
evnt.stopPropagation()
|
|
504
577
|
}
|
|
505
578
|
},
|
|
506
|
-
changeOptionEvent (evnt, selectValue) {
|
|
507
|
-
const { value, multiple } = this
|
|
579
|
+
changeOptionEvent (evnt, selectValue, option) {
|
|
580
|
+
const { value, multiple, remoteValueList } = this
|
|
508
581
|
if (multiple) {
|
|
509
582
|
let multipleValue
|
|
510
583
|
if (value) {
|
|
@@ -516,8 +589,15 @@ export default {
|
|
|
516
589
|
} else {
|
|
517
590
|
multipleValue = [selectValue]
|
|
518
591
|
}
|
|
592
|
+
const remoteItem = remoteValueList.find(item => item.key === selectValue)
|
|
593
|
+
if (remoteItem) {
|
|
594
|
+
remoteItem.result = option
|
|
595
|
+
} else {
|
|
596
|
+
remoteValueList.push({ key: selectValue, result: option })
|
|
597
|
+
}
|
|
519
598
|
this.changeEvent(evnt, multipleValue)
|
|
520
599
|
} else {
|
|
600
|
+
this.remoteValueList = [{ key: selectValue, result: option }]
|
|
521
601
|
this.changeEvent(evnt, selectValue)
|
|
522
602
|
this.hideOptionPanel()
|
|
523
603
|
}
|
|
@@ -544,7 +624,7 @@ export default {
|
|
|
544
624
|
}
|
|
545
625
|
},
|
|
546
626
|
handleGlobalKeydownEvent (evnt) {
|
|
547
|
-
const { visiblePanel, currentValue, clearable, disabled } = this
|
|
627
|
+
const { visiblePanel, currentValue, currentOption, clearable, disabled } = this
|
|
548
628
|
if (!disabled) {
|
|
549
629
|
const keyCode = evnt.keyCode
|
|
550
630
|
const isTab = keyCode === 9
|
|
@@ -563,7 +643,7 @@ export default {
|
|
|
563
643
|
} else if (isEnter) {
|
|
564
644
|
evnt.preventDefault()
|
|
565
645
|
evnt.stopPropagation()
|
|
566
|
-
this.changeOptionEvent(evnt, currentValue)
|
|
646
|
+
this.changeOptionEvent(evnt, currentValue, currentOption)
|
|
567
647
|
} else if (isUpArrow || isDwArrow) {
|
|
568
648
|
evnt.preventDefault()
|
|
569
649
|
let { firstOption, offsetOption } = findOffsetOption(this, currentValue, isUpArrow)
|
|
@@ -594,6 +674,15 @@ export default {
|
|
|
594
674
|
this.panelIndex = UtilTools.nextZIndex()
|
|
595
675
|
}
|
|
596
676
|
},
|
|
677
|
+
handleFocusSearch () {
|
|
678
|
+
if (this.filterable) {
|
|
679
|
+
this.$nextTick(() => {
|
|
680
|
+
if (this.$refs.inpSearch) {
|
|
681
|
+
this.$refs.inpSearch.focus()
|
|
682
|
+
}
|
|
683
|
+
})
|
|
684
|
+
}
|
|
685
|
+
},
|
|
597
686
|
focusEvent () {
|
|
598
687
|
if (!this.disabled) {
|
|
599
688
|
this.isActivated = true
|
|
@@ -602,6 +691,32 @@ export default {
|
|
|
602
691
|
blurEvent () {
|
|
603
692
|
this.isActivated = false
|
|
604
693
|
},
|
|
694
|
+
modelSearchEvent (value) {
|
|
695
|
+
this.searchValue = value
|
|
696
|
+
},
|
|
697
|
+
focusSearchEvent () {
|
|
698
|
+
this.isActivated = true
|
|
699
|
+
},
|
|
700
|
+
keydownSearchEvent (params) {
|
|
701
|
+
const { $event } = params
|
|
702
|
+
const isEnter = hasEventKey($event, EVENT_KEYS.ENTER)
|
|
703
|
+
if (isEnter) {
|
|
704
|
+
$event.preventDefault()
|
|
705
|
+
$event.stopPropagation()
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
triggerSearchEvent: XEUtils.debounce(function () {
|
|
709
|
+
const { remote, remoteMethod, searchValue } = this
|
|
710
|
+
if (remote && remoteMethod) {
|
|
711
|
+
this.searchLoading = true
|
|
712
|
+
Promise.resolve(remoteMethod({ searchValue })).then(() => this.$nextTick()).catch(() => this.$nextTick()).finally(() => {
|
|
713
|
+
this.searchLoading = false
|
|
714
|
+
this.refreshOption()
|
|
715
|
+
})
|
|
716
|
+
} else {
|
|
717
|
+
this.refreshOption()
|
|
718
|
+
}
|
|
719
|
+
}, 350, { trailing: true }),
|
|
605
720
|
isPanelVisible () {
|
|
606
721
|
return this.visiblePanel
|
|
607
722
|
},
|
|
@@ -635,8 +750,9 @@ export default {
|
|
|
635
750
|
}
|
|
636
751
|
},
|
|
637
752
|
showOptionPanel () {
|
|
638
|
-
const { loading, disabled } = this
|
|
753
|
+
const { loading, disabled, filterable } = this
|
|
639
754
|
if (!loading && !disabled) {
|
|
755
|
+
this.searchList = this.option
|
|
640
756
|
clearTimeout(this.hidePanelTimeout)
|
|
641
757
|
if (!this.inited) {
|
|
642
758
|
this.inited = true
|
|
@@ -646,6 +762,9 @@ export default {
|
|
|
646
762
|
}
|
|
647
763
|
this.isActivated = true
|
|
648
764
|
this.animatVisible = true
|
|
765
|
+
if (filterable) {
|
|
766
|
+
this.refreshOption()
|
|
767
|
+
}
|
|
649
768
|
setTimeout(() => {
|
|
650
769
|
const { value, multiple } = this
|
|
651
770
|
const currOption = findOption(this, multiple && value ? value[0] : value)
|
|
@@ -654,15 +773,19 @@ export default {
|
|
|
654
773
|
this.setCurrentOption(currOption)
|
|
655
774
|
this.scrollToOption(currOption)
|
|
656
775
|
}
|
|
776
|
+
this.handleFocusSearch()
|
|
657
777
|
}, 10)
|
|
658
778
|
this.updateZindex()
|
|
659
779
|
this.updatePlacement()
|
|
660
780
|
}
|
|
661
781
|
},
|
|
662
782
|
hideOptionPanel () {
|
|
783
|
+
this.searchValue = ''
|
|
784
|
+
this.searchLoading = false
|
|
663
785
|
this.visiblePanel = false
|
|
664
786
|
this.hidePanelTimeout = setTimeout(() => {
|
|
665
787
|
this.animatVisible = false
|
|
788
|
+
this.searchValue = ''
|
|
666
789
|
}, 350)
|
|
667
790
|
},
|
|
668
791
|
updatePlacement () {
|
|
@@ -66,7 +66,7 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
|
|
|
66
66
|
isAllOverflow,
|
|
67
67
|
align: allAlign,
|
|
68
68
|
currentColumn,
|
|
69
|
-
cellClassName,
|
|
69
|
+
cellClassName: allCellClassName,
|
|
70
70
|
cellStyle,
|
|
71
71
|
mergeList,
|
|
72
72
|
spanMethod,
|
|
@@ -90,6 +90,9 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
|
|
|
90
90
|
const { actived } = editStore
|
|
91
91
|
const { rHeight: scrollYRHeight } = sYOpts
|
|
92
92
|
const { height: rowHeight } = rowOpts
|
|
93
|
+
const renderOpts = editRender || cellRender
|
|
94
|
+
const compConf = renderOpts ? VXETable.renderer.get(renderOpts.name) : null
|
|
95
|
+
const cellClassName = compConf ? compConf.cellClassName : ''
|
|
93
96
|
const showAllTip = tooltipOpts.showAll || tooltipOpts.enabled
|
|
94
97
|
const columnIndex = $xetable.getColumnIndex(column)
|
|
95
98
|
const _columnIndex = $xetable.getVTColumnIndex(column)
|
|
@@ -205,7 +208,7 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
|
|
|
205
208
|
}
|
|
206
209
|
// 如果编辑列开启显示状态
|
|
207
210
|
if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
|
|
208
|
-
isDirty = $xetable.isUpdateByRow(row, column.
|
|
211
|
+
isDirty = $xetable.isUpdateByRow(row, column.field)
|
|
209
212
|
}
|
|
210
213
|
const tdVNs = []
|
|
211
214
|
if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
|
|
@@ -255,19 +258,26 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
|
|
|
255
258
|
}
|
|
256
259
|
}
|
|
257
260
|
return h('td', {
|
|
258
|
-
class: [
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
261
|
+
class: [
|
|
262
|
+
'vxe-body--column',
|
|
263
|
+
column.id,
|
|
264
|
+
{
|
|
265
|
+
[`col--${cellAlign}`]: cellAlign,
|
|
266
|
+
[`col--${type}`]: type,
|
|
267
|
+
'col--last': $columnIndex === columns.length - 1,
|
|
268
|
+
'col--tree-node': treeNode,
|
|
269
|
+
'col--edit': isEdit,
|
|
270
|
+
'col--ellipsis': hasEllipsis,
|
|
271
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
272
|
+
'col--dirty': isDirty,
|
|
273
|
+
'col--actived': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
|
|
274
|
+
'col--valid-error': hasValidError,
|
|
275
|
+
'col--current': currentColumn === column
|
|
276
|
+
},
|
|
277
|
+
UtilTools.getClass(cellClassName, params),
|
|
278
|
+
UtilTools.getClass(className, params),
|
|
279
|
+
UtilTools.getClass(allCellClassName, params)
|
|
280
|
+
],
|
|
271
281
|
key: columnKey || columnOpts.useKey ? column.id : $columnIndex,
|
|
272
282
|
attrs,
|
|
273
283
|
style: Object.assign({
|
|
@@ -343,15 +353,20 @@ function renderRows (h, _vm, $xetable, fixedType, tableData, tableColumn) {
|
|
|
343
353
|
}
|
|
344
354
|
rows.push(
|
|
345
355
|
h('tr', {
|
|
346
|
-
class: [
|
|
347
|
-
'row
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
356
|
+
class: [
|
|
357
|
+
'vxe-body--row',
|
|
358
|
+
treeConfig ? `row--level-${rowLevel}` : '',
|
|
359
|
+
{
|
|
360
|
+
'row--stripe': stripe && ($xetable.getVTRowIndex(row) + 1) % 2 === 0,
|
|
361
|
+
'is--new': isNewRow,
|
|
362
|
+
'is--expand-row': isExpandRow,
|
|
363
|
+
'is--expand-tree': isExpandTree,
|
|
364
|
+
'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
|
|
365
|
+
'row--radio': radioOpts.highlight && $xetable.selectRow === row,
|
|
366
|
+
'row--checked': checkboxOpts.highlight && $xetable.isCheckedByCheckboxRow(row)
|
|
367
|
+
},
|
|
368
|
+
rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''
|
|
369
|
+
],
|
|
355
370
|
attrs: {
|
|
356
371
|
rowid: rowid
|
|
357
372
|
},
|
|
@@ -478,7 +478,7 @@ export const Cell = {
|
|
|
478
478
|
renderCheckboxCellByProp (h, params) {
|
|
479
479
|
const { $table, row, column, isHidden } = params
|
|
480
480
|
const { treeConfig, treeIndeterminates } = $table
|
|
481
|
-
const { labelField, checkField
|
|
481
|
+
const { labelField, checkField, halfField, checkMethod, visibleMethod } = $table.checkboxOpts
|
|
482
482
|
const { slots } = column
|
|
483
483
|
const defaultSlot = slots ? slots.default : null
|
|
484
484
|
const checkboxSlot = slots ? slots.checkbox : null
|
|
@@ -488,7 +488,7 @@ export const Cell = {
|
|
|
488
488
|
let isDisabled = !!checkMethod
|
|
489
489
|
let on
|
|
490
490
|
if (!isHidden) {
|
|
491
|
-
isChecked = XEUtils.get(row,
|
|
491
|
+
isChecked = XEUtils.get(row, checkField)
|
|
492
492
|
on = {
|
|
493
493
|
click (evnt) {
|
|
494
494
|
if (!isDisabled && isVisible) {
|
|
@@ -712,7 +712,7 @@ export const Cell = {
|
|
|
712
712
|
const { sortable, remoteSort, filters, editRender } = column
|
|
713
713
|
let isRequired = false
|
|
714
714
|
if (editRules) {
|
|
715
|
-
const columnRules = XEUtils.get(editRules,
|
|
715
|
+
const columnRules = XEUtils.get(editRules, column.field)
|
|
716
716
|
if (columnRules) {
|
|
717
717
|
isRequired = columnRules.some(rule => rule.required)
|
|
718
718
|
}
|