filter available property editor UIs in picker
This commit is contained in:
@@ -170,10 +170,12 @@ export class UmbEditorViewDataTypeEditElement extends UmbContextConsumerMixin(Li
|
||||
}
|
||||
|
||||
private _openPropertyEditorUIPicker() {
|
||||
if (!this._dataType) return;
|
||||
if (!this._dataType || !this._dataType.propertyEditorAlias) return;
|
||||
|
||||
const selection = this._dataType.propertyEditorUIAlias ? [this._dataType.propertyEditorUIAlias] : [];
|
||||
const modalHandler = this._modalService?.propertyEditorUIPicker({ selection });
|
||||
const modalHandler = this._modalService?.propertyEditorUIPicker({
|
||||
propertyEditorAlias: this._dataType.propertyEditorAlias,
|
||||
selection: this._dataType.propertyEditorUIAlias ? [this._dataType.propertyEditorUIAlias] : [],
|
||||
});
|
||||
|
||||
modalHandler?.onClose().then(({ selection } = {}) => {
|
||||
if (!selection) return;
|
||||
|
||||
@@ -4,13 +4,14 @@ import { customElement, property, state } from 'lit/decorators.js';
|
||||
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
||||
import { UmbContextConsumerMixin } from '../../../../context';
|
||||
|
||||
import type { Subscription } from 'rxjs';
|
||||
import { map, Subscription } from 'rxjs';
|
||||
import type { UUIComboboxListElement, UUIComboboxListEvent } from '@umbraco-ui/uui';
|
||||
import type { UmbModalHandler } from '../../modal-handler';
|
||||
import type { UmbExtensionRegistry } from '../../../../extension';
|
||||
import type { ManifestPropertyEditorUI } from '../../../../models';
|
||||
|
||||
export interface UmbModalPropertyEditorUIPickerData {
|
||||
propertyEditorAlias: string;
|
||||
selection?: Array<string>;
|
||||
}
|
||||
|
||||
@@ -49,8 +50,17 @@ export class UmbModalLayoutPropertyEditorUIPickerElement extends UmbContextConsu
|
||||
}
|
||||
|
||||
private _usePropertyEditorUIs() {
|
||||
if (!this.data) return;
|
||||
|
||||
this._propertyEditorUIsSubscription = this._extensionRegistry
|
||||
?.extensionsOfType('propertyEditorUI')
|
||||
.pipe(
|
||||
map((propertyEditorUIs) =>
|
||||
propertyEditorUIs.filter((propertyEditorUI) =>
|
||||
propertyEditorUI.meta.propertyEditors.includes(this.data?.propertyEditorAlias ?? '')
|
||||
)
|
||||
)
|
||||
)
|
||||
.subscribe((propertyEditorUIs) => {
|
||||
this._propertyEditorUIs = propertyEditorUIs;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user