diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/data-type.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/data-type.data.ts index d0999f6d9b..5c0d673e84 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/data/data-type.data.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/data-type.data.ts @@ -200,7 +200,35 @@ export const data: Array = parentId: null, propertyEditorAlias: 'Umbraco.MultiNodeTreePicker', propertyEditorUiAlias: 'Umb.PropertyEditorUi.TreePicker', - values: [], + values: [ + { + alias: 'startNode', + value: { + type: 'content', + id: null, + }, + }, + { + alias: 'minNumber', + value: 0, + }, + { + alias: 'maxNumber', + value: 3, + }, + { + alias: 'ignoreUserStartNodes', + value: false, + }, + { + alias: 'showOpenButton', + value: true, + }, + { + alias: 'filter', + value: '', + }, + ], }, { type: 'data-type', diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/document-type.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/document-type.data.ts index bad341ab93..831facacd5 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/data/document-type.data.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/document-type.data.ts @@ -608,6 +608,56 @@ export const data: Array = [ keepLatestVersionPerDayForDays: null, }, }, + { + allowedTemplateIds: [], + defaultTemplateId: null, + id: 'simple-document-type-id', + alias: 'blogPost', + name: 'All property editors document type', + description: null, + icon: 'umb:item-arrangement', + allowedAsRoot: true, + variesByCulture: true, + variesBySegment: false, + isElement: false, + properties: [ + { + id: '6', + containerId: 'all-properties-group-key', + alias: 'multiNodeTreePicker', + name: 'Multi Node Tree Picker', + description: '', + dataTypeId: 'dt-multiNodeTreePicker', + variesByCulture: false, + variesBySegment: false, + validation: { + mandatory: true, + mandatoryMessage: null, + regEx: null, + regExMessage: null, + }, + appearance: { + labelOnTop: false, + }, + }, + ], + containers: [ + { + id: 'all-properties-group-key', + parentId: null, + name: 'Content', + type: 'Group', + sortOrder: 0, + }, + ], + allowedContentTypes: [], + compositions: [], + cleanup: { + preventCleanup: false, + keepAllVersionsNewerThanDays: null, + keepLatestVersionPerDayForDays: null, + }, + }, { allowedTemplateIds: [], @@ -1008,6 +1058,15 @@ export const treeData: Array = [ parentId: null, icon: '', }, + { + name: 'Simple document type', + type: 'document-type', + hasChildren: false, + id: 'simple-document-type-id', + isContainer: false, + parentId: null, + icon: '', + }, { name: 'Page Document Type', type: 'document-type', diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/document.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/document.data.ts index f7a87c7d52..f400807433 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/data/document.data.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/document.data.ts @@ -536,7 +536,12 @@ export const data: Array = [ ], }, { - urls: [], + urls: [ + { + culture: 'en-US', + url: '/', + }, + ], templateId: null, id: 'simple-document-id', contentTypeId: 'simple-document-type-id', @@ -551,6 +556,14 @@ export const data: Array = [ updateDate: '2023-02-06T15:32:24.957009', }, ], + values: [ + { + alias: 'multiNodeTreePicker', + culture: null, + segment: null, + value: null, + }, + ], }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/user-group.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/user-group.data.ts index 22412f3548..e34bab08de 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/data/user-group.data.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/user-group.data.ts @@ -78,6 +78,13 @@ export const data: Array = [ documentStartNodeId: 'all-property-editors-document-id', permissions: [UMB_USER_PERMISSION_DOCUMENT_CREATE, UMB_USER_PERMISSION_DOCUMENT_DELETE], }, + { + id: 'c630d49e-4e7b-42ea-b2bc-edc0edacb6b2', + name: 'Something', + icon: 'umb:medal', + documentStartNodeId: 'simple-document-id', + permissions: [UMB_USER_PERMISSION_DOCUMENT_CREATE, UMB_USER_PERMISSION_DOCUMENT_DELETE], + }, { id: '9d24dc47-a4bf-427f-8a4a-b900f03b8a12', name: 'User Group 1', diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/index.ts new file mode 100644 index 0000000000..d377387e83 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/index.ts @@ -0,0 +1 @@ +export * from './input-content-type/index.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/input-content-type/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/input-content-type/index.ts new file mode 100644 index 0000000000..b5bcade1c2 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/input-content-type/index.ts @@ -0,0 +1 @@ +export * from './input-content-type.element.js'; 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 new file mode 100644 index 0000000000..3a51a0941a --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/components/input-content-type/input-content-type.element.ts @@ -0,0 +1,119 @@ +import { UmbInputDocumentElement } 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'; + +export type ContentType = 'content' | 'member' | 'media'; + +export type StartNode = { + type?: ContentType; + id?: string | null; + query?: string | null; +}; + +@customElement('umb-input-content-type') +export class UmbInputContentTypeElement extends FormControlMixin(UmbLitElement) { + protected getFormElement() { + return undefined; + } + + private _type: StartNode['type'] = 'content'; + @property() + public set type(value: StartNode['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'] { + return this._type; + } + + @property({ attribute: 'node-id' }) + nodeId = ''; + + @property({ attribute: 'dynamic-path' }) + dynamicPath = ''; + + @state() + _options: Array