@umbraco-cms/backoffice 14.0.0--preview004-044c3492 → 14.0.0--preview004-3aedfe8e
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 +1 -3
- package/dist-cms/libs/context-api/consume/context-consumer.d.ts +9 -2
- package/dist-cms/libs/context-api/consume/context-consumer.js +16 -7
- package/dist-cms/libs/context-api/consume/context-request.event.d.ts +5 -4
- package/dist-cms/libs/context-api/consume/context-request.event.js +2 -1
- package/dist-cms/libs/context-api/provide/context-provider.d.ts +3 -2
- package/dist-cms/libs/context-api/provide/context-provider.js +7 -4
- package/dist-cms/libs/context-api/token/context-token.d.ts +17 -3
- package/dist-cms/libs/context-api/token/context-token.js +18 -4
- package/dist-cms/packages/core/data-type/variant-context/data-type-variant-context.token.d.ts +3 -3
- package/dist-cms/packages/core/data-type/variant-context/data-type-variant-context.token.js +3 -3
- package/dist-cms/packages/core/data-type/workspace/data-type-workspace.context.d.ts +9 -9
- package/dist-cms/packages/core/data-type/workspace/data-type-workspace.context.js +1 -1
- package/dist-cms/packages/core/workspace/variant-context/nameable-variant-context.token.d.ts +3 -3
- package/dist-cms/packages/core/workspace/variant-context/nameable-variant-context.token.js +2 -2
- package/dist-cms/packages/core/workspace/variant-context/variant-context.token.d.ts +2 -2
- package/dist-cms/packages/core/workspace/variant-context/variant-context.token.js +2 -2
- package/dist-cms/packages/core/workspace/workspace-context/variant-workspace-context.token.js +1 -1
- package/dist-cms/packages/core/workspace/workspace-context/workspace-context.interface.d.ts +2 -1
- package/dist-cms/packages/dictionary/dictionary/workspace/dictionary-workspace.context.d.ts +5 -5
- package/dist-cms/packages/dictionary/dictionary/workspace/dictionary-workspace.context.js +2 -2
- package/dist-cms/packages/documents/document-types/workspace/document-type-workspace-editor.element.js +2 -2
- package/dist-cms/packages/documents/document-types/workspace/document-type-workspace.context.js +1 -1
- package/dist-cms/packages/documents/documents/variant-context/document-variant-context.token.js +1 -1
- package/dist-cms/packages/documents/documents/workspace/document-workspace.context.js +1 -3
- package/dist-cms/packages/documents/documents/workspace/document-workspace.element.js +1 -4
- package/dist-cms/packages/media/media/workspace/manifests.js +2 -1
- package/dist-cms/packages/media/media/workspace/media-workspace.context.d.ts +3 -1
- package/dist-cms/packages/media/media/workspace/media-workspace.context.js +2 -1
- package/dist-cms/packages/media/media/workspace/media-workspace.element.d.ts +2 -1
- package/dist-cms/packages/media/media/workspace/media-workspace.element.js +29 -9
- package/dist-cms/packages/media/media-types/workspace/media-type-workspace.context.d.ts +8 -8
- package/dist-cms/packages/media/media-types/workspace/media-type-workspace.context.js +2 -2
- package/dist-cms/packages/members/member-groups/workspace/member-group-workspace.context.d.ts +2 -2
- package/dist-cms/packages/members/member-groups/workspace/member-group-workspace.context.js +1 -1
- package/dist-cms/packages/members/member-types/workspace/member-type-workspace.context.d.ts +2 -2
- package/dist-cms/packages/members/member-types/workspace/member-type-workspace.context.js +2 -2
- package/dist-cms/packages/members/members/workspace/member-workspace.context.d.ts +1 -1
- package/dist-cms/packages/members/members/workspace/member-workspace.context.js +1 -1
- package/dist-cms/packages/settings/languages/workspace/language/language-workspace.context.d.ts +4 -4
- package/dist-cms/packages/settings/languages/workspace/language/language-workspace.context.js +2 -2
- package/dist-cms/packages/settings/relation-types/workspace/relation-type-workspace.context.d.ts +5 -5
- package/dist-cms/packages/settings/relation-types/workspace/relation-type-workspace.context.js +2 -2
- package/dist-cms/packages/templating/partial-views/workspace/partial-view-workspace.context.d.ts +7 -7
- package/dist-cms/packages/templating/partial-views/workspace/partial-view-workspace.context.js +1 -1
- package/dist-cms/packages/templating/stylesheets/workspace/stylesheet-workspace.context.d.ts +10 -10
- package/dist-cms/packages/templating/stylesheets/workspace/stylesheet-workspace.context.js +1 -1
- package/dist-cms/packages/templating/stylesheets/workspace/stylesheet-workspace.element.js +3 -3
- package/dist-cms/packages/templating/templates/workspace/template-workspace.context.js +1 -1
- package/dist-cms/packages/templating/templates/workspace/template-workspace.element.d.ts +0 -1
- package/dist-cms/packages/templating/templates/workspace/template-workspace.element.js +0 -3
- package/dist-cms/packages/templating/utils.d.ts +0 -2
- package/dist-cms/packages/templating/utils.js +2 -6
- package/dist-cms/packages/user/user/workspace/user-workspace.context.js +1 -1
- package/dist-cms/packages/user/user-group/workspace/user-group-workspace.context.js +2 -2
- package/dist-cms/shared/utils/diff.type.d.ts +2 -2
- package/dist-cms/shared/utils/index.d.ts +3 -1
- package/dist-cms/shared/utils/index.js +3 -1
- package/dist-cms/shared/utils/path-decode.function.d.ts +1 -0
- package/dist-cms/shared/utils/path-decode.function.js +1 -0
- package/dist-cms/shared/utils/path-encode.function.d.ts +1 -0
- package/dist-cms/shared/utils/path-encode.function.js +1 -0
- package/dist-cms/shared/utils/umbraco-path.function.js +1 -0
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +1 -1
- package/package.json +1 -1
|
@@ -7011,9 +7011,7 @@
|
|
|
7011
7011
|
"path": "./../src/packages/media/media/workspace/media-workspace.element.ts",
|
|
7012
7012
|
"properties": [
|
|
7013
7013
|
{
|
|
7014
|
-
"name": "
|
|
7015
|
-
"type": "\"Umb.Workspace.Media\"",
|
|
7016
|
-
"default": "\"Umb.Workspace.Media\""
|
|
7014
|
+
"name": "manifest"
|
|
7017
7015
|
},
|
|
7018
7016
|
{
|
|
7019
7017
|
"name": "styles",
|
|
@@ -11,16 +11,23 @@ export declare class UmbContextConsumer<BaseType = unknown, ResultType extends B
|
|
|
11
11
|
/**
|
|
12
12
|
* Creates an instance of UmbContextConsumer.
|
|
13
13
|
* @param {EventTarget} hostElement
|
|
14
|
-
* @param {string}
|
|
14
|
+
* @param {string} contextIdentifier
|
|
15
15
|
* @param {UmbContextCallback} callback
|
|
16
16
|
* @memberof UmbContextConsumer
|
|
17
17
|
*/
|
|
18
|
-
constructor(hostElement: EventTarget,
|
|
18
|
+
constructor(hostElement: EventTarget, contextIdentifier: string | UmbContextToken<BaseType, ResultType>, callback?: UmbContextCallback<ResultType>);
|
|
19
19
|
protected _onResponse: (instance: BaseType) => boolean;
|
|
20
20
|
protected setInstance(instance: ResultType): void;
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
* @memberof UmbContextConsumer
|
|
24
|
+
* @description Get the context as a promise.
|
|
25
|
+
*/
|
|
21
26
|
asPromise(): Promise<ResultType>;
|
|
22
27
|
/**
|
|
28
|
+
* @public
|
|
23
29
|
* @memberof UmbContextConsumer
|
|
30
|
+
* @description Request the context from the host element.
|
|
24
31
|
*/
|
|
25
32
|
request(): void;
|
|
26
33
|
hostConnected(): void;
|
|
@@ -17,19 +17,20 @@ export class UmbContextConsumer {
|
|
|
17
17
|
return this.#instance;
|
|
18
18
|
}
|
|
19
19
|
#contextAlias;
|
|
20
|
+
#apiAlias;
|
|
20
21
|
#discriminator;
|
|
21
22
|
/**
|
|
22
23
|
* Creates an instance of UmbContextConsumer.
|
|
23
24
|
* @param {EventTarget} hostElement
|
|
24
|
-
* @param {string}
|
|
25
|
+
* @param {string} contextIdentifier
|
|
25
26
|
* @param {UmbContextCallback} callback
|
|
26
27
|
* @memberof UmbContextConsumer
|
|
27
28
|
*/
|
|
28
|
-
constructor(hostElement,
|
|
29
|
+
constructor(hostElement, contextIdentifier, callback) {
|
|
29
30
|
this.hostElement = hostElement;
|
|
30
31
|
this._onResponse = (instance) => {
|
|
31
32
|
if (this.#instance === instance) {
|
|
32
|
-
return
|
|
33
|
+
return true;
|
|
33
34
|
}
|
|
34
35
|
if (this.#discriminator) {
|
|
35
36
|
// Notice if discriminator returns false, we do not want to setInstance.
|
|
@@ -52,9 +53,11 @@ export class UmbContextConsumer {
|
|
|
52
53
|
this.request();
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
|
-
|
|
56
|
+
const idSplit = contextIdentifier.toString().split('#');
|
|
57
|
+
this.#contextAlias = idSplit[0];
|
|
58
|
+
this.#apiAlias = idSplit[1] ?? 'default';
|
|
56
59
|
this.#callback = callback;
|
|
57
|
-
this.#discriminator =
|
|
60
|
+
this.#discriminator = contextIdentifier.getDiscriminator?.();
|
|
58
61
|
}
|
|
59
62
|
setInstance(instance) {
|
|
60
63
|
this.#instance = instance;
|
|
@@ -64,6 +67,11 @@ export class UmbContextConsumer {
|
|
|
64
67
|
this.#promise = undefined;
|
|
65
68
|
}
|
|
66
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @public
|
|
72
|
+
* @memberof UmbContextConsumer
|
|
73
|
+
* @description Get the context as a promise.
|
|
74
|
+
*/
|
|
67
75
|
asPromise() {
|
|
68
76
|
return (this.#promise ??
|
|
69
77
|
(this.#promise = new Promise((resolve) => {
|
|
@@ -71,10 +79,12 @@ export class UmbContextConsumer {
|
|
|
71
79
|
})));
|
|
72
80
|
}
|
|
73
81
|
/**
|
|
82
|
+
* @public
|
|
74
83
|
* @memberof UmbContextConsumer
|
|
84
|
+
* @description Request the context from the host element.
|
|
75
85
|
*/
|
|
76
86
|
request() {
|
|
77
|
-
const event = new UmbContextRequestEventImplementation(this.#contextAlias, this._onResponse);
|
|
87
|
+
const event = new UmbContextRequestEventImplementation(this.#contextAlias, this.#apiAlias, this._onResponse);
|
|
78
88
|
this.hostElement.dispatchEvent(event);
|
|
79
89
|
}
|
|
80
90
|
hostConnected() {
|
|
@@ -107,7 +117,6 @@ export class UmbContextConsumer {
|
|
|
107
117
|
}
|
|
108
118
|
}
|
|
109
119
|
*/
|
|
110
|
-
// TODO: Test destroy scenarios:
|
|
111
120
|
destroy() {
|
|
112
121
|
this.hostDisconnected();
|
|
113
122
|
this.#callback = undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UmbContextToken } from '../token/context-token.js';
|
|
2
1
|
export declare const UMB_CONTENT_REQUEST_EVENT_TYPE = "umb:context-request";
|
|
3
2
|
export declare const UMB_DEBUG_CONTEXT_EVENT_TYPE = "umb:debug-contexts";
|
|
4
3
|
export type UmbContextCallback<T> = (instance: T) => void;
|
|
@@ -7,7 +6,8 @@ export type UmbContextCallback<T> = (instance: T) => void;
|
|
|
7
6
|
* @interface UmbContextRequestEvent
|
|
8
7
|
*/
|
|
9
8
|
export interface UmbContextRequestEvent<ResultType = unknown> extends Event {
|
|
10
|
-
readonly contextAlias: string
|
|
9
|
+
readonly contextAlias: string;
|
|
10
|
+
readonly apiAlias: string;
|
|
11
11
|
readonly callback: (context: ResultType) => boolean;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -17,9 +17,10 @@ export interface UmbContextRequestEvent<ResultType = unknown> extends Event {
|
|
|
17
17
|
* @implements {UmbContextRequestEvent}
|
|
18
18
|
*/
|
|
19
19
|
export declare class UmbContextRequestEventImplementation<ResultType = unknown> extends Event implements UmbContextRequestEvent<ResultType> {
|
|
20
|
-
readonly contextAlias: string
|
|
20
|
+
readonly contextAlias: string;
|
|
21
|
+
readonly apiAlias: string;
|
|
21
22
|
readonly callback: (context: ResultType) => boolean;
|
|
22
|
-
constructor(contextAlias: string
|
|
23
|
+
constructor(contextAlias: string, apiAlias: string, callback: (context: ResultType) => boolean);
|
|
23
24
|
}
|
|
24
25
|
export declare class UmbContextDebugRequest extends Event {
|
|
25
26
|
readonly callback: any;
|
|
@@ -7,9 +7,10 @@ export const UMB_DEBUG_CONTEXT_EVENT_TYPE = 'umb:debug-contexts';
|
|
|
7
7
|
* @implements {UmbContextRequestEvent}
|
|
8
8
|
*/
|
|
9
9
|
export class UmbContextRequestEventImplementation extends Event {
|
|
10
|
-
constructor(contextAlias, callback) {
|
|
10
|
+
constructor(contextAlias, apiAlias, callback) {
|
|
11
11
|
super(UMB_CONTENT_REQUEST_EVENT_TYPE, { bubbles: true, composed: true, cancelable: true });
|
|
12
12
|
this.contextAlias = contextAlias;
|
|
13
|
+
this.apiAlias = apiAlias;
|
|
13
14
|
this.callback = callback;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
@@ -7,6 +7,7 @@ export declare class UmbContextProvider<BaseType = unknown, ResultType extends B
|
|
|
7
7
|
#private;
|
|
8
8
|
protected hostElement: EventTarget;
|
|
9
9
|
protected _contextAlias: string;
|
|
10
|
+
protected _apiAlias: string;
|
|
10
11
|
/**
|
|
11
12
|
* Method to enable comparing the context providers by the instance they provide.
|
|
12
13
|
* Note this method should have a unique name for the provider controller, for it not to be confused with a consumer.
|
|
@@ -16,11 +17,11 @@ export declare class UmbContextProvider<BaseType = unknown, ResultType extends B
|
|
|
16
17
|
/**
|
|
17
18
|
* Creates an instance of UmbContextProvider.
|
|
18
19
|
* @param {EventTarget} host
|
|
19
|
-
* @param {string}
|
|
20
|
+
* @param {string | UmbContextToken} contextIdentifier
|
|
20
21
|
* @param {*} instance
|
|
21
22
|
* @memberof UmbContextProvider
|
|
22
23
|
*/
|
|
23
|
-
constructor(hostElement: EventTarget,
|
|
24
|
+
constructor(hostElement: EventTarget, contextIdentifier: string | UmbContextToken<BaseType, ResultType>, instance: ResultType);
|
|
24
25
|
/**
|
|
25
26
|
* @memberof UmbContextProvider
|
|
26
27
|
*/
|
|
@@ -19,11 +19,11 @@ export class UmbContextProvider {
|
|
|
19
19
|
/**
|
|
20
20
|
* Creates an instance of UmbContextProvider.
|
|
21
21
|
* @param {EventTarget} host
|
|
22
|
-
* @param {string}
|
|
22
|
+
* @param {string | UmbContextToken} contextIdentifier
|
|
23
23
|
* @param {*} instance
|
|
24
24
|
* @memberof UmbContextProvider
|
|
25
25
|
*/
|
|
26
|
-
constructor(hostElement,
|
|
26
|
+
constructor(hostElement, contextIdentifier, instance) {
|
|
27
27
|
/**
|
|
28
28
|
* @private
|
|
29
29
|
* @param {UmbContextRequestEvent} event
|
|
@@ -34,7 +34,8 @@ export class UmbContextProvider {
|
|
|
34
34
|
return;
|
|
35
35
|
// Since the alias matches, we will stop it from bubbling further up. But we still allow it to ask the other Contexts of the element. Hence not calling `event.stopImmediatePropagation();`
|
|
36
36
|
event.stopPropagation();
|
|
37
|
-
|
|
37
|
+
// First and importantly, check that the apiAlias matches and then call the callback. If that returns true then we can stop the event completely.
|
|
38
|
+
if (this._apiAlias === event.apiAlias && event.callback(this.#instance)) {
|
|
38
39
|
// Make sure the event not hits any more Contexts as we have found a match.
|
|
39
40
|
event.stopImmediatePropagation();
|
|
40
41
|
}
|
|
@@ -52,7 +53,9 @@ export class UmbContextProvider {
|
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
this.hostElement = hostElement;
|
|
55
|
-
|
|
56
|
+
const idSplit = contextIdentifier.toString().split('#');
|
|
57
|
+
this._contextAlias = idSplit[0];
|
|
58
|
+
this._apiAlias = idSplit[1] ?? 'default';
|
|
56
59
|
this.#instance = instance;
|
|
57
60
|
}
|
|
58
61
|
/**
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
export type UmbContextDiscriminator<BaseType, DiscriminatorResult extends BaseType> = (instance: BaseType) => instance is DiscriminatorResult;
|
|
2
|
+
/**
|
|
3
|
+
* @export
|
|
4
|
+
* @class UmbContextToken
|
|
5
|
+
* @template BaseType - A generic type of the API before decimated.
|
|
6
|
+
* @template ResultType - A concrete type of the API after decimation, use this when you apply a discriminator method. Note this is optional and defaults to the BaseType.
|
|
7
|
+
*/
|
|
2
8
|
export declare class UmbContextToken<BaseType = unknown, ResultType extends BaseType = BaseType> {
|
|
3
9
|
#private;
|
|
4
|
-
protected
|
|
10
|
+
protected contextAlias: string;
|
|
11
|
+
protected apiAlias: string;
|
|
5
12
|
/**
|
|
6
13
|
* Get the type of the token
|
|
7
14
|
*
|
|
@@ -13,9 +20,16 @@ export declare class UmbContextToken<BaseType = unknown, ResultType extends Base
|
|
|
13
20
|
*/
|
|
14
21
|
readonly TYPE: ResultType;
|
|
15
22
|
/**
|
|
16
|
-
* @param
|
|
23
|
+
* @param contextAlias Unique identifier for the context
|
|
24
|
+
* @param apiAlias Unique identifier for the api
|
|
25
|
+
* @param discriminator A discriminator that will be used to discriminate the API — testing if the API lives up to a certain requirement. If the API does not meet the requirement then the consumer will not receive this API.
|
|
26
|
+
*/
|
|
27
|
+
constructor(contextAlias: string, apiAlias?: string, discriminator?: UmbContextDiscriminator<BaseType, ResultType>);
|
|
28
|
+
/**
|
|
29
|
+
* Get the discriminator method for the token
|
|
30
|
+
*
|
|
31
|
+
* @returns the discriminator method
|
|
17
32
|
*/
|
|
18
|
-
constructor(alias: string, discriminator?: UmbContextDiscriminator<BaseType, ResultType>);
|
|
19
33
|
getDiscriminator(): UmbContextDiscriminator<BaseType, ResultType> | undefined;
|
|
20
34
|
/**
|
|
21
35
|
* This method must always return the unique alias of the token since that
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @export
|
|
3
|
+
* @class UmbContextToken
|
|
4
|
+
* @template BaseType - A generic type of the API before decimated.
|
|
5
|
+
* @template ResultType - A concrete type of the API after decimation, use this when you apply a discriminator method. Note this is optional and defaults to the BaseType.
|
|
6
|
+
*/
|
|
1
7
|
export class UmbContextToken {
|
|
2
8
|
#discriminator;
|
|
3
9
|
/**
|
|
4
|
-
* @param
|
|
10
|
+
* @param contextAlias Unique identifier for the context
|
|
11
|
+
* @param apiAlias Unique identifier for the api
|
|
12
|
+
* @param discriminator A discriminator that will be used to discriminate the API — testing if the API lives up to a certain requirement. If the API does not meet the requirement then the consumer will not receive this API.
|
|
5
13
|
*/
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
14
|
+
constructor(contextAlias, apiAlias = 'default', discriminator) {
|
|
15
|
+
this.contextAlias = contextAlias;
|
|
16
|
+
this.apiAlias = apiAlias;
|
|
8
17
|
/**
|
|
9
18
|
* Get the type of the token
|
|
10
19
|
*
|
|
@@ -17,6 +26,11 @@ export class UmbContextToken {
|
|
|
17
26
|
this.TYPE = undefined;
|
|
18
27
|
this.#discriminator = discriminator;
|
|
19
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the discriminator method for the token
|
|
31
|
+
*
|
|
32
|
+
* @returns the discriminator method
|
|
33
|
+
*/
|
|
20
34
|
getDiscriminator() {
|
|
21
35
|
return this.#discriminator;
|
|
22
36
|
}
|
|
@@ -27,6 +41,6 @@ export class UmbContextToken {
|
|
|
27
41
|
* @returns the unique alias of the token
|
|
28
42
|
*/
|
|
29
43
|
toString() {
|
|
30
|
-
return this.
|
|
44
|
+
return this.contextAlias + '#' + this.apiAlias;
|
|
31
45
|
}
|
|
32
46
|
}
|
package/dist-cms/packages/core/data-type/variant-context/data-type-variant-context.token.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { UmbDataTypeVariantContext } from
|
|
2
|
-
import { UmbVariantContext } from
|
|
3
|
-
import { UmbContextToken } from
|
|
1
|
+
import type { UmbDataTypeVariantContext } from './data-type-variant-context.js';
|
|
2
|
+
import { UmbVariantContext } from '../../workspace/index.js';
|
|
3
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
4
4
|
export declare const isDataTypeVariantContext: (context: UmbVariantContext) => context is UmbDataTypeVariantContext;
|
|
5
5
|
export declare const UMB_DATA_TYPE_VARIANT_CONTEXT: UmbContextToken<UmbVariantContext, UmbDataTypeVariantContext>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { UmbContextToken } from
|
|
2
|
-
export const isDataTypeVariantContext = (context) =>
|
|
3
|
-
export const UMB_DATA_TYPE_VARIANT_CONTEXT = new UmbContextToken(
|
|
1
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
2
|
+
export const isDataTypeVariantContext = (context) => 'properties' in context && context.getType() === 'data-type';
|
|
3
|
+
export const UMB_DATA_TYPE_VARIANT_CONTEXT = new UmbContextToken('UmbVariantContext', undefined, isDataTypeVariantContext);
|
|
@@ -8,12 +8,12 @@ import { Observable } from '../../../../external/rxjs/index.js';
|
|
|
8
8
|
import { PropertyEditorConfigDefaultData, PropertyEditorConfigProperty } from '../../extension-registry/index.js';
|
|
9
9
|
export declare class UmbDataTypeWorkspaceContext extends UmbEditableWorkspaceContextBase<UmbDataTypeDetailRepository, DataTypeResponseModel> implements UmbInvariantableWorkspaceContextInterface<DataTypeResponseModel | undefined> {
|
|
10
10
|
#private;
|
|
11
|
-
data: Observable<DataTypeResponseModel | undefined>;
|
|
12
|
-
name: Observable<string | undefined>;
|
|
13
|
-
id: Observable<string | undefined>;
|
|
14
|
-
propertyEditorUiAlias: Observable<string | null | undefined>;
|
|
15
|
-
propertyEditorSchemaAlias: Observable<string | undefined>;
|
|
16
|
-
properties: Observable<Array<PropertyEditorConfigProperty> | undefined>;
|
|
11
|
+
readonly data: Observable<DataTypeResponseModel | undefined>;
|
|
12
|
+
readonly name: Observable<string | undefined>;
|
|
13
|
+
readonly id: Observable<string | undefined>;
|
|
14
|
+
readonly propertyEditorUiAlias: Observable<string | null | undefined>;
|
|
15
|
+
readonly propertyEditorSchemaAlias: Observable<string | undefined>;
|
|
16
|
+
readonly properties: Observable<Array<PropertyEditorConfigProperty> | undefined>;
|
|
17
17
|
private _propertyEditorSchemaConfigDefaultData;
|
|
18
18
|
private _propertyEditorUISettingsDefaultData;
|
|
19
19
|
private _propertyEditorSchemaConfigProperties;
|
|
@@ -21,9 +21,9 @@ export declare class UmbDataTypeWorkspaceContext extends UmbEditableWorkspaceCon
|
|
|
21
21
|
private _propertyEditorSchemaConfigDefaultUIAlias;
|
|
22
22
|
private _configDefaultData?;
|
|
23
23
|
private _propertyEditorUISettingsSchemaAlias?;
|
|
24
|
-
defaults: Observable<PropertyEditorConfigDefaultData[]>;
|
|
25
|
-
propertyEditorUiIcon: Observable<string | null>;
|
|
26
|
-
propertyEditorUiName: Observable<string | null>;
|
|
24
|
+
readonly defaults: Observable<PropertyEditorConfigDefaultData[]>;
|
|
25
|
+
readonly propertyEditorUiIcon: Observable<string | null>;
|
|
26
|
+
readonly propertyEditorUiName: Observable<string | null>;
|
|
27
27
|
constructor(host: UmbControllerHostElement);
|
|
28
28
|
private _mergeConfigProperties;
|
|
29
29
|
private _mergeConfigDefaultData;
|
|
@@ -194,4 +194,4 @@ export class UmbDataTypeWorkspaceContext extends UmbEditableWorkspaceContextBase
|
|
|
194
194
|
this.#data.destroy();
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
export const UMB_DATA_TYPE_WORKSPACE_CONTEXT = new UmbContextToken('UmbWorkspaceContext', (context) => context.getEntityType?.() === 'data-type');
|
|
197
|
+
export const UMB_DATA_TYPE_WORKSPACE_CONTEXT = new UmbContextToken('UmbWorkspaceContext', undefined, (context) => context.getEntityType?.() === 'data-type');
|
package/dist-cms/packages/core/workspace/variant-context/nameable-variant-context.token.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type UmbVariantContext } from
|
|
2
|
-
import { UmbNameableVariantContext } from
|
|
3
|
-
import { UmbContextToken } from
|
|
1
|
+
import { type UmbVariantContext } from './variant-context.interface.js';
|
|
2
|
+
import { UmbNameableVariantContext } from './nameable-variant-context.interface.js';
|
|
3
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
4
4
|
export declare const isNameablePropertySetContext: (context: UmbVariantContext) => context is UmbNameableVariantContext;
|
|
5
5
|
export declare const UMB_NAMEABLE_VARIANT_CONTEXT: UmbContextToken<UmbVariantContext, UmbNameableVariantContext>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { UmbContextToken } from
|
|
1
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
2
2
|
export const isNameablePropertySetContext = (context) => 'setName' in context;
|
|
3
|
-
export const UMB_NAMEABLE_VARIANT_CONTEXT = new UmbContextToken(
|
|
3
|
+
export const UMB_NAMEABLE_VARIANT_CONTEXT = new UmbContextToken('UmbVariantContext', undefined, isNameablePropertySetContext);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type UmbVariantContext } from
|
|
2
|
-
import { UmbContextToken } from
|
|
1
|
+
import { type UmbVariantContext } from './variant-context.interface.js';
|
|
2
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
3
3
|
export declare const UMB_VARIANT_CONTEXT: UmbContextToken<UmbVariantContext, UmbVariantContext>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UmbContextToken } from
|
|
2
|
-
export const UMB_VARIANT_CONTEXT = new UmbContextToken(
|
|
1
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
2
|
+
export const UMB_VARIANT_CONTEXT = new UmbContextToken('UmbVariantContext');
|
package/dist-cms/packages/core/workspace/workspace-context/variant-workspace-context.token.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
2
|
-
export const UMB_VARIANT_WORKSPACE_CONTEXT_TOKEN = new UmbContextToken('UmbWorkspaceContext', (context) => 'variants' in context);
|
|
2
|
+
export const UMB_VARIANT_WORKSPACE_CONTEXT_TOKEN = new UmbContextToken('UmbWorkspaceContext', undefined, (context) => 'variants' in context);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { UmbApi } from '../../../../libs/extension-api/index.js';
|
|
2
|
+
export interface UmbWorkspaceContextInterface extends UmbApi {
|
|
2
3
|
readonly workspaceAlias: string;
|
|
3
4
|
getEntityType(): string;
|
|
4
5
|
getEntityId(): string | undefined;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { UmbDictionaryRepository } from '../repository/dictionary.repository.js';
|
|
2
|
-
import { UmbSaveableWorkspaceContextInterface, UmbEditableWorkspaceContextBase } from '../../../core/workspace/index.js';
|
|
3
|
-
import { UmbControllerHostElement } from '../../../../libs/controller-api/index.js';
|
|
2
|
+
import { type UmbSaveableWorkspaceContextInterface, UmbEditableWorkspaceContextBase } from '../../../core/workspace/index.js';
|
|
3
|
+
import type { UmbControllerHostElement } from '../../../../libs/controller-api/index.js';
|
|
4
4
|
import { DictionaryItemResponseModel } from '../../../../external/backend-api/index.js';
|
|
5
5
|
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
6
6
|
export declare class UmbDictionaryWorkspaceContext extends UmbEditableWorkspaceContextBase<UmbDictionaryRepository, DictionaryItemResponseModel> implements UmbSaveableWorkspaceContextInterface<DictionaryItemResponseModel | undefined> {
|
|
7
7
|
#private;
|
|
8
|
-
data: import("rxjs").Observable<DictionaryItemResponseModel | undefined>;
|
|
9
|
-
name: import("rxjs").Observable<string | undefined>;
|
|
10
|
-
dictionary: import("rxjs").Observable<DictionaryItemResponseModel | undefined>;
|
|
8
|
+
readonly data: import("rxjs").Observable<DictionaryItemResponseModel | undefined>;
|
|
9
|
+
readonly name: import("rxjs").Observable<string | undefined>;
|
|
10
|
+
readonly dictionary: import("rxjs").Observable<DictionaryItemResponseModel | undefined>;
|
|
11
11
|
constructor(host: UmbControllerHostElement);
|
|
12
12
|
getData(): DictionaryItemResponseModel | undefined;
|
|
13
13
|
getEntityId(): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UmbDictionaryRepository } from '../repository/dictionary.repository.js';
|
|
2
|
-
import { UmbEditableWorkspaceContextBase } from '../../../core/workspace/index.js';
|
|
2
|
+
import { UmbEditableWorkspaceContextBase, } from '../../../core/workspace/index.js';
|
|
3
3
|
import { UmbObjectState } from '../../../../libs/observable-api/index.js';
|
|
4
4
|
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
5
5
|
export class UmbDictionaryWorkspaceContext extends UmbEditableWorkspaceContextBase {
|
|
@@ -74,4 +74,4 @@ export class UmbDictionaryWorkspaceContext extends UmbEditableWorkspaceContextBa
|
|
|
74
74
|
this.#data.destroy();
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
export const UMB_DICTIONARY_WORKSPACE_CONTEXT = new UmbContextToken('UmbWorkspaceContext', (context) => context.getEntityType?.() === 'dictionary-item');
|
|
77
|
+
export const UMB_DICTIONARY_WORKSPACE_CONTEXT = new UmbContextToken('UmbWorkspaceContext', undefined, (context) => context.getEntityType?.() === 'dictionary-item');
|
|
@@ -4,11 +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 { UMB_DOCUMENT_TYPE_WORKSPACE_CONTEXT } from './document-type-workspace.context.js';
|
|
7
8
|
import { UUIInputEvent } from '../../../../external/uui/index.js';
|
|
8
9
|
import { css, html, customElement, state, ifDefined } from '../../../../external/lit/index.js';
|
|
9
10
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
10
11
|
import { UMB_MODAL_MANAGER_CONTEXT_TOKEN, UMB_ICON_PICKER_MODAL, } from '../../../core/modal/index.js';
|
|
11
|
-
import { UMB_WORKSPACE_CONTEXT } from '../../../core/workspace/index.js';
|
|
12
12
|
import { generateAlias } from '../../../../shared/utils/index.js';
|
|
13
13
|
export let UmbDocumentTypeWorkspaceEditorElement = class UmbDocumentTypeWorkspaceEditorElement extends UmbLitElement {
|
|
14
14
|
// TODO: Color should be using an alias, and look up in some dictionary/key/value) of project-colors.
|
|
@@ -16,7 +16,7 @@ export let UmbDocumentTypeWorkspaceEditorElement = class UmbDocumentTypeWorkspac
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super();
|
|
18
18
|
this._aliasLocked = true;
|
|
19
|
-
this.consumeContext(
|
|
19
|
+
this.consumeContext(UMB_DOCUMENT_TYPE_WORKSPACE_CONTEXT, (instance) => {
|
|
20
20
|
this.#workspaceContext = instance;
|
|
21
21
|
this.#observeDocumentType();
|
|
22
22
|
});
|
package/dist-cms/packages/documents/document-types/workspace/document-type-workspace.context.js
CHANGED
|
@@ -117,4 +117,4 @@ export class UmbDocumentTypeWorkspaceContext extends UmbEditableWorkspaceContext
|
|
|
117
117
|
super.destroy();
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
export const UMB_DOCUMENT_TYPE_WORKSPACE_CONTEXT = new UmbContextToken('UmbWorkspaceContext', (context) => context.getEntityType?.() === 'document-type');
|
|
120
|
+
export const UMB_DOCUMENT_TYPE_WORKSPACE_CONTEXT = new UmbContextToken('UmbWorkspaceContext', undefined, (context) => context.getEntityType?.() === 'document-type');
|
package/dist-cms/packages/documents/documents/variant-context/document-variant-context.token.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { UMB_DOCUMENT_ENTITY_TYPE } from '../entity.js';
|
|
2
2
|
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
3
3
|
export const IsDocumentVariantContext = (context) => context.getType() === UMB_DOCUMENT_ENTITY_TYPE;
|
|
4
|
-
export const UMB_DOCUMENT_VARIANT_CONTEXT = new UmbContextToken('UmbVariantContext', IsDocumentVariantContext);
|
|
4
|
+
export const UMB_DOCUMENT_VARIANT_CONTEXT = new UmbContextToken('UmbVariantContext', undefined, IsDocumentVariantContext);
|
|
@@ -174,6 +174,4 @@ export class UmbDocumentWorkspaceContext extends UmbEditableWorkspaceContextBase
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
export default UmbDocumentWorkspaceContext;
|
|
177
|
-
export const UMB_DOCUMENT_WORKSPACE_CONTEXT = new UmbContextToken('UmbWorkspaceContext',
|
|
178
|
-
// TODO: Refactor: make a better generic way to identify workspaces, maybe workspaceType or workspaceAlias?.
|
|
179
|
-
(context) => context.getEntityType?.() === UMB_DOCUMENT_ENTITY_TYPE);
|
|
177
|
+
export const UMB_DOCUMENT_WORKSPACE_CONTEXT = new UmbContextToken('UmbWorkspaceContext', undefined, (context) => context.getEntityType?.() === UMB_DOCUMENT_ENTITY_TYPE);
|
|
@@ -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 { UmbTextStyles } from
|
|
7
|
+
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
8
8
|
import { html, customElement, state } from '../../../../external/lit/index.js';
|
|
9
9
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
10
10
|
import './document-workspace-editor.element.js';
|
|
@@ -18,15 +18,12 @@ export let UmbDocumentWorkspaceElement = class UmbDocumentWorkspaceElement exten
|
|
|
18
18
|
}
|
|
19
19
|
#workspaceContext;
|
|
20
20
|
set manifest(manifest) {
|
|
21
|
-
console.log("got manifest", manifest.alias);
|
|
22
|
-
// TODO: Make context declaration.
|
|
23
21
|
createExtensionApi(manifest, [this]).then((context) => {
|
|
24
22
|
if (context) {
|
|
25
23
|
this.#gotWorkspaceContext(context);
|
|
26
24
|
}
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
|
-
;
|
|
30
27
|
#gotWorkspaceContext(context) {
|
|
31
28
|
this.#workspaceContext = context;
|
|
32
29
|
this._routes = [
|
|
@@ -4,7 +4,8 @@ const workspace = {
|
|
|
4
4
|
type: 'workspace',
|
|
5
5
|
alias: 'Umb.Workspace.Media',
|
|
6
6
|
name: 'Media Workspace',
|
|
7
|
-
|
|
7
|
+
element: () => import('./media-workspace.element.js'),
|
|
8
|
+
api: () => import('./media-workspace.context.js'),
|
|
8
9
|
meta: {
|
|
9
10
|
entityType: 'media',
|
|
10
11
|
},
|
|
@@ -3,8 +3,9 @@ import type { UmbMediaDetailModel } from '../index.js';
|
|
|
3
3
|
import { UmbSaveableWorkspaceContextInterface, UmbEditableWorkspaceContextBase } from '../../../core/workspace/index.js';
|
|
4
4
|
import { UmbControllerHostElement } from '../../../../libs/controller-api/index.js';
|
|
5
5
|
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
6
|
+
import { UmbApi } from '../../../../libs/extension-api/index.js';
|
|
6
7
|
type EntityType = UmbMediaDetailModel;
|
|
7
|
-
export declare class UmbMediaWorkspaceContext extends UmbEditableWorkspaceContextBase<UmbMediaRepository, EntityType> implements UmbSaveableWorkspaceContextInterface<EntityType | undefined
|
|
8
|
+
export declare class UmbMediaWorkspaceContext extends UmbEditableWorkspaceContextBase<UmbMediaRepository, EntityType> implements UmbSaveableWorkspaceContextInterface<EntityType | undefined>, UmbApi {
|
|
8
9
|
#private;
|
|
9
10
|
data: import("rxjs").Observable<UmbMediaDetailModel | undefined>;
|
|
10
11
|
name: import("rxjs").Observable<string | undefined>;
|
|
@@ -20,5 +21,6 @@ export declare class UmbMediaWorkspaceContext extends UmbEditableWorkspaceContex
|
|
|
20
21
|
delete(id: string): Promise<void>;
|
|
21
22
|
destroy(): void;
|
|
22
23
|
}
|
|
24
|
+
export declare const api: typeof UmbMediaWorkspaceContext;
|
|
23
25
|
export declare const UMB_MEDIA_WORKSPACE_CONTEXT: UmbContextToken<UmbSaveableWorkspaceContextInterface<unknown>, UmbMediaWorkspaceContext>;
|
|
24
26
|
export {};
|
|
@@ -66,4 +66,5 @@ export class UmbMediaWorkspaceContext extends UmbEditableWorkspaceContextBase {
|
|
|
66
66
|
this.#data.destroy();
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
export const
|
|
69
|
+
export const api = UmbMediaWorkspaceContext;
|
|
70
|
+
export const UMB_MEDIA_WORKSPACE_CONTEXT = new UmbContextToken('UmbWorkspaceContext', undefined, (context) => context.getEntityType?.() === 'media');
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { UmbRoute } from '../../../../shared/router/index.js';
|
|
2
2
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
3
|
+
import { type ManifestWorkspace } from '../../../core/extension-registry/index.js';
|
|
3
4
|
export declare class UmbMediaWorkspaceElement extends UmbLitElement {
|
|
4
5
|
#private;
|
|
5
|
-
readonly workspaceAlias = "Umb.Workspace.Media";
|
|
6
6
|
_routes: UmbRoute[];
|
|
7
|
+
set manifest(manifest: ManifestWorkspace);
|
|
7
8
|
render(): import("lit-html").TemplateResult<1>;
|
|
8
9
|
static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
|
|
9
10
|
}
|
|
@@ -4,30 +4,50 @@ 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 { UmbMediaWorkspaceEditorElement } from './media-workspace-editor.element.js';
|
|
9
|
-
import { UmbTextStyles } from "../../../../shared/style/index.js";
|
|
7
|
+
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
10
8
|
import { css, html, customElement, state } from '../../../../external/lit/index.js';
|
|
11
9
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
10
|
+
import { createExtensionApi, UmbExtensionsApiInitializer } from '../../../../libs/extension-api/index.js';
|
|
11
|
+
import { umbExtensionsRegistry } from '../../../core/extension-registry/index.js';
|
|
12
|
+
import { UmbWorkspaceIsNewRedirectController } from '../../../core/workspace/index.js';
|
|
12
13
|
export let UmbMediaWorkspaceElement = class UmbMediaWorkspaceElement extends UmbLitElement {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
15
|
-
this.
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
this._routes = [];
|
|
17
|
+
}
|
|
18
|
+
#workspaceContext;
|
|
19
|
+
set manifest(manifest) {
|
|
20
|
+
createExtensionApi(manifest, [this]).then((context) => {
|
|
21
|
+
if (context) {
|
|
22
|
+
this.#gotWorkspaceContext(context);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
#gotWorkspaceContext(context) {
|
|
27
|
+
this.#workspaceContext = context;
|
|
18
28
|
this._routes = [
|
|
29
|
+
{
|
|
30
|
+
path: 'create/:parentId',
|
|
31
|
+
component: import('./media-workspace-editor.element.js'),
|
|
32
|
+
setup: async (_component, info) => {
|
|
33
|
+
// TODO: Remember the perspective of permissions here, we need to check if the user has access to create a document of this type under this parent?
|
|
34
|
+
const parentId = info.match.params.parentId === 'null' ? null : info.match.params.parentId;
|
|
35
|
+
//const mediaTypeKey = info.match.params.mediaTypeKey;
|
|
36
|
+
this.#workspaceContext.create(parentId /** , mediaTypeKey */);
|
|
37
|
+
new UmbWorkspaceIsNewRedirectController(this, this.#workspaceContext, this.shadowRoot.querySelector('umb-router-slot'));
|
|
38
|
+
},
|
|
39
|
+
},
|
|
19
40
|
{
|
|
20
41
|
path: 'edit/:id',
|
|
21
|
-
component: ()
|
|
42
|
+
component: import('./media-workspace-editor.element.js'),
|
|
22
43
|
setup: (_component, info) => {
|
|
23
44
|
const id = info.match.params.id;
|
|
24
45
|
this.#workspaceContext.load(id);
|
|
25
46
|
},
|
|
26
47
|
},
|
|
27
48
|
];
|
|
49
|
+
new UmbExtensionsApiInitializer(this, umbExtensionsRegistry, 'workspaceContext', [this, this.#workspaceContext]);
|
|
28
50
|
}
|
|
29
|
-
#workspaceContext;
|
|
30
|
-
#element;
|
|
31
51
|
render() {
|
|
32
52
|
return html `<umb-router-slot .routes=${this._routes}></umb-router-slot>`;
|
|
33
53
|
}
|