@aemforms/af-core 0.22.166 → 0.22.169
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/esm/afb-runtime.js +20 -1
- package/esm/types/src/Scriptable.d.ts +21 -0
- package/lib/BaseNode.js +6 -0
- package/lib/Scriptable.d.ts +21 -0
- package/lib/Scriptable.js +5 -0
- package/lib/controller/EventQueue.js +10 -1
- package/package.json +2 -2
package/esm/afb-runtime.js
CHANGED
|
@@ -1840,6 +1840,12 @@ class BaseNode {
|
|
|
1840
1840
|
}
|
|
1841
1841
|
if (_data) {
|
|
1842
1842
|
if (!this.isContainer && _parent !== NullDataValue && _data !== NullDataValue) {
|
|
1843
|
+
if (_data.$isDataGroup && _data.$_fields.length > 0) {
|
|
1844
|
+
console.error(`Data binding conflict: non-container field "${this._jsonModel.name || this.id}" ` +
|
|
1845
|
+
`with dataRef "${dataRef}" points to a DataGroup already bound by a container. ` +
|
|
1846
|
+
'This would destroy existing child data. The data of this field will not be exported.');
|
|
1847
|
+
return this._data;
|
|
1848
|
+
}
|
|
1843
1849
|
_data = _data?.$convertToDataValue();
|
|
1844
1850
|
_parent.$addDataNode(_key, _data, true);
|
|
1845
1851
|
}
|
|
@@ -2039,6 +2045,11 @@ class Scriptable extends BaseNode {
|
|
|
2039
2045
|
}
|
|
2040
2046
|
return this._events[eName] || [];
|
|
2041
2047
|
}
|
|
2048
|
+
getState(forRestore = false) {
|
|
2049
|
+
const state = super.getState(forRestore);
|
|
2050
|
+
state.events = state.events || {};
|
|
2051
|
+
return state;
|
|
2052
|
+
}
|
|
2042
2053
|
applyUpdates(updates) {
|
|
2043
2054
|
if (typeof updates === 'object') {
|
|
2044
2055
|
if (updates !== null) {
|
|
@@ -2781,7 +2792,15 @@ class EventNode {
|
|
|
2781
2792
|
return that !== null && that !== undefined && this._node == that._node && this._event.type == that._event.type;
|
|
2782
2793
|
}
|
|
2783
2794
|
toString() {
|
|
2784
|
-
|
|
2795
|
+
const base = this._node.id + '__' + this._event.type;
|
|
2796
|
+
if (this._event.type === 'change' && this._event.payload?.changes) {
|
|
2797
|
+
const sig = this._event.payload.changes
|
|
2798
|
+
.map((c) => c.propertyName)
|
|
2799
|
+
.sort()
|
|
2800
|
+
.join(',');
|
|
2801
|
+
return base + '__' + sig;
|
|
2802
|
+
}
|
|
2803
|
+
return base;
|
|
2785
2804
|
}
|
|
2786
2805
|
valueOf() {
|
|
2787
2806
|
return this.toString();
|
|
@@ -8,6 +8,27 @@ declare abstract class Scriptable<T extends RulesJson> extends BaseNode<T> imple
|
|
|
8
8
|
getRules(): import("./types/Json").Items<string>;
|
|
9
9
|
private getCompiledRule;
|
|
10
10
|
private getCompiledEvent;
|
|
11
|
+
getState(forRestore?: boolean): T & {
|
|
12
|
+
_dependents?: {
|
|
13
|
+
id: string;
|
|
14
|
+
propertyName: string | undefined;
|
|
15
|
+
}[] | undefined;
|
|
16
|
+
allowedComponents?: undefined;
|
|
17
|
+
columnClassNames?: undefined;
|
|
18
|
+
columnCount?: undefined;
|
|
19
|
+
gridClassNames?: undefined;
|
|
20
|
+
':type': string;
|
|
21
|
+
repeatable?: boolean | undefined;
|
|
22
|
+
minOccur?: number | undefined;
|
|
23
|
+
maxOccur?: number | undefined;
|
|
24
|
+
properties: {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
index: number;
|
|
28
|
+
parent: undefined;
|
|
29
|
+
qualifiedName: any;
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
11
32
|
protected applyUpdates(updates: any): void;
|
|
12
33
|
protected executeAllRules(context: any): void;
|
|
13
34
|
private getExpressionScope;
|
package/lib/BaseNode.js
CHANGED
|
@@ -491,6 +491,12 @@ class BaseNode {
|
|
|
491
491
|
}
|
|
492
492
|
if (_data) {
|
|
493
493
|
if (!this.isContainer && _parent !== EmptyDataValue_1.default && _data !== EmptyDataValue_1.default) {
|
|
494
|
+
if (_data.$isDataGroup && _data.$_fields.length > 0) {
|
|
495
|
+
console.error(`Data binding conflict: non-container field "${this._jsonModel.name || this.id}" ` +
|
|
496
|
+
`with dataRef "${dataRef}" points to a DataGroup already bound by a container. ` +
|
|
497
|
+
'This would destroy existing child data. The data of this field will not be exported.');
|
|
498
|
+
return this._data;
|
|
499
|
+
}
|
|
494
500
|
_data = _data === null || _data === void 0 ? void 0 : _data.$convertToDataValue();
|
|
495
501
|
_parent.$addDataNode(_key, _data, true);
|
|
496
502
|
}
|
package/lib/Scriptable.d.ts
CHANGED
|
@@ -8,6 +8,27 @@ declare abstract class Scriptable<T extends RulesJson> extends BaseNode<T> imple
|
|
|
8
8
|
getRules(): import("./types/Json").Items<string>;
|
|
9
9
|
private getCompiledRule;
|
|
10
10
|
private getCompiledEvent;
|
|
11
|
+
getState(forRestore?: boolean): T & {
|
|
12
|
+
_dependents?: {
|
|
13
|
+
id: string;
|
|
14
|
+
propertyName: string | undefined;
|
|
15
|
+
}[] | undefined;
|
|
16
|
+
allowedComponents?: undefined;
|
|
17
|
+
columnClassNames?: undefined;
|
|
18
|
+
columnCount?: undefined;
|
|
19
|
+
gridClassNames?: undefined;
|
|
20
|
+
':type': string;
|
|
21
|
+
repeatable?: boolean | undefined;
|
|
22
|
+
minOccur?: number | undefined;
|
|
23
|
+
maxOccur?: number | undefined;
|
|
24
|
+
properties: {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
index: number;
|
|
28
|
+
parent: undefined;
|
|
29
|
+
qualifiedName: any;
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
11
32
|
protected applyUpdates(updates: any): void;
|
|
12
33
|
protected executeAllRules(context: any): void;
|
|
13
34
|
private getExpressionScope;
|
package/lib/Scriptable.js
CHANGED
|
@@ -81,6 +81,11 @@ class Scriptable extends BaseNode_1.BaseNode {
|
|
|
81
81
|
}
|
|
82
82
|
return this._events[eName] || [];
|
|
83
83
|
}
|
|
84
|
+
getState(forRestore = false) {
|
|
85
|
+
const state = super.getState(forRestore);
|
|
86
|
+
state.events = state.events || {};
|
|
87
|
+
return state;
|
|
88
|
+
}
|
|
84
89
|
applyUpdates(updates) {
|
|
85
90
|
if (typeof updates === 'object') {
|
|
86
91
|
if (updates !== null) {
|
|
@@ -16,7 +16,16 @@ class EventNode {
|
|
|
16
16
|
return that !== null && that !== undefined && this._node == that._node && this._event.type == that._event.type;
|
|
17
17
|
}
|
|
18
18
|
toString() {
|
|
19
|
-
|
|
19
|
+
var _a;
|
|
20
|
+
const base = this._node.id + '__' + this._event.type;
|
|
21
|
+
if (this._event.type === 'change' && ((_a = this._event.payload) === null || _a === void 0 ? void 0 : _a.changes)) {
|
|
22
|
+
const sig = this._event.payload.changes
|
|
23
|
+
.map((c) => c.propertyName)
|
|
24
|
+
.sort()
|
|
25
|
+
.join(',');
|
|
26
|
+
return base + '__' + sig;
|
|
27
|
+
}
|
|
28
|
+
return base;
|
|
20
29
|
}
|
|
21
30
|
valueOf() {
|
|
22
31
|
return this.toString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.169",
|
|
4
4
|
"description": "Core Module for Forms Runtime",
|
|
5
5
|
"author": "Adobe Systems",
|
|
6
6
|
"license": "Adobe Proprietary",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@adobe/json-formula": "0.1.50",
|
|
40
|
-
"@aemforms/af-formatters": "^0.22.
|
|
40
|
+
"@aemforms/af-formatters": "^0.22.169"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|