@umbraco-cms/backoffice 14.0.0--preview004-37f7727e → 14.0.0--preview004-a655feee
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/dist-cms/custom-elements.json +11 -11
- package/dist-cms/packages/core/collection/collection-alias.condition.js +2 -2
- package/dist-cms/packages/core/collection/collection-view.manager.d.ts +27 -0
- package/dist-cms/packages/core/collection/collection-view.manager.js +75 -0
- package/dist-cms/packages/core/collection/components/collection-action-bundle.element.js +2 -2
- package/dist-cms/packages/core/collection/components/collection-selection-actions.element.js +9 -2
- package/dist-cms/packages/core/collection/components/collection-view-bundle.element.js +5 -5
- package/dist-cms/packages/core/collection/components/pagination/collection-pagination.element.js +2 -2
- package/dist-cms/packages/core/collection/{collection-default.context.d.ts → default/collection-default.context.d.ts} +13 -26
- package/dist-cms/packages/core/collection/{collection-default.context.js → default/collection-default.context.js} +12 -61
- package/dist-cms/packages/core/collection/{collection-default.element.d.ts → default/collection-default.element.d.ts} +1 -1
- package/dist-cms/packages/core/collection/{collection-default.element.js → default/collection-default.element.js} +11 -29
- package/dist-cms/packages/core/collection/index.d.ts +3 -3
- package/dist-cms/packages/core/collection/index.js +3 -3
- package/dist-cms/packages/core/collection/types.d.ts +2 -1
- package/dist-cms/packages/documents/documents/collection/views/table/document-table-collection-view.element.js +2 -2
- package/dist-cms/packages/media/media/collection-view/media-grid-collection-view.element.js +2 -2
- package/dist-cms/packages/media/media/collection-view/media-table-collection-view.element.js +2 -2
- package/dist-cms/packages/user/user/collection/user-collection-header.element.js +2 -2
- package/dist-cms/packages/user/user/collection/user-collection.context.js +2 -1
- package/dist-cms/packages/user/user/collection/views/grid/user-grid-collection-view.element.js +2 -2
- package/dist-cms/packages/user/user/collection/views/index.d.ts +2 -0
- package/dist-cms/packages/user/user/collection/views/index.js +2 -0
- package/dist-cms/packages/user/user/collection/views/manifests.d.ts +2 -0
- package/dist-cms/packages/user/user/collection/views/manifests.js +4 -2
- package/dist-cms/packages/user/user/collection/views/table/user-table-collection-view.element.js +2 -2
- package/dist-cms/packages/user/user-group/collection/views/user-group-table-collection-view.element.js +2 -2
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +5 -5
- package/package.json +1 -1
|
@@ -427,17 +427,6 @@
|
|
|
427
427
|
}
|
|
428
428
|
]
|
|
429
429
|
},
|
|
430
|
-
{
|
|
431
|
-
"name": "umb-collection-default",
|
|
432
|
-
"path": "./../src/packages/core/collection/collection-default.element.ts",
|
|
433
|
-
"properties": [
|
|
434
|
-
{
|
|
435
|
-
"name": "styles",
|
|
436
|
-
"type": "array",
|
|
437
|
-
"default": "[\"UmbTextStyles\",null]"
|
|
438
|
-
}
|
|
439
|
-
]
|
|
440
|
-
},
|
|
441
430
|
{
|
|
442
431
|
"name": "umb-collection",
|
|
443
432
|
"path": "./../src/packages/core/collection/collection.element.ts",
|
|
@@ -524,6 +513,17 @@
|
|
|
524
513
|
}
|
|
525
514
|
]
|
|
526
515
|
},
|
|
516
|
+
{
|
|
517
|
+
"name": "umb-collection-default",
|
|
518
|
+
"path": "./../src/packages/core/collection/default/collection-default.element.ts",
|
|
519
|
+
"properties": [
|
|
520
|
+
{
|
|
521
|
+
"name": "styles",
|
|
522
|
+
"type": "array",
|
|
523
|
+
"default": "[\"UmbTextStyles\",null]"
|
|
524
|
+
}
|
|
525
|
+
]
|
|
526
|
+
},
|
|
527
527
|
{
|
|
528
528
|
"name": "umb-backoffice-modal-container",
|
|
529
529
|
"path": "./../src/packages/core/components/backoffice-modal-container/backoffice-modal-container.element.ts",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT } from './default/collection-default.context.js';
|
|
2
2
|
import { UmbBaseController } from '../../../libs/class-api/index.js';
|
|
3
3
|
export class UmbCollectionAliasCondition extends UmbBaseController {
|
|
4
4
|
#onChange;
|
|
@@ -7,7 +7,7 @@ export class UmbCollectionAliasCondition extends UmbBaseController {
|
|
|
7
7
|
this.permitted = false;
|
|
8
8
|
this.config = args.config;
|
|
9
9
|
this.#onChange = args.onChange;
|
|
10
|
-
this.consumeContext(
|
|
10
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (context) => {
|
|
11
11
|
this.permitted = context.getManifest()?.alias === this.config.match;
|
|
12
12
|
this.#onChange();
|
|
13
13
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UmbBaseController } from '../../../libs/class-api/index.js';
|
|
2
|
+
import { UmbControllerHost } from '../../../libs/controller-api/index.js';
|
|
3
|
+
import { ManifestCollectionView } from '../extension-registry/index.js';
|
|
4
|
+
import { UmbRoute } from '../../../shared/router/index.js';
|
|
5
|
+
export interface UmbCollectionViewManagerConfig {
|
|
6
|
+
defaultViewAlias?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class UmbCollectionViewManager extends UmbBaseController {
|
|
9
|
+
#private;
|
|
10
|
+
readonly views: import("rxjs").Observable<ManifestCollectionView[]>;
|
|
11
|
+
readonly currentView: import("rxjs").Observable<ManifestCollectionView | undefined>;
|
|
12
|
+
readonly routes: import("rxjs").Observable<UmbRoute[]>;
|
|
13
|
+
readonly rootPathname: import("rxjs").Observable<string>;
|
|
14
|
+
constructor(host: UmbControllerHost, config: UmbCollectionViewManagerConfig);
|
|
15
|
+
/**
|
|
16
|
+
* Sets the current view.
|
|
17
|
+
* @param {ManifestCollectionView} view
|
|
18
|
+
* @memberof UmbCollectionContext
|
|
19
|
+
*/
|
|
20
|
+
setCurrentView(view: ManifestCollectionView): void;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the current view.
|
|
23
|
+
* @return {ManifestCollectionView}
|
|
24
|
+
* @memberof UmbCollectionContext
|
|
25
|
+
*/
|
|
26
|
+
getCurrentView(): ManifestCollectionView | undefined;
|
|
27
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { UmbBaseController } from '../../../libs/class-api/index.js';
|
|
2
|
+
import { UmbExtensionsManifestInitializer, createExtensionElement } from '../../../libs/extension-api/index.js';
|
|
3
|
+
import { umbExtensionsRegistry } from '../extension-registry/index.js';
|
|
4
|
+
import { UmbArrayState, UmbObjectState, UmbStringState } from '../../../libs/observable-api/index.js';
|
|
5
|
+
export class UmbCollectionViewManager extends UmbBaseController {
|
|
6
|
+
#views;
|
|
7
|
+
#currentView;
|
|
8
|
+
#routes;
|
|
9
|
+
#rootPathname;
|
|
10
|
+
#defaultViewAlias;
|
|
11
|
+
constructor(host, config) {
|
|
12
|
+
super(host);
|
|
13
|
+
this.#views = new UmbArrayState([], (x) => x.alias);
|
|
14
|
+
this.views = this.#views.asObservable();
|
|
15
|
+
this.#currentView = new UmbObjectState(undefined);
|
|
16
|
+
this.currentView = this.#currentView.asObservable();
|
|
17
|
+
this.#routes = new UmbArrayState([], (x) => x.path);
|
|
18
|
+
this.routes = this.#routes.asObservable();
|
|
19
|
+
this.#rootPathname = new UmbStringState('');
|
|
20
|
+
this.rootPathname = this.#rootPathname.asObservable();
|
|
21
|
+
this.#defaultViewAlias = config.defaultViewAlias;
|
|
22
|
+
this.#observeViews();
|
|
23
|
+
// TODO: hack - we need to figure out how to get the "parent path" from the router
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
const currentUrl = new URL(window.location.href);
|
|
26
|
+
this.#rootPathname.next(currentUrl.pathname.substring(0, currentUrl.pathname.lastIndexOf('/')));
|
|
27
|
+
}, 100);
|
|
28
|
+
}
|
|
29
|
+
// Views
|
|
30
|
+
/**
|
|
31
|
+
* Sets the current view.
|
|
32
|
+
* @param {ManifestCollectionView} view
|
|
33
|
+
* @memberof UmbCollectionContext
|
|
34
|
+
*/
|
|
35
|
+
setCurrentView(view) {
|
|
36
|
+
this.#currentView.next(view);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the current view.
|
|
40
|
+
* @return {ManifestCollectionView}
|
|
41
|
+
* @memberof UmbCollectionContext
|
|
42
|
+
*/
|
|
43
|
+
getCurrentView() {
|
|
44
|
+
return this.#currentView.getValue();
|
|
45
|
+
}
|
|
46
|
+
#observeViews() {
|
|
47
|
+
return new UmbExtensionsManifestInitializer(this, umbExtensionsRegistry, 'collectionView', null, (views) => {
|
|
48
|
+
const manifests = views.map((view) => view.manifest);
|
|
49
|
+
this.#views.next(manifests);
|
|
50
|
+
this.#createRoutes(manifests);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
#createRoutes(views) {
|
|
54
|
+
let routes = [];
|
|
55
|
+
if (views) {
|
|
56
|
+
// find the default view from the config. If it doesn't exist, use the first view
|
|
57
|
+
const defaultView = views.find((view) => view.alias === this.#defaultViewAlias);
|
|
58
|
+
const fallbackView = defaultView?.meta.pathName || views[0].meta.pathName;
|
|
59
|
+
routes = views.map((view) => {
|
|
60
|
+
return {
|
|
61
|
+
path: `${view.meta.pathName}`,
|
|
62
|
+
component: () => createExtensionElement(view),
|
|
63
|
+
setup: () => {
|
|
64
|
+
this.setCurrentView(view);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
routes.push({
|
|
69
|
+
path: '',
|
|
70
|
+
redirectTo: fallbackView,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
this.#routes.next(routes);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '../default/collection-default.context.js';
|
|
8
8
|
import { html, customElement, state, nothing } from '../../../../external/lit/index.js';
|
|
9
9
|
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
10
10
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
@@ -13,7 +13,7 @@ let UmbCollectionActionBundleElement = class UmbCollectionActionBundleElement ex
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super();
|
|
15
15
|
this._collectionAlias = '';
|
|
16
|
-
this.consumeContext(
|
|
16
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (context) => {
|
|
17
17
|
this.#collectionContext = context;
|
|
18
18
|
if (!this.#collectionContext)
|
|
19
19
|
return;
|
package/dist-cms/packages/core/collection/components/collection-selection-actions.element.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
8
8
|
import { css, html, nothing, customElement, state } from '../../../../external/lit/index.js';
|
|
9
|
-
import {
|
|
9
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '../index.js';
|
|
10
10
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
11
11
|
let UmbCollectionSelectionActionsElement = class UmbCollectionSelectionActionsElement extends UmbLitElement {
|
|
12
12
|
constructor() {
|
|
@@ -15,7 +15,7 @@ let UmbCollectionSelectionActionsElement = class UmbCollectionSelectionActionsEl
|
|
|
15
15
|
this._selectionLength = 0;
|
|
16
16
|
this._extensionProps = {};
|
|
17
17
|
this._selection = [];
|
|
18
|
-
this.consumeContext(
|
|
18
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (instance) => {
|
|
19
19
|
this._collectionContext = instance;
|
|
20
20
|
this._observeCollectionContext();
|
|
21
21
|
});
|
|
@@ -74,6 +74,13 @@ let UmbCollectionSelectionActionsElement = class UmbCollectionSelectionActionsEl
|
|
|
74
74
|
static { this.styles = [
|
|
75
75
|
UmbTextStyles,
|
|
76
76
|
css `
|
|
77
|
+
:host {
|
|
78
|
+
width: 100%;
|
|
79
|
+
margin-right: calc(
|
|
80
|
+
-1 * var(--uui-size-space-6)
|
|
81
|
+
); // compensate for the padding on the container. TODO: make a better solution
|
|
82
|
+
}
|
|
83
|
+
|
|
77
84
|
#container {
|
|
78
85
|
display: flex;
|
|
79
86
|
gap: var(--uui-size-3);
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '../default/collection-default.context.js';
|
|
8
8
|
import { css, html, customElement, state, nothing } from '../../../../external/lit/index.js';
|
|
9
9
|
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
10
10
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
@@ -13,7 +13,7 @@ let UmbCollectionViewBundleElement = class UmbCollectionViewBundleElement extend
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super();
|
|
15
15
|
this._views = [];
|
|
16
|
-
this.consumeContext(
|
|
16
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (context) => {
|
|
17
17
|
this.#collectionContext = context;
|
|
18
18
|
if (!this.#collectionContext)
|
|
19
19
|
return;
|
|
@@ -23,18 +23,18 @@ let UmbCollectionViewBundleElement = class UmbCollectionViewBundleElement extend
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
#observeRootPathname() {
|
|
26
|
-
this.observe(this.#collectionContext.rootPathname, (rootPathname) => {
|
|
26
|
+
this.observe(this.#collectionContext.view.rootPathname, (rootPathname) => {
|
|
27
27
|
this._collectionRootPathname = rootPathname;
|
|
28
28
|
}, 'umbCollectionRootPathnameObserver');
|
|
29
29
|
}
|
|
30
30
|
#observeCurrentView() {
|
|
31
|
-
this.observe(this.#collectionContext.currentView, (view) => {
|
|
31
|
+
this.observe(this.#collectionContext.view.currentView, (view) => {
|
|
32
32
|
//TODO: This is not called when the view is changed
|
|
33
33
|
this._currentView = view;
|
|
34
34
|
}, 'umbCurrentCollectionViewObserver');
|
|
35
35
|
}
|
|
36
36
|
#observeViews() {
|
|
37
|
-
this.observe(this.#collectionContext.views, (views) => {
|
|
37
|
+
this.observe(this.#collectionContext.view.views, (views) => {
|
|
38
38
|
this._views = views;
|
|
39
39
|
}, 'umbCollectionViewsObserver');
|
|
40
40
|
}
|
package/dist-cms/packages/core/collection/components/pagination/collection-pagination.element.js
CHANGED
|
@@ -6,14 +6,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { UmbTextStyles } from '../../../../../shared/style/index.js';
|
|
8
8
|
import { css, html, customElement, nothing, state } from '../../../../../external/lit/index.js';
|
|
9
|
-
import {
|
|
9
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '../../index.js';
|
|
10
10
|
import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
|
|
11
11
|
let UmbCollectionPaginationElement = class UmbCollectionPaginationElement extends UmbLitElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
this._totalPages = 0;
|
|
15
15
|
this._currentPage = 1;
|
|
16
|
-
this.consumeContext(
|
|
16
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (instance) => {
|
|
17
17
|
this._collectionContext = instance;
|
|
18
18
|
this.#observeCurrentPage();
|
|
19
19
|
this.#observerTotalPages();
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { UmbCollectionConfiguration, UmbCollectionContext } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { UmbCollectionConfiguration, UmbCollectionContext } from '../types.js';
|
|
2
|
+
import { UmbCollectionViewManager } from '../collection-view.manager.js';
|
|
3
|
+
import { UmbCollectionRepository } from '../../repository/index.js';
|
|
4
|
+
import { UmbContextBase } from '../../../../libs/class-api/index.js';
|
|
5
|
+
import { type UmbControllerHostElement } from '../../../../libs/controller-api/index.js';
|
|
6
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
7
|
+
import { UmbApi } from '../../../../libs/extension-api/index.js';
|
|
8
|
+
import { ManifestCollection } from '../../extension-registry/index.js';
|
|
9
|
+
import type { UmbCollectionFilterModel } from '../index.js';
|
|
10
|
+
import { UmbSelectionManager, UmbPaginationManager } from '../../../../shared/utils/index.js';
|
|
11
|
+
export declare class UmbDefaultCollectionContext<ItemType = any, FilterModelType extends UmbCollectionFilterModel = any> extends UmbContextBase<UmbDefaultCollectionContext> implements UmbCollectionContext, UmbApi {
|
|
11
12
|
#private;
|
|
12
13
|
readonly items: import("rxjs").Observable<ItemType[]>;
|
|
13
14
|
readonly totalItems: import("rxjs").Observable<number>;
|
|
14
15
|
readonly filter: import("rxjs").Observable<object | FilterModelType>;
|
|
15
|
-
readonly views: import("rxjs").Observable<ManifestCollectionView[]>;
|
|
16
|
-
readonly currentView: import("rxjs").Observable<ManifestCollectionView | undefined>;
|
|
17
|
-
readonly rootPathname: import("rxjs").Observable<string>;
|
|
18
16
|
repository?: UmbCollectionRepository;
|
|
19
17
|
readonly pagination: UmbPaginationManager;
|
|
20
18
|
readonly selection: UmbSelectionManager;
|
|
19
|
+
readonly view: UmbCollectionViewManager;
|
|
21
20
|
constructor(host: UmbControllerHostElement, config?: UmbCollectionConfiguration);
|
|
22
21
|
/**
|
|
23
22
|
* Sets the manifest for the collection.
|
|
@@ -43,17 +42,5 @@ export declare class UmbDefaultCollectionContext<ItemType = any, FilterModelType
|
|
|
43
42
|
* @memberof UmbCollectionContext
|
|
44
43
|
*/
|
|
45
44
|
setFilter(filter: Partial<FilterModelType>): void;
|
|
46
|
-
/**
|
|
47
|
-
* Sets the current view.
|
|
48
|
-
* @param {ManifestCollectionView} view
|
|
49
|
-
* @memberof UmbCollectionContext
|
|
50
|
-
*/
|
|
51
|
-
setCurrentView(view: ManifestCollectionView): void;
|
|
52
|
-
/**
|
|
53
|
-
* Returns the current view.
|
|
54
|
-
* @return {ManifestCollectionView}
|
|
55
|
-
* @memberof UmbCollectionContext
|
|
56
|
-
*/
|
|
57
|
-
getCurrentView(): ManifestCollectionView | undefined;
|
|
58
45
|
}
|
|
59
|
-
export declare const
|
|
46
|
+
export declare const UMB_DEFAULT_COLLECTION_CONTEXT: UmbContextToken<UmbDefaultCollectionContext<any, any>, UmbDefaultCollectionContext<any, any>>;
|
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { UmbCollectionViewManager } from '../collection-view.manager.js';
|
|
2
|
+
import { UmbContextBase } from '../../../../libs/class-api/index.js';
|
|
3
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
4
|
+
import { UmbArrayState, UmbNumberState, UmbObjectState } from '../../../../libs/observable-api/index.js';
|
|
5
|
+
import { UmbExtensionApiInitializer } from '../../../../libs/extension-api/index.js';
|
|
6
|
+
import { umbExtensionsRegistry, } from '../../extension-registry/index.js';
|
|
7
|
+
import { UmbSelectionManager, UmbPaginationManager } from '../../../../shared/utils/index.js';
|
|
8
|
+
import { UmbChangeEvent } from '../../event/index.js';
|
|
9
|
+
export class UmbDefaultCollectionContext extends UmbContextBase {
|
|
9
10
|
#manifest;
|
|
10
11
|
#items;
|
|
11
12
|
#totalItems;
|
|
12
13
|
#filter;
|
|
13
|
-
#views;
|
|
14
|
-
#currentView;
|
|
15
|
-
#rootPathname;
|
|
16
14
|
#initResolver;
|
|
17
15
|
#initialized;
|
|
18
16
|
#init;
|
|
19
17
|
constructor(host, config = { pageSize: 50 }) {
|
|
20
|
-
super(host);
|
|
18
|
+
super(host, UMB_DEFAULT_COLLECTION_CONTEXT);
|
|
21
19
|
this.#items = new UmbArrayState([], (x) => x);
|
|
22
20
|
this.items = this.#items.asObservable();
|
|
23
21
|
this.#totalItems = new UmbNumberState(0);
|
|
24
22
|
this.totalItems = this.#totalItems.asObservable();
|
|
25
23
|
this.#filter = new UmbObjectState({});
|
|
26
24
|
this.filter = this.#filter.asObservable();
|
|
27
|
-
this.#views = new UmbArrayState([], (x) => x.alias);
|
|
28
|
-
this.views = this.#views.asObservable();
|
|
29
|
-
this.#currentView = new UmbObjectState(undefined);
|
|
30
|
-
this.currentView = this.#currentView.asObservable();
|
|
31
|
-
this.#rootPathname = new UmbStringState('');
|
|
32
|
-
this.rootPathname = this.#rootPathname.asObservable();
|
|
33
25
|
this.#initialized = false;
|
|
34
26
|
this.#init = new Promise((resolve) => {
|
|
35
27
|
this.#initialized ? resolve() : (this.#initResolver = resolve);
|
|
@@ -43,13 +35,8 @@ export class UmbDefaultCollectionContext extends UmbBaseController {
|
|
|
43
35
|
};
|
|
44
36
|
// listen for page changes on the pagination manager
|
|
45
37
|
this.pagination.addEventListener(UmbChangeEvent.TYPE, this.#onPageChange);
|
|
46
|
-
|
|
47
|
-
setTimeout(() => {
|
|
48
|
-
const currentUrl = new URL(window.location.href);
|
|
49
|
-
this.#rootPathname.next(currentUrl.pathname.substring(0, currentUrl.pathname.lastIndexOf('/')));
|
|
50
|
-
}, 100);
|
|
38
|
+
this.view = new UmbCollectionViewManager(this, { defaultViewAlias: config.defaultViewAlias });
|
|
51
39
|
this.#configure(config);
|
|
52
|
-
this.provideContext(UMB_COLLECTION_CONTEXT, this);
|
|
53
40
|
}
|
|
54
41
|
// TODO: find a generic way to do this
|
|
55
42
|
#checkIfInitialized() {
|
|
@@ -70,7 +57,6 @@ export class UmbDefaultCollectionContext extends UmbBaseController {
|
|
|
70
57
|
if (!this.#manifest)
|
|
71
58
|
return;
|
|
72
59
|
this.#observeRepository(this.#manifest.meta.repositoryAlias);
|
|
73
|
-
this.#observeViews();
|
|
74
60
|
}
|
|
75
61
|
/**
|
|
76
62
|
* Returns the manifest for the collection.
|
|
@@ -106,52 +92,17 @@ export class UmbDefaultCollectionContext extends UmbBaseController {
|
|
|
106
92
|
this.#filter.next({ ...this.#filter.getValue(), ...filter });
|
|
107
93
|
this.requestCollection();
|
|
108
94
|
}
|
|
109
|
-
// Views
|
|
110
|
-
/**
|
|
111
|
-
* Sets the current view.
|
|
112
|
-
* @param {ManifestCollectionView} view
|
|
113
|
-
* @memberof UmbCollectionContext
|
|
114
|
-
*/
|
|
115
|
-
setCurrentView(view) {
|
|
116
|
-
this.#currentView.next(view);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Returns the current view.
|
|
120
|
-
* @return {ManifestCollectionView}
|
|
121
|
-
* @memberof UmbCollectionContext
|
|
122
|
-
*/
|
|
123
|
-
getCurrentView() {
|
|
124
|
-
return this.#currentView.getValue();
|
|
125
|
-
}
|
|
126
95
|
#configure(configuration) {
|
|
127
96
|
this.selection.setMultiple(true);
|
|
128
97
|
this.pagination.setPageSize(configuration.pageSize);
|
|
129
98
|
this.#filter.next({ ...this.#filter.getValue(), skip: 0, take: configuration.pageSize });
|
|
130
99
|
}
|
|
131
100
|
#onPageChange;
|
|
132
|
-
#setCurrentView() {
|
|
133
|
-
const currentUrl = new URL(window.location.href);
|
|
134
|
-
const lastPathSegment = currentUrl.pathname.split('/').pop();
|
|
135
|
-
const views = this.#views.getValue();
|
|
136
|
-
const viewMatch = views.find((view) => view.meta.pathName === lastPathSegment);
|
|
137
|
-
/* TODO: Find a way to figure out which layout it starts with and set _currentLayout to that instead of [0]. eg. '/table'
|
|
138
|
-
For document, media and members this will come as part of a data type configuration, but in other cases "users" we should find another way.
|
|
139
|
-
This should only happen if the current layout is not set in the URL.
|
|
140
|
-
*/
|
|
141
|
-
const currentView = viewMatch || views[0];
|
|
142
|
-
this.setCurrentView(currentView);
|
|
143
|
-
}
|
|
144
101
|
#observeRepository(repositoryAlias) {
|
|
145
102
|
new UmbExtensionApiInitializer(this, umbExtensionsRegistry, repositoryAlias, [this._host], (permitted, ctrl) => {
|
|
146
103
|
this.repository = permitted ? ctrl.api : undefined;
|
|
147
104
|
this.#checkIfInitialized();
|
|
148
105
|
});
|
|
149
106
|
}
|
|
150
|
-
#observeViews() {
|
|
151
|
-
return new UmbExtensionsManifestInitializer(this, umbExtensionsRegistry, 'collectionView', null, (views) => {
|
|
152
|
-
this.#views.next(views.map((view) => view.manifest));
|
|
153
|
-
this.#setCurrentView();
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
107
|
}
|
|
157
|
-
export const
|
|
108
|
+
export const UMB_DEFAULT_COLLECTION_CONTEXT = new UmbContextToken('UmbCollectionContext');
|
|
@@ -4,12 +4,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
import { UmbTextStyles } from '
|
|
9
|
-
import { css, html, customElement, state } from '
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { UmbLitElement } from '../../../shared/lit-element/index.js';
|
|
7
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT, UmbDefaultCollectionContext } from './collection-default.context.js';
|
|
8
|
+
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
9
|
+
import { css, html, customElement, state } from '../../../../external/lit/index.js';
|
|
10
|
+
import { umbExtensionsRegistry } from '../../extension-registry/index.js';
|
|
11
|
+
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
13
12
|
const manifest = {
|
|
14
13
|
type: 'kind',
|
|
15
14
|
alias: 'Umb.Kind.Collection.Default',
|
|
@@ -28,35 +27,18 @@ let UmbCollectionDefaultElement = class UmbCollectionDefaultElement extends UmbL
|
|
|
28
27
|
constructor() {
|
|
29
28
|
super();
|
|
30
29
|
this._routes = [];
|
|
31
|
-
this
|
|
32
|
-
this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => {
|
|
30
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (instance) => {
|
|
33
31
|
this.#collectionContext = instance;
|
|
34
|
-
this.#
|
|
32
|
+
this.#observeCollectionRoutes();
|
|
35
33
|
});
|
|
36
34
|
}
|
|
37
|
-
#
|
|
35
|
+
#observeCollectionRoutes() {
|
|
38
36
|
if (!this.#collectionContext)
|
|
39
37
|
return;
|
|
40
|
-
this.observe(this.#collectionContext.
|
|
41
|
-
this
|
|
38
|
+
this.observe(this.#collectionContext.view.routes, (routes) => {
|
|
39
|
+
this._routes = routes;
|
|
42
40
|
}),
|
|
43
|
-
'
|
|
44
|
-
}
|
|
45
|
-
#createRoutes(views) {
|
|
46
|
-
this._routes = [];
|
|
47
|
-
if (views) {
|
|
48
|
-
this._routes = views.map((view) => {
|
|
49
|
-
return {
|
|
50
|
-
path: `${view.meta.pathName}`,
|
|
51
|
-
component: () => createExtensionElement(view),
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
this._routes.push({
|
|
56
|
-
path: '',
|
|
57
|
-
redirectTo: views?.[0]?.meta.pathName ?? '/',
|
|
58
|
-
});
|
|
59
|
-
this.requestUpdate();
|
|
41
|
+
'umbCollectionRoutesObserver';
|
|
60
42
|
}
|
|
61
43
|
render() {
|
|
62
44
|
return html `
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import './collection-default.element.js';
|
|
1
|
+
import './default/collection-default.element.js';
|
|
2
2
|
import './collection.element.js';
|
|
3
3
|
import './components/index.js';
|
|
4
|
-
export * from './collection-default.element.js';
|
|
4
|
+
export * from './default/collection-default.element.js';
|
|
5
5
|
export * from './collection.element.js';
|
|
6
6
|
export * from './components/index.js';
|
|
7
|
-
export * from './collection-default.context.js';
|
|
7
|
+
export * from './default/collection-default.context.js';
|
|
8
8
|
export * from './collection-filter-model.interface.js';
|
|
9
9
|
export { UMB_COLLECTION_ALIAS_CONDITION } from './collection-alias.condition.js';
|
|
10
10
|
export { UmbCollectionActionElement, UmbCollectionActionBase } from './action/index.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import './collection-default.element.js';
|
|
1
|
+
import './default/collection-default.element.js';
|
|
2
2
|
import './collection.element.js';
|
|
3
3
|
import './components/index.js';
|
|
4
|
-
export * from './collection-default.element.js';
|
|
4
|
+
export * from './default/collection-default.element.js';
|
|
5
5
|
export * from './collection.element.js';
|
|
6
6
|
export * from './components/index.js';
|
|
7
|
-
export * from './collection-default.context.js';
|
|
7
|
+
export * from './default/collection-default.context.js';
|
|
8
8
|
export * from './collection-filter-model.interface.js';
|
|
9
9
|
export { UMB_COLLECTION_ALIAS_CONDITION } from './collection-alias.condition.js';
|
|
10
10
|
export { UmbCollectionActionElement, UmbCollectionActionBase } from './action/index.js';
|
|
@@ -2,7 +2,8 @@ import { ManifestCollection } from '../extension-registry/index.js';
|
|
|
2
2
|
import { Observable } from '../../../external/rxjs/index.js';
|
|
3
3
|
import { UmbPaginationManager } from '../../../shared/utils/index.js';
|
|
4
4
|
export interface UmbCollectionConfiguration {
|
|
5
|
-
pageSize
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
defaultViewAlias?: string;
|
|
6
7
|
}
|
|
7
8
|
export interface UmbCollectionContext {
|
|
8
9
|
setManifest(manifest: ManifestCollection): void;
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { UmbTextStyles } from '../../../../../../shared/style/index.js';
|
|
8
8
|
import { css, html, customElement, state } from '../../../../../../external/lit/index.js';
|
|
9
|
-
import {
|
|
9
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '../../../../../core/collection/index.js';
|
|
10
10
|
import { UmbLitElement } from '../../../../../../shared/lit-element/index.js';
|
|
11
11
|
import './column-layouts/document-table-actions-column-layout.element.js';
|
|
12
12
|
let UmbDocumentTableCollectionViewElement = class UmbDocumentTableCollectionViewElement extends UmbLitElement {
|
|
@@ -31,7 +31,7 @@ let UmbDocumentTableCollectionViewElement = class UmbDocumentTableCollectionView
|
|
|
31
31
|
];
|
|
32
32
|
this._tableItems = [];
|
|
33
33
|
this._selection = [];
|
|
34
|
-
this.consumeContext(
|
|
34
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (instance) => {
|
|
35
35
|
this._collectionContext = instance;
|
|
36
36
|
this._observeCollectionContext();
|
|
37
37
|
});
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
8
8
|
import { css, html, customElement, state, repeat } from '../../../../external/lit/index.js';
|
|
9
|
-
import {
|
|
9
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '../../../core/collection/index.js';
|
|
10
10
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
11
11
|
let UmbMediaGridCollectionViewElement = class UmbMediaGridCollectionViewElement extends UmbLitElement {
|
|
12
12
|
constructor() {
|
|
@@ -15,7 +15,7 @@ let UmbMediaGridCollectionViewElement = class UmbMediaGridCollectionViewElement
|
|
|
15
15
|
document.addEventListener('dragenter', this._handleDragEnter.bind(this));
|
|
16
16
|
document.addEventListener('dragleave', this._handleDragLeave.bind(this));
|
|
17
17
|
document.addEventListener('drop', this._handleDrop.bind(this));
|
|
18
|
-
this.consumeContext(
|
|
18
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (instance) => {
|
|
19
19
|
this._collectionContext = instance;
|
|
20
20
|
this._observeCollectionContext();
|
|
21
21
|
});
|
package/dist-cms/packages/media/media/collection-view/media-table-collection-view.element.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
8
8
|
import { css, html, customElement, state } from '../../../../external/lit/index.js';
|
|
9
|
-
import {
|
|
9
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '../../../core/collection/index.js';
|
|
10
10
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
11
11
|
let UmbMediaTableCollectionViewElement = class UmbMediaTableCollectionViewElement extends UmbLitElement {
|
|
12
12
|
constructor() {
|
|
@@ -22,7 +22,7 @@ let UmbMediaTableCollectionViewElement = class UmbMediaTableCollectionViewElemen
|
|
|
22
22
|
];
|
|
23
23
|
this._tableItems = [];
|
|
24
24
|
this._selection = [];
|
|
25
|
-
this.consumeContext(
|
|
25
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (instance) => {
|
|
26
26
|
this._collectionContext = instance;
|
|
27
27
|
this._observeCollectionContext();
|
|
28
28
|
});
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { css, html, customElement, state, repeat, ifDefined } from '../../../../external/lit/index.js';
|
|
8
8
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
9
|
-
import {
|
|
9
|
+
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '../../../core/collection/index.js';
|
|
10
10
|
import { UserOrderModel, UserStateModel } from '../../../../external/backend-api/index.js';
|
|
11
11
|
import { UmbUserGroupCollectionRepository } from '../../user-group/index.js';
|
|
12
12
|
let UmbUserCollectionHeaderElement = class UmbUserCollectionHeaderElement extends UmbLitElement {
|
|
@@ -24,7 +24,7 @@ let UmbUserCollectionHeaderElement = class UmbUserCollectionHeaderElement extend
|
|
|
24
24
|
this._userGroupFilterSelection = [];
|
|
25
25
|
this.#inputTimerAmount = 500;
|
|
26
26
|
this.#userGroupCollectionRepository = new UmbUserGroupCollectionRepository(this);
|
|
27
|
-
this.consumeContext(
|
|
27
|
+
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (instance) => {
|
|
28
28
|
this.#collectionContext = instance;
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { UMB_COLLECTION_VIEW_USER_GRID } from './views/index.js';
|
|
1
2
|
import { UmbDefaultCollectionContext } from '../../../core/collection/index.js';
|
|
2
3
|
export class UmbUserCollectionContext extends UmbDefaultCollectionContext {
|
|
3
4
|
constructor(host) {
|
|
4
|
-
super(host, { pageSize: 50 });
|
|
5
|
+
super(host, { pageSize: 50, defaultViewAlias: UMB_COLLECTION_VIEW_USER_GRID });
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* Sets the state filter for the collection and refreshes the collection.
|