@umbraco-cms/backoffice 14.0.0--preview004-1a9a20fa → 14.0.0--preview004-73d11345
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/server-connection.js +1 -1
- package/dist-cms/apps/backoffice/backoffice.context.js +2 -2
- package/dist-cms/apps/installer/installer.context.js +8 -8
- package/dist-cms/custom-elements.json +2 -2
- package/dist-cms/libs/extension-api/registry/extension.registry.js +5 -5
- package/dist-cms/libs/observable-api/states/array-state.d.ts +16 -2
- package/dist-cms/libs/observable-api/states/array-state.js +25 -11
- package/dist-cms/libs/observable-api/states/basic-state.d.ts +10 -6
- package/dist-cms/libs/observable-api/states/basic-state.js +12 -8
- package/dist-cms/libs/observable-api/states/class-state.d.ts +6 -1
- package/dist-cms/libs/observable-api/states/class-state.js +8 -3
- package/dist-cms/libs/observable-api/states/deep-state.d.ts +6 -1
- package/dist-cms/libs/observable-api/states/deep-state.js +7 -2
- package/dist-cms/libs/observable-api/states/object-state.js +1 -1
- package/dist-cms/packages/block/block/context/block.context.js +8 -8
- package/dist-cms/packages/block/block/manager/block-manager.context.js +5 -5
- package/dist-cms/packages/block/block/workspace/block-element-manager.js +1 -1
- package/dist-cms/packages/block/block/workspace/block-workspace.context.js +3 -3
- package/dist-cms/packages/block/block-type/workspace/block-type-workspace.context.js +3 -3
- package/dist-cms/packages/core/collection/collection-view.manager.js +4 -4
- package/dist-cms/packages/core/collection/default/collection-default.context.js +4 -4
- package/dist-cms/packages/core/components/input-markdown-editor/input-markdown.element.js +1 -1
- package/dist-cms/packages/core/content-type/content-type-container-structure-helper.class.js +5 -5
- package/dist-cms/packages/core/content-type/content-type-property-structure-helper.class.js +1 -1
- package/dist-cms/packages/core/content-type/content-type-structure-manager.class.js +3 -3
- package/dist-cms/packages/core/data-type/workspace/data-type-workspace.context.js +5 -5
- package/dist-cms/packages/core/menu/menu.context.js +1 -1
- package/dist-cms/packages/core/modal/common/code-editor/code-editor-modal.element.js +1 -1
- package/dist-cms/packages/core/modal/modal-manager.context.js +2 -2
- package/dist-cms/packages/core/notification/notification.context.js +2 -2
- package/dist-cms/packages/core/property/property/property.context.js +10 -10
- package/dist-cms/packages/core/property/property-dataset/property-dataset-base-context.js +2 -2
- package/dist-cms/packages/core/property-editor/uis/tree-picker/config/source-type-picker/property-editor-ui-tree-picker-source-type-picker.element.d.ts +2 -1
- package/dist-cms/packages/core/property-editor/uis/tree-picker/config/source-type-picker/property-editor-ui-tree-picker-source-type-picker.element.js +20 -7
- package/dist-cms/packages/core/repository/repository-items.manager.js +3 -3
- package/dist-cms/packages/core/section/section-sidebar/section-sidebar.context.js +8 -8
- package/dist-cms/packages/core/section/section.context.js +3 -3
- package/dist-cms/packages/core/temporary-file/temporary-file-manager.class.js +2 -2
- package/dist-cms/packages/core/themes/theme.context.js +1 -1
- package/dist-cms/packages/core/tree/tree-item-base/tree-item-base.context.js +11 -11
- package/dist-cms/packages/core/workspace/workspace-context/editable-workspace-context-base.js +1 -1
- package/dist-cms/packages/core/workspace/workspace-context/entity-manager-controller.js +2 -2
- package/dist-cms/packages/core/workspace/workspace-split-view/workspace-split-view.context.js +1 -1
- package/dist-cms/packages/dictionary/dictionary/workspace/dictionary-workspace.context.js +3 -3
- package/dist-cms/packages/documents/document-types/workspace/document-type-workspace.context.js +1 -1
- package/dist-cms/packages/documents/documents/property-dataset-context/document-property-dataset-context.js +1 -1
- package/dist-cms/packages/documents/documents/workspace/document-workspace.context.js +2 -2
- package/dist-cms/packages/log-viewer/workspace/logviewer.context.js +14 -14
- package/dist-cms/packages/media/media/workspace/media-workspace.context.js +2 -2
- package/dist-cms/packages/media/media-types/workspace/media-type-workspace.context.js +1 -1
- package/dist-cms/packages/members/member-types/workspace/member-type-workspace.context.js +2 -2
- package/dist-cms/packages/relations/relation-types/workspace/relation-type-workspace.context.js +1 -1
- package/dist-cms/packages/settings/languages/workspace/language/language-workspace.context.js +1 -1
- package/dist-cms/packages/templating/partial-views/workspace/partial-view-workspace.context.js +3 -3
- package/dist-cms/packages/templating/scripts/workspace/script-workspace.context.js +3 -3
- package/dist-cms/packages/templating/stylesheets/workspace/stylesheet-workspace.context.js +5 -5
- package/dist-cms/packages/templating/templates/workspace/template-workspace.context.js +5 -5
- package/dist-cms/packages/user/current-user/current-user-history.store.js +2 -2
- package/dist-cms/packages/user/current-user/current-user.context.js +1 -1
- package/dist-cms/packages/user/user-group/workspace/user-group-workspace.context.js +2 -2
- package/dist-cms/shared/auth/auth.context.js +2 -2
- package/dist-cms/shared/utils/pagination-manager/pagination.manager.js +5 -5
- package/dist-cms/shared/utils/selection-manager/selection.manager.js +6 -6
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +2 -3
- package/examples/workspace-context-counter/counter-workspace-context.ts +1 -1
- package/package.json +1 -1
|
@@ -62,6 +62,6 @@ _UmbServerConnection_url = new WeakMap(), _UmbServerConnection_status = new Weak
|
|
|
62
62
|
if (error) {
|
|
63
63
|
throw error;
|
|
64
64
|
}
|
|
65
|
-
__classPrivateFieldGet(this, _UmbServerConnection_isConnected, "f").
|
|
65
|
+
__classPrivateFieldGet(this, _UmbServerConnection_isConnected, "f").setValue(true);
|
|
66
66
|
__classPrivateFieldSet(this, _UmbServerConnection_status, data?.serverStatus ?? RuntimeLevelModel.UNKNOWN, "f");
|
|
67
67
|
};
|
|
@@ -18,11 +18,11 @@ export class UmbBackofficeContext extends UmbContextBase {
|
|
|
18
18
|
_UmbBackofficeContext_allowedSections.set(this, new UmbBasicState([]));
|
|
19
19
|
this.allowedSections = __classPrivateFieldGet(this, _UmbBackofficeContext_allowedSections, "f").asObservable();
|
|
20
20
|
new UmbExtensionsManifestInitializer(this, umbExtensionsRegistry, 'section', null, (sections) => {
|
|
21
|
-
__classPrivateFieldGet(this, _UmbBackofficeContext_allowedSections, "f").
|
|
21
|
+
__classPrivateFieldGet(this, _UmbBackofficeContext_allowedSections, "f").setValue([...sections]);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
setActiveSectionAlias(alias) {
|
|
25
|
-
__classPrivateFieldGet(this, _UmbBackofficeContext_activeSectionAlias, "f").
|
|
25
|
+
__classPrivateFieldGet(this, _UmbBackofficeContext_activeSectionAlias, "f").setValue(alias);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
_UmbBackofficeContext_activeSectionAlias = new WeakMap(), _UmbBackofficeContext_allowedSections = new WeakMap();
|
|
@@ -47,7 +47,7 @@ export class UmbInstallerContext {
|
|
|
47
47
|
* @memberof UmbInstallerContext
|
|
48
48
|
*/
|
|
49
49
|
nextStep() {
|
|
50
|
-
this._currentStep.
|
|
50
|
+
this._currentStep.setValue(this._currentStep.getValue() + 1);
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Decrements the current step in the installation process
|
|
@@ -55,7 +55,7 @@ export class UmbInstallerContext {
|
|
|
55
55
|
* @memberof UmbInstallerContext
|
|
56
56
|
*/
|
|
57
57
|
prevStep() {
|
|
58
|
-
this._currentStep.
|
|
58
|
+
this._currentStep.setValue(this._currentStep.getValue() - 1);
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Reset the installation process
|
|
@@ -63,8 +63,8 @@ export class UmbInstallerContext {
|
|
|
63
63
|
* @memberof UmbInstallerContext
|
|
64
64
|
*/
|
|
65
65
|
reset() {
|
|
66
|
-
this._installStatus.
|
|
67
|
-
this._currentStep.
|
|
66
|
+
this._installStatus.setValue(null);
|
|
67
|
+
this._currentStep.setValue(1);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Set the data for the installation process
|
|
@@ -73,7 +73,7 @@ export class UmbInstallerContext {
|
|
|
73
73
|
* @memberof UmbInstallerContext
|
|
74
74
|
*/
|
|
75
75
|
appendData(data) {
|
|
76
|
-
this._data.
|
|
76
|
+
this._data.setValue({ ...this.getData(), ...data });
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Get the data for the installation process
|
|
@@ -91,7 +91,7 @@ export class UmbInstallerContext {
|
|
|
91
91
|
* @memberof UmbInstallerContext
|
|
92
92
|
*/
|
|
93
93
|
setInstallStatus(status) {
|
|
94
|
-
this._installStatus.
|
|
94
|
+
this._installStatus.setValue(status);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Load installer settings from the API
|
|
@@ -101,10 +101,10 @@ export class UmbInstallerContext {
|
|
|
101
101
|
async _loadInstallerSettings() {
|
|
102
102
|
const { data, error } = await tryExecute(InstallResource.getInstallSettings());
|
|
103
103
|
if (data) {
|
|
104
|
-
this._settings.
|
|
104
|
+
this._settings.setValue(data);
|
|
105
105
|
}
|
|
106
106
|
else if (error) {
|
|
107
|
-
this._installStatus.
|
|
107
|
+
this._installStatus.setValue(error);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -5054,14 +5054,14 @@
|
|
|
5054
5054
|
"attributes": [
|
|
5055
5055
|
{
|
|
5056
5056
|
"name": "value",
|
|
5057
|
-
"type": "string
|
|
5057
|
+
"type": "string"
|
|
5058
5058
|
}
|
|
5059
5059
|
],
|
|
5060
5060
|
"properties": [
|
|
5061
5061
|
{
|
|
5062
5062
|
"name": "value",
|
|
5063
5063
|
"attribute": "value",
|
|
5064
|
-
"type": "string
|
|
5064
|
+
"type": "string"
|
|
5065
5065
|
},
|
|
5066
5066
|
{
|
|
5067
5067
|
"name": "styles",
|
|
@@ -66,18 +66,18 @@ export class UmbExtensionRegistry {
|
|
|
66
66
|
.filter((k) => !(k.matchType === kind.matchType &&
|
|
67
67
|
k.matchKind === kind.matchKind));
|
|
68
68
|
nextData.push(kind);
|
|
69
|
-
this._kinds.
|
|
69
|
+
this._kinds.setValue(nextData);
|
|
70
70
|
}
|
|
71
71
|
register(manifest) {
|
|
72
72
|
const isValid = this.checkExtension(manifest);
|
|
73
73
|
if (!isValid) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
this._extensions.
|
|
76
|
+
this._extensions.setValue([...this._extensions.getValue(), manifest]);
|
|
77
77
|
}
|
|
78
78
|
registerMany(manifests) {
|
|
79
79
|
const validManifests = manifests.filter(this.checkExtension.bind(this));
|
|
80
|
-
this._extensions.
|
|
80
|
+
this._extensions.setValue([...this._extensions.getValue(), ...validManifests]);
|
|
81
81
|
}
|
|
82
82
|
unregisterMany(aliases) {
|
|
83
83
|
aliases.forEach((alias) => this.unregister(alias));
|
|
@@ -85,8 +85,8 @@ export class UmbExtensionRegistry {
|
|
|
85
85
|
unregister(alias) {
|
|
86
86
|
const newKindsValues = this._kinds.getValue().filter((kind) => kind.alias !== alias);
|
|
87
87
|
const newExtensionsValues = this._extensions.getValue().filter((extension) => extension.alias !== alias);
|
|
88
|
-
this._kinds.
|
|
89
|
-
this._extensions.
|
|
88
|
+
this._kinds.setValue(newKindsValues);
|
|
89
|
+
this._extensions.setValue(newExtensionsValues);
|
|
90
90
|
}
|
|
91
91
|
isRegistered(alias) {
|
|
92
92
|
if (this._extensions.getValue().find((ext) => ext.alias === alias)) {
|
|
@@ -14,7 +14,7 @@ export declare class UmbArrayState<T> extends UmbDeepState<T[]> {
|
|
|
14
14
|
constructor(initialData: T[], getUniqueOfEntryMethod: (entry: T) => unknown);
|
|
15
15
|
/**
|
|
16
16
|
* @method sortBy
|
|
17
|
-
* @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting
|
|
17
|
+
* @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting every time data is set.
|
|
18
18
|
* @description - A sort method to this Subject.
|
|
19
19
|
* @example <caption>Example add sort method</caption>
|
|
20
20
|
* const data = [
|
|
@@ -25,7 +25,21 @@ export declare class UmbArrayState<T> extends UmbDeepState<T[]> {
|
|
|
25
25
|
* myState.sortBy((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
|
|
26
26
|
*/
|
|
27
27
|
sortBy(sortMethod?: (a: T, b: T) => number): this;
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @method setValue
|
|
30
|
+
* @param {T} data - The next data for this state to hold.
|
|
31
|
+
* @description - Set the data of this state, if sortBy has been defined for this state the data will be sorted before set. If data is different than current this will trigger observations to update.
|
|
32
|
+
* @example <caption>Example change the data of a state</caption>
|
|
33
|
+
* const myState = new UmbArrayState('Good morning');
|
|
34
|
+
* // myState.value is equal 'Good morning'.
|
|
35
|
+
* myState.setValue('Goodnight')
|
|
36
|
+
* // myState.value is equal 'Goodnight'.
|
|
37
|
+
*/
|
|
38
|
+
setValue(value: T[]): void;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated - Use `setValue` instead.
|
|
41
|
+
*/
|
|
42
|
+
next: (value: T[]) => void;
|
|
29
43
|
/**
|
|
30
44
|
* @method remove
|
|
31
45
|
* @param {unknown[]} uniques - The unique values to remove.
|
|
@@ -26,11 +26,15 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
26
26
|
constructor(initialData, getUniqueOfEntryMethod) {
|
|
27
27
|
super(initialData);
|
|
28
28
|
_UmbArrayState_sortMethod.set(this, void 0);
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated - Use `setValue` instead.
|
|
31
|
+
*/
|
|
32
|
+
this.next = this.setValue;
|
|
29
33
|
this.getUniqueMethod = getUniqueOfEntryMethod;
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
32
36
|
* @method sortBy
|
|
33
|
-
* @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting
|
|
37
|
+
* @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting every time data is set.
|
|
34
38
|
* @description - A sort method to this Subject.
|
|
35
39
|
* @example <caption>Example add sort method</caption>
|
|
36
40
|
* const data = [
|
|
@@ -44,12 +48,22 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
44
48
|
__classPrivateFieldSet(this, _UmbArrayState_sortMethod, sortMethod, "f");
|
|
45
49
|
return this;
|
|
46
50
|
}
|
|
47
|
-
|
|
51
|
+
/**
|
|
52
|
+
* @method setValue
|
|
53
|
+
* @param {T} data - The next data for this state to hold.
|
|
54
|
+
* @description - Set the data of this state, if sortBy has been defined for this state the data will be sorted before set. If data is different than current this will trigger observations to update.
|
|
55
|
+
* @example <caption>Example change the data of a state</caption>
|
|
56
|
+
* const myState = new UmbArrayState('Good morning');
|
|
57
|
+
* // myState.value is equal 'Good morning'.
|
|
58
|
+
* myState.setValue('Goodnight')
|
|
59
|
+
* // myState.value is equal 'Goodnight'.
|
|
60
|
+
*/
|
|
61
|
+
setValue(value) {
|
|
48
62
|
if (__classPrivateFieldGet(this, _UmbArrayState_sortMethod, "f")) {
|
|
49
|
-
super.
|
|
63
|
+
super.setValue(value.sort(__classPrivateFieldGet(this, _UmbArrayState_sortMethod, "f")));
|
|
50
64
|
}
|
|
51
65
|
else {
|
|
52
|
-
super.
|
|
66
|
+
super.setValue(value);
|
|
53
67
|
}
|
|
54
68
|
}
|
|
55
69
|
/**
|
|
@@ -75,7 +89,7 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
75
89
|
return this.getUniqueMethod(x) !== unique;
|
|
76
90
|
});
|
|
77
91
|
});
|
|
78
|
-
this.
|
|
92
|
+
this.setValue(next);
|
|
79
93
|
}
|
|
80
94
|
return this;
|
|
81
95
|
}
|
|
@@ -100,7 +114,7 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
100
114
|
// @ts-ignore
|
|
101
115
|
return this.getUniqueMethod(x) !== unique;
|
|
102
116
|
});
|
|
103
|
-
this.
|
|
117
|
+
this.setValue(next);
|
|
104
118
|
}
|
|
105
119
|
return this;
|
|
106
120
|
}
|
|
@@ -126,7 +140,7 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
126
140
|
*
|
|
127
141
|
*/
|
|
128
142
|
filter(predicate) {
|
|
129
|
-
this.
|
|
143
|
+
this.setValue(this.getValue().filter(predicate));
|
|
130
144
|
return this;
|
|
131
145
|
}
|
|
132
146
|
/**
|
|
@@ -150,7 +164,7 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
150
164
|
else {
|
|
151
165
|
next.push(entry);
|
|
152
166
|
}
|
|
153
|
-
this.
|
|
167
|
+
this.setValue(next);
|
|
154
168
|
return this;
|
|
155
169
|
}
|
|
156
170
|
/**
|
|
@@ -175,10 +189,10 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
175
189
|
entries.forEach((entry) => {
|
|
176
190
|
pushToUniqueArray(next, entry, this.getUniqueMethod);
|
|
177
191
|
});
|
|
178
|
-
this.
|
|
192
|
+
this.setValue(next);
|
|
179
193
|
}
|
|
180
194
|
else {
|
|
181
|
-
this.
|
|
195
|
+
this.setValue([...this.getValue(), ...entries]);
|
|
182
196
|
}
|
|
183
197
|
return this;
|
|
184
198
|
}
|
|
@@ -200,7 +214,7 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
200
214
|
if (!this.getUniqueMethod) {
|
|
201
215
|
throw new Error("Can't partial update an ArrayState without a getUnique method provided when constructed.");
|
|
202
216
|
}
|
|
203
|
-
this.
|
|
217
|
+
this.setValue(partialUpdateFrozenArray(this.getValue(), entry, (x) => unique === this.getUniqueMethod(x)));
|
|
204
218
|
return this;
|
|
205
219
|
}
|
|
206
220
|
}
|
|
@@ -22,7 +22,7 @@ export declare class UmbBasicState<T> {
|
|
|
22
22
|
* @description - Holds the current data of this state.
|
|
23
23
|
* @example <caption>Example retrieve the current data of a state</caption>
|
|
24
24
|
* const myState = new UmbArrayState('Hello world');
|
|
25
|
-
* console.log("Value is: ", myState.
|
|
25
|
+
* console.log("Value is: ", myState.value);
|
|
26
26
|
*/
|
|
27
27
|
get value(): BehaviorSubject<T>['value'];
|
|
28
28
|
/**
|
|
@@ -40,14 +40,18 @@ export declare class UmbBasicState<T> {
|
|
|
40
40
|
*/
|
|
41
41
|
destroy(): void;
|
|
42
42
|
/**
|
|
43
|
-
* @method
|
|
44
|
-
* @param {T} data - The next
|
|
43
|
+
* @method setValue
|
|
44
|
+
* @param {T} data - The next data for this state to hold.
|
|
45
45
|
* @description - Set the data of this state, if data is different than current this will trigger observations to update.
|
|
46
|
-
* @example <caption>Example
|
|
46
|
+
* @example <caption>Example change the data of a state</caption>
|
|
47
47
|
* const myState = new UmbArrayState('Good morning');
|
|
48
48
|
* // myState.value is equal 'Good morning'.
|
|
49
|
-
* myState.
|
|
49
|
+
* myState.setValue('Goodnight')
|
|
50
50
|
* // myState.value is equal 'Goodnight'.
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
setValue(data: T): void;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated - Use `setValue` instead.
|
|
55
|
+
*/
|
|
56
|
+
next: (data: T) => void;
|
|
53
57
|
}
|
|
@@ -6,6 +6,10 @@ import { BehaviorSubject } from '../../../external/rxjs/index.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export class UmbBasicState {
|
|
8
8
|
constructor(initialData) {
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated - Use `setValue` instead.
|
|
11
|
+
*/
|
|
12
|
+
this.next = this.setValue;
|
|
9
13
|
this._subject = new BehaviorSubject(initialData);
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
@@ -25,7 +29,7 @@ export class UmbBasicState {
|
|
|
25
29
|
* @description - Holds the current data of this state.
|
|
26
30
|
* @example <caption>Example retrieve the current data of a state</caption>
|
|
27
31
|
* const myState = new UmbArrayState('Hello world');
|
|
28
|
-
* console.log("Value is: ", myState.
|
|
32
|
+
* console.log("Value is: ", myState.value);
|
|
29
33
|
*/
|
|
30
34
|
get value() {
|
|
31
35
|
return this._subject.value;
|
|
@@ -49,18 +53,18 @@ export class UmbBasicState {
|
|
|
49
53
|
this._subject.complete();
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
|
-
* @method
|
|
53
|
-
* @param {T} data - The next
|
|
56
|
+
* @method setValue
|
|
57
|
+
* @param {T} data - The next data for this state to hold.
|
|
54
58
|
* @description - Set the data of this state, if data is different than current this will trigger observations to update.
|
|
55
|
-
* @example <caption>Example
|
|
59
|
+
* @example <caption>Example change the data of a state</caption>
|
|
56
60
|
* const myState = new UmbArrayState('Good morning');
|
|
57
61
|
* // myState.value is equal 'Good morning'.
|
|
58
|
-
* myState.
|
|
62
|
+
* myState.setValue('Goodnight')
|
|
59
63
|
* // myState.value is equal 'Goodnight'.
|
|
60
64
|
*/
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
this._subject.next(
|
|
65
|
+
setValue(data) {
|
|
66
|
+
if (data !== this._subject.getValue()) {
|
|
67
|
+
this._subject.next(data);
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
}
|
|
@@ -10,5 +10,10 @@ export interface UmbClassStateData {
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class UmbClassState<T extends UmbClassStateData | undefined> extends UmbBasicState<T> {
|
|
12
12
|
constructor(initialData: T);
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @method setValue
|
|
15
|
+
* @param {T} data - The next data for this state to hold.
|
|
16
|
+
* @description - Set the data of this state, if data is different than current this will trigger observations to update.
|
|
17
|
+
*/
|
|
18
|
+
setValue(data: T): void;
|
|
14
19
|
}
|
|
@@ -9,10 +9,15 @@ export class UmbClassState extends UmbBasicState {
|
|
|
9
9
|
constructor(initialData) {
|
|
10
10
|
super(initialData);
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @method setValue
|
|
14
|
+
* @param {T} data - The next data for this state to hold.
|
|
15
|
+
* @description - Set the data of this state, if data is different than current this will trigger observations to update.
|
|
16
|
+
*/
|
|
17
|
+
setValue(data) {
|
|
13
18
|
const oldValue = this._subject.getValue();
|
|
14
|
-
if (
|
|
19
|
+
if (data && oldValue?.equal(data))
|
|
15
20
|
return;
|
|
16
|
-
this._subject.next(
|
|
21
|
+
this._subject.next(data);
|
|
17
22
|
}
|
|
18
23
|
}
|
|
@@ -11,5 +11,10 @@ import { UmbBasicState } from './basic-state.js';
|
|
|
11
11
|
export declare class UmbDeepState<T> extends UmbBasicState<T> {
|
|
12
12
|
constructor(initialData: T);
|
|
13
13
|
asObservablePart<ReturnType>(mappingFunction: MappingFunction<T, ReturnType>, memoizationFunction?: MemoizationFunction<ReturnType>): import("rxjs").Observable<ReturnType>;
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @method setValue
|
|
16
|
+
* @param {T} data - The next data for this state to hold.
|
|
17
|
+
* @description - Set the data of this state, if data is different than current this will trigger observations to update.
|
|
18
|
+
*/
|
|
19
|
+
setValue(data: T): void;
|
|
15
20
|
}
|
|
@@ -16,8 +16,13 @@ export class UmbDeepState extends UmbBasicState {
|
|
|
16
16
|
asObservablePart(mappingFunction, memoizationFunction) {
|
|
17
17
|
return createObservablePart(this._subject, mappingFunction, memoizationFunction);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* @method setValue
|
|
21
|
+
* @param {T} data - The next data for this state to hold.
|
|
22
|
+
* @description - Set the data of this state, if data is different than current this will trigger observations to update.
|
|
23
|
+
*/
|
|
24
|
+
setValue(data) {
|
|
25
|
+
const frozenData = deepFreeze(data);
|
|
21
26
|
// Only update data if its different than current data.
|
|
22
27
|
if (!naiveObjectComparison(frozenData, this._subject.getValue())) {
|
|
23
28
|
this._subject.next(frozenData);
|
|
@@ -20,7 +20,7 @@ export class UmbObjectState extends UmbDeepState {
|
|
|
20
20
|
* myState.update({value: 'myNewValue'});
|
|
21
21
|
*/
|
|
22
22
|
update(partialData) {
|
|
23
|
-
this.
|
|
23
|
+
this.setValue({ ...this._subject.getValue(), ...partialData });
|
|
24
24
|
return this;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -22,7 +22,7 @@ export class UmbBlockContext extends UmbContextBase {
|
|
|
22
22
|
* @returns {void}
|
|
23
23
|
*/
|
|
24
24
|
setLayout(layout) {
|
|
25
|
-
__classPrivateFieldGet(this, _UmbBlockContext_layout, "f").
|
|
25
|
+
__classPrivateFieldGet(this, _UmbBlockContext_layout, "f").setValue(layout);
|
|
26
26
|
}
|
|
27
27
|
constructor(host) {
|
|
28
28
|
super(host, UMB_BLOCK_CONTEXT);
|
|
@@ -51,7 +51,7 @@ export class UmbBlockContext extends UmbContextBase {
|
|
|
51
51
|
this.consumeContext(UMB_BLOCK_MANAGER_CONTEXT, (manager) => {
|
|
52
52
|
__classPrivateFieldSet(this, _UmbBlockContext_manager, manager, "f");
|
|
53
53
|
this.observe(manager.workspacePath, (workspacePath) => {
|
|
54
|
-
__classPrivateFieldGet(this, _UmbBlockContext_workspacePath, "f").
|
|
54
|
+
__classPrivateFieldGet(this, _UmbBlockContext_workspacePath, "f").setValue(workspacePath);
|
|
55
55
|
}, 'observeWorkspacePath');
|
|
56
56
|
__classPrivateFieldGet(this, _UmbBlockContext_instances, "m", _UmbBlockContext_observeBlockType).call(this);
|
|
57
57
|
__classPrivateFieldGet(this, _UmbBlockContext_instances, "m", _UmbBlockContext_observeData).call(this);
|
|
@@ -94,13 +94,13 @@ _UmbBlockContext_manager = new WeakMap(), _UmbBlockContext_blockTypeName = new W
|
|
|
94
94
|
return;
|
|
95
95
|
// observe content:
|
|
96
96
|
this.observe(__classPrivateFieldGet(this, _UmbBlockContext_manager, "f").contentOf(contentUdi), (content) => {
|
|
97
|
-
__classPrivateFieldGet(this, _UmbBlockContext_content, "f").
|
|
97
|
+
__classPrivateFieldGet(this, _UmbBlockContext_content, "f").setValue(content);
|
|
98
98
|
}, 'observeContent');
|
|
99
99
|
// observe settings:
|
|
100
100
|
const settingsUdi = __classPrivateFieldGet(this, _UmbBlockContext_layout, "f").value?.settingsUdi;
|
|
101
101
|
if (settingsUdi) {
|
|
102
102
|
this.observe(__classPrivateFieldGet(this, _UmbBlockContext_manager, "f").contentOf(settingsUdi), (content) => {
|
|
103
|
-
__classPrivateFieldGet(this, _UmbBlockContext_settings, "f").
|
|
103
|
+
__classPrivateFieldGet(this, _UmbBlockContext_settings, "f").setValue(content);
|
|
104
104
|
}, 'observeSettings');
|
|
105
105
|
}
|
|
106
106
|
}, _UmbBlockContext_observeBlockType = function _UmbBlockContext_observeBlockType() {
|
|
@@ -111,7 +111,7 @@ _UmbBlockContext_manager = new WeakMap(), _UmbBlockContext_blockTypeName = new W
|
|
|
111
111
|
return;
|
|
112
112
|
// observe blockType:
|
|
113
113
|
this.observe(__classPrivateFieldGet(this, _UmbBlockContext_manager, "f").blockTypeOf(contentTypeKey), (blockType) => {
|
|
114
|
-
__classPrivateFieldGet(this, _UmbBlockContext_blockType, "f").
|
|
114
|
+
__classPrivateFieldGet(this, _UmbBlockContext_blockType, "f").setValue(blockType);
|
|
115
115
|
}, 'observeBlockType');
|
|
116
116
|
}, _UmbBlockContext_observeBlockTypeLabel = function _UmbBlockContext_observeBlockTypeLabel() {
|
|
117
117
|
if (!__classPrivateFieldGet(this, _UmbBlockContext_manager, "f"))
|
|
@@ -122,14 +122,14 @@ _UmbBlockContext_manager = new WeakMap(), _UmbBlockContext_blockTypeName = new W
|
|
|
122
122
|
if (blockType.label) {
|
|
123
123
|
this.removeControllerByAlias('observeContentTypeName');
|
|
124
124
|
// Missing part for label syntax, as we need to store the syntax, interpretive it and then set the label: (here we are just parsing the label syntax)
|
|
125
|
-
__classPrivateFieldGet(this, _UmbBlockContext_label, "f").
|
|
125
|
+
__classPrivateFieldGet(this, _UmbBlockContext_label, "f").setValue(blockType.label);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
else {
|
|
129
129
|
// TODO: Maybe this could be skipped if we had a fallback label which was set to get the content element type name?
|
|
130
130
|
// Get the name of the content element type for label:
|
|
131
131
|
this.observe(this.blockTypeName, (contentTypeName) => {
|
|
132
|
-
__classPrivateFieldGet(this, _UmbBlockContext_label, "f").
|
|
132
|
+
__classPrivateFieldGet(this, _UmbBlockContext_label, "f").setValue(contentTypeName ?? 'no name');
|
|
133
133
|
}, 'observeBlockTypeName');
|
|
134
134
|
}
|
|
135
135
|
}, _UmbBlockContext_observeBlockTypeContentElementName = function _UmbBlockContext_observeBlockTypeContentElementName() {
|
|
@@ -140,7 +140,7 @@ _UmbBlockContext_manager = new WeakMap(), _UmbBlockContext_blockTypeName = new W
|
|
|
140
140
|
return;
|
|
141
141
|
// observe blockType:
|
|
142
142
|
this.observe(__classPrivateFieldGet(this, _UmbBlockContext_manager, "f").contentTypeNameOf(contentElementTypeKey), (contentTypeName) => {
|
|
143
|
-
__classPrivateFieldGet(this, _UmbBlockContext_blockTypeName, "f").
|
|
143
|
+
__classPrivateFieldGet(this, _UmbBlockContext_blockTypeName, "f").setValue(contentTypeName);
|
|
144
144
|
}, 'observeBlockTypeContentElementTypeName');
|
|
145
145
|
};
|
|
146
146
|
export const UMB_BLOCK_CONTEXT = new UmbContextToken('UmbBlockContext');
|
|
@@ -12,19 +12,19 @@ import { getKeyFromUdi } from '../../../../shared/utils/index.js';
|
|
|
12
12
|
import { UMB_WORKSPACE_MODAL, UmbModalRouteRegistrationController } from '../../../core/modal/index.js';
|
|
13
13
|
export class UmbBlockManagerContext extends UmbContextBase {
|
|
14
14
|
setBlockTypes(blockTypes) {
|
|
15
|
-
__classPrivateFieldGet(this, _UmbBlockManagerContext_blockTypes, "f").
|
|
15
|
+
__classPrivateFieldGet(this, _UmbBlockManagerContext_blockTypes, "f").setValue(blockTypes);
|
|
16
16
|
}
|
|
17
17
|
getBlockTypes() {
|
|
18
18
|
return __classPrivateFieldGet(this, _UmbBlockManagerContext_blockTypes, "f").value;
|
|
19
19
|
}
|
|
20
20
|
setLayouts(layouts) {
|
|
21
|
-
__classPrivateFieldGet(this, _UmbBlockManagerContext_layouts, "f").
|
|
21
|
+
__classPrivateFieldGet(this, _UmbBlockManagerContext_layouts, "f").setValue(layouts);
|
|
22
22
|
}
|
|
23
23
|
setContents(contents) {
|
|
24
|
-
__classPrivateFieldGet(this, _UmbBlockManagerContext_contents, "f").
|
|
24
|
+
__classPrivateFieldGet(this, _UmbBlockManagerContext_contents, "f").setValue(contents);
|
|
25
25
|
}
|
|
26
26
|
setSettings(settings) {
|
|
27
|
-
__classPrivateFieldGet(this, _UmbBlockManagerContext_settings, "f").
|
|
27
|
+
__classPrivateFieldGet(this, _UmbBlockManagerContext_settings, "f").setValue(settings);
|
|
28
28
|
}
|
|
29
29
|
constructor(host) {
|
|
30
30
|
super(host, UMB_BLOCK_MANAGER_CONTEXT);
|
|
@@ -52,7 +52,7 @@ export class UmbBlockManagerContext extends UmbContextBase {
|
|
|
52
52
|
})
|
|
53
53
|
.observeRouteBuilder((routeBuilder) => {
|
|
54
54
|
const newPath = routeBuilder({});
|
|
55
|
-
__classPrivateFieldGet(this, _UmbBlockManagerContext_workspacePath, "f").
|
|
55
|
+
__classPrivateFieldGet(this, _UmbBlockManagerContext_workspacePath, "f").setValue(newPath);
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
async ensureContentType(id) {
|
|
@@ -31,7 +31,7 @@ export class UmbBlockElementManager extends UmbBaseController {
|
|
|
31
31
|
this.observe(this.contentTypeId, (id) => this.structure.loadType(id));
|
|
32
32
|
}
|
|
33
33
|
setData(data) {
|
|
34
|
-
__classPrivateFieldGet(this, _UmbBlockElementManager_data, "f").
|
|
34
|
+
__classPrivateFieldGet(this, _UmbBlockElementManager_data, "f").setValue(data);
|
|
35
35
|
__classPrivateFieldGet(this, _UmbBlockElementManager_getDataResolver, "f").call(this);
|
|
36
36
|
}
|
|
37
37
|
getData() {
|
|
@@ -42,7 +42,7 @@ export class UmbBlockWorkspaceContext extends UmbEditableWorkspaceContextBase {
|
|
|
42
42
|
this.consumeContext(UMB_BLOCK_MANAGER_CONTEXT, (context) => {
|
|
43
43
|
__classPrivateFieldSet(this, _UmbBlockWorkspaceContext_blockManager, context, "f");
|
|
44
44
|
this.observe(context.layoutOf(unique), (layoutData) => {
|
|
45
|
-
__classPrivateFieldGet(this, _UmbBlockWorkspaceContext_layout, "f").
|
|
45
|
+
__classPrivateFieldGet(this, _UmbBlockWorkspaceContext_layout, "f").setValue(layoutData);
|
|
46
46
|
//
|
|
47
47
|
// Content:
|
|
48
48
|
const contentUdi = layoutData?.contentUdi;
|
|
@@ -76,13 +76,13 @@ export class UmbBlockWorkspaceContext extends UmbEditableWorkspaceContextBase {
|
|
|
76
76
|
this.content.setData(content);
|
|
77
77
|
// TODO: If we have Settings dedicated to this block type, we initiate them here:
|
|
78
78
|
this.setIsNew(true);
|
|
79
|
-
__classPrivateFieldGet(this, _UmbBlockWorkspaceContext_layout, "f").
|
|
79
|
+
__classPrivateFieldGet(this, _UmbBlockWorkspaceContext_layout, "f").setValue(layout);
|
|
80
80
|
}
|
|
81
81
|
getIsNew() {
|
|
82
82
|
return __classPrivateFieldGet(this, _UmbBlockWorkspaceContext_isNew, "f").value;
|
|
83
83
|
}
|
|
84
84
|
setIsNew(value) {
|
|
85
|
-
__classPrivateFieldGet(this, _UmbBlockWorkspaceContext_isNew, "f").
|
|
85
|
+
__classPrivateFieldGet(this, _UmbBlockWorkspaceContext_isNew, "f").setValue(value);
|
|
86
86
|
}
|
|
87
87
|
getData() {
|
|
88
88
|
return __classPrivateFieldGet(this, _UmbBlockWorkspaceContext_layout, "f").getValue();
|
|
@@ -39,12 +39,12 @@ export class UmbBlockTypeWorkspaceContext extends UmbEditableWorkspaceContextBas
|
|
|
39
39
|
if (value) {
|
|
40
40
|
const blockTypeData = value.find((x) => x.contentElementTypeKey === unique);
|
|
41
41
|
if (blockTypeData) {
|
|
42
|
-
__classPrivateFieldGet(this, _UmbBlockTypeWorkspaceContext_data, "f").
|
|
42
|
+
__classPrivateFieldGet(this, _UmbBlockTypeWorkspaceContext_data, "f").setValue(blockTypeData);
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
// Fallback to undefined:
|
|
47
|
-
__classPrivateFieldGet(this, _UmbBlockTypeWorkspaceContext_data, "f").
|
|
47
|
+
__classPrivateFieldGet(this, _UmbBlockTypeWorkspaceContext_data, "f").setValue(undefined);
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -53,7 +53,7 @@ export class UmbBlockTypeWorkspaceContext extends UmbEditableWorkspaceContextBas
|
|
|
53
53
|
contentElementTypeKey: contentElementTypeId,
|
|
54
54
|
};
|
|
55
55
|
this.setIsNew(true);
|
|
56
|
-
__classPrivateFieldGet(this, _UmbBlockTypeWorkspaceContext_data, "f").
|
|
56
|
+
__classPrivateFieldGet(this, _UmbBlockTypeWorkspaceContext_data, "f").setValue(data);
|
|
57
57
|
return { data };
|
|
58
58
|
}
|
|
59
59
|
getData() {
|
|
@@ -32,7 +32,7 @@ export class UmbCollectionViewManager extends UmbBaseController {
|
|
|
32
32
|
// TODO: hack - we need to figure out how to get the "parent path" from the router
|
|
33
33
|
setTimeout(() => {
|
|
34
34
|
const currentUrl = new URL(window.location.href);
|
|
35
|
-
__classPrivateFieldGet(this, _UmbCollectionViewManager_rootPathname, "f").
|
|
35
|
+
__classPrivateFieldGet(this, _UmbCollectionViewManager_rootPathname, "f").setValue(currentUrl.pathname.substring(0, currentUrl.pathname.lastIndexOf('/')));
|
|
36
36
|
}, 100);
|
|
37
37
|
}
|
|
38
38
|
// Views
|
|
@@ -42,7 +42,7 @@ export class UmbCollectionViewManager extends UmbBaseController {
|
|
|
42
42
|
* @memberof UmbCollectionContext
|
|
43
43
|
*/
|
|
44
44
|
setCurrentView(view) {
|
|
45
|
-
__classPrivateFieldGet(this, _UmbCollectionViewManager_currentView, "f").
|
|
45
|
+
__classPrivateFieldGet(this, _UmbCollectionViewManager_currentView, "f").setValue(view);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Returns the current view.
|
|
@@ -56,7 +56,7 @@ export class UmbCollectionViewManager extends UmbBaseController {
|
|
|
56
56
|
_UmbCollectionViewManager_views = new WeakMap(), _UmbCollectionViewManager_currentView = new WeakMap(), _UmbCollectionViewManager_routes = new WeakMap(), _UmbCollectionViewManager_rootPathname = new WeakMap(), _UmbCollectionViewManager_defaultViewAlias = new WeakMap(), _UmbCollectionViewManager_instances = new WeakSet(), _UmbCollectionViewManager_observeViews = function _UmbCollectionViewManager_observeViews() {
|
|
57
57
|
return new UmbExtensionsManifestInitializer(this, umbExtensionsRegistry, 'collectionView', null, (views) => {
|
|
58
58
|
const manifests = views.map((view) => view.manifest);
|
|
59
|
-
__classPrivateFieldGet(this, _UmbCollectionViewManager_views, "f").
|
|
59
|
+
__classPrivateFieldGet(this, _UmbCollectionViewManager_views, "f").setValue(manifests);
|
|
60
60
|
__classPrivateFieldGet(this, _UmbCollectionViewManager_instances, "m", _UmbCollectionViewManager_createRoutes).call(this, manifests);
|
|
61
61
|
});
|
|
62
62
|
}, _UmbCollectionViewManager_createRoutes = function _UmbCollectionViewManager_createRoutes(views) {
|
|
@@ -79,5 +79,5 @@ _UmbCollectionViewManager_views = new WeakMap(), _UmbCollectionViewManager_curre
|
|
|
79
79
|
redirectTo: fallbackView,
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
__classPrivateFieldGet(this, _UmbCollectionViewManager_routes, "f").
|
|
82
|
+
__classPrivateFieldGet(this, _UmbCollectionViewManager_routes, "f").setValue(routes);
|
|
83
83
|
};
|
|
@@ -79,8 +79,8 @@ export class UmbDefaultCollectionContext extends UmbContextBase {
|
|
|
79
79
|
const filter = __classPrivateFieldGet(this, _UmbDefaultCollectionContext_filter, "f").getValue();
|
|
80
80
|
const { data } = await this.repository.requestCollection(filter);
|
|
81
81
|
if (data) {
|
|
82
|
-
__classPrivateFieldGet(this, _UmbDefaultCollectionContext_items, "f").
|
|
83
|
-
__classPrivateFieldGet(this, _UmbDefaultCollectionContext_totalItems, "f").
|
|
82
|
+
__classPrivateFieldGet(this, _UmbDefaultCollectionContext_items, "f").setValue(data.items);
|
|
83
|
+
__classPrivateFieldGet(this, _UmbDefaultCollectionContext_totalItems, "f").setValue(data.total);
|
|
84
84
|
this.pagination.setTotalItems(data.total);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -90,7 +90,7 @@ export class UmbDefaultCollectionContext extends UmbContextBase {
|
|
|
90
90
|
* @memberof UmbCollectionContext
|
|
91
91
|
*/
|
|
92
92
|
setFilter(filter) {
|
|
93
|
-
__classPrivateFieldGet(this, _UmbDefaultCollectionContext_filter, "f").
|
|
93
|
+
__classPrivateFieldGet(this, _UmbDefaultCollectionContext_filter, "f").setValue({ ...__classPrivateFieldGet(this, _UmbDefaultCollectionContext_filter, "f").getValue(), ...filter });
|
|
94
94
|
this.requestCollection();
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -102,7 +102,7 @@ _UmbDefaultCollectionContext_manifest = new WeakMap(), _UmbDefaultCollectionCont
|
|
|
102
102
|
}, _UmbDefaultCollectionContext_configure = function _UmbDefaultCollectionContext_configure(configuration) {
|
|
103
103
|
this.selection.setMultiple(true);
|
|
104
104
|
this.pagination.setPageSize(configuration.pageSize);
|
|
105
|
-
__classPrivateFieldGet(this, _UmbDefaultCollectionContext_filter, "f").
|
|
105
|
+
__classPrivateFieldGet(this, _UmbDefaultCollectionContext_filter, "f").setValue({ ...__classPrivateFieldGet(this, _UmbDefaultCollectionContext_filter, "f").getValue(), skip: 0, take: configuration.pageSize });
|
|
106
106
|
}, _UmbDefaultCollectionContext_observeRepository = function _UmbDefaultCollectionContext_observeRepository(repositoryAlias) {
|
|
107
107
|
new UmbExtensionApiInitializer(this, umbExtensionsRegistry, repositoryAlias, [this._host], (permitted, ctrl) => {
|
|
108
108
|
this.repository = permitted ? ctrl.api : undefined;
|