From 6a9574b18a4bd1fb8c1f4290b1ca48b231a207a9 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Tue, 19 Dec 2023 16:18:15 +0000 Subject: [PATCH] Updates to `start-node` elements to use the new `input-document-source` element. Extended the `StartNode` type to include the DynamicRoot schema. --- .../input-start-node.element.ts | 64 ++++++++++++++----- ...ditor-ui-tree-picker-start-node.element.ts | 8 ++- 2 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/components/input-start-node/input-start-node.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/components/input-start-node/input-start-node.element.ts index d6db6cc9c5..d5392ca592 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/components/input-start-node/input-start-node.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/components/input-start-node/input-start-node.element.ts @@ -1,16 +1,26 @@ -import { UmbInputDocumentElement } from '@umbraco-cms/backoffice/document'; +import { UmbInputDocumentSourceElement } from '@umbraco-cms/backoffice/document'; 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'; -import { UmbChangeEvent } from '@umbraco-cms/backoffice/event'; +//import { UmbChangeEvent } from '@umbraco-cms/backoffice/event'; export type ContentType = 'content' | 'member' | 'media'; +export type DynamicRootQueryStepType = { + alias: string; + anyOfDocTypeKeys: Array; +}; + +export type DynamicRootType = { + originAlias: string; + querySteps?: Array | null; +}; + export type StartNode = { type?: ContentType; id?: string | null; - query?: string | null; + dynamicRoot?: DynamicRootType | null; }; @customElement('umb-input-start-node') @@ -20,14 +30,21 @@ export class UmbInputStartNodeElement extends FormControlMixin(UmbLitElement) { } private _type: StartNode['type'] = 'content'; + @property() public set type(value: StartNode['type']) { + if (value === undefined) { + value = this._type; + } + const oldValue = this._type; 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'] { @@ -35,30 +52,43 @@ export class UmbInputStartNodeElement extends FormControlMixin(UmbLitElement) { } @property({ attribute: 'node-id' }) - nodeId = ''; + nodeId?: string | null; - @property({ attribute: 'dynamic-path' }) - dynamicPath = ''; + @property({ attribute: false }) + dynamicRoot?: DynamicRootType | null; @state() _options: Array