@umbraco-cms/backoffice 1.0.0-next.ce55cd35 → 1.0.0-next.d46c6b3e
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/backend-api.d.ts +161 -84
- package/controller.d.ts +1 -0
- package/custom-elements.json +44 -19
- package/extensions-api.d.ts +2 -1
- package/modal.d.ts +1 -310
- package/observable-api.d.ts +40 -40
- package/package.json +1 -1
- package/repository.d.ts +15 -21
- package/router.d.ts +272 -22
- package/store.d.ts +1 -1
- package/vscode-html-custom-data.json +42 -31
- package/workspace.d.ts +3 -3
package/observable-api.d.ts
CHANGED
|
@@ -18,55 +18,55 @@ declare class UmbObserverController<T = unknown> extends UmbObserver<T> implemen
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @export
|
|
21
|
-
* @class
|
|
21
|
+
* @class UmbBasicState
|
|
22
22
|
* @extends {BehaviorSubject<T>}
|
|
23
23
|
* @description - A RxJS BehaviorSubject this Subject ensures the data is unique, not updating any Observes unless there is an actual change of the value.
|
|
24
24
|
*/
|
|
25
|
-
declare class
|
|
25
|
+
declare class UmbBasicState<T> extends BehaviorSubject<T> {
|
|
26
26
|
constructor(initialData: T);
|
|
27
27
|
next(newData: T): void;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* @export
|
|
32
|
-
* @class
|
|
32
|
+
* @class UmbBooleanState
|
|
33
33
|
* @extends {BehaviorSubject<T>}
|
|
34
34
|
* @description - A RxJS BehaviorSubject this Subject ensures the data is unique, not updating any Observes unless there is an actual change of the value.
|
|
35
35
|
*/
|
|
36
|
-
declare class
|
|
36
|
+
declare class UmbBooleanState<T> extends UmbBasicState<T | boolean> {
|
|
37
37
|
constructor(initialData: T | boolean);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* @export
|
|
42
|
-
* @class
|
|
42
|
+
* @class UmbNumberState
|
|
43
43
|
* @extends {BehaviorSubject<T>}
|
|
44
44
|
* @description - A RxJS BehaviorSubject this Subject ensures the data is unique, not updating any Observes unless there is an actual change of the value.
|
|
45
45
|
*/
|
|
46
|
-
declare class
|
|
46
|
+
declare class UmbNumberState<T> extends UmbBasicState<T | number> {
|
|
47
47
|
constructor(initialData: T | number);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* @export
|
|
52
|
-
* @class
|
|
53
|
-
* @extends {
|
|
52
|
+
* @class UmbStringState
|
|
53
|
+
* @extends {UmbBasicState<T>}
|
|
54
54
|
* @description - A RxJS BehaviorSubject this Subject ensures the data is unique, not updating any Observes unless there is an actual change of the value.
|
|
55
55
|
*/
|
|
56
|
-
declare class
|
|
56
|
+
declare class UmbStringState<T> extends UmbBasicState<T | string> {
|
|
57
57
|
constructor(initialData: T | string);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
interface
|
|
61
|
-
equal(otherClass:
|
|
60
|
+
interface UmbClassStateData {
|
|
61
|
+
equal(otherClass: UmbClassStateData): boolean;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* @export
|
|
65
|
-
* @class
|
|
65
|
+
* @class UmbClassState
|
|
66
66
|
* @extends {BehaviorSubject<T>}
|
|
67
67
|
* @description - A RxJS BehaviorSubject which can hold class instance which has a equal method to compare in coming instances for changes.
|
|
68
68
|
*/
|
|
69
|
-
declare class
|
|
69
|
+
declare class UmbClassState<T extends UmbClassStateData | undefined | null> extends BehaviorSubject<T> {
|
|
70
70
|
constructor(initialData: T);
|
|
71
71
|
next(newData: T): void;
|
|
72
72
|
}
|
|
@@ -77,12 +77,12 @@ type MemoizationFunction<R> = (previousResult: R, currentResult: R) => boolean;
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* @export
|
|
80
|
-
* @class
|
|
80
|
+
* @class UmbDeepState
|
|
81
81
|
* @extends {BehaviorSubject<T>}
|
|
82
82
|
* @description - A RxJS BehaviorSubject which deepFreezes the data to ensure its not manipulated from any implementations.
|
|
83
83
|
* Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.
|
|
84
84
|
*/
|
|
85
|
-
declare class
|
|
85
|
+
declare class UmbDeepState<T> extends BehaviorSubject<T> {
|
|
86
86
|
constructor(initialData: T);
|
|
87
87
|
getObservablePart<ReturnType>(mappingFunction: MappingFunction<T, ReturnType>, memoizationFunction?: MemoizationFunction<ReturnType>): rxjs.Observable<ReturnType>;
|
|
88
88
|
next(newData: T): void;
|
|
@@ -90,14 +90,14 @@ declare class DeepState<T> extends BehaviorSubject<T> {
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* @export
|
|
93
|
-
* @class
|
|
94
|
-
* @extends {
|
|
93
|
+
* @class UmbArrayState
|
|
94
|
+
* @extends {UmbDeepState<T>}
|
|
95
95
|
* @description - A RxJS BehaviorSubject which deepFreezes the object-data to ensure its not manipulated from any implementations.
|
|
96
96
|
* Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.
|
|
97
97
|
*
|
|
98
98
|
* The ArrayState provides methods to append data when the data is an Object.
|
|
99
99
|
*/
|
|
100
|
-
declare class
|
|
100
|
+
declare class UmbArrayState<T> extends UmbDeepState<T[]> {
|
|
101
101
|
#private;
|
|
102
102
|
constructor(initialData: T[], getUniqueMethod?: (entry: T) => unknown);
|
|
103
103
|
/**
|
|
@@ -109,7 +109,7 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
109
109
|
* { key: 1, value: 'foo'},
|
|
110
110
|
* { key: 2, value: 'bar'}
|
|
111
111
|
* ];
|
|
112
|
-
* const myState = new
|
|
112
|
+
* const myState = new UmbArrayState(data, (x) => x.key);
|
|
113
113
|
* myState.sortBy((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
|
|
114
114
|
*/
|
|
115
115
|
sortBy(sortMethod?: (a: T, b: T) => number): this;
|
|
@@ -117,35 +117,35 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
117
117
|
/**
|
|
118
118
|
* @method remove
|
|
119
119
|
* @param {unknown[]} uniques - The unique values to remove.
|
|
120
|
-
* @return {
|
|
120
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
121
121
|
* @description - Remove some new data of this Subject.
|
|
122
122
|
* @example <caption>Example remove entry with id '1' and '2'</caption>
|
|
123
123
|
* const data = [
|
|
124
124
|
* { id: 1, value: 'foo'},
|
|
125
125
|
* { id: 2, value: 'bar'}
|
|
126
126
|
* ];
|
|
127
|
-
* const myState = new
|
|
127
|
+
* const myState = new UmbArrayState(data, (x) => x.id);
|
|
128
128
|
* myState.remove([1, 2]);
|
|
129
129
|
*/
|
|
130
130
|
remove(uniques: unknown[]): this;
|
|
131
131
|
/**
|
|
132
132
|
* @method removeOne
|
|
133
133
|
* @param {unknown} unique - The unique value to remove.
|
|
134
|
-
* @return {
|
|
134
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
135
135
|
* @description - Remove some new data of this Subject.
|
|
136
136
|
* @example <caption>Example remove entry with id '1'</caption>
|
|
137
137
|
* const data = [
|
|
138
138
|
* { id: 1, value: 'foo'},
|
|
139
139
|
* { id: 2, value: 'bar'}
|
|
140
140
|
* ];
|
|
141
|
-
* const myState = new
|
|
141
|
+
* const myState = new UmbArrayState(data, (x) => x.id);
|
|
142
142
|
* myState.removeOne(1);
|
|
143
143
|
*/
|
|
144
144
|
removeOne(unique: unknown): this;
|
|
145
145
|
/**
|
|
146
146
|
* @method filter
|
|
147
147
|
* @param {unknown} filterMethod - The unique value to remove.
|
|
148
|
-
* @return {
|
|
148
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
149
149
|
* @description - Remove some new data of this Subject.
|
|
150
150
|
* @example <caption>Example remove entry with key '1'</caption>
|
|
151
151
|
* const data = [
|
|
@@ -153,7 +153,7 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
153
153
|
* { key: 2, value: 'bar'},
|
|
154
154
|
* { key: 3, value: 'poo'}
|
|
155
155
|
* ];
|
|
156
|
-
* const myState = new
|
|
156
|
+
* const myState = new UmbArrayState(data, (x) => x.key);
|
|
157
157
|
* myState.filter((entry) => entry.key !== 1);
|
|
158
158
|
*
|
|
159
159
|
* Result:
|
|
@@ -167,28 +167,28 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
167
167
|
/**
|
|
168
168
|
* @method appendOne
|
|
169
169
|
* @param {T} entry - new data to be added in this Subject.
|
|
170
|
-
* @return {
|
|
170
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
171
171
|
* @description - Append some new data to this Subject.
|
|
172
172
|
* @example <caption>Example append some data.</caption>
|
|
173
173
|
* const data = [
|
|
174
174
|
* { key: 1, value: 'foo'},
|
|
175
175
|
* { key: 2, value: 'bar'}
|
|
176
176
|
* ];
|
|
177
|
-
* const myState = new
|
|
177
|
+
* const myState = new UmbArrayState(data);
|
|
178
178
|
* myState.append({ key: 1, value: 'replaced-foo'});
|
|
179
179
|
*/
|
|
180
180
|
appendOne(entry: T): this;
|
|
181
181
|
/**
|
|
182
182
|
* @method append
|
|
183
183
|
* @param {T[]} entries - A array of new data to be added in this Subject.
|
|
184
|
-
* @return {
|
|
184
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
185
185
|
* @description - Append some new data to this Subject, if it compares to existing data it will replace it.
|
|
186
186
|
* @example <caption>Example append some data.</caption>
|
|
187
187
|
* const data = [
|
|
188
188
|
* { key: 1, value: 'foo'},
|
|
189
189
|
* { key: 2, value: 'bar'}
|
|
190
190
|
* ];
|
|
191
|
-
* const myState = new
|
|
191
|
+
* const myState = new UmbArrayState(data);
|
|
192
192
|
* myState.append([
|
|
193
193
|
* { key: 1, value: 'replaced-foo'},
|
|
194
194
|
* { key: 3, value: 'another-bla'}
|
|
@@ -199,14 +199,14 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
199
199
|
* @method updateOne
|
|
200
200
|
* @param {unknown} unique - Unique value to find entry to update.
|
|
201
201
|
* @param {Partial<T>} entry - new data to be added in this Subject.
|
|
202
|
-
* @return {
|
|
202
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
203
203
|
* @description - Update a item with some new data, requires the ArrayState to be constructed with a getUnique method.
|
|
204
204
|
* @example <caption>Example append some data.</caption>
|
|
205
205
|
* const data = [
|
|
206
206
|
* { key: 1, value: 'foo'},
|
|
207
207
|
* { key: 2, value: 'bar'}
|
|
208
208
|
* ];
|
|
209
|
-
* const myState = new
|
|
209
|
+
* const myState = new UmbArrayState(data, (x) => x.key);
|
|
210
210
|
* myState.updateOne(2, {value: 'updated-bar'});
|
|
211
211
|
*/
|
|
212
212
|
updateOne(unique: unknown, entry: Partial<T>): this;
|
|
@@ -214,22 +214,22 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
216
|
* @export
|
|
217
|
-
* @class
|
|
218
|
-
* @extends {
|
|
217
|
+
* @class UmbObjectState
|
|
218
|
+
* @extends {UmbDeepState<T>}
|
|
219
219
|
* @description - A RxJS BehaviorSubject which deepFreezes the object-data to ensure its not manipulated from any implementations.
|
|
220
220
|
* Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.
|
|
221
221
|
*
|
|
222
|
-
* The
|
|
222
|
+
* The UmbObjectState provides methods to append data when the data is an Object.
|
|
223
223
|
*/
|
|
224
|
-
declare class
|
|
224
|
+
declare class UmbObjectState<T> extends UmbDeepState<T> {
|
|
225
225
|
/**
|
|
226
226
|
* @method update
|
|
227
227
|
* @param {Partial<T>} partialData - A object containing some of the data to update in this Subject.
|
|
228
228
|
* @description - Append some new data to this Object.
|
|
229
|
-
* @return {
|
|
229
|
+
* @return {UmbObjectState<T>} Reference to it self.
|
|
230
230
|
* @example <caption>Example append some data.</caption>
|
|
231
231
|
* const data = {key: 'myKey', value: 'myInitialValue'};
|
|
232
|
-
* const myState = new
|
|
232
|
+
* const myState = new UmbObjectState(data);
|
|
233
233
|
* myState.update({value: 'myNewValue'});
|
|
234
234
|
*/
|
|
235
235
|
update(partialData: Partial<T>): this;
|
|
@@ -254,7 +254,7 @@ declare function createObservablePart<R, T>(source$: Observable<T>, mappingFunct
|
|
|
254
254
|
* @param {(mappable: T) => R} mappingFunction - Method to return the part for this Observable to return.
|
|
255
255
|
* @param {(previousResult: R, currentResult: R) => boolean} [memoizationFunction] - Method to Compare if the data has changed. Should return true when data is different.
|
|
256
256
|
* @description - Creates a RxJS Observable from RxJS Subject.
|
|
257
|
-
* @example <caption>Example append new entry for a ArrayState or a part of
|
|
257
|
+
* @example <caption>Example append new entry for a ArrayState or a part of UmbDeepState/UmbObjectState it which is an array. Where the key is unique and the item will be updated if matched with existing.</caption>
|
|
258
258
|
* const entry = {id: 'myKey', value: 'myValue'};
|
|
259
259
|
* const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.id === id);
|
|
260
260
|
* mySubject.next(newDataSet);
|
|
@@ -268,11 +268,11 @@ declare function appendToFrozenArray<T>(data: T[], entry: T, getUniqueMethod?: (
|
|
|
268
268
|
* @param {(mappable: T) => R} mappingFunction - Method to return the part for this Observable to return.
|
|
269
269
|
* @param {(previousResult: R, currentResult: R) => boolean} [memoizationFunction] - Method to Compare if the data has changed. Should return true when data is different.
|
|
270
270
|
* @description - Creates a RxJS Observable from RxJS Subject.
|
|
271
|
-
* @example <caption>Example append new entry for a ArrayState or a part of
|
|
271
|
+
* @example <caption>Example append new entry for a ArrayState or a part of UmbDeepState/UmbObjectState it which is an array. Where the key is unique and the item will be updated if matched with existing.</caption>
|
|
272
272
|
* const partialEntry = {value: 'myValue'};
|
|
273
273
|
* const newDataSet = partialUpdateFrozenArray(mySubject.getValue(), partialEntry, x => x.key === 'myKey');
|
|
274
274
|
* mySubject.next(newDataSet);
|
|
275
275
|
*/
|
|
276
276
|
declare function partialUpdateFrozenArray<T>(data: T[], partialEntry: Partial<T>, findMethod: (entry: T) => boolean): T[];
|
|
277
277
|
|
|
278
|
-
export {
|
|
278
|
+
export { MappingFunction, UmbArrayState, UmbBasicState, UmbBooleanState, UmbClassState, UmbDeepState, UmbNumberState, UmbObjectState, UmbObserver, UmbObserverController, UmbStringState, appendToFrozenArray, createObservablePart, partialUpdateFrozenArray };
|
package/package.json
CHANGED
package/repository.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface DataSourceResponse<T = undefined> {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
interface UmbDataSource<CreateRequestType, UpdateRequestType, ResponseType> {
|
|
11
|
-
createScaffold(parentId: string | null): Promise<DataSourceResponse$1<
|
|
11
|
+
createScaffold(parentId: string | null): Promise<DataSourceResponse$1<CreateRequestType>>;
|
|
12
12
|
get(unique: string): Promise<DataSourceResponse$1<ResponseType>>;
|
|
13
13
|
insert(data: CreateRequestType): Promise<any>;
|
|
14
14
|
update(unique: string, data: UpdateRequestType): Promise<DataSourceResponse$1<ResponseType>>;
|
|
@@ -29,24 +29,18 @@ interface UmbTreeDataSource<PagedItemsType = any, ItemsType = any> {
|
|
|
29
29
|
getItems(unique: Array<string>): Promise<DataSourceResponse$1<Array<ItemsType>>>;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
interface
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
create(data:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
save(data: DetailType): Promise<{
|
|
45
|
-
error?: ProblemDetailsModel;
|
|
46
|
-
}>;
|
|
47
|
-
delete(key: string): Promise<{
|
|
48
|
-
error?: ProblemDetailsModel;
|
|
49
|
-
}>;
|
|
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>;
|
|
50
44
|
}
|
|
51
45
|
|
|
52
46
|
interface UmbPagedData<T> {
|
|
@@ -91,9 +85,9 @@ interface UmbFolderRepository {
|
|
|
91
85
|
data?: UpdateFolderReponseModel;
|
|
92
86
|
error?: ProblemDetailsModel;
|
|
93
87
|
}>;
|
|
94
|
-
deleteFolder(
|
|
88
|
+
deleteFolder(id: string): Promise<{
|
|
95
89
|
error?: ProblemDetailsModel;
|
|
96
90
|
}>;
|
|
97
91
|
}
|
|
98
92
|
|
|
99
|
-
export { DataSourceResponse, UmbDataSource, UmbDetailRepository, UmbFolderDataSource, UmbFolderRepository, UmbPagedData, UmbTreeDataSource, UmbTreeRepository };
|
|
93
|
+
export { DataSourceResponse, UmbDataSource, UmbDetailRepository, UmbFolderDataSource, UmbFolderRepository, UmbPagedData, UmbRepositoryErrorResponse, UmbRepositoryResponse, UmbTreeDataSource, UmbTreeRepository };
|
package/router.d.ts
CHANGED
|
@@ -2,24 +2,6 @@ import { UmbContextToken } from './context-api';
|
|
|
2
2
|
import { UmbControllerHostElement } from './controller';
|
|
3
3
|
import { UmbModalRouteRegistration } from './modal';
|
|
4
4
|
|
|
5
|
-
interface UmbRouteLocation {
|
|
6
|
-
name?: string;
|
|
7
|
-
params: {
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare class UmbRouteContext {
|
|
13
|
-
#private;
|
|
14
|
-
private _onGotModals;
|
|
15
|
-
constructor(host: UmbControllerHostElement, _onGotModals: (contextRoutes: any) => void);
|
|
16
|
-
registerModal(registration: UmbModalRouteRegistration): UmbModalRouteRegistration<object, any>;
|
|
17
|
-
unregisterModal(registrationToken: ReturnType<typeof this$1.registerModal>): void;
|
|
18
|
-
_internal_routerGotBasePath(routerBasePath: string): void;
|
|
19
|
-
_internal_modalRouterChanged(activeModalPath: string | undefined): void;
|
|
20
|
-
}
|
|
21
|
-
declare const UMB_ROUTE_CONTEXT_TOKEN: UmbContextToken<UmbRouteContext>;
|
|
22
|
-
|
|
23
5
|
interface IRouterSlot<D = any, P = any> extends HTMLElement {
|
|
24
6
|
readonly route: IRoute<D> | null;
|
|
25
7
|
readonly isRoot: boolean;
|
|
@@ -40,14 +22,21 @@ type IRoutingInfo<D = any, P = any> = {
|
|
|
40
22
|
};
|
|
41
23
|
type CustomResolver<D = any, P = any> = ((info: IRoutingInfo<D>) => boolean | void | Promise<boolean> | Promise<void>);
|
|
42
24
|
type Guard<D = any, P = any> = ((info: IRoutingInfo<D, P>) => boolean | Promise<boolean>);
|
|
43
|
-
type
|
|
25
|
+
type Cancel = (() => boolean);
|
|
26
|
+
type PageComponent = HTMLElement | undefined;
|
|
44
27
|
type ModuleResolver = Promise<{
|
|
45
28
|
default: any;
|
|
46
29
|
}>;
|
|
47
30
|
type Class<T extends PageComponent = PageComponent> = {
|
|
48
31
|
new (...args: any[]): T;
|
|
49
32
|
};
|
|
33
|
+
type Component = Class | ModuleResolver | PageComponent | (() => Class) | (() => PromiseLike<Class>) | (() => PageComponent) | (() => PromiseLike<PageComponent>) | (() => ModuleResolver) | (() => PromiseLike<ModuleResolver>);
|
|
50
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;
|
|
51
40
|
type PathMatch = "prefix" | "suffix" | "full" | "fuzzy";
|
|
52
41
|
/**
|
|
53
42
|
* The base route interface.
|
|
@@ -70,7 +59,7 @@ interface IRedirectRoute<D = any> extends IRouteBase<D> {
|
|
|
70
59
|
* Route type used to resolve and stamp components.
|
|
71
60
|
*/
|
|
72
61
|
interface IComponentRoute<D = any> extends IRouteBase<D> {
|
|
73
|
-
component:
|
|
62
|
+
component: Component | PromiseLike<Component>;
|
|
74
63
|
setup?: Setup;
|
|
75
64
|
}
|
|
76
65
|
/**
|
|
@@ -106,10 +95,22 @@ type NavigationEndEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
|
|
|
106
95
|
type Params = {
|
|
107
96
|
[key: string]: string;
|
|
108
97
|
};
|
|
98
|
+
type Query = {
|
|
99
|
+
[key: string]: string;
|
|
100
|
+
};
|
|
101
|
+
type EventListenerSubscription = (() => void);
|
|
102
|
+
/**
|
|
103
|
+
* RouterSlot related events.
|
|
104
|
+
*/
|
|
105
|
+
type RouterSlotEvent = "changestate";
|
|
109
106
|
/**
|
|
110
107
|
* History related events.
|
|
111
108
|
*/
|
|
112
109
|
type GlobalRouterEvent = "pushstate" | "replacestate" | "popstate" | "changestate" | "willchangestate" | "navigationstart" | "navigationcancel" | "navigationerror" | "navigationsuccess" | "navigationend";
|
|
110
|
+
interface ISlashOptions {
|
|
111
|
+
start: boolean;
|
|
112
|
+
end: boolean;
|
|
113
|
+
}
|
|
113
114
|
declare global {
|
|
114
115
|
interface GlobalEventHandlersEventMap {
|
|
115
116
|
"pushstate": PushStateEvent;
|
|
@@ -125,6 +126,255 @@ declare global {
|
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
|
|
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;
|
|
129
379
|
|
|
130
|
-
export { UMB_ROUTE_CONTEXT_TOKEN, UmbRoute, UmbRouteContext, UmbRouteLocation };
|
|
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
|
@@ -132,7 +132,7 @@ declare class UmbFileSystemTreeStore extends UmbStoreBase$1 implements UmbTreeSt
|
|
|
132
132
|
*/
|
|
133
133
|
childrenOf(parentPath: string | null): rxjs.Observable<FileSystemTreeItemPresentationModel[]>;
|
|
134
134
|
/**
|
|
135
|
-
* Returns an observable to observe the items with the given
|
|
135
|
+
* Returns an observable to observe the items with the given ids
|
|
136
136
|
* @param {Array<string>} paths
|
|
137
137
|
* @return {*}
|
|
138
138
|
* @memberof UmbFileSystemTreeStore
|