diff --git a/src/Umbraco.Web.UI.Client/src/libs/extension-api/controller/extension-element-controller.ts b/src/Umbraco.Web.UI.Client/src/libs/extension-api/controller/extension-element-controller.ts index 2e30f45e26..372e57323d 100644 --- a/src/Umbraco.Web.UI.Client/src/libs/extension-api/controller/extension-element-controller.ts +++ b/src/Umbraco.Web.UI.Client/src/libs/extension-api/controller/extension-element-controller.ts @@ -69,13 +69,15 @@ export class UmbExtensionElementController< protected async _conditionsAreGood() { const manifest = this.manifest!; // In this case we are sure its not undefined. + console.log("---defaultElement", this._defaultElement) if (isManifestElementableType(manifest)) { - const newComponent = await createExtensionElement(manifest); + const newComponent = await createExtensionElement(manifest, this._defaultElement); if (!this._positive) { // We are not positive anymore, so we will back out of this creation. return false; } this._component = newComponent; + } else if (this._defaultElement) { this._component = document.createElement(this._defaultElement); } else { diff --git a/src/Umbraco.Web.UI.Client/src/libs/extension-api/create-extension-api.function.ts b/src/Umbraco.Web.UI.Client/src/libs/extension-api/create-extension-api.function.ts index d5442d9e72..83026a79be 100644 --- a/src/Umbraco.Web.UI.Client/src/libs/extension-api/create-extension-api.function.ts +++ b/src/Umbraco.Web.UI.Client/src/libs/extension-api/create-extension-api.function.ts @@ -4,7 +4,7 @@ import { loadExtensionApi } from './load-extension-api.function.js'; //TODO: Write tests for this method: export async function createExtensionApi( - manifest: ManifestApi | ManifestElementAndApi, + manifest: ManifestApi | ManifestElementAndApi, constructorArguments: unknown[] ): Promise { const js = await loadExtensionApi(manifest); diff --git a/src/Umbraco.Web.UI.Client/src/libs/extension-api/create-extension-element.function.ts b/src/Umbraco.Web.UI.Client/src/libs/extension-api/create-extension-element.function.ts index f659829b0a..448146a2c8 100644 --- a/src/Umbraco.Web.UI.Client/src/libs/extension-api/create-extension-element.function.ts +++ b/src/Umbraco.Web.UI.Client/src/libs/extension-api/create-extension-element.function.ts @@ -3,11 +3,12 @@ import type { HTMLElementConstructor, ManifestElement } from './types.js'; import { loadExtensionElement } from './load-extension-element.function.js'; export async function createExtensionElement( - manifest: ManifestElement + manifest: ManifestElement, defaultElement?: string ): Promise { //TODO: Write tests for these extension options: const js = await loadExtensionElement(manifest); + console.log("defaultElement", defaultElement) if (isManifestElementNameType(manifest)) { // created by manifest method providing HTMLElement return document.createElement(manifest.elementName) as ElementType; @@ -23,18 +24,16 @@ export async function createExtensionElement( // Element will be created by default class return new js.default(); } + } - // If some JS was loaded and manifest did not have a elementName neither it the JS file contain a default export, so we will fail: - console.error( - '-- Extension did not succeed creating an element, missing a default export of the served JavaScript file', - manifest - ); - return undefined; + + if(defaultElement) { + return document.createElement(defaultElement) as ElementType; } // If some JS was loaded and manifest did not have a elementName neither it the JS file contain a default export, so we will fail: console.error( - '-- Extension did not succeed creating an element, missing a default export or `elementName` in the manifest.', + '-- Extension did not succeed creating an element, missing a `element` or `default` export of the JavaScript file or `elementName` in the manifest.', manifest ); return undefined; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/action/action.interface.ts b/src/Umbraco.Web.UI.Client/src/packages/core/action/action.interface.ts index 3306f2868a..11eff0690d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/action/action.interface.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/action/action.interface.ts @@ -2,6 +2,6 @@ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api export interface UmbAction { host: UmbControllerHostElement; - repository: RepositoryType; + repository?: RepositoryType; execute(): Promise; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection-entity-type.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection-entity-type.condition.ts new file mode 100644 index 0000000000..0623088f89 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection-entity-type.condition.ts @@ -0,0 +1,42 @@ + +import { UMB_COLLECTION_CONTEXT } from './collection.context.js'; +import { UmbBaseController } from '@umbraco-cms/backoffice/controller-api'; +import { + ManifestCondition, + UmbConditionConfigBase, + UmbConditionControllerArguments, + UmbExtensionCondition, +} from '@umbraco-cms/backoffice/extension-api'; + +export class UmbCollectionEntityTypeCondition extends UmbBaseController implements UmbExtensionCondition { + config: CollectionEntityTypeConditionConfig; + permitted = false; + #onChange: () => void; + + constructor(args: UmbConditionControllerArguments) { + super(args.host); + this.config = args.config; + this.#onChange = args.onChange; + this.consumeContext(UMB_COLLECTION_CONTEXT, (context) => { + this.permitted = context.getEntityType().toLowerCase() === this.config.match.toLowerCase(); + this.#onChange(); + }); + } +} + +export type CollectionEntityTypeConditionConfig = UmbConditionConfigBase<'Umb.Condition.CollectionEntityType'> & { + /** + * Define the workspace that this extension should be available in + * + * @example + * "Document" + */ + match: string; +}; + +export const manifest: ManifestCondition = { + type: 'condition', + name: 'Collection Entity Type Condition', + alias: 'Umb.Condition.CollectionEntityType', + api: UmbCollectionEntityTypeCondition, +}; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection-selection-actions.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection-selection-actions.element.ts index ae694f4fe4..8a6998f91d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection-selection-actions.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection-selection-actions.element.ts @@ -1,14 +1,11 @@ import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { css, html, nothing, customElement, state } from '@umbraco-cms/backoffice/external/lit'; -import { map } from '@umbraco-cms/backoffice/external/rxjs'; -import { UMB_COLLECTION_CONTEXT_TOKEN, UmbCollectionContext } from '@umbraco-cms/backoffice/collection'; -import { ManifestEntityBulkAction, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; +import { UMB_COLLECTION_CONTEXT, UmbCollectionContext } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import { UmbExecutedEvent } from '@umbraco-cms/backoffice/events'; @customElement('umb-collection-selection-actions') export class UmbCollectionSelectionActionsElement extends UmbLitElement { - #entityType?: string; @state() private _nodesLength = 0; @@ -16,22 +13,13 @@ export class UmbCollectionSelectionActionsElement extends UmbLitElement { @state() private _selectionLength = 0; - @state() - private _entityBulkActions: Array = []; - private _collectionContext?: UmbCollectionContext; - private _selection: Array = []; constructor() { super(); - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this._collectionContext = instance; this._observeCollectionContext(); - - if (instance.getEntityType()) { - this.#entityType = instance.getEntityType() ?? undefined; - this.#observeEntityBulkActions(); - } }); } @@ -55,29 +43,12 @@ export class UmbCollectionSelectionActionsElement extends UmbLitElement { this.observe(this._collectionContext.selection, (selection) => { this._selectionLength = selection.length; - this._selection = selection; }, 'observeSelection'); } private _renderSelectionCount() { return html`
${this._selectionLength} of ${this._nodesLength} selected
`; } - - // TODO: find a solution to use extension slot - #observeEntityBulkActions() { - this.observe( - umbExtensionsRegistry.extensionsOfType('entityBulkAction').pipe( - map((extensions) => { - return extensions.filter((extension) => extension.conditions.entityType === this.#entityType); - }) - ), - (bulkActions) => { - this._entityBulkActions = bulkActions; - } - , 'observeEntityBulkActions' - ); - } - #onActionExecuted(event: UmbExecutedEvent) { event.stopPropagation(); this._collectionContext?.clearSelection(); @@ -97,15 +68,8 @@ export class UmbCollectionSelectionActionsElement extends UmbLitElement { ${this._renderSelectionCount()} -
- ${this._entityBulkActions?.map( - (manifest) => - html`` - )} -
+ + `; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection.context.ts b/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection.context.ts index 814f3b3573..876a8ef5cc 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection.context.ts @@ -1,3 +1,4 @@ +import { UmbCollectionRepository } from '@umbraco-cms/backoffice/repository'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; import { @@ -8,13 +9,12 @@ import { } from '@umbraco-cms/backoffice/observable-api'; import { createExtensionApi } from '@umbraco-cms/backoffice/extension-api'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; -import { UmbCollectionRepository } from '@umbraco-cms/backoffice/repository'; import type { UmbCollectionFilterModel } from '@umbraco-cms/backoffice/collection'; // TODO: Clean up the need for store as Media has switched to use Repositories(repository). export class UmbCollectionContext { private _host: UmbControllerHostElement; - private _entityType: string | null; + private _entityType: string; protected _dataObserver?: UmbObserverController; @@ -38,7 +38,7 @@ export class UmbCollectionContext>('UmbCollectionContext'); +export const UMB_COLLECTION_CONTEXT = new UmbContextToken>('UmbCollectionContext'); diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection.element.ts index 965e832c97..3818a19ef9 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/collection/collection.element.ts @@ -1,7 +1,7 @@ import { UmbTextStyles } from "@umbraco-cms/backoffice/style"; import { css, html, nothing, customElement, state, property } from '@umbraco-cms/backoffice/external/lit'; import { map } from '@umbraco-cms/backoffice/external/rxjs'; -import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UmbCollectionContext, UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { createExtensionElement } from '@umbraco-cms/backoffice/extension-api'; import { ManifestCollectionView, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; @@ -36,7 +36,7 @@ export class UmbCollectionElement extends UmbLitElement { constructor() { super(); - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this._collectionContext = instance; this._observeCollectionContext(); }); diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/collection/dashboards/dashboard-collection.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/collection/dashboards/dashboard-collection.element.ts index ac060fd291..86c78ddec0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/collection/dashboards/dashboard-collection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/collection/dashboards/dashboard-collection.element.ts @@ -1,5 +1,5 @@ import { css, html, customElement, state, ifDefined } from '@umbraco-cms/backoffice/external/lit'; -import { UMB_COLLECTION_CONTEXT_TOKEN, UmbCollectionContext } from '@umbraco-cms/backoffice/collection'; +import { UMB_COLLECTION_CONTEXT, UmbCollectionContext } from '@umbraco-cms/backoffice/collection'; import type { ManifestDashboardCollection } from '@umbraco-cms/backoffice/extension-registry'; import type { FolderTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; @@ -23,7 +23,7 @@ export class UmbDashboardCollectionElement extends UmbLitElement { const repositoryAlias = this.manifest.meta.repositoryAlias; this._entityType = this.manifest.conditions.entityType; this._collectionContext = new UmbCollectionContext(this, this._entityType, repositoryAlias); - this.provideContext(UMB_COLLECTION_CONTEXT_TOKEN, this._collectionContext); + this.provideContext(UMB_COLLECTION_CONTEXT, this._collectionContext); } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/collection/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/collection/index.ts index e000c638f2..e798aa9b7e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/collection/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/collection/index.ts @@ -1,3 +1,4 @@ export * from './collection.context.js'; export * from './collection-filter-model.interface.js'; export * from './collection-selection-actions.element.js'; +export { type CollectionEntityTypeConditionConfig } from './collection-entity-type.condition.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/collection/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/collection/manifests.ts new file mode 100644 index 0000000000..f921c9c7e0 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/collection/manifests.ts @@ -0,0 +1,3 @@ +import { manifest as collectionEntityTypeCondition } from './collection-entity-type.condition.js'; + +export const manifests = [collectionEntityTypeCondition]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/components/extension-slot/extension-slot.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/components/extension-slot/extension-slot.element.ts index 2a13311cb7..73e439942c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/components/extension-slot/extension-slot.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/components/extension-slot/extension-slot.element.ts @@ -92,7 +92,7 @@ export class UmbExtensionSlotElement extends UmbLitElement { #props?: Record = {}; @property({ type: String, attribute: 'default-element' }) - public defaultElement = ''; + public defaultElement?:string; @property() public renderMethod?: (extension: UmbExtensionElementController) => TemplateResult | HTMLElement | null | undefined; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.element.ts index 02613601cb..f0609fa470 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.element.ts @@ -40,7 +40,7 @@ export class UmbEntityActionElement extends UmbLitElement { if (!this._manifest) return; if (this._unique === undefined) return; - this.#api = createExtensionApi(this._manifest, [this._manifest.meta.repositoryAlias, this.unique]); + this.#api = createExtensionApi(this._manifest, [this, this._manifest.meta.repositoryAlias, this.unique]); // TODO: Fix so when we use a HREF it does not refresh the page? this._href = await this.#api.getHref?.(); diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-bulk-action/entity-bulk-action.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-bulk-action/entity-bulk-action.element.ts index 92dd3c9e40..1b8de317e0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-bulk-action/entity-bulk-action.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-bulk-action/entity-bulk-action.element.ts @@ -36,8 +36,9 @@ export class UmbEntityBulkActionElement extends UmbLitElement { } async #createApi() { - if (!this._manifest?.meta.api) return; - this.#api = await createExtensionApi(this._manifest, [this._manifest.meta.repositoryAlias, this._selection]); + if (!this._manifest) return; + + this.#api = await createExtensionApi(this._manifest, [this, this._manifest.meta.repositoryAlias, this._selection]); } #api?: UmbEntityBulkAction; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/conditions/types.ts b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/conditions/types.ts index 943dbe8d41..e655d3211f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/conditions/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/conditions/types.ts @@ -1,14 +1,19 @@ import type { SectionAliasConditionConfig } from './section-alias.condition.js'; import type { SwitchConditionConfig } from './switch.condition.js'; -import type { WorkspaceAliasConditionConfig } from '@umbraco-cms/backoffice/workspace'; +import type { WorkspaceAliasConditionConfig, WorkspaceEntityTypeConditionConfig } from '@umbraco-cms/backoffice/workspace'; import type { UmbConditionConfigBase } from '@umbraco-cms/backoffice/extension-api'; import type { UserPermissionConditionConfig } from '@umbraco-cms/backoffice/current-user'; +import type { CollectionEntityTypeConditionConfig } from '@umbraco-cms/backoffice/collection'; /* TODO: in theory should't the core package import from other packages. -Are there any other way we can do this? */ +Are there any other way we can do this? +Niels: Sadly I don't see any other solutions currently. But are very open for ideas :-) now that I think about it maybe there is some ability to extend a global type, similar to the 'declare global' trick we use on Elements. +*/ export type ConditionTypes = + | CollectionEntityTypeConditionConfig | SectionAliasConditionConfig | WorkspaceAliasConditionConfig + | WorkspaceEntityTypeConditionConfig | SwitchConditionConfig | UserPermissionConditionConfig | UmbConditionConfigBase; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/entity-bulk-action.model.ts b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/entity-bulk-action.model.ts index 91549890eb..0d4b881e76 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/entity-bulk-action.model.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/models/entity-bulk-action.model.ts @@ -1,10 +1,12 @@ -import type { ManifestElementAndApi, ManifestWithConditions } from '@umbraco-cms/backoffice/extension-api'; +import type { ConditionTypes } from '../conditions/types.js'; +import type { UmbEntityBulkAction } from '@umbraco-cms/backoffice/entity-bulk-action'; +import type { ManifestElementAndApi, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api'; /** * An action to perform on multiple entities * For example for content you may wish to move one or more documents in bulk */ -export interface ManifestEntityBulkAction extends ManifestElementAndApi, ManifestWithConditions { +export interface ManifestEntityBulkAction extends ManifestElementAndApi, ManifestWithDynamicConditions { type: 'entityBulkAction'; meta: MetaEntityBulkAction; } @@ -25,17 +27,3 @@ export interface MetaEntityBulkAction { */ repositoryAlias: string; } - -export interface ConditionsEntityBulkAction { - /** - * The entity type this action is for - * - * @examples [ - * "document", - * "media", - * "user", - * "user-group" - * ] - */ - entityType: string; -} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/index.ts index a3f9d00ddc..1bed69d3e5 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/index.ts @@ -4,6 +4,7 @@ import { manifests as localizationManifests } from './localization/manifests.js' import { manifests as propertyActionManifests } from './property-action/manifests.js'; import { manifests as propertyEditorManifests } from './property-editor/manifests.js'; import { manifests as tinyMcePluginManifests } from './property-editor/uis/tiny-mce/plugins/manifests.js'; +import { manifests as collectionManifests } from './collection/manifests.js'; import { manifests as workspaceManifests } from './workspace/manifests.js'; import { manifests as modalManifests } from './modal/common/manifests.js'; import { manifests as themeManifests } from './themes/manifests.js'; @@ -22,7 +23,6 @@ import { export * from './localization/index.js'; export * from './action/index.js'; -export * from './collection/index.js'; export * from './components/index.js'; export * from './content-type/index.js'; export * from './debug/index.js'; @@ -52,6 +52,7 @@ const manifests: Array = [ ...propertyActionManifests, ...propertyEditorManifests, ...tinyMcePluginManifests, + ...collectionManifests, ...workspaceManifests, ...modalManifests, ...themeManifests, diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/section/section-sidebar-context-menu/section-sidebar-context-menu.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/section/section-sidebar-context-menu/section-sidebar-context-menu.element.ts index 600be4c570..48218ba73e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/section/section-sidebar-context-menu/section-sidebar-context-menu.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/section/section-sidebar-context-menu/section-sidebar-context-menu.element.ts @@ -75,7 +75,7 @@ export class UmbSectionSidebarContextMenuElement extends UmbLitElement { ? html`

${this._headline}

` diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/index.ts index b03f096011..2bca6d682d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/index.ts @@ -1,7 +1,8 @@ export * from './variant-context/index.js'; export * from './workspace-action-menu/index.js'; export * from './workspace-action/index.js'; -export * from './workspace-alias.condition.js'; +export type { WorkspaceAliasConditionConfig } from './workspace-alias.condition.js'; +export type { WorkspaceEntityTypeConditionConfig } from './workspace-entity-type.condition.js'; export * from './workspace-context/index.js'; export * from './workspace-editor/index.js'; export * from './workspace-footer/index.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/manifests.ts index 0ff1588392..80ad04072c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/manifests.ts @@ -1,4 +1,5 @@ import { manifests as workspaceModals } from './workspace-modal/manifests.js'; -import { manifest as workspaceCondition } from './workspace-alias.condition.js'; +import { manifest as workspaceAliasCondition } from './workspace-alias.condition.js'; +import { manifest as workspaceEntityTypeCondition } from './workspace-entity-type.condition.js'; -export const manifests = [...workspaceModals, workspaceCondition]; +export const manifests = [...workspaceModals, workspaceAliasCondition, workspaceEntityTypeCondition]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-action-menu/workspace-action-menu.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-action-menu/workspace-action-menu.element.ts index 3f78226d8a..5b4a902a6c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-action-menu/workspace-action-menu.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-action-menu/workspace-action-menu.element.ts @@ -56,7 +56,7 @@ export class UmbWorkspaceActionMenuElement extends UmbLitElement {
diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-content/views/collection/workspace-view-collection.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-content/views/collection/workspace-view-collection.element.ts index d673c0e796..573be83239 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-content/views/collection/workspace-view-collection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-content/views/collection/workspace-view-collection.element.ts @@ -1,6 +1,6 @@ import { css, html, customElement, ifDefined } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from "@umbraco-cms/backoffice/style"; -import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UmbCollectionContext, UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import type { FolderTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api'; import type { ManifestWorkspaceViewCollection } from '@umbraco-cms/backoffice/extension-registry'; @@ -34,7 +34,7 @@ export class UmbWorkspaceViewCollectionElement extends UmbLitElement { const manifestMeta = this.manifest.meta; this._collectionContext = new UmbCollectionContext(this, entityType, manifestMeta.repositoryAlias); - this.provideContext(UMB_COLLECTION_CONTEXT_TOKEN, this._collectionContext); + this.provideContext(UMB_COLLECTION_CONTEXT, this._collectionContext); } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-entity-type.condition.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-entity-type.condition.ts new file mode 100644 index 0000000000..8ec90a1a7a --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/workspace-entity-type.condition.ts @@ -0,0 +1,41 @@ +import { UMB_WORKSPACE_CONTEXT } from './workspace-context/index.js'; +import { UmbBaseController } from '@umbraco-cms/backoffice/controller-api'; +import { + ManifestCondition, + UmbConditionConfigBase, + UmbConditionControllerArguments, + UmbExtensionCondition, +} from '@umbraco-cms/backoffice/extension-api'; + +export class UmbWorkspaceEntityTypeCondition extends UmbBaseController implements UmbExtensionCondition { + config: WorkspaceEntityTypeConditionConfig; + permitted = false; + #onChange: () => void; + + constructor(args: UmbConditionControllerArguments) { + super(args.host); + this.config = args.config; + this.#onChange = args.onChange; + this.consumeContext(UMB_WORKSPACE_CONTEXT, (context) => { + this.permitted = context.getEntityType().toLowerCase() === this.config.match.toLowerCase(); + this.#onChange(); + }); + } +} + +export type WorkspaceEntityTypeConditionConfig = UmbConditionConfigBase<'Umb.Condition.WorkspaceEntityType'> & { + /** + * Define the workspace that this extension should be available in + * + * @example + * "Document" + */ + match: string; +}; + +export const manifest: ManifestCondition = { + type: 'condition', + name: 'Workspace Entity Type Condition', + alias: 'Umb.Condition.WorkspaceEntityType', + api: UmbWorkspaceEntityTypeCondition, +}; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/column-layouts/document-table-actions-column-layout.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/column-layouts/document-table-actions-column-layout.element.ts index 083ed5cb3e..c98150e397 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/column-layouts/document-table-actions-column-layout.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/column-layouts/document-table-actions-column-layout.element.ts @@ -54,7 +54,7 @@ export class UmbDocumentTableActionColumnLayoutElement extends LitElement {
diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts index afd29395bc..b81b17449d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts @@ -10,7 +10,7 @@ import { UmbTableOrderedEvent, UmbTableSelectedEvent, } from '@umbraco-cms/backoffice/components'; -import { UMB_COLLECTION_CONTEXT_TOKEN, UmbCollectionContext } from '@umbraco-cms/backoffice/collection'; +import { UMB_COLLECTION_CONTEXT, UmbCollectionContext } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import { DocumentTreeItemResponseModel, EntityTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api'; @@ -54,7 +54,7 @@ export class UmbDocumentTableCollectionViewElement extends UmbLitElement { constructor() { super(); - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this._collectionContext = instance; this._observeCollectionContext(); }); diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-bulk-actions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-bulk-actions/manifests.ts index 7a27eaa9aa..d4a5820bef 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-bulk-actions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-bulk-actions/manifests.ts @@ -16,9 +16,10 @@ const entityActions: Array = [ label: 'Move', repositoryAlias: DOCUMENT_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, { type: 'entityBulkAction', @@ -30,9 +31,10 @@ const entityActions: Array = [ label: 'Copy', repositoryAlias: DOCUMENT_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/collection-view/media-grid-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/collection-view/media-grid-collection-view.element.ts index a27955c0d3..e11ca15d4d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/collection-view/media-grid-collection-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/collection-view/media-grid-collection-view.element.ts @@ -1,6 +1,6 @@ import { UmbTextStyles } from "@umbraco-cms/backoffice/style"; import { css, html, customElement, state, repeat } from '@umbraco-cms/backoffice/external/lit'; -import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UmbCollectionContext, UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import { EntityTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api'; @@ -19,7 +19,7 @@ export class UmbMediaGridCollectionViewElement extends UmbLitElement { document.addEventListener('dragenter', this._handleDragEnter.bind(this)); document.addEventListener('dragleave', this._handleDragLeave.bind(this)); document.addEventListener('drop', this._handleDrop.bind(this)); - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this._collectionContext = instance; this._observeCollectionContext(); }); diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/collection-view/media-table-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/collection-view/media-table-collection-view.element.ts index 0f021b3651..7f5b688fda 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/collection-view/media-table-collection-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/collection-view/media-table-collection-view.element.ts @@ -10,7 +10,7 @@ import type { UmbTableOrderedEvent, UmbTableSelectedEvent, } from '@umbraco-cms/backoffice/components'; -import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UmbCollectionContext, UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import { EntityTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api'; @@ -42,7 +42,7 @@ export class UmbMediaTableCollectionViewElement extends UmbLitElement { constructor() { super(); - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this._collectionContext = instance; this._observeCollectionContext(); }); diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/entity-bulk-actions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/entity-bulk-actions/manifests.ts index 6d57fff5b0..f35eaf374e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/entity-bulk-actions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/entity-bulk-actions/manifests.ts @@ -17,9 +17,10 @@ const entityActions: Array = [ label: 'Move', repositoryAlias: MEDIA_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, { type: 'entityBulkAction', @@ -31,9 +32,10 @@ const entityActions: Array = [ label: 'Copy', repositoryAlias: MEDIA_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, { type: 'entityBulkAction', @@ -45,9 +47,10 @@ const entityActions: Array = [ label: 'Trash', repositoryAlias: MEDIA_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/settings/languages/workspace/language-root/components/language-root-table-delete-column-layout.element.ts b/src/Umbraco.Web.UI.Client/src/packages/settings/languages/workspace/language-root/components/language-root-table-delete-column-layout.element.ts index b90b38f424..7b1b88a777 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/settings/languages/workspace/language-root/components/language-root-table-delete-column-layout.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/settings/languages/workspace/language-root/components/language-root-table-delete-column-layout.element.ts @@ -35,7 +35,7 @@ export class UmbLanguageRootTableDeleteColumnLayoutElement extends UmbLitElement diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection-header.element.ts b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection-header.element.ts index d2034339a4..a53ae056da 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection-header.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection-header.element.ts @@ -1,7 +1,7 @@ import { UmbUserGroupCollectionContext } from './user-group-collection.context.js'; import { UUIInputEvent } from '@umbraco-cms/backoffice/external/uui'; import { css, html, customElement } from '@umbraco-cms/backoffice/external/lit'; -import { UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; @customElement('umb-user-group-collection-header') @@ -11,7 +11,7 @@ export class UmbUserGroupCollectionHeaderElement extends UmbLitElement { constructor() { super(); - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this.#collectionContext = instance as UmbUserGroupCollectionContext; }); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection-view.element.ts index 008728d42a..db6a62353f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection-view.element.ts @@ -2,7 +2,7 @@ import { UmbUserGroupCollectionContext } from './user-group-collection.context.j import { UmbTextStyles } from "@umbraco-cms/backoffice/style"; import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; -import { UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UserGroupResponseModel } from '@umbraco-cms/backoffice/backend-api'; import './user-group-table-name-column-layout.element.js'; @@ -59,7 +59,7 @@ export class UmbUserGroupCollectionViewElement extends UmbLitElement { constructor() { super(); - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this.#collectionContext = instance; this.observe(this.#collectionContext.selection, (selection) => (this._selection = selection)); this.observe(this.#collectionContext.items, (items) => { diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection.element.ts b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection.element.ts index 31886d123e..357a8e559b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/collection/user-group-collection.element.ts @@ -1,7 +1,7 @@ import { UmbUserGroupCollectionContext } from './user-group-collection.context.js'; import { css, html, customElement } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from "@umbraco-cms/backoffice/style"; -import { UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import './user-group-collection-view.element.js'; @@ -13,7 +13,7 @@ export class UmbUserCollectionElement extends UmbLitElement { connectedCallback(): void { super.connectedCallback(); - this.provideContext(UMB_COLLECTION_CONTEXT_TOKEN, this.#collectionContext); + this.provideContext(UMB_COLLECTION_CONTEXT, this.#collectionContext); } render() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/entity-bulk-actions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/entity-bulk-actions/manifests.ts index f4aad28212..b3e24352dc 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/entity-bulk-actions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/entity-bulk-actions/manifests.ts @@ -15,9 +15,10 @@ const entityActions: Array = [ label: 'Delete', repositoryAlias: USER_GROUP_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/user-collection-header.element.ts b/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/user-collection-header.element.ts index 2f190f9f5b..bb440ee9c9 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/user-collection-header.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/user-collection-header.element.ts @@ -8,7 +8,7 @@ import { import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import { UmbDropdownElement } from '@umbraco-cms/backoffice/components'; -import { UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UMB_CREATE_USER_MODAL, UMB_INVITE_USER_MODAL, @@ -46,7 +46,7 @@ export class UmbUserCollectionHeaderElement extends UmbLitElement { this.#modalContext = instance; }); - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this.#collectionContext = instance as UmbUserCollectionContext; }); } @@ -124,7 +124,7 @@ export class UmbUserCollectionHeaderElement extends UmbLitElement { - : + :
diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/user-collection.element.ts b/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/user-collection.element.ts index 968db62614..1f2ea624e5 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/user-collection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/user-collection.element.ts @@ -1,7 +1,7 @@ import { UmbUserCollectionContext } from './user-collection.context.js'; import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from "@umbraco-cms/backoffice/style"; -import { UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import type { UmbRoute } from '@umbraco-cms/backoffice/router'; @@ -30,7 +30,7 @@ export class UmbUserCollectionElement extends UmbLitElement { connectedCallback(): void { super.connectedCallback(); - this.provideContext(UMB_COLLECTION_CONTEXT_TOKEN, this.#collectionContext); + this.provideContext(UMB_COLLECTION_CONTEXT, this.#collectionContext); } render() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/views/grid/user-collection-grid-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/views/grid/user-collection-grid-view.element.ts index 7d9df20e55..33c20f53ab 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/views/grid/user-collection-grid-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/views/grid/user-collection-grid-view.element.ts @@ -3,7 +3,7 @@ import { UmbUserCollectionContext } from '../../user-collection.context.js'; import { type UmbUserDetail } from '../../../types.js'; import { css, html, nothing, customElement, state, repeat, ifDefined } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from "@umbraco-cms/backoffice/style"; -import { UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import { UserStateModel } from '@umbraco-cms/backoffice/backend-api'; @@ -22,7 +22,7 @@ export class UmbUserCollectionGridViewElement extends UmbLitElement { //TODO: Get user group names - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this.#collectionContext = instance as UmbUserCollectionContext; this.observe(this.#collectionContext.selection, (selection) => (this._selection = selection)); this.observe(this.#collectionContext.items, (items) => (this._users = items)); diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/views/table/user-collection-table-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/views/table/user-collection-table-view.element.ts index 3fb57752f1..38d5175e59 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/views/table/user-collection-table-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/users/collection/views/table/user-collection-table-view.element.ts @@ -16,7 +16,7 @@ import { UmbTableOrderedEvent, } from '@umbraco-cms/backoffice/components'; import type { UserGroupEntity } from '@umbraco-cms/backoffice/user-group'; -import { UMB_COLLECTION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/collection'; +import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import './column-layouts/name/user-table-name-column-layout.element.js'; @@ -75,7 +75,7 @@ export class UmbUserCollectionTableViewElement extends UmbLitElement { this._observeUserGroups(); }); - this.consumeContext(UMB_COLLECTION_CONTEXT_TOKEN, (instance) => { + this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => { this.#collectionContext = instance as UmbUserCollectionContext; this.observe(this.#collectionContext.selection, (selection) => (this._selection = selection)); this.observe(this.#collectionContext.items, (items) => (this._users = items)); diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/users/entity-bulk-actions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/users/users/entity-bulk-actions/manifests.ts index ce5780dede..e06c06f4e2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/users/entity-bulk-actions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/users/entity-bulk-actions/manifests.ts @@ -18,9 +18,10 @@ const entityActions: Array = [ label: 'SetGroup', repositoryAlias: USER_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, { type: 'entityBulkAction', @@ -32,9 +33,10 @@ const entityActions: Array = [ label: 'Enable', repositoryAlias: USER_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, { type: 'entityBulkAction', @@ -46,9 +48,10 @@ const entityActions: Array = [ label: 'Unlock', repositoryAlias: USER_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, { type: 'entityBulkAction', @@ -60,9 +63,10 @@ const entityActions: Array = [ label: 'Disable', repositoryAlias: USER_REPOSITORY_ALIAS, }, - conditions: { - entityType, - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: entityType, + }], }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/shared/umb-events/executed.event.ts b/src/Umbraco.Web.UI.Client/src/shared/umb-events/executed.event.ts index 76bf95a2b2..b297740a40 100644 --- a/src/Umbraco.Web.UI.Client/src/shared/umb-events/executed.event.ts +++ b/src/Umbraco.Web.UI.Client/src/shared/umb-events/executed.event.ts @@ -1,5 +1,5 @@ export class UmbExecutedEvent extends Event { public constructor() { - super('executed', { bubbles: true, composed: true, cancelable: false }); + super('action-executed', { bubbles: true, composed: true, cancelable: false }); } } diff --git a/src/Umbraco.Web.UI.Client/storybook/stories/extending/entity-actions.mdx b/src/Umbraco.Web.UI.Client/storybook/stories/extending/entity-actions.mdx index 7f02963420..52c8a3649b 100644 --- a/src/Umbraco.Web.UI.Client/storybook/stories/extending/entity-actions.mdx +++ b/src/Umbraco.Web.UI.Client/storybook/stories/extending/entity-actions.mdx @@ -184,9 +184,10 @@ const manifest = { label: 'My Entity Bulk Action', repositoryAlias: 'My.Repository', }, - conditions: { - entityType: 'my-entity', - }, + conditions: [{ + alias: 'Umb.Condition.CollectionEntityType', + match: 'my-entity-type', + }], }; extensionRegistry.register(manifest);