mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
feat: gantt block congiure fields
This commit is contained in:
parent
34aec221bb
commit
5f35a24899
@ -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
|
||||
|
@ -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: {},
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user