@umbraco-cms/backoffice 1.0.0-next.37dcc47c → 1.0.0-next.386e13e7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ import * as rxjs from 'rxjs';
2
+ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
3
+ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
4
+ import { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
5
+ import { UmbCollectionRepository } from '@umbraco-cms/backoffice/repository';
6
+ import { UmbCollectionFilterModel as UmbCollectionFilterModel$1 } from '@umbraco-cms/backoffice/collection';
7
+
8
+ declare class UmbCollectionContext<ItemType, FilterModelType extends UmbCollectionFilterModel$1> {
9
+ #private;
10
+ private _host;
11
+ private _entityType;
12
+ protected _dataObserver?: UmbObserverController<ItemType[]>;
13
+ readonly items: rxjs.Observable<ItemType[]>;
14
+ readonly total: rxjs.Observable<number>;
15
+ readonly selection: rxjs.Observable<string[]>;
16
+ readonly filter: rxjs.Observable<object | FilterModelType>;
17
+ repository?: UmbCollectionRepository;
18
+ constructor(host: UmbControllerHostElement, entityType: string | null, repositoryAlias: string);
19
+ isSelected(id: string): boolean;
20
+ setSelection(value: Array<string>): void;
21
+ clearSelection(): void;
22
+ select(id: string): void;
23
+ deselect(id: string): void;
24
+ destroy(): void;
25
+ getEntityType(): string | null;
26
+ protected _onRepositoryReady(): Promise<void>;
27
+ requestCollection(): Promise<void>;
28
+ setFilter(filter: Partial<FilterModelType>): void;
29
+ }
30
+ declare const UMB_COLLECTION_CONTEXT_TOKEN: UmbContextToken<UmbCollectionContext<any, any>>;
31
+
32
+ interface UmbCollectionFilterModel {
33
+ skip?: number;
34
+ take?: number;
35
+ filter?: string;
36
+ }
37
+
38
+ export { UMB_COLLECTION_CONTEXT_TOKEN, UmbCollectionContext, UmbCollectionFilterModel };
@@ -0,0 +1,130 @@
1
+ import * as rxjs from 'rxjs';
2
+ import { Observable } from 'rxjs';
3
+ import { ProblemDetailsModel, DocumentTypeResponseModel, PropertyTypeContainerResponseModelBaseModel, PropertyTypeResponseModelBaseModel, DocumentTypePropertyTypeResponseModel } from '@umbraco-cms/backoffice/backend-api';
4
+ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
5
+ import { MappingFunction } from '@umbraco-cms/backoffice/observable-api';
6
+
7
+ interface UmbRepositoryErrorResponse {
8
+ error?: ProblemDetailsModel;
9
+ }
10
+ interface UmbRepositoryResponse<T> extends UmbRepositoryErrorResponse {
11
+ data?: T;
12
+ }
13
+ interface UmbDetailRepository<CreateRequestType = any, CreateResponseType = any, UpdateRequestType = any, ResponseType = any> {
14
+ createScaffold(parentId: string | null): Promise<UmbRepositoryResponse<CreateRequestType>>;
15
+ requestById(id: string): Promise<UmbRepositoryResponse<ResponseType>>;
16
+ byId(id: string): Promise<Observable<ResponseType>>;
17
+ create(data: CreateRequestType): Promise<UmbRepositoryResponse<CreateResponseType>>;
18
+ save(id: string, data: UpdateRequestType): Promise<UmbRepositoryErrorResponse>;
19
+ delete(id: string): Promise<UmbRepositoryErrorResponse>;
20
+ }
21
+
22
+ type PropertyContainerTypes = 'Group' | 'Tab';
23
+ type T = DocumentTypeResponseModel;
24
+ declare class UmbContentTypePropertyStructureManager<R extends UmbDetailRepository<T> = UmbDetailRepository<T>> {
25
+ #private;
26
+ readonly documentTypes: rxjs.Observable<DocumentTypeResponseModel[]>;
27
+ private readonly _documentTypeContainers;
28
+ constructor(host: UmbControllerHostElement, typeRepository: R);
29
+ /**
30
+ * loadType will load the node type and all inherited and composed types.
31
+ * This will give us all the structure for properties and containers.
32
+ */
33
+ loadType(id?: string): Promise<{
34
+ data?: undefined;
35
+ } | {
36
+ data: any;
37
+ }>;
38
+ createScaffold(parentId: string | null): Promise<{
39
+ data?: undefined;
40
+ } | {
41
+ data: DocumentTypeResponseModel;
42
+ }>;
43
+ save(): Promise<boolean>;
44
+ create(): Promise<boolean>;
45
+ private _ensureType;
46
+ private _loadType;
47
+ _observeDocumentType(data: T): Promise<void>;
48
+ private _loadDocumentTypeCompositions;
49
+ /** Public methods for consuming structure: */
50
+ ownerDocumentType(): rxjs.Observable<DocumentTypeResponseModel | undefined>;
51
+ getOwnerDocumentType(): DocumentTypeResponseModel | undefined;
52
+ updateOwnerDocumentType(entry: T): void;
53
+ createContainer(contentTypeId: string | null, parentId?: string | null, type?: PropertyContainerTypes, sortOrder?: number): Promise<PropertyTypeContainerResponseModelBaseModel>;
54
+ updateContainer(documentTypeId: string | null, groupKey: string, partialUpdate: Partial<PropertyTypeContainerResponseModelBaseModel>): Promise<void>;
55
+ removeContainer(documentTypeKey: string | null, containerId?: string | null): Promise<void>;
56
+ createProperty(documentTypeId: string | null, containerId?: string | null, sortOrder?: number): Promise<PropertyTypeResponseModelBaseModel>;
57
+ insertProperty(documentTypeId: string | null, property: PropertyTypeResponseModelBaseModel): Promise<void>;
58
+ removeProperty(documentTypeId: string | null, propertyId: string): Promise<void>;
59
+ updateProperty(documentTypeId: string | null, propertyId: string, partialUpdate: Partial<PropertyTypeResponseModelBaseModel>): Promise<void>;
60
+ ownerDocumentTypeObservablePart<PartResult>(mappingFunction: MappingFunction<T, PartResult>): rxjs.Observable<PartResult | undefined>;
61
+ hasPropertyStructuresOf(containerId: string | null): rxjs.Observable<boolean>;
62
+ rootPropertyStructures(): rxjs.Observable<PropertyTypeResponseModelBaseModel[]>;
63
+ propertyStructuresOf(containerId: string | null): rxjs.Observable<PropertyTypeResponseModelBaseModel[]>;
64
+ rootContainers(containerType: PropertyContainerTypes): rxjs.Observable<PropertyTypeContainerResponseModelBaseModel[]>;
65
+ hasRootContainers(containerType: PropertyContainerTypes): rxjs.Observable<boolean>;
66
+ ownerContainersOf(containerType: PropertyContainerTypes): rxjs.Observable<PropertyTypeContainerResponseModelBaseModel[] | undefined>;
67
+ containersOfParentKey(parentId: PropertyTypeContainerResponseModelBaseModel['parentId'], containerType: PropertyContainerTypes): rxjs.Observable<PropertyTypeContainerResponseModelBaseModel[]>;
68
+ containersByNameAndType(name: string, containerType: PropertyContainerTypes): rxjs.Observable<PropertyTypeContainerResponseModelBaseModel[]>;
69
+ private _reset;
70
+ destroy(): void;
71
+ }
72
+
73
+ declare class UmbContentTypeContainerStructureHelper {
74
+ #private;
75
+ private _ownerType?;
76
+ private _childType?;
77
+ private _isRoot;
78
+ private _ownerName?;
79
+ private _directContainers;
80
+ private _ownerContainers;
81
+ readonly containers: rxjs.Observable<PropertyTypeContainerResponseModelBaseModel[]>;
82
+ readonly hasProperties: rxjs.Observable<boolean>;
83
+ constructor(host: UmbControllerHostElement);
84
+ setStructureManager(structure: UmbContentTypePropertyStructureManager): void;
85
+ setType(value?: PropertyContainerTypes): void;
86
+ getType(): PropertyContainerTypes | undefined;
87
+ setContainerChildType(value?: PropertyContainerTypes): void;
88
+ getContainerChildType(): PropertyContainerTypes | undefined;
89
+ setName(value?: string): void;
90
+ getName(): string | undefined;
91
+ setIsRoot(value: boolean): void;
92
+ getIsRoot(): boolean;
93
+ private _observeDirectContainers;
94
+ private _observeChildContainerProperties;
95
+ private _observeChildContainers;
96
+ private _observeRootContainers;
97
+ private _insertGroupContainers;
98
+ /**
99
+ * Returns true if the container is an owner container.
100
+ */
101
+ isOwnerContainer(containerId?: string): boolean | undefined;
102
+ /** Manipulate methods: */
103
+ addContainer(parentContainerId?: string, sortOrder?: number): Promise<void>;
104
+ partialUpdateContainer(containerId?: string, partialUpdate?: Partial<PropertyTypeContainerResponseModelBaseModel>): Promise<void>;
105
+ }
106
+
107
+ declare class UmbContentTypePropertyStructureHelper {
108
+ #private;
109
+ private _containerType?;
110
+ private _isRoot?;
111
+ private _containerName?;
112
+ readonly propertyStructure: rxjs.Observable<PropertyTypeResponseModelBaseModel[]>;
113
+ constructor(host: UmbControllerHostElement);
114
+ setStructureManager(structure: UmbContentTypePropertyStructureManager): void;
115
+ setContainerType(value?: PropertyContainerTypes): void;
116
+ getContainerType(): PropertyContainerTypes | undefined;
117
+ setContainerName(value?: string): void;
118
+ getContainerName(): string | undefined;
119
+ setIsRoot(value: boolean): void;
120
+ getIsRoot(): boolean | undefined;
121
+ private _observeGroupContainers;
122
+ private _observePropertyStructureOf;
123
+ /** Manipulate methods: */
124
+ addProperty(ownerId?: string, sortOrder?: number): Promise<PropertyTypeResponseModelBaseModel | undefined>;
125
+ insertProperty(property: PropertyTypeResponseModelBaseModel, sortOrder?: number): Promise<boolean>;
126
+ removeProperty(propertyId: string): Promise<boolean>;
127
+ partialUpdateProperty(propertyKey?: string, partialUpdate?: Partial<DocumentTypePropertyTypeResponseModel>): Promise<void>;
128
+ }
129
+
130
+ export { PropertyContainerTypes, UmbContentTypeContainerStructureHelper, UmbContentTypePropertyStructureHelper, UmbContentTypePropertyStructureManager };
package/context-api.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- import { UmbControllerHostInterface, UmbControllerInterface } from './controller';
1
+ import { UmbControllerHostElement, UmbControllerInterface } from '@umbraco-cms/backoffice/controller-api';
2
+ import { UmbContextToken as UmbContextToken$1 } from '@umbraco-cms/backoffice/context-api';
3
+ import { UmbWorkspaceContextInterface } from '@umbraco-cms/backoffice/workspace';
4
+ import { UmbEntityBase } from '@umbraco-cms/backoffice/models';
2
5
 
3
6
  declare class UmbContextToken<T = unknown> {
4
7
  protected alias: string;
@@ -90,9 +93,9 @@ declare class UmbContextConsumer<HostType extends EventTarget = EventTarget, T =
90
93
  destroy(): void;
91
94
  }
92
95
 
93
- declare class UmbContextConsumerController<T = unknown> extends UmbContextConsumer<UmbControllerHostInterface, T> implements UmbControllerInterface {
96
+ declare class UmbContextConsumerController<T = unknown> extends UmbContextConsumer<UmbControllerHostElement, T> implements UmbControllerInterface {
94
97
  get unique(): undefined;
95
- constructor(host: UmbControllerHostInterface, contextAlias: string | UmbContextToken<T>, callback: UmbContextCallback<T>);
98
+ constructor(host: UmbControllerHostElement, contextAlias: string | UmbContextToken<T>, callback: UmbContextCallback<T>);
96
99
  destroy(): void;
97
100
  }
98
101
 
@@ -136,9 +139,9 @@ declare class UmbContextProvider<HostType extends EventTarget = EventTarget> {
136
139
  destroy(): void;
137
140
  }
138
141
 
139
- declare class UmbContextProviderController<T = unknown> extends UmbContextProvider<UmbControllerHostInterface> implements UmbControllerInterface {
142
+ declare class UmbContextProviderController<T = unknown> extends UmbContextProvider<UmbControllerHostElement> implements UmbControllerInterface {
140
143
  get unique(): string;
141
- constructor(host: UmbControllerHostInterface, contextAlias: string | UmbContextToken<T>, instance: T);
144
+ constructor(host: UmbControllerHostElement, contextAlias: string | UmbContextToken<T>, instance: T);
142
145
  destroy(): void;
143
146
  }
144
147
 
@@ -162,4 +165,111 @@ declare class UmbContextProvideEventImplementation extends Event implements UmbC
162
165
  }
163
166
  declare const isUmbContextProvideEventType: (event: Event) => event is UmbContextProvideEventImplementation;
164
167
 
165
- export { UmbContextCallback, UmbContextConsumer, UmbContextConsumerController, UmbContextDebugRequest, UmbContextProvideEvent, UmbContextProvideEventImplementation, UmbContextProvider, UmbContextProviderController, UmbContextRequestEvent, UmbContextRequestEventImplementation, UmbContextToken, isUmbContextProvideEventType, isUmbContextRequestEvent, umbContextProvideEventType, umbContextRequestEventType, umbDebugContextEventType };
168
+ declare const UmbContextProviderElement_base: (new (...args: any[]) => UmbControllerHostElement) & {
169
+ new (): HTMLElement;
170
+ prototype: HTMLElement;
171
+ };
172
+ /**
173
+ * Provides a value to the context down the DOM tree.
174
+ *
175
+ * @remarks This element is a wrapper around the `provideContext` function.
176
+ * @slot - The context will be available to all descendants given in the default slot.
177
+ * @throws {Error} If the key property is not set.
178
+ * @throws {Error} If the value property is not set.
179
+ */
180
+ declare class UmbContextProviderElement extends UmbContextProviderElement_base {
181
+ /**
182
+ * The value to provide to the context.
183
+ * @optional
184
+ */
185
+ create?: (host: UmbControllerHostElement) => unknown;
186
+ /**
187
+ * The value to provide to the context.
188
+ * @required
189
+ */
190
+ value: unknown;
191
+ /**
192
+ * The key to provide to the context.
193
+ * @required
194
+ */
195
+ key: string | UmbContextToken$1;
196
+ static get observedAttributes(): string[];
197
+ attributeChangedCallback(name: string, _oldValue: string | UmbContextToken$1, newValue: string | UmbContextToken$1): void;
198
+ constructor();
199
+ connectedCallback(): void;
200
+ }
201
+ declare global {
202
+ interface HTMLElementTagNameMap {
203
+ 'umb-context-provider': UmbContextProviderElement;
204
+ }
205
+ }
206
+
207
+ interface UmbEntityWorkspaceContextInterface<EntityType = unknown> extends UmbWorkspaceContextInterface<EntityType> {
208
+ getEntityId(): string | undefined;
209
+ getEntityType(): string;
210
+ save(): Promise<void>;
211
+ }
212
+
213
+ declare const UMB_ENTITY_WORKSPACE_CONTEXT: UmbContextToken<UmbEntityWorkspaceContextInterface<UmbEntityBase>>;
214
+
215
+ /**
216
+ * Change the collection of Contexts into a simplified array of data
217
+ *
218
+ * @param contexts This is a map of the collected contexts from umb-debug
219
+ * @returns An array of simplified context data
220
+ */
221
+ declare function contextData(contexts: Map<any, any>): Array<DebugContextData>;
222
+ interface DebugContextData {
223
+ /**
224
+ * The alias of the context
225
+ *
226
+ * @type {string}
227
+ * @memberof DebugContextData
228
+ */
229
+ alias: string;
230
+ /**
231
+ * The type of the context such as object or string
232
+ *
233
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
234
+ * @memberof DebugContextData
235
+ */
236
+ type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
237
+ /**
238
+ * Data about the context that includes method and property names
239
+ *
240
+ * @type {DebugContextItemData}
241
+ * @memberof DebugContextData
242
+ */
243
+ data: DebugContextItemData;
244
+ }
245
+ interface DebugContextItemData {
246
+ type: string;
247
+ methods?: Array<unknown>;
248
+ properties?: Array<DebugContextItemPropertyData>;
249
+ value?: unknown;
250
+ }
251
+ interface DebugContextItemPropertyData {
252
+ /**
253
+ * The name of the property
254
+ *
255
+ * @type {string}
256
+ * @memberof DebugContextItemPropertyData
257
+ */
258
+ key: string;
259
+ /**
260
+ * The type of the property's value such as string or number
261
+ *
262
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
263
+ * @memberof DebugContextItemPropertyData
264
+ */
265
+ type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
266
+ /**
267
+ * Simple types such as string or number can have their value displayed stored inside the property
268
+ *
269
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
270
+ * @memberof DebugContextItemPropertyData
271
+ */
272
+ value?: unknown;
273
+ }
274
+
275
+ export { DebugContextData, DebugContextItemData, DebugContextItemPropertyData, UMB_ENTITY_WORKSPACE_CONTEXT, UmbContextCallback, UmbContextConsumer, UmbContextConsumerController, UmbContextDebugRequest, UmbContextProvideEvent, UmbContextProvideEventImplementation, UmbContextProvider, UmbContextProviderController, UmbContextProviderElement, UmbContextRequestEvent, UmbContextRequestEventImplementation, UmbContextToken, contextData, isUmbContextProvideEventType, isUmbContextRequestEvent, umbContextProvideEventType, umbContextRequestEventType, umbDebugContextEventType };
@@ -1,5 +1,3 @@
1
- import { HTMLElementConstructor } from './models';
2
-
3
1
  interface UmbControllerInterface {
4
2
  get unique(): string | undefined;
5
3
  hostConnected(): void;
@@ -7,10 +5,12 @@ interface UmbControllerInterface {
7
5
  destroy(): void;
8
6
  }
9
7
 
10
- declare class UmbControllerHostInterface extends HTMLElement {
8
+ type HTMLElementConstructor<T = HTMLElement> = new (...args: any[]) => T;
9
+ declare class UmbControllerHostElement extends HTMLElement {
11
10
  hasController(controller: UmbControllerInterface): boolean;
12
11
  getControllers(filterMethod: (ctrl: UmbControllerInterface) => boolean): UmbControllerInterface[];
13
12
  addController(controller: UmbControllerInterface): void;
13
+ removeControllerByUnique(unique: UmbControllerInterface['unique']): void;
14
14
  removeController(controller: UmbControllerInterface): void;
15
15
  }
16
16
  /**
@@ -20,7 +20,7 @@ declare class UmbControllerHostInterface extends HTMLElement {
20
20
  * @param {Object} superClass - superclass to be extended.
21
21
  * @mixin
22
22
  */
23
- declare const UmbControllerHostMixin: <T extends HTMLElementConstructor<HTMLElement>>(superClass: T) => HTMLElementConstructor<UmbControllerHostInterface> & T;
23
+ declare const UmbControllerHostMixin: <T extends HTMLElementConstructor<HTMLElement>>(superClass: T) => HTMLElementConstructor<UmbControllerHostElement> & T;
24
24
  declare global {
25
25
  interface HTMLElement {
26
26
  connectedCallback(): void;
@@ -29,13 +29,13 @@ declare global {
29
29
  }
30
30
 
31
31
  declare abstract class UmbController implements UmbControllerInterface {
32
- protected host?: UmbControllerHostInterface;
32
+ protected host?: UmbControllerHostElement;
33
33
  private _alias?;
34
34
  get unique(): string | undefined;
35
- constructor(host: UmbControllerHostInterface, alias?: string);
35
+ constructor(host: UmbControllerHostElement, alias?: string);
36
36
  abstract hostConnected(): void;
37
37
  abstract hostDisconnected(): void;
38
38
  destroy(): void;
39
39
  }
40
40
 
41
- export { UmbController, UmbControllerHostInterface, UmbControllerHostMixin, UmbControllerInterface };
41
+ export { UmbController, UmbControllerHostElement, UmbControllerHostMixin, UmbControllerInterface };