@umbraco-cms/backoffice 1.0.0-next.f1bd6ec7 → 1.0.0-next.f63da516
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 +493 -74
- package/collection.d.ts +38 -0
- package/content-type.d.ts +127 -0
- package/context-api.d.ts +4 -4
- package/controller.d.ts +1 -1
- package/custom-elements.json +1498 -1312
- package/element.d.ts +4 -4
- package/entity-action.d.ts +6 -13
- package/extensions-api.d.ts +13 -13
- package/extensions-registry.d.ts +290 -88
- package/id.d.ts +6 -0
- package/modal.d.ts +35 -23
- package/models.d.ts +3 -70
- 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/repository.d.ts +84 -38
- package/resources.d.ts +24 -15
- package/router.d.ts +4 -16
- package/section.d.ts +29 -0
- package/sorter.d.ts +103 -0
- package/store.d.ts +43 -48
- package/tree.d.ts +14 -0
- package/umbraco-package-schema.json +37755 -0
- package/utils.d.ts +1 -11
- package/vscode-html-custom-data.json +474 -473
- package/workspace.d.ts +37 -19
- package/property-editor.d.ts +0 -8
package/repository.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DataSourceResponse as DataSourceResponse$1 } from '
|
|
1
|
+
import { ApiError, CancelError, FolderReponseModel, CreateFolderRequestModel, UpdateFolderReponseModel, TreeItemPresentationModel, ProblemDetailsModel, 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
|
+
import { UmbTreeRootModel, UmbTreeRootEntityModel } from '@umbraco-cms/backoffice/tree';
|
|
4
5
|
|
|
5
|
-
interface DataSourceResponse<T = undefined> {
|
|
6
|
+
interface DataSourceResponse<T = undefined> extends UmbDataSourceErrorResponse {
|
|
6
7
|
data?: T;
|
|
7
|
-
|
|
8
|
+
}
|
|
9
|
+
interface UmbDataSourceErrorResponse {
|
|
10
|
+
error?: ApiError | CancelError;
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
interface UmbDataSource<CreateRequestType, UpdateRequestType, ResponseType> {
|
|
13
|
+
interface UmbDataSource<CreateRequestType, CreateResponseType, UpdateRequestType, ResponseType> {
|
|
11
14
|
createScaffold(parentId: string | null): Promise<DataSourceResponse$1<CreateRequestType>>;
|
|
12
15
|
get(unique: string): Promise<DataSourceResponse$1<ResponseType>>;
|
|
13
|
-
insert(data: CreateRequestType): Promise<
|
|
16
|
+
insert(data: CreateRequestType): Promise<DataSourceResponse$1<CreateResponseType>>;
|
|
14
17
|
update(unique: string, data: UpdateRequestType): Promise<DataSourceResponse$1<ResponseType>>;
|
|
15
18
|
delete(unique: string): Promise<DataSourceResponse$1>;
|
|
16
19
|
}
|
|
@@ -23,10 +26,56 @@ interface UmbFolderDataSource {
|
|
|
23
26
|
delete(unique: string): Promise<DataSourceResponse>;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
interface UmbPagedData<T> {
|
|
30
|
+
total: number;
|
|
31
|
+
items: Array<T>;
|
|
32
|
+
}
|
|
33
|
+
interface UmbTreeRepository<TreeItemType extends TreeItemPresentationModel, TreeRootType extends UmbTreeRootModel = UmbTreeRootEntityModel> {
|
|
34
|
+
requestTreeRoot: () => Promise<{
|
|
35
|
+
data?: TreeRootType;
|
|
36
|
+
error?: ProblemDetailsModel;
|
|
37
|
+
}>;
|
|
38
|
+
requestRootTreeItems: () => Promise<{
|
|
39
|
+
data?: UmbPagedData<TreeItemType>;
|
|
40
|
+
error?: ProblemDetailsModel;
|
|
41
|
+
asObservable?: () => Observable<TreeItemType[]>;
|
|
42
|
+
}>;
|
|
43
|
+
requestTreeItemsOf: (parentUnique: string | null) => Promise<{
|
|
44
|
+
data?: UmbPagedData<TreeItemType>;
|
|
45
|
+
error?: ProblemDetailsModel;
|
|
46
|
+
asObservable?: () => Observable<TreeItemType[]>;
|
|
47
|
+
}>;
|
|
48
|
+
requestItemsLegacy?: (uniques: string[]) => Promise<{
|
|
49
|
+
data?: Array<TreeItemType>;
|
|
50
|
+
error?: ProblemDetailsModel;
|
|
51
|
+
asObservable?: () => Observable<any[]>;
|
|
52
|
+
}>;
|
|
53
|
+
rootTreeItems: () => Promise<Observable<TreeItemType[]>>;
|
|
54
|
+
treeItemsOf: (parentUnique: string | null) => Promise<Observable<TreeItemType[]>>;
|
|
55
|
+
itemsLegacy?: (uniques: string[]) => Promise<Observable<any[]>>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface UmbTreeDataSource<ItemType = any, PagedItemType = UmbPagedData<ItemType>> {
|
|
59
|
+
getRootItems(): Promise<DataSourceResponse<PagedItemType>>;
|
|
60
|
+
getChildrenOf(parentUnique: string | null): Promise<DataSourceResponse<PagedItemType>>;
|
|
61
|
+
getItems(unique: Array<string>): Promise<DataSourceResponse<Array<any>>>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface UmbItemDataSource<ItemType> {
|
|
65
|
+
getItems(unique: Array<string>): Promise<DataSourceResponse$1<Array<ItemType>>>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface UmbMoveDataSource {
|
|
69
|
+
move(unique: string, targetUnique: string | null): Promise<UmbDataSourceErrorResponse$1>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface UmbCopyDataSource {
|
|
73
|
+
copy(unique: string, targetUnique: string | null): Promise<DataSourceResponse$1<string>>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface UmbCollectionDataSource<ItemType = any, PagedItemType = UmbPagedData<ItemType>> {
|
|
77
|
+
getCollection(): Promise<DataSourceResponse<PagedItemType>>;
|
|
78
|
+
filterCollection(filter: any): Promise<DataSourceResponse<PagedItemType>>;
|
|
30
79
|
}
|
|
31
80
|
|
|
32
81
|
interface UmbRepositoryErrorResponse {
|
|
@@ -35,39 +84,15 @@ interface UmbRepositoryErrorResponse {
|
|
|
35
84
|
interface UmbRepositoryResponse<T> extends UmbRepositoryErrorResponse {
|
|
36
85
|
data?: T;
|
|
37
86
|
}
|
|
38
|
-
interface UmbDetailRepository<CreateRequestType = any, UpdateRequestType = any, ResponseType = any> {
|
|
87
|
+
interface UmbDetailRepository<CreateRequestType = any, CreateResponseType = any, UpdateRequestType = any, ResponseType = any> {
|
|
39
88
|
createScaffold(parentId: string | null): Promise<UmbRepositoryResponse<CreateRequestType>>;
|
|
40
89
|
requestById(id: string): Promise<UmbRepositoryResponse<ResponseType>>;
|
|
41
|
-
|
|
90
|
+
byId(id: string): Promise<Observable<ResponseType>>;
|
|
91
|
+
create(data: CreateRequestType): Promise<UmbRepositoryResponse<CreateResponseType>>;
|
|
42
92
|
save(id: string, data: UpdateRequestType): Promise<UmbRepositoryErrorResponse>;
|
|
43
93
|
delete(id: string): Promise<UmbRepositoryErrorResponse>;
|
|
44
94
|
}
|
|
45
95
|
|
|
46
|
-
interface UmbPagedData<T> {
|
|
47
|
-
total: number;
|
|
48
|
-
items: Array<T>;
|
|
49
|
-
}
|
|
50
|
-
interface UmbTreeRepository<ItemType = any, PagedItemType = UmbPagedData<ItemType>> {
|
|
51
|
-
requestRootTreeItems: () => Promise<{
|
|
52
|
-
data: PagedItemType | undefined;
|
|
53
|
-
error: ProblemDetailsModel | undefined;
|
|
54
|
-
asObservable?: () => Observable<ItemType[]>;
|
|
55
|
-
}>;
|
|
56
|
-
requestTreeItemsOf: (parentUnique: string | null) => Promise<{
|
|
57
|
-
data: PagedItemType | undefined;
|
|
58
|
-
error: ProblemDetailsModel | undefined;
|
|
59
|
-
asObservable?: () => Observable<ItemType[]>;
|
|
60
|
-
}>;
|
|
61
|
-
requestTreeItems: (uniques: string[]) => Promise<{
|
|
62
|
-
data: Array<ItemType> | undefined;
|
|
63
|
-
error: ProblemDetailsModel | undefined;
|
|
64
|
-
asObservable?: () => Observable<ItemType[]>;
|
|
65
|
-
}>;
|
|
66
|
-
rootTreeItems: () => Promise<Observable<ItemType[]>>;
|
|
67
|
-
treeItemsOf: (parentUnique: string | null) => Promise<Observable<ItemType[]>>;
|
|
68
|
-
treeItems: (uniques: string[]) => Promise<Observable<ItemType[]>>;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
96
|
interface UmbFolderRepository {
|
|
72
97
|
createFolderScaffold(parentId: string | null): Promise<{
|
|
73
98
|
data?: FolderReponseModel;
|
|
@@ -90,4 +115,25 @@ interface UmbFolderRepository {
|
|
|
90
115
|
}>;
|
|
91
116
|
}
|
|
92
117
|
|
|
93
|
-
|
|
118
|
+
interface UmbCollectionRepository {
|
|
119
|
+
requestCollection(filter?: any): Promise<any>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface UmbItemRepository<ItemType extends ItemResponseModelBaseModel> {
|
|
123
|
+
requestItems: (uniques: string[]) => Promise<{
|
|
124
|
+
data?: Array<ItemType> | undefined;
|
|
125
|
+
error?: ProblemDetailsModel | undefined;
|
|
126
|
+
asObservable?: () => Observable<Array<ItemType>>;
|
|
127
|
+
}>;
|
|
128
|
+
items: (uniques: string[]) => Promise<Observable<Array<ItemType>>>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface UmbMoveRepository {
|
|
132
|
+
move(unique: string, targetUnique: string): Promise<UmbRepositoryErrorResponse>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface UmbCopyRepository {
|
|
136
|
+
copy(unique: string, targetUnique: string): Promise<UmbRepositoryResponse<string>>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { DataSourceResponse, UmbCollectionDataSource, UmbCollectionRepository, UmbCopyDataSource, UmbCopyRepository, UmbDataSource, UmbDataSourceErrorResponse, UmbDetailRepository, UmbFolderDataSource, UmbFolderRepository, UmbItemDataSource, UmbItemRepository, UmbMoveDataSource, UmbMoveRepository, UmbPagedData, UmbRepositoryErrorResponse, UmbRepositoryResponse, UmbTreeDataSource, UmbTreeRepository };
|
package/resources.d.ts
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import { UmbNotificationOptions } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { UmbNotificationOptions } from '@umbraco-cms/backoffice/notification';
|
|
2
|
+
import { UmbController, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
3
|
+
import { DataSourceResponse as DataSourceResponse$1 } from '@umbraco-cms/backoffice/repository';
|
|
4
|
+
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
|
5
|
+
import { ApiError, CancelError } from '@umbraco-cms/backoffice/backend-api';
|
|
5
6
|
|
|
6
7
|
declare class UmbResourceController extends UmbController {
|
|
7
8
|
#private;
|
|
8
9
|
constructor(host: UmbControllerHostElement, promise: Promise<any>, alias?: string);
|
|
9
10
|
hostConnected(): void;
|
|
10
11
|
hostDisconnected(): void;
|
|
11
|
-
/**
|
|
12
|
-
* Extract the ProblemDetailsModel object from an ApiError.
|
|
13
|
-
*
|
|
14
|
-
* This assumes that all ApiErrors contain a ProblemDetailsModel object in their body.
|
|
15
|
-
*/
|
|
16
|
-
static toProblemDetailsModel(error: unknown): ProblemDetailsModel | undefined;
|
|
17
12
|
/**
|
|
18
13
|
* Base execute function with a try/catch block and return a tuple with the result and the error.
|
|
19
14
|
*/
|
|
20
15
|
static tryExecute<T>(promise: Promise<T>): Promise<DataSourceResponse$1<T>>;
|
|
21
16
|
/**
|
|
22
|
-
* Wrap the {
|
|
17
|
+
* Wrap the {tryExecute} function in a try/catch block and return the result.
|
|
23
18
|
* If the executor function throws an error, then show the details in a notification.
|
|
24
19
|
*/
|
|
25
20
|
tryExecuteAndNotify<T>(options?: UmbNotificationOptions): Promise<DataSourceResponse$1<T>>;
|
|
@@ -38,13 +33,27 @@ declare class UmbResourceController extends UmbController {
|
|
|
38
33
|
destroy(): void;
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The base URL of the configured Umbraco server.
|
|
38
|
+
* If the server is local, this will be an empty string.
|
|
39
|
+
*
|
|
40
|
+
* @remarks This is the base URL of the Umbraco server, not the base URL of the backoffice.
|
|
41
|
+
*
|
|
42
|
+
* @example https://localhost:44300
|
|
43
|
+
* @example https://my-umbraco-site.com
|
|
44
|
+
* @example ''
|
|
45
|
+
*/
|
|
46
|
+
declare const UMB_SERVER_URL: UmbContextToken<string>;
|
|
47
|
+
|
|
48
|
+
interface DataSourceResponse<T = undefined> extends UmbDataSourceErrorResponse {
|
|
42
49
|
data?: T;
|
|
43
|
-
|
|
50
|
+
}
|
|
51
|
+
interface UmbDataSourceErrorResponse {
|
|
52
|
+
error?: ApiError | CancelError;
|
|
44
53
|
}
|
|
45
54
|
|
|
46
55
|
declare function tryExecute<T>(promise: Promise<T>): Promise<DataSourceResponse<T>>;
|
|
47
56
|
|
|
48
|
-
declare function tryExecuteAndNotify<T>(host: UmbControllerHostElement, resource: Promise<T>, options?: UmbNotificationOptions
|
|
57
|
+
declare function tryExecuteAndNotify<T>(host: UmbControllerHostElement, resource: Promise<T>, options?: UmbNotificationOptions): Promise<DataSourceResponse<T>>;
|
|
49
58
|
|
|
50
|
-
export { UmbResourceController, tryExecute, tryExecuteAndNotify };
|
|
59
|
+
export { UMB_SERVER_URL, UmbResourceController, tryExecute, tryExecuteAndNotify };
|
package/router.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UmbContextToken } from '
|
|
2
|
-
import { UmbControllerHostElement } from '
|
|
3
|
-
import { UmbModalRouteRegistration } from '
|
|
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';
|
|
4
4
|
|
|
5
5
|
interface IRouterSlot<D = any, P = any> extends HTMLElement {
|
|
6
6
|
readonly route: IRoute<D> | null;
|
|
@@ -22,7 +22,6 @@ type IRoutingInfo<D = any, P = any> = {
|
|
|
22
22
|
};
|
|
23
23
|
type CustomResolver<D = any, P = any> = ((info: IRoutingInfo<D>) => boolean | void | Promise<boolean> | Promise<void>);
|
|
24
24
|
type Guard<D = any, P = any> = ((info: IRoutingInfo<D, P>) => boolean | Promise<boolean>);
|
|
25
|
-
type Cancel = (() => boolean);
|
|
26
25
|
type PageComponent = HTMLElement | undefined;
|
|
27
26
|
type ModuleResolver = Promise<{
|
|
28
27
|
default: any;
|
|
@@ -99,10 +98,6 @@ type Query = {
|
|
|
99
98
|
[key: string]: string;
|
|
100
99
|
};
|
|
101
100
|
type EventListenerSubscription = (() => void);
|
|
102
|
-
/**
|
|
103
|
-
* RouterSlot related events.
|
|
104
|
-
*/
|
|
105
|
-
type RouterSlotEvent = "changestate";
|
|
106
101
|
/**
|
|
107
102
|
* History related events.
|
|
108
103
|
*/
|
|
@@ -355,13 +350,6 @@ declare function toQueryString(query: Query): string;
|
|
|
355
350
|
*/
|
|
356
351
|
declare function ensureAnchorHistory(): void;
|
|
357
352
|
|
|
358
|
-
interface UmbRouteLocation {
|
|
359
|
-
name?: string;
|
|
360
|
-
params: {
|
|
361
|
-
[key: string]: string;
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
|
|
365
353
|
declare class UmbRouteContext {
|
|
366
354
|
#private;
|
|
367
355
|
private _onGotModals;
|
|
@@ -377,4 +365,4 @@ declare function generateRoutePathBuilder(path: string): (params: {
|
|
|
377
365
|
[key: string]: string | number;
|
|
378
366
|
}) => string;
|
|
379
367
|
|
|
380
|
-
export {
|
|
368
|
+
export { Guard, IComponentRoute, IRedirectRoute, IResolverRoute, IRoutingInfo, PageComponent, Params, Query, UMB_ROUTE_CONTEXT_TOKEN, IRoute as UmbRoute, UmbRouteContext, 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/section.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as rxjs from 'rxjs';
|
|
2
|
+
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
|
3
|
+
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
4
|
+
import { ManifestSection } from '@umbraco-cms/backoffice/extensions-registry';
|
|
5
|
+
|
|
6
|
+
declare class UmbSectionSidebarContext {
|
|
7
|
+
#private;
|
|
8
|
+
contextMenuIsOpen: rxjs.Observable<boolean>;
|
|
9
|
+
entityType: rxjs.Observable<string | undefined>;
|
|
10
|
+
unique: rxjs.Observable<string | null | undefined>;
|
|
11
|
+
headline: rxjs.Observable<string | undefined>;
|
|
12
|
+
constructor(host: UmbControllerHostElement);
|
|
13
|
+
toggleContextMenu(entityType: string, unique: string | null | undefined, headline: string): void;
|
|
14
|
+
openContextMenu(entityType: string, unique: string | null | undefined, headline: string): void;
|
|
15
|
+
closeContextMenu(): void;
|
|
16
|
+
}
|
|
17
|
+
declare const UMB_SECTION_SIDEBAR_CONTEXT_TOKEN: UmbContextToken<UmbSectionSidebarContext>;
|
|
18
|
+
|
|
19
|
+
declare class UmbSectionContext {
|
|
20
|
+
#private;
|
|
21
|
+
readonly alias: rxjs.Observable<string | undefined>;
|
|
22
|
+
readonly pathname: rxjs.Observable<string | undefined>;
|
|
23
|
+
readonly label: rxjs.Observable<string | undefined>;
|
|
24
|
+
constructor(manifest: ManifestSection);
|
|
25
|
+
setManifest(manifest?: ManifestSection): void;
|
|
26
|
+
}
|
|
27
|
+
declare const UMB_SECTION_CONTEXT_TOKEN: UmbContextToken<UmbSectionContext>;
|
|
28
|
+
|
|
29
|
+
export { UMB_SECTION_CONTEXT_TOKEN, UMB_SECTION_SIDEBAR_CONTEXT_TOKEN, UmbSectionContext, UmbSectionSidebarContext };
|
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 };
|
package/store.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as rxjs from 'rxjs';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { UmbControllerHostElement } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
4
|
+
import { UmbArrayState } from '@umbraco-cms/backoffice/observable-api';
|
|
5
|
+
import { EntityTreeItemResponseModel, FileSystemTreeItemPresentationModel } from '@umbraco-cms/backoffice/backend-api';
|
|
6
|
+
import { UmbStoreBase as UmbStoreBase$1, UmbTreeStore as UmbTreeStore$1 } from '@umbraco-cms/backoffice/store';
|
|
6
7
|
|
|
7
8
|
interface UmbDataStoreIdentifiers {
|
|
8
9
|
key?: string;
|
|
@@ -38,39 +39,46 @@ interface UmbContentStore<T> extends UmbEntityDetailStore<T> {
|
|
|
38
39
|
save(data: T[]): Promise<void>;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
interface UmbStore<T> {
|
|
43
|
+
appendItems: (items: Array<T>) => void;
|
|
44
|
+
updateItem: (unique: string, item: Partial<T>) => void;
|
|
45
|
+
removeItem: (unique: string) => void;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*/
|
|
53
|
-
declare class UmbEntityTreeStore extends UmbStoreBase$1 implements UmbTreeStore$1<EntityTreeItemResponseModel> {
|
|
54
|
-
#private;
|
|
48
|
+
declare class UmbStoreBase<StoreItemType = any> implements UmbStore<StoreItemType> {
|
|
49
|
+
protected _host: UmbControllerHostElement;
|
|
50
|
+
protected _data: UmbArrayState<StoreItemType>;
|
|
51
|
+
readonly storeAlias: string;
|
|
52
|
+
constructor(_host: UmbControllerHostElement, storeAlias: string, data: UmbArrayState<StoreItemType>);
|
|
55
53
|
/**
|
|
56
54
|
* Appends items to the store
|
|
57
|
-
* @param {Array<
|
|
55
|
+
* @param {Array<StoreItemType>} items
|
|
58
56
|
* @memberof UmbEntityTreeStore
|
|
59
57
|
*/
|
|
60
|
-
appendItems(items: Array<
|
|
58
|
+
appendItems(items: Array<StoreItemType>): void;
|
|
61
59
|
/**
|
|
62
60
|
* Updates an item in the store
|
|
63
61
|
* @param {string} id
|
|
64
|
-
* @param {Partial<
|
|
62
|
+
* @param {Partial<StoreItemType>} data
|
|
65
63
|
* @memberof UmbEntityTreeStore
|
|
66
64
|
*/
|
|
67
|
-
updateItem(
|
|
65
|
+
updateItem(unique: string, data: Partial<StoreItemType>): void;
|
|
68
66
|
/**
|
|
69
67
|
* Removes an item from the store
|
|
70
68
|
* @param {string} id
|
|
71
69
|
* @memberof UmbEntityTreeStore
|
|
72
70
|
*/
|
|
73
|
-
removeItem(
|
|
71
|
+
removeItem(unique: string): void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @export
|
|
76
|
+
* @class UmbEntityTreeStore
|
|
77
|
+
* @extends {UmbStoreBase}
|
|
78
|
+
* @description - Entity Tree Store
|
|
79
|
+
*/
|
|
80
|
+
declare class UmbEntityTreeStore extends UmbStoreBase$1<EntityTreeItemResponseModel> implements UmbTreeStore$1<EntityTreeItemResponseModel> {
|
|
81
|
+
constructor(host: UmbControllerHostElement, storeAlias: string);
|
|
74
82
|
/**
|
|
75
83
|
* An observable to observe the root items
|
|
76
84
|
* @memberof UmbEntityTreeStore
|
|
@@ -89,36 +97,17 @@ declare class UmbEntityTreeStore extends UmbStoreBase$1 implements UmbTreeStore$
|
|
|
89
97
|
* @return {*}
|
|
90
98
|
* @memberof UmbEntityTreeStore
|
|
91
99
|
*/
|
|
92
|
-
items(ids: Array<string>): rxjs.Observable<EntityTreeItemResponseModel[]>;
|
|
100
|
+
items(ids: Array<string | null>): rxjs.Observable<EntityTreeItemResponseModel[]>;
|
|
93
101
|
}
|
|
94
102
|
|
|
95
103
|
/**
|
|
96
104
|
* @export
|
|
97
105
|
* @class UmbFileSystemTreeStore
|
|
98
106
|
* @extends {UmbStoreBase}
|
|
99
|
-
* @description -
|
|
107
|
+
* @description - File System Tree Store
|
|
100
108
|
*/
|
|
101
|
-
declare class UmbFileSystemTreeStore extends UmbStoreBase$1 implements UmbTreeStore$1<FileSystemTreeItemPresentationModel> {
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Appends items to the store
|
|
105
|
-
* @param {Array<FileSystemTreeItemPresentationModel>} items
|
|
106
|
-
* @memberof UmbFileSystemTreeStore
|
|
107
|
-
*/
|
|
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;
|
|
109
|
+
declare class UmbFileSystemTreeStore extends UmbStoreBase$1<FileSystemTreeItemPresentationModel> implements UmbTreeStore$1<FileSystemTreeItemPresentationModel> {
|
|
110
|
+
constructor(host: UmbControllerHostElement, storeAlias: string);
|
|
122
111
|
/**
|
|
123
112
|
* An observable to observe the root items
|
|
124
113
|
* @memberof UmbFileSystemTreeStore
|
|
@@ -147,13 +136,19 @@ type TreeItemPresentationModel = {
|
|
|
147
136
|
hasChildren?: boolean;
|
|
148
137
|
};
|
|
149
138
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
139
|
+
type ItemResponseModelBaseModel = {
|
|
140
|
+
name?: string;
|
|
141
|
+
id?: string;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
interface UmbTreeStore<T extends TreeItemPresentationModel = any> extends UmbStore<T> {
|
|
154
145
|
rootItems: Observable<Array<T>>;
|
|
155
146
|
childrenOf: (parentUnique: string | null) => Observable<Array<T>>;
|
|
156
147
|
items: (uniques: Array<string>) => Observable<Array<T>>;
|
|
157
148
|
}
|
|
158
149
|
|
|
159
|
-
|
|
150
|
+
interface UmbItemStore<T extends ItemResponseModelBaseModel = any> extends UmbStore<T> {
|
|
151
|
+
items: (uniques: Array<string>) => Observable<Array<T>>;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export { UmbContentStore, UmbDataStore, UmbDataStoreIdentifiers, UmbEntityDetailStore, UmbEntityTreeStore, UmbFileSystemTreeStore, UmbItemStore, UmbStoreBase, UmbTreeStore };
|
package/tree.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface UmbTreeRootModel {
|
|
2
|
+
type: string;
|
|
3
|
+
name: string;
|
|
4
|
+
hasChildren: boolean;
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
interface UmbTreeRootEntityModel extends UmbTreeRootModel {
|
|
8
|
+
id: string | null;
|
|
9
|
+
}
|
|
10
|
+
interface UmbTreeRootFileSystemModel extends UmbTreeRootModel {
|
|
11
|
+
path: string | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { UmbTreeRootEntityModel, UmbTreeRootFileSystemModel, UmbTreeRootModel };
|