@aemforms/af-core 0.22.155 → 0.22.157
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 +30 -9
- package/lib/Container.js +8 -8
- package/lib/utils/FormUtils.js +22 -1
- package/package.json +2 -2
package/esm/afb-runtime.js
CHANGED
|
@@ -1038,7 +1038,28 @@ const replaceTemplatePlaceholders = (str, values = []) => {
|
|
|
1038
1038
|
});
|
|
1039
1039
|
};
|
|
1040
1040
|
const sanitizeName = (name) => {
|
|
1041
|
-
const nameRegex = /^[A-Za-
|
|
1041
|
+
const nameRegex = /^[A-Za-z0-9_$][A-Za-z0-9_.[\]]*$/;
|
|
1042
|
+
if (name.includes('.')) {
|
|
1043
|
+
const parts = name.split('.');
|
|
1044
|
+
const sanitizedParts = parts.map((part) => {
|
|
1045
|
+
if (part.includes('[')) {
|
|
1046
|
+
const bracketIndex = part.indexOf('[');
|
|
1047
|
+
const namePart = part.substring(0, bracketIndex);
|
|
1048
|
+
const bracketPart = part.substring(bracketIndex);
|
|
1049
|
+
if (!nameRegex.test(namePart)) {
|
|
1050
|
+
return `"${namePart}"${bracketPart}`;
|
|
1051
|
+
}
|
|
1052
|
+
return part;
|
|
1053
|
+
}
|
|
1054
|
+
else {
|
|
1055
|
+
if (!nameRegex.test(part)) {
|
|
1056
|
+
return `"${part}"`;
|
|
1057
|
+
}
|
|
1058
|
+
return part;
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
return sanitizedParts.join('.');
|
|
1062
|
+
}
|
|
1042
1063
|
if (!nameRegex.test(name)) {
|
|
1043
1064
|
return `"${name}"`;
|
|
1044
1065
|
}
|
|
@@ -2509,18 +2530,11 @@ class Container extends Scriptable {
|
|
|
2509
2530
|
return;
|
|
2510
2531
|
}
|
|
2511
2532
|
this._data = dataGroup;
|
|
2512
|
-
|
|
2533
|
+
this.syncDataAndFormModel(dataGroup);
|
|
2513
2534
|
const newLength = this.items.length;
|
|
2514
|
-
result.added.forEach((item) => {
|
|
2515
|
-
this.notifyDependents(propertyChange('items', item.getState(), null));
|
|
2516
|
-
item.dispatch(new Initialize());
|
|
2517
|
-
});
|
|
2518
2535
|
for (let i = 0; i < newLength; i += 1) {
|
|
2519
2536
|
this._children[i].dispatch(new ExecuteRule());
|
|
2520
2537
|
}
|
|
2521
|
-
result.removed.forEach((item) => {
|
|
2522
|
-
this.notifyDependents(propertyChange('items', null, item.getState()));
|
|
2523
|
-
});
|
|
2524
2538
|
}
|
|
2525
2539
|
else if (typeof this._data === 'undefined') {
|
|
2526
2540
|
console.warn(`Data node is null, hence importData did not work for panel "${this.name}". Check if parent has a dataRef set to null.`);
|
|
@@ -2550,6 +2564,13 @@ class Container extends Scriptable {
|
|
|
2550
2564
|
result.removed.push(this._children.pop());
|
|
2551
2565
|
}
|
|
2552
2566
|
}
|
|
2567
|
+
result.added.forEach((item) => {
|
|
2568
|
+
this.notifyDependents(propertyChange('items', item.getState(), null));
|
|
2569
|
+
item.dispatch(new Initialize());
|
|
2570
|
+
});
|
|
2571
|
+
result.removed.forEach((item) => {
|
|
2572
|
+
this.notifyDependents(propertyChange('items', null, item.getState()));
|
|
2573
|
+
});
|
|
2553
2574
|
}
|
|
2554
2575
|
this._children.forEach(x => {
|
|
2555
2576
|
let dataModel = x.bindToDataModel(contextualDataModel);
|
package/lib/Container.js
CHANGED
|
@@ -367,18 +367,11 @@ class Container extends Scriptable_1.default {
|
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
369
|
this._data = dataGroup;
|
|
370
|
-
|
|
370
|
+
this.syncDataAndFormModel(dataGroup);
|
|
371
371
|
const newLength = this.items.length;
|
|
372
|
-
result.added.forEach((item) => {
|
|
373
|
-
this.notifyDependents((0, Events_1.propertyChange)('items', item.getState(), null));
|
|
374
|
-
item.dispatch(new Events_1.Initialize());
|
|
375
|
-
});
|
|
376
372
|
for (let i = 0; i < newLength; i += 1) {
|
|
377
373
|
this._children[i].dispatch(new Events_1.ExecuteRule());
|
|
378
374
|
}
|
|
379
|
-
result.removed.forEach((item) => {
|
|
380
|
-
this.notifyDependents((0, Events_1.propertyChange)('items', null, item.getState()));
|
|
381
|
-
});
|
|
382
375
|
}
|
|
383
376
|
else if (typeof this._data === 'undefined') {
|
|
384
377
|
console.warn(`Data node is null, hence importData did not work for panel "${this.name}". Check if parent has a dataRef set to null.`);
|
|
@@ -408,6 +401,13 @@ class Container extends Scriptable_1.default {
|
|
|
408
401
|
result.removed.push(this._children.pop());
|
|
409
402
|
}
|
|
410
403
|
}
|
|
404
|
+
result.added.forEach((item) => {
|
|
405
|
+
this.notifyDependents((0, Events_1.propertyChange)('items', item.getState(), null));
|
|
406
|
+
item.dispatch(new Events_1.Initialize());
|
|
407
|
+
});
|
|
408
|
+
result.removed.forEach((item) => {
|
|
409
|
+
this.notifyDependents((0, Events_1.propertyChange)('items', null, item.getState()));
|
|
410
|
+
});
|
|
411
411
|
}
|
|
412
412
|
this._children.forEach(x => {
|
|
413
413
|
let dataModel = x.bindToDataModel(contextualDataModel);
|
package/lib/utils/FormUtils.js
CHANGED
|
@@ -286,7 +286,28 @@ const replaceTemplatePlaceholders = (str, values = []) => {
|
|
|
286
286
|
};
|
|
287
287
|
exports.replaceTemplatePlaceholders = replaceTemplatePlaceholders;
|
|
288
288
|
const sanitizeName = (name) => {
|
|
289
|
-
const nameRegex = /^[A-Za-
|
|
289
|
+
const nameRegex = /^[A-Za-z0-9_$][A-Za-z0-9_.[\]]*$/;
|
|
290
|
+
if (name.includes('.')) {
|
|
291
|
+
const parts = name.split('.');
|
|
292
|
+
const sanitizedParts = parts.map((part) => {
|
|
293
|
+
if (part.includes('[')) {
|
|
294
|
+
const bracketIndex = part.indexOf('[');
|
|
295
|
+
const namePart = part.substring(0, bracketIndex);
|
|
296
|
+
const bracketPart = part.substring(bracketIndex);
|
|
297
|
+
if (!nameRegex.test(namePart)) {
|
|
298
|
+
return `"${namePart}"${bracketPart}`;
|
|
299
|
+
}
|
|
300
|
+
return part;
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
if (!nameRegex.test(part)) {
|
|
304
|
+
return `"${part}"`;
|
|
305
|
+
}
|
|
306
|
+
return part;
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
return sanitizedParts.join('.');
|
|
310
|
+
}
|
|
290
311
|
if (!nameRegex.test(name)) {
|
|
291
312
|
return `"${name}"`;
|
|
292
313
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.157",
|
|
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.157"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|