mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
feat: gantt block code improve
This commit is contained in:
parent
f19ab3603b
commit
d9b47d3816
@ -123,6 +123,7 @@ const formatData = (data = [], fieldNames) => {
|
|||||||
name: v[fieldNames.title],
|
name: v[fieldNames.title],
|
||||||
id: v.id + '',
|
id: v.id + '',
|
||||||
type: 'task',
|
type: 'task',
|
||||||
|
progress:10,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return tasks;
|
return tasks;
|
||||||
|
@ -1,88 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { SchemaInitializer } from '../SchemaInitializer';
|
|
||||||
import {
|
|
||||||
itemsMerge,
|
|
||||||
useAssociatedTableColumnInitializerFields,
|
|
||||||
useTableColumnInitializerFields,
|
|
||||||
useInheritsTableColumnInitializerFields,
|
|
||||||
} from '../utils';
|
|
||||||
import { useCompile } from '../../schema-component';
|
|
||||||
|
|
||||||
// 甘特图表格列配置
|
|
||||||
export const GanttColumnInitializers = (props: any) => {
|
|
||||||
const { items = [] } = props;
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const associatedFields = useAssociatedTableColumnInitializerFields();
|
|
||||||
const inheritFields = useInheritsTableColumnInitializerFields();
|
|
||||||
const compile = useCompile();
|
|
||||||
const fieldItems: any[] = [
|
|
||||||
{
|
|
||||||
type: 'itemGroup',
|
|
||||||
title: t('Display fields'),
|
|
||||||
children: useTableColumnInitializerFields(),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
if (inheritFields?.length > 0) {
|
|
||||||
inheritFields.forEach((inherit) => {
|
|
||||||
Object.values(inherit)[0].length &&
|
|
||||||
fieldItems.push(
|
|
||||||
{
|
|
||||||
type: 'divider',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'itemGroup',
|
|
||||||
title: t(`Parent collection fields`) + '(' + compile(`${Object.keys(inherit)[0]}`) + ')',
|
|
||||||
children: Object.values(inherit)[0],
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (associatedFields?.length > 0) {
|
|
||||||
fieldItems.push(
|
|
||||||
{
|
|
||||||
type: 'divider',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'itemGroup',
|
|
||||||
title: t('Display association fields'),
|
|
||||||
children: associatedFields,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
fieldItems.push(
|
|
||||||
{
|
|
||||||
type: 'divider',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'item',
|
|
||||||
title: t('Action column'),
|
|
||||||
component: 'TableActionColumnInitializer',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<SchemaInitializer.Button
|
|
||||||
insertPosition={'beforeEnd'}
|
|
||||||
icon={'SettingOutlined'}
|
|
||||||
wrap={(s) => {
|
|
||||||
if (s['x-action-column']) {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'TableV2.Column.Decorator',
|
|
||||||
'x-designer': 'TableV2.Column.Designer',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
properties: {
|
|
||||||
[s.name]: {
|
|
||||||
...s,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
items={itemsMerge(fieldItems, items)}
|
|
||||||
>
|
|
||||||
{t('Configure columns')}
|
|
||||||
</SchemaInitializer.Button>
|
|
||||||
);
|
|
||||||
};
|
|
@ -19,7 +19,6 @@ export * from './TableActionInitializers';
|
|||||||
export * from './TableColumnInitializers';
|
export * from './TableColumnInitializers';
|
||||||
export * from './TableSelectorInitializers';
|
export * from './TableSelectorInitializers';
|
||||||
export * from './TabPaneInitializers';
|
export * from './TabPaneInitializers';
|
||||||
export * from './GanttColumnInitializers'
|
|
||||||
export * from './GanttActionInitializers'
|
export * from './GanttActionInitializers'
|
||||||
// association filter
|
// association filter
|
||||||
export * from '../../schema-component/antd/association-filter/AssociationFilter';
|
export * from '../../schema-component/antd/association-filter/AssociationFilter';
|
||||||
|
@ -1038,30 +1038,6 @@ export const createGanttBlockSchema = (options) => {
|
|||||||
'x-designer': 'Gantt.Designer',
|
'x-designer': 'Gantt.Designer',
|
||||||
'x-component': 'CardItem',
|
'x-component': 'CardItem',
|
||||||
properties: {
|
properties: {
|
||||||
// [uid()]: {
|
|
||||||
// type: 'array',
|
|
||||||
// 'x-decorator': 'GantTableBlockProvider',
|
|
||||||
// 'x-decorator-props': {
|
|
||||||
// style: {
|
|
||||||
// display: 'inline-block',
|
|
||||||
// maxWidth: '30%',
|
|
||||||
// width: '100%',
|
|
||||||
// verticalAlign: 'top',
|
|
||||||
// marginTop: '55px'
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
|
|
||||||
// 'x-initializer': 'GanttColumnInitializers',
|
|
||||||
// 'x-component': 'TableV2',
|
|
||||||
// 'x-component-props': {
|
|
||||||
// rowKey: 'id',
|
|
||||||
// rowSelection: {
|
|
||||||
// type: 'checkbox',
|
|
||||||
// },
|
|
||||||
// useProps: '{{ useTableBlockProps }}',
|
|
||||||
// pagination: false,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
[uid()]: {
|
[uid()]: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-component': 'Gantt',
|
'x-component': 'Gantt',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user