Collection menu item extension point (#20506)
* add extension option for collection menu item * Add collection menu module export * remove unused css * register user collection menu item * register user collection menu * use collection modal for user picker * Delete user-picker-modal.element.ts * Update manifests.ts * explicit exports to avoid name collision * hack to avoid circular dependency * fix lint errors * fix missing const export * Update collection-menu-item.element.ts
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
|
||||
import type { UmbCollectionFilterModel, UmbCollectionItemModel } from '@umbraco-cms/backoffice/collection';
|
||||
import type { UmbItemModel } from '@umbraco-cms/backoffice/entity-item';
|
||||
import type {
|
||||
UmbPickerCollectionDataSource,
|
||||
UmbPickerSearchableDataSource,
|
||||
} from '@umbraco-cms/backoffice/picker-data-source';
|
||||
import type { UmbSearchRequestArgs } from '@umbraco-cms/backoffice/search';
|
||||
|
||||
interface ExampleCollectionItemModel extends UmbCollectionItemModel {
|
||||
isPickable: boolean;
|
||||
}
|
||||
|
||||
export class ExampleCustomPickerCollectionPropertyEditorDataSource
|
||||
extends UmbControllerBase
|
||||
implements UmbPickerCollectionDataSource, UmbPickerSearchableDataSource
|
||||
implements UmbPickerCollectionDataSource<ExampleCollectionItemModel>, UmbPickerSearchableDataSource
|
||||
{
|
||||
collectionPickableFilter = (item: ExampleCollectionItemModel) => item.isPickable;
|
||||
|
||||
async requestCollection(args: UmbCollectionFilterModel) {
|
||||
// TODO: use args to filter/paginate etc
|
||||
console.log(args);
|
||||
@@ -41,35 +48,40 @@ export class ExampleCustomPickerCollectionPropertyEditorDataSource
|
||||
|
||||
export { ExampleCustomPickerCollectionPropertyEditorDataSource as api };
|
||||
|
||||
const customItems: Array<UmbCollectionItemModel> = [
|
||||
const customItems: Array<ExampleCollectionItemModel> = [
|
||||
{
|
||||
unique: '1',
|
||||
entityType: 'example',
|
||||
name: 'Example 1',
|
||||
icon: 'icon-shape-triangle',
|
||||
isPickable: true,
|
||||
},
|
||||
{
|
||||
unique: '2',
|
||||
entityType: 'example',
|
||||
name: 'Example 2',
|
||||
icon: 'icon-shape-triangle',
|
||||
isPickable: true,
|
||||
},
|
||||
{
|
||||
unique: '3',
|
||||
entityType: 'example',
|
||||
name: 'Example 3',
|
||||
icon: 'icon-shape-triangle',
|
||||
isPickable: true,
|
||||
},
|
||||
{
|
||||
unique: '4',
|
||||
entityType: 'example',
|
||||
name: 'Example 4',
|
||||
icon: 'icon-shape-triangle',
|
||||
isPickable: false,
|
||||
},
|
||||
{
|
||||
unique: '5',
|
||||
entityType: 'example',
|
||||
name: 'Example 5',
|
||||
icon: 'icon-shape-triangle',
|
||||
isPickable: true,
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user