vxe-table 4.2.4-beta.2 → 4.2.4
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/es/all.js +0 -2
- package/es/button/style.css +0 -5
- package/es/checkbox/src/checkbox.js +6 -0
- package/es/checkbox/src/group.js +7 -1
- package/es/edit/src/hook.js +35 -4
- package/es/form/src/form-config-item.js +152 -0
- package/es/form/src/form-gather.js +12 -3
- package/es/form/src/form-item.js +22 -3
- package/es/form/src/form.js +28 -119
- package/es/form/src/itemInfo.js +2 -0
- package/es/form/style.css +6 -6
- package/es/icon/style.css +10 -9
- package/es/input/src/input.js +50 -5
- package/es/input/style.css +5 -0
- package/es/radio/src/button.js +6 -0
- package/es/radio/src/group.js +8 -2
- package/es/radio/src/radio.js +6 -0
- package/es/select/src/select.js +7 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/switch/src/switch.js +7 -1
- package/es/table/src/table.js +3 -2
- package/es/textarea/src/textarea.js +7 -1
- package/es/tools/log.js +1 -1
- package/es/v-x-e-table/index.js +1 -1
- package/es/validator/src/hook.js +1 -1
- package/lib/all.js +15 -15
- package/lib/all.min.js +1 -1
- package/lib/button/style/style.css +0 -5
- package/lib/button/style/style.min.css +1 -1
- package/lib/checkbox/src/checkbox.js +7 -1
- package/lib/checkbox/src/checkbox.min.js +1 -1
- package/lib/checkbox/src/group.js +7 -1
- package/lib/checkbox/src/group.min.js +1 -1
- package/lib/edit/src/hook.js +35 -4
- package/lib/edit/src/hook.min.js +1 -1
- package/lib/form/src/form-config-item.js +212 -0
- package/lib/form/src/form-config-item.min.js +1 -0
- package/lib/form/src/form-gather.js +14 -3
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form-item.js +25 -2
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +30 -149
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/itemInfo.js +2 -0
- package/lib/form/src/itemInfo.min.js +1 -1
- package/lib/form/style/style.css +6 -6
- package/lib/form/style/style.min.css +1 -1
- package/lib/icon/style/style.css +10 -9
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +2072 -1839
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +54 -5
- package/lib/input/src/input.min.js +1 -1
- package/lib/input/style/style.css +5 -0
- package/lib/input/style/style.min.css +1 -1
- package/lib/radio/src/button.js +7 -1
- package/lib/radio/src/button.min.js +1 -1
- package/lib/radio/src/group.js +8 -2
- package/lib/radio/src/group.min.js +1 -1
- package/lib/radio/src/radio.js +7 -1
- package/lib/radio/src/radio.min.js +1 -1
- package/lib/select/src/select.js +7 -1
- package/lib/select/src/select.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/switch/src/switch.js +8 -1
- package/lib/switch/src/switch.min.js +1 -1
- package/lib/table/src/table.js +4 -2
- package/lib/table/src/table.min.js +1 -1
- package/lib/textarea/src/textarea.js +7 -1
- package/lib/textarea/src/textarea.min.js +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/validator/src/hook.js +1 -1
- package/lib/validator/src/hook.min.js +1 -1
- package/package.json +2 -2
- package/packages/all.ts +0 -2
- package/packages/checkbox/src/checkbox.ts +7 -1
- package/packages/checkbox/src/group.ts +8 -2
- package/packages/edit/src/hook.ts +35 -4
- package/packages/form/src/form-config-item.ts +156 -0
- package/packages/form/src/form-gather.ts +13 -3
- package/packages/form/src/form-item.ts +24 -3
- package/packages/form/src/form.ts +28 -126
- package/packages/form/src/itemInfo.ts +2 -0
- package/packages/input/src/input.ts +54 -6
- package/packages/radio/src/button.ts +7 -1
- package/packages/radio/src/group.ts +9 -3
- package/packages/radio/src/radio.ts +7 -1
- package/packages/select/src/select.ts +8 -2
- package/packages/switch/src/switch.ts +8 -2
- package/packages/table/src/table.ts +3 -2
- package/packages/textarea/src/textarea.ts +8 -2
- package/packages/validator/src/hook.ts +1 -1
- package/styles/button.scss +0 -5
- package/styles/form.scss +17 -19
- package/styles/icon.scss +10 -9
- package/styles/input.scss +4 -0
- package/styles/variable.scss +1 -0
- package/types/all.d.ts +0 -1
- package/types/edit.d.ts +38 -5
- package/types/form-item.d.ts +10 -0
- package/types/form.d.ts +14 -2
|
@@ -6,8 +6,8 @@ import { getFuncText, isEnableConf, eqEmptyValue } from '../../tools/utils'
|
|
|
6
6
|
import { errLog } from '../../tools/log'
|
|
7
7
|
import { scrollToView } from '../../tools/dom'
|
|
8
8
|
import { createItem, handleFieldOrItem } from './util'
|
|
9
|
-
import { renderTitle } from './render'
|
|
10
9
|
import { useSize } from '../../hooks/size'
|
|
10
|
+
import VxeFormConfigItem from './form-config-item'
|
|
11
11
|
|
|
12
12
|
import { VxeFormConstructor, VxeFormPropTypes, VxeFormEmits, FormReactData, FormMethods, FormPrivateRef, VxeFormPrivateMethods, VxeFormDefines, VxeFormItemPropTypes, VxeTooltipInstance, FormInternalData, VxeFormPrivateComputed } from '../../../types/all'
|
|
13
13
|
|
|
@@ -331,7 +331,7 @@ export default defineComponent({
|
|
|
331
331
|
}
|
|
332
332
|
} else {
|
|
333
333
|
const isArrType = type === 'array'
|
|
334
|
-
const hasEmpty = isArrType ? (!XEUtils.isArray(itemValue) || !itemValue.length) : eqEmptyValue(itemValue)
|
|
334
|
+
const hasEmpty = isArrType || XEUtils.isArray(itemValue) ? (!XEUtils.isArray(itemValue) || !itemValue.length) : eqEmptyValue(itemValue)
|
|
335
335
|
if (required ? (hasEmpty || validErrorRuleValue(rule, itemValue)) : (!hasEmpty && validErrorRuleValue(rule, itemValue))) {
|
|
336
336
|
errorRules.push(new Rule(rule))
|
|
337
337
|
}
|
|
@@ -491,137 +491,31 @@ export default defineComponent({
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
* 如果单元格配置了校验规则,则会进行校验
|
|
498
|
-
*/
|
|
499
|
-
const updateStatus = (scope: any, itemValue?: any) => {
|
|
500
|
-
const { property } = scope
|
|
501
|
-
if (property) {
|
|
502
|
-
validItemRules('change', property, itemValue)
|
|
494
|
+
const triggerItemEvent = (evnt: Event, field: string, itemValue?: any) => {
|
|
495
|
+
if (field) {
|
|
496
|
+
return validItemRules(evnt ? evnt.type : 'all', field, itemValue)
|
|
503
497
|
.then(() => {
|
|
504
|
-
clearValidate(
|
|
498
|
+
clearValidate(field)
|
|
505
499
|
})
|
|
506
500
|
.catch(({ rule }) => {
|
|
507
|
-
const item = getItemByField(
|
|
501
|
+
const item = getItemByField(field)
|
|
508
502
|
if (item) {
|
|
509
503
|
item.showError = true
|
|
510
504
|
item.errRule = rule
|
|
511
505
|
}
|
|
512
506
|
})
|
|
513
507
|
}
|
|
508
|
+
return nextTick()
|
|
514
509
|
}
|
|
515
510
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const titleSlot = slots ? slots.title : null
|
|
525
|
-
const span = item.span || props.span
|
|
526
|
-
const align = item.align || props.align
|
|
527
|
-
const titleAlign = item.titleAlign || props.titleAlign
|
|
528
|
-
const titleWidth = item.titleWidth || props.titleWidth
|
|
529
|
-
const itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow
|
|
530
|
-
const showEllipsis = itemOverflow === 'ellipsis'
|
|
531
|
-
const showTitle = itemOverflow === 'title'
|
|
532
|
-
const showTooltip = itemOverflow === true || itemOverflow === 'tooltip'
|
|
533
|
-
const hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
534
|
-
let itemVisibleMethod = visibleMethod
|
|
535
|
-
const params = { data, field, property: field, item, $form: $xeform }
|
|
536
|
-
if (visible === false) {
|
|
537
|
-
return createCommentVNode()
|
|
538
|
-
}
|
|
539
|
-
let isRequired = false
|
|
540
|
-
if (rules) {
|
|
541
|
-
const itemRules = rules[field]
|
|
542
|
-
if (itemRules) {
|
|
543
|
-
isRequired = itemRules.some((rule) => rule.required)
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
// 如果为项集合
|
|
547
|
-
const isGather = children && children.length > 0
|
|
548
|
-
if (isGather) {
|
|
549
|
-
const childVNs = renderItems(item.children)
|
|
550
|
-
return childVNs.length ? h('div', {
|
|
551
|
-
class: ['vxe-form--gather vxe-row', item.id, span ? `vxe-col--${span} is--span` : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '']
|
|
552
|
-
}, childVNs) : createCommentVNode()
|
|
553
|
-
}
|
|
554
|
-
if (!itemVisibleMethod && compConf && compConf.itemVisibleMethod) {
|
|
555
|
-
itemVisibleMethod = compConf.itemVisibleMethod
|
|
556
|
-
}
|
|
557
|
-
let contentVNs: any[] = []
|
|
558
|
-
if (defaultSlot) {
|
|
559
|
-
contentVNs = callSlot(defaultSlot, params)
|
|
560
|
-
} else if (compConf && compConf.renderItemContent) {
|
|
561
|
-
contentVNs = compConf.renderItemContent(itemRender, params)
|
|
562
|
-
} else if (field) {
|
|
563
|
-
contentVNs = [`${XEUtils.get(data, field)}`]
|
|
564
|
-
}
|
|
565
|
-
if (collapseNode) {
|
|
566
|
-
contentVNs.push(
|
|
567
|
-
h('div', {
|
|
568
|
-
class: 'vxe-form--item-trigger-node',
|
|
569
|
-
onClick: toggleCollapseEvent
|
|
570
|
-
}, [
|
|
571
|
-
h('span', {
|
|
572
|
-
class: 'vxe-form--item-trigger-text'
|
|
573
|
-
}, collapseAll ? GlobalConfig.i18n('vxe.form.unfolding') : GlobalConfig.i18n('vxe.form.folding')),
|
|
574
|
-
h('i', {
|
|
575
|
-
class: ['vxe-form--item-trigger-icon', collapseAll ? GlobalConfig.icon.FORM_FOLDING : GlobalConfig.icon.FORM_UNFOLDING]
|
|
576
|
-
})
|
|
577
|
-
])
|
|
578
|
-
)
|
|
579
|
-
}
|
|
580
|
-
if (errRule && validOpts.showMessage) {
|
|
581
|
-
contentVNs.push(
|
|
582
|
-
h('div', {
|
|
583
|
-
class: 'vxe-form--item-valid',
|
|
584
|
-
style: errRule.maxWidth ? {
|
|
585
|
-
width: `${errRule.maxWidth}px`
|
|
586
|
-
} : null
|
|
587
|
-
}, errRule.content)
|
|
588
|
-
)
|
|
589
|
-
}
|
|
590
|
-
const ons = showTooltip ? {
|
|
591
|
-
onMouseenter (evnt: MouseEvent) {
|
|
592
|
-
triggerTitleTipEvent(evnt, params)
|
|
593
|
-
},
|
|
594
|
-
onMouseleave: handleTitleTipLeaveEvent
|
|
595
|
-
} : {}
|
|
596
|
-
return h('div', {
|
|
597
|
-
class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
|
|
598
|
-
'is--title': title,
|
|
599
|
-
'is--required': isRequired,
|
|
600
|
-
'is--hidden': folding && collapseAll,
|
|
601
|
-
'is--active': !itemVisibleMethod || itemVisibleMethod(params),
|
|
602
|
-
'is--error': showError
|
|
603
|
-
}],
|
|
604
|
-
key: item.id
|
|
605
|
-
}, [
|
|
606
|
-
h('div', {
|
|
607
|
-
class: 'vxe-form--item-inner'
|
|
608
|
-
}, [
|
|
609
|
-
title || titleSlot ? h('div', {
|
|
610
|
-
class: ['vxe-form--item-title', titleAlign ? `align--${titleAlign}` : null, {
|
|
611
|
-
'is--ellipsis': hasEllipsis
|
|
612
|
-
}],
|
|
613
|
-
style: titleWidth ? {
|
|
614
|
-
width: isNaN(titleWidth as number) ? titleWidth : `${titleWidth}px`
|
|
615
|
-
} : null,
|
|
616
|
-
title: showTitle ? getFuncText(title) : null,
|
|
617
|
-
...ons
|
|
618
|
-
}, renderTitle($xeform, item)) : null,
|
|
619
|
-
h('div', {
|
|
620
|
-
class: ['vxe-form--item-content', align ? `align--${align}` : null]
|
|
621
|
-
}, contentVNs)
|
|
622
|
-
])
|
|
623
|
-
])
|
|
624
|
-
})
|
|
511
|
+
/**
|
|
512
|
+
* 更新项状态
|
|
513
|
+
* 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
|
|
514
|
+
* 如果单元格配置了校验规则,则会进行校验
|
|
515
|
+
*/
|
|
516
|
+
const updateStatus = (scope: any, itemValue?: any) => {
|
|
517
|
+
const { field } = scope
|
|
518
|
+
return triggerItemEvent(new Event('change'), field, itemValue)
|
|
625
519
|
}
|
|
626
520
|
|
|
627
521
|
formMethods = {
|
|
@@ -641,6 +535,7 @@ export default defineComponent({
|
|
|
641
535
|
|
|
642
536
|
const formPrivateMethods: VxeFormPrivateMethods = {
|
|
643
537
|
callSlot,
|
|
538
|
+
triggerItemEvent,
|
|
644
539
|
toggleCollapseEvent,
|
|
645
540
|
triggerTitleTipEvent,
|
|
646
541
|
handleTitleTipLeaveEvent
|
|
@@ -672,7 +567,7 @@ export default defineComponent({
|
|
|
672
567
|
})
|
|
673
568
|
|
|
674
569
|
const renderVN = () => {
|
|
675
|
-
const { loading, className, data,
|
|
570
|
+
const { loading, className, data, customLayout } = props
|
|
676
571
|
const { formItems } = reactData
|
|
677
572
|
// const formItems: any[] = []
|
|
678
573
|
const vSize = computeSize.value
|
|
@@ -682,8 +577,6 @@ export default defineComponent({
|
|
|
682
577
|
ref: refElem,
|
|
683
578
|
class: ['vxe-form', className ? (XEUtils.isFunction(className) ? className({ items: formItems, data, $form: $xeform }) : className) : '', {
|
|
684
579
|
[`size--${vSize}`]: vSize,
|
|
685
|
-
'is--colon': titleColon,
|
|
686
|
-
'is--asterisk': titleAsterisk,
|
|
687
580
|
'is--loading': loading
|
|
688
581
|
}],
|
|
689
582
|
onSubmit: submitEvent,
|
|
@@ -691,7 +584,13 @@ export default defineComponent({
|
|
|
691
584
|
}, [
|
|
692
585
|
h('div', {
|
|
693
586
|
class: 'vxe-form--wrapper vxe-row'
|
|
694
|
-
}, customLayout ? (defaultSlot ? defaultSlot({}) : []) :
|
|
587
|
+
}, customLayout ? (defaultSlot ? defaultSlot({}) : []) : formItems.map((item, index) => {
|
|
588
|
+
return h(VxeFormConfigItem, {
|
|
589
|
+
key: index,
|
|
590
|
+
itemConfig2: item,
|
|
591
|
+
itemConfig: item
|
|
592
|
+
})
|
|
593
|
+
})),
|
|
695
594
|
h('div', {
|
|
696
595
|
class: 'vxe-form-slots',
|
|
697
596
|
ref: 'hideItem'
|
|
@@ -718,6 +617,9 @@ export default defineComponent({
|
|
|
718
617
|
$xeform.renderVN = renderVN
|
|
719
618
|
|
|
720
619
|
provide('$xeform', $xeform)
|
|
620
|
+
provide('$xeformgather', null)
|
|
621
|
+
provide('$xeformitem', null)
|
|
622
|
+
provide('$xeformiteminfo', null)
|
|
721
623
|
|
|
722
624
|
return $xeform
|
|
723
625
|
},
|
|
@@ -10,6 +10,8 @@ export class ItemInfo {
|
|
|
10
10
|
align: item.align,
|
|
11
11
|
titleAlign: item.titleAlign,
|
|
12
12
|
titleWidth: item.titleWidth,
|
|
13
|
+
titleColon: item.titleColon,
|
|
14
|
+
titleAsterisk: item.titleAsterisk,
|
|
13
15
|
titlePrefix: item.titlePrefix,
|
|
14
16
|
titleSuffix: item.titleSuffix,
|
|
15
17
|
titleOverflow: item.titleOverflow,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, Teleport, ref, Ref, computed, reactive, nextTick, watch, onUnmounted, PropType } from 'vue'
|
|
1
|
+
import { defineComponent, h, Teleport, ref, Ref, computed, reactive, inject, nextTick, watch, onUnmounted, PropType } 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'
|
|
@@ -8,7 +8,7 @@ import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
|
|
|
8
8
|
import { toStringTimeDate, getDateQuarter } from './date'
|
|
9
9
|
import { handleNumber, toFloatValueFixed } from './number'
|
|
10
10
|
|
|
11
|
-
import { VNodeStyle, VxeInputConstructor, VxeInputEmits, InputReactData, InputMethods, VxeInputPropTypes, InputPrivateRef } from '../../../types/all'
|
|
11
|
+
import { VNodeStyle, VxeInputConstructor, VxeInputEmits, InputReactData, InputMethods, VxeInputPropTypes, InputPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types/all'
|
|
12
12
|
|
|
13
13
|
interface DateYearItem {
|
|
14
14
|
date: Date;
|
|
@@ -130,6 +130,8 @@ export default defineComponent({
|
|
|
130
130
|
] as VxeInputEmits,
|
|
131
131
|
setup (props, context) {
|
|
132
132
|
const { slots, emit } = context
|
|
133
|
+
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeform', null)
|
|
134
|
+
const $xeformiteminfo = inject<VxeFormDefines.ProvideItemInfo | null>('$xeformiteminfo', null)
|
|
133
135
|
|
|
134
136
|
const xID = XEUtils.uniqueId()
|
|
135
137
|
|
|
@@ -610,6 +612,40 @@ export default defineComponent({
|
|
|
610
612
|
return immediate || !(type === 'text' || type === 'number' || type === 'integer' || type === 'float')
|
|
611
613
|
})
|
|
612
614
|
|
|
615
|
+
const computeNumValue = computed(() => {
|
|
616
|
+
const { type } = props
|
|
617
|
+
const { inputValue } = reactData
|
|
618
|
+
const isNumType = computeIsNumType.value
|
|
619
|
+
if (isNumType) {
|
|
620
|
+
return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue))
|
|
621
|
+
}
|
|
622
|
+
return 0
|
|
623
|
+
})
|
|
624
|
+
|
|
625
|
+
const computeIsDisabledSubtractNumber = computed(() => {
|
|
626
|
+
const { min } = props
|
|
627
|
+
const { inputValue } = reactData
|
|
628
|
+
const isNumType = computeIsNumType.value
|
|
629
|
+
const numValue = computeNumValue.value
|
|
630
|
+
// 当有值时再进行判断
|
|
631
|
+
if ((inputValue || inputValue === 0) && isNumType && min !== null) {
|
|
632
|
+
return numValue <= XEUtils.toNumber(min)
|
|
633
|
+
}
|
|
634
|
+
return false
|
|
635
|
+
})
|
|
636
|
+
|
|
637
|
+
const computeIsDisabledAddNumber = computed(() => {
|
|
638
|
+
const { max } = props
|
|
639
|
+
const { inputValue } = reactData
|
|
640
|
+
const isNumType = computeIsNumType.value
|
|
641
|
+
const numValue = computeNumValue.value
|
|
642
|
+
// 当有值时再进行判断
|
|
643
|
+
if ((inputValue || inputValue === 0) && isNumType && max !== null) {
|
|
644
|
+
return numValue >= XEUtils.toNumber(max)
|
|
645
|
+
}
|
|
646
|
+
return false
|
|
647
|
+
})
|
|
648
|
+
|
|
613
649
|
const getNumberValue = (val: any) => {
|
|
614
650
|
const { type, exponential } = props
|
|
615
651
|
const inpMaxlength = computeInpMaxlength.value
|
|
@@ -632,6 +668,10 @@ export default defineComponent({
|
|
|
632
668
|
inputMethods.dispatchEvent('input', { value }, evnt)
|
|
633
669
|
if (XEUtils.toValueString(props.modelValue) !== value) {
|
|
634
670
|
inputMethods.dispatchEvent('change', { value }, evnt)
|
|
671
|
+
// 自动更新校验状态
|
|
672
|
+
if ($xeform && $xeformiteminfo) {
|
|
673
|
+
$xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, value)
|
|
674
|
+
}
|
|
635
675
|
}
|
|
636
676
|
}
|
|
637
677
|
|
|
@@ -959,8 +999,9 @@ export default defineComponent({
|
|
|
959
999
|
|
|
960
1000
|
const numberNextEvent = (evnt: Event) => {
|
|
961
1001
|
const { readonly, disabled } = props
|
|
1002
|
+
const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value
|
|
962
1003
|
clearTimeout(downbumTimeout)
|
|
963
|
-
if (!disabled && !readonly) {
|
|
1004
|
+
if (!disabled && !readonly && !isDisabledSubtractNumber) {
|
|
964
1005
|
numberChange(false, evnt)
|
|
965
1006
|
}
|
|
966
1007
|
inputMethods.dispatchEvent('next-number', {}, evnt)
|
|
@@ -975,8 +1016,9 @@ export default defineComponent({
|
|
|
975
1016
|
|
|
976
1017
|
const numberPrevEvent = (evnt: Event) => {
|
|
977
1018
|
const { readonly, disabled } = props
|
|
1019
|
+
const isDisabledAddNumber = computeIsDisabledAddNumber.value
|
|
978
1020
|
clearTimeout(downbumTimeout)
|
|
979
|
-
if (!disabled && !readonly) {
|
|
1021
|
+
if (!disabled && !readonly && !isDisabledAddNumber) {
|
|
980
1022
|
numberChange(true, evnt)
|
|
981
1023
|
}
|
|
982
1024
|
inputMethods.dispatchEvent('prev-number', {}, evnt)
|
|
@@ -2059,11 +2101,15 @@ export default defineComponent({
|
|
|
2059
2101
|
}
|
|
2060
2102
|
|
|
2061
2103
|
const renderNumberIcon = () => {
|
|
2104
|
+
const isDisabledAddNumber = computeIsDisabledAddNumber.value
|
|
2105
|
+
const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value
|
|
2062
2106
|
return h('span', {
|
|
2063
2107
|
class: 'vxe-input--number-suffix'
|
|
2064
2108
|
}, [
|
|
2065
2109
|
h('span', {
|
|
2066
|
-
class: 'vxe-input--number-prev is--prev',
|
|
2110
|
+
class: ['vxe-input--number-prev is--prev', {
|
|
2111
|
+
'is--disabled': isDisabledAddNumber
|
|
2112
|
+
}],
|
|
2067
2113
|
onMousedown: numberMousedownEvent,
|
|
2068
2114
|
onMouseup: numberStopDown,
|
|
2069
2115
|
onMouseleave: numberStopDown
|
|
@@ -2073,7 +2119,9 @@ export default defineComponent({
|
|
|
2073
2119
|
})
|
|
2074
2120
|
]),
|
|
2075
2121
|
h('span', {
|
|
2076
|
-
class: 'vxe-input--number-next is--next',
|
|
2122
|
+
class: ['vxe-input--number-next is--next', {
|
|
2123
|
+
'is--disabled': isDisabledSubtractNumber
|
|
2124
|
+
}],
|
|
2077
2125
|
onMousedown: numberMousedownEvent,
|
|
2078
2126
|
onMouseup: numberStopDown,
|
|
2079
2127
|
onMouseleave: numberStopDown
|
|
@@ -4,7 +4,7 @@ import { getFuncText } from '../../tools/utils'
|
|
|
4
4
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
5
5
|
import { useSize } from '../../hooks/size'
|
|
6
6
|
|
|
7
|
-
import { VxeRadioButtonPropTypes, VxeRadioGroupConstructor, VxeRadioButtonConstructor, VxeRadioButtonEmits, VxeRadioGroupPrivateMethods, RadioButtonMethods } from '../../../types/all'
|
|
7
|
+
import { VxeRadioButtonPropTypes, VxeRadioGroupConstructor, VxeRadioButtonConstructor, VxeRadioButtonEmits, VxeRadioGroupPrivateMethods, RadioButtonMethods, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types/all'
|
|
8
8
|
|
|
9
9
|
export default defineComponent({
|
|
10
10
|
name: 'VxeRadioButton',
|
|
@@ -23,6 +23,8 @@ export default defineComponent({
|
|
|
23
23
|
] as VxeRadioButtonEmits,
|
|
24
24
|
setup (props, context) {
|
|
25
25
|
const { slots, emit } = context
|
|
26
|
+
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeform', null)
|
|
27
|
+
const $xeformiteminfo = inject<VxeFormDefines.ProvideItemInfo | null>('$xeformiteminfo', null)
|
|
26
28
|
|
|
27
29
|
const xID = XEUtils.uniqueId()
|
|
28
30
|
|
|
@@ -69,6 +71,10 @@ export default defineComponent({
|
|
|
69
71
|
} else {
|
|
70
72
|
emit('update:modelValue', label)
|
|
71
73
|
radioButtonMethods.dispatchEvent('change', { label }, evnt)
|
|
74
|
+
// 自动更新校验状态
|
|
75
|
+
if ($xeform && $xeformiteminfo) {
|
|
76
|
+
$xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, label)
|
|
77
|
+
}
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
80
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent, h, provide, PropType } from 'vue'
|
|
1
|
+
import { defineComponent, h, provide, PropType, inject } 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
|
|
|
6
|
-
import { VxeRadioGroupPropTypes, VxeRadioGroupConstructor, VxeRadioGroupEmits, VxeRadioGroupPrivateMethods, RadioGroupPrivateMethods, RadioGroupMethods } from '../../../types/all'
|
|
6
|
+
import { VxeRadioGroupPropTypes, VxeRadioGroupConstructor, VxeRadioGroupEmits, VxeRadioGroupPrivateMethods, RadioGroupPrivateMethods, RadioGroupMethods, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types/all'
|
|
7
7
|
|
|
8
8
|
export default defineComponent({
|
|
9
9
|
name: 'VxeRadioGroup',
|
|
@@ -19,6 +19,8 @@ export default defineComponent({
|
|
|
19
19
|
] as VxeRadioGroupEmits,
|
|
20
20
|
setup (props, context) {
|
|
21
21
|
const { slots, emit } = context
|
|
22
|
+
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeform', null)
|
|
23
|
+
const $xeformiteminfo = inject<VxeFormDefines.ProvideItemInfo | null>('$xeformiteminfo', null)
|
|
22
24
|
|
|
23
25
|
const xID = XEUtils.uniqueId()
|
|
24
26
|
|
|
@@ -34,9 +36,13 @@ export default defineComponent({
|
|
|
34
36
|
useSize(props)
|
|
35
37
|
|
|
36
38
|
const radioGroupPrivateMethods: RadioGroupPrivateMethods = {
|
|
37
|
-
handleChecked (params) {
|
|
39
|
+
handleChecked (params, evnt) {
|
|
38
40
|
emit('update:modelValue', params.label)
|
|
39
41
|
radioGroupMethods.dispatchEvent('change', params)
|
|
42
|
+
// 自动更新校验状态
|
|
43
|
+
if ($xeform && $xeformiteminfo) {
|
|
44
|
+
$xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, params.label)
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
|
|
@@ -4,7 +4,7 @@ import { getFuncText } from '../../tools/utils'
|
|
|
4
4
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
5
5
|
import { useSize } from '../../hooks/size'
|
|
6
6
|
|
|
7
|
-
import { VxeRadioPropTypes, VxeRadioConstructor, VxeRadioEmits, VxeRadioGroupConstructor, VxeRadioGroupPrivateMethods, RadioMethods } from '../../../types/all'
|
|
7
|
+
import { VxeRadioPropTypes, VxeRadioConstructor, VxeRadioEmits, VxeRadioGroupConstructor, VxeRadioGroupPrivateMethods, RadioMethods, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types/all'
|
|
8
8
|
|
|
9
9
|
export default defineComponent({
|
|
10
10
|
name: 'VxeRadio',
|
|
@@ -24,6 +24,8 @@ export default defineComponent({
|
|
|
24
24
|
] as VxeRadioEmits,
|
|
25
25
|
setup (props, context) {
|
|
26
26
|
const { slots, emit } = context
|
|
27
|
+
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeform', null)
|
|
28
|
+
const $xeformiteminfo = inject<VxeFormDefines.ProvideItemInfo | null>('$xeformiteminfo', null)
|
|
27
29
|
|
|
28
30
|
const xID = XEUtils.uniqueId()
|
|
29
31
|
|
|
@@ -62,6 +64,10 @@ export default defineComponent({
|
|
|
62
64
|
} else {
|
|
63
65
|
emit('update:modelValue', label)
|
|
64
66
|
radioMethods.dispatchEvent('change', { label }, evnt)
|
|
67
|
+
// 自动更新校验状态
|
|
68
|
+
if ($xeform && $xeformiteminfo) {
|
|
69
|
+
$xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, label)
|
|
70
|
+
}
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, Teleport, PropType, ref, Ref, VNode, resolveComponent, ComponentOptions, computed, provide, onUnmounted, reactive, nextTick, watch, onMounted } from 'vue'
|
|
1
|
+
import { defineComponent, h, Teleport, PropType, ref, Ref, inject, VNode, resolveComponent, ComponentOptions, computed, provide, onUnmounted, reactive, nextTick, watch, onMounted } 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'
|
|
@@ -6,7 +6,7 @@ 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
8
|
|
|
9
|
-
import { VxeSelectPropTypes, VxeSelectConstructor, SelectReactData, VxeSelectEmits, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeInputConstructor, VxeOptgroupProps, VxeOptionProps } from '../../../types/all'
|
|
9
|
+
import { VxeSelectPropTypes, VxeSelectConstructor, SelectReactData, VxeSelectEmits, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeInputConstructor, VxeOptgroupProps, VxeOptionProps, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods } from '../../../types/all'
|
|
10
10
|
|
|
11
11
|
function isOptionVisible (option: any) {
|
|
12
12
|
return option.visible !== false
|
|
@@ -49,6 +49,8 @@ export default defineComponent({
|
|
|
49
49
|
] as VxeSelectEmits,
|
|
50
50
|
setup (props, context) {
|
|
51
51
|
const { slots, emit } = context
|
|
52
|
+
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeform', null)
|
|
53
|
+
const $xeformiteminfo = inject<VxeFormDefines.ProvideItemInfo | null>('$xeformiteminfo', null)
|
|
52
54
|
|
|
53
55
|
const xID = XEUtils.uniqueId()
|
|
54
56
|
|
|
@@ -370,6 +372,10 @@ export default defineComponent({
|
|
|
370
372
|
if (selectValue !== props.modelValue) {
|
|
371
373
|
emit('update:modelValue', selectValue)
|
|
372
374
|
selectMethods.dispatchEvent('change', { value: selectValue }, evnt)
|
|
375
|
+
// 自动更新校验状态
|
|
376
|
+
if ($xeform && $xeformiteminfo) {
|
|
377
|
+
$xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, selectValue)
|
|
378
|
+
}
|
|
373
379
|
}
|
|
374
380
|
}
|
|
375
381
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent, h, ref, Ref, computed, reactive, nextTick, createCommentVNode, PropType } from 'vue'
|
|
1
|
+
import { defineComponent, h, ref, Ref, computed, reactive, nextTick, createCommentVNode, PropType, inject } 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 { getFuncText } from '../../tools/utils'
|
|
6
6
|
|
|
7
|
-
import { VxeSwitchPropTypes, VxeSwitchConstructor, VxeSwitchEmits, SwitchReactData, SwitchMethods } from '../../../types/all'
|
|
7
|
+
import { VxeSwitchPropTypes, VxeSwitchConstructor, VxeSwitchEmits, SwitchReactData, SwitchMethods, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types/all'
|
|
8
8
|
|
|
9
9
|
export default defineComponent({
|
|
10
10
|
name: 'VxeSwitch',
|
|
@@ -27,6 +27,8 @@ export default defineComponent({
|
|
|
27
27
|
] as VxeSwitchEmits,
|
|
28
28
|
setup (props, context) {
|
|
29
29
|
const { emit } = context
|
|
30
|
+
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeform', null)
|
|
31
|
+
const $xeformiteminfo = inject<VxeFormDefines.ProvideItemInfo | null>('$xeformiteminfo', null)
|
|
30
32
|
|
|
31
33
|
const xID = XEUtils.uniqueId()
|
|
32
34
|
|
|
@@ -70,6 +72,10 @@ export default defineComponent({
|
|
|
70
72
|
reactData.hasAnimat = true
|
|
71
73
|
emit('update:modelValue', value)
|
|
72
74
|
switchMethods.dispatchEvent('change', { value }, evnt)
|
|
75
|
+
// 自动更新校验状态
|
|
76
|
+
if ($xeform && $xeformiteminfo) {
|
|
77
|
+
$xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, value)
|
|
78
|
+
}
|
|
73
79
|
_atimeout = setTimeout(() => {
|
|
74
80
|
reactData.hasAnimat = false
|
|
75
81
|
}, 400)
|
|
@@ -10,6 +10,7 @@ import { VXETable } from '../../v-x-e-table'
|
|
|
10
10
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
11
11
|
import Cell from './cell'
|
|
12
12
|
import TableBodyComponent from './body'
|
|
13
|
+
import TableHeaderComponent from '../../header'
|
|
13
14
|
import tableProps from './props'
|
|
14
15
|
import tableEmits from './emits'
|
|
15
16
|
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, restoreScrollListener, XEBodyScrollElement } from './util'
|
|
@@ -5569,7 +5570,7 @@ export default defineComponent({
|
|
|
5569
5570
|
ref: isFixedLeft ? refLeftContainer : refRightContainer,
|
|
5570
5571
|
class: `vxe-table--fixed-${fixedType}-wrapper`
|
|
5571
5572
|
}, [
|
|
5572
|
-
showHeader ? h(
|
|
5573
|
+
showHeader ? h(TableHeaderComponent, {
|
|
5573
5574
|
ref: isFixedLeft ? refTableLeftHeader : refTableRightHeader,
|
|
5574
5575
|
fixedType,
|
|
5575
5576
|
tableData,
|
|
@@ -5963,7 +5964,7 @@ export default defineComponent({
|
|
|
5963
5964
|
/**
|
|
5964
5965
|
* 表头
|
|
5965
5966
|
*/
|
|
5966
|
-
showHeader ? h(
|
|
5967
|
+
showHeader ? h(TableHeaderComponent, {
|
|
5967
5968
|
ref: refTableHeader,
|
|
5968
5969
|
tableData,
|
|
5969
5970
|
tableColumn,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent, h, ref, Ref, computed, nextTick, watch, PropType, reactive } from 'vue'
|
|
1
|
+
import { defineComponent, h, ref, Ref, computed, nextTick, watch, PropType, reactive, inject } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
4
4
|
import { getFuncText } from '../../tools/utils'
|
|
5
5
|
import { useSize } from '../../hooks/size'
|
|
6
6
|
|
|
7
|
-
import { VxeTextareaPropTypes, TextareaReactData, TextareaMethods, VxeTextareaConstructor, VxeTextareaEmits, TextareaPrivateRef } from '../../../types/all'
|
|
7
|
+
import { VxeTextareaPropTypes, TextareaReactData, TextareaMethods, VxeTextareaConstructor, VxeTextareaEmits, TextareaPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types/all'
|
|
8
8
|
|
|
9
9
|
let autoTxtElem: HTMLDivElement
|
|
10
10
|
|
|
@@ -40,6 +40,8 @@ export default defineComponent({
|
|
|
40
40
|
] as VxeTextareaEmits,
|
|
41
41
|
setup (props, context) {
|
|
42
42
|
const { emit } = context
|
|
43
|
+
const $xeform = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeform', null)
|
|
44
|
+
const $xeformiteminfo = inject<VxeFormDefines.ProvideItemInfo | null>('$xeformiteminfo', null)
|
|
43
45
|
|
|
44
46
|
const xID = XEUtils.uniqueId()
|
|
45
47
|
|
|
@@ -136,6 +138,10 @@ export default defineComponent({
|
|
|
136
138
|
emit('update:modelValue', value)
|
|
137
139
|
if (XEUtils.toValueString(props.modelValue) !== value) {
|
|
138
140
|
textareaMethods.dispatchEvent('change', { value }, evnt)
|
|
141
|
+
// 自动更新校验状态
|
|
142
|
+
if ($xeform && $xeformiteminfo) {
|
|
143
|
+
$xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, value)
|
|
144
|
+
}
|
|
139
145
|
}
|
|
140
146
|
}
|
|
141
147
|
|
|
@@ -314,7 +314,7 @@ const validatorHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
314
314
|
}
|
|
315
315
|
} else {
|
|
316
316
|
const isArrType = type === 'array'
|
|
317
|
-
const hasEmpty = isArrType ? (!XEUtils.isArray(cellValue) || !cellValue.length) : eqEmptyValue(cellValue)
|
|
317
|
+
const hasEmpty = isArrType || XEUtils.isArray(cellValue) ? (!XEUtils.isArray(cellValue) || !cellValue.length) : eqEmptyValue(cellValue)
|
|
318
318
|
if (required ? (hasEmpty || validErrorRuleValue(rule, cellValue)) : (!hasEmpty && validErrorRuleValue(rule, cellValue))) {
|
|
319
319
|
validRuleErr = true
|
|
320
320
|
errorRules.push(new Rule(rule))
|
package/styles/button.scss
CHANGED
|
@@ -272,11 +272,6 @@ $btnThemeList: (
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
.vxe-button--loading-icon,
|
|
275
|
-
.vxe-button--icon,
|
|
276
|
-
.vxe-button--content {
|
|
277
|
-
vertical-align: middle;
|
|
278
|
-
}
|
|
279
|
-
.vxe-button--loading-icon,
|
|
280
275
|
.vxe-button--icon {
|
|
281
276
|
min-width: $vxe-font-size;
|
|
282
277
|
&+.vxe-button--content {
|
package/styles/form.scss
CHANGED
|
@@ -106,22 +106,9 @@
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
.vxe-form--item-title-content {
|
|
113
|
-
&:before {
|
|
114
|
-
content: "*";
|
|
115
|
-
color: $vxe-form-validate-error-color;
|
|
116
|
-
font-family: Verdana,Arial,Tahoma;
|
|
117
|
-
margin-right: 0.2em;
|
|
118
|
-
font-weight: normal;
|
|
119
|
-
vertical-align: middle;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.vxe-form--item {
|
|
125
112
|
&.is--colon {
|
|
126
113
|
.vxe-form--item-title-postfix {
|
|
127
114
|
&:after {
|
|
@@ -131,9 +118,20 @@
|
|
|
131
118
|
}
|
|
132
119
|
}
|
|
133
120
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
.vxe-form--item {
|
|
121
|
+
&.is--asterisk {
|
|
122
|
+
&.is--required {
|
|
123
|
+
.vxe-form--item-title-content {
|
|
124
|
+
&:before {
|
|
125
|
+
content: "*";
|
|
126
|
+
color: $vxe-form-validate-error-color;
|
|
127
|
+
font-family: Verdana,Arial,Tahoma;
|
|
128
|
+
margin-right: 0.2em;
|
|
129
|
+
font-weight: normal;
|
|
130
|
+
vertical-align: middle;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
137
135
|
&.is--span {
|
|
138
136
|
.vxe-default-input:not([type="submit"]):not([type="reset"]),
|
|
139
137
|
.vxe-default-textarea,
|