workspace editor views
This commit is contained in:
@@ -36,11 +36,14 @@ class UmbTestExtensionController extends UmbBaseExtensionController {
|
||||
type myTestManifests = ManifestWithDynamicConditions | ManifestCondition;
|
||||
const testExtensionRegistry = new UmbExtensionRegistry<myTestManifests>();
|
||||
|
||||
type myTestManifestTypesUnion = 'extension-type-extra' | 'extension-type';
|
||||
type myTestManifestTypes = myTestManifestTypesUnion | myTestManifestTypesUnion[];
|
||||
|
||||
class UmbTestExtensionsController<
|
||||
MyPermittedControllerType extends UmbTestExtensionController = PermittedControllerType<UmbTestExtensionController>
|
||||
> extends UmbBaseExtensionsController<
|
||||
myTestManifests,
|
||||
'extension-type',
|
||||
myTestManifestTypesUnion,
|
||||
ManifestWithDynamicConditions,
|
||||
UmbTestExtensionController,
|
||||
MyPermittedControllerType
|
||||
@@ -49,7 +52,7 @@ class UmbTestExtensionsController<
|
||||
constructor(
|
||||
host: UmbControllerHost,
|
||||
extensionRegistry: UmbExtensionRegistry<ManifestWithDynamicConditions>,
|
||||
type: 'extension-type',
|
||||
type: myTestManifestTypes,
|
||||
filter: null | ((manifest: ManifestWithDynamicConditions) => boolean),
|
||||
onChange: (permittedManifests: Array<MyPermittedControllerType>, controller: MyPermittedControllerType) => void
|
||||
) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import { UmbModalBaseElement } from '@umbraco-cms/internal/modal';
|
||||
import { UmbPropertySettingsModalResult, UmbPropertySettingsModalData } from '@umbraco-cms/backoffice/modal';
|
||||
import { generateAlias } from '@umbraco-cms/backoffice/utils';
|
||||
// TODO: Could base take a token to get its types?.
|
||||
// TODO: Missing a workspace context... unless this should not be a workspace any way.
|
||||
@customElement('umb-property-settings-modal')
|
||||
export class UmbPropertySettingsModalElement extends UmbModalBaseElement<
|
||||
UmbPropertySettingsModalData,
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
ManifestWorkspaceViewCollection,
|
||||
umbExtensionsRegistry,
|
||||
} from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { UmbExtensionsElementController, createExtensionElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { UmbExtensionsManifestController, createExtensionElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import { componentHasManifestProperty } from '@umbraco-cms/backoffice/utils';
|
||||
@@ -36,26 +36,15 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
|
||||
@property({ type: Boolean })
|
||||
public enforceNoFooter = false;
|
||||
|
||||
private _alias = '';
|
||||
// TODO: Revisit if we can remove the alias from the workspace-editor. Its not used for anything, as the context now takes care of it.
|
||||
/**
|
||||
* Alias of the workspace. The Layout will render the workspace views that are registered for this workspace alias.
|
||||
* Alias of the workspace. Currently not used for anything.
|
||||
* @public
|
||||
* @type {string}
|
||||
* @type {string | undefined}
|
||||
* @attr
|
||||
* @default ''
|
||||
*/
|
||||
@property()
|
||||
public get alias() {
|
||||
return this._alias;
|
||||
}
|
||||
public set alias(value) {
|
||||
const oldValue = this._alias;
|
||||
this._alias = value;
|
||||
if (oldValue !== this._alias) {
|
||||
this._observeWorkspaceViews();
|
||||
this.requestUpdate('alias', oldValue);
|
||||
}
|
||||
}
|
||||
public alias?: string;
|
||||
|
||||
@state()
|
||||
private _workspaceViews: Array<ManifestWorkspaceEditorView | ManifestWorkspaceViewCollection> = [];
|
||||
@@ -71,32 +60,18 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
new UmbExtensionsElementController(
|
||||
new UmbExtensionsManifestController(
|
||||
this,
|
||||
umbExtensionsRegistry,
|
||||
['workspaceEditorView', 'workspaceViewCollection'],
|
||||
null,
|
||||
(workspaceViews) => {
|
||||
this._workspaceViews = workspaceViews;
|
||||
this._workspaceViews = workspaceViews.map((view) => view.manifest);
|
||||
this._createRoutes();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private _observeWorkspaceViews() {
|
||||
this.observe(
|
||||
umbExtensionsRegistry.extensionsOfTypes<ManifestWorkspaceEditorView>([
|
||||
'workspaceEditorView',
|
||||
'workspaceViewCollection',
|
||||
]),
|
||||
(workspaceViews) => {
|
||||
this._workspaceViews = workspaceViews;
|
||||
this._createRoutes();
|
||||
},
|
||||
'_observeWorkspaceViews'
|
||||
);
|
||||
}
|
||||
|
||||
private _createRoutes() {
|
||||
this._routes = [];
|
||||
|
||||
@@ -142,7 +117,7 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
|
||||
${this.enforceNoFooter
|
||||
? ''
|
||||
: html`
|
||||
<umb-workspace-footer slot="footer" alias=${this.alias}>
|
||||
<umb-workspace-footer slot="footer">
|
||||
<slot name="footer-info"></slot>
|
||||
<slot name="actions" slot="actions"></slot>
|
||||
</umb-workspace-footer>
|
||||
|
||||
@@ -17,27 +17,6 @@ import { UMB_MODAL_CONTEXT_TOKEN, UmbModalContext } from '@umbraco-cms/backoffic
|
||||
// TODO: stop naming this something with layout. as its not just an layout. it hooks up with extensions.
|
||||
@customElement('umb-workspace-footer')
|
||||
export class UmbWorkspaceFooterLayoutElement extends UmbLitElement {
|
||||
private _alias = '';
|
||||
|
||||
/**
|
||||
* Alias of the workspace. The Layout will render the workspace actions that are registered for this workspace alias.
|
||||
* @public
|
||||
* @type {string}
|
||||
* @attr
|
||||
* @default ''
|
||||
*/
|
||||
@property()
|
||||
public get alias() {
|
||||
return this._alias;
|
||||
}
|
||||
public set alias(value) {
|
||||
const oldValue = this._alias;
|
||||
this._alias = value;
|
||||
if (oldValue !== this._alias) {
|
||||
this.requestUpdate('alias', oldValue);
|
||||
}
|
||||
}
|
||||
|
||||
@state()
|
||||
_withinModal = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user