From 63ad5da8000e8bb4a89517176f7f78991aa8ae4a Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Mon, 22 Jul 2024 19:12:36 +0800 Subject: [PATCH] releases 4.7.58 --- package.json | 4 ++-- packages/grid/src/grid.ts | 32 +++++++++++++++++----------- packages/table/module/edit/hook.ts | 13 ++++++++--- packages/table/module/export/hook.ts | 4 ++-- packages/ui/index.ts | 3 ++- styles/components/table.scss | 5 +---- 6 files changed, 36 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 60d04ff249..ef8485bf09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table", - "version": "4.7.57", + "version": "4.7.58", "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...", "scripts": { "update": "npm install --legacy-peer-deps", @@ -28,7 +28,7 @@ "style": "lib/style.css", "typings": "types/index.d.ts", "dependencies": { - "vxe-pc-ui": "^4.0.78" + "vxe-pc-ui": "^4.0.79" }, "devDependencies": { "@types/resize-observer-browser": "^0.1.11", diff --git a/packages/grid/src/grid.ts b/packages/grid/src/grid.ts index 99608b5324..a9ec10ee32 100644 --- a/packages/grid/src/grid.ts +++ b/packages/grid/src/grid.ts @@ -116,9 +116,14 @@ export default defineComponent({ return Object.assign({}, getConfig().grid.proxyConfig, props.proxyConfig) as VxeGridPropTypes.ProxyConfig }) - const computeIsMsg = computed(() => { + const computeIsRespMsg = computed(() => { const proxyOpts = computeProxyOpts.value - return proxyOpts.message !== false + return XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg + }) + + const computeIsActiveMsg = computed(() => { + const proxyOpts = computeProxyOpts.value + return proxyOpts.showActiveMsg }) const computePagerOpts = computed(() => { @@ -231,14 +236,14 @@ export default defineComponent({ } const triggerPendingEvent = (code: string) => { - const isMsg = computeIsMsg.value + const isActiveMsg = computeIsActiveMsg.value const $xeTable = refTable.value const selectRecords = $xeTable.getCheckboxRecords() if (selectRecords.length) { $xeTable.togglePendingRow(selectRecords) gridExtendTableMethods.clearCheckboxRow() } else { - if (isMsg) { + if (isActiveMsg) { if (VxeUI.modal) { VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.selectOneRecord'), status: 'warning' }) } @@ -258,9 +263,9 @@ export default defineComponent({ } const handleDeleteRow = (code: string, alertKey: string, callback: () => void): Promise => { - const isMsg = computeIsMsg.value + const isActiveMsg = computeIsActiveMsg.value const selectRecords = gridExtendTableMethods.getCheckboxRecords() - if (isMsg) { + if (isActiveMsg) { if (selectRecords.length) { if (VxeUI.modal) { return VxeUI.modal.confirm({ id: `cfm_${code}`, content: getI18n(alertKey), escClosable: true }).then((type) => { @@ -729,7 +734,8 @@ export default defineComponent({ commitProxy (proxyTarget: string | VxeToolbarPropTypes.ButtonConfig, ...args: any[]) { const { toolbarConfig, pagerConfig, editRules, validConfig } = props const { tablePage, formData } = reactData - const isMsg = computeIsMsg.value + const isActiveMsg = computeIsActiveMsg.value + const isRespMsg = computeIsRespMsg.value const proxyOpts = computeProxyOpts.value const pagerOpts = computePagerOpts.value const toolbarOpts = computeToolbarOpts.value @@ -894,7 +900,7 @@ export default defineComponent({ .then(rest => { reactData.tableLoading = false $xeTable.setPendingRow(removeRecords, false) - if (isMsg) { + if (isRespMsg) { if (VxeUI.modal) { VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' }) } @@ -908,7 +914,7 @@ export default defineComponent({ }) .catch(rest => { reactData.tableLoading = false - if (isMsg) { + if (isRespMsg) { if (VxeUI.modal) { VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' }) } @@ -917,7 +923,7 @@ export default defineComponent({ }) }) } else { - if (isMsg) { + if (isActiveMsg) { if (VxeUI.modal) { VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.selectOneRecord'), status: 'warning' }) } @@ -961,7 +967,7 @@ export default defineComponent({ .then(rest => { reactData.tableLoading = false $xeTable.clearPendingRow() - if (isMsg) { + if (isRespMsg) { if (VxeUI.modal) { VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' }) } @@ -975,7 +981,7 @@ export default defineComponent({ }) .catch(rest => { reactData.tableLoading = false - if (isMsg) { + if (isRespMsg) { if (VxeUI.modal) { VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' }) } @@ -983,7 +989,7 @@ export default defineComponent({ return { status: false } }) } else { - if (isMsg) { + if (isActiveMsg) { if (VxeUI.modal) { VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.dataUnchanged'), status: 'info' }) } diff --git a/packages/table/module/edit/hook.ts b/packages/table/module/edit/hook.ts index bd3cba9c23..86bca55a25 100644 --- a/packages/table/module/edit/hook.ts +++ b/packages/table/module/edit/hook.ts @@ -428,11 +428,18 @@ hooks.add('tableEditModule', { * 获取表格数据集,包含新增、删除、修改、标记 */ getRecordset () { + const removeRecords = editMethods.getRemoveRecords() + const pendingRecords = $xeTable.getPendingRecords() + const delRecords = removeRecords.concat(pendingRecords) + // 如果已经被删除,则无需放到更新数组 + const updateRecords = editMethods.getUpdateRecords().filter(row => { + return !delRecords.some(item => $xeTable.eqRow(item, row)) + }) return { insertRecords: editMethods.getInsertRecords(), - removeRecords: editMethods.getRemoveRecords(), - updateRecords: editMethods.getUpdateRecords(), - pendingRecords: $xeTable.getPendingRecords() + removeRecords, + updateRecords, + pendingRecords } }, /** diff --git a/packages/table/module/export/hook.ts b/packages/table/module/export/hook.ts index b510f3229b..b2228b5c0d 100644 --- a/packages/table/module/export/hook.ts +++ b/packages/table/module/export/hook.ts @@ -6,7 +6,7 @@ import { parseFile, formatText } from '../../../ui/src/utils' import { createHtmlPage, getExportBlobByContent } from './util' import { warnLog, errLog } from '../../../ui/src/log' -import type { VxeGridConstructor, VxeGridPrivateMethods, TableExportMethods } from '../../../../types' +import type { VxeGridConstructor, VxeGridPrivateMethods, TableExportMethods, VxeGridPropTypes } from '../../../../types' const { getI18n, hooks, renderer } = VxeUI @@ -944,7 +944,7 @@ hooks.add('tableExportModule', { const hasTree = treeConfig const customOpts = computeCustomOpts.value const selectRecords = $xeTable.getCheckboxRecords() - const proxyOpts = $xeGrid ? $xeGrid.getComputeMaps().computeProxyOpts.value : {} + const proxyOpts = $xeGrid ? $xeGrid.getComputeMaps().computeProxyOpts.value : {} as VxeGridPropTypes.ProxyOpts const hasFooter = !!footerTableData.length const hasMerge = !hasTree && mergeList.length const defOpts = Object.assign({ diff --git a/packages/ui/index.ts b/packages/ui/index.ts index 3adf02ef44..7a0080b456 100644 --- a/packages/ui/index.ts +++ b/packages/ui/index.ts @@ -180,7 +180,8 @@ VxeUI.setConfig({ proxyConfig: { enabled: true, autoLoad: true, - message: true, + showResponseMsg: true, + showActiveMsg: true, props: { list: null, result: 'result', diff --git a/styles/components/table.scss b/styles/components/table.scss index e798dc13f6..3ed89f3093 100644 --- a/styles/components/table.scss +++ b/styles/components/table.scss @@ -1278,11 +1278,8 @@ border-color: var(--vxe-ui-table-validate-error-color); } .vxe-input { - > .vxe-input--inner { - border-color: var(--vxe-ui-table-validate-error-color); - } + border-color: var(--vxe-ui-table-validate-error-color); } - } } &.valid-msg--single {