From fbd1971be9974de4b8ac092eacdc5a7f069827eb Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Mon, 23 Jan 2023 14:39:19 +0100 Subject: [PATCH] update import paths to observable-api --- .../shared/collection/collection.element.ts | 2 +- .../workspace-property.element.ts | 37 ++++++++++--------- .../src/core/stores/store.ts | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.element.ts index 4812e18d3a..2a75c95f73 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.element.ts @@ -9,7 +9,7 @@ import { createExtensionElement } from '@umbraco-cms/extensions-api'; import type { ManifestCollectionView, MediaDetails } from '@umbraco-cms/models'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry'; import { UmbLitElement } from '@umbraco-cms/element'; -import type { UmbObserverController } from 'src/core/observable-api/observer.controller'; +import type { UmbObserverController } from '@umbraco-cms/observable-api'; @customElement('umb-collection') export class UmbCollectionElement extends UmbLitElement { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace-property/workspace-property.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace-property/workspace-property.element.ts index d9f15582ed..8a8945effb 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace-property/workspace-property.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace-property/workspace-property.element.ts @@ -9,7 +9,7 @@ import type { DataTypePropertyData, ManifestPropertyEditorUI, ManifestTypes } fr import '../../property-actions/shared/property-action-menu/property-action-menu.element'; import '../../../../backoffice/shared/components/workspace/workspace-property-layout/workspace-property-layout.element'; -import { UmbObserverController } from 'src/core/observable-api/observer.controller'; +import { UmbObserverController } from '@umbraco-cms/observable-api'; import { UmbLitElement } from '@umbraco-cms/element'; /** @@ -49,10 +49,10 @@ export class UmbWorkspacePropertyElement extends UmbLitElement { ]; @state() - private _label?:string; + private _label?: string; @state() - private _description?:string; + private _description?: string; /** * Label. Name of the property @@ -98,7 +98,7 @@ export class UmbWorkspacePropertyElement extends UmbLitElement { private _propertyEditorUIAlias = ''; @property({ type: String, attribute: 'property-editor-ui-alias' }) public set propertyEditorUIAlias(value: string) { - if(this._propertyEditorUIAlias === value) return; + if (this._propertyEditorUIAlias === value) return; this._propertyEditorUIAlias = value; this._observePropertyEditorUI(); } @@ -110,7 +110,7 @@ export class UmbWorkspacePropertyElement extends UmbLitElement { * @attr * @default undefined */ - @property({attribute: false }) + @property({ attribute: false }) public set value(value: unknown) { this._propertyContext.setValue(value); } @@ -131,7 +131,6 @@ export class UmbWorkspacePropertyElement extends UmbLitElement { @state() private _element?: { value?: any; config?: any } & HTMLElement; // TODO: invent interface for propertyEditorUI. - private _propertyContext = new UmbWorkspacePropertyContext(this); private propertyEditorUIObserver?: UmbObserverController; @@ -139,7 +138,6 @@ export class UmbWorkspacePropertyElement extends UmbLitElement { private _valueObserver?: UmbObserverController; private _configObserver?: UmbObserverController; - constructor() { super(); @@ -149,21 +147,23 @@ export class UmbWorkspacePropertyElement extends UmbLitElement { this.observe(this._propertyContext.description, (description) => { this._description = description; }); - } private _onPropertyEditorChange = (e: CustomEvent) => { const target = e.composedPath()[0] as any; - this.value = target.value;// Sets value in context. + this.value = target.value; // Sets value in context. e.stopPropagation(); }; private _observePropertyEditorUI() { this.propertyEditorUIObserver?.destroy(); - this.propertyEditorUIObserver = this.observe(umbExtensionsRegistry.getByTypeAndAlias('propertyEditorUI', this._propertyEditorUIAlias), (manifest) => { - this._gotEditorUI(manifest); - }); + this.propertyEditorUIObserver = this.observe( + umbExtensionsRegistry.getByTypeAndAlias('propertyEditorUI', this._propertyEditorUIAlias), + (manifest) => { + this._gotEditorUI(manifest); + } + ); } private _gotEditorUI(manifest?: ManifestPropertyEditorUI | null) { @@ -183,33 +183,34 @@ export class UmbWorkspacePropertyElement extends UmbLitElement { this._valueObserver?.destroy(); this._configObserver?.destroy(); - if(this._element) { + if (this._element) { this._element.addEventListener('property-value-change', this._onPropertyEditorChange as any as EventListener); this._valueObserver = this.observe(this._propertyContext.value, (value) => { - if(this._element) { + if (this._element) { this._element.value = value; } }); this._configObserver = this.observe(this._propertyContext.config, (config) => { - if(this._element) { + if (this._element) { this._element.config = config; } }); } this.requestUpdate('element', oldValue); - }) .catch(() => { // TODO: loading JS failed so we should do some nice UI. (This does only happen if extension has a js prop, otherwise we concluded that no source was needed resolved the load.) }); } - render() { return html` - + ${this._renderPropertyActionMenu()}
${this._element}
diff --git a/src/Umbraco.Web.UI.Client/src/core/stores/store.ts b/src/Umbraco.Web.UI.Client/src/core/stores/store.ts index d2c8b8f8c7..f6fc600e5a 100644 --- a/src/Umbraco.Web.UI.Client/src/core/stores/store.ts +++ b/src/Umbraco.Web.UI.Client/src/core/stores/store.ts @@ -1,5 +1,5 @@ import type { Observable } from 'rxjs'; -import { UniqueBehaviorSubject } from '../observable-api/unique-behavior-subject'; +import { UniqueBehaviorSubject } from '@umbraco-cms/observable-api'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; export interface UmbDataStoreIdentifiers {