add block configuration property editor ui

This commit is contained in:
Mads Rasmussen
2023-01-10 09:03:30 +01:00
parent 0ccd622e01
commit f2f5f701dd
5 changed files with 81 additions and 0 deletions

View File

@@ -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',
},
};

View File

@@ -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`<div>umb-property-editor-ui-block-configuration</div>`;
}
}
export default UmbPropertyEditorUIBlockConfigurationElement;
declare global {
interface HTMLElementTagNameMap {
'umb-property-editor-ui-block-configuration': UmbPropertyEditorUIBlockConfigurationElement;
}
}

View File

@@ -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<UmbPropertyEditorUIBlockConfigurationElement> = () =>
html`<umb-property-editor-ui-block-configuration></umb-property-editor-ui-block-configuration>`;
AAAOverview.storyName = 'Overview';

View File

@@ -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` <umb-property-editor-ui-block-configuration></umb-property-editor-ui-block-configuration> `
);
});
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);
});
});

View File

@@ -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<ManifestPropertyEditorUI> = [
checkboxList,
blockList,
numberRange,
blockConfiguration,
{
type: 'propertyEditorUI',
alias: 'Umb.PropertyEditorUI.Number',