jaykou25 / react-admin-kit Goto Github PK
View Code? Open in Web Editor NEW快速构建表单和表格的 React 组件库, 无需再使用 Antd Form
Home Page: https://jaykou25.github.io/react-admin-kit/
License: MIT License
快速构建表单和表格的 React 组件库, 无需再使用 Antd Form
Home Page: https://jaykou25.github.io/react-admin-kit/
License: MIT License
我有一个修改密码的表单, 通过 SchemaForm 组件生成表单, 表单有 '新密码' 和 '确认密码' 两个表单项, '确认密码' 的表单项需要设置检验, 确保其值与 '新密码' 的值相同.
通过 valueType: dependency 和 validator 方法能够实现这个校验的需求.
但是我希望在 onBlur 的时候触发校验, 我在 rules 里设置了 validateTrigger: "onBlur"
不生效. 下面是代码:
[
{
title: "新密码",
dataIndex: "newPassword",
valueType: "password",
required: true,
fieldProps: {
autoComplete: "new-password",
},
},
{
valueType: "dependency",
name: ["newPassword"],
columns: ({ newPassword }) => {
return [
{
title: "确认密码",
dataIndex: "confirmPassword",
valueType: "password",
fieldProps: {
autoComplete: "off",
},
formItemProps: {
rules: [
{
required: true,
validateTrigger: "onBlur",
message: "密码不一致",
validator(rule, value) {
if (value !== newPassword) {
return Promise.reject();
}
return Promise.resolve();
},
},
],
},
},
];
},
},
];
希望新增属性来控制 message, 因为按钮文字有可能是 关闭
, 成功后的提醒需要是 关闭成功
正常 ProTable 在弹窗里编辑表单时, 表单默认带有 confirmOnClose 功能, 即关闭弹窗时, 如果表单项发生了改动会弹出确认框.
但是当 ProTable 处在 Drawer 等原本就已经有遮罩层的容器里时, confirmOnClose 的弹出框会有 zIndex 问题, 即被其它遮罩层遮住.
比如:
{
title: '用户',
dataIndex: 'user,userName',
valueType: 'select',
fieldProps: {
labelInValue: true
}
}
formRef.current.getFieldsValue
应该得到 { user: 1, userName: 'jack' }
实际得到 { user,userName: { value: 1, label: 'jack' } }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.