diff --git a/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/config/source-content/index.ts b/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/config/source-content/index.ts new file mode 100644 index 0000000000..f45438cbdc --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/config/source-content/index.ts @@ -0,0 +1 @@ +export * from './input-content-picker-source.element.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/config/source-content/input-content-picker-source.element.ts b/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/config/source-content/input-content-picker-source.element.ts new file mode 100644 index 0000000000..9ae2b22d53 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/config/source-content/input-content-picker-source.element.ts @@ -0,0 +1,140 @@ +import type { UmbContentPickerDynamicRoot, UmbContentPickerSourceType } from '../../types.js'; +import type { UmbInputContentPickerDocumentRootElement } from '../../dynamic-root/components/input-content-picker-document-root.element.js'; +import { html, customElement, property, css, state, nothing } from '@umbraco-cms/backoffice/external/lit'; +import type { UUISelectEvent } from '@umbraco-cms/backoffice/external/uui'; +import { UUIFormControlMixin } from '@umbraco-cms/backoffice/external/uui'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { UmbChangeEvent } from '@umbraco-cms/backoffice/event'; + +import '../../dynamic-root/components/input-content-picker-document-root.element.js'; + +@customElement('umb-input-content-picker-source') +export class UmbInputContentPickerSourceElement extends UUIFormControlMixin(UmbLitElement, '') { + protected override getFormElement() { + return undefined; + } + + #type: UmbContentPickerSourceType = 'content'; + + @property() + public set type(value: UmbContentPickerSourceType) { + 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(): UmbContentPickerSourceType { + return this.#type; + } + + @property({ attribute: 'node-id' }) + nodeId?: string; + + @property({ attribute: false }) + dynamicRoot?: UmbContentPickerDynamicRoot; + + @state() + _options: Array