rename section picker
This commit is contained in:
@@ -2,7 +2,7 @@ import { html } from 'lit';
|
||||
import { property } from 'lit/decorators.js';
|
||||
import { UUIModalSidebarSize } from '@umbraco-ui/uui-modal-sidebar';
|
||||
import { UmbPickerModalData } from '../../../../../libs/modal/layouts/modal-layout-picker-base';
|
||||
import { UmbModalContext, UmbModalType, UMB_MODAL_CONTEXT_TOKEN } from '../../../../../libs/modal';
|
||||
import { UmbModalContext, UmbModalToken, UmbModalType, UMB_MODAL_CONTEXT_TOKEN } from '../../../../../libs/modal';
|
||||
|
||||
//TODO: These should probably be imported dynamically.
|
||||
import '../../modals/section-picker/section-picker-modal.element';
|
||||
@@ -24,7 +24,7 @@ export class UmbInputListBase extends UmbLitElement {
|
||||
@property({ type: String })
|
||||
public modalSize: UUIModalSidebarSize = 'small';
|
||||
|
||||
protected pickerLayout?: string;
|
||||
protected pickerToken?: UmbModalToken;
|
||||
private _modalContext?: UmbModalContext;
|
||||
|
||||
constructor() {
|
||||
@@ -35,16 +35,13 @@ export class UmbInputListBase extends UmbLitElement {
|
||||
}
|
||||
|
||||
private _openPicker() {
|
||||
if (!this.pickerLayout) return;
|
||||
if (!this.pickerToken) return;
|
||||
|
||||
const modalHandler = this._modalContext?.open(this.pickerLayout, {
|
||||
type: this.modalType,
|
||||
size: this.modalSize,
|
||||
data: {
|
||||
multiple: this.multiple,
|
||||
selection: this.value,
|
||||
},
|
||||
const modalHandler = this._modalContext?.open(this.pickerToken, {
|
||||
multiple: this.multiple,
|
||||
selection: this.value,
|
||||
});
|
||||
|
||||
modalHandler?.onClose().then((data: UmbPickerModalData<string>) => {
|
||||
if (data) {
|
||||
this.value = data.selection;
|
||||
|
||||
@@ -2,6 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css';
|
||||
import { css, html, nothing } from 'lit';
|
||||
import { customElement, state } from 'lit/decorators.js';
|
||||
import { UmbInputListBase } from '../input-list-base/input-list-base';
|
||||
import { UMB_SECTION_PICKER_MODAL_TOKEN } from '../../modals/section-picker';
|
||||
import type { ManifestSection } from '@umbraco-cms/models';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/extensions-api';
|
||||
|
||||
@@ -41,7 +42,7 @@ export class UmbInputPickerSectionElement extends UmbInputListBase {
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
this.pickerLayout = 'umb-picker-layout-section';
|
||||
this.pickerToken = UMB_SECTION_PICKER_MODAL_TOKEN;
|
||||
this._observeSections();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import { UmbModalLayoutPickerBase } from '../../../../../libs/modal/layouts/moda
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/extensions-api';
|
||||
import type { ManifestSection } from '@umbraco-cms/models';
|
||||
|
||||
@customElement('umb-picker-layout-section')
|
||||
export class UmbPickerLayoutSectionElement extends UmbModalLayoutPickerBase<ManifestSection> {
|
||||
@customElement('umb-section-picker-modal')
|
||||
export class UmbSectionPickerModalElement extends UmbModalLayoutPickerBase<ManifestSection> {
|
||||
static styles = [
|
||||
UUITextStyles,
|
||||
css`
|
||||
@@ -91,10 +91,10 @@ export class UmbPickerLayoutSectionElement extends UmbModalLayoutPickerBase<Mani
|
||||
}
|
||||
}
|
||||
|
||||
export default UmbPickerLayoutSectionElement;
|
||||
export default UmbSectionPickerModalElement;
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-picker-layout-section': UmbPickerLayoutSectionElement;
|
||||
'umb-section-picker-modal': UmbSectionPickerModalElement;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user