@ember-eui/validated-form 6.5.10 → 6.5.12

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.
@@ -23,7 +23,7 @@ export default class ValidatedFormFieldBase extends Component {
23
23
  }
24
24
 
25
25
  get hasErrorMessages() {
26
- return this._validationErrorMessages?.length;
26
+ return this._validationErrorMessages?.length || this.error?.length > 0;
27
27
  }
28
28
 
29
29
  get isValid() {
@@ -58,8 +58,8 @@ export default class ValidatedFormFieldBase extends Component {
58
58
  return this.args.label || '';
59
59
  }
60
60
 
61
- get errors() {
62
- return this.args.errors || [];
61
+ get error() {
62
+ return this.args.error || [];
63
63
  }
64
64
 
65
65
  get options() {
@@ -67,7 +67,23 @@ export default class ValidatedFormFieldBase extends Component {
67
67
  }
68
68
 
69
69
  get validationErrorMessages() {
70
- return this._validationErrorMessages;
70
+ let error = [];
71
+ if (this.error.length > 0) {
72
+ error.push(...this.error);
73
+ }
74
+
75
+ if (
76
+ this._validationErrorMessages &&
77
+ this._validationErrorMessages.length > 0
78
+ ) {
79
+ error.push(...this._validationErrorMessages);
80
+ }
81
+
82
+ if (error.length === 0) {
83
+ return null;
84
+ }
85
+
86
+ return error;
71
87
  }
72
88
 
73
89
  constructor() {
@@ -40,14 +40,18 @@ export default class ValidatedForm extends Component {
40
40
  }
41
41
 
42
42
  @action
43
- handleSubmit(e) {
43
+ async handleSubmit(e) {
44
44
  e.preventDefault();
45
45
  if (this.isInvalid) {
46
46
  this.childComponents.setEach('isTouched', true);
47
47
  this.args.onInvalid?.();
48
48
  } else {
49
49
  this.childComponents.setEach('isTouched', false);
50
- this.args.onSubmit?.();
50
+ try {
51
+ await this.args.onSubmit?.();
52
+ } catch (e) {
53
+ this.childComponents.setEach('isTouched', true);
54
+ }
51
55
  }
52
56
  }
53
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-eui/validated-form",
3
- "version": "6.5.10",
3
+ "version": "6.5.12",
4
4
  "description": "The default blueprint for ember-cli addons.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -28,7 +28,7 @@
28
28
  "postpack": "ember ts:clean"
29
29
  },
30
30
  "dependencies": {
31
- "@ember-eui/core": "^6.5.10",
31
+ "@ember-eui/core": "^6.5.12",
32
32
  "ember-cli-babel": "^7.26.11",
33
33
  "ember-cli-htmlbars": "^6.0.1",
34
34
  "ember-cli-typescript": "4.2.1",
@@ -115,5 +115,5 @@
115
115
  "volta": {
116
116
  "extends": "../../package.json"
117
117
  },
118
- "gitHead": "f20f34f00bf0ebb9d73bf14bb3e5b649c2760414"
118
+ "gitHead": "f0bc6572bcf7aa7541efdbc2941b94de59468308"
119
119
  }