@umbraco-cms/backoffice 1.0.0-next.37dcc47c → 1.0.0-next.3b4f30db

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.
package/router.d.ts ADDED
@@ -0,0 +1,380 @@
1
+ import { UmbContextToken } from './context-api';
2
+ import { UmbControllerHostElement } from './controller';
3
+ import { UmbModalRouteRegistration } from './modal';
4
+
5
+ interface IRouterSlot<D = any, P = any> extends HTMLElement {
6
+ readonly route: IRoute<D> | null;
7
+ readonly isRoot: boolean;
8
+ readonly fragments: IPathFragments | null;
9
+ readonly params: Params | null;
10
+ readonly match: IRouteMatch<D> | null;
11
+ routes: IRoute<D>[];
12
+ add: ((routes: IRoute<D>[], navigate?: boolean) => void);
13
+ clear: (() => void);
14
+ render: (() => Promise<void>);
15
+ constructAbsolutePath: ((path: PathFragment) => string);
16
+ parent: IRouterSlot<P> | null | undefined;
17
+ queryParentRouterSlot: (() => IRouterSlot<P> | null);
18
+ }
19
+ type IRoutingInfo<D = any, P = any> = {
20
+ slot: IRouterSlot<D, P>;
21
+ match: IRouteMatch<D>;
22
+ };
23
+ type CustomResolver<D = any, P = any> = ((info: IRoutingInfo<D>) => boolean | void | Promise<boolean> | Promise<void>);
24
+ type Guard<D = any, P = any> = ((info: IRoutingInfo<D, P>) => boolean | Promise<boolean>);
25
+ type Cancel = (() => boolean);
26
+ type PageComponent = HTMLElement | undefined;
27
+ type ModuleResolver = Promise<{
28
+ default: any;
29
+ }>;
30
+ type Class<T extends PageComponent = PageComponent> = {
31
+ new (...args: any[]): T;
32
+ };
33
+ type Component = Class | ModuleResolver | PageComponent | (() => Class) | (() => PromiseLike<Class>) | (() => PageComponent) | (() => PromiseLike<PageComponent>) | (() => ModuleResolver) | (() => PromiseLike<ModuleResolver>);
34
+ type Setup<D = any> = ((component: PageComponent, info: IRoutingInfo<D>) => void);
35
+ type RouterTree<D = any, P = any> = {
36
+ slot: IRouterSlot<D, P>;
37
+ } & {
38
+ child?: RouterTree;
39
+ } | null | undefined;
40
+ type PathMatch = "prefix" | "suffix" | "full" | "fuzzy";
41
+ /**
42
+ * The base route interface.
43
+ * D = the data type of the data
44
+ */
45
+ interface IRouteBase<D = any> {
46
+ path: PathFragment;
47
+ data?: D;
48
+ guards?: Guard[];
49
+ pathMatch?: PathMatch;
50
+ }
51
+ /**
52
+ * Route type used for redirection.
53
+ */
54
+ interface IRedirectRoute<D = any> extends IRouteBase<D> {
55
+ redirectTo: string;
56
+ preserveQuery?: boolean;
57
+ }
58
+ /**
59
+ * Route type used to resolve and stamp components.
60
+ */
61
+ interface IComponentRoute<D = any> extends IRouteBase<D> {
62
+ component: Component | PromiseLike<Component>;
63
+ setup?: Setup;
64
+ }
65
+ /**
66
+ * Route type used to take control of how the route should resolve.
67
+ */
68
+ interface IResolverRoute<D = any> extends IRouteBase<D> {
69
+ resolve: CustomResolver;
70
+ }
71
+ type IRoute<D = any> = IRedirectRoute<D> | IComponentRoute<D> | IResolverRoute<D>;
72
+ type PathFragment = string;
73
+ type IPathFragments = {
74
+ consumed: PathFragment;
75
+ rest: PathFragment;
76
+ };
77
+ interface IRouteMatch<D = any> {
78
+ route: IRoute<D>;
79
+ params: Params;
80
+ fragments: IPathFragments;
81
+ match: RegExpMatchArray;
82
+ }
83
+ type PushStateEvent = CustomEvent<null>;
84
+ type ReplaceStateEvent = CustomEvent<null>;
85
+ type ChangeStateEvent = CustomEvent<null>;
86
+ type WillChangeStateEvent = CustomEvent<{
87
+ url?: string | null;
88
+ eventName: GlobalRouterEvent;
89
+ }>;
90
+ type NavigationStartEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
91
+ type NavigationSuccessEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
92
+ type NavigationCancelEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
93
+ type NavigationErrorEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
94
+ type NavigationEndEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
95
+ type Params = {
96
+ [key: string]: string;
97
+ };
98
+ type Query = {
99
+ [key: string]: string;
100
+ };
101
+ type EventListenerSubscription = (() => void);
102
+ /**
103
+ * RouterSlot related events.
104
+ */
105
+ type RouterSlotEvent = "changestate";
106
+ /**
107
+ * History related events.
108
+ */
109
+ type GlobalRouterEvent = "pushstate" | "replacestate" | "popstate" | "changestate" | "willchangestate" | "navigationstart" | "navigationcancel" | "navigationerror" | "navigationsuccess" | "navigationend";
110
+ interface ISlashOptions {
111
+ start: boolean;
112
+ end: boolean;
113
+ }
114
+ declare global {
115
+ interface GlobalEventHandlersEventMap {
116
+ "pushstate": PushStateEvent;
117
+ "replacestate": ReplaceStateEvent;
118
+ "popstate": PopStateEvent;
119
+ "changestate": ChangeStateEvent;
120
+ "navigationstart": NavigationStartEvent;
121
+ "navigationend": NavigationEndEvent;
122
+ "navigationsuccess": NavigationSuccessEvent;
123
+ "navigationcancel": NavigationCancelEvent;
124
+ "navigationerror": NavigationErrorEvent;
125
+ "willchangestate": WillChangeStateEvent;
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Dispatches a did change route event.
131
+ * @param $elem
132
+ * @param {IRoute} detail
133
+ */
134
+ declare function dispatchRouteChangeEvent<D = any>($elem: HTMLElement, detail: IRoutingInfo<D>): void;
135
+ /**
136
+ * Dispatches an event on the window object.
137
+ * @param name
138
+ * @param detail
139
+ */
140
+ declare function dispatchGlobalRouterEvent<D = any>(name: GlobalRouterEvent, detail?: IRoutingInfo<D>): void;
141
+ /**
142
+ * Adds an event listener (or more) to an element and returns a function to unsubscribe.
143
+ * @param $elem
144
+ * @param type
145
+ * @param listener
146
+ * @param options
147
+ */
148
+ declare function addListener<T extends Event, eventType extends string>($elem: EventTarget, type: eventType[] | eventType, listener: ((e: T) => void), options?: boolean | AddEventListenerOptions): EventListenerSubscription;
149
+ /**
150
+ * Removes the event listeners in the array.
151
+ * @param listeners
152
+ */
153
+ declare function removeListeners(listeners: EventListenerSubscription[]): void;
154
+
155
+ declare const historyPatches: [string, GlobalRouterEvent[]][];
156
+ /**
157
+ * Patches the history object by ensuring correct events are dispatches when the history changes.
158
+ */
159
+ declare function ensureHistoryEvents(): void;
160
+ /**
161
+ * Attaches a global router event after the native function on the object has been invoked.
162
+ * Stores the original function at the _name.
163
+ * @param obj
164
+ * @param functionName
165
+ * @param eventName
166
+ */
167
+ declare function attachCallback(obj: any, functionName: string, eventName: GlobalRouterEvent): void;
168
+ /**
169
+ * Saves the native function on the history object.
170
+ * @param obj
171
+ * @param name
172
+ * @param func
173
+ */
174
+ declare function saveNativeFunction(obj: any, name: string, func: (() => void)): void;
175
+ declare global {
176
+ interface History {
177
+ "native": {
178
+ "back": ((distance?: any) => void);
179
+ "forward": ((distance?: any) => void);
180
+ "go": ((delta?: any) => void);
181
+ "pushState": ((data: any, title?: string, url?: string | null) => void);
182
+ "replaceState": ((data: any, title?: string, url?: string | null) => void);
183
+ };
184
+ }
185
+ }
186
+
187
+ /**
188
+ * Determines whether the path is active.
189
+ * If the full path starts with the path and is followed by the end of the string or a "/" the path is considered active.
190
+ * @param path
191
+ * @param fullPath
192
+ */
193
+ declare function isPathActive(path: string | PathFragment, fullPath?: string): boolean;
194
+ /**
195
+ * Matches a route.
196
+ * @param route
197
+ * @param path
198
+ */
199
+ declare function matchRoute<D = any>(route: IRoute<D>, path: string | PathFragment): IRouteMatch<D> | null;
200
+ /**
201
+ * Matches the first route that matches the given path.
202
+ * @param routes
203
+ * @param path
204
+ */
205
+ declare function matchRoutes<D = any>(routes: IRoute<D>[], path: string | PathFragment): IRouteMatch<D> | null;
206
+ /**
207
+ * Returns the page from the route.
208
+ * If the component provided is a function (and not a class) call the function to get the promise.
209
+ * @param route
210
+ * @param info
211
+ */
212
+ declare function resolvePageComponent(route: IComponentRoute, info: IRoutingInfo): Promise<PageComponent>;
213
+ /**
214
+ * Determines if a route is a redirect route.
215
+ * @param route
216
+ */
217
+ declare function isRedirectRoute(route: IRoute): route is IRedirectRoute;
218
+ /**
219
+ * Determines if a route is a resolver route.
220
+ * @param route
221
+ */
222
+ declare function isResolverRoute(route: IRoute): route is IResolverRoute;
223
+ /**
224
+ * Traverses the router tree up to the root route.
225
+ * @param slot
226
+ */
227
+ declare function traverseRouterTree(slot: IRouterSlot): {
228
+ tree: RouterTree;
229
+ depth: number;
230
+ };
231
+ /**
232
+ * Generates a path based on the router tree.
233
+ * @param tree
234
+ * @param depth
235
+ */
236
+ declare function getFragments(tree: RouterTree, depth: number): PathFragment[];
237
+ /**
238
+ * Constructs the correct absolute path based on a router.
239
+ * - Handles relative paths: "mypath"
240
+ * - Handles absolute paths: "/mypath"
241
+ * - Handles traversing paths: "../../mypath"
242
+ * @param slot
243
+ * @param path
244
+ */
245
+ declare function constructAbsolutePath<D = any, P = any>(slot: IRouterSlot<D, P>, path?: string | PathFragment): string;
246
+ /**
247
+ * Handles a redirect.
248
+ * @param slot
249
+ * @param route
250
+ */
251
+ declare function handleRedirect(slot: IRouterSlot, route: IRedirectRoute): void;
252
+ /**
253
+ * Determines whether the navigation should start based on the current match and the new match.
254
+ * @param currentMatch
255
+ * @param newMatch
256
+ */
257
+ declare function shouldNavigate<D>(currentMatch: IRouteMatch<D> | null, newMatch: IRouteMatch<D>): boolean;
258
+
259
+ /**
260
+ * Queries the parent router.
261
+ * @param $elem
262
+ */
263
+ declare function queryParentRouterSlot<D = any>($elem: Element): IRouterSlot<D> | null;
264
+ /**
265
+ * Traverses the roots and returns the first match.
266
+ * The minRoots parameter indicates how many roots should be traversed before we started matching with the query.
267
+ * @param $elem
268
+ * @param query
269
+ * @param minRoots
270
+ * @param roots
271
+ */
272
+ declare function queryParentRoots<T>($elem: Element, query: string, minRoots?: number, roots?: number): T | null;
273
+
274
+ /**
275
+ * The current path of the location.
276
+ * As default slashes are included at the start and end.
277
+ * @param options
278
+ */
279
+ declare function path(options?: Partial<ISlashOptions>): string;
280
+ /**
281
+ * Returns the path without the base path.
282
+ * @param options
283
+ */
284
+ declare function pathWithoutBasePath(options?: Partial<ISlashOptions>): string;
285
+ /**
286
+ * Returns the base path as defined in the <base> tag in the head in a reliable way.
287
+ * If eg. <base href="/router-slot/"> is defined this function will return "/router-slot/".
288
+ *
289
+ * An alternative would be to use regex on document.baseURI,
290
+ * but that will be unreliable in some cases because it
291
+ * doesn't use the built in HTMLHyperlinkElementUtils.
292
+ *
293
+ * To make this method more performant we could cache the anchor element.
294
+ * As default it will return the base path with slashes in front and at the end.
295
+ */
296
+ declare function basePath(options?: Partial<ISlashOptions>): string;
297
+ /**
298
+ * Creates an URL using the built in HTMLHyperlinkElementUtils.
299
+ * An alternative would be to use regex on document.baseURI,
300
+ * but that will be unreliable in some cases because it
301
+ * doesn't use the built in HTMLHyperlinkElementUtils.
302
+ *
303
+ * As default it will return the base path with slashes in front and at the end.
304
+ * @param path
305
+ * @param options
306
+ */
307
+ declare function constructPathWithBasePath(path: string, options?: Partial<ISlashOptions>): string;
308
+ /**
309
+ * Removes the start of the path that matches the part.
310
+ * @param path
311
+ * @param part
312
+ */
313
+ declare function stripStart(path: string, part: string): string;
314
+ /**
315
+ * Returns the query string.
316
+ */
317
+ declare function queryString(): string;
318
+ /**
319
+ * Returns the params for the current path.
320
+ * @returns Params
321
+ */
322
+ declare function query(): Query;
323
+ /**
324
+ * Strips the slash from the start and end of a path.
325
+ * @param path
326
+ */
327
+ declare function stripSlash(path: string): string;
328
+ /**
329
+ * Ensures the path starts and ends with a slash
330
+ * @param path
331
+ */
332
+ declare function ensureSlash(path: string): string;
333
+ /**
334
+ * Makes sure that the start and end slashes are present or not depending on the options.
335
+ * @param path
336
+ * @param start
337
+ * @param end
338
+ */
339
+ declare function slashify(path: string, { start, end }?: Partial<ISlashOptions>): string;
340
+ /**
341
+ * Turns a query string into an object.
342
+ * @param {string} queryString (example: ("test=123&hejsa=LOL&wuhuu"))
343
+ * @returns {Query}
344
+ */
345
+ declare function toQuery(queryString: string): Query;
346
+ /**
347
+ * Turns a query object into a string query.
348
+ * @param query
349
+ */
350
+ declare function toQueryString(query: Query): string;
351
+
352
+ /**
353
+ * Hook up a click listener to the window that, for all anchor tags
354
+ * that has a relative HREF, uses the history API instead.
355
+ */
356
+ declare function ensureAnchorHistory(): void;
357
+
358
+ interface UmbRouteLocation {
359
+ name?: string;
360
+ params: {
361
+ [key: string]: string;
362
+ };
363
+ }
364
+
365
+ declare class UmbRouteContext {
366
+ #private;
367
+ private _onGotModals;
368
+ constructor(host: UmbControllerHostElement, _onGotModals: (contextRoutes: any) => void);
369
+ registerModal(registration: UmbModalRouteRegistration): UmbModalRouteRegistration<object, any>;
370
+ unregisterModal(registrationToken: ReturnType<typeof this$1.registerModal>): void;
371
+ _internal_routerGotBasePath(routerBasePath: string): void;
372
+ _internal_modalRouterChanged(activeModalPath: string | undefined): void;
373
+ }
374
+ declare const UMB_ROUTE_CONTEXT_TOKEN: UmbContextToken<UmbRouteContext>;
375
+
376
+ declare function generateRoutePathBuilder(path: string): (params: {
377
+ [key: string]: string | number;
378
+ }) => string;
379
+
380
+ export { Cancel, ChangeStateEvent, Class, Component, CustomResolver, EventListenerSubscription, GlobalRouterEvent, Guard, IComponentRoute, IPathFragments, IRedirectRoute, IResolverRoute, IRoute, IRouteBase, IRouteMatch, IRouterSlot, IRoutingInfo, ISlashOptions, ModuleResolver, NavigationCancelEvent, NavigationEndEvent, NavigationErrorEvent, NavigationStartEvent, NavigationSuccessEvent, PageComponent, Params, PathFragment, PathMatch, PushStateEvent, Query, ReplaceStateEvent, RouterSlotEvent, RouterTree, Setup, UMB_ROUTE_CONTEXT_TOKEN, IRoute as UmbRoute, UmbRouteContext, UmbRouteLocation, WillChangeStateEvent, addListener, attachCallback, basePath, constructAbsolutePath, constructPathWithBasePath, dispatchGlobalRouterEvent, dispatchRouteChangeEvent, ensureAnchorHistory, ensureHistoryEvents, ensureSlash, generateRoutePathBuilder, getFragments, handleRedirect, historyPatches, isPathActive, isRedirectRoute, isResolverRoute, matchRoute, matchRoutes, path, pathWithoutBasePath, query, queryParentRoots, queryParentRouterSlot, queryString, removeListeners, resolvePageComponent, saveNativeFunction, shouldNavigate, slashify, stripSlash, stripStart, toQuery, toQueryString, traverseRouterTree };
package/store.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as rxjs from 'rxjs';
2
2
  import { Observable } from 'rxjs';
3
- import { UmbControllerHostInterface } from './controller';
4
- import { EntityTreeItemResponseModel } from './backend-api';
5
- import { UmbStoreBase as UmbStoreBase$1 } from './store';
3
+ import { UmbControllerHostElement } from './controller';
4
+ import { EntityTreeItemResponseModel, FileSystemTreeItemPresentationModel } from './backend-api';
5
+ import { UmbStoreBase as UmbStoreBase$1, UmbTreeStore as UmbTreeStore$1 } from './store';
6
6
 
7
7
  interface UmbDataStoreIdentifiers {
8
8
  key?: string;
@@ -11,24 +11,6 @@ interface UmbDataStoreIdentifiers {
11
11
  interface UmbDataStore {
12
12
  readonly storeAlias: string;
13
13
  }
14
- interface UmbTreeStore<T> extends UmbDataStore {
15
- getTreeRoot(): Observable<Array<T>>;
16
- getTreeItemChildren(key: string): Observable<Array<T>>;
17
- /**
18
- * @description - Trash data.
19
- * @param {string[]} keys
20
- * @return {*} {(Promise<void>)}
21
- * @memberof UmbTreeStore
22
- */
23
- trash(keys: string[]): Promise<void>;
24
- /**
25
- * @description - Move data.
26
- * @param {string[]} keys
27
- * @return {*} {(Promise<void>)}
28
- * @memberof UmbTreeStore
29
- */
30
- move(keys: string[], destination: string): Promise<void>;
31
- }
32
14
  interface UmbEntityDetailStore<T> extends UmbDataStore {
33
15
  /**
34
16
  * @description - Request scaffold data by entityType and . The data is added to the store and is returned as an Observable.
@@ -36,7 +18,7 @@ interface UmbEntityDetailStore<T> extends UmbDataStore {
36
18
  * @return {*} {T}
37
19
  * @memberof UmbEntityDetailStore
38
20
  */
39
- getScaffold: (entityType: string, parentKey: string | null) => T;
21
+ getScaffold: (entityType: string, parentId: string | null) => T;
40
22
  /**
41
23
  * @description - Request data by key. The data is added to the store and is returned as an Observable.
42
24
  * @param {string} key
@@ -57,57 +39,121 @@ interface UmbContentStore<T> extends UmbEntityDetailStore<T> {
57
39
  }
58
40
 
59
41
  declare class UmbStoreBase {
60
- protected _host: UmbControllerHostInterface;
42
+ protected _host: UmbControllerHostElement;
61
43
  readonly storeAlias: string;
62
- constructor(_host: UmbControllerHostInterface, storeAlias: string);
44
+ constructor(_host: UmbControllerHostElement, storeAlias: string);
63
45
  }
64
46
 
65
47
  /**
66
48
  * @export
67
- * @class UmbTreeStoreBase
49
+ * @class UmbEntityTreeStore
68
50
  * @extends {UmbStoreBase}
69
51
  * @description - General Tree Data Store
70
52
  */
71
- declare class UmbTreeStoreBase extends UmbStoreBase$1 {
53
+ declare class UmbEntityTreeStore extends UmbStoreBase$1 implements UmbTreeStore$1<EntityTreeItemResponseModel> {
72
54
  #private;
73
55
  /**
74
56
  * Appends items to the store
75
- * @param {Array<EntityTreeItemModel>} items
76
- * @memberof UmbTreeStoreBase
57
+ * @param {Array<EntityTreeItemResponseModel>} items
58
+ * @memberof UmbEntityTreeStore
77
59
  */
78
60
  appendItems(items: Array<EntityTreeItemResponseModel>): void;
79
61
  /**
80
62
  * Updates an item in the store
81
- * @param {string} key
82
- * @param {Partial<EntityTreeItemModel>} data
83
- * @memberof UmbTreeStoreBase
63
+ * @param {string} id
64
+ * @param {Partial<EntityTreeItemResponseModel>} data
65
+ * @memberof UmbEntityTreeStore
84
66
  */
85
- updateItem(key: string, data: Partial<EntityTreeItemResponseModel>): void;
67
+ updateItem(id: string, data: Partial<EntityTreeItemResponseModel>): void;
86
68
  /**
87
69
  * Removes an item from the store
88
- * @param {string} key
89
- * @memberof UmbTreeStoreBase
70
+ * @param {string} id
71
+ * @memberof UmbEntityTreeStore
90
72
  */
91
- removeItem(key: string): void;
73
+ removeItem(id: string): void;
92
74
  /**
93
75
  * An observable to observe the root items
94
- * @memberof UmbTreeStoreBase
76
+ * @memberof UmbEntityTreeStore
95
77
  */
96
78
  rootItems: rxjs.Observable<EntityTreeItemResponseModel[]>;
97
79
  /**
98
80
  * Returns an observable to observe the children of a given parent
99
- * @param {(string | null)} parentKey
81
+ * @param {(string | null)} parentId
100
82
  * @return {*}
101
- * @memberof UmbTreeStoreBase
83
+ * @memberof UmbEntityTreeStore
102
84
  */
103
- childrenOf(parentKey: string | null): rxjs.Observable<EntityTreeItemResponseModel[]>;
85
+ childrenOf(parentId: string | null): rxjs.Observable<EntityTreeItemResponseModel[]>;
104
86
  /**
105
- * Returns an observable to observe the items with the given keys
106
- * @param {Array<string>} keys
87
+ * Returns an observable to observe the items with the given ids
88
+ * @param {Array<string>} ids
107
89
  * @return {*}
108
- * @memberof UmbTreeStoreBase
90
+ * @memberof UmbEntityTreeStore
91
+ */
92
+ items(ids: Array<string>): rxjs.Observable<EntityTreeItemResponseModel[]>;
93
+ }
94
+
95
+ /**
96
+ * @export
97
+ * @class UmbFileSystemTreeStore
98
+ * @extends {UmbStoreBase}
99
+ * @description - General Tree Data Store
100
+ */
101
+ declare class UmbFileSystemTreeStore extends UmbStoreBase$1 implements UmbTreeStore$1<FileSystemTreeItemPresentationModel> {
102
+ #private;
103
+ /**
104
+ * Appends items to the store
105
+ * @param {Array<FileSystemTreeItemPresentationModel>} items
106
+ * @memberof UmbFileSystemTreeStore
109
107
  */
110
- items(keys: Array<string>): rxjs.Observable<EntityTreeItemResponseModel[]>;
108
+ appendItems(items: Array<FileSystemTreeItemPresentationModel>): void;
109
+ /**
110
+ * Updates an item in the store
111
+ * @param {string} path
112
+ * @param {Partial<FileSystemTreeItemPresentationModel>} data
113
+ * @memberof UmbFileSystemTreeStore
114
+ */
115
+ updateItem(path: string, data: Partial<FileSystemTreeItemPresentationModel>): void;
116
+ /**
117
+ * Removes an item from the store
118
+ * @param {string} path
119
+ * @memberof UmbFileSystemTreeStore
120
+ */
121
+ removeItem(path: string): void;
122
+ /**
123
+ * An observable to observe the root items
124
+ * @memberof UmbFileSystemTreeStore
125
+ */
126
+ rootItems: rxjs.Observable<FileSystemTreeItemPresentationModel[]>;
127
+ /**
128
+ * Returns an observable to observe the children of a given parent
129
+ * @param {(string | null)} parentPath
130
+ * @return {*}
131
+ * @memberof UmbFileSystemTreeStore
132
+ */
133
+ childrenOf(parentPath: string | null): rxjs.Observable<FileSystemTreeItemPresentationModel[]>;
134
+ /**
135
+ * Returns an observable to observe the items with the given ids
136
+ * @param {Array<string>} paths
137
+ * @return {*}
138
+ * @memberof UmbFileSystemTreeStore
139
+ */
140
+ items(paths: Array<string>): rxjs.Observable<FileSystemTreeItemPresentationModel[]>;
141
+ }
142
+
143
+ type TreeItemPresentationModel = {
144
+ name?: string;
145
+ type?: string;
146
+ icon?: string;
147
+ hasChildren?: boolean;
148
+ };
149
+
150
+ interface UmbTreeStore<T extends TreeItemPresentationModel = any> {
151
+ appendItems: (items: Array<T>) => void;
152
+ updateItem: (unique: string, item: Partial<T>) => void;
153
+ removeItem: (unique: string) => void;
154
+ rootItems: Observable<Array<T>>;
155
+ childrenOf: (parentUnique: string | null) => Observable<Array<T>>;
156
+ items: (uniques: Array<string>) => Observable<Array<T>>;
111
157
  }
112
158
 
113
- export { UmbContentStore, UmbDataStore, UmbDataStoreIdentifiers, UmbEntityDetailStore, UmbStoreBase, UmbTreeStore, UmbTreeStoreBase };
159
+ export { UmbContentStore, UmbDataStore, UmbDataStoreIdentifiers, UmbEntityDetailStore, UmbEntityTreeStore, UmbFileSystemTreeStore, UmbStoreBase, UmbTreeStore };
package/utils.d.ts CHANGED
@@ -11,4 +11,6 @@ declare function umbracoPath(path: string): string;
11
11
  declare function buildUdi(entityType: string, guid: string): string;
12
12
  declare function getKeyFromUdi(udi: string): string;
13
13
 
14
- export { buildUdi, getKeyFromUdi, getLookAndColorFromUserStatus, umbracoPath };
14
+ declare function generateGuid(): string;
15
+
16
+ export { buildUdi, generateGuid, getKeyFromUdi, getLookAndColorFromUserStatus, umbracoPath };