feat: gantt block congiure fields

This commit is contained in:
katherinehhh 2023-01-17 16:10:15 +08:00
parent 34aec221bb
commit 5f35a24899
2 changed files with 65 additions and 64 deletions

View File

@ -186,6 +186,7 @@ export const Gantt: any = (props) => {
onSelect,
onExpanderClick,
} = props;
const fieldSchema = useFieldSchema();
const { fieldNames, dataSource } = useProps(props);
const { range: viewMode } = fieldNames;
const tasks = formatData(dataSource, fieldNames) || [];
@ -214,7 +215,7 @@ export const Gantt: any = (props) => {
const [scrollY, setScrollY] = useState(0);
const [scrollX, setScrollX] = useState(-1);
const [ignoreScrollEvent, setIgnoreScrollEvent] = useState(false);
console.log(fieldSchema)
// task change events
useEffect(() => {
let filteredTasks: Task[];
@ -536,29 +537,7 @@ export const Gantt: any = (props) => {
// TaskListTable,
// };
const tableSchema = {
type: 'array',
'x-decorator': 'div',
'x-decorator-props': {
style: {
display: 'inline-block',
maxWidth: '30%',
},
},
'x-initializer': 'TableColumnInitializers',
'x-uid':'gant_table',
'x-component': 'TableV2',
'x-component-props': {
rowKey: 'id',
rowSelection: {
type: 'checkbox',
},
useProps: '{{ useTableBlockProps }}',
pagination: false,
},
} as unknown as Schema;
return (
<div>
<Toolbar />
@ -571,7 +550,7 @@ export const Gantt: any = (props) => {
paginate: false,
}}
>
<RecursionField name={'table'} schema={tableSchema} />
<RecursionField name={'table'} schema={fieldSchema.properties.table} />
</TableBlockProvider>
{
<TaskGantt

View File

@ -1080,48 +1080,70 @@ export const createGanttBlockSchema = (options) => {
'x-initializer': 'GanttActionInitializers',
properties: {},
},
event: {
type: 'void',
'x-component': 'Gantt.Event',
properties: {
drawer: {
type: 'void',
'x-component': 'Action.Drawer',
'x-component-props': {
className: 'nb-action-popup',
},
title: '{{ t("View record") }}',
properties: {
tabs: {
type: 'void',
'x-component': 'Tabs',
'x-component-props': {},
'x-initializer': 'TabPaneInitializers',
properties: {
tab1: {
type: 'void',
title: '{{t("Details")}}',
'x-component': 'Tabs.TabPane',
'x-designer': 'Tabs.Designer',
'x-component-props': {},
properties: {
grid: {
type: 'void',
'x-component': 'Grid',
'x-initializer-props': {
actionInitializers: 'GanttFormActionInitializers',
},
'x-initializer': 'RecordBlockInitializers',
properties: {},
},
},
},
},
},
},
table:{
type: 'array',
'x-decorator': 'div',
'x-decorator-props': {
style: {
display: 'inline-block',
maxWidth: '30%',
},
},
'x-initializer': 'TableColumnInitializers',
'x-component': 'TableV2',
'x-component-props': {
rowKey: 'id',
rowSelection: {
type: 'checkbox',
},
useProps: '{{ useTableBlockProps }}',
pagination: false,
},
},
// event: {
// type: 'void',
// 'x-component': 'Gantt.Event',
// properties: {
// drawer: {
// type: 'void',
// 'x-component': 'Action.Drawer',
// 'x-component-props': {
// className: 'nb-action-popup',
// },
// title: '{{ t("View record") }}',
// properties: {
// tabs: {
// type: 'void',
// 'x-component': 'Tabs',
// 'x-component-props': {},
// 'x-initializer': 'TabPaneInitializers',
// properties: {
// tab1: {
// type: 'void',
// title: '{{t("Details")}}',
// 'x-component': 'Tabs.TabPane',
// 'x-designer': 'Tabs.Designer',
// 'x-component-props': {},
// properties: {
// grid: {
// type: 'void',
// 'x-component': 'Grid',
// 'x-initializer-props': {
// actionInitializers: 'GanttFormActionInitializers',
// },
// 'x-initializer': 'RecordBlockInitializers',
// properties: {},
// },
// },
// },
// },
// },
// },
// },
// },
// },
},
},
},