diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/menu-item.model.ts b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/menu-item.model.ts index 2212514665..b7171bd14b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/menu-item.model.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/menu-item.model.ts @@ -21,4 +21,5 @@ export interface ManifestMenuItemTreeKind extends ManifestMenuItem { export interface MetaMenuItemTreeKind extends MetaMenuItem { treeAlias: string; + hideTreeRoot?: boolean; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/modal/token/document-picker-modal.token.ts b/src/Umbraco.Web.UI.Client/src/packages/core/modal/token/document-picker-modal.token.ts index 3904f0ac2b..e3403e8903 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/modal/token/document-picker-modal.token.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/modal/token/document-picker-modal.token.ts @@ -11,6 +11,6 @@ export const UMB_DOCUMENT_PICKER_MODAL = new UmbModalToken ` : nothing; + return this.manifest + ? html` + + ` + : nothing; } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.stories.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.stories.ts index c664288a24..2f9e0d7be8 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.stories.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.stories.ts @@ -13,7 +13,7 @@ type Story = StoryObj; // TODO: This does not display anything - need help export const Overview: Story = { args: { - alias: 'Umb.Tree.Documents', + alias: 'Umb.Tree.Document', selectable: true, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entities.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entities.ts new file mode 100644 index 0000000000..b07e1f48a9 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entities.ts @@ -0,0 +1,2 @@ +export const UMB_DICTIONARY_ROOT_ENTITY_TYPE = 'dictionary-root'; +export const UMB_DICTIONARY_ENTITY_TYPE = 'dictionary-item'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/manifests.ts index 8cb6b7a040..cd83e8f7e2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/manifests.ts @@ -1,4 +1,5 @@ -import { DICTIONARY_REPOSITORY_ALIAS } from '../repository/manifests.js'; +import { UMB_DICTIONARY_REPOSITORY_ALIAS } from '../repository/manifests.js'; +import { UMB_DICTIONARY_ENTITY_TYPE } from '../entities.js'; import UmbReloadDictionaryEntityAction from './reload.action.js'; import UmbImportDictionaryEntityAction from './import/import.action.js'; import UmbExportDictionaryEntityAction from './export/export.action.js'; @@ -6,9 +7,6 @@ import UmbCreateDictionaryEntityAction from './create/create.action.js'; import { UmbDeleteEntityAction, UmbMoveEntityAction } from '@umbraco-cms/backoffice/entity-action'; import type { ManifestEntityAction, ManifestModal } from '@umbraco-cms/backoffice/extension-registry'; -const entityType = 'dictionary-item'; -const repositoryAlias = DICTIONARY_REPOSITORY_ALIAS; - const entityActions: Array = [ { type: 'entityAction', @@ -19,8 +17,8 @@ const entityActions: Array = [ meta: { icon: 'icon-add', label: 'Create', - repositoryAlias, - entityTypes: [entityType], + repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS, + entityTypes: [UMB_DICTIONARY_ENTITY_TYPE], }, }, { @@ -32,8 +30,8 @@ const entityActions: Array = [ meta: { icon: 'icon-enter', label: 'Move', - repositoryAlias, - entityTypes: [entityType], + repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS, + entityTypes: [UMB_DICTIONARY_ENTITY_TYPE], }, }, { @@ -45,8 +43,8 @@ const entityActions: Array = [ meta: { icon: 'icon-download-alt', label: 'Export', - repositoryAlias, - entityTypes: [entityType], + repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS, + entityTypes: [UMB_DICTIONARY_ENTITY_TYPE], }, }, { @@ -58,8 +56,8 @@ const entityActions: Array = [ meta: { icon: 'icon-page-up', label: 'Import', - repositoryAlias, - entityTypes: [entityType], + repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS, + entityTypes: [UMB_DICTIONARY_ENTITY_TYPE], }, }, { @@ -71,8 +69,8 @@ const entityActions: Array = [ meta: { icon: 'icon-refresh', label: 'Reload', - repositoryAlias, - entityTypes: [entityType], + repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS, + entityTypes: [UMB_DICTIONARY_ENTITY_TYPE], }, }, { @@ -84,8 +82,8 @@ const entityActions: Array = [ meta: { icon: 'icon-trash', label: 'Delete', - repositoryAlias, - entityTypes: [entityType], + repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS, + entityTypes: [UMB_DICTIONARY_ENTITY_TYPE], }, }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/index.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/index.ts index fac33f822d..a24a0f6363 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/index.ts @@ -1,3 +1,3 @@ export * from './repository/index.js'; +export * from './tree/index.js'; export * from './components/index.js'; -import './components/index.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/dictionary-menu-item.element.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/dictionary-menu-item.element.ts deleted file mode 100644 index 5c3898425f..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/dictionary-menu-item.element.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { html, customElement } from '@umbraco-cms/backoffice/external/lit'; -import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; - -@customElement('umb-dictionary-menu-item') -export class UmbDictionaryMenuItemElement extends UmbLitElement { - render() { - return html``; - } -} - -export default UmbDictionaryMenuItemElement; - -declare global { - interface HTMLElementTagNameMap { - 'umb-dictionary-menu-item': UmbDictionaryMenuItemElement; - } -} diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/manifests.ts index 6d15c07043..ac644d838e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/manifests.ts @@ -1,16 +1,20 @@ -import type { ManifestMenuItem } from '@umbraco-cms/backoffice/extension-registry'; +import { UMB_DICTIONARY_ENTITY_TYPE } from '../entities.js'; +import { UMB_DICTIONARY_TREE_ALIAS } from '../tree/index.js'; +import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry'; -const menuItem: ManifestMenuItem = { +const menuItem: ManifestTypes = { type: 'menuItem', + kind: 'tree', alias: 'Umb.MenuItem.Dictionary', name: 'Dictionary Menu Item', weight: 400, - loader: () => import('./dictionary-menu-item.element.js'), meta: { label: 'Dictionary', icon: 'icon-book-alt', - entityType: 'dictionary-item', + entityType: UMB_DICTIONARY_ENTITY_TYPE, menus: ['Umb.Menu.Dictionary'], + treeAlias: UMB_DICTIONARY_TREE_ALIAS, + hideTreeRoot: true, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/dictionary.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/dictionary.repository.ts index b38dbedb43..259e7effba 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/dictionary.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/dictionary.repository.ts @@ -1,14 +1,11 @@ +import { type UmbDictionaryTreeStore, UMB_DICTIONARY_TREE_STORE_CONTEXT } from '../tree/index.js'; import { UmbDictionaryStore, UMB_DICTIONARY_STORE_CONTEXT_TOKEN } from './dictionary.store.js'; import { UmbDictionaryDetailServerDataSource } from './sources/dictionary.detail.server.data.js'; -import { UmbDictionaryTreeStore, UMB_DICTIONARY_TREE_STORE_CONTEXT_TOKEN } from './dictionary.tree.store.js'; -import { UmbDictionaryTreeServerDataSource } from './sources/dictionary.tree.server.data.js'; import { UmbBaseController, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; import { UmbDetailRepository } from '@umbraco-cms/backoffice/repository'; -import { UmbTreeRepository, UmbTreeDataSource } from '@umbraco-cms/backoffice/tree'; import { CreateDictionaryItemRequestModel, DictionaryOverviewResponseModel, - EntityTreeItemResponseModel, ImportDictionaryRequestModel, UpdateDictionaryItemRequestModel, } from '@umbraco-cms/backoffice/backend-api'; @@ -18,7 +15,6 @@ import type { UmbApi } from '@umbraco-cms/backoffice/extension-api'; export class UmbDictionaryRepository extends UmbBaseController implements - UmbTreeRepository, UmbDetailRepository< CreateDictionaryItemRequestModel, any, @@ -29,7 +25,6 @@ export class UmbDictionaryRepository { #init!: Promise; - #treeSource: UmbTreeDataSource; #treeStore?: UmbDictionaryTreeStore; #detailSource: UmbDictionaryDetailServerDataSource; @@ -41,7 +36,6 @@ export class UmbDictionaryRepository super(host); // TODO: figure out how spin up get the correct data source - this.#treeSource = new UmbDictionaryTreeServerDataSource(this); this.#detailSource = new UmbDictionaryDetailServerDataSource(this); this.#init = Promise.all([ @@ -49,7 +43,7 @@ export class UmbDictionaryRepository this.#detailStore = instance; }), - this.consumeContext(UMB_DICTIONARY_TREE_STORE_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_DICTIONARY_TREE_STORE_CONTEXT, (instance) => { this.#treeStore = instance; }), @@ -59,82 +53,6 @@ export class UmbDictionaryRepository ]); } - // TREE: - async requestTreeRoot() { - await this.#init; - - const data = { - id: null, - type: 'dictionary-root', - name: 'Dictionary', - icon: 'icon-folder', - hasChildren: true, - }; - - return { data }; - } - - async requestRootTreeItems() { - await this.#init; - - const { data, error } = await this.#treeSource.getRootItems(); - - if (data) { - this.#treeStore?.appendItems(data.items); - } - - return { data, error, asObservable: () => this.#treeStore!.rootItems }; - } - - async requestTreeItemsOf(parentId: string | null) { - if (parentId === undefined) throw new Error('Parent id is missing'); - await this.#init; - - const { data, error } = await this.#treeSource.getChildrenOf(parentId); - - if (data) { - this.#treeStore?.appendItems(data.items); - } - - return { data, error, asObservable: () => this.#treeStore!.childrenOf(parentId) }; - } - - async requestItems(ids: Array) { - await this.#init; - - if (!ids) { - throw new Error('Ids are missing'); - } - - const { data, error } = await this.#treeSource.getItems(ids); - - return { data, error, asObservable: () => this.#treeStore!.items(ids) }; - } - - async requestItems(ids: Array) { - // TODO: There is a bug where the item gets removed from the tree before we confirm the delete via the modal. It doesn't delete the item unless we confirm the delete. - if (!ids) throw new Error('Dictionary Ids are missing'); - await this.#init; - - const { data, error } = await this.#treeSource.getItems(ids); - - if (data) { - this.#treeStore?.appendItems(data); - } - - return { data, error, asObservable: () => this.#treeStore!.items(ids) }; - } - - async rootTreeItems() { - await this.#init; - return this.#treeStore!.rootItems; - } - - async treeItemsOf(parentId: string | null) { - await this.#init; - return this.#treeStore!.childrenOf(parentId); - } - async itemsLegacy(ids: Array) { await this.#init; return this.#treeStore!.items(ids); diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/index.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/index.ts index 5915c01e1d..65e36c033e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/index.ts @@ -1,3 +1 @@ export * from './dictionary.repository.js'; -export * from './dictionary.store.js'; -export * from './dictionary.tree.store.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/manifests.ts index a33e69ae76..4fd6335dfa 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/manifests.ts @@ -1,32 +1,23 @@ import { UmbDictionaryRepository } from './dictionary.repository.js'; -import { UmbDictionaryTreeStore } from './dictionary.tree.store.js'; import { UmbDictionaryStore } from './dictionary.store.js'; -import { ManifestStore, ManifestTreeStore, ManifestRepository } from '@umbraco-cms/backoffice/extension-registry'; +import { ManifestStore, ManifestRepository } from '@umbraco-cms/backoffice/extension-registry'; -export const DICTIONARY_REPOSITORY_ALIAS = 'Umb.Repository.Dictionary'; +export const UMB_DICTIONARY_REPOSITORY_ALIAS = 'Umb.Repository.Dictionary'; const repository: ManifestRepository = { type: 'repository', - alias: DICTIONARY_REPOSITORY_ALIAS, + alias: UMB_DICTIONARY_REPOSITORY_ALIAS, name: 'Dictionary Repository', api: UmbDictionaryRepository, }; -export const DICTIONARY_STORE_ALIAS = 'Umb.Store.Dictionary'; -export const DICTIONARY_TREE_STORE_ALIAS = 'Umb.Store.DictionaryTree'; +export const UMB_DICTIONARY_STORE_ALIAS = 'Umb.Store.Dictionary'; const store: ManifestStore = { type: 'store', - alias: DICTIONARY_STORE_ALIAS, + alias: UMB_DICTIONARY_STORE_ALIAS, name: 'Dictionary Store', api: UmbDictionaryStore, }; -const treeStore: ManifestTreeStore = { - type: 'treeStore', - alias: DICTIONARY_TREE_STORE_ALIAS, - name: 'Dictionary Tree Store', - api: UmbDictionaryTreeStore, -}; - -export const manifests = [repository, store, treeStore]; +export const manifests = [repository, store]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.repository.ts new file mode 100644 index 0000000000..4f908e838f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.repository.ts @@ -0,0 +1,28 @@ +import { UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entities.js'; +import { UmbDictionaryTreeServerDataSource } from './dictionary-tree.server.data-source.js'; +import { UmbDictionaryTreeItemModel, UmbDictionaryTreeRootModel } from './types.js'; +import { UMB_DICTIONARY_TREE_STORE_CONTEXT } from './dictionary-tree.store.js'; +import { UmbTreeRepositoryBase } from '@umbraco-cms/backoffice/tree'; +import { type UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; +import { UmbApi } from '@umbraco-cms/backoffice/extension-api'; + +export class UmbDictionaryTreeRepository + extends UmbTreeRepositoryBase + implements UmbApi +{ + constructor(host: UmbControllerHost) { + super(host, UmbDictionaryTreeServerDataSource, UMB_DICTIONARY_TREE_STORE_CONTEXT); + } + + async requestTreeRoot() { + const data = { + id: null, + type: UMB_DICTIONARY_ROOT_ENTITY_TYPE, + name: 'Dictionary', + icon: 'icon-folder', + hasChildren: true, + }; + + return { data }; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/sources/dictionary.tree.server.data.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.server.data-source.ts similarity index 82% rename from src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/sources/dictionary.tree.server.data.ts rename to src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.server.data-source.ts index 04278012f8..bdcfb4721a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/sources/dictionary.tree.server.data.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.server.data-source.ts @@ -1,21 +1,21 @@ -import { DictionaryResource } from '@umbraco-cms/backoffice/backend-api'; -import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbTreeDataSource } from '@umbraco-cms/backoffice/tree'; +import { DictionaryResource, EntityTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api'; +import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources'; /** * A data source for the Dictionary tree that fetches data from the server * @export * @class UmbDictionaryTreeServerDataSource - * @implements {DictionaryTreeDataSource} + * @implements {UmbTreeDataSource} */ -export class UmbDictionaryTreeServerDataSource implements UmbTreeDataSource { +export class UmbDictionaryTreeServerDataSource implements UmbTreeDataSource { #host: UmbControllerHost; /** - * Creates an instance of DictionaryTreeDataSource. + * Creates an instance of UmbDictionaryTreeServerDataSource. * @param {UmbControllerHost} host - * @memberof DictionaryTreeDataSource + * @memberof UmbDictionaryTreeServerDataSource */ constructor(host: UmbControllerHost) { this.#host = host; @@ -32,7 +32,7 @@ export class UmbDictionaryTreeServerDataSource implements UmbTreeDataSource { /** * Fetches the children of a given parent id from the server - * @param {(string | null)} parentId + * @param {(string)} parentId * @return {*} * @memberof UmbDictionaryTreeServerDataSource */ @@ -60,10 +60,7 @@ export class UmbDictionaryTreeServerDataSource implements UmbTreeDataSource { * @memberof UmbDictionaryTreeServerDataSource */ async getItems(ids: Array) { - if (!ids || ids.length === 0) { - throw new Error('Ids are missing'); - } - + if (!ids) throw new Error('Ids are missing'); return tryExecuteAndNotify( this.#host, DictionaryResource.getDictionaryItem({ diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/dictionary.tree.store.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.store.ts similarity index 65% rename from src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/dictionary.tree.store.ts rename to src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.store.ts index d05e19af5d..30e9c79fd0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/repository/dictionary.tree.store.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.store.ts @@ -1,12 +1,12 @@ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; -import { UmbEntityTreeStore } from '@umbraco-cms/backoffice/tree'; import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; +import { UmbEntityTreeStore } from '@umbraco-cms/backoffice/tree'; /** * @export * @class UmbDictionaryTreeStore - * @extends {UmbEntityTreeStore} - * @description - Tree Data Store for Dictionary + * @extends {UmbStoreBase} + * @description - Tree Data Store for Dictionary Items */ export class UmbDictionaryTreeStore extends UmbEntityTreeStore { /** @@ -15,10 +15,8 @@ export class UmbDictionaryTreeStore extends UmbEntityTreeStore { * @memberof UmbDictionaryTreeStore */ constructor(host: UmbControllerHostElement) { - super(host, UMB_DICTIONARY_TREE_STORE_CONTEXT_TOKEN.toString()); + super(host, UMB_DICTIONARY_TREE_STORE_CONTEXT.toString()); } } -export const UMB_DICTIONARY_TREE_STORE_CONTEXT_TOKEN = new UmbContextToken( - 'UmbDictionaryTreeStore', -); +export const UMB_DICTIONARY_TREE_STORE_CONTEXT = new UmbContextToken('UmbDictionaryTreeStore'); diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/index.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/index.ts new file mode 100644 index 0000000000..8b7d45e3a6 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/index.ts @@ -0,0 +1,9 @@ +export { UmbDictionaryTreeRepository } from './dictionary-tree.repository.js'; +export { + UMB_DICTIONARY_TREE_REPOSITORY_ALIAS, + UMB_DICTIONARY_TREE_STORE_ALIAS, + UMB_DICTIONARY_TREE_ALIAS, +} from './manifests.js'; +export { UMB_DICTIONARY_TREE_STORE_CONTEXT } from './dictionary-tree.store.js'; +export { type UmbDictionaryTreeStore } from './dictionary-tree.store.js'; +export * from './types.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/manifests.ts index 663cd6ecc7..e2e0185c3c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/manifests.ts @@ -1,23 +1,48 @@ -import { DICTIONARY_REPOSITORY_ALIAS } from '../repository/manifests.js'; -import type { ManifestTree, ManifestTreeItem } from '@umbraco-cms/backoffice/extension-registry'; +import { UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entities.js'; +import { UmbDictionaryTreeRepository } from './dictionary-tree.repository.js'; +import { UmbDictionaryTreeStore } from './dictionary-tree.store.js'; +import type { + ManifestRepository, + ManifestTree, + ManifestTreeItem, + ManifestTreeStore, +} from '@umbraco-cms/backoffice/extension-registry'; + +export const UMB_DICTIONARY_TREE_REPOSITORY_ALIAS = 'Umb.Repository.Dictionary.Tree'; +export const UMB_DICTIONARY_TREE_STORE_ALIAS = 'Umb.Store.Dictionary.Tree'; +export const UMB_DICTIONARY_TREE_ALIAS = 'Umb.Tree.Dictionary'; + +const treeRepository: ManifestRepository = { + type: 'repository', + alias: UMB_DICTIONARY_TREE_REPOSITORY_ALIAS, + name: 'Dictionary Tree Repository', + api: UmbDictionaryTreeRepository, +}; + +const treeStore: ManifestTreeStore = { + type: 'treeStore', + alias: UMB_DICTIONARY_TREE_STORE_ALIAS, + name: 'Dictionary Tree Store', + api: UmbDictionaryTreeStore, +}; const tree: ManifestTree = { type: 'tree', - alias: 'Umb.Tree.Dictionary', + alias: UMB_DICTIONARY_TREE_ALIAS, name: 'Dictionary Tree', meta: { - repositoryAlias: DICTIONARY_REPOSITORY_ALIAS, + repositoryAlias: UMB_DICTIONARY_TREE_REPOSITORY_ALIAS, }, }; const treeItem: ManifestTreeItem = { type: 'treeItem', kind: 'entity', - alias: 'Umb.TreeItem.DictionaryItem', - name: 'Dictionary Item Tree Item', + alias: 'Umb.TreeItem.Dictionary', + name: 'Dictionary Tree Item', meta: { - entityTypes: ['dictionary-root', 'dictionary-item'], + entityTypes: [UMB_DICTIONARY_ROOT_ENTITY_TYPE, UMB_DICTIONARY_ENTITY_TYPE], }, }; -export const manifests = [tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/types.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/types.ts new file mode 100644 index 0000000000..2c8aef0bc6 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/types.ts @@ -0,0 +1,5 @@ +import { EntityTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api'; +import type { UmbEntityTreeItemModel, UmbEntityTreeRootModel } from '@umbraco-cms/backoffice/tree'; + +export type UmbDictionaryTreeItemModel = EntityTreeItemResponseModel & UmbEntityTreeItemModel; +export type UmbDictionaryTreeRootModel = EntityTreeItemResponseModel & UmbEntityTreeRootModel; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/menu-item/document-menu-item.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/menu-item/document-menu-item.element.ts deleted file mode 100644 index e0719ac3d5..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/menu-item/document-menu-item.element.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { html, customElement } from '@umbraco-cms/backoffice/external/lit'; -import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; - -@customElement('umb-document-menu-item') -export class UmbDocumentMenuItemElement extends UmbLitElement { - render() { - return html``; - } -} - -export default UmbDocumentMenuItemElement; - -declare global { - interface HTMLElementTagNameMap { - 'umb-document-menu-item': UmbDocumentMenuItemElement; - } -} diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/menu-item/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/menu-item/manifests.ts index 296de6cb49..eb727355da 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/menu-item/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/menu-item/manifests.ts @@ -1,15 +1,17 @@ -import type { ManifestMenuItem } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry'; -const menuItem: ManifestMenuItem = { +const menuItem: ManifestTypes = { type: 'menuItem', + kind: 'tree', alias: 'Umb.MenuItem.Documents', name: 'Documents Menu Item', weight: 200, - loader: () => import('./document-menu-item.element.js'), meta: { label: 'Documents', icon: 'icon-folder', menus: ['Umb.Menu.Content'], + treeAlias: 'Umb.Tree.Document', + hideTreeRoot: true, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/manifests.ts index 64d79b138c..1b65dba45d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/manifests.ts @@ -1,11 +1,11 @@ import { DOCUMENT_REPOSITORY_ALIAS } from '../repository/manifests.js'; import type { ManifestTree, ManifestTreeItem } from '@umbraco-cms/backoffice/extension-registry'; -export const DOCUMENT_TREE_ALIAS = 'Umb.Tree.Documents'; +export const UMB_DOCUMENT_TREE_ALIAS = 'Umb.Tree.Document'; const tree: ManifestTree = { type: 'tree', - alias: DOCUMENT_TREE_ALIAS, + alias: UMB_DOCUMENT_TREE_ALIAS, name: 'Documents Tree', meta: { repositoryAlias: DOCUMENT_REPOSITORY_ALIAS, diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/menu-item/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/menu-item/manifests.ts index b369a0c8e8..c7036d64f5 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/menu-item/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/menu-item/manifests.ts @@ -1,15 +1,17 @@ -import type { ManifestMenuItem } from '@umbraco-cms/backoffice/extension-registry'; +import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry'; -const menuItem: ManifestMenuItem = { +const menuItem: ManifestTypes = { type: 'menuItem', + kind: 'tree', alias: 'Umb.MenuItem.Media', name: 'Media Menu Item', weight: 100, - loader: () => import('./media-menu-item.element.js'), meta: { label: 'Media', icon: 'icon-folder', menus: ['Umb.Menu.Media'], + treeAlias: 'Umb.Tree.Media', + hideTreeRoot: true, }, }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/menu-item/media-menu-item.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/menu-item/media-menu-item.element.ts deleted file mode 100644 index 716595e178..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/menu-item/media-menu-item.element.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { html, customElement } from '@umbraco-cms/backoffice/external/lit'; -import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; - -@customElement('umb-media-menu-item') -export class UmbMediaMenuItemElement extends UmbLitElement { - render() { - return html``; - } -} - -export default UmbMediaMenuItemElement; - -declare global { - interface HTMLElementTagNameMap { - 'umb-media-menu-item': UmbMediaMenuItemElement; - } -} diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/manifests.ts index 0851c1d2fe..c7cebf55bf 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/manifests.ts @@ -1,11 +1,11 @@ import { MEDIA_REPOSITORY_ALIAS } from '../repository/manifests.js'; import type { ManifestTree, ManifestTreeItem } from '@umbraco-cms/backoffice/extension-registry'; -const treeAlias = 'Umb.Tree.Media'; +const UMB_MEDIA_TREE_ALIAS = 'Umb.Tree.Media'; const tree: ManifestTree = { type: 'tree', - alias: treeAlias, + alias: UMB_MEDIA_TREE_ALIAS, name: 'Media Tree', meta: { repositoryAlias: MEDIA_REPOSITORY_ALIAS,