From b6cfa5cc26925555c5c895063d7f51f8e33c2b59 Mon Sep 17 00:00:00 2001 From: lizhensheng Date: Thu, 31 Aug 2023 15:26:07 +0800 Subject: [PATCH] [chore]: Expand character limit for name field in forms --- src/page/AuditPlan/PlanForm/index.tsx | 2 +- src/page/DataSource/DataSourceForm/index.tsx | 2 +- .../RuleTemplateForm/BaseInfoForm/index.tsx | 2 +- src/page/RuleTemplate/RuleTemplateForm/BaseInfoForm/index.tsx | 2 +- src/page/UserCenter/Role/Modal/RoleForm/index.tsx | 2 +- src/page/UserCenter/User/Modal/UserForm/index.tsx | 2 +- .../UserGroup/Modal/UserGroupForm/UserGroupForm.tsx | 2 +- src/utils/FormRule.ts | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/page/AuditPlan/PlanForm/index.tsx b/src/page/AuditPlan/PlanForm/index.tsx index e4552cf3..39afdc36 100644 --- a/src/page/AuditPlan/PlanForm/index.tsx +++ b/src/page/AuditPlan/PlanForm/index.tsx @@ -113,7 +113,7 @@ const PlanForm: React.FC = ({ form, ...props }) => { { required: true, }, - ...nameRule(), + ...nameRule(119), ]} > = (props) => { name="name" validateFirst={true} rules={[ + ...nameRule(119), { required: true, message: t('common.form.rule.require', { name: t('dataSource.dataSourceForm.name'), }), }, - ...nameRule(), ]} > = (props) => { ]; if (!isUpdate) { - nameFormRule.push(...nameRule()); + nameFormRule.push(...nameRule(119)); } return ( diff --git a/src/page/RuleTemplate/RuleTemplateForm/BaseInfoForm/index.tsx b/src/page/RuleTemplate/RuleTemplateForm/BaseInfoForm/index.tsx index 1d23d288..0ce43792 100644 --- a/src/page/RuleTemplate/RuleTemplateForm/BaseInfoForm/index.tsx +++ b/src/page/RuleTemplate/RuleTemplateForm/BaseInfoForm/index.tsx @@ -34,7 +34,7 @@ const BaseInfoForm: React.FC = (props) => { ]; if (!isUpdate) { - rule.push(...nameRule()); + rule.push(...nameRule(119)); } return rule; }, [isUpdate]); diff --git a/src/page/UserCenter/Role/Modal/RoleForm/index.tsx b/src/page/UserCenter/Role/Modal/RoleForm/index.tsx index bc3590c9..6a1000c9 100644 --- a/src/page/UserCenter/Role/Modal/RoleForm/index.tsx +++ b/src/page/UserCenter/Role/Modal/RoleForm/index.tsx @@ -22,7 +22,7 @@ const RoleForm: React.FC = (props) => { name: t('role.roleForm.roleName'), }), }, - ...nameRule(), + ...nameRule(119), ]} > = (props) => { if (props.isUpdate) { return baseRules; } - return [...baseRules, ...nameRule()]; + return [...baseRules, ...nameRule(119)]; }; return ( diff --git a/src/page/UserCenter/UserGroup/Modal/UserGroupForm/UserGroupForm.tsx b/src/page/UserCenter/UserGroup/Modal/UserGroupForm/UserGroupForm.tsx index 14a45c13..5dcbe68c 100644 --- a/src/page/UserCenter/UserGroup/Modal/UserGroupForm/UserGroupForm.tsx +++ b/src/page/UserCenter/UserGroup/Modal/UserGroupForm/UserGroupForm.tsx @@ -19,7 +19,7 @@ const UserGroupForm: React.FC = (props) => { { required: true, }, - ...nameRule(), + ...nameRule(119), ]} > { +export const nameRule = (max = 59): Rule[] => { return [ { validator: nameRuleValidator(), }, { - max: 59, + max, }, ]; };