-
Notifications
You must be signed in to change notification settings - Fork 635
Expand file tree
/
Copy pathheaderForm.tsx
More file actions
66 lines (61 loc) · 2.01 KB
/
headerForm.tsx
File metadata and controls
66 lines (61 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { Input, Tooltip, Select } from 'antd';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.less';
import { FormComponentProps } from '@ant-design/compatible/lib/form';
import React, { Fragment } from 'react';
import locales from '@/common/locales';
import { VisibilityType } from './interface';
const { Option } = Select;
const HeaderForm: React.FC<FormComponentProps> = ({ form: { getFieldDecorator } }) => {
return (
<Fragment>
<Form.Item>
<Tooltip
trigger={['focus']}
title={locales.format({
id: 'backend.services.memos.headerForm.tag',
defaultMessage: 'Input tags (eg. tag1, tag2...)'
})}
placement="topLeft"
overlayClassName="numeric-input"
>
{getFieldDecorator('tags', {
rules: [
{
pattern: /^(?! )[^\u4e00-\u9fa5~`!@#$%^&*()_+={}\[\]:;"'<>.?\/\\|]*[^\s.,;:!?"'()]*$/,
message: locales.format({
id: 'backend.services.memos.headerForm.tag_error',
}),
},
],
})(
<Input
autoComplete="off"
placeholder={locales.format({
id: 'backend.services.memos.headerForm.tag',
defaultMessage: 'Input tags (eg. tag1, tag2...)'
})}
/>
)}
</Tooltip>
</Form.Item>
<Form.Item label={locales.format({
id: 'backend.services.memos.headerForm.visibility',
defaultMessage: 'visibility'
})}>
{getFieldDecorator('visibility', {
initialValue: VisibilityType[0].value,
})(
<Select style={{ width: '100%' }}>
{VisibilityType.map(option => (
<Option key={option.value} value={option.value}>
{option.label()}
</Option>
))}
</Select>
)}
</Form.Item>
</Fragment>
);
};
export default HeaderForm;