@aemforms/af-core 0.22.162 → 0.22.163
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 +18 -17
- package/lib/Container.js +18 -17
- package/package.json +2 -2
package/esm/afb-runtime.js
CHANGED
|
@@ -2539,25 +2539,26 @@ class Container extends Scriptable {
|
|
|
2539
2539
|
super.dispatch(action);
|
|
2540
2540
|
}
|
|
2541
2541
|
importData(dataModel) {
|
|
2542
|
-
if (typeof this._data
|
|
2543
|
-
const dataGroup = new DataGroup(this._data.$name, dataModel, this._data.$type, this._data.parent);
|
|
2544
|
-
try {
|
|
2545
|
-
this._data.parent?.$addDataNode(dataGroup.$name, dataGroup, true);
|
|
2546
|
-
}
|
|
2547
|
-
catch (e) {
|
|
2548
|
-
this.form.logger.error(`unable to setItems for ${this.qualifiedName} : ${e}`);
|
|
2549
|
-
return;
|
|
2550
|
-
}
|
|
2551
|
-
this._data = dataGroup;
|
|
2552
|
-
this.syncDataAndFormModel(dataGroup);
|
|
2553
|
-
const newLength = this.items.length;
|
|
2554
|
-
for (let i = 0; i < newLength; i += 1) {
|
|
2555
|
-
this._children[i].dispatch(new ExecuteRule());
|
|
2556
|
-
}
|
|
2557
|
-
}
|
|
2558
|
-
else if (typeof this._data === 'undefined') {
|
|
2542
|
+
if (typeof this._data === 'undefined') {
|
|
2559
2543
|
console.warn(`Data node is null, hence importData did not work for panel "${this.name}". Check if parent has a dataRef set to null.`);
|
|
2544
|
+
return;
|
|
2545
|
+
}
|
|
2546
|
+
const isArrayPanel = this.type === 'array' && Array.isArray(dataModel);
|
|
2547
|
+
const isObjectPanel = this.type === 'object' && typeof dataModel === 'object' && dataModel !== null && !Array.isArray(dataModel);
|
|
2548
|
+
if (!isArrayPanel && !isObjectPanel) {
|
|
2549
|
+
return;
|
|
2550
|
+
}
|
|
2551
|
+
const dataGroup = new DataGroup(this._data.$name, dataModel, this._data.$type, this._data.parent);
|
|
2552
|
+
try {
|
|
2553
|
+
this._data.parent?.$addDataNode(dataGroup.$name, dataGroup, true);
|
|
2554
|
+
}
|
|
2555
|
+
catch (e) {
|
|
2556
|
+
this.form.logger.error(`unable to importData for ${this.qualifiedName} : ${e}`);
|
|
2557
|
+
return;
|
|
2560
2558
|
}
|
|
2559
|
+
this._data = dataGroup;
|
|
2560
|
+
this.syncDataAndFormModel(dataGroup);
|
|
2561
|
+
this._children.forEach((child) => child.dispatch(new ExecuteRule()));
|
|
2561
2562
|
}
|
|
2562
2563
|
syncDataAndFormModel(contextualDataModel) {
|
|
2563
2564
|
const result = {
|
package/lib/Container.js
CHANGED
|
@@ -357,25 +357,26 @@ class Container extends Scriptable_1.default {
|
|
|
357
357
|
}
|
|
358
358
|
importData(dataModel) {
|
|
359
359
|
var _a;
|
|
360
|
-
if (typeof this._data
|
|
361
|
-
const dataGroup = new DataGroup_1.default(this._data.$name, dataModel, this._data.$type, this._data.parent);
|
|
362
|
-
try {
|
|
363
|
-
(_a = this._data.parent) === null || _a === void 0 ? void 0 : _a.$addDataNode(dataGroup.$name, dataGroup, true);
|
|
364
|
-
}
|
|
365
|
-
catch (e) {
|
|
366
|
-
this.form.logger.error(`unable to setItems for ${this.qualifiedName} : ${e}`);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
this._data = dataGroup;
|
|
370
|
-
this.syncDataAndFormModel(dataGroup);
|
|
371
|
-
const newLength = this.items.length;
|
|
372
|
-
for (let i = 0; i < newLength; i += 1) {
|
|
373
|
-
this._children[i].dispatch(new Events_1.ExecuteRule());
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
else if (typeof this._data === 'undefined') {
|
|
360
|
+
if (typeof this._data === 'undefined') {
|
|
377
361
|
console.warn(`Data node is null, hence importData did not work for panel "${this.name}". Check if parent has a dataRef set to null.`);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const isArrayPanel = this.type === 'array' && Array.isArray(dataModel);
|
|
365
|
+
const isObjectPanel = this.type === 'object' && typeof dataModel === 'object' && dataModel !== null && !Array.isArray(dataModel);
|
|
366
|
+
if (!isArrayPanel && !isObjectPanel) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const dataGroup = new DataGroup_1.default(this._data.$name, dataModel, this._data.$type, this._data.parent);
|
|
370
|
+
try {
|
|
371
|
+
(_a = this._data.parent) === null || _a === void 0 ? void 0 : _a.$addDataNode(dataGroup.$name, dataGroup, true);
|
|
372
|
+
}
|
|
373
|
+
catch (e) {
|
|
374
|
+
this.form.logger.error(`unable to importData for ${this.qualifiedName} : ${e}`);
|
|
375
|
+
return;
|
|
378
376
|
}
|
|
377
|
+
this._data = dataGroup;
|
|
378
|
+
this.syncDataAndFormModel(dataGroup);
|
|
379
|
+
this._children.forEach((child) => child.dispatch(new Events_1.ExecuteRule()));
|
|
379
380
|
}
|
|
380
381
|
syncDataAndFormModel(contextualDataModel) {
|
|
381
382
|
const result = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.163",
|
|
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.163"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|