@aemforms/af-core 0.22.77 → 0.22.78
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 +10 -7
- package/esm/types/src/Field.d.ts +1 -0
- package/lib/Field.d.ts +1 -0
- package/lib/Field.js +17 -7
- package/package.json +2 -2
package/esm/afb-runtime.js
CHANGED
|
@@ -3898,12 +3898,15 @@ class Field extends Scriptable {
|
|
|
3898
3898
|
}
|
|
3899
3899
|
triggerValidationEvent(changes) {
|
|
3900
3900
|
if (changes.validity) {
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3901
|
+
this.#triggerValidationEvent();
|
|
3902
|
+
}
|
|
3903
|
+
}
|
|
3904
|
+
#triggerValidationEvent() {
|
|
3905
|
+
if (this.validity.valid) {
|
|
3906
|
+
this.dispatch(new Valid());
|
|
3907
|
+
}
|
|
3908
|
+
else {
|
|
3909
|
+
this.dispatch(new Invalid());
|
|
3907
3910
|
}
|
|
3908
3911
|
}
|
|
3909
3912
|
validate() {
|
|
@@ -3911,8 +3914,8 @@ class Field extends Scriptable {
|
|
|
3911
3914
|
return [];
|
|
3912
3915
|
}
|
|
3913
3916
|
const changes = this.evaluateConstraints();
|
|
3917
|
+
this.#triggerValidationEvent();
|
|
3914
3918
|
if (changes.validity) {
|
|
3915
|
-
this.triggerValidationEvent(changes);
|
|
3916
3919
|
this.notifyDependents(new Change({ changes: Object.values(changes) }));
|
|
3917
3920
|
}
|
|
3918
3921
|
return this.valid ? [] : [new ValidationError(this.id, [this._jsonModel.errorMessage])];
|
package/esm/types/src/Field.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import Scriptable from './Scriptable';
|
|
|
3
3
|
import DataValue from './data/DataValue';
|
|
4
4
|
import DataGroup from './data/DataGroup';
|
|
5
5
|
declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
6
|
+
#private;
|
|
6
7
|
constructor(params: FieldJson, _options: {
|
|
7
8
|
form: FormModel;
|
|
8
9
|
parent: ContainerModel;
|
package/lib/Field.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import Scriptable from './Scriptable';
|
|
|
3
3
|
import DataValue from './data/DataValue';
|
|
4
4
|
import DataGroup from './data/DataGroup';
|
|
5
5
|
declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
6
|
+
#private;
|
|
6
7
|
constructor(params: FieldJson, _options: {
|
|
7
8
|
form: FormModel;
|
|
8
9
|
parent: ContainerModel;
|
package/lib/Field.js
CHANGED
|
@@ -5,9 +5,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
8
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
15
|
};
|
|
16
|
+
var _Field_instances, _Field_triggerValidationEvent;
|
|
11
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
18
|
const types_1 = require("./types");
|
|
13
19
|
const ValidationUtils_1 = require("./utils/ValidationUtils");
|
|
@@ -23,6 +29,7 @@ const validTypes = ['string', 'number', 'integer', 'boolean', 'file', 'string[]'
|
|
|
23
29
|
class Field extends Scriptable_1.default {
|
|
24
30
|
constructor(params, _options) {
|
|
25
31
|
super(params, _options);
|
|
32
|
+
_Field_instances.add(this);
|
|
26
33
|
this._ruleNodeReference = [];
|
|
27
34
|
if (_options.mode !== 'restore') {
|
|
28
35
|
this._applyDefaults();
|
|
@@ -642,12 +649,7 @@ class Field extends Scriptable_1.default {
|
|
|
642
649
|
}
|
|
643
650
|
triggerValidationEvent(changes) {
|
|
644
651
|
if (changes.validity) {
|
|
645
|
-
|
|
646
|
-
this.dispatch(new Events_1.Valid());
|
|
647
|
-
}
|
|
648
|
-
else {
|
|
649
|
-
this.dispatch(new Events_1.Invalid());
|
|
650
|
-
}
|
|
652
|
+
__classPrivateFieldGet(this, _Field_instances, "m", _Field_triggerValidationEvent).call(this);
|
|
651
653
|
}
|
|
652
654
|
}
|
|
653
655
|
validate() {
|
|
@@ -655,8 +657,8 @@ class Field extends Scriptable_1.default {
|
|
|
655
657
|
return [];
|
|
656
658
|
}
|
|
657
659
|
const changes = this.evaluateConstraints();
|
|
660
|
+
__classPrivateFieldGet(this, _Field_instances, "m", _Field_triggerValidationEvent).call(this);
|
|
658
661
|
if (changes.validity) {
|
|
659
|
-
this.triggerValidationEvent(changes);
|
|
660
662
|
this.notifyDependents(new Events_1.Change({ changes: Object.values(changes) }));
|
|
661
663
|
}
|
|
662
664
|
return this.valid ? [] : [new types_1.ValidationError(this.id, [this._jsonModel.errorMessage])];
|
|
@@ -692,6 +694,14 @@ class Field extends Scriptable_1.default {
|
|
|
692
694
|
}
|
|
693
695
|
}
|
|
694
696
|
}
|
|
697
|
+
_Field_instances = new WeakSet(), _Field_triggerValidationEvent = function _Field_triggerValidationEvent() {
|
|
698
|
+
if (this.validity.valid) {
|
|
699
|
+
this.dispatch(new Events_1.Valid());
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
this.dispatch(new Events_1.Invalid());
|
|
703
|
+
}
|
|
704
|
+
};
|
|
695
705
|
__decorate([
|
|
696
706
|
(0, BaseNode_1.dependencyTracked)(),
|
|
697
707
|
(0, BaseNode_1.exclude)('button', 'image', 'plain-text')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.78",
|
|
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.78"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|