tachybase_todo/packages/plugins/@tachybase/plugin-gantt/src/client/utils.tsx
sealday ede7ead8b1 chore(version): release v0.21.34 (#1045)
Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1045
2024-05-24 01:06:06 +08:00

21 lines
555 B
TypeScript

import { useCollection_deprecated, useCompile } from '@tachybase/client';
import { useTranslation } from 'react-i18next';
export const useGanttTranslation = () => {
return useTranslation('gantt');
};
export const useOptions = (type = 'string') => {
const compile = useCompile();
const { fields } = useCollection_deprecated();
const options = fields
?.filter((field) => field.type === type)
?.map((field) => {
return {
value: field.name,
label: compile(field?.uiSchema?.title),
};
});
return options;
};