mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
feat(form): table 增加 beforeAddRow 钩子函数校验是否可增加行
This commit is contained in:
parent
7c90b9339d
commit
2dcef449bf
@ -325,6 +325,15 @@ const newHandler = async (row?: any) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof props.config.beforeAddRow === 'function') {
|
||||
const beforeCheckRes = props.config.beforeAddRow(mForm, {
|
||||
model: props.model[modelName.value],
|
||||
formValue: mForm?.values,
|
||||
prop: props.prop,
|
||||
});
|
||||
if (!beforeCheckRes) return;
|
||||
}
|
||||
|
||||
const columns = props.config.items;
|
||||
const enumValues = props.config.enum || [];
|
||||
let enumV = [];
|
||||
|
@ -669,6 +669,8 @@ export interface TableConfig extends FormItem {
|
||||
fixed?: boolean;
|
||||
itemExtra?: string | FilterFunction<string>;
|
||||
rowKey?: string;
|
||||
/** table 新增行时前置回调 */
|
||||
beforeAddRow?: (mForm: FormState | undefined, data: any) => boolean;
|
||||
}
|
||||
|
||||
export interface GroupListConfig extends FormItem {
|
||||
|
Loading…
x
Reference in New Issue
Block a user