diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/models/Umbraco.MultiUrlPicker.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/models/Umbraco.MultiUrlPicker.ts new file mode 100644 index 0000000000..30a8bd6248 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/models/Umbraco.MultiUrlPicker.ts @@ -0,0 +1,41 @@ +import type { ManifestPropertyEditorModel } from '@umbraco-cms/models'; + +export const manifest: ManifestPropertyEditorModel = { + type: 'propertyEditorModel', + name: 'Multi URL Picker', + alias: 'Umbraco.MultiUrlPicker', + meta: { + config: { + properties: [ + { + alias: 'minNumber', + label: 'Minimum number of items', + description: '', + propertyEditorUI: 'Umb.PropertyEditorUI.Number', + }, + { + alias: 'maxNumber', + label: 'Maximum number of items', + description: '', + propertyEditorUI: 'Umb.PropertyEditorUI.Number', + }, + { + alias: 'ignoreUserStartNodes', + label: 'Ignore user start nodes', + description: 'Selecting this option allows a user to choose nodes that they normally dont have access to.', + propertyEditorUI: 'Umb.PropertyEditorUI.Toggle', + }, + ], + defaultData: [ + { + alias: 'minNumber', + value: 0, + }, + { + alias: 'maxNumber', + value: 0, + }, + ], + }, + }, +}; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/models/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/models/manifests.ts index 3e55ed9eb7..2d4c4572e6 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/models/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/models/manifests.ts @@ -2,6 +2,7 @@ import { manifest as colorPicker } from './Umbraco.ColorPicker'; import { manifest as eyeDropper } from './Umbraco.ColorPicker.EyeDropper'; import { manifest as contentPicker } from './Umbraco.ContentPicker'; import { manifest as json } from './Umbraco.JSON'; +import { manifest as multiUrlPicker } from './Umbraco.MultiUrlPicker'; import type { ManifestPropertyEditorModel } from '@umbraco-cms/models'; @@ -10,6 +11,7 @@ export const manifests: Array = [ eyeDropper, contentPicker, json, + multiUrlPicker, { type: 'propertyEditorModel', name: 'Multi URL Picker', diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/shared/property-editor-config/property-editor-config.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/shared/property-editor-config/property-editor-config.element.ts index cf847b77b4..a38d6c5bee 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/shared/property-editor-config/property-editor-config.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/shared/property-editor-config/property-editor-config.element.ts @@ -100,7 +100,7 @@ export class UmbPropertyEditorConfigElement extends UmbContextConsumerMixin(UmbO private _getValue(property: PropertyEditorConfigProperty) { const value = this.data.find((data) => data.alias === property.alias)?.value; const defaultValue = this._configDefaultData?.find((data) => data.alias === property.alias)?.value; - return value || defaultValue || null; + return value ?? defaultValue ?? null; } render() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/manifests.ts index d589a42e5d..18e07fd715 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/manifests.ts @@ -2,6 +2,8 @@ import { manifest as ColorPicker } from './color-picker/manifests'; import { manifest as ContentPicker } from './content-picker/manifests'; import { manifest as EyeDropper } from './eye-dropper/manifests'; import { manifest as TreePicker } from './tree-picker/manifests'; +import { manifest as MultiUrlPicker } from './multi-url-picker/manifests'; +import { manifest as OverlaySize } from './overlay-size/manifests'; import type { ManifestPropertyEditorUI } from '@umbraco-cms/models'; export const manifests: Array = [ @@ -9,6 +11,8 @@ export const manifests: Array = [ ContentPicker, EyeDropper, TreePicker, + MultiUrlPicker, + OverlaySize, { type: 'propertyEditorUI', alias: 'Umb.PropertyEditorUI.BlockList', diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/manifests.ts new file mode 100644 index 0000000000..90c48e605f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/manifests.ts @@ -0,0 +1,30 @@ +import type { ManifestPropertyEditorUI } from '@umbraco-cms/models'; + +export const manifest: ManifestPropertyEditorUI = { + type: 'propertyEditorUI', + alias: 'Umb.PropertyEditorUI.MultiUrlPicker', + name: 'Multi URL Picker Property Editor UI', + loader: () => import('./property-editor-ui-multi-url-picker.element'), + meta: { + label: 'Multi URL Picker', + propertyEditorModel: 'Umbraco.MultiUrlPicker', + icon: 'umb:link', + group: 'pickers', + config: { + properties: [ + { + alias: 'overlaySize', + label: 'Overlay Size', + description: 'Select the width of the overlay.', + propertyEditorUI: 'Umb.PropertyEditorUI.OverlaySize', + }, + { + alias: 'hideAnchor', + label: 'Hide anchor/query string input', + description: 'Selecting this hides the anchor/query string input field in the link picker overlay.', + propertyEditorUI: 'Umb.PropertyEditorUI.Toggle', + }, + ], + }, + }, +}; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/property-editor-ui-multi-url-picker.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/property-editor-ui-multi-url-picker.element.ts new file mode 100644 index 0000000000..5e33094719 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/property-editor-ui-multi-url-picker.element.ts @@ -0,0 +1,29 @@ +import { html, LitElement } from 'lit'; +import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; +import { customElement, property } from 'lit/decorators.js'; + +/** + * @element umb-property-editor-ui-multi-url-picker + */ +@customElement('umb-property-editor-ui-multi-url-picker') +export class UmbPropertyEditorUIMultiUrlPickerElement extends LitElement { + static styles = [UUITextStyles]; + + @property() + value = ''; + + @property({ type: Array, attribute: false }) + public config = []; + + render() { + return html`
umb-property-editor-ui-multi-url-picker
`; + } +} + +export default UmbPropertyEditorUIMultiUrlPickerElement; + +declare global { + interface HTMLElementTagNameMap { + 'umb-property-editor-ui-multi-url-picker': UmbPropertyEditorUIMultiUrlPickerElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/property-editor-ui-multi-url-picker.stories.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/property-editor-ui-multi-url-picker.stories.ts new file mode 100644 index 0000000000..ec833487f1 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/property-editor-ui-multi-url-picker.stories.ts @@ -0,0 +1,15 @@ +import { Meta, Story } from '@storybook/web-components'; +import { html } from 'lit-html'; + +import type { UmbPropertyEditorUIMultiUrlPickerElement } from './property-editor-ui-multi-url-picker.element'; +import './property-editor-ui-multi-url-picker.element'; + +export default { + title: 'Property Editor UIs/Multi Url Picker', + component: 'umb-property-editor-ui-multi-url-picker', + id: 'umb-property-editor-ui-multi-url-picker', +} as Meta; + +export const AAAOverview: Story = () => + html``; +AAAOverview.storyName = 'Overview'; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/property-editor-ui-multi-url-picker.test.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/property-editor-ui-multi-url-picker.test.ts new file mode 100644 index 0000000000..8e6e46f607 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multi-url-picker/property-editor-ui-multi-url-picker.test.ts @@ -0,0 +1,21 @@ +import { expect, fixture, html } from '@open-wc/testing'; +import { UmbPropertyEditorUIMultiUrlPickerElement } from './property-editor-ui-multi-url-picker.element'; +import { defaultA11yConfig } from '@umbraco-cms/test-utils'; + +describe('UmbPropertyEditorUIMultiUrlPickerElement', () => { + let element: UmbPropertyEditorUIMultiUrlPickerElement; + + beforeEach(async () => { + element = await fixture( + html` ` + ); + }); + + it('is defined with its own instance', () => { + expect(element).to.be.instanceOf(UmbPropertyEditorUIMultiUrlPickerElement); + }); + + it('passes the a11y audit', async () => { + await expect(element).shadowDom.to.be.accessible(defaultA11yConfig); + }); +}); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/manifests.ts new file mode 100644 index 0000000000..2baef91ae5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/manifests.ts @@ -0,0 +1,14 @@ +import type { ManifestPropertyEditorUI } from '@umbraco-cms/models'; + +export const manifest: ManifestPropertyEditorUI = { + type: 'propertyEditorUI', + alias: 'Umb.PropertyEditorUI.OverlaySize', + name: 'Overlay Size Property Editor UI', + loader: () => import('./property-editor-ui-overlay-size.element'), + meta: { + label: 'Overlay Size', + propertyEditorModel: '', + icon: 'umb:document', + group: '', + }, +}; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/property-editor-ui-overlay-size.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/property-editor-ui-overlay-size.element.ts new file mode 100644 index 0000000000..8d4444dfd8 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/property-editor-ui-overlay-size.element.ts @@ -0,0 +1,29 @@ +import { html, LitElement } from 'lit'; +import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; +import { customElement, property } from 'lit/decorators.js'; + +/** + * @element umb-property-editor-ui-overlay-size + */ +@customElement('umb-property-editor-ui-overlay-size') +export class UmbPropertyEditorUIOverlaySizeElement extends LitElement { + static styles = [UUITextStyles]; + + @property() + value = ''; + + @property({ type: Array, attribute: false }) + public config = []; + + render() { + return html`
umb-property-editor-ui-overlay-size
`; + } +} + +export default UmbPropertyEditorUIOverlaySizeElement; + +declare global { + interface HTMLElementTagNameMap { + 'umb-property-editor-ui-overlay-size': UmbPropertyEditorUIOverlaySizeElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/property-editor-ui-overlay-size.stories.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/property-editor-ui-overlay-size.stories.ts new file mode 100644 index 0000000000..4ae4156e8e --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/property-editor-ui-overlay-size.stories.ts @@ -0,0 +1,15 @@ +import { Meta, Story } from '@storybook/web-components'; +import { html } from 'lit-html'; + +import type { UmbPropertyEditorUIOverlaySizeElement } from './property-editor-ui-overlay-size.element'; +import './property-editor-ui-overlay-size.element'; + +export default { + title: 'Property Editor UIs/Overlay Size', + component: 'umb-property-editor-ui-overlay-size', + id: 'umb-property-editor-ui-overlay-size', +} as Meta; + +export const AAAOverview: Story = () => + html``; +AAAOverview.storyName = 'Overview'; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/property-editor-ui-overlay-size.test.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/property-editor-ui-overlay-size.test.ts new file mode 100644 index 0000000000..3fbca003b3 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/overlay-size/property-editor-ui-overlay-size.test.ts @@ -0,0 +1,21 @@ +import { expect, fixture, html } from '@open-wc/testing'; +import { UmbPropertyEditorUIOverlaySizeElement } from './property-editor-ui-overlay-size.element'; +import { defaultA11yConfig } from '@umbraco-cms/test-utils'; + +describe('UmbPropertyEditorUIOverlaySizeElement', () => { + let element: UmbPropertyEditorUIOverlaySizeElement; + + beforeEach(async () => { + element = await fixture( + html` ` + ); + }); + + it('is defined with its own instance', () => { + expect(element).to.be.instanceOf(UmbPropertyEditorUIOverlaySizeElement); + }); + + it('passes the a11y audit', async () => { + await expect(element).shadowDom.to.be.accessible(defaultA11yConfig); + }); +}); diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/data/data-type.data.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/data/data-type.data.ts index 0983adf5e2..1f89a5e4a3 100644 --- a/src/Umbraco.Web.UI.Client/src/core/mocks/data/data-type.data.ts +++ b/src/Umbraco.Web.UI.Client/src/core/mocks/data/data-type.data.ts @@ -84,7 +84,7 @@ export const data: Array = [ data: [], }, { - name: 'Umbraco.ColorPicker', + name: 'Color Picker', type: 'data-type', icon: 'umb:autofill', hasChildren: false, @@ -97,7 +97,7 @@ export const data: Array = [ data: [], }, { - name: 'Umbraco.ContentPicker', + name: 'Content Picker', type: 'data-type', icon: 'umb:autofill', hasChildren: false, @@ -110,7 +110,7 @@ export const data: Array = [ data: [], }, { - name: 'Umbraco.ColorPicker.EyeDropper', + name: 'Eye Dropper', type: 'data-type', icon: 'umb:autofill', hasChildren: false, @@ -122,6 +122,19 @@ export const data: Array = [ propertyEditorUIAlias: 'Umb.PropertyEditorUI.EyeDropper', data: [], }, + { + name: 'Multi URL Picker', + type: 'data-type', + icon: 'umb:autofill', + hasChildren: false, + key: 'dt-10', + isContainer: false, + parentKey: null, + isFolder: false, + propertyEditorModelAlias: 'Umbraco.MultiUrlPicker', + propertyEditorUIAlias: 'Umb.PropertyEditorUI.MultiUrlPicker', + data: [], + }, ]; // Temp mocked database