diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/input-content-type/input-content-type.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/input-content-type/input-content-type.element.ts index 72a05ff523..3a51a0941a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/input-content-type/input-content-type.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/input-content-type/input-content-type.element.ts @@ -1,5 +1,5 @@ import { UmbInputDocumentElement } from '@umbraco-cms/backoffice/document'; -import { html, customElement, property, css } from '@umbraco-cms/backoffice/external/lit'; +import { html, customElement, property, css, state } from '@umbraco-cms/backoffice/external/lit'; import { FormControlMixin, UUISelectEvent } from '@umbraco-cms/backoffice/external/uui'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import { UmbInputMediaElement } from '@umbraco-cms/backoffice/media'; @@ -10,6 +10,7 @@ export type ContentType = 'content' | 'member' | 'media'; export type StartNode = { type?: ContentType; id?: string | null; + query?: string | null; }; @customElement('umb-input-content-type') @@ -18,37 +19,57 @@ export class UmbInputContentTypeElement extends FormControlMixin(UmbLitElement) return undefined; } + private _type: StartNode['type'] = 'content'; @property() - startNodeType?: StartNode['type']; + public set type(value: StartNode['type']) { + const oldValue = this._type; - @property({ attribute: 'start-node-id' }) - startNodeId?: string; + this._options = this._options.map((option) => + option.value === value ? { ...option, selected: true } : { ...option, selected: false }, + ); + this._type = value; + this.requestUpdate('type', oldValue); + } + public get type(): StartNode['type'] { + return this._type; + } - @property({ type: Array }) - options: Array