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

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.
@@ -1,6 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { ManifestTypes, ManifestKind, ManifestTypeMap, ManifestBase, SpecificManifestTypeOrManifestBase, ManifestElement, ManifestElementWithElementName, ManifestClass } from './extensions-registry';
3
3
  import { UmbContextToken } from './context-api';
4
+ import { PageComponent } from './router';
4
5
  import { UmbControllerHostElement } from './controller';
5
6
 
6
7
  declare class UmbExtensionRegistry {
@@ -22,7 +23,7 @@ declare class UmbExtensionRegistry {
22
23
  }
23
24
  declare const UMB_EXTENSION_REGISTRY_TOKEN: UmbContextToken<UmbExtensionRegistry>;
24
25
 
25
- declare function createExtensionElement(manifest: ManifestElement): Promise<HTMLElement | undefined>;
26
+ declare function createExtensionElement(manifest: ManifestElement): Promise<PageComponent>;
26
27
 
27
28
  declare function hasDefaultExport<ConstructorType>(object: unknown): object is {
28
29
  default: ConstructorType;
package/modal.d.ts CHANGED
@@ -6,8 +6,9 @@ import { LitElement, TemplateResult } from 'lit';
6
6
  import { UUIModalDialogElement, UUIModalSidebarElement, UUIModalSidebarSize } from '@umbraco-ui/uui';
7
7
  import { UmbControllerHostElement, UmbControllerInterface } from './controller';
8
8
  import { UmbContextToken } from './context-api';
9
+ import { Params } from './router';
9
10
  import { UmbModalToken as UmbModalToken$1, UmbModalConfig as UmbModalConfig$1, UmbPickerModalData as UmbPickerModalData$1 } from './modal';
10
- import { LanguageResponseModel } from './backend-api';
11
+ import { LanguageResponseModel, FolderReponseModel } from './backend-api';
11
12
  import { UserDetails } from './models';
12
13
 
13
14
  declare class UmbSearchModalElement extends LitElement {
@@ -104,7 +105,7 @@ interface UmbModalConfig {
104
105
  declare class UmbModalContext {
105
106
  #private;
106
107
  host: UmbControllerHostElement;
107
- readonly modals: rxjs.Observable<UmbModalHandler<object, any>[]>;
108
+ readonly modals: rxjs.Observable<UmbModalHandler[]>;
108
109
  constructor(host: UmbControllerHostElement);
109
110
  search(): UmbModalHandler<any, any>;
110
111
  /**
@@ -126,316 +127,6 @@ declare class UmbModalContext {
126
127
  }
127
128
  declare const UMB_MODAL_CONTEXT_TOKEN: UmbContextToken<UmbModalContext>;
128
129
 
129
- interface IRouterSlot<D = any, P = any> extends HTMLElement {
130
- readonly route: IRoute<D> | null;
131
- readonly isRoot: boolean;
132
- readonly fragments: IPathFragments | null;
133
- readonly params: Params | null;
134
- readonly match: IRouteMatch<D> | null;
135
- routes: IRoute<D>[];
136
- add: ((routes: IRoute<D>[], navigate?: boolean) => void);
137
- clear: (() => void);
138
- render: (() => Promise<void>);
139
- constructAbsolutePath: ((path: PathFragment) => string);
140
- parent: IRouterSlot<P> | null | undefined;
141
- queryParentRouterSlot: (() => IRouterSlot<P> | null);
142
- }
143
- type IRoutingInfo<D = any, P = any> = {
144
- slot: IRouterSlot<D, P>;
145
- match: IRouteMatch<D>;
146
- };
147
- type CustomResolver<D = any, P = any> = ((info: IRoutingInfo<D>) => boolean | void | Promise<boolean> | Promise<void>);
148
- type Guard<D = any, P = any> = ((info: IRoutingInfo<D, P>) => boolean | Promise<boolean>);
149
- type PageComponent = HTMLElement;
150
- type ModuleResolver = Promise<{
151
- default: any;
152
- }>;
153
- type Class<T extends PageComponent = PageComponent> = {
154
- new (...args: any[]): T;
155
- };
156
- type Setup<D = any> = ((component: PageComponent, info: IRoutingInfo<D>) => void);
157
- type PathMatch = "prefix" | "suffix" | "full" | "fuzzy";
158
- /**
159
- * The base route interface.
160
- * D = the data type of the data
161
- */
162
- interface IRouteBase<D = any> {
163
- path: PathFragment;
164
- data?: D;
165
- guards?: Guard[];
166
- pathMatch?: PathMatch;
167
- }
168
- /**
169
- * Route type used for redirection.
170
- */
171
- interface IRedirectRoute<D = any> extends IRouteBase<D> {
172
- redirectTo: string;
173
- preserveQuery?: boolean;
174
- }
175
- /**
176
- * Route type used to resolve and stamp components.
177
- */
178
- interface IComponentRoute<D = any> extends IRouteBase<D> {
179
- component: Class | ModuleResolver | PageComponent | (() => Class) | (() => PageComponent) | (() => ModuleResolver);
180
- setup?: Setup;
181
- }
182
- /**
183
- * Route type used to take control of how the route should resolve.
184
- */
185
- interface IResolverRoute<D = any> extends IRouteBase<D> {
186
- resolve: CustomResolver;
187
- }
188
- type IRoute<D = any> = IRedirectRoute<D> | IComponentRoute<D> | IResolverRoute<D>;
189
- type PathFragment = string;
190
- type IPathFragments = {
191
- consumed: PathFragment;
192
- rest: PathFragment;
193
- };
194
- interface IRouteMatch<D = any> {
195
- route: IRoute<D>;
196
- params: Params;
197
- fragments: IPathFragments;
198
- match: RegExpMatchArray;
199
- }
200
- type PushStateEvent = CustomEvent<null>;
201
- type ReplaceStateEvent = CustomEvent<null>;
202
- type ChangeStateEvent = CustomEvent<null>;
203
- type WillChangeStateEvent = CustomEvent<{
204
- url?: string | null;
205
- eventName: GlobalRouterEvent;
206
- }>;
207
- type NavigationStartEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
208
- type NavigationSuccessEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
209
- type NavigationCancelEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
210
- type NavigationErrorEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
211
- type NavigationEndEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
212
- type Params = {
213
- [key: string]: string;
214
- };
215
- /**
216
- * History related events.
217
- */
218
- type GlobalRouterEvent = "pushstate" | "replacestate" | "popstate" | "changestate" | "willchangestate" | "navigationstart" | "navigationcancel" | "navigationerror" | "navigationsuccess" | "navigationend";
219
- declare global {
220
- interface GlobalEventHandlersEventMap {
221
- "pushstate": PushStateEvent;
222
- "replacestate": ReplaceStateEvent;
223
- "popstate": PopStateEvent;
224
- "changestate": ChangeStateEvent;
225
- "navigationstart": NavigationStartEvent;
226
- "navigationend": NavigationEndEvent;
227
- "navigationsuccess": NavigationSuccessEvent;
228
- "navigationcancel": NavigationCancelEvent;
229
- "navigationerror": NavigationErrorEvent;
230
- "willchangestate": WillChangeStateEvent;
231
- }
232
- }
233
-
234
- /**
235
- * Slot for a node in the router tree.
236
- * @slot - Default content.
237
- * @event changestate - Dispatched when the router slot state changes.
238
- */
239
- declare class RouterSlot<D = any, P = any> extends HTMLElement implements IRouterSlot<D, P> {
240
- /**
241
- * Listeners on the router.
242
- */
243
- private listeners;
244
- /**
245
- * The available routes.
246
- */
247
- private _routes;
248
- get routes(): IRoute<D>[];
249
- set routes(routes: IRoute<D>[]);
250
- /**
251
- * The parent router.
252
- * Is REQUIRED if this router is a child.
253
- * When set, the relevant listeners are added or teared down because they depend on the parent.
254
- */
255
- _parent: IRouterSlot<P> | null | undefined;
256
- get parent(): IRouterSlot<P> | null | undefined;
257
- set parent(router: IRouterSlot<P> | null | undefined);
258
- /**
259
- * Whether the router is a root router.
260
- */
261
- get isRoot(): boolean;
262
- /**
263
- * The current route match.
264
- */
265
- private _routeMatch;
266
- get match(): IRouteMatch<D> | null;
267
- /**
268
- * The current route of the match.
269
- */
270
- get route(): IRoute<D> | null;
271
- /**
272
- * The current path fragment of the match
273
- */
274
- get fragments(): IPathFragments | null;
275
- /**
276
- * The current params of the match.
277
- */
278
- get params(): Params | null;
279
- /**
280
- * Hooks up the element.
281
- */
282
- constructor();
283
- /**
284
- * Query the parent router slot when the router slot is connected.
285
- */
286
- connectedCallback(): void;
287
- /**
288
- * Tears down the element.
289
- */
290
- disconnectedCallback(): void;
291
- /**
292
- * Queries the parent router.
293
- */
294
- queryParentRouterSlot(): IRouterSlot<P> | null;
295
- /**
296
- * Returns an absolute path relative to the router slot.
297
- * @param path
298
- */
299
- constructAbsolutePath(path: PathFragment): string;
300
- /**
301
- * Adds routes to the router.
302
- * Navigates automatically if the router slot is the root and is connected.
303
- * @param routes
304
- * @param navigate
305
- */
306
- add(routes: IRoute<D>[], navigate?: boolean): void;
307
- /**
308
- * Removes all routes.
309
- */
310
- clear(): void;
311
- /**
312
- * Each time the path changes, load the new path.
313
- */
314
- render(): Promise<void>;
315
- /**
316
- * Attaches listeners, either globally or on the parent router.
317
- */
318
- protected attachListeners(): void;
319
- /**
320
- * Clears the children in the DOM.
321
- */
322
- protected clearChildren(): void;
323
- /**
324
- * Detaches the listeners.
325
- */
326
- protected detachListeners(): void;
327
- /**
328
- * Notify the listeners.
329
- */
330
- notifyChildRouters(info: any): void;
331
- /**
332
- * Loads a new path based on the routes.
333
- * Returns true if a navigation was made to a new page.
334
- */
335
- protected renderPath(path: string | PathFragment): Promise<boolean>;
336
- }
337
- declare global {
338
- interface HTMLElementTagNameMap {
339
- "router-slot": RouterSlot;
340
- }
341
- }
342
-
343
- /**
344
- * Router link.
345
- * @slot - Default content.
346
- */
347
- declare class RouterLink extends HTMLElement {
348
- private listeners;
349
- private _context;
350
- static get observedAttributes(): string[];
351
- /**
352
- * The path of the navigation.
353
- * @attr
354
- */
355
- set path(value: string | PathFragment);
356
- get path(): string | PathFragment;
357
- /**
358
- * Whether the element is disabled or not.
359
- * @attr
360
- */
361
- get disabled(): boolean;
362
- set disabled(value: boolean);
363
- /**
364
- * Whether the element is active or not.
365
- * @attr
366
- */
367
- get active(): boolean;
368
- set active(value: boolean);
369
- /**
370
- * Whether the focus should be delegated.
371
- * @attr
372
- */
373
- get delegateFocus(): boolean;
374
- set delegateFocus(value: boolean);
375
- /**
376
- * Whether the query should be preserved or not.
377
- * @attr
378
- */
379
- get preserveQuery(): boolean;
380
- set preserveQuery(value: boolean);
381
- /**
382
- * The current router slot context.
383
- */
384
- get context(): IRouterSlot | null;
385
- set context(value: IRouterSlot | null);
386
- /**
387
- * Returns the absolute path.
388
- */
389
- get absolutePath(): string;
390
- constructor();
391
- /**
392
- * Hooks up the element.
393
- */
394
- connectedCallback(): void;
395
- /**
396
- * Tear down listeners.
397
- */
398
- disconnectedCallback(): void;
399
- /**
400
- * Reacts to attribute changed callback.
401
- * @param name
402
- * @param oldValue
403
- * @param newValue
404
- */
405
- attributeChangedCallback(name: string, oldValue: unknown, newValue: unknown): void;
406
- private updateTabIndex;
407
- /**
408
- * Returns the absolute path constructed relative to the context.
409
- * If no router parent was found the path property is the absolute one.
410
- */
411
- constructAbsolutePath(path: string): string;
412
- /**
413
- * Updates whether the route is active or not.
414
- */
415
- protected updateActive(): void;
416
- /**
417
- * Navigates to the specified path.
418
- */
419
- navigate(path: string, e?: Event): void;
420
- }
421
- declare global {
422
- interface HTMLElementTagNameMap {
423
- "router-link": RouterLink;
424
- }
425
- }
426
-
427
- declare global {
428
- interface History {
429
- "native": {
430
- "back": ((distance?: any) => void);
431
- "forward": ((distance?: any) => void);
432
- "go": ((delta?: any) => void);
433
- "pushState": ((data: any, title?: string, url?: string | null) => void);
434
- "replaceState": ((data: any, title?: string, url?: string | null) => void);
435
- };
436
- }
437
- }
438
-
439
130
  type UmbModalRouteBuilder = (params: {
440
131
  [key: string]: string | number;
441
132
  }) => string;
@@ -478,7 +169,7 @@ declare class UmbModalRouteRegistrationController<D extends object = object, R =
478
169
  }
479
170
 
480
171
  interface UmbAllowedDocumentTypesModalData {
481
- key: string | null;
172
+ id: string | null;
482
173
  }
483
174
  interface UmbAllowedDocumentTypesModalResult {
484
175
  documentTypeKey: string;
@@ -589,8 +280,8 @@ interface UmbImportDictionaryModalData {
589
280
  unique: string | null;
590
281
  }
591
282
  interface UmbImportDictionaryModalResult {
592
- fileName?: string;
593
- parentKey?: string;
283
+ temporaryFileId?: string;
284
+ parentId?: string;
594
285
  }
595
286
  declare const UMB_IMPORT_DICTIONARY_MODAL: UmbModalToken$1<UmbImportDictionaryModalData, UmbImportDictionaryModalResult>;
596
287
 
@@ -674,11 +365,11 @@ interface UmbSectionPickerModalData {
674
365
  declare const UMB_SECTION_PICKER_MODAL: UmbModalToken$1<UmbSectionPickerModalData, unknown>;
675
366
 
676
367
  interface UmbTemplateModalData {
677
- key: string;
368
+ id: string;
678
369
  language?: 'razor' | 'typescript' | 'javascript' | 'css' | 'markdown' | 'json' | 'html';
679
370
  }
680
371
  interface UmbTemplateModalResult {
681
- key: string;
372
+ id: string;
682
373
  }
683
374
  declare const UMB_TEMPLATE_MODAL: UmbModalToken$1<UmbTemplateModalData, UmbTemplateModalResult>;
684
375
 
@@ -695,6 +386,15 @@ declare const UMB_USER_GROUP_PICKER_MODAL: UmbModalToken$1<UmbPickerModalData$1<
695
386
 
696
387
  declare const UMB_USER_PICKER_MODAL: UmbModalToken$1<UmbPickerModalData$1<UserDetails>, unknown>;
697
388
 
389
+ interface UmbFolderModalData {
390
+ repositoryAlias: string;
391
+ unique?: string;
392
+ }
393
+ interface UmbFolderModalResult {
394
+ folder: FolderReponseModel;
395
+ }
396
+ declare const UMB_FOLDER_MODAL: UmbModalToken$1<UmbFolderModalData, UmbFolderModalResult>;
397
+
698
398
  interface UmbPickerModalData<T> {
699
399
  multiple: boolean;
700
400
  selection: Array<string>;
@@ -704,4 +404,4 @@ interface UmbPickerModalResult<T> {
704
404
  selection: Array<string>;
705
405
  }
706
406
 
707
- export { OEmbedResult, OEmbedStatus, UMB_ALLOWED_DOCUMENT_TYPES_MODAL, UMB_CHANGE_PASSWORD_MODAL, UMB_CONFIRM_MODAL, UMB_CONTEXT_DEBUGGER_MODAL, UMB_CREATE_DICTIONARY_MODAL, UMB_CREATE_USER_MODAL, UMB_CURRENT_USER_MODAL, UMB_DOCUMENT_PICKER_MODAL, UMB_DOCUMENT_TYPE_PICKER_MODAL, UMB_EMBEDDED_MEDIA_MODAL, UMB_EXAMINE_FIELDS_SETTINGS_MODAL, UMB_EXPORT_DICTIONARY_MODAL, UMB_ICON_PICKER_MODAL, UMB_IMPORT_DICTIONARY_MODAL, UMB_INVITE_USER_MODAL, UMB_LANGUAGE_PICKER_MODAL, UMB_LINK_PICKER_MODAL, UMB_MEDIA_PICKER_MODAL, UMB_MODAL_CONTEXT_TOKEN, UMB_PROPERTY_EDITOR_UI_PICKER_MODAL, UMB_PROPERTY_SETTINGS_MODAL, UMB_SEARCH_MODAL, UMB_SECTION_PICKER_MODAL, UMB_TEMPLATE_MODAL, UMB_TEMPLATE_PICKER_MODAL, UMB_USER_GROUP_PICKER_MODAL, UMB_USER_PICKER_MODAL, UmbAllowedDocumentTypesModalData, UmbAllowedDocumentTypesModalResult, UmbChangePasswordModalData, UmbConfirmModalData, UmbConfirmModalResult, UmbContextDebuggerModalData, UmbCreateDictionaryModalData, UmbCreateDictionaryModalResult, UmbCreateDocumentModalResultData, UmbDocumentPickerModalData, UmbDocumentPickerModalResult, UmbDocumentTypePickerModalData, UmbDocumentTypePickerModalResult, UmbEmbeddedMediaModalData, UmbEmbeddedMediaModalResult, UmbExamineFieldsSettingsModalData, UmbExportDictionaryModalData, UmbExportDictionaryModalResult, UmbIconPickerModalData, UmbIconPickerModalResult, UmbImportDictionaryModalData, UmbImportDictionaryModalResult, UmbLanguagePickerModalData, UmbLanguagePickerModalResult, UmbLinkPickerConfig, UmbLinkPickerLink, UmbLinkPickerModalData, UmbLinkPickerModalResult, UmbMediaPickerModalData, UmbMediaPickerModalResult, UmbModalConfig, UmbModalContext, UmbModalHandler, UmbModalHandlerClass, UmbModalRouteBuilder, UmbModalRouteRegistration, UmbModalRouteRegistrationController, UmbModalToken, UmbModalType, UmbPickerModalData, UmbPickerModalResult, UmbPropertyEditorUIPickerModalData, UmbPropertyEditorUIPickerModalResult, UmbPropertySettingsModalResult, UmbSectionPickerModalData, UmbTemplateModalData, UmbTemplateModalResult, UmbTemplatePickerModalData, UmbTemplatePickerModalResult };
407
+ export { OEmbedResult, OEmbedStatus, UMB_ALLOWED_DOCUMENT_TYPES_MODAL, UMB_CHANGE_PASSWORD_MODAL, UMB_CONFIRM_MODAL, UMB_CONTEXT_DEBUGGER_MODAL, UMB_CREATE_DICTIONARY_MODAL, UMB_CREATE_USER_MODAL, UMB_CURRENT_USER_MODAL, UMB_DOCUMENT_PICKER_MODAL, UMB_DOCUMENT_TYPE_PICKER_MODAL, UMB_EMBEDDED_MEDIA_MODAL, UMB_EXAMINE_FIELDS_SETTINGS_MODAL, UMB_EXPORT_DICTIONARY_MODAL, UMB_FOLDER_MODAL, UMB_ICON_PICKER_MODAL, UMB_IMPORT_DICTIONARY_MODAL, UMB_INVITE_USER_MODAL, UMB_LANGUAGE_PICKER_MODAL, UMB_LINK_PICKER_MODAL, UMB_MEDIA_PICKER_MODAL, UMB_MODAL_CONTEXT_TOKEN, UMB_PROPERTY_EDITOR_UI_PICKER_MODAL, UMB_PROPERTY_SETTINGS_MODAL, UMB_SEARCH_MODAL, UMB_SECTION_PICKER_MODAL, UMB_TEMPLATE_MODAL, UMB_TEMPLATE_PICKER_MODAL, UMB_USER_GROUP_PICKER_MODAL, UMB_USER_PICKER_MODAL, UmbAllowedDocumentTypesModalData, UmbAllowedDocumentTypesModalResult, UmbChangePasswordModalData, UmbConfirmModalData, UmbConfirmModalResult, UmbContextDebuggerModalData, UmbCreateDictionaryModalData, UmbCreateDictionaryModalResult, UmbCreateDocumentModalResultData, UmbDocumentPickerModalData, UmbDocumentPickerModalResult, UmbDocumentTypePickerModalData, UmbDocumentTypePickerModalResult, UmbEmbeddedMediaModalData, UmbEmbeddedMediaModalResult, UmbExamineFieldsSettingsModalData, UmbExportDictionaryModalData, UmbExportDictionaryModalResult, UmbFolderModalData, UmbFolderModalResult, UmbIconPickerModalData, UmbIconPickerModalResult, UmbImportDictionaryModalData, UmbImportDictionaryModalResult, UmbLanguagePickerModalData, UmbLanguagePickerModalResult, UmbLinkPickerConfig, UmbLinkPickerLink, UmbLinkPickerModalData, UmbLinkPickerModalResult, UmbMediaPickerModalData, UmbMediaPickerModalResult, UmbModalConfig, UmbModalContext, UmbModalHandler, UmbModalHandlerClass, UmbModalRouteBuilder, UmbModalRouteRegistration, UmbModalRouteRegistrationController, UmbModalToken, UmbModalType, UmbPickerModalData, UmbPickerModalResult, UmbPropertyEditorUIPickerModalData, UmbPropertyEditorUIPickerModalResult, UmbPropertySettingsModalResult, UmbSectionPickerModalData, UmbTemplateModalData, UmbTemplateModalResult, UmbTemplatePickerModalData, UmbTemplatePickerModalResult };
package/models.d.ts CHANGED
@@ -3,16 +3,16 @@ import { EntityTreeItemResponseModel, FolderTreeItemResponseModel, PackageManife
3
3
  type HTMLElementConstructor<T = HTMLElement> = new (...args: any[]) => T;
4
4
  type ClassConstructor<T> = new (...args: any[]) => T;
5
5
  interface Entity {
6
- key: string;
6
+ id: string;
7
7
  name: string;
8
8
  icon: string;
9
9
  type: string;
10
10
  hasChildren: boolean;
11
- parentKey: string | null;
11
+ parentId: string | null;
12
12
  }
13
13
  /** Tried to find a common base of our entities — used by Entity Workspace Context */
14
14
  type BaseEntity = {
15
- key?: string;
15
+ id?: string;
16
16
  name?: string;
17
17
  };
18
18
  interface UserEntity extends Entity {
@@ -43,23 +43,23 @@ interface UserGroupDetails extends UserGroupEntity {
43
43
  permissions: Array<string>;
44
44
  }
45
45
  interface MemberTypeDetails extends EntityTreeItemResponseModel {
46
- key: string;
46
+ id: string;
47
47
  alias: string;
48
48
  properties: [];
49
49
  }
50
50
  interface MediaTypeDetails extends FolderTreeItemResponseModel {
51
- key: string;
51
+ id: string;
52
52
  alias: string;
53
53
  properties: [];
54
54
  }
55
55
  interface MemberGroupDetails extends EntityTreeItemResponseModel {
56
- key: string;
56
+ id: string;
57
57
  }
58
58
  interface MemberDetails extends EntityTreeItemResponseModel {
59
- key: string;
59
+ id: string;
60
60
  }
61
61
  interface DocumentBlueprintDetails {
62
- key: string;
62
+ id: string;
63
63
  name: string;
64
64
  type: 'document-blueprint';
65
65
  properties: Array<any>;
@@ -98,19 +98,33 @@ declare class DeepState<T> extends BehaviorSubject<T> {
98
98
  * The ArrayState provides methods to append data when the data is an Object.
99
99
  */
100
100
  declare class ArrayState<T> extends DeepState<T[]> {
101
- private _getUnique?;
101
+ #private;
102
102
  constructor(initialData: T[], getUniqueMethod?: (entry: T) => unknown);
103
+ /**
104
+ * @method sortBy
105
+ * @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting everytime data is set.
106
+ * @description - A sort method to this Subject.
107
+ * @example <caption>Example add sort method</caption>
108
+ * const data = [
109
+ * { key: 1, value: 'foo'},
110
+ * { key: 2, value: 'bar'}
111
+ * ];
112
+ * const myState = new ArrayState(data, (x) => x.key);
113
+ * myState.sortBy((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
114
+ */
115
+ sortBy(sortMethod?: (a: T, b: T) => number): this;
116
+ next(value: T[]): void;
103
117
  /**
104
118
  * @method remove
105
119
  * @param {unknown[]} uniques - The unique values to remove.
106
120
  * @return {ArrayState<T>} Reference to it self.
107
121
  * @description - Remove some new data of this Subject.
108
- * @example <caption>Example remove entry with key '1' and '2'</caption>
122
+ * @example <caption>Example remove entry with id '1' and '2'</caption>
109
123
  * const data = [
110
- * { key: 1, value: 'foo'},
111
- * { key: 2, value: 'bar'}
124
+ * { id: 1, value: 'foo'},
125
+ * { id: 2, value: 'bar'}
112
126
  * ];
113
- * const myState = new ArrayState(data, (x) => x.key);
127
+ * const myState = new ArrayState(data, (x) => x.id);
114
128
  * myState.remove([1, 2]);
115
129
  */
116
130
  remove(uniques: unknown[]): this;
@@ -119,12 +133,12 @@ declare class ArrayState<T> extends DeepState<T[]> {
119
133
  * @param {unknown} unique - The unique value to remove.
120
134
  * @return {ArrayState<T>} Reference to it self.
121
135
  * @description - Remove some new data of this Subject.
122
- * @example <caption>Example remove entry with key '1'</caption>
136
+ * @example <caption>Example remove entry with id '1'</caption>
123
137
  * const data = [
124
- * { key: 1, value: 'foo'},
125
- * { key: 2, value: 'bar'}
138
+ * { id: 1, value: 'foo'},
139
+ * { id: 2, value: 'bar'}
126
140
  * ];
127
- * const myState = new ArrayState(data, (x) => x.key);
141
+ * const myState = new ArrayState(data, (x) => x.id);
128
142
  * myState.removeOne(1);
129
143
  */
130
144
  removeOne(unique: unknown): this;
@@ -241,8 +255,8 @@ declare function createObservablePart<R, T>(source$: Observable<T>, mappingFunct
241
255
  * @param {(previousResult: R, currentResult: R) => boolean} [memoizationFunction] - Method to Compare if the data has changed. Should return true when data is different.
242
256
  * @description - Creates a RxJS Observable from RxJS Subject.
243
257
  * @example <caption>Example append new entry for a ArrayState or a part of DeepState/ObjectState it which is an array. Where the key is unique and the item will be updated if matched with existing.</caption>
244
- * const entry = {key: 'myKey', value: 'myValue'};
245
- * const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.key === key);
258
+ * const entry = {id: 'myKey', value: 'myValue'};
259
+ * const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.id === id);
246
260
  * mySubject.next(newDataSet);
247
261
  */
248
262
  declare function appendToFrozenArray<T>(data: T[], entry: T, getUniqueMethod?: (entry: T) => unknown): T[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-cms/backoffice",
3
- "version": "1.0.0-next.de0ffca0",
3
+ "version": "1.0.0-next.f1bd6ec7",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "umbraco",
package/repository.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ProblemDetailsModel } from './backend-api';
1
+ import { ProblemDetailsModel, FolderReponseModel, CreateFolderRequestModel, UpdateFolderReponseModel, FolderModelBaseModel } from './backend-api';
2
2
  import { DataSourceResponse as DataSourceResponse$1 } from './repository';
3
3
  import { Observable } from 'rxjs';
4
4
 
@@ -7,12 +7,20 @@ interface DataSourceResponse<T = undefined> {
7
7
  error?: ProblemDetailsModel;
8
8
  }
9
9
 
10
- interface UmbDataSource<T> {
11
- createScaffold(parentKey: string | null): Promise<DataSourceResponse$1<T>>;
12
- get(key: string): Promise<DataSourceResponse$1<T>>;
13
- insert(data: T): Promise<DataSourceResponse$1<T>>;
14
- update(data: T): Promise<DataSourceResponse$1<T>>;
15
- delete(key: string): Promise<DataSourceResponse$1<T>>;
10
+ interface UmbDataSource<CreateRequestType, UpdateRequestType, ResponseType> {
11
+ createScaffold(parentId: string | null): Promise<DataSourceResponse$1<CreateRequestType>>;
12
+ get(unique: string): Promise<DataSourceResponse$1<ResponseType>>;
13
+ insert(data: CreateRequestType): Promise<any>;
14
+ update(unique: string, data: UpdateRequestType): Promise<DataSourceResponse$1<ResponseType>>;
15
+ delete(unique: string): Promise<DataSourceResponse$1>;
16
+ }
17
+
18
+ interface UmbFolderDataSource {
19
+ createScaffold(parentId: string | null): Promise<DataSourceResponse<FolderReponseModel>>;
20
+ get(unique: string): Promise<DataSourceResponse<FolderReponseModel>>;
21
+ insert(data: CreateFolderRequestModel): Promise<DataSourceResponse<string>>;
22
+ update(unique: string, data: CreateFolderRequestModel): Promise<DataSourceResponse<UpdateFolderReponseModel>>;
23
+ delete(unique: string): Promise<DataSourceResponse>;
16
24
  }
17
25
 
18
26
  interface UmbTreeDataSource<PagedItemsType = any, ItemsType = any> {
@@ -21,24 +29,18 @@ interface UmbTreeDataSource<PagedItemsType = any, ItemsType = any> {
21
29
  getItems(unique: Array<string>): Promise<DataSourceResponse$1<Array<ItemsType>>>;
22
30
  }
23
31
 
24
- interface UmbDetailRepository<DetailType> {
25
- createScaffold(parentKey: string | null): Promise<{
26
- data?: DetailType;
27
- error?: ProblemDetailsModel;
28
- }>;
29
- requestByKey(key: string): Promise<{
30
- data?: DetailType;
31
- error?: ProblemDetailsModel;
32
- }>;
33
- create(data: DetailType): Promise<{
34
- error?: ProblemDetailsModel;
35
- }>;
36
- save(data: DetailType): Promise<{
37
- error?: ProblemDetailsModel;
38
- }>;
39
- delete(key: string): Promise<{
40
- error?: ProblemDetailsModel;
41
- }>;
32
+ interface UmbRepositoryErrorResponse {
33
+ error?: ProblemDetailsModel;
34
+ }
35
+ interface UmbRepositoryResponse<T> extends UmbRepositoryErrorResponse {
36
+ data?: T;
37
+ }
38
+ interface UmbDetailRepository<CreateRequestType = any, UpdateRequestType = any, ResponseType = any> {
39
+ createScaffold(parentId: string | null): Promise<UmbRepositoryResponse<CreateRequestType>>;
40
+ requestById(id: string): Promise<UmbRepositoryResponse<ResponseType>>;
41
+ create(data: CreateRequestType): Promise<UmbRepositoryErrorResponse>;
42
+ save(id: string, data: UpdateRequestType): Promise<UmbRepositoryErrorResponse>;
43
+ delete(id: string): Promise<UmbRepositoryErrorResponse>;
42
44
  }
43
45
 
44
46
  interface UmbPagedData<T> {
@@ -66,4 +68,26 @@ interface UmbTreeRepository<ItemType = any, PagedItemType = UmbPagedData<ItemTyp
66
68
  treeItems: (uniques: string[]) => Promise<Observable<ItemType[]>>;
67
69
  }
68
70
 
69
- export { DataSourceResponse, UmbDataSource, UmbDetailRepository, UmbPagedData, UmbTreeDataSource, UmbTreeRepository };
71
+ interface UmbFolderRepository {
72
+ createFolderScaffold(parentId: string | null): Promise<{
73
+ data?: FolderReponseModel;
74
+ error?: ProblemDetailsModel;
75
+ }>;
76
+ createFolder(folderRequest: CreateFolderRequestModel): Promise<{
77
+ data?: string;
78
+ error?: ProblemDetailsModel;
79
+ }>;
80
+ requestFolder(unique: string): Promise<{
81
+ data?: FolderReponseModel;
82
+ error?: ProblemDetailsModel;
83
+ }>;
84
+ updateFolder(unique: string, folder: FolderModelBaseModel): Promise<{
85
+ data?: UpdateFolderReponseModel;
86
+ error?: ProblemDetailsModel;
87
+ }>;
88
+ deleteFolder(id: string): Promise<{
89
+ error?: ProblemDetailsModel;
90
+ }>;
91
+ }
92
+
93
+ export { DataSourceResponse, UmbDataSource, UmbDetailRepository, UmbFolderDataSource, UmbFolderRepository, UmbPagedData, UmbRepositoryErrorResponse, UmbRepositoryResponse, UmbTreeDataSource, UmbTreeRepository };