Merge remote-tracking branch 'origin/main' into feature/media-bulk-actions
# Conflicts: # src/backoffice/media/media/workspace/media-workspace.context.ts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { UmbControllerHostInterface, UmbControllerInterface } from '@umbraco-cms/controller';
|
||||
import { UmbContextToken } from '../context-token';
|
||||
import { UmbContextConsumer } from './context-consumer';
|
||||
import { UmbContextCallback } from './context-request.event';
|
||||
import type { UmbControllerHostInterface, UmbControllerInterface } from '@umbraco-cms/controller';
|
||||
|
||||
export class UmbContextConsumerController<T = unknown>
|
||||
extends UmbContextConsumer<UmbControllerHostInterface, T>
|
||||
|
||||
@@ -20,6 +20,7 @@ export class UmbContextProviderController<T = unknown>
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
super.destroy();
|
||||
if (this.host) {
|
||||
this.host.removeController(this);
|
||||
}
|
||||
|
||||
@@ -53,4 +53,10 @@ export class UmbContextProvider<HostType extends EventTarget = EventTarget> {
|
||||
event.stopPropagation();
|
||||
event.callback(this.#instance);
|
||||
};
|
||||
|
||||
|
||||
destroy(): void {
|
||||
// I want to make sure to call this, but for now it was too overwhelming to require the destroy method on context instances.
|
||||
(this.#instance as any).destroy?.();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { HTMLElementConstructor } from '@umbraco-cms/models';
|
||||
import { UmbControllerInterface } from './controller.interface';
|
||||
import type { HTMLElementConstructor } from '@umbraco-cms/models';
|
||||
|
||||
export declare class UmbControllerHostInterface extends HTMLElement {
|
||||
//#controllers:UmbController[];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { UmbContextToken } from '@umbraco-cms/context-api';
|
||||
import { UmbNotificationHandler } from './notification-handler';
|
||||
import { UmbContextToken } from '@umbraco-cms/context-api';
|
||||
|
||||
export type UmbNotificationData = any;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Meta, Story } from '@storybook/web-components';
|
||||
import { html } from 'lit';
|
||||
import { customElement } from 'lit/decorators.js';
|
||||
|
||||
import { UmbLitElement } from '@umbraco-cms/element';
|
||||
import type { UmbNotificationDefaultData } from './layouts/default';
|
||||
import {
|
||||
UmbNotificationColor,
|
||||
@@ -12,6 +11,7 @@ import {
|
||||
UmbNotificationService,
|
||||
UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN,
|
||||
} from '.';
|
||||
import { UmbLitElement } from '@umbraco-cms/element';
|
||||
|
||||
export default {
|
||||
title: 'API/Notifications/Overview',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
import { createObservablePart } from "./create-observable-part.method";
|
||||
|
||||
|
||||
// TODO: Should this handle array as well?
|
||||
@@ -50,6 +51,13 @@ export class DeepState<T> extends BehaviorSubject<T> {
|
||||
super(deepFreeze(initialData));
|
||||
}
|
||||
|
||||
getObservablePart<ReturnType>(
|
||||
mappingFunction: MappingFunction<T, ReturnType>,
|
||||
memoizationFunction?: MemoizationFunction<ReturnType>
|
||||
) {
|
||||
return createObservablePart(this, mappingFunction, memoizationFunction);
|
||||
}
|
||||
|
||||
next(newData: T): void {
|
||||
const frozenData = deepFreeze(newData);
|
||||
// Only update data if its different than current data.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { UmbResourceController } from './resource.controller';
|
||||
import { UmbControllerHostInterface } from '@umbraco-cms/controller';
|
||||
import type { UmbNotificationOptions } from '@umbraco-cms/notification';
|
||||
import { UmbResourceController } from './resource.controller';
|
||||
|
||||
export function tryExecuteAndNotify<T>(
|
||||
host: UmbControllerHostInterface,
|
||||
|
||||
@@ -25,12 +25,21 @@ export interface UmbTreeStore<T> extends UmbDataStore {
|
||||
trash(keys: string[]): Promise<void>;
|
||||
}
|
||||
|
||||
export interface UmbContentStore<T> extends UmbDataStore {
|
||||
export interface UmbEntityDetailStore<T> extends UmbDataStore {
|
||||
|
||||
/**
|
||||
* @description - Request scaffold data by entityType and . The data is added to the store and is returned as an Observable.
|
||||
* @param {string} key
|
||||
* @return {*} {T}
|
||||
* @memberof UmbEntityDetailStore
|
||||
*/
|
||||
getScaffold: (entityType: string, parentKey: string | null) => T;
|
||||
|
||||
/**
|
||||
* @description - Request data by key. The data is added to the store and is returned as an Observable.
|
||||
* @param {string} key
|
||||
* @return {*} {(Observable<T>)}
|
||||
* @memberof UmbDataStoreBase
|
||||
* @memberof UmbEntityDetailStore
|
||||
*/
|
||||
getByKey(key: string): Observable<T | undefined>;
|
||||
|
||||
@@ -38,7 +47,15 @@ export interface UmbContentStore<T> extends UmbDataStore {
|
||||
* @description - Save data.
|
||||
* @param {object} data
|
||||
* @return {*} {(Promise<void>)}
|
||||
* @memberof UmbContentStore
|
||||
* @memberof UmbEntityDetailStore
|
||||
*/
|
||||
save(data: T[]): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
export interface UmbContentStore<T> extends UmbEntityDetailStore<T> {
|
||||
|
||||
// TODO: make something that is specific for UmbContentStore, or then we should get rid of it. But for now i kept it as we might want this for rollback or other things specific to Content types.
|
||||
save(data: T[]): Promise<void>;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user