Skip to content

Commit ab7d748

Browse files
committed
Merge branch 'main' into v15/feature/emm-picker-search-result-item
# Conflicts: # src/packages/core/extension-registry/models/index.ts
2 parents 50187f6 + edee8cf commit ab7d748

File tree

189 files changed

+3243
-1759
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+3243
-1759
lines changed

examples/dashboard-with-property-dataset/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ManifestDashboard } from '@umbraco-cms/backoffice/extension-registry';
1+
import type { ManifestDashboard } from '@umbraco-cms/backoffice/dashboard';
22

33
export const manifests: Array<ManifestDashboard> = [
44
{

examples/manifest-picker/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ManifestDashboard } from '@umbraco-cms/backoffice/extension-registry';
1+
import type { ManifestDashboard } from '@umbraco-cms/backoffice/dashboard';
22

33
export const manifests: Array<ManifestDashboard> = [
44
{

examples/sorter-with-nested-containers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ManifestDashboard } from '@umbraco-cms/backoffice/extension-registry';
1+
import type { ManifestDashboard } from '@umbraco-cms/backoffice/dashboard';
22

33
export const manifests: Array<ManifestDashboard> = [
44
{

examples/sorter-with-two-containers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ManifestDashboard } from '@umbraco-cms/backoffice/extension-registry';
1+
import type { ManifestDashboard } from '@umbraco-cms/backoffice/dashboard';
22

33
export const manifests: Array<ManifestDashboard> = [
44
{

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"./culture": "./dist-cms/packages/core/culture/index.js",
3333
"./picker": "./dist-cms/packages/core/picker/index.js",
3434
"./current-user": "./dist-cms/packages/user/current-user/index.js",
35+
"./dashboard": "./dist-cms/packages/core/dashboard/index.js",
3536
"./data-type": "./dist-cms/packages/data-type/index.js",
3637
"./debug": "./dist-cms/packages/core/debug/index.js",
3738
"./dictionary": "./dist-cms/packages/dictionary/index.js",

src/external/backend-api/src/types.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ export type DataTypeItemResponseModel = {
488488
id: string;
489489
name: string;
490490
editorUiAlias?: (string) | null;
491+
editorAlias: string;
491492
isDeletable: boolean;
492493
};
493494

src/libs/class-api/class.interface.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export interface UmbClassInterface extends UmbControllerHost {
1212
/**
1313
* @description Observe an Observable. An Observable is a declared source of data that can be observed. An observables is declared from a UmbState.
1414
* @param {Observable} source An Observable to observe from.
15-
* @param {ObserverCallback} callback Callback method called when data is changed.
15+
* @param {ObserverCallback | undefined} callback Callback method called when data is changed.
16+
* @param {UmbControllerAlias | null | undefined} controllerAlias Define an explicit controller alias. If not defined then one will be generated based on the callback function. If null is parsed no controller alias will be given.
1617
* @returns {UmbObserverController} Reference to the created Observer Controller instance.
1718
* @memberof UmbClassInterface
1819
*/
@@ -30,7 +31,7 @@ export interface UmbClassInterface extends UmbControllerHost {
3031
>(
3132
// This type dance checks if the Observable given could be undefined, if it potentially could be undefined it means that this potentially could return undefined and then call the callback with undefined. [NL]
3233
source: ObservableType,
33-
callback: ObserverCallback<SpecificT>,
34+
callback?: ObserverCallback<SpecificT>,
3435
controllerAlias?: UmbControllerAlias | null,
3536
): SpecificR;
3637

src/libs/extension-api/registry/extension.registry.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,21 @@ export class UmbExtensionRegistry<
414414
) as Observable<Array<T>>;
415415
}
416416

417+
// TODO: Write test for this method:
418+
getByTypeAndFilter<
419+
Key extends string,
420+
T extends ManifestBase = SpecificManifestTypeOrManifestBase<ManifestTypes, Key>,
421+
>(type: Key, filter: (ext: T) => boolean): Array<T> {
422+
const exts = this._extensions
423+
.getValue()
424+
.filter((ext) => ext.type === type && filter(ext as unknown as T)) as unknown as T[];
425+
if (exts.length === 0) {
426+
return [];
427+
}
428+
const kinds = this._kinds.getValue();
429+
return exts.map((ext) => (ext?.kind ? (this.#mergeExtensionWithKinds([ext, kinds]) ?? ext) : ext));
430+
}
431+
417432
/**
418433
* Get an observable of extensions by types and a given filter method.
419434
* This will return the all extensions that matches the types and which filter method returns true.

src/libs/observable-api/states/array-state.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
2323
/**
2424
* @function sortBy
2525
* @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting every time data is set.
26+
* @returns {UmbArrayState<T>} Reference to it self.
2627
* @description - A sort method to this Subject.
2728
* @example <caption>Example add sort method</caption>
2829
* const data = [
@@ -53,7 +54,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
5354
* // myState.value is equal 'Goodnight'.
5455
*/
5556
override setValue(value: T[]) {
56-
if (this.#sortMethod) {
57+
if (value && this.#sortMethod) {
5758
super.setValue([...value].sort(this.#sortMethod));
5859
} else {
5960
super.setValue(value);
@@ -76,6 +77,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
7677
remove(uniques: unknown[]) {
7778
if (this.getUniqueMethod) {
7879
let next = this.getValue();
80+
if (!next) return this;
7981
uniques.forEach((unique) => {
8082
next = next.filter((x) => {
8183
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -105,6 +107,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
105107
removeOne(unique: unknown) {
106108
if (this.getUniqueMethod) {
107109
let next = this.getValue();
110+
if (!next) return this;
108111
next = next.filter((x) => {
109112
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
110113
// @ts-ignore
@@ -138,7 +141,10 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
138141
* ]
139142
*/
140143
filter(predicate: (value: T, index: number, array: T[]) => boolean) {
141-
this.setValue(this.getValue().filter(predicate));
144+
const value = this.getValue();
145+
if (value) {
146+
this.setValue(value.filter(predicate));
147+
}
142148
return this;
143149
}
144150

src/mocks/data/data-type/data-type.db.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const itemResponseMapper = (item: UmbMockDataTypeModel): DataTypeItemResponseMod
8282
return {
8383
id: item.id,
8484
name: item.name,
85+
editorAlias: item.editorAlias,
8586
isDeletable: item.isDeletable,
8687
};
8788
};

0 commit comments

Comments
 (0)