@umbraco-cms/backoffice 1.0.0-next.48e903f7 → 1.0.0-next.49f05cfb

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';
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,127 @@
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';
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): Promise<{
39
+ data?: undefined;
40
+ } | {
41
+ data: DocumentTypeResponseModel;
42
+ }>;
43
+ private _ensureType;
44
+ private _loadType;
45
+ _observeDocumentType(data: T): Promise<void>;
46
+ private _loadDocumentTypeCompositions;
47
+ /** Public methods for consuming structure: */
48
+ rootDocumentType(): rxjs.Observable<DocumentTypeResponseModel | undefined>;
49
+ getRootDocumentType(): DocumentTypeResponseModel | undefined;
50
+ updateRootDocumentType(entry: T): void;
51
+ createContainer(contentTypeId: string | null, parentId?: string | null, type?: PropertyContainerTypes, sortOrder?: number): Promise<PropertyTypeContainerResponseModelBaseModel>;
52
+ updateContainer(documentTypeId: string | null, groupKey: string, partialUpdate: Partial<PropertyTypeContainerResponseModelBaseModel>): Promise<void>;
53
+ removeContainer(documentTypeKey: string | null, containerId?: string | null): Promise<void>;
54
+ createProperty(documentTypeId: string | null, containerId?: string | null, sortOrder?: number): Promise<PropertyTypeResponseModelBaseModel>;
55
+ insertProperty(documentTypeId: string | null, property: PropertyTypeResponseModelBaseModel): Promise<void>;
56
+ removeProperty(documentTypeId: string | null, propertyId: string): Promise<void>;
57
+ updateProperty(documentTypeId: string | null, propertyId: string, partialUpdate: Partial<PropertyTypeResponseModelBaseModel>): Promise<void>;
58
+ rootDocumentTypeObservablePart<PartResult>(mappingFunction: MappingFunction<T, PartResult>): rxjs.Observable<PartResult | undefined>;
59
+ hasPropertyStructuresOf(containerId: string | null): rxjs.Observable<boolean>;
60
+ rootPropertyStructures(): rxjs.Observable<PropertyTypeResponseModelBaseModel[]>;
61
+ propertyStructuresOf(containerId: string | null): rxjs.Observable<PropertyTypeResponseModelBaseModel[]>;
62
+ rootContainers(containerType: PropertyContainerTypes): rxjs.Observable<PropertyTypeContainerResponseModelBaseModel[]>;
63
+ hasRootContainers(containerType: PropertyContainerTypes): rxjs.Observable<boolean>;
64
+ containersOfParentKey(parentId: PropertyTypeContainerResponseModelBaseModel['parentId'], containerType: PropertyContainerTypes): rxjs.Observable<PropertyTypeContainerResponseModelBaseModel[]>;
65
+ containersByNameAndType(name: string, containerType: PropertyContainerTypes): rxjs.Observable<PropertyTypeContainerResponseModelBaseModel[]>;
66
+ private _reset;
67
+ destroy(): void;
68
+ }
69
+
70
+ declare class UmbContentTypeContainerStructureHelper {
71
+ #private;
72
+ private _ownerType?;
73
+ private _childType?;
74
+ private _isRoot;
75
+ private _ownerName?;
76
+ private _ownerKey?;
77
+ private _ownerContainers;
78
+ readonly containers: rxjs.Observable<PropertyTypeContainerResponseModelBaseModel[]>;
79
+ readonly hasProperties: rxjs.Observable<boolean>;
80
+ constructor(host: UmbControllerHostElement);
81
+ setStructureManager(structure: UmbContentTypePropertyStructureManager): void;
82
+ setType(value?: PropertyContainerTypes): void;
83
+ getType(): PropertyContainerTypes | undefined;
84
+ setContainerChildType(value?: PropertyContainerTypes): void;
85
+ getContainerChildType(): PropertyContainerTypes | undefined;
86
+ setName(value?: string): void;
87
+ getName(): string | undefined;
88
+ setIsRoot(value: boolean): void;
89
+ getIsRoot(): boolean;
90
+ private _observeOwnerContainers;
91
+ private _observeOwnerProperties;
92
+ private _observeChildContainers;
93
+ private _observeRootContainers;
94
+ private _insertGroupContainers;
95
+ /**
96
+ * Returns true if the container is an owner container.
97
+ */
98
+ isOwnerContainer(groupId?: string): boolean | undefined;
99
+ /** Manipulate methods: */
100
+ addContainer(ownerId?: string, sortOrder?: number): Promise<void>;
101
+ partialUpdateContainer(groupId?: string, partialUpdate?: Partial<PropertyTypeContainerResponseModelBaseModel>): Promise<void>;
102
+ }
103
+
104
+ declare class UmbContentTypePropertyStructureHelper {
105
+ #private;
106
+ private _containerType?;
107
+ private _isRoot?;
108
+ private _containerName?;
109
+ readonly propertyStructure: rxjs.Observable<PropertyTypeResponseModelBaseModel[]>;
110
+ constructor(host: UmbControllerHostElement);
111
+ setStructureManager(structure: UmbContentTypePropertyStructureManager): void;
112
+ setContainerType(value?: PropertyContainerTypes): void;
113
+ getContainerType(): PropertyContainerTypes | undefined;
114
+ setContainerName(value?: string): void;
115
+ getContainerName(): string | undefined;
116
+ setIsRoot(value: boolean): void;
117
+ getIsRoot(): boolean | undefined;
118
+ private _observeGroupContainers;
119
+ private _observePropertyStructureOf;
120
+ /** Manipulate methods: */
121
+ addProperty(ownerId?: string, sortOrder?: number): Promise<PropertyTypeResponseModelBaseModel | undefined>;
122
+ insertProperty(property: PropertyTypeResponseModelBaseModel, sortOrder?: number): Promise<boolean>;
123
+ removeProperty(propertyId: string): Promise<boolean>;
124
+ partialUpdateProperty(propertyKey?: string, partialUpdate?: Partial<DocumentTypePropertyTypeResponseModel>): Promise<void>;
125
+ }
126
+
127
+ 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';
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,113 @@ 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
+ type HTMLElementConstructor<T = HTMLElement> = new (...args: any[]) => T;
169
+
170
+ declare const UmbContextProviderElement_base: HTMLElementConstructor<UmbControllerHostElement> & {
171
+ new (): HTMLElement;
172
+ prototype: HTMLElement;
173
+ };
174
+ /**
175
+ * Provides a value to the context down the DOM tree.
176
+ *
177
+ * @remarks This element is a wrapper around the `provideContext` function.
178
+ * @slot - The context will be available to all descendants given in the default slot.
179
+ * @throws {Error} If the key property is not set.
180
+ * @throws {Error} If the value property is not set.
181
+ */
182
+ declare class UmbContextProviderElement extends UmbContextProviderElement_base {
183
+ /**
184
+ * The value to provide to the context.
185
+ * @optional
186
+ */
187
+ create?: (host: UmbControllerHostElement) => unknown;
188
+ /**
189
+ * The value to provide to the context.
190
+ * @required
191
+ */
192
+ value: unknown;
193
+ /**
194
+ * The key to provide to the context.
195
+ * @required
196
+ */
197
+ key: string | UmbContextToken$1;
198
+ static get observedAttributes(): string[];
199
+ attributeChangedCallback(name: string, _oldValue: string | UmbContextToken$1, newValue: string | UmbContextToken$1): void;
200
+ constructor();
201
+ connectedCallback(): void;
202
+ }
203
+ declare global {
204
+ interface HTMLElementTagNameMap {
205
+ 'umb-context-provider': UmbContextProviderElement;
206
+ }
207
+ }
208
+
209
+ interface UmbEntityWorkspaceContextInterface<EntityType = unknown> extends UmbWorkspaceContextInterface<EntityType> {
210
+ getEntityId(): string | undefined;
211
+ getEntityType(): string;
212
+ save(): Promise<void>;
213
+ }
214
+
215
+ declare const UMB_ENTITY_WORKSPACE_CONTEXT: UmbContextToken<UmbEntityWorkspaceContextInterface<UmbEntityBase>>;
216
+
217
+ /**
218
+ * Change the collection of Contexts into a simplified array of data
219
+ *
220
+ * @param contexts This is a map of the collected contexts from umb-debug
221
+ * @returns An array of simplified context data
222
+ */
223
+ declare function contextData(contexts: Map<any, any>): Array<DebugContextData>;
224
+ interface DebugContextData {
225
+ /**
226
+ * The alias of the context
227
+ *
228
+ * @type {string}
229
+ * @memberof DebugContextData
230
+ */
231
+ alias: string;
232
+ /**
233
+ * The type of the context such as object or string
234
+ *
235
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
236
+ * @memberof DebugContextData
237
+ */
238
+ type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
239
+ /**
240
+ * Data about the context that includes method and property names
241
+ *
242
+ * @type {DebugContextItemData}
243
+ * @memberof DebugContextData
244
+ */
245
+ data: DebugContextItemData;
246
+ }
247
+ interface DebugContextItemData {
248
+ type: string;
249
+ methods?: Array<unknown>;
250
+ properties?: Array<DebugContextItemPropertyData>;
251
+ value?: unknown;
252
+ }
253
+ interface DebugContextItemPropertyData {
254
+ /**
255
+ * The name of the property
256
+ *
257
+ * @type {string}
258
+ * @memberof DebugContextItemPropertyData
259
+ */
260
+ key: string;
261
+ /**
262
+ * The type of the property's value such as string or number
263
+ *
264
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
265
+ * @memberof DebugContextItemPropertyData
266
+ */
267
+ type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
268
+ /**
269
+ * Simple types such as string or number can have their value displayed stored inside the property
270
+ *
271
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
272
+ * @memberof DebugContextItemPropertyData
273
+ */
274
+ value?: unknown;
275
+ }
276
+
277
+ 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 };
package/controller.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HTMLElementConstructor } from './models';
1
+ import { HTMLElementConstructor } from '@umbraco-cms/backoffice/models';
2
2
 
3
3
  interface UmbControllerInterface {
4
4
  get unique(): string | undefined;
@@ -7,10 +7,11 @@ interface UmbControllerInterface {
7
7
  destroy(): void;
8
8
  }
9
9
 
10
- declare class UmbControllerHostInterface extends HTMLElement {
10
+ declare class UmbControllerHostElement extends HTMLElement {
11
11
  hasController(controller: UmbControllerInterface): boolean;
12
12
  getControllers(filterMethod: (ctrl: UmbControllerInterface) => boolean): UmbControllerInterface[];
13
13
  addController(controller: UmbControllerInterface): void;
14
+ removeControllerByUnique(unique: UmbControllerInterface['unique']): void;
14
15
  removeController(controller: UmbControllerInterface): void;
15
16
  }
16
17
  /**
@@ -20,7 +21,7 @@ declare class UmbControllerHostInterface extends HTMLElement {
20
21
  * @param {Object} superClass - superclass to be extended.
21
22
  * @mixin
22
23
  */
23
- declare const UmbControllerHostMixin: <T extends HTMLElementConstructor<HTMLElement>>(superClass: T) => HTMLElementConstructor<UmbControllerHostInterface> & T;
24
+ declare const UmbControllerHostMixin: <T extends HTMLElementConstructor>(superClass: T) => HTMLElementConstructor<UmbControllerHostElement> & T;
24
25
  declare global {
25
26
  interface HTMLElement {
26
27
  connectedCallback(): void;
@@ -29,13 +30,13 @@ declare global {
29
30
  }
30
31
 
31
32
  declare abstract class UmbController implements UmbControllerInterface {
32
- protected host?: UmbControllerHostInterface;
33
+ protected host?: UmbControllerHostElement;
33
34
  private _alias?;
34
35
  get unique(): string | undefined;
35
- constructor(host: UmbControllerHostInterface, alias?: string);
36
+ constructor(host: UmbControllerHostElement, alias?: string);
36
37
  abstract hostConnected(): void;
37
38
  abstract hostDisconnected(): void;
38
39
  destroy(): void;
39
40
  }
40
41
 
41
- export { UmbController, UmbControllerHostInterface, UmbControllerHostMixin, UmbControllerInterface };
42
+ export { UmbController, UmbControllerHostElement, UmbControllerHostMixin, UmbControllerInterface };