ember-validated-form 5.1.1 → 5.3.0
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 +38 -0
- package/README.md +1 -1
- package/addon/components/validated-button.js +20 -0
- package/addon/components/validated-form.hbs +1 -0
- package/addon/components/validated-form.js +15 -0
- package/addon/components/validated-input/-themes/uikit/render.hbs +8 -0
- package/addon/components/validated-input/render.hbs +8 -0
- package/addon/components/validated-input/types/-themes/bootstrap/checkbox-group.hbs +2 -2
- package/addon/components/validated-input/types/-themes/bootstrap/checkbox.hbs +2 -2
- package/addon/components/validated-input/types/-themes/bootstrap/radio-group.hbs +2 -2
- package/addon/components/validated-input/types/-themes/uikit/checkbox-group.hbs +2 -2
- package/addon/components/validated-input/types/-themes/uikit/checkbox.hbs +1 -1
- package/addon/components/validated-input/types/-themes/uikit/radio-group.hbs +2 -2
- package/addon/components/validated-input/types/checkbox-group.hbs +1 -0
- package/addon/components/validated-input/types/checkbox.hbs +1 -0
- package/addon/components/validated-input/types/input.hbs +1 -1
- package/addon/components/validated-input/types/radio-group.hbs +1 -0
- package/addon/components/validated-input/types/select.hbs +8 -44
- package/addon/components/validated-input/types/select.js +34 -7
- package/addon/components/validated-input/types/textarea.hbs +1 -1
- package/addon/components/validated-input.hbs +2 -0
- package/blueprints/ember-validated-form/index.js +1 -0
- package/package.json +30 -42
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -9
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/deploy.yml +0 -28
- package/.github/workflows/release.yml +0 -25
- package/.github/workflows/test.yml +0 -84
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
# [5.3.0](https://github.com/adfinis-sygroup/ember-validated-form/compare/v5.2.2...v5.3.0) (2022-02-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* addon docs root url ([7d8151f](https://github.com/adfinis-sygroup/ember-validated-form/commit/7d8151fa9d854cdf9595f27347fa57652e58ef10))
|
|
7
|
+
* **blueprint:** add ember-truth-helpers to default blueprint ([a401589](https://github.com/adfinis-sygroup/ember-validated-form/commit/a401589dab6d013f5d659865927919346655295d))
|
|
8
|
+
* **deps:** move required deps to dependencies instead of devDependencies ([46629ce](https://github.com/adfinis-sygroup/ember-validated-form/commit/46629ceb48210bbc58898c299a9388ce7fa816ec))
|
|
9
|
+
* new link to docs ([c1073e5](https://github.com/adfinis-sygroup/ember-validated-form/commit/c1073e55e3a916ed393e33bcf4a045124c320967))
|
|
10
|
+
* **select:** pass prompt argument down to input component ([64a1377](https://github.com/adfinis-sygroup/ember-validated-form/commit/64a1377d64618fa880b332f8a693e1c7f1a321f7))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* pass attributes to input components ([dc0417d](https://github.com/adfinis-sygroup/ember-validated-form/commit/dc0417d125fe4c20cb59b76531ae4f7391258259))
|
|
16
|
+
|
|
17
|
+
## [5.2.2](https://github.com/adfinis-sygroup/ember-validated-form/compare/v5.2.1...v5.2.2) (2022-02-10)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* select support for plain options ([#747](https://github.com/adfinis-sygroup/ember-validated-form/issues/747)) ([a58e26d](https://github.com/adfinis-sygroup/ember-validated-form/commit/a58e26ddcd46ec5328c3bb5351bafc7781eacdbd))
|
|
23
|
+
|
|
24
|
+
## [5.2.1](https://github.com/adfinis-sygroup/ember-validated-form/compare/v5.2.0...v5.2.1) (2022-02-09)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* 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))
|
|
30
|
+
|
|
31
|
+
# [5.2.0](https://github.com/adfinis-sygroup/ember-validated-form/compare/v5.1.1...v5.2.0) (2022-02-03)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* scroll first invalid element into view ([#733](https://github.com/adfinis-sygroup/ember-validated-form/issues/733)) ([ae7c8b2](https://github.com/adfinis-sygroup/ember-validated-form/commit/ae7c8b2b160307646adf90cd09a091effa549238))
|
|
37
|
+
* **validated-button:** add `triggerValidations` flag ([#721](https://github.com/adfinis-sygroup/ember-validated-form/issues/721)) ([765f5f4](https://github.com/adfinis-sygroup/ember-validated-form/commit/765f5f40c9d2e5ccfca7129fb701ff3bb0ed661e))
|
|
38
|
+
|
|
1
39
|
# [5.0.0](https://github.com/adfinis-sygroup/ember-validated-form/compare/v4.1.0...v5.0.0) (2021-10-08)
|
|
2
40
|
|
|
3
41
|
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Easily create forms with client side validations.
|
|
|
9
9
|
|
|
10
10
|

|
|
11
11
|
|
|
12
|
-
Want to try it yourself? [View the docs here.](https://adfinis
|
|
12
|
+
Want to try it yourself? [View the docs here.](https://docs.adfinis.com/ember-validated-form/)
|
|
13
13
|
|
|
14
14
|
# Contributing
|
|
15
15
|
|
|
@@ -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
|
}
|
|
@@ -25,6 +34,11 @@ export default class ValidatedButtonComponent extends Component {
|
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
event.preventDefault();
|
|
37
|
+
|
|
38
|
+
if (this.args.triggerValidations) {
|
|
39
|
+
this.args.markAsDirty();
|
|
40
|
+
}
|
|
41
|
+
|
|
28
42
|
const model = this.args.model;
|
|
29
43
|
|
|
30
44
|
if (!model || !model.validate) {
|
|
@@ -34,6 +48,12 @@ export default class ValidatedButtonComponent extends Component {
|
|
|
34
48
|
|
|
35
49
|
await model.validate();
|
|
36
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
|
+
|
|
37
57
|
if (model.get("isInvalid")) {
|
|
38
58
|
this.runCallback(ON_INVALID_CLICK);
|
|
39
59
|
} else {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getOwner } from "@ember/application";
|
|
1
2
|
import { action } from "@ember/object";
|
|
2
3
|
import { scheduleOnce } from "@ember/runloop";
|
|
3
4
|
import Component from "@glimmer/component";
|
|
@@ -14,6 +15,10 @@ export default class ValidatedFormComponent extends Component {
|
|
|
14
15
|
|
|
15
16
|
constructor(...args) {
|
|
16
17
|
super(...args);
|
|
18
|
+
this.config =
|
|
19
|
+
getOwner(this).resolveRegistration("config:environment")[
|
|
20
|
+
"ember-validated-form"
|
|
21
|
+
];
|
|
17
22
|
|
|
18
23
|
if (this.args.model && this.args.model.validate) {
|
|
19
24
|
scheduleOnce("actions", this, "validateModel", this.args.model);
|
|
@@ -24,6 +29,11 @@ export default class ValidatedFormComponent extends Component {
|
|
|
24
29
|
model.validate();
|
|
25
30
|
}
|
|
26
31
|
|
|
32
|
+
@action
|
|
33
|
+
markAsDirty() {
|
|
34
|
+
this.submitted = true;
|
|
35
|
+
}
|
|
36
|
+
|
|
27
37
|
@action
|
|
28
38
|
async submit(event) {
|
|
29
39
|
event.preventDefault();
|
|
@@ -39,6 +49,11 @@ export default class ValidatedFormComponent extends Component {
|
|
|
39
49
|
await model.validate();
|
|
40
50
|
|
|
41
51
|
if (model.get("isInvalid")) {
|
|
52
|
+
if (this.config?.features?.scrollErrorIntoView && model.errors[0]?.key) {
|
|
53
|
+
document
|
|
54
|
+
.querySelector(`[name=${model.errors[0].key}]`)
|
|
55
|
+
?.scrollIntoView({ behavior: "smooth" });
|
|
56
|
+
}
|
|
42
57
|
this.runCallback(PROP_ON_INVALID_SUBMIT);
|
|
43
58
|
} else {
|
|
44
59
|
this.runCallback(PROP_ON_SUBMIT);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
{{! template-lint-disable no-autofocus-attribute }}
|
|
1
2
|
<div class={{this.class}}>
|
|
2
3
|
{{#if (not-eq @type "checkbox")}}
|
|
3
4
|
<@labelComponent />
|
|
@@ -18,10 +19,12 @@
|
|
|
18
19
|
@options={{@options}}
|
|
19
20
|
@optionTargetPath={{@optionTargetPath}}
|
|
20
21
|
@optionValuePath={{@optionValuePath}}
|
|
22
|
+
@prompt={{@prompt}}
|
|
21
23
|
@promptIsSelectable={{@promptIsSelectable}}
|
|
22
24
|
@setDirty={{@setDirty}}
|
|
23
25
|
@update={{@update}}
|
|
24
26
|
@value={{@value}}
|
|
27
|
+
...attributes
|
|
25
28
|
/>
|
|
26
29
|
{{/let}}
|
|
27
30
|
{{else if (or (eq @type "radioGroup") (eq @type "radio-group"))}}
|
|
@@ -36,6 +39,7 @@
|
|
|
36
39
|
@setDirty={{@setDirty}}
|
|
37
40
|
@update={{@update}}
|
|
38
41
|
@value={{@value}}
|
|
42
|
+
...attributes
|
|
39
43
|
/>
|
|
40
44
|
{{/let}}
|
|
41
45
|
{{else if (or (eq @type "checkboxGroup") (eq @type "checkbox-group"))}}
|
|
@@ -50,6 +54,7 @@
|
|
|
50
54
|
@setDirty={{@setDirty}}
|
|
51
55
|
@update={{@update}}
|
|
52
56
|
@value={{@value}}
|
|
57
|
+
...attributes
|
|
53
58
|
/>
|
|
54
59
|
{{/let}}
|
|
55
60
|
{{else if (eq @type "checkbox")}}
|
|
@@ -65,6 +70,7 @@
|
|
|
65
70
|
@setDirty={{@setDirty}}
|
|
66
71
|
@update={{@update}}
|
|
67
72
|
@value={{@value}}
|
|
73
|
+
...attributes
|
|
68
74
|
/>
|
|
69
75
|
{{/let}}
|
|
70
76
|
{{else if (eq @type "textarea")}}
|
|
@@ -83,6 +89,7 @@
|
|
|
83
89
|
@isValid={{@isValid}}
|
|
84
90
|
@setDirty={{@setDirty}}
|
|
85
91
|
@update={{@update}}
|
|
92
|
+
...attributes
|
|
86
93
|
/>
|
|
87
94
|
{{/let}}
|
|
88
95
|
{{else}}
|
|
@@ -100,6 +107,7 @@
|
|
|
100
107
|
@isValid={{@isValid}}
|
|
101
108
|
@setDirty={{@setDirty}}
|
|
102
109
|
@update={{@update}}
|
|
110
|
+
...attributes
|
|
103
111
|
/>
|
|
104
112
|
{{/let}}
|
|
105
113
|
{{/if}}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
{{! template-lint-disable no-autofocus-attribute }}
|
|
1
2
|
<div class={{this.class}}>
|
|
2
3
|
{{#if (not-eq @type "checkbox")}}
|
|
3
4
|
<@labelComponent />
|
|
@@ -17,10 +18,12 @@
|
|
|
17
18
|
@options={{@options}}
|
|
18
19
|
@optionTargetPath={{@optionTargetPath}}
|
|
19
20
|
@optionValuePath={{@optionValuePath}}
|
|
21
|
+
@prompt={{@prompt}}
|
|
20
22
|
@promptIsSelectable={{@promptIsSelectable}}
|
|
21
23
|
@setDirty={{@setDirty}}
|
|
22
24
|
@update={{@update}}
|
|
23
25
|
@value={{@value}}
|
|
26
|
+
...attributes
|
|
24
27
|
/>
|
|
25
28
|
{{/let}}
|
|
26
29
|
{{else if (or (eq @type "radioGroup") (eq @type "radio-group"))}}
|
|
@@ -35,6 +38,7 @@
|
|
|
35
38
|
@setDirty={{@setDirty}}
|
|
36
39
|
@update={{@update}}
|
|
37
40
|
@value={{@value}}
|
|
41
|
+
...attributes
|
|
38
42
|
/>
|
|
39
43
|
{{/let}}
|
|
40
44
|
{{else if (or (eq @type "checkboxGroup") (eq @type "checkbox-group"))}}
|
|
@@ -49,6 +53,7 @@
|
|
|
49
53
|
@setDirty={{@setDirty}}
|
|
50
54
|
@update={{@update}}
|
|
51
55
|
@value={{@value}}
|
|
56
|
+
...attributes
|
|
52
57
|
/>
|
|
53
58
|
{{/let}}
|
|
54
59
|
{{else if (eq @type "checkbox")}}
|
|
@@ -64,6 +69,7 @@
|
|
|
64
69
|
@setDirty={{@setDirty}}
|
|
65
70
|
@update={{@update}}
|
|
66
71
|
@value={{@value}}
|
|
72
|
+
...attributes
|
|
67
73
|
/>
|
|
68
74
|
{{/let}}
|
|
69
75
|
{{else if (eq @type "textarea")}}
|
|
@@ -82,6 +88,7 @@
|
|
|
82
88
|
@isValid={{@isValid}}
|
|
83
89
|
@setDirty={{@setDirty}}
|
|
84
90
|
@update={{@update}}
|
|
91
|
+
...attributes
|
|
85
92
|
/>
|
|
86
93
|
{{/let}}
|
|
87
94
|
{{else}}
|
|
@@ -99,6 +106,7 @@
|
|
|
99
106
|
@isValid={{@isValid}}
|
|
100
107
|
@setDirty={{@setDirty}}
|
|
101
108
|
@update={{@update}}
|
|
109
|
+
...attributes
|
|
102
110
|
/>
|
|
103
111
|
{{/let}}
|
|
104
112
|
{{/if}}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<input
|
|
4
4
|
type="checkbox"
|
|
5
5
|
class="custom-control-input
|
|
6
|
-
{{if @isValid
|
|
7
|
-
{{if @isInvalid
|
|
6
|
+
{{if @isValid 'is-valid'}}
|
|
7
|
+
{{if @isInvalid 'is-invalid'}}"
|
|
8
8
|
checked={{includes option.key @value}}
|
|
9
9
|
name={{@name}}
|
|
10
10
|
id="{{@inputId}}-{{i}}"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<div class="custom-control custom-checkbox">
|
|
2
2
|
<input
|
|
3
3
|
class="custom-control-input
|
|
4
|
-
{{if @isValid
|
|
5
|
-
{{if @isInvalid
|
|
4
|
+
{{if @isValid 'is-valid'}}
|
|
5
|
+
{{if @isInvalid 'is-invalid'}}"
|
|
6
6
|
type="checkbox"
|
|
7
7
|
name={{@name}}
|
|
8
8
|
id={{@inputId}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{{#let (component @labelComponent) as |Label|}}
|
|
2
2
|
<Label
|
|
3
|
-
class="{{if @isValid
|
|
3
|
+
class="{{if @isValid 'uk-text-success'}} {{if @isInvalid 'uk-text-danger'}}"
|
|
4
4
|
>
|
|
5
5
|
<input
|
|
6
6
|
class="uk-checkbox uk-margin-small-right"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<select
|
|
2
2
|
class={{this.class}}
|
|
3
|
-
...attributes
|
|
4
3
|
name={{@name}}
|
|
5
4
|
id={{@inpudId}}
|
|
6
5
|
disabled={{@disabled}}
|
|
7
6
|
multiple={{@multiple}}
|
|
8
7
|
{{on "change" this.onUpdate}}
|
|
9
8
|
{{on "blur" this.onBlur}}
|
|
9
|
+
...attributes
|
|
10
10
|
>
|
|
11
11
|
{{#if (or @prompt @includeBlank)}}
|
|
12
12
|
<option
|
|
@@ -20,53 +20,17 @@
|
|
|
20
20
|
{{#each this.optionGroups as |optionGroup|}}
|
|
21
21
|
<optgroup label={{optionGroup.groupName}}>
|
|
22
22
|
{{#each optionGroup.options as |opt|}}
|
|
23
|
-
{{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(get opt (or @optionValuePath @optionTargetPath))
|
|
27
|
-
opt
|
|
28
|
-
)
|
|
29
|
-
as |optionValue|
|
|
30
|
-
}}
|
|
31
|
-
<option
|
|
32
|
-
selected={{eq optionValue @value}}
|
|
33
|
-
value={{optionValue}}
|
|
34
|
-
>{{#if @optionLabelPath}}
|
|
35
|
-
{{get opt @optionLabelPath}}
|
|
36
|
-
{{else if @optionValuePath}}
|
|
37
|
-
{{get opt @optionValuePath}}
|
|
38
|
-
{{else if @optionTargetPath}}
|
|
39
|
-
{{get opt @optionTargetPath}}
|
|
40
|
-
{{else}}
|
|
41
|
-
{{opt}}
|
|
42
|
-
{{/if}}
|
|
43
|
-
</option>
|
|
44
|
-
{{/let}}
|
|
23
|
+
<option selected={{eq opt.id @value}} value={{opt.id}}>
|
|
24
|
+
{{opt.label}}
|
|
25
|
+
</option>
|
|
45
26
|
{{/each}}
|
|
46
27
|
</optgroup>
|
|
47
28
|
{{/each}}
|
|
48
29
|
{{else}}
|
|
49
|
-
{{#each
|
|
50
|
-
{{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
(get opt (or @optionValuePath @optionTargetPath))
|
|
54
|
-
opt
|
|
55
|
-
)
|
|
56
|
-
as |optionValue|
|
|
57
|
-
}}
|
|
58
|
-
<option selected={{eq optionValue @value}} value={{optionValue}}>{{#if
|
|
59
|
-
@optionLabelPath
|
|
60
|
-
}}
|
|
61
|
-
{{get opt @optionLabelPath}}
|
|
62
|
-
{{else if @optionValuePath}}
|
|
63
|
-
{{get opt @optionValuePath}}
|
|
64
|
-
{{else if @optionTargetPath}}
|
|
65
|
-
{{get opt @optionTargetPath}}
|
|
66
|
-
{{else}}
|
|
67
|
-
{{opt}}
|
|
68
|
-
{{/if}}</option>
|
|
69
|
-
{{/let}}
|
|
30
|
+
{{#each this.normalizedOptions as |opt|}}
|
|
31
|
+
<option selected={{eq opt.id @value}} value={{opt.id}}>
|
|
32
|
+
{{opt.label}}
|
|
33
|
+
</option>
|
|
70
34
|
{{/each}}
|
|
71
35
|
{{/if}}
|
|
72
36
|
</select>
|
|
@@ -23,6 +23,7 @@ export default class SelectComponent extends Component {
|
|
|
23
23
|
until: "6.0.0",
|
|
24
24
|
since: "5.1.0",
|
|
25
25
|
url: "https://github.com/adfinis-sygroup/ember-validated-form/releases/tag/v5.1.0",
|
|
26
|
+
for: "ember-validated-form",
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
29
|
}
|
|
@@ -38,6 +39,23 @@ export default class SelectComponent extends Component {
|
|
|
38
39
|
return this.hasPreGroupedOptions || this.args.groupLabelPath;
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
get normalizedOptions() {
|
|
43
|
+
// normalize options to common data structure, only for rendering
|
|
44
|
+
return this.args.options.map((opt) => this.normalize(opt));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
normalize(option) {
|
|
48
|
+
if (typeof option !== "object") {
|
|
49
|
+
return { id: option, label: option };
|
|
50
|
+
}
|
|
51
|
+
const valuePath = this.args.optionValuePath ?? this.args.optionTargetPath;
|
|
52
|
+
const labelPath = this.args.optionLabelPath;
|
|
53
|
+
return {
|
|
54
|
+
id: valuePath ? option[valuePath] : option.id,
|
|
55
|
+
label: labelPath ? option[labelPath] : option.label,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
41
59
|
get optionGroups() {
|
|
42
60
|
const groupLabelPath = this.args.groupLabelPath;
|
|
43
61
|
if (!groupLabelPath) {
|
|
@@ -60,7 +78,7 @@ export default class SelectComponent extends Component {
|
|
|
60
78
|
groups.pushObject(group);
|
|
61
79
|
}
|
|
62
80
|
|
|
63
|
-
group.options.pushObject(item);
|
|
81
|
+
group.options.pushObject(this.normalize(item));
|
|
64
82
|
} else {
|
|
65
83
|
groups.pushObject(item);
|
|
66
84
|
}
|
|
@@ -72,6 +90,17 @@ export default class SelectComponent extends Component {
|
|
|
72
90
|
findOption(target) {
|
|
73
91
|
const targetPath = this.args.optionTargetPath;
|
|
74
92
|
const valuePath = this.args.optionValuePath || targetPath;
|
|
93
|
+
|
|
94
|
+
const getValue = (item) => {
|
|
95
|
+
if (valuePath) {
|
|
96
|
+
return String(item[valuePath]);
|
|
97
|
+
}
|
|
98
|
+
if (typeof item === "object") {
|
|
99
|
+
return String(item.id);
|
|
100
|
+
}
|
|
101
|
+
return String(item);
|
|
102
|
+
};
|
|
103
|
+
|
|
75
104
|
let options = this.args.options;
|
|
76
105
|
|
|
77
106
|
//flatten pre grouped options
|
|
@@ -85,9 +114,9 @@ export default class SelectComponent extends Component {
|
|
|
85
114
|
.call(target.options, (option) => option.selected)
|
|
86
115
|
.map((option) => option.value);
|
|
87
116
|
|
|
88
|
-
const foundOptions = options.filter((item) =>
|
|
89
|
-
selectedValues.includes(
|
|
90
|
-
);
|
|
117
|
+
const foundOptions = options.filter((item) => {
|
|
118
|
+
return selectedValues.includes(getValue(item));
|
|
119
|
+
});
|
|
91
120
|
if (targetPath) {
|
|
92
121
|
return foundOptions.map((item) => item[targetPath]);
|
|
93
122
|
}
|
|
@@ -95,9 +124,7 @@ export default class SelectComponent extends Component {
|
|
|
95
124
|
}
|
|
96
125
|
|
|
97
126
|
//single select
|
|
98
|
-
const foundOption = options.find(
|
|
99
|
-
(item) => `${valuePath ? item[valuePath] : item.value}` === target.value
|
|
100
|
-
);
|
|
127
|
+
const foundOption = options.find((item) => getValue(item) === target.value);
|
|
101
128
|
if (targetPath) {
|
|
102
129
|
return foundOption[targetPath];
|
|
103
130
|
}
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
@isInvalid={{this.isInvalid}}
|
|
49
49
|
@placeholder={{@placeholder}}
|
|
50
50
|
@class={{@class}}
|
|
51
|
+
@prompt={{@prompt}}
|
|
51
52
|
@promptIsSelectable={{@promptIsSelectable}}
|
|
52
53
|
@optionLabelPath={{@optionLabelPath}}
|
|
53
54
|
@optionValuePath={{@optionValuePath}}
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
(and this.showValidity this.errors)
|
|
70
71
|
(component this.errorComponent errors=this.errors)
|
|
71
72
|
}}
|
|
73
|
+
...attributes
|
|
72
74
|
/>
|
|
73
75
|
{{/let}}
|
|
74
76
|
{{/if}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-validated-form",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Easily create forms with client-side validations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"directories": {
|
|
15
15
|
"test": "tests"
|
|
16
16
|
},
|
|
17
|
-
"homepage": "https://adfinis
|
|
17
|
+
"homepage": "https://docs.adfinis.com/ember-validated-form",
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/adfinis-sygroup/ember-validated-form/issues"
|
|
20
20
|
},
|
|
@@ -33,74 +33,62 @@
|
|
|
33
33
|
"prepare": "husky install"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"ember-
|
|
36
|
+
"@glimmer/component": "^1.0.4",
|
|
37
|
+
"@glimmer/tracking": "^1.0.4",
|
|
38
|
+
"ember-auto-import": "^2.4.0",
|
|
39
|
+
"ember-changeset": "^4.0.0-beta.5",
|
|
40
|
+
"ember-changeset-validations": "^4.0.0-beta.3",
|
|
41
|
+
"ember-cli-babel": "^7.26.11",
|
|
42
|
+
"ember-cli-htmlbars": "^6.0.1",
|
|
39
43
|
"ember-truth-helpers": "^3.0.0"
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
42
46
|
"@adfinis-sygroup/eslint-config": "1.5.0",
|
|
43
|
-
"@adfinis-sygroup/semantic-release-config": "3.
|
|
44
|
-
"@babel/core": "7.16.7",
|
|
45
|
-
"@babel/helper-create-regexp-features-plugin": "^7.16.7",
|
|
46
|
-
"@babel/helper-environment-visitor": "^7.16.5",
|
|
47
|
-
"@babel/plugin-proposal-decorators": "^7.16.7",
|
|
48
|
-
"@babel/plugin-transform-modules-amd": "^7.16.7",
|
|
49
|
-
"@babel/preset-env": "^7.16.7",
|
|
47
|
+
"@adfinis-sygroup/semantic-release-config": "3.4.0",
|
|
50
48
|
"@ember/optional-features": "2.0.0",
|
|
51
49
|
"@ember/test-helpers": "2.6.0",
|
|
52
|
-
"@embroider/test-setup": "
|
|
53
|
-
"@fortawesome/ember-fontawesome": "0.2
|
|
54
|
-
"@fortawesome/free-solid-svg-icons": "
|
|
55
|
-
"@glimmer/component": "1.0.4",
|
|
56
|
-
"@glimmer/tracking": "1.0.4",
|
|
50
|
+
"@embroider/test-setup": "1.2.0",
|
|
51
|
+
"@fortawesome/ember-fontawesome": "0.3.2",
|
|
52
|
+
"@fortawesome/free-solid-svg-icons": "6.0.0",
|
|
57
53
|
"babel-eslint": "10.1.0",
|
|
58
54
|
"broccoli-asset-rev": "3.0.0",
|
|
59
|
-
"ember-
|
|
60
|
-
"ember-
|
|
61
|
-
"ember-cli": "3.28.1",
|
|
62
|
-
"ember-cli-addon-docs": "4.2.1",
|
|
55
|
+
"ember-cli": "4.1.1",
|
|
56
|
+
"ember-cli-addon-docs": "ember-learn/ember-cli-addon-docs#667701d60650cf7af51611dbff9abf1879776421",
|
|
63
57
|
"ember-cli-dependency-checker": "3.2.0",
|
|
64
58
|
"ember-cli-deploy": "1.0.2",
|
|
65
59
|
"ember-cli-deploy-build": "2.0.0",
|
|
66
60
|
"ember-cli-deploy-git": "1.3.4",
|
|
67
61
|
"ember-cli-deploy-git-ci": "1.0.1",
|
|
68
62
|
"ember-cli-inject-live-reload": "2.1.0",
|
|
69
|
-
"ember-cli-release": "1.0.0-beta.2",
|
|
70
63
|
"ember-cli-sri": "2.1.1",
|
|
71
64
|
"ember-cli-terser": "4.0.2",
|
|
72
65
|
"ember-cli-test-loader": "3.0.0",
|
|
73
|
-
"ember-concurrency": "2.2.
|
|
74
|
-
"ember-data": "
|
|
66
|
+
"ember-concurrency": "2.2.1",
|
|
67
|
+
"ember-data": "4.1.0",
|
|
75
68
|
"ember-disable-prototype-extensions": "1.1.3",
|
|
76
69
|
"ember-load-initializers": "2.1.2",
|
|
77
|
-
"ember-maybe-import-regenerator": "1.0.0",
|
|
78
|
-
"ember-power-select": "4.1.6",
|
|
79
70
|
"ember-qunit": "5.1.5",
|
|
80
71
|
"ember-resolver": "8.0.3",
|
|
81
|
-
"ember-source": "
|
|
72
|
+
"ember-source": "4.2.0",
|
|
82
73
|
"ember-source-channel-url": "3.0.0",
|
|
83
|
-
"ember-template-lint": "
|
|
84
|
-
"ember-template-lint-plugin-prettier": "
|
|
85
|
-
"ember-try": "
|
|
74
|
+
"ember-template-lint": "4.1.0",
|
|
75
|
+
"ember-template-lint-plugin-prettier": "4.0.0",
|
|
76
|
+
"ember-try": "2.0.0",
|
|
86
77
|
"eslint": "7.32.0",
|
|
87
|
-
"eslint-config-prettier": "8.
|
|
88
|
-
"eslint-plugin-ember": "10.5.
|
|
89
|
-
"eslint-plugin-import": "2.25.
|
|
78
|
+
"eslint-config-prettier": "8.4.0",
|
|
79
|
+
"eslint-plugin-ember": "10.5.9",
|
|
80
|
+
"eslint-plugin-import": "2.25.4",
|
|
90
81
|
"eslint-plugin-node": "11.1.0",
|
|
91
82
|
"eslint-plugin-prettier": "4.0.0",
|
|
92
|
-
"eslint-plugin-qunit": "
|
|
83
|
+
"eslint-plugin-qunit": "7.2.0",
|
|
93
84
|
"husky": "7.0.4",
|
|
94
|
-
"lint-staged": "
|
|
85
|
+
"lint-staged": "12.3.4",
|
|
95
86
|
"loader.js": "4.7.0",
|
|
96
87
|
"npm-run-all": "4.1.5",
|
|
97
|
-
"prettier": "2.
|
|
98
|
-
"qunit": "2.
|
|
88
|
+
"prettier": "2.5.1",
|
|
89
|
+
"qunit": "2.18.0",
|
|
99
90
|
"qunit-dom": "2.0.0",
|
|
100
|
-
"webpack": "5.
|
|
101
|
-
},
|
|
102
|
-
"resolutions": {
|
|
103
|
-
"graceful-fs": ">=4.2.0"
|
|
91
|
+
"webpack": "5.69.1"
|
|
104
92
|
},
|
|
105
93
|
"engines": {
|
|
106
94
|
"node": "12.* || 14.* || >= 16"
|
|
@@ -110,7 +98,7 @@
|
|
|
110
98
|
},
|
|
111
99
|
"ember-addon": {
|
|
112
100
|
"configPath": "tests/dummy/config",
|
|
113
|
-
"demoURL": "https://adfinis
|
|
101
|
+
"demoURL": "https://docs.adfinis.com/ember-validated-form"
|
|
114
102
|
},
|
|
115
103
|
"release": {
|
|
116
104
|
"extends": "@adfinis-sygroup/semantic-release-config"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report
|
|
3
|
-
about: Template for bug reports
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
--
|
|
7
|
-
If possible, please consider creating a basic reproduction of your issue with Ember Twiddle. You can use this twiddle as a starting point:
|
|
8
|
-
|
|
9
|
-
https://ember-twiddle.com/3691a8576c35ff149bfc26a564ec5437
|
package/.github/dependabot.yml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
name: Deploy
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
release:
|
|
8
|
-
types: [published]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
deploy:
|
|
12
|
-
name: Deploy
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v2
|
|
16
|
-
- uses: actions/setup-node@v2
|
|
17
|
-
with:
|
|
18
|
-
node-version: 14
|
|
19
|
-
|
|
20
|
-
- name: Install Dependencies
|
|
21
|
-
run: yarn install
|
|
22
|
-
|
|
23
|
-
- name: Deploy to Github Pages
|
|
24
|
-
run: yarn ember deploy production
|
|
25
|
-
env:
|
|
26
|
-
CI: true
|
|
27
|
-
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
|
28
|
-
ADDON_DOCS_UPDATE_LATEST: true
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on: workflow_dispatch
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
release:
|
|
7
|
-
name: Release
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
steps:
|
|
10
|
-
- uses: actions/checkout@v2
|
|
11
|
-
with:
|
|
12
|
-
fetch-depth: 0
|
|
13
|
-
persist-credentials: false
|
|
14
|
-
- uses: actions/setup-node@v2
|
|
15
|
-
with:
|
|
16
|
-
node-version: 14
|
|
17
|
-
|
|
18
|
-
- name: Install dependencies
|
|
19
|
-
run: yarn install
|
|
20
|
-
|
|
21
|
-
- name: Release on NPM
|
|
22
|
-
env:
|
|
23
|
-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
24
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
25
|
-
run: yarn semantic-release
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
name: Test
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
pull_request:
|
|
8
|
-
branches:
|
|
9
|
-
- main
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
lint:
|
|
13
|
-
name: Lint
|
|
14
|
-
runs-on: [ubuntu-latest]
|
|
15
|
-
|
|
16
|
-
strategy:
|
|
17
|
-
matrix:
|
|
18
|
-
target: [js, hbs]
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v2
|
|
22
|
-
- uses: actions/setup-node@v2
|
|
23
|
-
with:
|
|
24
|
-
node-version: 14
|
|
25
|
-
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: yarn install
|
|
28
|
-
|
|
29
|
-
- name: Lint ${{ matrix.target }}
|
|
30
|
-
run: yarn lint:${{ matrix.target }}
|
|
31
|
-
|
|
32
|
-
test:
|
|
33
|
-
name: Tests
|
|
34
|
-
needs: [lint]
|
|
35
|
-
runs-on: [ubuntu-latest]
|
|
36
|
-
|
|
37
|
-
steps:
|
|
38
|
-
- uses: actions/checkout@v2
|
|
39
|
-
- uses: actions/setup-node@v2
|
|
40
|
-
with:
|
|
41
|
-
node-version: 14
|
|
42
|
-
|
|
43
|
-
- name: Install dependencies (no lockfile)
|
|
44
|
-
run: yarn install --no-lockfile
|
|
45
|
-
|
|
46
|
-
- name: Run tests (floating dependencies)
|
|
47
|
-
run: yarn test:ember
|
|
48
|
-
|
|
49
|
-
- name: Install dependencies
|
|
50
|
-
run: yarn install
|
|
51
|
-
|
|
52
|
-
- name: Run tests
|
|
53
|
-
run: yarn test:ember
|
|
54
|
-
env:
|
|
55
|
-
COVERAGE: true
|
|
56
|
-
|
|
57
|
-
- name: Upload coverage report to Codecov
|
|
58
|
-
uses: codecov/codecov-action@v1
|
|
59
|
-
with:
|
|
60
|
-
file: ./coverage/lcov.info
|
|
61
|
-
|
|
62
|
-
try-one:
|
|
63
|
-
name: Additional Tests
|
|
64
|
-
needs: [test]
|
|
65
|
-
runs-on: [ubuntu-latest]
|
|
66
|
-
|
|
67
|
-
strategy:
|
|
68
|
-
matrix:
|
|
69
|
-
scenario:
|
|
70
|
-
- ember-lts-3.24
|
|
71
|
-
- ember-lts-3.28
|
|
72
|
-
- ember-release
|
|
73
|
-
|
|
74
|
-
steps:
|
|
75
|
-
- uses: actions/checkout@v2
|
|
76
|
-
- uses: actions/setup-node@v2
|
|
77
|
-
with:
|
|
78
|
-
node-version: 14
|
|
79
|
-
|
|
80
|
-
- name: Install dependencies
|
|
81
|
-
run: yarn install
|
|
82
|
-
|
|
83
|
-
- name: Run tests
|
|
84
|
-
run: yarn ember try:one ${{ matrix.scenario }}
|