fix: invalid drag and drop sort

This commit is contained in:
chenos 2022-04-30 13:51:26 +08:00
parent 9ff82f9998
commit 13248af671
3 changed files with 4 additions and 3 deletions

View File

@ -19,6 +19,7 @@ export interface CollectionOptions {
title?: string;
filterTargetKey?: string;
targetKey?: string;
sortable?: any;
fields?: FieldOptions[];
}

View File

@ -10,7 +10,7 @@ import { useSchemaTemplate } from '../../../schema-templates';
import { useDesignable } from '../../hooks';
export const TableBlockDesigner = () => {
const { name, title } = useCollection();
const { name, title, sortable } = useCollection();
const field = useField();
const fieldSchema = useFieldSchema();
const dataSource = useCollectionFilterOptions(name);
@ -41,7 +41,7 @@ export const TableBlockDesigner = () => {
onChange={(dragSort) => {
field.decoratorProps.dragSort = dragSort;
fieldSchema['x-decorator-props'].dragSort = dragSort;
service.run({ ...service.params?.[0], sort: defaultSort });
service.run({ ...service.params?.[0], sort: 'sort' });
dn.emit('patch', {
schema: {
['x-uid']: fieldSchema['x-uid'],

View File

@ -39,7 +39,7 @@ export const TableVoidDesigner = () => {
onChange={(dragSort) => {
field.decoratorProps.dragSort = dragSort;
fieldSchema['x-decorator-props'].dragSort = dragSort;
ctx.run({ ...ctx.params?.[0], sort: defaultSort });
ctx.run({ ...ctx.params?.[0], sort: 'sort' });
dn.emit('patch', {
schema: {
['x-uid']: fieldSchema['x-uid'],