@aemforms/af-core 0.22.1 → 0.22.4
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/lib/BaseNode.js +4 -0
- package/lib/Container.js +1 -1
- package/lib/Fieldset.d.ts +2 -0
- package/lib/Fieldset.js +6 -0
- package/lib/types/Json.js +4 -1
- package/lib/utils/TranslationUtils.js +9 -1
- package/package.json +1 -1
package/lib/BaseNode.js
CHANGED
|
@@ -109,6 +109,10 @@ class BaseNode {
|
|
|
109
109
|
//look for property
|
|
110
110
|
if (prop.startsWith('$')) {
|
|
111
111
|
prop = prop.substr(1);
|
|
112
|
+
if (prop === 'parent') {
|
|
113
|
+
return this[prop].getRuleNode();
|
|
114
|
+
}
|
|
115
|
+
//@ts-ignore
|
|
112
116
|
//@todo: create a list of properties that are allowed
|
|
113
117
|
//@ts-ignore
|
|
114
118
|
// return only non functional properties in this object
|
package/lib/Container.js
CHANGED
|
@@ -199,7 +199,7 @@ class Container extends Scriptable_1.default {
|
|
|
199
199
|
*/
|
|
200
200
|
removeItem(action) {
|
|
201
201
|
if (action.type === 'removeItem' && this._itemTemplate != null) {
|
|
202
|
-
const index = action.payload
|
|
202
|
+
const index = typeof action.payload === 'number' ? action.payload : this._children.length - 1;
|
|
203
203
|
const state = this._children[index].getState();
|
|
204
204
|
//@ts-ignore
|
|
205
205
|
if (this._children.length > this._jsonModel.minItems) {
|
package/lib/Fieldset.d.ts
CHANGED
package/lib/Fieldset.js
CHANGED
|
@@ -99,5 +99,11 @@ class Fieldset extends Container_1.default {
|
|
|
99
99
|
get fieldType() {
|
|
100
100
|
return 'panel';
|
|
101
101
|
}
|
|
102
|
+
get enabled() {
|
|
103
|
+
return this._jsonModel.enabled;
|
|
104
|
+
}
|
|
105
|
+
set enabled(e) {
|
|
106
|
+
this._setProperty('enabled', e);
|
|
107
|
+
}
|
|
102
108
|
}
|
|
103
109
|
exports.Fieldset = Fieldset;
|
package/lib/types/Json.js
CHANGED
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.constraintProps = exports.translationProps = void 0;
|
|
11
11
|
/** Constant for all properties which can be translated based on `adaptive form specification` */
|
|
12
|
-
exports.translationProps = ['description', 'placeholder', 'enum', 'enumNames', 'label.value'
|
|
12
|
+
exports.translationProps = ['description', 'placeholder', 'enum', 'enumNames', 'label.value', 'constraintMessages.accept',
|
|
13
|
+
'constraintMessages.enum', 'constraintMessages.exclusiveMinimum', 'constraintMessages.exclusiveMaximum', 'constraintMessages.format', 'constraintMessages.maxFileSize', 'constraintMessages.maxLength',
|
|
14
|
+
'constraintMessages.maximum', 'constraintMessages.maxItems', 'constraintMessages.minLength', 'constraintMessages.minimum', 'constraintMessages.minItems', 'constraintMessages.pattern', 'constraintMessages.required',
|
|
15
|
+
'constraintMessages.step', 'constraintMessages.type', 'constraintMessages.validationExpression'];
|
|
13
16
|
/** Constant for all properties which are constraints based on `adaptive form specification` */
|
|
14
17
|
exports.constraintProps = ['accept', 'enum', 'exclusiveMinimum', 'exclusiveMaximum',
|
|
15
18
|
'format', 'maxFileSize', 'maxLength', 'maximum', 'maxItems',
|
|
@@ -59,7 +59,15 @@ exports.addTranslationId = addTranslationId;
|
|
|
59
59
|
const _createTranslationId = (input, path, transProps) => {
|
|
60
60
|
Object.entries(input).forEach(([key, value]) => {
|
|
61
61
|
if (typeof value == 'object') {
|
|
62
|
-
|
|
62
|
+
if (input instanceof Array) {
|
|
63
|
+
if (value && 'name' in value) {
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
_createTranslationId(value, `${path === '' ? path : path + exports.TRANSLATION_TOKEN}${value.name}`, transProps);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
_createTranslationId(value, ((key === 'items') ? path : `${path === '' ? path : path + exports.TRANSLATION_TOKEN}${key}`), transProps);
|
|
70
|
+
}
|
|
63
71
|
}
|
|
64
72
|
else {
|
|
65
73
|
// set it only if either of type or fieldType properties is present
|