Block Type Configuration: filter search to only include element types (#19201)

* Incorrect forum and security urls when raising issue (#19080)

* Add 'ManifestWithDynamicConditions' to ManifestHeaderApp so Header Apps can be conditionally shown/loaded (#19124)

* V15 QA Added acceptance tests for bulk trash dialog (#19125)

* Added tests for bulk trash content dialog

* Updated tests for trash content dialog

* Added tests for trash and bulk trash media dialog

* Moved trash content tests into a folder

* Bumped version

* Make trash tests run in the pipeline

* Make trash tests run in the pipeline

* Fixed comments

* Reverted npm command

* readme shield for forum

* Allow deselection of color picker property. (#19174)

* V15 Added acceptance tests for tiptap statusbar (#19131)

* Updated tests for tiptap RTE

* Moved tests for titptap toolbar to another class

* Added tests for titptap toolbar

* Added tests for tiptap statusbar

* Bumped version

* Make tiptap tests run in the pipeline

* Bumped version

* Reverted npm command

* build: restores some of the behavior from V13 in relation to StaticAssets (#19189)

In v13, the StaticAssets build was only triggered based on the existence of either the output folder or a preserve.* marker file. Here, we also additionally check for the node_modules/.package-lock.json file before reinstalling npm dependencies. We also now only run `npm install` rather than `npm ci` to optimise the build.

* filter search to only include element types

* V16 QA update failing nightly tests (#19190)

* Fixed tests

* More updates for tests

* Bumped version of testhelpers

* Fixed notifications in tests

* Last fixes

* Revert "Merge branch 'v16/dev' into v16/hotfix/filter-element-type-search-for-block-types"

This reverts commit 7b8b5c28da5f1aea30b398d1b0a9bfc6552fc17d, reversing
changes made to 6d4ddb70776c46a5ddbc1815c4a1a7609ba891df.

* disable not pickable search results

* correct use of pickable filter

---------

Co-authored-by: Lotte Pitcher <LottePitcher@users.noreply.github.com>
Co-authored-by: Warren Buckley <warren@hackmakedo.com>
Co-authored-by: Nhu Dinh <150406148+nhudinh0309@users.noreply.github.com>
Co-authored-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
Co-authored-by: Lotte Pitcher <github@lottepitcher.co.uk>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com>
Co-authored-by: mole <nikolajlauridsen@protonmail.ch>
Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
This commit is contained in:
Mads Rasmussen
2025-05-01 15:17:49 +02:00
committed by GitHub
parent 479ea0c77d
commit 60457456f9
8 changed files with 39 additions and 11 deletions

View File

@@ -106,6 +106,12 @@ export class UmbInputBlockTypeElement<
presetAlias: 'element',
},
},
// TODO: hide the queryParams and filter config under a "elementTypesOnly" field. [MR]
search: {
queryParams: {
isElementType: true,
},
},
pickableFilter: (docType) =>
// Only pick elements:
docType.isElement &&

View File

@@ -1,11 +1,13 @@
import { UMB_PICKER_CONTEXT } from '../picker.context.token.js';
import type { UmbPickerContext } from '../picker.context.js';
import type { ManifestPickerSearchResultItem } from './result-item/picker-search-result-item.extension.js';
import { customElement, html, nothing, repeat, state } from '@umbraco-cms/backoffice/external/lit';
import { customElement, html, nothing, property, repeat, state } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import type { UmbSearchRequestArgs } from '@umbraco-cms/backoffice/search';
import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity';
type PickableFilterMethodType<T extends UmbEntityModel = UmbEntityModel> = (item: T) => boolean;
@customElement('umb-picker-search-result')
export class UmbPickerSearchResultElement extends UmbLitElement {
@state()
@@ -20,6 +22,9 @@ export class UmbPickerSearchResultElement extends UmbLitElement {
@state()
_isSearchable: boolean = false;
@property({ attribute: false })
pickableFilter: PickableFilterMethodType = () => true;
#pickerContext?: UmbPickerContext;
constructor() {
@@ -30,10 +35,15 @@ export class UmbPickerSearchResultElement extends UmbLitElement {
this.observe(
this.#pickerContext?.search.searchable,
(isSearchable) => (this._isSearchable = isSearchable ?? false),
'obsSearchable',
);
this.observe(this.#pickerContext?.search.query, (query) => (this._query = query));
this.observe(this.#pickerContext?.search.searching, (query) => (this._searching = query ?? false));
this.observe(this.#pickerContext?.search.resultItems, (items) => (this._items = items ?? []));
this.observe(this.#pickerContext?.search.query, (query) => (this._query = query), 'obsQuery');
this.observe(
this.#pickerContext?.search.searching,
(query) => (this._searching = query ?? false),
'obsSearching',
);
this.observe(this.#pickerContext?.search.resultItems, (items) => (this._items = items ?? []), 'obsResultItems');
});
}
@@ -58,11 +68,15 @@ export class UmbPickerSearchResultElement extends UmbLitElement {
}
#renderResultItem(item: UmbEntityModel) {
console.log('pickableFilter', this.pickableFilter(item));
return html`
<umb-extension-with-api-slot
type="pickerSearchResultItem"
.filter=${(manifest: ManifestPickerSearchResultItem) => manifest.forEntityTypes.includes(item.entityType)}
.elementProps=${{ item }}></umb-extension-with-api-slot>
.elementProps=${{
item,
disabled: !this.pickableFilter(item),
}}></umb-extension-with-api-slot>
`;
}
}

View File

@@ -13,8 +13,9 @@ export class UmbDefaultPickerSearchResultItemElement extends UmbPickerSearchResu
id=${item.unique}
icon=${item.icon ?? 'icon-document'}
select-only
selectable
?selectable=${!this.disabled}
?selected=${this._isSelected}
?disabled=${this.disabled}
@deselected=${() => this.pickerContext?.selection.deselect(item.unique)}
@selected=${() => this.pickerContext?.selection.select(item.unique)}>
</umb-ref-item>

View File

@@ -18,6 +18,9 @@ export abstract class UmbPickerSearchResultItemElementBase<ItemType extends UmbN
return this.#item;
}
@property({ type: Boolean })
disabled?: boolean;
@state()
_isSelected = false;
@@ -49,8 +52,9 @@ export abstract class UmbPickerSearchResultItemElementBase<ItemType extends UmbN
<umb-ref-item
name=${item.name}
select-only
selectable
?selectable=${!this.disabled}
?selected=${this._isSelected}
?disabled=${this.disabled}
@deselected=${() => this.pickerContext?.selection.deselect(item.unique)}
@selected=${() => this.pickerContext?.selection.select(item.unique)}>
</umb-ref-item>

View File

@@ -159,7 +159,7 @@ export class UmbTreePickerModalElement<TreeItemType extends UmbTreeItemModelBase
#renderSearch() {
return html`
<umb-picker-search-field></umb-picker-search-field>
<umb-picker-search-result></umb-picker-search-result>
<umb-picker-search-result .pickableFilter=${this.data?.pickableFilter}></umb-picker-search-result>
`;
}

View File

@@ -13,8 +13,9 @@ export class UmbDocumentTypePickerSearchResultItemElement extends UmbPickerSearc
id=${item.unique}
icon=${item.icon ?? 'icon-document'}
select-only
selectable
?selectable=${!this.disabled}
?selected=${this._isSelected}
?disabled=${this.disabled}
@deselected=${() => this.pickerContext?.selection.deselect(item.unique)}
@selected=${() => this.pickerContext?.selection.select(item.unique)}>
${when(

View File

@@ -13,8 +13,9 @@ export class UmbDocumentPickerSearchResultItemElement extends UmbPickerSearchRes
id=${item.unique}
icon=${item.documentType.icon ?? 'icon-document'}
select-only
selectable
?selectable=${!this.disabled}
?selected=${this._isSelected}
?disabled=${this.disabled}
@deselected=${() => this.pickerContext?.selection.deselect(item.unique)}
@selected=${() => this.pickerContext?.selection.select(item.unique)}>
</umb-ref-item>

View File

@@ -13,8 +13,9 @@ export class UmbMemberPickerSearchResultItemElement extends UmbPickerSearchResul
id=${item.unique}
icon=${item.memberType.icon ?? 'icon-user'}
select-only
selectable
?selectable=${!this.disabled}
?selected=${this._isSelected}
?disabled=${this.disabled}
@deselected=${() => this.pickerContext?.selection.deselect(item.unique)}
@selected=${() => this.pickerContext?.selection.select(item.unique)}>
</umb-ref-item>