Skip to content

Commit

Permalink
releases 4.7.58
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Jul 22, 2024
1 parent 0c81d70 commit 63ad5da
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 25 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
32 changes: 19 additions & 13 deletions packages/grid/src/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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' })
}
Expand All @@ -258,9 +263,9 @@ export default defineComponent({
}

const handleDeleteRow = (code: string, alertKey: string, callback: () => void): Promise<void> => {
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) => {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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' })
}
Expand All @@ -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' })
}
Expand All @@ -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' })
}
Expand Down Expand Up @@ -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' })
}
Expand All @@ -975,15 +981,15 @@ 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' })
}
}
return { status: false }
})
} else {
if (isMsg) {
if (isActiveMsg) {
if (VxeUI.modal) {
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.dataUnchanged'), status: 'info' })
}
Expand Down
13 changes: 10 additions & 3 deletions packages/table/module/edit/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
},
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/table/module/export/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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({
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ VxeUI.setConfig({
proxyConfig: {
enabled: true,
autoLoad: true,
message: true,
showResponseMsg: true,
showActiveMsg: true,
props: {
list: null,
result: 'result',
Expand Down
5 changes: 1 addition & 4 deletions styles/components/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 63ad5da

Please sign in to comment.