@umbraco-cms/backoffice 1.0.0-next.99fe12c7 → 1.0.0-next.9c008bb2

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,32 @@
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 { UmbFilterModel } from '@umbraco-cms/backoffice/models';
7
+
8
+ declare class UmbCollectionContext<ItemType, FilterModelType extends UmbFilterModel> {
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
+ export { UMB_COLLECTION_CONTEXT_TOKEN, UmbCollectionContext };
@@ -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,6 @@
1
- import { UmbControllerHostInterface, UmbControllerInterface } from './controller';
1
+ import { UmbControllerHostElement, UmbControllerInterface } from '@umbraco-cms/backoffice/controller';
2
+ import { UmbWorkspaceContextInterface } from '@umbraco-cms/backoffice/workspace';
3
+ import { BaseEntity } from '@umbraco-cms/backoffice/models';
2
4
 
3
5
  declare class UmbContextToken<T = unknown> {
4
6
  protected alias: string;
@@ -90,9 +92,9 @@ declare class UmbContextConsumer<HostType extends EventTarget = EventTarget, T =
90
92
  destroy(): void;
91
93
  }
92
94
 
93
- declare class UmbContextConsumerController<T = unknown> extends UmbContextConsumer<UmbControllerHostInterface, T> implements UmbControllerInterface {
95
+ declare class UmbContextConsumerController<T = unknown> extends UmbContextConsumer<UmbControllerHostElement, T> implements UmbControllerInterface {
94
96
  get unique(): undefined;
95
- constructor(host: UmbControllerHostInterface, contextAlias: string | UmbContextToken<T>, callback: UmbContextCallback<T>);
97
+ constructor(host: UmbControllerHostElement, contextAlias: string | UmbContextToken<T>, callback: UmbContextCallback<T>);
96
98
  destroy(): void;
97
99
  }
98
100
 
@@ -136,9 +138,9 @@ declare class UmbContextProvider<HostType extends EventTarget = EventTarget> {
136
138
  destroy(): void;
137
139
  }
138
140
 
139
- declare class UmbContextProviderController<T = unknown> extends UmbContextProvider<UmbControllerHostInterface> implements UmbControllerInterface {
141
+ declare class UmbContextProviderController<T = unknown> extends UmbContextProvider<UmbControllerHostElement> implements UmbControllerInterface {
140
142
  get unique(): string;
141
- constructor(host: UmbControllerHostInterface, contextAlias: string | UmbContextToken<T>, instance: T);
143
+ constructor(host: UmbControllerHostElement, contextAlias: string | UmbContextToken<T>, instance: T);
142
144
  destroy(): void;
143
145
  }
144
146
 
@@ -162,4 +164,72 @@ declare class UmbContextProvideEventImplementation extends Event implements UmbC
162
164
  }
163
165
  declare const isUmbContextProvideEventType: (event: Event) => event is UmbContextProvideEventImplementation;
164
166
 
165
- export { UmbContextCallback, UmbContextConsumer, UmbContextConsumerController, UmbContextDebugRequest, UmbContextProvideEvent, UmbContextProvideEventImplementation, UmbContextProvider, UmbContextProviderController, UmbContextRequestEvent, UmbContextRequestEventImplementation, UmbContextToken, isUmbContextProvideEventType, isUmbContextRequestEvent, umbContextProvideEventType, umbContextRequestEventType, umbDebugContextEventType };
167
+ interface UmbEntityWorkspaceContextInterface<EntityType = unknown> extends UmbWorkspaceContextInterface<EntityType> {
168
+ getEntityId(): string | undefined;
169
+ getEntityType(): string;
170
+ save(): Promise<void>;
171
+ }
172
+
173
+ declare const UMB_ENTITY_WORKSPACE_CONTEXT: UmbContextToken<UmbEntityWorkspaceContextInterface<BaseEntity>>;
174
+
175
+ /**
176
+ * Change the collection of Contexts into a simplified array of data
177
+ *
178
+ * @param contexts This is a map of the collected contexts from umb-debug
179
+ * @returns An array of simplified context data
180
+ */
181
+ declare function contextData(contexts: Map<any, any>): Array<DebugContextData>;
182
+ interface DebugContextData {
183
+ /**
184
+ * The alias of the context
185
+ *
186
+ * @type {string}
187
+ * @memberof DebugContextData
188
+ */
189
+ alias: string;
190
+ /**
191
+ * The type of the context such as object or string
192
+ *
193
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
194
+ * @memberof DebugContextData
195
+ */
196
+ type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
197
+ /**
198
+ * Data about the context that includes method and property names
199
+ *
200
+ * @type {DebugContextItemData}
201
+ * @memberof DebugContextData
202
+ */
203
+ data: DebugContextItemData;
204
+ }
205
+ interface DebugContextItemData {
206
+ type: string;
207
+ methods?: Array<unknown>;
208
+ properties?: Array<DebugContextItemPropertyData>;
209
+ value?: unknown;
210
+ }
211
+ interface DebugContextItemPropertyData {
212
+ /**
213
+ * The name of the property
214
+ *
215
+ * @type {string}
216
+ * @memberof DebugContextItemPropertyData
217
+ */
218
+ key: string;
219
+ /**
220
+ * The type of the property's value such as string or number
221
+ *
222
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
223
+ * @memberof DebugContextItemPropertyData
224
+ */
225
+ type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
226
+ /**
227
+ * Simple types such as string or number can have their value displayed stored inside the property
228
+ *
229
+ * @type {("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")}
230
+ * @memberof DebugContextItemPropertyData
231
+ */
232
+ value?: unknown;
233
+ }
234
+
235
+ export { DebugContextData, DebugContextItemData, DebugContextItemPropertyData, UMB_ENTITY_WORKSPACE_CONTEXT, UmbContextCallback, UmbContextConsumer, UmbContextConsumerController, UmbContextDebugRequest, UmbContextProvideEvent, UmbContextProvideEventImplementation, UmbContextProvider, UmbContextProviderController, 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 };