fix: enable drag and drop sorting

This commit is contained in:
chenos 2022-03-07 11:40:03 +08:00
parent 9ff0361336
commit e1e91bbe20

View File

@ -1,5 +1,6 @@
import { ISchema, useField, useFieldSchema } from '@formily/react';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useCollection, useResourceActionContext } from '../../../collection-manager';
import { useCollectionFilterOptions } from '../../../collection-manager/action-hooks';
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
@ -11,13 +12,14 @@ export const TableVoidDesigner = () => {
const fieldSchema = useFieldSchema();
const dataSource = useCollectionFilterOptions(name);
const ctx = useResourceActionContext();
const { t } = useTranslation();
const { dn } = useDesignable();
const defaultFilter = fieldSchema?.['x-decorator-props']?.request?.params?.filter || {};
const defaultSort = fieldSchema?.['x-decorator-props']?.request?.params?.sort || [];
return (
<GeneralSchemaDesigner title={title || name}>
<SchemaSettings.SwitchItem
title={'启用手动排序'}
title={t('Enable drag and drop sorting')}
checked={field.decoratorProps.dragSort}
onChange={(dragSort) => {
field.decoratorProps.dragSort = dragSort;