register number property editor ui
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { css, html, LitElement } from 'lit';
|
||||
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
|
||||
import { customElement, property } from 'lit/decorators.js';
|
||||
|
||||
@customElement('umb-property-editor-number')
|
||||
export class UmbPropertyEditorNumberElement extends LitElement {
|
||||
static styles = [
|
||||
UUITextStyles,
|
||||
css`
|
||||
uui-input {
|
||||
width: 100%;
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
@property()
|
||||
value = '';
|
||||
|
||||
private onInput(e: InputEvent) {
|
||||
this.value = (e.target as HTMLInputElement).value;
|
||||
this.dispatchEvent(new CustomEvent('property-editor-change', { bubbles: true, composed: true }));
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`<uui-input .value=${this.value} type="number" @input=${this.onInput}></uui-input>`;
|
||||
}
|
||||
}
|
||||
|
||||
export default UmbPropertyEditorNumberElement;
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-property-editor-number': UmbPropertyEditorNumberElement;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Meta, Story } from '@storybook/web-components';
|
||||
import { html } from 'lit-html';
|
||||
|
||||
import type { UmbPropertyEditorNumberElement } from './property-editor-number.element';
|
||||
import './property-editor-number.element';
|
||||
|
||||
export default {
|
||||
title: 'Property Editors/Number',
|
||||
component: 'umb-property-editor-number',
|
||||
id: 'umb-property-editor-number',
|
||||
} as Meta;
|
||||
|
||||
export const AAAOverview: Story<UmbPropertyEditorNumberElement> = () =>
|
||||
html` <umb-property-editor-number></umb-property-editor-number>`;
|
||||
AAAOverview.storyName = 'Overview';
|
||||
@@ -164,6 +164,17 @@ export const internalManifests: Array<ManifestTypes & { loader: () => Promise<ob
|
||||
propertyEditors: ['Umbraco.Custom'],
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'propertyEditorUI',
|
||||
alias: 'Umb.PropertyEditorUI.Number',
|
||||
name: 'Property Editor Number',
|
||||
loader: () => import('./backoffice/property-editors/number/property-editor-number.element'),
|
||||
meta: {
|
||||
icon: 'umb:autofill',
|
||||
group: 'Common',
|
||||
propertyEditors: ['Umbraco.Integer'],
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'editorView',
|
||||
alias: 'Umb.EditorView.Content.Edit',
|
||||
|
||||
Reference in New Issue
Block a user