Skip to content

Commit

Permalink
Merge pull request #310 from actiontech/feature/issue-1733
Browse files Browse the repository at this point in the history
[chore]: Expand character limit for name field in forms
  • Loading branch information
Rain-1214 authored Aug 31, 2023
2 parents 39bbc2a + b6cfa5c commit e86632d
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/page/AuditPlan/PlanForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const PlanForm: React.FC<PlanFormProps> = ({ form, ...props }) => {
{
required: true,
},
...nameRule(),
...nameRule(119),
]}
>
<Input
Expand Down
2 changes: 1 addition & 1 deletion src/page/DataSource/DataSourceForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ const DataSourceForm: React.FC<IDataSourceFormProps> = (props) => {
name="name"
validateFirst={true}
rules={[
...nameRule(119),
{
required: true,
message: t('common.form.rule.require', {
name: t('dataSource.dataSourceForm.name'),
}),
},
...nameRule(),
]}
>
<Input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const BaseInfoForm: React.FC<RuleTemplateBaseInfoFormProps> = (props) => {
];

if (!isUpdate) {
nameFormRule.push(...nameRule());
nameFormRule.push(...nameRule(119));
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const BaseInfoForm: React.FC<RuleTemplateBaseInfoFormProps> = (props) => {
];

if (!isUpdate) {
rule.push(...nameRule());
rule.push(...nameRule(119));
}
return rule;
}, [isUpdate]);
Expand Down
2 changes: 1 addition & 1 deletion src/page/UserCenter/Role/Modal/RoleForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const RoleForm: React.FC<IRoleFormProps> = (props) => {
name: t('role.roleForm.roleName'),
}),
},
...nameRule(),
...nameRule(119),
]}
>
<Input
Expand Down
2 changes: 1 addition & 1 deletion src/page/UserCenter/User/Modal/UserForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const UserForm: React.FC<IUserFormProps> = (props) => {
if (props.isUpdate) {
return baseRules;
}
return [...baseRules, ...nameRule()];
return [...baseRules, ...nameRule(119)];
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const UserGroupForm: React.FC<UserGroupFormProps> = (props) => {
{
required: true,
},
...nameRule(),
...nameRule(119),
]}
>
<Input
Expand Down
4 changes: 2 additions & 2 deletions src/utils/FormRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { Rule } from 'rc-field-form/lib/interface';
import { t } from '../locale';
import { FormValidatorRule } from '../types/common.type';

export const nameRule = (): Rule[] => {
export const nameRule = (max = 59): Rule[] => {
return [
{
validator: nameRuleValidator(),
},
{
max: 59,
max,
},
];
};
Expand Down

0 comments on commit e86632d

Please sign in to comment.