workspace conditions
This commit is contained in:
@@ -4,11 +4,6 @@ import type { UmbSectionUserPermissionConditionConfig } from '../../section/cond
|
||||
import type { SectionAliasConditionConfig } from './section-alias.condition.js';
|
||||
import type { SwitchConditionConfig } from './switch.condition.js';
|
||||
import type { UmbMultipleAppLanguageConditionConfig } from './multiple-app-languages.condition.js';
|
||||
import type {
|
||||
WorkspaceAliasConditionConfig,
|
||||
WorkspaceEntityTypeConditionConfig,
|
||||
WorkspaceContentTypeAliasConditionConfig,
|
||||
} from '@umbraco-cms/backoffice/workspace';
|
||||
import type { UmbConditionConfigBase } from '@umbraco-cms/backoffice/extension-api';
|
||||
import type { UmbDocumentUserPermissionConditionConfig } from '@umbraco-cms/backoffice/document';
|
||||
|
||||
@@ -29,10 +24,7 @@ export type ConditionTypes =
|
||||
| UmbConditionConfigBase
|
||||
| UmbDocumentUserPermissionConditionConfig
|
||||
| UmbMultipleAppLanguageConditionConfig
|
||||
| UmbSectionUserPermissionConditionConfig
|
||||
| WorkspaceAliasConditionConfig
|
||||
| WorkspaceContentTypeAliasConditionConfig
|
||||
| WorkspaceEntityTypeConditionConfig;
|
||||
| UmbSectionUserPermissionConditionConfig;
|
||||
|
||||
type UnionOfProperties<T> = T extends object ? T[keyof T] : never;
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export const UMB_WORKSPACE_HAS_COLLECTION_CONDITION = 'Umb.Condition.WorkspaceHasCollection';
|
||||
@@ -1,5 +1 @@
|
||||
export type { WorkspaceAliasConditionConfig } from './workspace-alias.condition.js';
|
||||
export type { WorkspaceEntityTypeConditionConfig } from './workspace-entity-type.condition.js';
|
||||
export type { WorkspaceHasCollectionConditionConfig } from './workspace-has-collection.condition.js';
|
||||
export type { WorkspaceContentTypeAliasConditionConfig as WorkspaceEntityContentTypeConditionConfig } from './workspace-content-type-alias.condition.js';
|
||||
export type { WorkspaceContentTypeAliasConditionConfig } from './workspace-content-type-alias.condition.js';
|
||||
export type * from './types.js';
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import type { UMB_WORKSPACE_HAS_COLLECTION_CONDITION } from './const.js';
|
||||
import type { UmbConditionConfigBase } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
export type WorkspaceAliasConditionConfig = UmbConditionConfigBase<'Umb.Condition.WorkspaceAlias'> & {
|
||||
/**
|
||||
* Define the workspace that this extension should be available in
|
||||
* @example
|
||||
* "Umb.Workspace.Document"
|
||||
*/
|
||||
match?: string;
|
||||
/**
|
||||
* Define one or more workspaces that this extension should be available in
|
||||
* @example
|
||||
* ["Umb.Workspace.Document", "Umb.Workspace.Media"]
|
||||
*/
|
||||
oneOf?: Array<string>;
|
||||
};
|
||||
|
||||
export type WorkspaceContentTypeAliasConditionConfig =
|
||||
UmbConditionConfigBase<'Umb.Condition.WorkspaceContentTypeAlias'> & {
|
||||
/**
|
||||
* Define a content type alias in which workspace this extension should be available
|
||||
* @example
|
||||
* Depends on implementation, but i.e. "article", "image", "blockPage"
|
||||
*/
|
||||
match?: string;
|
||||
/**
|
||||
* Define one or more content type aliases in which workspace this extension should be available
|
||||
* @example
|
||||
* ["article", "image", "blockPage"]
|
||||
*/
|
||||
oneOf?: Array<string>;
|
||||
};
|
||||
|
||||
export type WorkspaceEntityTypeConditionConfig = UmbConditionConfigBase<'Umb.Condition.WorkspaceEntityType'> & {
|
||||
/**
|
||||
* Define the workspace that this extension should be available in
|
||||
* @example
|
||||
* "Document"
|
||||
*/
|
||||
match: string;
|
||||
};
|
||||
|
||||
export type WorkspaceHasCollectionConditionConfig = UmbConditionConfigBase<
|
||||
typeof UMB_WORKSPACE_HAS_COLLECTION_CONDITION
|
||||
>;
|
||||
@@ -1,8 +1,8 @@
|
||||
import { UMB_WORKSPACE_CONTEXT, type UmbWorkspaceContext } from '../contexts/index.js';
|
||||
import type { WorkspaceAliasConditionConfig } from './types.js';
|
||||
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type {
|
||||
ManifestCondition,
|
||||
UmbConditionConfigBase,
|
||||
UmbConditionControllerArguments,
|
||||
UmbExtensionCondition,
|
||||
} from '@umbraco-cms/backoffice/extension-api';
|
||||
@@ -34,21 +34,6 @@ export class UmbWorkspaceAliasCondition
|
||||
}
|
||||
}
|
||||
|
||||
export type WorkspaceAliasConditionConfig = UmbConditionConfigBase<'Umb.Condition.WorkspaceAlias'> & {
|
||||
/**
|
||||
* Define the workspace that this extension should be available in
|
||||
* @example
|
||||
* "Umb.Workspace.Document"
|
||||
*/
|
||||
match?: string;
|
||||
/**
|
||||
* Define one or more workspaces that this extension should be available in
|
||||
* @example
|
||||
* ["Umb.Workspace.Document", "Umb.Workspace.Media"]
|
||||
*/
|
||||
oneOf?: Array<string>;
|
||||
};
|
||||
|
||||
export const manifest: ManifestCondition = {
|
||||
type: 'condition',
|
||||
name: 'Workspace Alias Condition',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { UmbConditionBase } from '../../extension-registry/conditions/condition-base.controller.js';
|
||||
import type { WorkspaceContentTypeAliasConditionConfig } from './types.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UMB_PROPERTY_STRUCTURE_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace';
|
||||
import type {
|
||||
ManifestCondition,
|
||||
UmbConditionConfigBase,
|
||||
UmbConditionControllerArguments,
|
||||
UmbExtensionCondition,
|
||||
} from '@umbraco-cms/backoffice/extension-api';
|
||||
@@ -49,22 +49,6 @@ export class UmbWorkspaceContentTypeAliasCondition
|
||||
}
|
||||
}
|
||||
|
||||
export type WorkspaceContentTypeAliasConditionConfig =
|
||||
UmbConditionConfigBase<'Umb.Condition.WorkspaceContentTypeAlias'> & {
|
||||
/**
|
||||
* Define a content type alias in which workspace this extension should be available
|
||||
* @example
|
||||
* Depends on implementation, but i.e. "article", "image", "blockPage"
|
||||
*/
|
||||
match?: string;
|
||||
/**
|
||||
* Define one or more content type aliases in which workspace this extension should be available
|
||||
* @example
|
||||
* ["article", "image", "blockPage"]
|
||||
*/
|
||||
oneOf?: Array<string>;
|
||||
};
|
||||
|
||||
export const manifest: ManifestCondition = {
|
||||
type: 'condition',
|
||||
name: 'Workspace Content Type Alias Condition',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { UMB_WORKSPACE_CONTEXT } from '../contexts/index.js';
|
||||
import type { WorkspaceEntityTypeConditionConfig } from './types.js';
|
||||
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type {
|
||||
ManifestCondition,
|
||||
UmbConditionConfigBase,
|
||||
UmbConditionControllerArguments,
|
||||
UmbExtensionCondition,
|
||||
} from '@umbraco-cms/backoffice/extension-api';
|
||||
@@ -20,15 +20,6 @@ export class UmbWorkspaceEntityTypeCondition
|
||||
}
|
||||
}
|
||||
|
||||
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',
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { UMB_COLLECTION_WORKSPACE_CONTEXT } from '../contexts/tokens/collection-workspace.context-token.js';
|
||||
import type { WorkspaceHasCollectionConditionConfig } from './types.js';
|
||||
import { UMB_WORKSPACE_HAS_COLLECTION_CONDITION } from './const.js';
|
||||
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type {
|
||||
ManifestCondition,
|
||||
UmbConditionConfigBase,
|
||||
UmbConditionControllerArguments,
|
||||
UmbExtensionCondition,
|
||||
} from '@umbraco-cms/backoffice/extension-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
const ObserveSymbol = Symbol();
|
||||
|
||||
export class UmbWorkspaceHasCollectionCondition
|
||||
extends UmbConditionBase<WorkspaceHasCollectionConditionConfig>
|
||||
implements UmbExtensionCondition
|
||||
@@ -21,18 +24,12 @@ export class UmbWorkspaceHasCollectionCondition
|
||||
(hasCollection) => {
|
||||
this.permitted = hasCollection;
|
||||
},
|
||||
'observeHasCollection',
|
||||
ObserveSymbol,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export type WorkspaceHasCollectionConditionConfig = UmbConditionConfigBase<
|
||||
typeof UMB_WORKSPACE_HAS_COLLECTION_CONDITION
|
||||
>;
|
||||
|
||||
export const UMB_WORKSPACE_HAS_COLLECTION_CONDITION = 'Umb.Condition.WorkspaceHasCollection';
|
||||
|
||||
export const manifest: ManifestCondition = {
|
||||
type: 'condition',
|
||||
name: 'Workspace Has Collection Condition',
|
||||
|
||||
Reference in New Issue
Block a user