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; title?: string;
filterTargetKey?: string; filterTargetKey?: string;
targetKey?: string; targetKey?: string;
sortable?: any;
fields?: FieldOptions[]; fields?: FieldOptions[];
} }

View File

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

View File

@ -39,7 +39,7 @@ export const TableVoidDesigner = () => {
onChange={(dragSort) => { onChange={(dragSort) => {
field.decoratorProps.dragSort = dragSort; field.decoratorProps.dragSort = dragSort;
fieldSchema['x-decorator-props'].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', { dn.emit('patch', {
schema: { schema: {
['x-uid']: fieldSchema['x-uid'], ['x-uid']: fieldSchema['x-uid'],