| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- import { useIntl } from "react-intl";
- import {
- ProForm,
- ProFormSelect,
- ProFormText,
- ProFormTextArea,
- } from "@ant-design/pro-components";
- import LangSelect from "../general/LangSelect";
- import { DefaultOptionType } from "antd/lib/select";
- interface IWidget {
- meaningList?: string[];
- channelList?: DefaultOptionType[];
- }
- const Widget = ({ meaningList, channelList }: IWidget) => {
- const intl = useIntl();
- return (
- <>
- <ProForm.Group>
- <ProFormText
- width="md"
- name="word"
- required
- label={intl.formatMessage({
- id: "term.fields.word.label",
- })}
- rules={[
- {
- required: true,
- message: intl.formatMessage({
- id: "term.message.meaning.required",
- }),
- },
- ]}
- fieldProps={{
- showCount: true,
- maxLength: 128,
- }}
- />
- <ProFormText
- width="md"
- name="tag"
- tooltip={intl.formatMessage({
- id: "term.fields.description.tooltip",
- })}
- label={intl.formatMessage({
- id: "term.fields.description.label",
- })}
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormText
- width="md"
- name="meaning"
- tooltip={intl.formatMessage({
- id: "term.fields.meaning.tooltip",
- })}
- label={intl.formatMessage({
- id: "forms.fields.meaning.label",
- })}
- rules={[
- {
- required: true,
- message: intl.formatMessage({
- id: "forms.message.meaning.required",
- }),
- },
- ]}
- fieldProps={{
- showCount: true,
- maxLength: 128,
- }}
- />
- <ProFormSelect
- width="md"
- name="meaning2"
- label={intl.formatMessage({
- id: "term.fields.meaning2.label",
- })}
- options={meaningList}
- fieldProps={{
- mode: "tags",
- tokenSeparators: [",", ","],
- }}
- placeholder="Please select other meanings"
- rules={[
- {
- type: "array",
- },
- ]}
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormText
- width="md"
- name="channel"
- tooltip={intl.formatMessage({
- id: "term.fields.channel.tooltip",
- })}
- label={intl.formatMessage({
- id: "term.fields.channel.label",
- })}
- />
- <LangSelect />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormTextArea
- name="note"
- width="xl"
- label={intl.formatMessage({
- id: "forms.fields.note.label",
- })}
- />
- </ProForm.Group>
- </>
- );
- };
- export default Widget;
|