@umbraco-cms/backoffice 1.0.0-next.ce55cd35 → 1.0.0-next.d2c0dcf1
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/context-api.d.ts +3 -3
- package/controller.d.ts +2 -1
- package/custom-elements.json +536 -384
- package/element.d.ts +4 -4
- package/entity-action.d.ts +6 -13
- package/extensions-api.d.ts +5 -4
- package/extensions-registry.d.ts +171 -10
- package/modal.d.ts +18 -318
- package/models.d.ts +1 -1
- package/notification.d.ts +1 -1
- package/observable-api.d.ts +53 -41
- package/package.json +1 -1
- package/picker-input.d.ts +24 -0
- package/property-editor.d.ts +1 -1
- package/repository.d.ts +51 -26
- package/resources.d.ts +7 -5
- package/router.d.ts +275 -25
- package/sorter.d.ts +103 -0
- package/store.d.ts +43 -48
- package/umbraco-package-schema.json +2439 -0
- package/utils.d.ts +1 -1
- package/vscode-html-custom-data.json +117 -75
- package/workspace.d.ts +5 -5
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as rxjs from 'rxjs';
|
|
2
|
+
import { UmbItemRepository } from '@umbraco-cms/backoffice/repository';
|
|
3
|
+
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
4
|
+
import { UmbModalToken, UmbModalContext } from '@umbraco-cms/backoffice/modal';
|
|
5
|
+
import { ItemResponseModelBaseModel } from '@umbraco-cms/backoffice/backend-api';
|
|
6
|
+
|
|
7
|
+
declare class UmbPickerInputContext<ItemType extends ItemResponseModelBaseModel> {
|
|
8
|
+
#private;
|
|
9
|
+
host: UmbControllerHostElement;
|
|
10
|
+
modalAlias: string | UmbModalToken;
|
|
11
|
+
repository?: UmbItemRepository<ItemType>;
|
|
12
|
+
modalContext?: UmbModalContext;
|
|
13
|
+
selection: rxjs.Observable<string[]>;
|
|
14
|
+
selectedItems: rxjs.Observable<ItemType[]>;
|
|
15
|
+
max: number;
|
|
16
|
+
min: number;
|
|
17
|
+
constructor(host: UmbControllerHostElement, repositoryAlias: string, modalAlias: string | UmbModalToken, getUniqueMethod?: (entry: ItemType) => string | undefined);
|
|
18
|
+
getSelection(): string[];
|
|
19
|
+
setSelection(selection: string[]): void;
|
|
20
|
+
openPicker(pickerData?: any): void;
|
|
21
|
+
requestRemoveItem(unique: string): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { UmbPickerInputContext };
|
package/property-editor.d.ts
CHANGED
package/repository.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { ProblemDetailsModel, FolderReponseModel, CreateFolderRequestModel, UpdateFolderReponseModel, FolderModelBaseModel } from '
|
|
2
|
-
import { DataSourceResponse as DataSourceResponse$1 } from '
|
|
1
|
+
import { ProblemDetailsModel, FolderReponseModel, CreateFolderRequestModel, UpdateFolderReponseModel, FolderModelBaseModel, ItemResponseModelBaseModel } from '@umbraco-cms/backoffice/backend-api';
|
|
2
|
+
import { DataSourceResponse as DataSourceResponse$1, UmbDataSourceErrorResponse as UmbDataSourceErrorResponse$1 } from '@umbraco-cms/backoffice/repository';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
|
|
5
|
-
interface DataSourceResponse<T = undefined> {
|
|
5
|
+
interface DataSourceResponse<T = undefined> extends UmbDataSourceErrorResponse {
|
|
6
6
|
data?: T;
|
|
7
|
+
}
|
|
8
|
+
interface UmbDataSourceErrorResponse {
|
|
7
9
|
error?: ProblemDetailsModel;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
interface UmbDataSource<CreateRequestType, UpdateRequestType, ResponseType> {
|
|
11
|
-
createScaffold(parentId: string | null): Promise<DataSourceResponse$1<
|
|
13
|
+
createScaffold(parentId: string | null): Promise<DataSourceResponse$1<CreateRequestType>>;
|
|
12
14
|
get(unique: string): Promise<DataSourceResponse$1<ResponseType>>;
|
|
13
15
|
insert(data: CreateRequestType): Promise<any>;
|
|
14
16
|
update(unique: string, data: UpdateRequestType): Promise<DataSourceResponse$1<ResponseType>>;
|
|
@@ -29,24 +31,30 @@ interface UmbTreeDataSource<PagedItemsType = any, ItemsType = any> {
|
|
|
29
31
|
getItems(unique: Array<string>): Promise<DataSourceResponse$1<Array<ItemsType>>>;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
interface
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
interface UmbItemDataSource<ItemType> {
|
|
35
|
+
getItems(unique: Array<string>): Promise<DataSourceResponse$1<Array<ItemType>>>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface UmbMoveDataSource {
|
|
39
|
+
move(unique: string, targetUnique: string): Promise<UmbDataSourceErrorResponse$1>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface UmbCopyDataSource {
|
|
43
|
+
copy(unique: string, targetUnique: string): Promise<DataSourceResponse$1<string>>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface UmbRepositoryErrorResponse {
|
|
47
|
+
error?: ProblemDetailsModel;
|
|
48
|
+
}
|
|
49
|
+
interface UmbRepositoryResponse<T> extends UmbRepositoryErrorResponse {
|
|
50
|
+
data?: T;
|
|
51
|
+
}
|
|
52
|
+
interface UmbDetailRepository<CreateRequestType = any, UpdateRequestType = any, ResponseType = any> {
|
|
53
|
+
createScaffold(parentId: string | null): Promise<UmbRepositoryResponse<CreateRequestType>>;
|
|
54
|
+
requestById(id: string): Promise<UmbRepositoryResponse<ResponseType>>;
|
|
55
|
+
create(data: CreateRequestType): Promise<UmbRepositoryErrorResponse>;
|
|
56
|
+
save(id: string, data: UpdateRequestType): Promise<UmbRepositoryErrorResponse>;
|
|
57
|
+
delete(id: string): Promise<UmbRepositoryErrorResponse>;
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
interface UmbPagedData<T> {
|
|
@@ -64,14 +72,14 @@ interface UmbTreeRepository<ItemType = any, PagedItemType = UmbPagedData<ItemTyp
|
|
|
64
72
|
error: ProblemDetailsModel | undefined;
|
|
65
73
|
asObservable?: () => Observable<ItemType[]>;
|
|
66
74
|
}>;
|
|
67
|
-
|
|
75
|
+
requestItemsLegacy?: (uniques: string[]) => Promise<{
|
|
68
76
|
data: Array<ItemType> | undefined;
|
|
69
77
|
error: ProblemDetailsModel | undefined;
|
|
70
78
|
asObservable?: () => Observable<ItemType[]>;
|
|
71
79
|
}>;
|
|
72
80
|
rootTreeItems: () => Promise<Observable<ItemType[]>>;
|
|
73
81
|
treeItemsOf: (parentUnique: string | null) => Promise<Observable<ItemType[]>>;
|
|
74
|
-
|
|
82
|
+
itemsLegacy?: (uniques: string[]) => Promise<Observable<ItemType[]>>;
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
interface UmbFolderRepository {
|
|
@@ -91,9 +99,26 @@ interface UmbFolderRepository {
|
|
|
91
99
|
data?: UpdateFolderReponseModel;
|
|
92
100
|
error?: ProblemDetailsModel;
|
|
93
101
|
}>;
|
|
94
|
-
deleteFolder(
|
|
102
|
+
deleteFolder(id: string): Promise<{
|
|
95
103
|
error?: ProblemDetailsModel;
|
|
96
104
|
}>;
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
|
|
107
|
+
interface UmbItemRepository<ItemType extends ItemResponseModelBaseModel> {
|
|
108
|
+
requestItems: (uniques: string[]) => Promise<{
|
|
109
|
+
data?: Array<ItemType> | undefined;
|
|
110
|
+
error?: ProblemDetailsModel | undefined;
|
|
111
|
+
asObservable?: () => Observable<Array<ItemType>>;
|
|
112
|
+
}>;
|
|
113
|
+
items: (uniques: string[]) => Promise<Observable<Array<ItemType>>>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface UmbMoveRepository {
|
|
117
|
+
move(unique: string, targetUnique: string): Promise<UmbRepositoryErrorResponse>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
interface UmbCopyRepository {
|
|
121
|
+
copy(unique: string, targetUnique: string): Promise<UmbRepositoryResponse<string>>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { DataSourceResponse, UmbCopyDataSource, UmbCopyRepository, UmbDataSource, UmbDataSourceErrorResponse, UmbDetailRepository, UmbFolderDataSource, UmbFolderRepository, UmbItemDataSource, UmbItemRepository, UmbMoveDataSource, UmbMoveRepository, UmbPagedData, UmbRepositoryErrorResponse, UmbRepositoryResponse, UmbTreeDataSource, UmbTreeRepository };
|
package/resources.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UmbNotificationOptions } from '
|
|
2
|
-
import { ProblemDetailsModel } from '
|
|
3
|
-
import { UmbController, UmbControllerHostElement } from '
|
|
4
|
-
import { DataSourceResponse as DataSourceResponse$1 } from '
|
|
1
|
+
import { UmbNotificationOptions } from '@umbraco-cms/backoffice/notification';
|
|
2
|
+
import { ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api';
|
|
3
|
+
import { UmbController, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
4
|
+
import { DataSourceResponse as DataSourceResponse$1 } from '@umbraco-cms/backoffice/repository';
|
|
5
5
|
|
|
6
6
|
declare class UmbResourceController extends UmbController {
|
|
7
7
|
#private;
|
|
@@ -38,8 +38,10 @@ declare class UmbResourceController extends UmbController {
|
|
|
38
38
|
destroy(): void;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
interface DataSourceResponse<T = undefined> {
|
|
41
|
+
interface DataSourceResponse<T = undefined> extends UmbDataSourceErrorResponse {
|
|
42
42
|
data?: T;
|
|
43
|
+
}
|
|
44
|
+
interface UmbDataSourceErrorResponse {
|
|
43
45
|
error?: ProblemDetailsModel;
|
|
44
46
|
}
|
|
45
47
|
|
package/router.d.ts
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
|
-
import { UmbContextToken } from '
|
|
2
|
-
import { UmbControllerHostElement } from '
|
|
3
|
-
import { UmbModalRouteRegistration } from '
|
|
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>;
|
|
1
|
+
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
|
2
|
+
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
3
|
+
import { UmbModalRouteRegistration } from '@umbraco-cms/backoffice/modal';
|
|
22
4
|
|
|
23
5
|
interface IRouterSlot<D = any, P = any> extends HTMLElement {
|
|
24
6
|
readonly route: IRoute<D> | null;
|
|
@@ -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/sorter.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { UmbControllerInterface, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
2
|
+
|
|
3
|
+
type INTERNAL_UmbSorterConfig<T> = {
|
|
4
|
+
compareElementToModel: (el: HTMLElement, modelEntry: T) => boolean;
|
|
5
|
+
querySelectModelToElement: (container: HTMLElement, modelEntry: T) => HTMLElement | null;
|
|
6
|
+
identifier: string;
|
|
7
|
+
itemSelector: string;
|
|
8
|
+
disabledItemSelector?: string;
|
|
9
|
+
containerSelector: string;
|
|
10
|
+
ignorerSelector: string;
|
|
11
|
+
placeholderClass: string;
|
|
12
|
+
draggableSelector?: string;
|
|
13
|
+
boundarySelector?: string;
|
|
14
|
+
dataTransferResolver?: (dataTransfer: DataTransfer | null, currentItem: T) => void;
|
|
15
|
+
onStart?: (argument: {
|
|
16
|
+
item: T;
|
|
17
|
+
element: HTMLElement;
|
|
18
|
+
}) => void;
|
|
19
|
+
onChange?: (argument: {
|
|
20
|
+
item: T;
|
|
21
|
+
element: HTMLElement;
|
|
22
|
+
}) => void;
|
|
23
|
+
onContainerChange?: (argument: {
|
|
24
|
+
item: T;
|
|
25
|
+
element: HTMLElement;
|
|
26
|
+
}) => void;
|
|
27
|
+
onEnd?: (argument: {
|
|
28
|
+
item: T;
|
|
29
|
+
element: HTMLElement;
|
|
30
|
+
}) => void;
|
|
31
|
+
onSync?: (argument: {
|
|
32
|
+
item: T;
|
|
33
|
+
fromController: UmbSorterController<T>;
|
|
34
|
+
toController: UmbSorterController<T>;
|
|
35
|
+
}) => void;
|
|
36
|
+
itemHasNestedContainersResolver?: (element: HTMLElement) => boolean;
|
|
37
|
+
onDisallowed?: () => void;
|
|
38
|
+
onAllowed?: () => void;
|
|
39
|
+
onRequestDrop?: (argument: {
|
|
40
|
+
item: T;
|
|
41
|
+
}) => boolean | void;
|
|
42
|
+
resolveVerticalDirection?: (argument: {
|
|
43
|
+
containerElement: Element;
|
|
44
|
+
containerRect: DOMRect;
|
|
45
|
+
item: T;
|
|
46
|
+
element: HTMLElement;
|
|
47
|
+
elementRect: DOMRect;
|
|
48
|
+
relatedElement: HTMLElement;
|
|
49
|
+
relatedRect: DOMRect;
|
|
50
|
+
placeholderIsInThisRow: boolean;
|
|
51
|
+
horizontalPlaceAfter: boolean;
|
|
52
|
+
}) => void;
|
|
53
|
+
performItemInsert?: (argument: {
|
|
54
|
+
item: T;
|
|
55
|
+
newIndex: number;
|
|
56
|
+
}) => Promise<boolean> | boolean;
|
|
57
|
+
performItemRemove?: (argument: {
|
|
58
|
+
item: T;
|
|
59
|
+
}) => Promise<boolean> | boolean;
|
|
60
|
+
};
|
|
61
|
+
type UmbSorterConfig<T> = Omit<INTERNAL_UmbSorterConfig<T>, 'placeholderClass' | 'ignorerSelector' | 'containerSelector'> & Partial<Pick<INTERNAL_UmbSorterConfig<T>, 'placeholderClass' | 'ignorerSelector' | 'containerSelector'>>;
|
|
62
|
+
/**
|
|
63
|
+
* @export
|
|
64
|
+
* @class UmbSorterController
|
|
65
|
+
* @implements {UmbControllerInterface}
|
|
66
|
+
* @description This controller can make user able to sort items.
|
|
67
|
+
*/
|
|
68
|
+
declare class UmbSorterController<T> implements UmbControllerInterface {
|
|
69
|
+
#private;
|
|
70
|
+
private _lastIndicationContainerVM;
|
|
71
|
+
get unique(): string;
|
|
72
|
+
constructor(host: UmbControllerHostElement, config: UmbSorterConfig<T>);
|
|
73
|
+
setModel(model: Array<T>): void;
|
|
74
|
+
hostConnected(): void;
|
|
75
|
+
private _onFirstRender;
|
|
76
|
+
hostDisconnected(): void;
|
|
77
|
+
setupItem(element: HTMLElement): void;
|
|
78
|
+
destroyItem(element: HTMLElement): void;
|
|
79
|
+
handleDragStart: (event: DragEvent) => void;
|
|
80
|
+
handleDragEnd: () => Promise<void>;
|
|
81
|
+
handleDragMove: (event: DragEvent) => void;
|
|
82
|
+
moveCurrentElement: () => void;
|
|
83
|
+
move(orderedContainerElements: Array<Element>, newElIndex: number): void;
|
|
84
|
+
/** Management methods: */
|
|
85
|
+
getItemOfElement(element: HTMLElement): T | null | undefined;
|
|
86
|
+
removeItem(item: T): Promise<boolean | T | null>;
|
|
87
|
+
hasOtherItemsThan(item: T): boolean;
|
|
88
|
+
sync(element: HTMLElement, fromVm: UmbSorterController<T>): Promise<boolean>;
|
|
89
|
+
updateAllowIndication(contextVM: UmbSorterController<T>, item: T): boolean;
|
|
90
|
+
removeAllowIndication(): void;
|
|
91
|
+
private autoScrollX;
|
|
92
|
+
private autoScrollY;
|
|
93
|
+
private handleAutoScroll;
|
|
94
|
+
private _performAutoScroll;
|
|
95
|
+
private stopAutoScroll;
|
|
96
|
+
notifySync(data: any): void;
|
|
97
|
+
notifyDisallowed(): void;
|
|
98
|
+
notifyAllowed(): void;
|
|
99
|
+
notifyRequestDrop(data: any): boolean;
|
|
100
|
+
destroy(): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { UmbSorterConfig, UmbSorterController };
|