1
0
mirror of synced 2025-12-11 08:38:08 +08:00

fix 修复显示多个校验消息提示无效问题

This commit is contained in:
xuliangzhan
2024-04-30 10:52:13 +08:00
parent 13ca20f86a
commit 138562efe8
12 changed files with 88 additions and 21 deletions

View File

@@ -59,6 +59,7 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
* [x] Merged footer items * [x] Merged footer items
* [x] Import/Export/Print * [x] Import/Export/Print
* [x] Show/Hide column * [x] Show/Hide column
* [x] Drag and drop/Customize column sorting
* [x] Loading * [x] Loading
* [x] Formatted cell * [x] Formatted cell
* [x] Slot - template * [x] Slot - template

View File

@@ -60,6 +60,7 @@
* [x] 合并表尾 * [x] 合并表尾
* [x] 导入/导出/打印 * [x] 导入/导出/打印
* [x] 显示/隐藏列 * [x] 显示/隐藏列
* [x] 拖拽/自定义列排序
* [x] 加载中 * [x] 加载中
* [x] 格式化内容 * [x] 格式化内容
* [x] 自定义插槽 - 模板 * [x] 自定义插槽 - 模板

View File

@@ -59,6 +59,7 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
* [x] 合併錶尾 * [x] 合併錶尾
* [x] 導入/匯出/列印 * [x] 導入/匯出/列印
* [x] 顯示/隱藏列 * [x] 顯示/隱藏列
* [x] 拖拽/自定義列排序
* [x] 加載中 * [x] 加載中
* [x] 格式化內容 * [x] 格式化內容
* [x] 自定義插槽 - 範本 * [x] 自定義插槽 - 範本

View File

@@ -1040,7 +1040,7 @@
"description": "严格模式,选中后不能取消" "description": "严格模式,选中后不能取消"
}, },
"vxe-radio-group/options": { "vxe-radio-group/options": {
"type": "{ value, label }[]", "type": "{ value, label, disabled }[]",
"description": "选项列表" "description": "选项列表"
}, },
"vxe-radio-group/option-props": { "vxe-radio-group/option-props": {
@@ -1120,7 +1120,7 @@
"description": "是否禁用" "description": "是否禁用"
}, },
"vxe-checkbox-group/options": { "vxe-checkbox-group/options": {
"type": "{ value, label }[]", "type": "{ value, label, disabled }[]",
"description": "选项列表" "description": "选项列表"
}, },
"vxe-checkbox-group/option-props": { "vxe-checkbox-group/option-props": {
@@ -1437,7 +1437,7 @@
}, },
"vxe-button/mode": { "vxe-button/mode": {
"type": "string", "type": "string",
"description": "模式" "description": "按钮模式,支持文本和按钮"
}, },
"vxe-button/title": { "vxe-button/title": {
"type": "string", "type": "string",
@@ -1445,7 +1445,7 @@
}, },
"vxe-button/type": { "vxe-button/type": {
"type": "string", "type": "string",
"description": "类型" "description": "原生按钮类型"
}, },
"vxe-button/size": { "vxe-button/size": {
"type": "string", "type": "string",
@@ -1501,12 +1501,16 @@
}, },
"vxe-button-group/mode": { "vxe-button-group/mode": {
"type": "string", "type": "string",
"description": "模式" "description": "按钮模式,支持文本和按钮"
}, },
"vxe-button-group/size": { "vxe-button-group/size": {
"type": "string", "type": "string",
"description": "尺寸" "description": "尺寸"
}, },
"vxe-button-group/status": {
"type": "string",
"description": "按钮的图标"
},
"vxe-button-group/round": { "vxe-button-group/round": {
"type": "boolean", "type": "boolean",
"description": "圆角边框" "description": "圆角边框"

View File

@@ -490,6 +490,7 @@
"attributes": [ "attributes": [
"mode", "mode",
"size", "size",
"status",
"round", "round",
"circle", "circle",
"disabled", "disabled",

View File

@@ -1,6 +1,6 @@
{ {
"name": "vxe-table", "name": "vxe-table",
"version": "4.6.7-beta.2", "version": "4.6.7",
"description": "一个基于 vue 的 PC 端表单/表格组件支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式...", "description": "一个基于 vue 的 PC 端表单/表格组件支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式...",
"scripts": { "scripts": {
"update": "npm install --legacy-peer-deps", "update": "npm install --legacy-peer-deps",

View File

@@ -129,7 +129,43 @@ export default defineComponent({
const computeBtnMode = computed(() => { const computeBtnMode = computed(() => {
const { type, mode } = props const { type, mode } = props
return (mode === 'text' || type === 'text') ? 'text' : 'button' if (mode === 'text' || type === 'text' || ($xebuttonggroup && $xebuttonggroup.props.mode === 'text')) {
return 'text'
}
return 'button'
})
const computeBtnStatus = computed(() => {
const { status } = props
if (status) {
return status
}
if ($xebuttonggroup) {
return $xebuttonggroup.props.status
}
return ''
})
const computeBtnRound = computed(() => {
const { round } = props
if (round) {
return round
}
if ($xebuttonggroup) {
return $xebuttonggroup.props.round
}
return false
})
const computeBtnCircle = computed(() => {
const { circle } = props
if (circle) {
return circle
}
if ($xebuttonggroup) {
return $xebuttonggroup.props.circle
}
return false
}) })
const updateZindex = () => { const updateZindex = () => {
@@ -394,10 +430,13 @@ export default defineComponent({
}) })
const renderVN = () => { const renderVN = () => {
const { className, popupClassName, transfer, title, type, round, circle, destroyOnClose, status, name, disabled, loading } = props const { className, popupClassName, transfer, title, type, destroyOnClose, name, disabled, loading } = props
const { inited, showPanel } = reactData const { inited, showPanel } = reactData
const isFormBtn = computeIsFormBtn.value const isFormBtn = computeIsFormBtn.value
const btnMode = computeBtnMode.value const btnMode = computeBtnMode.value
const btnStatus = computeBtnStatus.value
const btnRound = computeBtnRound.value
const btnCircle = computeBtnCircle.value
const vSize = computeSize.value const vSize = computeSize.value
if (slots.dropdowns) { if (slots.dropdowns) {
return h('div', { return h('div', {
@@ -411,9 +450,9 @@ export default defineComponent({
ref: refButton, ref: refButton,
class: ['vxe-button', `type--${btnMode}`, { class: ['vxe-button', `type--${btnMode}`, {
[`size--${vSize}`]: vSize, [`size--${vSize}`]: vSize,
[`theme--${status}`]: status, [`theme--${btnStatus}`]: btnStatus,
'is--round': round, 'is--round': btnRound,
'is--circle': circle, 'is--circle': btnCircle,
'is--disabled': disabled || loading, 'is--disabled': disabled || loading,
'is--loading': loading 'is--loading': loading
}], }],
@@ -458,9 +497,9 @@ export default defineComponent({
ref: refButton, ref: refButton,
class: ['vxe-button', `type--${btnMode}`, className ? (XEUtils.isFunction(className) ? className({ $button: $xebutton }) : className) : '', { class: ['vxe-button', `type--${btnMode}`, className ? (XEUtils.isFunction(className) ? className({ $button: $xebutton }) : className) : '', {
[`size--${vSize}`]: vSize, [`size--${vSize}`]: vSize,
[`theme--${status}`]: status, [`theme--${btnStatus}`]: btnStatus,
'is--round': round, 'is--round': btnRound,
'is--circle': circle, 'is--circle': btnCircle,
'is--disabled': disabled || loading, 'is--disabled': disabled || loading,
'is--loading': loading 'is--loading': loading
}], }],

View File

@@ -10,6 +10,11 @@ export default defineComponent({
name: 'VxeButtonGroup', name: 'VxeButtonGroup',
props: { props: {
options: Array as PropType<VxeButtonGroupPropTypes.Options>, options: Array as PropType<VxeButtonGroupPropTypes.Options>,
mode: String as PropType<VxeButtonGroupPropTypes.Mode>,
status: String as PropType<VxeButtonGroupPropTypes.Status>,
round: Boolean as PropType<VxeButtonGroupPropTypes.Round>,
circle: Boolean as PropType<VxeButtonGroupPropTypes.Circle>,
className: [String, Function] as PropType<VxeButtonGroupPropTypes.ClassName>,
disabled: Boolean as PropType<VxeButtonGroupPropTypes.Disabled>, disabled: Boolean as PropType<VxeButtonGroupPropTypes.Disabled>,
size: { type: String as PropType<VxeButtonGroupPropTypes.Size>, default: () => GlobalConfig.buttonGroup.size || GlobalConfig.size } size: { type: String as PropType<VxeButtonGroupPropTypes.Size>, default: () => GlobalConfig.buttonGroup.size || GlobalConfig.size }
}, },
@@ -51,10 +56,10 @@ export default defineComponent({
Object.assign($xebuttongroup, buttonGroupMethods, buttonGroupPrivateMethods) Object.assign($xebuttongroup, buttonGroupMethods, buttonGroupPrivateMethods)
const renderVN = () => { const renderVN = () => {
const { options } = props const { className, options } = props
const defaultSlot = slots.default const defaultSlot = slots.default
return h('div', { return h('div', {
class: 'vxe-button-group' class: ['vxe-button-group', className ? (XEUtils.isFunction(className) ? className({ $buttonGroup: $xebuttongroup }) : className) : '']
}, defaultSlot ? defaultSlot({}) : (options ? options.map((item, index) => { }, defaultSlot ? defaultSlot({}) : (options ? options.map((item, index) => {
return h(VxeButtonComponent, { return h(VxeButtonComponent, {
key: index, key: index,

View File

@@ -1,5 +1,4 @@
import { defineComponent, h, createApp, reactive } from 'vue' import { defineComponent, h, createApp, resolveComponent, reactive, ComponentOptions } from 'vue'
import VxeModalComponent from '../modal'
import { VxeModalDefines } from '../../types/all' import { VxeModalDefines } from '../../types/all'
@@ -18,7 +17,7 @@ const VxeDynamics = defineComponent({
const { modals } = dynamicStore const { modals } = dynamicStore
return h('div', { return h('div', {
class: 'vxe-dynamics--modal' class: 'vxe-dynamics--modal'
}, modals.map((item) => h(VxeModalComponent, item))) }, modals.map((item) => h(resolveComponent('vxe-modal') as ComponentOptions, item)))
} }
} }
}) })

View File

@@ -712,7 +712,7 @@ export default defineComponent({
* @param {String/Object} code 字符串或对象 * @param {String/Object} code 字符串或对象
*/ */
commitProxy (proxyTarget: string | VxeToolbarPropTypes.ButtonConfig, ...args: any[]) { commitProxy (proxyTarget: string | VxeToolbarPropTypes.ButtonConfig, ...args: any[]) {
const { toolbarConfig, pagerConfig, editRules } = props const { toolbarConfig, pagerConfig, editRules, validConfig } = props
const { tablePage, formData } = reactData const { tablePage, formData } = reactData
const isMsg = computeIsMsg.value const isMsg = computeIsMsg.value
const proxyOpts = computeProxyOpts.value const proxyOpts = computeProxyOpts.value
@@ -940,7 +940,7 @@ export default defineComponent({
let restPromise: Promise<any> = Promise.resolve() let restPromise: Promise<any> = Promise.resolve()
if (editRules) { if (editRules) {
// 只校验新增和修改的数据 // 只校验新增和修改的数据
restPromise = $xetable.validate(body.insertRecords.concat(updateRecords)) restPromise = $xetable[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords))
} }
return restPromise.then((errMap) => { return restPromise.then((errMap) => {
if (errMap) { if (errMap) {

View File

@@ -26,16 +26,26 @@ export interface VxeButtonGroupConstructor extends VxeComponentBase, VxeButtonGr
export type VxeButtonGroupProps = { export type VxeButtonGroupProps = {
size?: VxeButtonGroupPropTypes.Size size?: VxeButtonGroupPropTypes.Size
options?: VxeButtonGroupPropTypes.Options options?: VxeButtonGroupPropTypes.Options
mode?: VxeButtonGroupPropTypes.Mode
status?: VxeButtonGroupPropTypes.Status
round?: VxeButtonGroupPropTypes.Round
circle?: VxeButtonGroupPropTypes.Circle
/** /**
* 是否禁用 * 是否禁用
*/ */
disabled?: VxeButtonGroupPropTypes.Disabled disabled?: VxeButtonGroupPropTypes.Disabled
className?: VxeButtonGroupPropTypes.ClassName
} }
export namespace VxeButtonGroupPropTypes { export namespace VxeButtonGroupPropTypes {
export type Size = SizeType export type Size = SizeType
export type Options = VxeButtonProps[] export type Options = VxeButtonProps[]
export type Round = boolean
export type Circle = boolean
export type Disabled = boolean export type Disabled = boolean
export type Mode = VxeButtonPropTypes.Mode
export type Status = VxeButtonPropTypes.Status
export type ClassName = string | ((params: { $buttonGroup: VxeButtonGroupConstructor }) => string)
} }
export interface ButtonPrivateComputed { export interface ButtonPrivateComputed {

6
types/table.d.ts vendored
View File

@@ -1968,6 +1968,12 @@ export namespace VxeTablePropTypes {
* 用于 mouse-config.area & column.type=checkbox|radio开启空格键切换复选框或单选框状态功能 * 用于 mouse-config.area & column.type=checkbox|radio开启空格键切换复选框或单选框状态功能
*/ */
isChecked?: boolean isChecked?: boolean
/**
* 用于 mouse-config.area方向键光标锁开启后将支持两种状态
* 非聚焦式输入状态:默认情况下,可以按方向键移动单元格。
* 聚焦式输入状态:如果需要移动光标,可以按 F2 键或者鼠标左键点击输入框,切换为聚焦输入状态,就可以用方向键左右移动光标
*/
arrowCursorLock?: boolean
/** /**
* 用于 mouse-config.area是否将回车键行为改成 Tab 键行为 * 用于 mouse-config.area是否将回车键行为改成 Tab 键行为
*/ */