@umbraco-cms/backoffice 14.0.0--preview004-2a8fbe36 → 14.0.0--preview004-eaff2f45
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/apps/app/app.context.js +1 -1
- package/dist-cms/custom-elements.json +184 -173
- package/dist-cms/packages/core/components/property-type-based-property/property-type-based-property.element.js +2 -2
- package/dist-cms/packages/core/components/variant-selector/variant-selector.element.js +4 -3
- package/dist-cms/packages/core/data-type/components/property-editor-config/property-editor-config.element.d.ts +1 -1
- package/dist-cms/packages/core/data-type/components/property-editor-config/property-editor-config.element.js +9 -8
- package/dist-cms/packages/core/data-type/index.d.ts +0 -1
- package/dist-cms/packages/core/data-type/index.js +0 -1
- package/dist-cms/packages/core/data-type/workspace/data-type-workspace-editor.element.js +1 -1
- package/dist-cms/packages/core/data-type/workspace/data-type-workspace.context.d.ts +3 -3
- package/dist-cms/packages/core/data-type/workspace/data-type-workspace.context.js +44 -6
- package/dist-cms/packages/core/data-type/workspace/views/details/data-type-details-workspace-view.element.js +2 -2
- package/dist-cms/packages/core/data-type/workspace/views/info/workspace-view-data-type-info.element.js +6 -6
- package/dist-cms/packages/core/modal/common/embedded-media/embedded-media-modal.element.js +12 -12
- package/dist-cms/packages/core/property/index.d.ts +4 -0
- package/dist-cms/packages/core/property/index.js +4 -0
- package/dist-cms/packages/core/property/property/index.d.ts +2 -0
- package/dist-cms/packages/core/property/property/index.js +2 -0
- package/dist-cms/packages/core/{workspace/workspace-property/workspace-property.context.d.ts → property/property/property.context.d.ts} +3 -3
- package/dist-cms/packages/core/{workspace/workspace-property/workspace-property.context.js → property/property/property.context.js} +15 -15
- package/dist-cms/packages/core/{workspace/workspace-property/workspace-property.element.d.ts → property/property/property.element.d.ts} +9 -10
- package/dist-cms/packages/core/{workspace/workspace-property/workspace-property.element.js → property/property/property.element.js} +63 -56
- package/dist-cms/packages/core/property/property-dataset/index.d.ts +6 -0
- package/dist-cms/packages/core/property/property-dataset/index.js +6 -0
- package/dist-cms/packages/core/property/property-dataset/nameable-property-dataset-context.interface.d.ts +7 -0
- package/dist-cms/packages/core/property/property-dataset/nameable-property-dataset-context.token.d.ts +5 -0
- package/dist-cms/packages/core/property/property-dataset/nameable-property-dataset-context.token.js +4 -0
- package/dist-cms/packages/core/property/property-dataset/property-dataset-base-context.d.ts +33 -0
- package/dist-cms/packages/core/property/property-dataset/property-dataset-base-context.js +58 -0
- package/dist-cms/packages/core/{workspace/variant-context/variant-context.interface.d.ts → property/property-dataset/property-dataset-context.interface.d.ts} +7 -6
- package/dist-cms/packages/core/property/property-dataset/property-dataset-context.token.d.ts +3 -0
- package/dist-cms/packages/core/property/property-dataset/property-dataset-context.token.js +2 -0
- package/dist-cms/packages/core/property/property-dataset/property-dataset.element.d.ts +67 -0
- package/dist-cms/packages/core/property/property-dataset/property-dataset.element.js +119 -0
- package/dist-cms/packages/core/property/property-layout/index.d.ts +1 -0
- package/dist-cms/packages/core/property/property-layout/index.js +1 -0
- package/dist-cms/packages/core/{workspace/workspace-property-layout/workspace-property-layout.element.d.ts → property/property-layout/property-layout.element.d.ts} +4 -4
- package/dist-cms/packages/core/{workspace/workspace-property-layout/workspace-property-layout.element.js → property/property-layout/property-layout.element.js} +12 -12
- package/dist-cms/packages/core/property/types/index.d.ts +1 -0
- package/dist-cms/packages/core/property/types/index.js +1 -0
- package/dist-cms/packages/core/property/types/property-value-data.type.d.ts +4 -0
- package/dist-cms/packages/core/property/types/property-value-data.type.js +1 -0
- package/dist-cms/packages/core/property-action/common/clear/property-action-clear.element.js +2 -2
- package/dist-cms/packages/core/property-editor/uis/block-grid/property-editor-ui-block-grid.element.js +2 -2
- package/dist-cms/packages/core/property-editor/uis/block-list/config/block-configuration/property-editor-ui-block-list-block-configuration.element.js +1 -1
- package/dist-cms/packages/core/property-editor/uis/multi-url-picker/property-editor-ui-multi-url-picker.element.js +2 -2
- package/dist-cms/packages/core/property-editor/uis/text-box/property-editor-ui-text-box.element.js +5 -2
- package/dist-cms/packages/core/workspace/index.d.ts +1 -3
- package/dist-cms/packages/core/workspace/index.js +1 -3
- package/dist-cms/packages/core/workspace/workspace-context/workspace-invariantable-context.interface.d.ts +3 -2
- package/dist-cms/packages/core/workspace/workspace-context/workspace-variantable-context.interface.d.ts +2 -2
- package/dist-cms/packages/core/workspace/workspace-modal/workspace-modal.element.d.ts +1 -1
- package/dist-cms/packages/core/workspace/workspace-modal/workspace-modal.element.js +2 -2
- package/dist-cms/packages/core/workspace/workspace-property-dataset/index.d.ts +1 -0
- package/dist-cms/packages/core/workspace/workspace-property-dataset/index.js +1 -0
- package/dist-cms/packages/core/workspace/workspace-property-dataset/invariant-workspace-property-dataset-context.d.ts +26 -0
- package/dist-cms/packages/core/workspace/workspace-property-dataset/invariant-workspace-property-dataset-context.js +44 -0
- package/dist-cms/packages/core/workspace/workspace-split-view/workspace-split-view.context.js +1 -1
- package/dist-cms/packages/dictionary/dictionary/workspace/views/editor/workspace-view-dictionary-editor.element.js +2 -2
- package/dist-cms/packages/documents/document-types/workspace/views/design/document-type-workspace-view-edit-property.element.js +1 -1
- package/dist-cms/packages/documents/document-types/workspace/views/settings/document-type-workspace-view-settings.element.js +8 -8
- package/dist-cms/packages/documents/document-types/workspace/views/structure/document-type-workspace-view-structure.element.js +6 -6
- package/dist-cms/packages/documents/document-types/workspace/views/templates/document-type-workspace-view-templates.element.js +4 -4
- package/dist-cms/packages/documents/documents/{variant-context/document-variant-context.d.ts → property-dataset-context/document-property-dataset-context.d.ts} +4 -4
- package/dist-cms/packages/documents/documents/{variant-context/document-variant-context.js → property-dataset-context/document-property-dataset-context.js} +6 -8
- package/dist-cms/packages/documents/documents/property-dataset-context/document-property-dataset-context.token.d.ts +5 -0
- package/dist-cms/packages/documents/documents/{variant-context/document-variant-context.token.js → property-dataset-context/document-property-dataset-context.token.js} +1 -1
- package/dist-cms/packages/documents/documents/workspace/document-workspace.context.d.ts +2 -2
- package/dist-cms/packages/documents/documents/workspace/document-workspace.context.js +3 -3
- package/dist-cms/packages/media/media-types/workspace/views/design/media-type-workspace-view-edit-property.element.js +1 -1
- package/dist-cms/packages/media/media-types/workspace/views/structure/media-type-workspace-view-structure.element.js +6 -6
- package/dist-cms/packages/packages/package-builder/workspace/workspace-package-builder.element.js +15 -29
- package/dist-cms/packages/settings/languages/workspace/language/views/details/language-details-workspace-view.element.js +8 -8
- package/dist-cms/packages/settings/relation-types/workspace/views/relation-type/relation-type-workspace-view-relation-type.element.js +6 -6
- package/dist-cms/packages/tags/property-editors/tags/property-editor-ui-tags.element.js +2 -2
- package/dist-cms/packages/user/user/workspace/components/user-workspace-access-settings/user-workspace-access-settings.element.js +6 -6
- package/dist-cms/packages/user/user/workspace/components/user-workspace-profile-settings/user-workspace-profile-settings.element.js +4 -4
- package/dist-cms/packages/user/user-group/workspace/user-group-workspace-editor.element.js +6 -6
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +63 -68
- package/examples/dashboard-with-property-dataset/README.md +5 -0
- package/examples/dashboard-with-property-dataset/dataset-dashboard.ts +75 -0
- package/examples/dashboard-with-property-dataset/index.ts +15 -0
- package/package.json +4 -1
- package/dist-cms/packages/core/data-type/variant-context/data-type-variant-context.d.ts +0 -7
- package/dist-cms/packages/core/data-type/variant-context/data-type-variant-context.js +0 -7
- package/dist-cms/packages/core/data-type/variant-context/data-type-variant-context.token.d.ts +0 -5
- package/dist-cms/packages/core/data-type/variant-context/data-type-variant-context.token.js +0 -3
- package/dist-cms/packages/core/data-type/variant-context/index.d.ts +0 -2
- package/dist-cms/packages/core/data-type/variant-context/index.js +0 -2
- package/dist-cms/packages/core/workspace/variant-context/index.d.ts +0 -5
- package/dist-cms/packages/core/workspace/variant-context/index.js +0 -5
- package/dist-cms/packages/core/workspace/variant-context/invariant-workspace-variant-context.d.ts +0 -29
- package/dist-cms/packages/core/workspace/variant-context/invariant-workspace-variant-context.js +0 -48
- package/dist-cms/packages/core/workspace/variant-context/nameable-variant-context.interface.d.ts +0 -7
- package/dist-cms/packages/core/workspace/variant-context/nameable-variant-context.token.d.ts +0 -5
- package/dist-cms/packages/core/workspace/variant-context/nameable-variant-context.token.js +0 -3
- package/dist-cms/packages/core/workspace/variant-context/variant-context.token.d.ts +0 -3
- package/dist-cms/packages/core/workspace/variant-context/variant-context.token.js +0 -2
- package/dist-cms/packages/core/workspace/workspace-property/index.d.ts +0 -2
- package/dist-cms/packages/core/workspace/workspace-property/index.js +0 -2
- package/dist-cms/packages/documents/documents/variant-context/document-variant-context.token.d.ts +0 -5
- /package/dist-cms/packages/core/{workspace/variant-context/nameable-variant-context.interface.js → property/property-dataset/nameable-property-dataset-context.interface.js} +0 -0
- /package/dist-cms/packages/core/{workspace/variant-context/variant-context.interface.js → property/property-dataset/property-dataset-context.interface.js} +0 -0
|
@@ -130,7 +130,7 @@ let UmbEmbeddedMediaModalElement = class UmbEmbeddedMediaModalElement extends Um
|
|
|
130
130
|
return html `
|
|
131
131
|
<umb-body-layout headline="Embed">
|
|
132
132
|
<uui-box>
|
|
133
|
-
<umb-
|
|
133
|
+
<umb-property-layout label="URL" orientation="vertical">
|
|
134
134
|
<div slot="editor">
|
|
135
135
|
<uui-input .value=${this._model.url} type="text" @change=${this.#onUrlChange} required="true">
|
|
136
136
|
<uui-button
|
|
@@ -142,42 +142,42 @@ let UmbEmbeddedMediaModalElement = class UmbEmbeddedMediaModalElement extends Um
|
|
|
142
142
|
label="Retrieve"></uui-button>
|
|
143
143
|
</uui-input>
|
|
144
144
|
</div>
|
|
145
|
-
</umb-
|
|
145
|
+
</umb-property-layout>
|
|
146
146
|
|
|
147
|
-
${when(this.#embedResult?.oEmbedStatus === OEmbedStatus.Success || this._model.a11yInfo, () => html ` <umb-
|
|
147
|
+
${when(this.#embedResult?.oEmbedStatus === OEmbedStatus.Success || this._model.a11yInfo, () => html ` <umb-property-layout label="Preview" orientation="vertical">
|
|
148
148
|
<div slot="editor">
|
|
149
149
|
${when(this.#loading, () => html `<uui-loader-circle></uui-loader-circle>`)}
|
|
150
150
|
${when(this.#embedResult?.markup, () => html `${unsafeHTML(this.#embedResult.markup)}`)}
|
|
151
151
|
${when(this._model.info, () => html ` <p aria-hidden="true">${this._model.info}</p>`)}
|
|
152
152
|
${when(this._model.a11yInfo, () => html ` <p class="sr-only" role="alert">${this._model.a11yInfo}</p>`)}
|
|
153
153
|
</div>
|
|
154
|
-
</umb-
|
|
154
|
+
</umb-property-layout>`)}
|
|
155
155
|
|
|
156
|
-
<umb-
|
|
156
|
+
<umb-property-layout label="Width" orientation="vertical">
|
|
157
157
|
<uui-input
|
|
158
158
|
slot="editor"
|
|
159
159
|
.value=${this._model.width}
|
|
160
160
|
type="number"
|
|
161
161
|
?disabled=${this.#dimensionControlsDisabled()}
|
|
162
162
|
@change=${this.#onWidthChange}></uui-input>
|
|
163
|
-
</umb-
|
|
163
|
+
</umb-property-layout>
|
|
164
164
|
|
|
165
|
-
<umb-
|
|
165
|
+
<umb-property-layout label="Height" orientation="vertical">
|
|
166
166
|
<uui-input
|
|
167
167
|
slot="editor"
|
|
168
168
|
.value=${this._model.height}
|
|
169
169
|
type="number"
|
|
170
170
|
?disabled=${this.#dimensionControlsDisabled()}
|
|
171
171
|
@change=${this.#onHeightChange}></uui-input>
|
|
172
|
-
</umb-
|
|
172
|
+
</umb-property-layout>
|
|
173
173
|
|
|
174
|
-
<umb-
|
|
174
|
+
<umb-property-layout label="Constrain" orientation="vertical">
|
|
175
175
|
<uui-toggle
|
|
176
176
|
slot="editor"
|
|
177
177
|
@change=${this.#onConstrainChange}
|
|
178
178
|
?disabled=${this.#dimensionControlsDisabled()}
|
|
179
179
|
.checked=${this._model.constrain}></uui-toggle>
|
|
180
|
-
</umb-
|
|
180
|
+
</umb-property-layout>
|
|
181
181
|
</uui-box>
|
|
182
182
|
|
|
183
183
|
<uui-button slot="actions" id="cancel" label="Cancel" @click=${this.#handleCancel}>Cancel</uui-button>
|
|
@@ -215,11 +215,11 @@ let UmbEmbeddedMediaModalElement = class UmbEmbeddedMediaModalElement extends Um
|
|
|
215
215
|
width: 1px;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
umb-
|
|
218
|
+
umb-property-layout:first-child {
|
|
219
219
|
padding-top: 0;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
umb-
|
|
222
|
+
umb-property-layout:last-child {
|
|
223
223
|
padding-bottom: 0;
|
|
224
224
|
}
|
|
225
225
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { UmbPropertyEditorUiElement } from '../../extension-registry/interfaces/property-editor-ui-element.interface.js';
|
|
2
|
-
import { type WorkspacePropertyData } from '
|
|
2
|
+
import { type WorkspacePropertyData } from '../../workspace/types/workspace-property-data.type.js';
|
|
3
3
|
import { UmbVariantId } from '../../variant/index.js';
|
|
4
4
|
import { type UmbControllerHostElement } from '../../../../libs/controller-api/index.js';
|
|
5
5
|
import { UmbBaseController } from '../../../../libs/class-api/index.js';
|
|
6
6
|
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
7
7
|
import { UmbPropertyEditorConfigCollection } from '../../property-editor/index.js';
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class UmbPropertyContext<ValueType = any> extends UmbBaseController {
|
|
9
9
|
#private;
|
|
10
10
|
private _providerController;
|
|
11
11
|
readonly alias: import("rxjs").Observable<string | undefined>;
|
|
@@ -36,4 +36,4 @@ export declare class UmbWorkspacePropertyContext<ValueType = any> extends UmbBas
|
|
|
36
36
|
resetValue(): void;
|
|
37
37
|
destroy(): void;
|
|
38
38
|
}
|
|
39
|
-
export declare const
|
|
39
|
+
export declare const UMB_PROPERTY_CONTEXT: UmbContextToken<UmbPropertyContext<any>, UmbPropertyContext<any>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UMB_PROPERTY_DATASET_CONTEXT } from '../index.js';
|
|
2
2
|
import { UmbBaseController } from '../../../../libs/class-api/index.js';
|
|
3
|
-
import { UmbClassState, UmbObjectState, UmbStringState,
|
|
3
|
+
import { UmbBasicState, UmbClassState, UmbObjectState, UmbStringState, } from '../../../../libs/observable-api/index.js';
|
|
4
4
|
import { UmbContextProviderController, UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
5
5
|
import { UmbPropertyEditorConfigCollection } from '../../property-editor/index.js';
|
|
6
|
-
export class
|
|
6
|
+
export class UmbPropertyContext extends UmbBaseController {
|
|
7
7
|
#data;
|
|
8
8
|
#configCollection;
|
|
9
9
|
setEditor(editor) {
|
|
@@ -14,7 +14,7 @@ export class UmbWorkspacePropertyContext extends UmbBaseController {
|
|
|
14
14
|
}
|
|
15
15
|
// property variant ID:
|
|
16
16
|
#variantId;
|
|
17
|
-
#
|
|
17
|
+
#datasetContext;
|
|
18
18
|
constructor(host) {
|
|
19
19
|
super(host);
|
|
20
20
|
this.#data = new UmbObjectState({});
|
|
@@ -32,15 +32,15 @@ export class UmbWorkspacePropertyContext extends UmbBaseController {
|
|
|
32
32
|
this.variantId = this.#variantId.asObservable();
|
|
33
33
|
this._variantDifference = new UmbStringState(undefined);
|
|
34
34
|
this.variantDifference = this._variantDifference.asObservable();
|
|
35
|
-
this.consumeContext(
|
|
36
|
-
this.#
|
|
35
|
+
this.consumeContext(UMB_PROPERTY_DATASET_CONTEXT, (variantContext) => {
|
|
36
|
+
this.#datasetContext = variantContext;
|
|
37
37
|
this._generateVariantDifferenceString();
|
|
38
38
|
this._observeProperty();
|
|
39
39
|
});
|
|
40
40
|
this.observe(this.alias, () => {
|
|
41
41
|
this._observeProperty();
|
|
42
42
|
});
|
|
43
|
-
this._providerController = new UmbContextProviderController(host,
|
|
43
|
+
this._providerController = new UmbContextProviderController(host, UMB_PROPERTY_CONTEXT, this);
|
|
44
44
|
this.observe(this.configValues, (configValues) => {
|
|
45
45
|
this.#configCollection.next(configValues ? new UmbPropertyEditorConfigCollection(configValues) : undefined);
|
|
46
46
|
});
|
|
@@ -50,9 +50,9 @@ export class UmbWorkspacePropertyContext extends UmbBaseController {
|
|
|
50
50
|
}
|
|
51
51
|
async _observeProperty() {
|
|
52
52
|
const alias = this.#data.getValue().alias;
|
|
53
|
-
if (!this.#
|
|
53
|
+
if (!this.#datasetContext || !alias)
|
|
54
54
|
return;
|
|
55
|
-
const variantIdSubject = (await this.#
|
|
55
|
+
const variantIdSubject = (await this.#datasetContext.propertyVariantId?.(alias)) ?? undefined;
|
|
56
56
|
this._observePropertyVariant?.destroy();
|
|
57
57
|
if (variantIdSubject) {
|
|
58
58
|
this._observePropertyVariant = this.observe(variantIdSubject, (variantId) => {
|
|
@@ -60,7 +60,7 @@ export class UmbWorkspacePropertyContext extends UmbBaseController {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
// TODO: Verify if we need to optimize runtime by parsing the propertyVariantID, cause this method retrieves it again:
|
|
63
|
-
const subject = await this.#
|
|
63
|
+
const subject = await this.#datasetContext.propertyValueByAlias(alias);
|
|
64
64
|
this._observePropertyValue?.destroy();
|
|
65
65
|
if (subject) {
|
|
66
66
|
this._observePropertyValue = this.observe(subject, (value) => {
|
|
@@ -70,9 +70,9 @@ export class UmbWorkspacePropertyContext extends UmbBaseController {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
_generateVariantDifferenceString() {
|
|
73
|
-
if (!this.#
|
|
73
|
+
if (!this.#datasetContext)
|
|
74
74
|
return;
|
|
75
|
-
const contextVariantId = this.#
|
|
75
|
+
const contextVariantId = this.#datasetContext.getVariantId?.() ?? undefined;
|
|
76
76
|
this._variantDifference.next(contextVariantId ? this.#variantId.getValue()?.toDifferencesString(contextVariantId) : '');
|
|
77
77
|
}
|
|
78
78
|
setAlias(alias) {
|
|
@@ -86,9 +86,9 @@ export class UmbWorkspacePropertyContext extends UmbBaseController {
|
|
|
86
86
|
}
|
|
87
87
|
setValue(value) {
|
|
88
88
|
const alias = this.#data.getValue().alias;
|
|
89
|
-
if (!this.#
|
|
89
|
+
if (!this.#datasetContext || !alias)
|
|
90
90
|
return;
|
|
91
|
-
this.#
|
|
91
|
+
this.#datasetContext?.setPropertyValue(alias, value);
|
|
92
92
|
}
|
|
93
93
|
setConfig(config) {
|
|
94
94
|
this.#data.update({ config });
|
|
@@ -107,4 +107,4 @@ export class UmbWorkspacePropertyContext extends UmbBaseController {
|
|
|
107
107
|
this._providerController.destroy(); // This would also be handled by the controller host, but if someone wanted to replace/remove this context without the host being destroyed. Then we have clean up out selfs here.
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
export const
|
|
110
|
+
export const UMB_PROPERTY_CONTEXT = new UmbContextToken('UmbPropertyContext');
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { type UmbPropertyEditorConfig } from '../../property-editor/index.js';
|
|
2
1
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
2
|
+
import { type UmbPropertyEditorConfig } from '../../property-editor/index.js';
|
|
3
3
|
/**
|
|
4
|
-
* @element umb-
|
|
5
|
-
* @description
|
|
6
|
-
*
|
|
4
|
+
* @element umb-property
|
|
5
|
+
* @description Component for displaying a property with editor from extension registry.
|
|
6
|
+
* The Element will render a Property Editor based on the Property Editor UI alias passed to the element.
|
|
7
|
+
* This will also render all Property Actions related to the Property Editor UI Alias.
|
|
7
8
|
*/
|
|
8
|
-
export declare class
|
|
9
|
+
export declare class UmbPropertyElement extends UmbLitElement {
|
|
10
|
+
#private;
|
|
9
11
|
/**
|
|
10
12
|
* Label. Name of the property
|
|
11
13
|
* @type {string}
|
|
@@ -35,8 +37,8 @@ export declare class UmbWorkspacePropertyElement extends UmbLitElement {
|
|
|
35
37
|
* @attr
|
|
36
38
|
* @default ''
|
|
37
39
|
*/
|
|
38
|
-
private _propertyEditorUiAlias;
|
|
39
40
|
set propertyEditorUiAlias(value: string);
|
|
41
|
+
private _propertyEditorUiAlias;
|
|
40
42
|
/**
|
|
41
43
|
* Config. Configuration to pass to the Property Editor UI. This is also the configuration data stored on the Data Type.
|
|
42
44
|
* @public
|
|
@@ -51,9 +53,6 @@ export declare class UmbWorkspacePropertyElement extends UmbLitElement {
|
|
|
51
53
|
private _alias?;
|
|
52
54
|
private _label?;
|
|
53
55
|
private _description?;
|
|
54
|
-
private _propertyContext;
|
|
55
|
-
private _valueObserver?;
|
|
56
|
-
private _configObserver?;
|
|
57
56
|
constructor();
|
|
58
57
|
private _onPropertyEditorChange;
|
|
59
58
|
private _observePropertyEditorUI;
|
|
@@ -64,6 +63,6 @@ export declare class UmbWorkspacePropertyElement extends UmbLitElement {
|
|
|
64
63
|
}
|
|
65
64
|
declare global {
|
|
66
65
|
interface HTMLElementTagNameMap {
|
|
67
|
-
'umb-
|
|
66
|
+
'umb-property': UmbPropertyElement;
|
|
68
67
|
}
|
|
69
68
|
}
|
|
@@ -4,18 +4,19 @@ 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 { UmbPropertyContext } from './property.context.js';
|
|
8
8
|
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
9
9
|
import { css, html, customElement, property, state, ifDefined } from '../../../../external/lit/index.js';
|
|
10
10
|
import { createExtensionElement } from '../../../../libs/extension-api/index.js';
|
|
11
11
|
import { umbExtensionsRegistry } from '../../extension-registry/index.js';
|
|
12
12
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
13
13
|
/**
|
|
14
|
-
* @element umb-
|
|
15
|
-
* @description
|
|
16
|
-
*
|
|
14
|
+
* @element umb-property
|
|
15
|
+
* @description Component for displaying a property with editor from extension registry.
|
|
16
|
+
* The Element will render a Property Editor based on the Property Editor UI alias passed to the element.
|
|
17
|
+
* This will also render all Property Actions related to the Property Editor UI Alias.
|
|
17
18
|
*/
|
|
18
|
-
let
|
|
19
|
+
let UmbPropertyElement = class UmbPropertyElement extends UmbLitElement {
|
|
19
20
|
/**
|
|
20
21
|
* Label. Name of the property
|
|
21
22
|
* @type {string}
|
|
@@ -23,7 +24,7 @@ let UmbWorkspacePropertyElement = class UmbWorkspacePropertyElement extends UmbL
|
|
|
23
24
|
* @default ''
|
|
24
25
|
*/
|
|
25
26
|
set label(label) {
|
|
26
|
-
this.
|
|
27
|
+
this.#propertyContext.setLabel(label);
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
30
|
* Description: render a description underneath the label.
|
|
@@ -32,7 +33,7 @@ let UmbWorkspacePropertyElement = class UmbWorkspacePropertyElement extends UmbL
|
|
|
32
33
|
* @default ''
|
|
33
34
|
*/
|
|
34
35
|
set description(description) {
|
|
35
|
-
this.
|
|
36
|
+
this.#propertyContext.setDescription(description);
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Alias
|
|
@@ -42,8 +43,15 @@ let UmbWorkspacePropertyElement = class UmbWorkspacePropertyElement extends UmbL
|
|
|
42
43
|
* @default ''
|
|
43
44
|
*/
|
|
44
45
|
set alias(alias) {
|
|
45
|
-
this.
|
|
46
|
+
this.#propertyContext.setAlias(alias);
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Property Editor UI Alias. Render the Property Editor UI registered for this alias.
|
|
50
|
+
* @public
|
|
51
|
+
* @type {string}
|
|
52
|
+
* @attr
|
|
53
|
+
* @default ''
|
|
54
|
+
*/
|
|
47
55
|
set propertyEditorUiAlias(value) {
|
|
48
56
|
if (this._propertyEditorUiAlias === value)
|
|
49
57
|
return;
|
|
@@ -58,35 +66,31 @@ let UmbWorkspacePropertyElement = class UmbWorkspacePropertyElement extends UmbL
|
|
|
58
66
|
* @default ''
|
|
59
67
|
*/
|
|
60
68
|
set config(value) {
|
|
61
|
-
this.
|
|
69
|
+
this.#propertyContext.setConfig(value);
|
|
62
70
|
}
|
|
71
|
+
#propertyContext;
|
|
72
|
+
#valueObserver;
|
|
73
|
+
#configObserver;
|
|
63
74
|
constructor() {
|
|
64
75
|
super();
|
|
65
|
-
/**
|
|
66
|
-
* Property Editor UI Alias. Render the Property Editor UI registered for this alias.
|
|
67
|
-
* @public
|
|
68
|
-
* @type {string}
|
|
69
|
-
* @attr
|
|
70
|
-
* @default ''
|
|
71
|
-
*/
|
|
72
76
|
this._propertyEditorUiAlias = '';
|
|
73
|
-
this
|
|
77
|
+
this.#propertyContext = new UmbPropertyContext(this);
|
|
74
78
|
this._onPropertyEditorChange = (e) => {
|
|
75
79
|
const target = e.composedPath()[0];
|
|
76
80
|
//this.value = target.value; // Sets value in context.
|
|
77
|
-
this.
|
|
81
|
+
this.#propertyContext.setValue(target.value);
|
|
78
82
|
e.stopPropagation();
|
|
79
83
|
};
|
|
80
|
-
this.observe(this.
|
|
84
|
+
this.observe(this.#propertyContext.alias, (alias) => {
|
|
81
85
|
this._alias = alias;
|
|
82
86
|
});
|
|
83
|
-
this.observe(this.
|
|
87
|
+
this.observe(this.#propertyContext.label, (label) => {
|
|
84
88
|
this._label = label;
|
|
85
89
|
});
|
|
86
|
-
this.observe(this.
|
|
90
|
+
this.observe(this.#propertyContext.description, (description) => {
|
|
87
91
|
this._description = description;
|
|
88
92
|
});
|
|
89
|
-
this.observe(this.
|
|
93
|
+
this.observe(this.#propertyContext.variantDifference, (variantDifference) => {
|
|
90
94
|
this._variantDifference = variantDifference;
|
|
91
95
|
});
|
|
92
96
|
}
|
|
@@ -96,39 +100,42 @@ let UmbWorkspacePropertyElement = class UmbWorkspacePropertyElement extends UmbL
|
|
|
96
100
|
}, '_observePropertyEditorUI');
|
|
97
101
|
}
|
|
98
102
|
async _gotEditorUI(manifest) {
|
|
99
|
-
this.
|
|
103
|
+
this.#propertyContext.setEditor(undefined);
|
|
100
104
|
if (!manifest) {
|
|
101
105
|
// TODO: if propertyEditorUiAlias didn't exist in store, we should do some nice fail UI.
|
|
102
106
|
return;
|
|
103
107
|
}
|
|
104
108
|
const el = await createExtensionElement(manifest);
|
|
105
109
|
if (el) {
|
|
106
|
-
const
|
|
107
|
-
|
|
110
|
+
const oldElement = this._element;
|
|
111
|
+
// cleanup:
|
|
112
|
+
this.#valueObserver?.destroy();
|
|
113
|
+
this.#configObserver?.destroy();
|
|
114
|
+
oldElement?.removeEventListener('property-value-change', this._onPropertyEditorChange);
|
|
108
115
|
this._element = el;
|
|
109
|
-
this.
|
|
110
|
-
this._valueObserver?.destroy();
|
|
111
|
-
this._configObserver?.destroy();
|
|
116
|
+
this.#propertyContext.setEditor(this._element);
|
|
112
117
|
if (this._element) {
|
|
118
|
+
// TODO: Could this be changed to change event? (or additionally support change?)
|
|
113
119
|
this._element.addEventListener('property-value-change', this._onPropertyEditorChange);
|
|
114
|
-
|
|
120
|
+
// No need for a controller alias, as the clean is handled via the observer prop:
|
|
121
|
+
this.#valueObserver = this.observe(this.#propertyContext.value, (value) => {
|
|
115
122
|
this._value = value;
|
|
116
123
|
if (this._element) {
|
|
117
124
|
this._element.value = value;
|
|
118
125
|
}
|
|
119
|
-
}
|
|
120
|
-
this
|
|
126
|
+
});
|
|
127
|
+
this.#configObserver = this.observe(this.#propertyContext.config, (config) => {
|
|
121
128
|
if (this._element && config) {
|
|
122
129
|
this._element.config = config;
|
|
123
130
|
}
|
|
124
|
-
}
|
|
131
|
+
});
|
|
125
132
|
}
|
|
126
|
-
this.requestUpdate('element',
|
|
133
|
+
this.requestUpdate('element', oldElement);
|
|
127
134
|
}
|
|
128
135
|
}
|
|
129
136
|
render() {
|
|
130
137
|
return html `
|
|
131
|
-
<umb-
|
|
138
|
+
<umb-property-layout
|
|
132
139
|
id="layout"
|
|
133
140
|
alias="${ifDefined(this._alias)}"
|
|
134
141
|
label="${ifDefined(this._label)}"
|
|
@@ -138,14 +145,14 @@ let UmbWorkspacePropertyElement = class UmbWorkspacePropertyElement extends UmbL
|
|
|
138
145
|
? html `<uui-tag look="secondary" slot="description">${this._variantDifference}</uui-tag>`
|
|
139
146
|
: ''}
|
|
140
147
|
<div slot="editor">${this._element}</div>
|
|
141
|
-
</umb-
|
|
148
|
+
</umb-property-layout>
|
|
142
149
|
`;
|
|
143
150
|
}
|
|
144
151
|
_renderPropertyActionMenu() {
|
|
145
152
|
return html `${this._propertyEditorUiAlias
|
|
146
153
|
? html `<umb-property-action-menu
|
|
147
|
-
slot="
|
|
148
|
-
id="
|
|
154
|
+
slot="action-menu"
|
|
155
|
+
id="action-menu"
|
|
149
156
|
.propertyEditorUiAlias=${this._propertyEditorUiAlias}
|
|
150
157
|
.value=${this._value}></umb-property-action-menu>`
|
|
151
158
|
: ''}`;
|
|
@@ -161,13 +168,13 @@ let UmbWorkspacePropertyElement = class UmbWorkspacePropertyElement extends UmbL
|
|
|
161
168
|
color: var(--uui-color-text-alt);
|
|
162
169
|
}
|
|
163
170
|
|
|
164
|
-
#
|
|
171
|
+
#action-menu {
|
|
165
172
|
opacity: 0;
|
|
166
173
|
}
|
|
167
174
|
|
|
168
|
-
#layout:focus-within #
|
|
169
|
-
#layout:hover #
|
|
170
|
-
#
|
|
175
|
+
#layout:focus-within #action-menu,
|
|
176
|
+
#layout:hover #action-menu,
|
|
177
|
+
#action-menu[open] {
|
|
171
178
|
opacity: 1;
|
|
172
179
|
}
|
|
173
180
|
|
|
@@ -179,38 +186,38 @@ let UmbWorkspacePropertyElement = class UmbWorkspacePropertyElement extends UmbL
|
|
|
179
186
|
};
|
|
180
187
|
__decorate([
|
|
181
188
|
property({ type: String })
|
|
182
|
-
],
|
|
189
|
+
], UmbPropertyElement.prototype, "label", null);
|
|
183
190
|
__decorate([
|
|
184
191
|
property({ type: String })
|
|
185
|
-
],
|
|
192
|
+
], UmbPropertyElement.prototype, "description", null);
|
|
186
193
|
__decorate([
|
|
187
194
|
property({ type: String })
|
|
188
|
-
],
|
|
195
|
+
], UmbPropertyElement.prototype, "alias", null);
|
|
189
196
|
__decorate([
|
|
190
197
|
property({ type: String, attribute: 'property-editor-ui-alias' })
|
|
191
|
-
],
|
|
198
|
+
], UmbPropertyElement.prototype, "propertyEditorUiAlias", null);
|
|
192
199
|
__decorate([
|
|
193
200
|
property({ type: Array, attribute: false })
|
|
194
|
-
],
|
|
201
|
+
], UmbPropertyElement.prototype, "config", null);
|
|
195
202
|
__decorate([
|
|
196
203
|
state()
|
|
197
|
-
],
|
|
204
|
+
], UmbPropertyElement.prototype, "_variantDifference", void 0);
|
|
198
205
|
__decorate([
|
|
199
206
|
state()
|
|
200
|
-
],
|
|
207
|
+
], UmbPropertyElement.prototype, "_element", void 0);
|
|
201
208
|
__decorate([
|
|
202
209
|
state()
|
|
203
|
-
],
|
|
210
|
+
], UmbPropertyElement.prototype, "_value", void 0);
|
|
204
211
|
__decorate([
|
|
205
212
|
state()
|
|
206
|
-
],
|
|
213
|
+
], UmbPropertyElement.prototype, "_alias", void 0);
|
|
207
214
|
__decorate([
|
|
208
215
|
state()
|
|
209
|
-
],
|
|
216
|
+
], UmbPropertyElement.prototype, "_label", void 0);
|
|
210
217
|
__decorate([
|
|
211
218
|
state()
|
|
212
|
-
],
|
|
213
|
-
|
|
214
|
-
customElement('umb-
|
|
215
|
-
],
|
|
216
|
-
export {
|
|
219
|
+
], UmbPropertyElement.prototype, "_description", void 0);
|
|
220
|
+
UmbPropertyElement = __decorate([
|
|
221
|
+
customElement('umb-property')
|
|
222
|
+
], UmbPropertyElement);
|
|
223
|
+
export { UmbPropertyElement };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './nameable-property-dataset-context.interface.js';
|
|
2
|
+
export * from './nameable-property-dataset-context.token.js';
|
|
3
|
+
export * from './property-dataset-base-context.js';
|
|
4
|
+
export * from './property-dataset-context.interface.js';
|
|
5
|
+
export * from './property-dataset-context.token.js';
|
|
6
|
+
export * from './property-dataset.element.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './nameable-property-dataset-context.interface.js';
|
|
2
|
+
export * from './nameable-property-dataset-context.token.js';
|
|
3
|
+
export * from './property-dataset-base-context.js';
|
|
4
|
+
export * from './property-dataset-context.interface.js';
|
|
5
|
+
export * from './property-dataset-context.token.js';
|
|
6
|
+
export * from './property-dataset.element.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UmbPropertyDatasetContext } from './property-dataset-context.interface.js';
|
|
2
|
+
/**
|
|
3
|
+
* A variant context with ability to set the name of it.
|
|
4
|
+
*/
|
|
5
|
+
export interface UmbNameablePropertyDatasetContext extends UmbPropertyDatasetContext {
|
|
6
|
+
setName(name: string): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type UmbPropertyDatasetContext } from './property-dataset-context.interface.js';
|
|
2
|
+
import { UmbNameablePropertyDatasetContext } from './nameable-property-dataset-context.interface.js';
|
|
3
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
4
|
+
export declare const isNameablePropertyDatasetContext: (context: UmbPropertyDatasetContext) => context is UmbNameablePropertyDatasetContext;
|
|
5
|
+
export declare const UMB_NAMEABLE_PROPERTY_DATASET_CONTEXT: UmbContextToken<UmbPropertyDatasetContext, UmbNameablePropertyDatasetContext>;
|
package/dist-cms/packages/core/property/property-dataset/nameable-property-dataset-context.token.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UMB_PROPERTY_DATASET_CONTEXT } from './property-dataset-context.token.js';
|
|
2
|
+
import { UmbContextToken } from '../../../../libs/context-api/index.js';
|
|
3
|
+
export const isNameablePropertyDatasetContext = (context) => 'setName' in context;
|
|
4
|
+
export const UMB_NAMEABLE_PROPERTY_DATASET_CONTEXT = new UmbContextToken(UMB_PROPERTY_DATASET_CONTEXT.toString(), undefined, isNameablePropertyDatasetContext);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UMB_PROPERTY_DATASET_CONTEXT, type UmbNameablePropertyDatasetContext, type UmbPropertyDatasetContext } from '../index.js';
|
|
2
|
+
import type { UmbPropertyValueData } from '../types/property-value-data.type.js';
|
|
3
|
+
import { type UmbControllerHost } from '../../../../libs/controller-api/index.js';
|
|
4
|
+
import { UmbContextBase } from '../../../../libs/class-api/index.js';
|
|
5
|
+
import { UmbVariantId } from '../../variant/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* A base property dataset context implementation.
|
|
8
|
+
* @class UmbPropertyDatasetBaseContext
|
|
9
|
+
* @extends {UmbContextBase}
|
|
10
|
+
*/
|
|
11
|
+
export declare class UmbPropertyDatasetBaseContext extends UmbContextBase<typeof UMB_PROPERTY_DATASET_CONTEXT.TYPE> implements UmbPropertyDatasetContext, UmbNameablePropertyDatasetContext {
|
|
12
|
+
#private;
|
|
13
|
+
name: import("rxjs").Observable<string | undefined>;
|
|
14
|
+
readonly values: import("rxjs").Observable<UmbPropertyValueData[]>;
|
|
15
|
+
private _entityType;
|
|
16
|
+
private _unique;
|
|
17
|
+
getEntityType(): string;
|
|
18
|
+
getUnique(): string;
|
|
19
|
+
getName(): string | undefined;
|
|
20
|
+
setName(name: string | undefined): void;
|
|
21
|
+
getVariantId(): UmbVariantId;
|
|
22
|
+
constructor(host: UmbControllerHost);
|
|
23
|
+
/**
|
|
24
|
+
* TODO: Write proper JSDocs here.
|
|
25
|
+
*/
|
|
26
|
+
propertyValueByAlias<ReturnType = unknown>(propertyAlias: string): Promise<import("rxjs").Observable<ReturnType | undefined>>;
|
|
27
|
+
/**
|
|
28
|
+
* TODO: Write proper JSDocs here.
|
|
29
|
+
*/
|
|
30
|
+
setPropertyValue(alias: string, value: unknown): void;
|
|
31
|
+
getValues(): UmbPropertyValueData[];
|
|
32
|
+
setValues(map: Array<UmbPropertyValueData>): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { UMB_PROPERTY_DATASET_CONTEXT, } from '../index.js';
|
|
2
|
+
import { UmbContextBase } from '../../../../libs/class-api/index.js';
|
|
3
|
+
import { UmbArrayState, UmbStringState } from '../../../../libs/observable-api/index.js';
|
|
4
|
+
import { UmbVariantId } from '../../variant/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* A base property dataset context implementation.
|
|
7
|
+
* @class UmbPropertyDatasetBaseContext
|
|
8
|
+
* @extends {UmbContextBase}
|
|
9
|
+
*/
|
|
10
|
+
export class UmbPropertyDatasetBaseContext extends UmbContextBase {
|
|
11
|
+
#name;
|
|
12
|
+
#values;
|
|
13
|
+
getEntityType() {
|
|
14
|
+
return this._entityType;
|
|
15
|
+
}
|
|
16
|
+
getUnique() {
|
|
17
|
+
return this._unique;
|
|
18
|
+
}
|
|
19
|
+
getName() {
|
|
20
|
+
return this.#name.getValue();
|
|
21
|
+
}
|
|
22
|
+
setName(name) {
|
|
23
|
+
this.#name.next(name);
|
|
24
|
+
}
|
|
25
|
+
getVariantId() {
|
|
26
|
+
return UmbVariantId.CreateInvariant();
|
|
27
|
+
}
|
|
28
|
+
// variant id for a specific property?
|
|
29
|
+
constructor(host) {
|
|
30
|
+
// The controller alias, is a very generic name cause we want only one of these for this controller host.
|
|
31
|
+
super(host, UMB_PROPERTY_DATASET_CONTEXT);
|
|
32
|
+
this.#name = new UmbStringState(undefined);
|
|
33
|
+
this.name = this.#name.asObservable();
|
|
34
|
+
this.#values = new UmbArrayState([], (x) => x.alias);
|
|
35
|
+
this.values = this.#values.asObservable();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* TODO: Write proper JSDocs here.
|
|
39
|
+
*/
|
|
40
|
+
async propertyValueByAlias(propertyAlias) {
|
|
41
|
+
return this.#values.asObservablePart((values) => {
|
|
42
|
+
const valueObj = values.find((x) => x.alias === propertyAlias);
|
|
43
|
+
return valueObj ? valueObj.value : undefined;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* TODO: Write proper JSDocs here.
|
|
48
|
+
*/
|
|
49
|
+
setPropertyValue(alias, value) {
|
|
50
|
+
this.#values.appendOne({ alias, value });
|
|
51
|
+
}
|
|
52
|
+
getValues() {
|
|
53
|
+
return this.#values.getValue();
|
|
54
|
+
}
|
|
55
|
+
setValues(map) {
|
|
56
|
+
this.#values.next(map);
|
|
57
|
+
}
|
|
58
|
+
}
|