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

[chore]: Expand character limit for name field in forms #310

Merged
merged 1 commit into from
Aug 31, 2023
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
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