From 7d7988713c5a3be847ee489826a8073d57d12b71 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 14 Sep 2022 13:47:57 +0200 Subject: [PATCH] add ref component for property editor ui --- .../src/backoffice/backoffice.element.ts | 2 ++ .../ref-property-editor-ui.element.ts | 32 +++++++++++++++++++ .../editor-view-data-type-edit.element.ts | 10 ++++-- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/components/ref-property-editor-ui/ref-property-editor-ui.element.ts diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts index 3ce2a18181..f268f86f69 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts @@ -1,3 +1,5 @@ +//TODO: we need to figure out what components should be available for extensions and load them upfront +import './components/ref-property-editor-ui/ref-property-editor-ui.element'; import './components/backoffice-header.element'; import './components/backoffice-main.element'; import './components/backoffice-modal-container.element'; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/components/ref-property-editor-ui/ref-property-editor-ui.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/components/ref-property-editor-ui/ref-property-editor-ui.element.ts new file mode 100644 index 0000000000..3ae605613e --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/components/ref-property-editor-ui/ref-property-editor-ui.element.ts @@ -0,0 +1,32 @@ +import { UUIRefNodeElement } from '@umbraco-ui/uui'; +import { html } from 'lit'; +import { customElement, property } from 'lit/decorators.js'; + +@customElement('umb-ref-property-editor-ui') +export class UmbRefPropertyEditorUI extends UUIRefNodeElement { + static styles = [...UUIRefNodeElement.styles]; + + protected fallbackIcon = + ''; + + @property({ type: String }) + alias = ''; + + protected renderDetail() { + const details: string[] = []; + + if (this.alias !== '') { + details.push(this.alias); + } + if (this.detail !== '') { + details.push(this.detail); + } + return html`${details.join(' | ')}`; + } +} + +declare global { + interface HTMLElementTagNameMap { + 'umb-ref-property-editor-ui': UmbRefPropertyEditorUI; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/editors/data-type/views/editor-view-data-type-edit.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/editors/data-type/views/editor-view-data-type-edit.element.ts index f267391613..7e59b63319 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/editors/data-type/views/editor-view-data-type-edit.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/editors/data-type/views/editor-view-data-type-edit.element.ts @@ -2,6 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html, LitElement } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { Subscription, distinctUntilChanged } from 'rxjs'; +import { ifDefined } from 'lit-html/directives/if-defined.js'; import { UmbModalService } from '../../../../core/services/modal'; import { UmbContextConsumerMixin } from '../../../../core/context'; @@ -73,10 +74,13 @@ export class UmbEditorViewDataTypeEditElement extends UmbContextConsumerMixin(Li render() { return html` -

Property Editor UI

- ${this._dataType?.propertyEditorUIAlias} - + + + + + +
`; }