mirror of
https://gitee.com/xuliangzhan_admin/vxe-table.git
synced 2026-01-21 05:27:57 +08:00
增加参数 showClose、增加插槽 prefix
This commit is contained in:
@@ -288,7 +288,26 @@ const apis = [
|
||||
type: '',
|
||||
enum: '',
|
||||
defVal: '',
|
||||
list: []
|
||||
list: [
|
||||
{
|
||||
name: 'prefix',
|
||||
desc: '前缀图标模板',
|
||||
version: '',
|
||||
type: '',
|
||||
enum: '',
|
||||
defVal: '',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
name: 'suffix',
|
||||
desc: '后缀图标模板',
|
||||
version: '',
|
||||
type: '',
|
||||
enum: '',
|
||||
defVal: '',
|
||||
list: []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Events',
|
||||
|
||||
@@ -197,6 +197,15 @@ const apis = [
|
||||
defVal: 'false',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
name: 'show-close',
|
||||
desc: '是否显示关闭按钮',
|
||||
version: '4.0.14',
|
||||
type: 'Boolean',
|
||||
enum: '',
|
||||
defVal: 'true',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
name: 'resize',
|
||||
descKey: 'app.api.modal.desc.resize',
|
||||
|
||||
@@ -178,7 +178,17 @@ const apis = [
|
||||
type: '',
|
||||
enum: '',
|
||||
defVal: '',
|
||||
list: []
|
||||
list: [
|
||||
{
|
||||
name: 'prefix',
|
||||
desc: '前缀图标模板',
|
||||
version: '4.0.14',
|
||||
type: '',
|
||||
enum: '',
|
||||
defVal: '',
|
||||
list: []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Events',
|
||||
|
||||
@@ -320,7 +320,7 @@ export default {
|
||||
v2: '2.0+ (vue 2.6+ Old) ~ 2021-12 Stop',
|
||||
v3: '3.0+ (vue 2.6+ Stable)',
|
||||
v3d5: '3.5+ (vue 2.6+ Sticky)',
|
||||
v4: '4.0+ (vue 3.0+ next)',
|
||||
v4: '4.0+ (vue 3.0+ Latest)',
|
||||
v4d5: '4.5+ (vue 3.0+ Sticky)',
|
||||
plan: {
|
||||
v1: 'v1 Based on vue2.6+, Support for all major browsers',
|
||||
|
||||
@@ -319,7 +319,7 @@ export default {
|
||||
v2: '2.0+ (vue 2.6+ 旧版本) ~ 2021-12 停止更新',
|
||||
v3: '3.0+ (vue 2.6+ 稳定版)',
|
||||
v3d5: '3.5+ (vue 2.6+ 粘性表格)',
|
||||
v4: '4.0+ (vue 3.0+ next)',
|
||||
v4: '4.0+ (vue 3.0+ 最新版)',
|
||||
v4d5: '4.5+ (vue 3.0+ 粘性表格)',
|
||||
plan: {
|
||||
v1: 'v1 基于 vue2.6+,支持所有主流的浏览器,实现表格的一切实用的功能',
|
||||
|
||||
@@ -319,7 +319,7 @@ export default {
|
||||
v2: '2.0+ (vue 2.6+ 旧版本) ~ 2021-12 停止更新',
|
||||
v3: '3.0+ (vue 2.6+ 稳定版)',
|
||||
v3d5: '3.5+ (vue 2.6+ 粘性表格)',
|
||||
v4: '4.0+ (vue 3.0+ next)',
|
||||
v4: '4.0+ (vue 3.0+ 最新版)',
|
||||
v4d5: '4.5+ (vue 3.0+ 粘性表格)',
|
||||
plan: {
|
||||
v1: 'v1 基於 vue2.6+,支持所有主流的瀏覽器,實現表格的一切實用的功能',
|
||||
|
||||
@@ -120,13 +120,13 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
const saveEvent2 = async (row: any, field?: string) => {
|
||||
const saveEvent2 = async (row: any) => {
|
||||
const $table = xTable.value
|
||||
if ($table.isUpdateByRow(row)) {
|
||||
row.loading = true
|
||||
const data = await submitSave(row)
|
||||
// 局部保存,并更新本地数据
|
||||
await $table.reloadRow(row, data, field)
|
||||
await $table.reloadRow(row, data)
|
||||
VXETable.modal.message({ content: '保存成功!', status: 'success' })
|
||||
row.loading = false
|
||||
} else {
|
||||
@@ -268,13 +268,13 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
const saveEvent2 = async (row: any, field?: string) => {
|
||||
const saveEvent2 = async (row: any) => {
|
||||
const $table = xTable.value
|
||||
if ($table.isUpdateByRow(row)) {
|
||||
row.loading = true
|
||||
const data = await submitSave(row)
|
||||
// 局部保存,并更新本地数据
|
||||
await $table.reloadRow(row, data, field)
|
||||
await $table.reloadRow(row, data)
|
||||
VXETable.modal.message({ content: '保存成功!', status: 'success' })
|
||||
row.loading = false
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vxe-table",
|
||||
"version": "4.0.13",
|
||||
"version": "4.0.14",
|
||||
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟滚动、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、虚拟列表、模态窗口、自定义模板、渲染器、贼灵活的配置项、扩展接口等...",
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
@@ -78,8 +78,8 @@
|
||||
"vue-i18n": "^9.0.0",
|
||||
"vue-router": "^4.0.4",
|
||||
"vuex": "^4.0.0",
|
||||
"vxe-table-plugin-antd": "^3.0.2",
|
||||
"vxe-table-plugin-element": "^3.0.2",
|
||||
"vxe-table-plugin-antd": "^3.0.3",
|
||||
"vxe-table-plugin-element": "^3.0.3",
|
||||
"vxe-table-plugin-export-pdf": "^3.0.2",
|
||||
"vxe-table-plugin-export-xlsx": "^3.0.2",
|
||||
"vxe-table-plugin-menus": "^3.0.1",
|
||||
@@ -87,7 +87,7 @@
|
||||
"vxe-table-plugin-shortcut-key": "^3.0.1",
|
||||
"xe-ajax": "^4.0.5",
|
||||
"xe-clipboard": "^1.10.1",
|
||||
"xe-utils": "^3.1.14",
|
||||
"xe-utils": "^3.2.0",
|
||||
"xlsx": "^0.16.9"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -48,7 +48,7 @@ const validErrorRuleValue = (rule: VxeFormDefines.FormRule, val: any) => {
|
||||
}
|
||||
// 如果存在 pattern,正则校验
|
||||
if (pattern) {
|
||||
return (XEUtils.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)
|
||||
return !(XEUtils.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1896,12 +1896,13 @@ export default defineComponent({
|
||||
|
||||
const rendePrefixIcon = () => {
|
||||
const { prefixIcon } = props
|
||||
const prefixSlot = slots.prefix
|
||||
const icons = []
|
||||
if (slots.prefix) {
|
||||
if (prefixSlot) {
|
||||
icons.push(
|
||||
h('span', {
|
||||
class: 'vxe-input--prefix-icon'
|
||||
}, slots.prefix({}))
|
||||
}, prefixSlot({}))
|
||||
)
|
||||
} else if (prefixIcon) {
|
||||
icons.push(
|
||||
@@ -1919,13 +1920,14 @@ export default defineComponent({
|
||||
const renderSuffixIcon = () => {
|
||||
const { disabled, suffixIcon } = props
|
||||
const { inputValue } = reactData
|
||||
const suffixSlot = slots.suffix
|
||||
const isClearable = computeIsClearable.value
|
||||
const icons = []
|
||||
if (slots.suffix) {
|
||||
if (suffixSlot) {
|
||||
icons.push(
|
||||
h('span', {
|
||||
class: 'vxe-input--suffix-icon'
|
||||
}, slots.suffix({}))
|
||||
}, suffixSlot({}))
|
||||
)
|
||||
} else if (suffixIcon) {
|
||||
icons.push(
|
||||
|
||||
@@ -39,6 +39,7 @@ export default defineComponent({
|
||||
showHeader: { type: Boolean as PropType<VxeModalPropTypes.ShowHeader>, default: () => GlobalConfig.modal.showHeader },
|
||||
showFooter: { type: Boolean as PropType<VxeModalPropTypes.ShowFooter>, default: () => GlobalConfig.modal.showFooter },
|
||||
showZoom: Boolean as PropType<VxeModalPropTypes.ShowZoom>,
|
||||
showClose: { type: Boolean as PropType<VxeModalPropTypes.ShowClose>, default: () => GlobalConfig.modal.showClose },
|
||||
dblclickZoom: { type: Boolean as PropType<VxeModalPropTypes.DblclickZoom>, default: () => GlobalConfig.modal.dblclickZoom },
|
||||
width: [Number, String] as PropType<VxeModalPropTypes.Width>,
|
||||
height: [Number, String] as PropType<VxeModalPropTypes.Height>,
|
||||
@@ -669,7 +670,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const renderTitles = () => {
|
||||
const { slots: propSlots = {}, showZoom, title } = props
|
||||
const { slots: propSlots = {}, showClose, showZoom, title } = props
|
||||
const { zoomLocat } = reactData
|
||||
const titleSlot = slots.title || propSlots.title
|
||||
const titVNs: VNode[] = titleSlot ? titleSlot({ $modal: $xemodal }) as VNode[] : [
|
||||
@@ -686,13 +687,15 @@ export default defineComponent({
|
||||
})
|
||||
)
|
||||
}
|
||||
titVNs.push(
|
||||
h('i', {
|
||||
class: ['vxe-modal--close-btn', 'trigger--btn', GlobalConfig.icon.MODAL_CLOSE],
|
||||
title: GlobalConfig.i18n('vxe.modal.close'),
|
||||
onClick: closeEvent
|
||||
})
|
||||
)
|
||||
if (showClose) {
|
||||
titVNs.push(
|
||||
h('i', {
|
||||
class: ['vxe-modal--close-btn', 'trigger--btn', GlobalConfig.icon.MODAL_CLOSE],
|
||||
title: GlobalConfig.i18n('vxe.modal.close'),
|
||||
onClick: closeEvent
|
||||
})
|
||||
)
|
||||
}
|
||||
return titVNs
|
||||
}
|
||||
|
||||
|
||||
@@ -733,6 +733,7 @@ export default defineComponent({
|
||||
const { inited, isActivated, visiblePanel } = reactData
|
||||
const vSize = computeSize.value
|
||||
const selectLabel = computeSelectLabel.value
|
||||
const prefixSlot = slots.prefix
|
||||
return h('div', {
|
||||
ref: refElem,
|
||||
class: ['vxe-select', className ? (XEUtils.isFunction(className) ? className({ $select: $xeselect }) : className) : '', {
|
||||
@@ -761,7 +762,9 @@ export default defineComponent({
|
||||
onFocus: focusEvent,
|
||||
onBlur: blurEvent,
|
||||
onSuffixClick: togglePanelEvent
|
||||
}),
|
||||
}, prefixSlot ? {
|
||||
prefix: () => prefixSlot({})
|
||||
} : {}),
|
||||
h(Teleport, {
|
||||
to: 'body',
|
||||
disabled: transfer ? !inited : true
|
||||
|
||||
@@ -732,7 +732,7 @@ export default defineComponent({
|
||||
rowspan = XEUtils.toNumber(rowspan) || 1
|
||||
colspan = XEUtils.toNumber(colspan) || 1
|
||||
if (rowspan > 1 || colspan > 1) {
|
||||
const mcIndex = XEUtils.findIndexOf(mList, item => item._row === row && item._col === col)
|
||||
const mcIndex = XEUtils.findIndexOf(mList, item => (item._row === row || getRowid($xetable, item._row) === getRowid($xetable, row)) && (item._col.id === col || item._col.id === col.id))
|
||||
const mergeItem = mList[mcIndex]
|
||||
if (mergeItem) {
|
||||
mergeItem.rowspan = rowspan
|
||||
@@ -741,7 +741,7 @@ export default defineComponent({
|
||||
mergeItem._colspan = colspan
|
||||
} else {
|
||||
const mergeRowIndex = rowList ? $xetable.findRowIndexOf(rowList, row) : row
|
||||
const mergeColIndex = visibleColumn.indexOf(col)
|
||||
const mergeColIndex = tableMethods.getVTColumnIndex(col)
|
||||
mList.push({
|
||||
row: mergeRowIndex,
|
||||
col: mergeColIndex,
|
||||
@@ -778,7 +778,7 @@ export default defineComponent({
|
||||
if (XEUtils.isNumber(col)) {
|
||||
col = visibleColumn[col]
|
||||
}
|
||||
const mcIndex = XEUtils.findIndexOf(mList, item => item._row === row && item._col === col)
|
||||
const mcIndex = XEUtils.findIndexOf(mList, item => (item._row === row || getRowid($xetable, item._row) === getRowid($xetable, row)) && (item._col.id === col || item._col.id === col.id))
|
||||
if (mcIndex > -1) {
|
||||
const rItems = mList.splice(mcIndex, 1)
|
||||
rest.push(rItems[0])
|
||||
|
||||
@@ -308,6 +308,7 @@ const GlobalConfig: VXETableGlobalConfig = {
|
||||
dblclickZoom: true,
|
||||
showTitleOverflow: true,
|
||||
animat: true,
|
||||
showClose: true,
|
||||
// storage: false,
|
||||
storageKey: 'VXE_MODAL_POSITION'
|
||||
},
|
||||
|
||||
@@ -243,7 +243,7 @@ const validatorHook: VxeGlobalHooksHandles.HookOptions = {
|
||||
}
|
||||
// 如果存在 pattern,正则校验
|
||||
if (pattern) {
|
||||
return (XEUtils.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)
|
||||
return !(XEUtils.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -27,11 +27,17 @@
|
||||
<div>1.将代码示例放到以下任意一个在线链接中,运行起来(点击 fork,确保能复现问题,最后点击保存,将链接发群里即可)</div>
|
||||
<div style="color:red">(注:提供可复现问题简化demo即可,不需要提供其他无关的代码)</div>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://codesandbox.io/s/vxe-table-wentiyanshi-forked-54v2j" target="_blank">v4 codesandbox(支持jsx)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://jsrun.net/K5IKp/edit" target="_blank">v4 jsrun</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://codesandbox.io/s/vxe-table-wentiyanshi-forked-54v2j" target="_blank">v4 codesandbox(支持jsx)</a>
|
||||
<a href="https://jsrun.net/CT3Kp/edit" target="_blank">v4 jsrun(集成 element-plus)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://jsrun.net/nT3Kp/edit" target="_blank">v4 jsrun(集成 ant-design-vue)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://jsfiddle.net/9qoghkbj/" target="_blank">v4 jsfiddle</a>
|
||||
@@ -39,6 +45,9 @@
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://codesandbox.io/s/vue-template-916h0" target="_blank">v3 codesandbox(支持jsx)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://jsrun.pro/vIyKp/edit" target="_blank">v3 jsrun</a>
|
||||
</li>
|
||||
@@ -51,9 +60,6 @@
|
||||
<li>
|
||||
<a href="https://jsrun.net/pRLKp/edit" target="_blank">v3 jsrun(集成 ant-design-vue)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://codesandbox.io/s/vue-template-916h0" target="_blank">v3 codesandbox(支持jsx)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://jsfiddle.net/qsmtja6x/" target="_blank">v3 jsfiddle</a>
|
||||
</li>
|
||||
|
||||
2
types/modal.d.ts
vendored
2
types/modal.d.ts
vendored
@@ -133,6 +133,7 @@ export namespace VxeModalPropTypes {
|
||||
export type ShowHeader = boolean;
|
||||
export type ShowFooter = boolean;
|
||||
export type ShowZoom = boolean;
|
||||
export type ShowClose = boolean;
|
||||
export type DblclickZoom = boolean;
|
||||
export type Width = number | string;
|
||||
export type Height = number | string;
|
||||
@@ -182,6 +183,7 @@ export type VxeModalProps = {
|
||||
showHeader?: VxeModalPropTypes.ShowHeader;
|
||||
showFooter?: VxeModalPropTypes.ShowFooter;
|
||||
showZoom?: VxeModalPropTypes.ShowZoom;
|
||||
showClose?: VxeModalPropTypes.ShowClose;
|
||||
dblclickZoom?: VxeModalPropTypes.DblclickZoom;
|
||||
width?: VxeModalPropTypes.Width;
|
||||
height?: VxeModalPropTypes.Height;
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = {
|
||||
entry: 'examples/main.ts',
|
||||
template: 'public/index.html',
|
||||
filename: 'index.html',
|
||||
title: 'vxe-table 4.0+ (Next)'
|
||||
title: 'vxe-table 4.0+ (Latest)'
|
||||
}
|
||||
},
|
||||
transpileDependencies: ['highlight.js'],
|
||||
|
||||
Reference in New Issue
Block a user