# CollectionManager ## Components ### CollectionManagerProvider ```jsx | pure ``` ### CollectionProvider ```jsx | pure const collection = { name: 'tests', fields: [ { type: 'string', name: 'title', interface: 'input', uiSchema: { type: 'string', 'x-component': 'Input' }, }, ], }; ``` If there is no collection parameter passed in, get the collection from CollectionManagerProvider with the corresponding name. ```jsx | pure const collections = [ { name: 'tests', fields: [ { type: 'string', name: 'title', interface: 'input', uiSchema: { type: 'string', 'x-component': 'Input' }, }, ], } ]; ``` ### CollectionFieldProvider ```jsx | pure const field = { type: 'string', name: 'title', interface: 'input', uiSchema: { type: 'string', 'x-component': 'Input' }, }; ``` If there is no field parameter passed in, get the field from CollectionProvider with the corresponding name. ```jsx | pure const collection = { name: 'tests', fields: [ { type: 'string', name: 'title', interface: 'input', uiSchema: { type: 'string', 'x-component': 'Input' }, }, ], }; ``` ### CollectionField Universal field component that needs to be used with ``, but only in schema scenarios. Get the field schema from CollectionProvider with the corresponding name. Extend the configuration via the schema where the CollectionField is located. ```ts { name: 'title', 'x-decorator': 'FormItem', 'x-decorator-props': {}, 'x-component': 'CollectionField', 'x-component-props': {}, properties: {}, } ``` ## Hooks ### useCollectionManager() Use with ``. ```jsx | pure const { collections, get } = useCollectionManager(); ``` ### useCollection() Use with ``. ```jsx | pure const { name, fields, getField, findField, resource } = useCollection(); ``` ### useCollectionField() Use with ``. ```jsx | pure const { name, uiSchema, resource } = useCollectionField(); ``` The resource needs to be used with `` to provide context of the record of the current data table row. # CollectionManager ## Components ### CollectionManagerProvider ```jsx | pure ``` ### CollectionProvider ```jsx | pure const collection = { name: 'tests', fields: [ { type: 'string', name: 'title', interface: 'input', uiSchema: { type: 'string', 'x-component': 'Input' }, }, ], }; ``` If there is no collection parameter passed in, get the collection from CollectionManagerProvider with the corresponding name. ```jsx | pure const collections = [ { name: 'tests', fields: [ { type: 'string', name: 'title', interface: 'input', uiSchema: { type: 'string', 'x-component': 'Input' }, }, ], } ]; ``` ### CollectionFieldProvider ```jsx | pure const field = { type: 'string', name: 'title', interface: 'input', uiSchema: { type: 'string', 'x-component': 'Input' }, }; ``` If there is no field parameter passed in, get the field from CollectionProvider with the corresponding name. ```jsx | pure const collection = { name: 'tests', fields: [ { type: 'string', name: 'title', interface: 'input', uiSchema: { type: 'string', 'x-component': 'Input' }, }, ], }; ``` ### CollectionField Universal field component that needs to be used with ``, but only in schema scenarios. Get the field schema from CollectionProvider with the corresponding name. Extend the configuration via the schema where the CollectionField is located. ```ts { name: 'title', 'x-decorator': 'FormItem', 'x-decorator-props': {}, 'x-component': 'CollectionField', 'x-component-props': {}, properties: {}, } ``` ## Hooks ### useCollectionManager() Use with ``. ```jsx | pure const { collections, get } = useCollectionManager(); ``` ### useCollection() Use with ``. ```jsx | pure const { name, fields, getField, findField, resource } = useCollection(); ``` ### useCollectionField() Use with ``. ```jsx | pure const { name, uiSchema, resource } = useCollectionField(); ``` The resource needs to be used with `` to provide context of the record of the current data table row.