mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
29 lines
993 B
TypeScript
29 lines
993 B
TypeScript
import { observer, useForm } from '@formily/react';
|
|
import { useCollectionManager, useCompile } from '@nocobase/client';
|
|
import { Select } from 'antd';
|
|
import React from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
export const DateFieldsSelect: React.FC<any> = observer(
|
|
(props) => {
|
|
const { t } = useTranslation();
|
|
const compile = useCompile();
|
|
const { getCollectionFields } = useCollectionManager();
|
|
const { values } = useForm();
|
|
const fields = getCollectionFields(values?.collection);
|
|
|
|
return (
|
|
<Select dropdownMatchSelectWidth={false} placeholder={t('Select field')} {...props}>
|
|
{fields
|
|
.filter((field) => !field.hidden && (field.uiSchema ? field.type === 'date' : false))
|
|
.map((field) => (
|
|
<Select.Option key={field.name} value={field.name}>
|
|
{compile(field.uiSchema?.title)}
|
|
</Select.Option>
|
|
))}
|
|
</Select>
|
|
);
|
|
},
|
|
{ displayName: 'DateFieldsSelect' },
|
|
);
|