ember-validated-form 5.2.0 → 5.2.1
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [5.2.1](https://github.com/adfinis-sygroup/ember-validated-form/compare/v5.2.0...v5.2.1) (2022-02-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* respect scrollErrorIntoView for validated buttons as well ([#743](https://github.com/adfinis-sygroup/ember-validated-form/issues/743)) ([fd6be2a](https://github.com/adfinis-sygroup/ember-validated-form/commit/fd6be2a49c5f947bfcf5eb3f7ab61a23ac00064a))
|
|
7
|
+
|
|
1
8
|
# [5.2.0](https://github.com/adfinis-sygroup/ember-validated-form/compare/v5.1.1...v5.2.0) (2022-02-03)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getOwner } from "@ember/application";
|
|
1
2
|
import { action } from "@ember/object";
|
|
2
3
|
import Component from "@glimmer/component";
|
|
3
4
|
import { tracked } from "@glimmer/tracking";
|
|
@@ -12,6 +13,14 @@ export default class ValidatedButtonComponent extends Component {
|
|
|
12
13
|
|
|
13
14
|
@tracked _loading;
|
|
14
15
|
|
|
16
|
+
constructor(...args) {
|
|
17
|
+
super(...args);
|
|
18
|
+
this.config =
|
|
19
|
+
getOwner(this).resolveRegistration("config:environment")[
|
|
20
|
+
"ember-validated-form"
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
get loading() {
|
|
16
25
|
return this.args.loading || this._loading;
|
|
17
26
|
}
|
|
@@ -39,6 +48,12 @@ export default class ValidatedButtonComponent extends Component {
|
|
|
39
48
|
|
|
40
49
|
await model.validate();
|
|
41
50
|
|
|
51
|
+
if (this.config?.features?.scrollErrorIntoView && model.errors[0]?.key) {
|
|
52
|
+
document
|
|
53
|
+
.querySelector(`[name=${model.errors[0].key}]`)
|
|
54
|
+
?.scrollIntoView({ behavior: "smooth" });
|
|
55
|
+
}
|
|
56
|
+
|
|
42
57
|
if (model.get("isInvalid")) {
|
|
43
58
|
this.runCallback(ON_INVALID_CLICK);
|
|
44
59
|
} else {
|
|
@@ -52,7 +52,7 @@ export default class ValidatedFormComponent extends Component {
|
|
|
52
52
|
if (this.config?.features?.scrollErrorIntoView && model.errors[0]?.key) {
|
|
53
53
|
document
|
|
54
54
|
.querySelector(`[name=${model.errors[0].key}]`)
|
|
55
|
-
?.scrollIntoView();
|
|
55
|
+
?.scrollIntoView({ behavior: "smooth" });
|
|
56
56
|
}
|
|
57
57
|
this.runCallback(PROP_ON_INVALID_SUBMIT);
|
|
58
58
|
} else {
|