mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 07:29:24 +08:00
feat: table block of the selector supports tree table
This commit is contained in:
parent
6126481b06
commit
b28b8ba536
@ -99,19 +99,21 @@ const useAssociationNames = (collection) => {
|
|||||||
|
|
||||||
export const TableSelectorProvider = (props) => {
|
export const TableSelectorProvider = (props) => {
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
const ctx = useFormBlockContext();
|
|
||||||
const { getCollectionJoinField, getCollectionFields } = useCollectionManager();
|
const { getCollectionJoinField, getCollectionFields } = useCollectionManager();
|
||||||
const record = useRecord();
|
const record = useRecord();
|
||||||
|
const { getCollection } = useCollectionManager();
|
||||||
|
const collection = getCollection(props.collection);
|
||||||
|
const { treeTable } = fieldSchema['x-decorator-props'];
|
||||||
const collectionFieldSchema = recursiveParent(fieldSchema, 'CollectionField');
|
const collectionFieldSchema = recursiveParent(fieldSchema, 'CollectionField');
|
||||||
// const value = ctx.form.query(collectionFieldSchema?.name).value();
|
|
||||||
const collectionField = getCollectionJoinField(collectionFieldSchema?.['x-collection-field']);
|
const collectionField = getCollectionJoinField(collectionFieldSchema?.['x-collection-field']);
|
||||||
|
|
||||||
const params = { ...props.params };
|
const params = { ...props.params };
|
||||||
const appends = useAssociationNames(props.collection);
|
const appends = useAssociationNames(props.collection);
|
||||||
if (props.dragSort) {
|
if (props.dragSort) {
|
||||||
params['sort'] = ['sort'];
|
params['sort'] = ['sort'];
|
||||||
}
|
}
|
||||||
|
if ((collection as any).template === 'tree' && treeTable !== false) {
|
||||||
|
params['tree'] = true;
|
||||||
|
}
|
||||||
if (!Object.keys(params).includes('appends')) {
|
if (!Object.keys(params).includes('appends')) {
|
||||||
params['appends'] = appends;
|
params['appends'] = appends;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user