From f2f5f701ddf405f5138f80a069bbcb0d409e8a6d Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 10 Jan 2023 09:03:30 +0100 Subject: [PATCH] add block configuration property editor ui --- .../uis/block-configuration/manifests.ts | 14 +++++++++ ...y-editor-ui-block-configuration.element.ts | 29 +++++++++++++++++++ ...y-editor-ui-block-configuration.stories.ts | 15 ++++++++++ ...erty-editor-ui-block-configuration.test.ts | 21 ++++++++++++++ .../shared/property-editors/uis/manifests.ts | 2 ++ 5 files changed, 81 insertions(+) create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/manifests.ts create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.element.ts create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.stories.ts create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.test.ts diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/manifests.ts new file mode 100644 index 0000000000..c7003d29c0 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/manifests.ts @@ -0,0 +1,14 @@ +import type { ManifestPropertyEditorUI } from '@umbraco-cms/models'; + +export const manifest: ManifestPropertyEditorUI = { + type: 'propertyEditorUI', + alias: 'Umb.PropertyEditorUI.BlockConfiguration', + name: 'Block Configuration Property Editor UI', + loader: () => import('./property-editor-ui-block-configuration.element'), + meta: { + label: 'Block List', + propertyEditorModel: '', + icon: 'umb:autofill', + group: 'common', + }, +}; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.element.ts new file mode 100644 index 0000000000..a343c4b754 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.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-block-configuration + */ +@customElement('umb-property-editor-ui-block-configuration') +export class UmbPropertyEditorUIBlockConfigurationElement extends LitElement { + static styles = [UUITextStyles]; + + @property() + value = ''; + + @property({ type: Array, attribute: false }) + public config = []; + + render() { + return html`
umb-property-editor-ui-block-configuration
`; + } +} + +export default UmbPropertyEditorUIBlockConfigurationElement; + +declare global { + interface HTMLElementTagNameMap { + 'umb-property-editor-ui-block-configuration': UmbPropertyEditorUIBlockConfigurationElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.stories.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.stories.ts new file mode 100644 index 0000000000..a02a845763 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.stories.ts @@ -0,0 +1,15 @@ +import { Meta, Story } from '@storybook/web-components'; +import { html } from 'lit-html'; + +import type { UmbPropertyEditorUIBlockConfigurationElement } from './property-editor-ui-block-configuration.element'; +import './property-editor-ui-block-configuration.element'; + +export default { + title: 'Property Editor UIs/Block Configuration', + component: 'umb-property-editor-ui-block-configuration', + id: 'umb-property-editor-ui-block-configuration', +} as Meta; + +export const AAAOverview: Story = () => + html``; +AAAOverview.storyName = 'Overview'; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.test.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.test.ts new file mode 100644 index 0000000000..efd411034d --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/block-configuration/property-editor-ui-block-configuration.test.ts @@ -0,0 +1,21 @@ +import { expect, fixture, html } from '@open-wc/testing'; +import { UmbPropertyEditorUIBlockConfigurationElement } from './property-editor-ui-block-configuration.element'; +import { defaultA11yConfig } from '@umbraco-cms/test-utils'; + +describe('UmbPropertyEditorUIBlockConfigurationElement', () => { + let element: UmbPropertyEditorUIBlockConfigurationElement; + + beforeEach(async () => { + element = await fixture( + html` ` + ); + }); + + it('is defined with its own instance', () => { + expect(element).to.be.instanceOf(UmbPropertyEditorUIBlockConfigurationElement); + }); + + 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/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/manifests.ts index 31a274ac7f..1b247fa2d9 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 @@ -18,6 +18,7 @@ import { manifest as radioButtonList } from './radio-button-list/manifests'; import { manifest as checkboxList } from './checkbox-list/manifests'; import { manifest as blockList } from './block-list/manifests'; import { manifest as numberRange } from './number-range/manifests'; +import { manifest as blockConfiguration } from './block-configuration/manifests'; import type { ManifestPropertyEditorUI } from '@umbraco-cms/models'; @@ -42,6 +43,7 @@ export const manifests: Array = [ checkboxList, blockList, numberRange, + blockConfiguration, { type: 'propertyEditorUI', alias: 'Umb.PropertyEditorUI.Number',