Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(grid): [grid] validate successful add return value in promise sense #2851

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions examples/sites/demos/apis/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2490,24 +2490,12 @@ export default {
defaultValue: '',
desc: {
'zh-CN':
'表格校验函数,如果指定 row 或 rows 则校验指定一行或多行,否则校验整个表格。该回调函数会在校验结束后被调用,并传入两个参数:(是否校验成功,最近一列未通过校验的字段)。若不传入回调函数,则会返回一个 promise',
'表格校验函数,如果指定 row 或 rows 则校验指定一行或多行,否则校验整个表格。该回调函数会在校验结束后被调用,并传入两个参数:(是否校验成功,最近一列未通过校验的字段)。若不传入回调函数,则会返回一个 promise, 校验成功返回 true (3.22.0新增),校验失败返回错误信息对象',
'en-US':
'Table verification function. If a row or rows is specified, the specified row or multiple rows are verified. Otherwise, the entire table is verified. This callback function is called after the verification is complete and the following parameters are transferred: (Whether the verification is successful. The fields in the latest column fail the verification.) If no callback function is passed in, a promise is returned'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'grid-validation#validation-before-submit-validation'
},
{
name: 'validate(rows, callback)',
type: '',
defaultValue: '',
desc: {
'zh-CN':
'表格校验函数,如果指定 row 或 rows 则校验指定一行或多行,否则校验整个表格。该回调函数会在校验结束后被调用,并传入两个参数:(是否校验成功,最近一列未通过校验的字段)。若不传入回调函数,则会返回一个 promise',
'en-US': ''
},
mode: ['mobile-first'],
mfDemo: ''
}
],
slots: [
Expand Down
1 change: 1 addition & 0 deletions packages/vue/src/grid/src/validator/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export default {
}

cb && cb(opt.status)
return opt.status

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the return value of opt.status is correctly handled by the calling function, as this change introduces a return statement that may affect the function's behavior.

}
return Promise.all(rowValids).then(onFulfilled).catch(onRejected(opt, this))
},
Expand Down
Loading