Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Extension Manifest Map: Tree #2294

Merged
merged 11 commits into from
Sep 14, 2024
6 changes: 0 additions & 6 deletions src/packages/core/extension-registry/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ import type { ManifestSectionView } from './section-view.model.js';
import type { ManifestStore, ManifestTreeStore, ManifestItemStore } from './store.model.js';
import type { ManifestTheme } from './theme.model.js';
import type { ManifestTinyMcePlugin } from './tinymce-plugin.model.js';
import type { ManifestTree } from './tree.model.js';
import type { ManifestTreeItem } from './tree-item.model.js';
import type { ManifestUfmComponent } from './ufm-component.model.js';
import type { ManifestUfmFilter } from './ufm-filter.model.js';
import type { ManifestUserProfileApp } from './user-profile-app.model.js';
Expand Down Expand Up @@ -101,8 +99,6 @@ export type * from './section.model.js';
export type * from './store.model.js';
export type * from './theme.model.js';
export type * from './tinymce-plugin.model.js';
export type * from './tree-item.model.js';
export type * from './tree.model.js';
export type * from './ufm-component.model.js';
export type * from './ufm-filter.model.js';
export type * from './user-granular-permission.model.js';
Expand Down Expand Up @@ -188,8 +184,6 @@ export type ManifestTypes =
| ManifestStore
| ManifestTheme
| ManifestTinyMcePlugin
| ManifestTree
| ManifestTreeItem
| ManifestTreeStore
| ManifestUfmComponent
| ManifestUfmFilter
Expand Down
7 changes: 2 additions & 5 deletions src/packages/core/tree/default/default-tree.context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ import type { UmbTreeItemModel, UmbTreeRootModel, UmbTreeStartNode } from '../ty
import type { UmbTreeRepository } from '../data/tree-repository.interface.js';
import type { UmbTreeContext } from '../tree-context.interface.js';
import type { UmbTreeRootItemsRequestArgs } from '../data/types.js';
import type { ManifestTree } from '../extensions/index.js';
import { UMB_TREE_CONTEXT } from './default-tree.context-token.js';
import { type UmbActionEventContext, UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
import {
type ManifestRepository,
type ManifestTree,
umbExtensionsRegistry,
} from '@umbraco-cms/backoffice/extension-registry';
import { type ManifestRepository, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbExtensionApiInitializer } from '@umbraco-cms/backoffice/extension-api';
Expand Down
26 changes: 13 additions & 13 deletions src/packages/core/tree/default/manifests.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { ManifestTypes, UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';

const defaultTreeKind: UmbExtensionManifestKind = {
type: 'kind',
alias: 'Umb.Kind.Tree.Default',
matchKind: 'default',
matchType: 'tree',
manifest: {
type: 'tree',
api: () => import('./default-tree.context.js'),
element: () => import('./default-tree.element.js'),
export const manifests: Array<UmbExtensionManifestKind> = [
{
type: 'kind',
alias: 'Umb.Kind.Tree.Default',
matchKind: 'default',
matchType: 'tree',
manifest: {
type: 'tree',
api: () => import('./default-tree.context.js'),
element: () => import('./default-tree.element.js'),
},
},
};

export const manifests: Array<ManifestTypes | UmbExtensionManifestKind> = [defaultTreeKind];
];
2 changes: 2 additions & 0 deletions src/packages/core/tree/extensions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './tree-item.extension.js';
export * from './tree.extension.js';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { UmbTreeItemModel } from '../../tree/types.js';
import type { UmbTreeItemContext } from '../../tree/tree-item/index.js';
import type { UmbTreeItemModel } from '../types.js';
import type { UmbTreeItemContext } from '../tree-item/index.js';
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
import type { ManifestElementAndApi } from '@umbraco-cms/backoffice/extension-api';

Expand All @@ -8,3 +8,9 @@ export interface ManifestTreeItem
type: 'treeItem';
forEntityTypes: Array<string>;
}

declare global {
interface UmbExtensionManifestMap {
umbTreeItem: ManifestTreeItem;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ export interface ManifestTree extends ManifestElementAndApi, ManifestWithDynamic
export interface MetaTree {
repositoryAlias: string;
}

declare global {
interface UmbExtensionManifestMap {
umbTree: ManifestTree;
}
}
1 change: 1 addition & 0 deletions src/packages/core/tree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './data/index.js';
export * from './tree-menu-item-default/index.js';
export * from './folder/index.js';
export * from './tree.element.js';
export * from './extensions/index.js';

export * from './entity-actions/sort-children-of/index.js';
export * from './entity-actions/reload-tree-item-children/index.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import type { UmbTreeItemContext } from '../tree-item-context.interface.js';
import { UMB_TREE_CONTEXT, type UmbDefaultTreeContext } from '../../default/index.js';
import type { UmbTreeItemModel, UmbTreeRootModel } from '../../types.js';
import { UmbRequestReloadTreeItemChildrenEvent } from '../../entity-actions/reload-tree-item-children/index.js';
import type { ManifestTreeItem } from '../../extensions/index.js';
import { map } from '@umbraco-cms/backoffice/external/rxjs';
import { UmbArrayState, UmbBooleanState, UmbObjectState, UmbStringState } from '@umbraco-cms/backoffice/observable-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import { UMB_SECTION_CONTEXT, UMB_SECTION_SIDEBAR_CONTEXT } from '@umbraco-cms/backoffice/section';
import type { ManifestTreeItem } from '@umbraco-cms/backoffice/extension-registry';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/core/tree/tree-item/tree-item.element.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ManifestTreeItem } from '../extensions/index.js';
import { customElement, property } from '@umbraco-cms/backoffice/external/lit';
import type { ManifestTreeItem } from '@umbraco-cms/backoffice/extension-registry';
import {
UmbExtensionElementAndApiSlotElementBase,
umbExtensionsRegistry,
Expand Down
2 changes: 1 addition & 1 deletion src/packages/core/tree/tree.element.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ManifestTree } from './extensions/index.js';
import { customElement } from '@umbraco-cms/backoffice/external/lit';
import type { ManifestTree } from '@umbraco-cms/backoffice/extension-registry';
import { UmbExtensionElementAndApiSlotElementBase } from '@umbraco-cms/backoffice/extension-registry';

@customElement('umb-tree')
Expand Down
71 changes: 28 additions & 43 deletions src/packages/data-type/tree/manifests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,36 @@ import {
UMB_DATA_TYPE_TREE_REPOSITORY_ALIAS,
UMB_DATA_TYPE_TREE_STORE_ALIAS,
} from './constants.js';
import type {
ManifestRepository,
ManifestTree,
ManifestTreeItem,
ManifestTreeStore,
ManifestTypes,
} from '@umbraco-cms/backoffice/extension-registry';

const treeRepository: ManifestRepository = {
type: 'repository',
alias: UMB_DATA_TYPE_TREE_REPOSITORY_ALIAS,
name: 'Data Type Tree Repository',
api: () => import('./data-type-tree.repository.js'),
};

const treeStore: ManifestTreeStore = {
type: 'treeStore',
alias: UMB_DATA_TYPE_TREE_STORE_ALIAS,
name: 'Data Type Tree Store',
api: () => import('./data-type-tree.store.js'),
};

const tree: ManifestTree = {
type: 'tree',
kind: 'default',
alias: UMB_DATA_TYPE_TREE_ALIAS,
name: 'Data Types Tree',
meta: {
repositoryAlias: UMB_DATA_TYPE_TREE_REPOSITORY_ALIAS,
export const manifests: Array<UmbExtensionManifest> = [
{
type: 'repository',
alias: UMB_DATA_TYPE_TREE_REPOSITORY_ALIAS,
name: 'Data Type Tree Repository',
api: () => import('./data-type-tree.repository.js'),
},
{
type: 'treeStore',
alias: UMB_DATA_TYPE_TREE_STORE_ALIAS,
name: 'Data Type Tree Store',
api: () => import('./data-type-tree.store.js'),
},
{
type: 'tree',
kind: 'default',
alias: UMB_DATA_TYPE_TREE_ALIAS,
name: 'Data Types Tree',
meta: {
repositoryAlias: UMB_DATA_TYPE_TREE_REPOSITORY_ALIAS,
},
},
{
type: 'treeItem',
kind: 'default',
alias: 'Umb.TreeItem.DataType',
name: 'Data Type Tree Item',
forEntityTypes: ['data-type-root', 'data-type', 'data-type-folder'],
},
};

const treeItem: ManifestTreeItem = {
type: 'treeItem',
kind: 'default',
alias: 'Umb.TreeItem.DataType',
name: 'Data Type Tree Item',
forEntityTypes: ['data-type-root', 'data-type', 'data-type-folder'],
};

export const manifests: Array<ManifestTypes> = [
treeRepository,
treeStore,
tree,
treeItem,
...folderManifests,
...reloadManifests,
];
71 changes: 28 additions & 43 deletions src/packages/dictionary/tree/manifests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,35 @@ import {
UMB_DICTIONARY_TREE_STORE_ALIAS,
} from './constants.js';
import { manifests as reloadTreeItemChildrenManifests } from './reload-tree-item-children/manifests.js';
import type {
ManifestRepository,
ManifestTree,
ManifestTreeItem,
ManifestTreeStore,
ManifestTypes,
} from '@umbraco-cms/backoffice/extension-registry';

const treeRepository: ManifestRepository = {
type: 'repository',
alias: UMB_DICTIONARY_TREE_REPOSITORY_ALIAS,
name: 'Dictionary Tree Repository',
api: () => import('./dictionary-tree.repository.js'),
};

const treeStore: ManifestTreeStore = {
type: 'treeStore',
alias: UMB_DICTIONARY_TREE_STORE_ALIAS,
name: 'Dictionary Tree Store',
api: () => import('./dictionary-tree.store.js'),
};

const tree: ManifestTree = {
type: 'tree',
kind: 'default',
alias: UMB_DICTIONARY_TREE_ALIAS,
name: 'Dictionary Tree',
meta: {
repositoryAlias: UMB_DICTIONARY_TREE_REPOSITORY_ALIAS,
export const manifests: Array<UmbExtensionManifest> = [
{
type: 'repository',
alias: UMB_DICTIONARY_TREE_REPOSITORY_ALIAS,
name: 'Dictionary Tree Repository',
api: () => import('./dictionary-tree.repository.js'),
},
{
type: 'treeStore',
alias: UMB_DICTIONARY_TREE_STORE_ALIAS,
name: 'Dictionary Tree Store',
api: () => import('./dictionary-tree.store.js'),
},
{
type: 'tree',
kind: 'default',
alias: UMB_DICTIONARY_TREE_ALIAS,
name: 'Dictionary Tree',
meta: {
repositoryAlias: UMB_DICTIONARY_TREE_REPOSITORY_ALIAS,
},
},
{
type: 'treeItem',
kind: 'default',
alias: 'Umb.TreeItem.Dictionary',
name: 'Dictionary Tree Item',
forEntityTypes: [UMB_DICTIONARY_ROOT_ENTITY_TYPE, UMB_DICTIONARY_ENTITY_TYPE],
},
};

const treeItem: ManifestTreeItem = {
type: 'treeItem',
kind: 'default',
alias: 'Umb.TreeItem.Dictionary',
name: 'Dictionary Tree Item',
forEntityTypes: [UMB_DICTIONARY_ROOT_ENTITY_TYPE, UMB_DICTIONARY_ENTITY_TYPE],
};

export const manifests: Array<ManifestTypes> = [
treeRepository,
treeStore,
tree,
treeItem,
...reloadTreeItemChildrenManifests,
];
79 changes: 32 additions & 47 deletions src/packages/documents/document-blueprints/tree/manifests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,40 @@ import {
} from './constants.js';
import { manifests as folderManifests } from './folder/manifests.js';
import { manifests as reloadManifests } from './reload-tree-item-children/manifests.js';
import type {
ManifestRepository,
ManifestTree,
ManifestTreeItem,
ManifestTreeStore,
ManifestTypes,
} from '@umbraco-cms/backoffice/extension-registry';

const treeRepository: ManifestRepository = {
type: 'repository',
alias: UMB_DOCUMENT_BLUEPRINT_TREE_REPOSITORY_ALIAS,
name: 'Document Blueprint Tree Repository',
api: () => import('./document-blueprint-tree.repository.js'),
};

const treeStore: ManifestTreeStore = {
type: 'treeStore',
alias: UMB_DOCUMENT_BLUEPRINT_TREE_STORE_ALIAS,
name: 'Document Blueprint Tree Store',
api: () => import('./document-blueprint-tree.store.js'),
};

const tree: ManifestTree = {
type: 'tree',
kind: 'default',
alias: UMB_DOCUMENT_BLUEPRINT_TREE_ALIAS,
name: 'Document Blueprints Tree',
meta: {
repositoryAlias: UMB_DOCUMENT_BLUEPRINT_TREE_REPOSITORY_ALIAS,
export const manifests: Array<UmbExtensionManifest> = [
{
type: 'repository',
alias: UMB_DOCUMENT_BLUEPRINT_TREE_REPOSITORY_ALIAS,
name: 'Document Blueprint Tree Repository',
api: () => import('./document-blueprint-tree.repository.js'),
},
{
type: 'treeStore',
alias: UMB_DOCUMENT_BLUEPRINT_TREE_STORE_ALIAS,
name: 'Document Blueprint Tree Store',
api: () => import('./document-blueprint-tree.store.js'),
},
{
type: 'tree',
kind: 'default',
alias: UMB_DOCUMENT_BLUEPRINT_TREE_ALIAS,
name: 'Document Blueprints Tree',
meta: {
repositoryAlias: UMB_DOCUMENT_BLUEPRINT_TREE_REPOSITORY_ALIAS,
},
},
{
type: 'treeItem',
kind: 'default',
alias: 'Umb.TreeItem.DocumentBlueprint',
name: 'Document Blueprint Tree Item',
forEntityTypes: [
UMB_DOCUMENT_BLUEPRINT_ROOT_ENTITY_TYPE,
UMB_DOCUMENT_BLUEPRINT_ENTITY_TYPE,
UMB_DOCUMENT_BLUEPRINT_FOLDER_ENTITY_TYPE,
],
},
};

const treeItem: ManifestTreeItem = {
type: 'treeItem',
kind: 'default',
alias: 'Umb.TreeItem.DocumentBlueprint',
name: 'Document Blueprint Tree Item',
forEntityTypes: [
UMB_DOCUMENT_BLUEPRINT_ROOT_ENTITY_TYPE,
UMB_DOCUMENT_BLUEPRINT_ENTITY_TYPE,
UMB_DOCUMENT_BLUEPRINT_FOLDER_ENTITY_TYPE,
],
};

export const manifests: Array<ManifestTypes> = [
treeRepository,
treeStore,
tree,
treeItem,
...reloadManifests,
...folderManifests,
];
Loading
Loading