diff --git a/package.json b/package.json index c2000d280..225715823 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table", - "version": "3.6.14", + "version": "3.6.15", "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器等...", "scripts": { "update": "npm install --legacy-peer-deps", diff --git a/packages/form/src/form.js b/packages/form/src/form.js index 4e4bddb69..0576b42f8 100644 --- a/packages/form/src/form.js +++ b/packages/form/src/form.js @@ -468,7 +468,15 @@ export default { } } else { const isArrType = type === 'array' - const hasEmpty = isArrType || XEUtils.isArray(itemValue) ? (!XEUtils.isArray(itemValue) || !itemValue.length) : eqEmptyValue(itemValue) + const isArrVal = XEUtils.isArray(itemValue) + let hasEmpty = true + if (isArrType || isArrVal) { + hasEmpty = !isArrVal || !itemValue.length + } else if (XEUtils.isString(itemValue)) { + hasEmpty = eqEmptyValue(itemValue.trim()) + } else { + hasEmpty = eqEmptyValue(itemValue) + } if (required ? (hasEmpty || validErrorRuleValue(rule, itemValue)) : (!hasEmpty && validErrorRuleValue(rule, itemValue))) { errorRules.push(new Rule(rule)) } diff --git a/packages/validator/src/mixin.js b/packages/validator/src/mixin.js index e85d1b803..7ae48ab1b 100644 --- a/packages/validator/src/mixin.js +++ b/packages/validator/src/mixin.js @@ -278,7 +278,15 @@ export default { } } else { const isArrType = type === 'array' - const hasEmpty = isArrType || XEUtils.isArray(cellValue) ? (!XEUtils.isArray(cellValue) || !cellValue.length) : eqEmptyValue(cellValue) + const isArrVal = XEUtils.isArray(cellValue) + let hasEmpty = true + if (isArrType || isArrVal) { + hasEmpty = !isArrVal || !cellValue.length + } else if (XEUtils.isString(cellValue)) { + hasEmpty = eqEmptyValue(cellValue.trim()) + } else { + hasEmpty = eqEmptyValue(cellValue) + } if (required ? (hasEmpty || validErrorRuleValue(rule, cellValue)) : (!hasEmpty && validErrorRuleValue(rule, cellValue))) { this.validRuleErr = true errorRules.push(new Rule(rule)) diff --git a/styles/form.scss b/styles/form.scss index 36c2f263c..e870f05c8 100644 --- a/styles/form.scss +++ b/styles/form.scss @@ -226,7 +226,7 @@ } .vxe-default-input[type="submit"], .vxe-default-input[type="reset"] { - line-height: calc($vxe-button-height-default - 2px); + line-height: $vxe-button-height-default - 2px; background-color: #fff; cursor: pointer; &:hover { @@ -284,7 +284,7 @@ } .vxe-default-input[type="submit"], .vxe-default-input[type="reset"] { - line-height: calc($vxe-button-height-medium - 2px); + line-height: $vxe-button-height-medium - 2px; } .vxe-default-input, .vxe-default-input, @@ -299,7 +299,7 @@ } .vxe-default-input[type="submit"], .vxe-default-input[type="reset"] { - line-height: calc($vxe-button-height-small - 2px); + line-height: $vxe-button-height-small - 2px; } .vxe-default-input, .vxe-default-input, @@ -314,7 +314,7 @@ } .vxe-default-input[type="submit"], .vxe-default-input[type="reset"] { - line-height: calc($vxe-button-height-mini - 2px); + line-height: $vxe-button-height-mini - 2px; } .vxe-default-input, .vxe-default-input, diff --git a/styles/input.scss b/styles/input.scss index 18b1a12ef..de688c2d8 100644 --- a/styles/input.scss +++ b/styles/input.scss @@ -819,7 +819,7 @@ $iconWidth: 1.6em; } .vxe-input--date-picker-body table, .vxe-input--time-picker-body { - height: calc(nth($timeWeekRowHeightList, $sizeIndex) * 6 + nth($titleRowHeightList, $sizeIndex)); + height: nth($timeWeekRowHeightList, $sizeIndex) * 6 + nth($titleRowHeightList, $sizeIndex); } .vxe-input--time-picker-body { $ulWidthList: 48px, 48px, 44px, 42px; @@ -839,7 +839,7 @@ $iconWidth: 1.6em; left: nth($ulWidthList, $sizeIndex); } .vxe-input--time-picker-second-list { - left: calc(nth($ulWidthList, $sizeIndex) * 2); + left: nth($ulWidthList, $sizeIndex) * 2; } } .vxe-input--date-day-view, @@ -870,7 +870,7 @@ $iconWidth: 1.6em; padding: 0 10px - $sizeIndex; } .vxe-input--date-label { - line-height: calc(nth($fontSizeList, $sizeIndex) + 1px); + line-height: nth($fontSizeList, $sizeIndex) + 1px; } } diff --git a/styles/radio.scss b/styles/radio.scss index 72879752b..b23554e0d 100644 --- a/styles/radio.scss +++ b/styles/radio.scss @@ -74,7 +74,7 @@ } .vxe-radio--label { padding: 0 1em; - line-height: calc($vxe-button-height-default - 2px); + line-height: $vxe-button-height-default - 2px; display: inline-block; border-style: solid; border-color: $vxe-input-border-color; @@ -119,17 +119,17 @@ } &.size--medium { .vxe-radio--label { - line-height: calc($vxe-button-height-medium - 2px); + line-height: $vxe-button-height-medium - 2px; } } &.size--small { .vxe-radio--label { - line-height: calc($vxe-button-height-small - 2px); + line-height: $vxe-button-height-small - 2px; } } &.size--mini { .vxe-radio--label { - line-height: calc($vxe-button-height-mini - 2px); + line-height: $vxe-button-height-mini - 2px; } } } diff --git a/styles/table.scss b/styles/table.scss index b810840ff..b7553b50a 100644 --- a/styles/table.scss +++ b/styles/table.scss @@ -1282,7 +1282,7 @@ } } .vxe-textarea { - height: calc($vxe-table-row-line-height - 1px); + height: $vxe-table-row-line-height - 1px; .vxe-textarea--inner { border: 0; } diff --git a/types/v-x-e-table/renderer.d.ts b/types/v-x-e-table/renderer.d.ts index 9a9b26dfa..438baad95 100644 --- a/types/v-x-e-table/renderer.d.ts +++ b/types/v-x-e-table/renderer.d.ts @@ -59,7 +59,9 @@ export interface RendererMapOptions { renderExpand?(h: CreateElement, renderOpts: ColumnContentRenderOptions, params: ColumnCellRenderParams | ColumnEditRenderParams): SlotVNodeType | SlotVNodeType[]; // 工具栏-按钮渲染 + toolbarButtonClassName?: string | ((params: ToolbarButtonRenderParams) => string | VNodeClassName) renderToolbarButton?(h: CreateElement, renderOpts: ToolbarButtonRenderOptions, params: ToolbarButtonRenderParams): SlotVNodeType | SlotVNodeType[]; + toolbarToolClassName?: string | ((params: ToolbarToolRenderParams) => string | VNodeClassName) renderToolbarTool?(h: CreateElement, renderOpts: ToolbarToolRenderOptions, params: ToolbarToolRenderParams): SlotVNodeType | SlotVNodeType[]; // 表单-项渲染