refactor: sort by start date

This commit is contained in:
katherinehhh 2023-04-11 20:53:00 +08:00
parent cab40bd58b
commit efcb22b925
3 changed files with 8 additions and 5 deletions

View File

@ -63,8 +63,8 @@ const InternalGanttBlockProvider = (props) => {
export const GanttBlockProvider = (props) => {
return (
<BlockProvider {...props} params={{ ...props.params, paginate: false }}>
<TableBlockProvider {...props} params={{ ...props.params, paginate: false }}>
<BlockProvider {...props} params={{ tree:true, paginate: false, sort: props.fieldNames.start }}>
<TableBlockProvider {...props} params={{ tree:true, paginate: false, sort: props.fieldNames.start }}>
<InternalGanttBlockProvider {...props} />
</TableBlockProvider>
</BlockProvider>

View File

@ -66,6 +66,9 @@ export const useAssociationNames = (collection) => {
if (schema['x-component'] === 'TableV2') {
return schema;
}
if (schema['x-component'] === 'Gantt') {
return schema.properties?.table;
}
return buf;
}, new Schema({}));
return uniq(
@ -94,6 +97,7 @@ export const useAssociationNames = (collection) => {
};
export const TableBlockProvider = (props) => {
console.log(props.collection);
const resourceName = props.resource;
const params = { ...props.params };
const appends = useAssociationNames(props.collection);
@ -120,6 +124,7 @@ export const TableBlockProvider = (props) => {
params['tree'] = true;
}
}
console.log(appends);
if (!Object.keys(params).includes('appends')) {
params['appends'] = appends;
}
@ -175,7 +180,6 @@ export const useTableBlockProps = () => {
ctx.field.data = ctx?.field?.data || {};
ctx.field.data.selectedRowKeys = selectedRowKeys;
ctx?.field?.onRowSelect?.(selectedRowKeys);
},
async onRowDragEnd({ from, to }) {
await ctx.resource.move({

View File

@ -1388,7 +1388,6 @@ export const createGanttBlockSchema = (options) => {
},
params: {
paginate: false,
sort: ['sort'],
},
...others,
},