@umbraco-cms/backoffice 1.0.0-next.de0ffca0 → 1.0.0-next.e8be58ec

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,6 +1,6 @@
1
- import { UmbControllerHostElement, UmbControllerInterface } from './controller';
2
- import { UmbWorkspaceContextInterface } from './workspace';
3
- import { BaseEntity } from './models';
1
+ import { UmbControllerHostElement, UmbControllerInterface } from '@umbraco-cms/backoffice/controller';
2
+ import { UmbWorkspaceContextInterface } from '@umbraco-cms/backoffice/workspace';
3
+ import { UmbEntityBase } from '@umbraco-cms/backoffice/models';
4
4
 
5
5
  declare class UmbContextToken<T = unknown> {
6
6
  protected alias: string;
@@ -165,11 +165,71 @@ declare class UmbContextProvideEventImplementation extends Event implements UmbC
165
165
  declare const isUmbContextProvideEventType: (event: Event) => event is UmbContextProvideEventImplementation;
166
166
 
167
167
  interface UmbEntityWorkspaceContextInterface<EntityType = unknown> extends UmbWorkspaceContextInterface<EntityType> {
168
- getEntityKey(): string | undefined;
168
+ getEntityId(): string | undefined;
169
169
  getEntityType(): string;
170
170
  save(): Promise<void>;
171
171
  }
172
172
 
173
- declare const UMB_ENTITY_WORKSPACE_CONTEXT: UmbContextToken<UmbEntityWorkspaceContextInterface<BaseEntity>>;
173
+ declare const UMB_ENTITY_WORKSPACE_CONTEXT: UmbContextToken<UmbEntityWorkspaceContextInterface<UmbEntityBase>>;
174
174
 
175
- export { UMB_ENTITY_WORKSPACE_CONTEXT, UmbContextCallback, UmbContextConsumer, UmbContextConsumerController, UmbContextDebugRequest, UmbContextProvideEvent, UmbContextProvideEventImplementation, UmbContextProvider, UmbContextProviderController, UmbContextRequestEvent, UmbContextRequestEventImplementation, UmbContextToken, isUmbContextProvideEventType, isUmbContextRequestEvent, umbContextProvideEventType, umbContextRequestEventType, umbDebugContextEventType };
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;
@@ -11,6 +11,7 @@ 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 UmbControllerHostElement 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<UmbControllerHostElement> & 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;