From efcb22b925d58c25ba2ab2e16b15e62cebc18fca Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Tue, 11 Apr 2023 20:53:00 +0800 Subject: [PATCH] refactor: sort by start date --- .../core/client/src/block-provider/GanttBlockProvider.tsx | 4 ++-- .../core/client/src/block-provider/TableBlockProvider.tsx | 8 ++++++-- packages/core/client/src/schema-initializer/utils.ts | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/core/client/src/block-provider/GanttBlockProvider.tsx b/packages/core/client/src/block-provider/GanttBlockProvider.tsx index 16e9b3508b..86273b2c62 100644 --- a/packages/core/client/src/block-provider/GanttBlockProvider.tsx +++ b/packages/core/client/src/block-provider/GanttBlockProvider.tsx @@ -63,8 +63,8 @@ const InternalGanttBlockProvider = (props) => { export const GanttBlockProvider = (props) => { return ( - - + + diff --git a/packages/core/client/src/block-provider/TableBlockProvider.tsx b/packages/core/client/src/block-provider/TableBlockProvider.tsx index d7567ad9a1..d37aaa7226 100644 --- a/packages/core/client/src/block-provider/TableBlockProvider.tsx +++ b/packages/core/client/src/block-provider/TableBlockProvider.tsx @@ -21,7 +21,7 @@ interface Props { const InternalTableBlockProvider = (props: Props) => { const { params, showIndex, dragSort, rowKey, childrenColumnName } = props; - const field:any = useField(); + const field: any = useField(); const { resource, service } = useBlockRequestContext(); const [expandFlag, setExpandFlag] = useState(false); return ( @@ -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({ diff --git a/packages/core/client/src/schema-initializer/utils.ts b/packages/core/client/src/schema-initializer/utils.ts index 07d1958975..98bab3a633 100644 --- a/packages/core/client/src/schema-initializer/utils.ts +++ b/packages/core/client/src/schema-initializer/utils.ts @@ -1388,7 +1388,6 @@ export const createGanttBlockSchema = (options) => { }, params: { paginate: false, - sort: ['sort'], }, ...others, },