@frontile/changeset-form 0.12.4 → 0.13.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.
@@ -5,6 +5,7 @@
5
5
  @label={{@label}}
6
6
  @hint={{@hint}}
7
7
  @hasError={{@hasError}}
8
+ @showError={{@showError}}
8
9
  @hasSubmitted={{@hasSubmitted}}
9
10
  @containerClass={{@containerClass}}
10
11
  @size={{@size}}
@@ -10,6 +10,7 @@
10
10
  @label={{@label}}
11
11
  @hint={{@hint}}
12
12
  @hasError={{@hasError}}
13
+ @showError={{@showError}}
13
14
  @containerClass={{@containerClass}}
14
15
  @size={{@size}}
15
16
  @onChange={{@onChange}}
@@ -7,6 +7,7 @@
7
7
  @hint={{@hint}}
8
8
  @hasSubmitted={{@hasSubmitted}}
9
9
  @hasError={{@hasError}}
10
+ @showError={{@showError}}
10
11
  @containerClass={{@containerClass}}
11
12
  @size={{@size}}
12
13
  @isInline={{@isInline}}
@@ -10,6 +10,7 @@
10
10
  @label={{@label}}
11
11
  @hint={{@hint}}
12
12
  @hasError={{@hasError}}
13
+ @showError={{@showError}}
13
14
  @containerClass={{@containerClass}}
14
15
  @size={{@size}}
15
16
 
@@ -10,6 +10,7 @@
10
10
  @label={{@label}}
11
11
  @hint={{@hint}}
12
12
  @hasError={{@hasError}}
13
+ @showError={{@showError}}
13
14
  @containerClass={{@containerClass}}
14
15
  @size={{@size}}
15
16
  @onChange={{@onChange}}
@@ -6,15 +6,15 @@
6
6
  <ChangesetForm::Context @changeset={{@changeset}} as |Form|>
7
7
  {{yield
8
8
  (hash
9
- Input=(component Form.Input hasSubmitted=this.hasSubmitted)
10
- Textarea=(component Form.Textarea hasSubmitted=this.hasSubmitted)
11
- Select=(component Form.Select hasSubmitted=this.hasSubmitted)
12
- Checkbox=(component Form.Checkbox hasSubmitted=this.hasSubmitted)
9
+ Input=(component Form.Input hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors)
10
+ Textarea=(component Form.Textarea hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors)
11
+ Select=(component Form.Select hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors)
12
+ Checkbox=(component Form.Checkbox hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors)
13
13
  CheckboxGroup=(component
14
- Form.CheckboxGroup hasSubmitted=this.hasSubmitted
14
+ Form.CheckboxGroup hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors
15
15
  )
16
- Radio=(component Form.Radio hasSubmitted=this.hasSubmitted)
17
- RadioGroup=(component Form.RadioGroup hasSubmitted=this.hasSubmitted)
16
+ Radio=(component Form.Radio hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors)
17
+ RadioGroup=(component Form.RadioGroup hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors)
18
18
  )
19
19
  @changeset
20
20
  (hash hasSubmitted=this.hasSubmitted)
@@ -3,6 +3,7 @@ import { tracked } from '@glimmer/tracking';
3
3
  import { BufferedChangeset } from 'ember-changeset/types';
4
4
  import { action } from '@ember/object';
5
5
  import { assert } from '@ember/debug';
6
+ import { next } from '@ember/runloop';
6
7
 
7
8
  interface ChangesetFormArgs {
8
9
  /** Changeset Object */
@@ -14,6 +15,18 @@ interface ChangesetFormArgs {
14
15
  * */
15
16
  runExecuteInsteadOfSave?: boolean;
16
17
 
18
+ /**
19
+ * Always show errors if there are any
20
+ * @defaultValue false
21
+ */
22
+ alwaysShowErrors?: boolean;
23
+
24
+ /**
25
+ * Validate the changeset on initialization
26
+ * @defaultValue false
27
+ */
28
+ validateOnInit?: boolean;
29
+
17
30
  /** Callback exeuted when from `onsubmit` event is triggered */
18
31
  onSubmit?: (data: unknown, event: Event) => void;
19
32
 
@@ -30,6 +43,12 @@ export default class ChangesetForm extends Component<ChangesetFormArgs> {
30
43
  '@changeset must be defined on <ChangesetForm> component',
31
44
  this.args.changeset
32
45
  );
46
+
47
+ if (this.args.validateOnInit) {
48
+ next(() => {
49
+ this.args.changeset.validate();
50
+ });
51
+ }
33
52
  }
34
53
 
35
54
  @action
@@ -8,6 +8,16 @@ interface ChangesetFormArgs {
8
8
  * @defaultValue false
9
9
  * */
10
10
  runExecuteInsteadOfSave?: boolean;
11
+ /**
12
+ * Always show errors if there are any
13
+ * @defaultValue false
14
+ */
15
+ alwaysShowErrors?: boolean;
16
+ /**
17
+ * Validate the changeset on initialization
18
+ * @defaultValue false
19
+ */
20
+ validateOnInit?: boolean;
11
21
  /** Callback exeuted when from `onsubmit` event is triggered */
12
22
  onSubmit?: (data: unknown, event: Event) => void;
13
23
  /** Callback exeuted when from `onreset` event is triggered */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontile/changeset-form",
3
- "version": "0.12.4",
3
+ "version": "0.13.0",
4
4
  "description": "Component Library for Ember Octane apps: ChangesetForm",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -22,49 +22,60 @@
22
22
  "postpack": "ember ts:clean"
23
23
  },
24
24
  "dependencies": {
25
- "@frontile/forms": "^0.12.4",
25
+ "@frontile/forms": "^0.13.0",
26
26
  "ember-changeset": "^3.15.0",
27
27
  "ember-changeset-validations": "^3.16.0",
28
- "ember-cli-babel": "^7.26.6",
29
- "ember-cli-htmlbars": "^5.7.1",
28
+ "ember-cli-babel": "^7.26.11",
29
+ "ember-cli-htmlbars": "^6.0.1",
30
30
  "ember-cli-typescript": "^4.2.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@babel/core": "^7.15.8",
34
34
  "@ember/optional-features": "^2.0.0",
35
- "@ember/test-helpers": "^2.5.0",
36
- "@embroider/test-setup": "^0.45.0",
37
- "@frontile/core": "^0.12.4",
35
+ "@ember/test-helpers": "^2.6.0",
36
+ "@embroider/test-setup": "^1.0.0",
37
+ "@frontile/core": "^0.13.0",
38
38
  "@glimmer/component": "^1.0.4",
39
39
  "@glimmer/tracking": "^1.0.4",
40
- "@types/ember": "^3.16.5",
41
- "@types/ember-qunit": "^3.4.14",
42
- "@types/ember-resolver": "^5.0.10",
43
- "@types/ember__test-helpers": "^2.0.2",
44
- "@types/qunit": "^2.11.2",
40
+ "@types/ember-qunit": "^5.0.0",
41
+ "@types/ember-resolver": "^5.0.11",
42
+ "@types/ember__application": "^4.0.0",
43
+ "@types/ember__array": "^4.0.1",
44
+ "@types/ember__component": "^4.0.1",
45
+ "@types/ember__debug": "^4.0.0",
46
+ "@types/ember__error": "^4.0.0",
47
+ "@types/ember__object": "^4.0.0",
48
+ "@types/ember__routing": "^4.0.2",
49
+ "@types/ember__runloop": "^4.0.0",
50
+ "@types/ember__service": "^4.0.0",
51
+ "@types/ember__string": "^3.0.9",
52
+ "@types/ember__template": "^4.0.0",
53
+ "@types/ember__test": "^4.0.0",
54
+ "@types/ember__test-helpers": "^2.6.1",
55
+ "@types/htmlbars-inline-precompile": "^3.0.0",
56
+ "@types/qunit": "^2.11.3",
45
57
  "@types/rsvp": "^4.0.4",
46
- "autoprefixer": "^10.3.7",
58
+ "autoprefixer": "^10.4.2",
47
59
  "broccoli-asset-rev": "^3.0.0",
48
- "ember-auto-import": "^2.2.0",
49
- "ember-cli": "~3.28.1",
60
+ "ember-auto-import": "^2.4.0",
61
+ "ember-cli": "~4.1.1",
50
62
  "ember-cli-dependency-checker": "^3.2.0",
51
63
  "ember-cli-inject-live-reload": "^2.1.0",
52
- "ember-cli-postcss": "^7.0.2",
64
+ "ember-cli-postcss": "^8.0.0",
53
65
  "ember-cli-typescript-blueprints": "^3.0.0",
54
66
  "ember-cli-uglify": "^3.0.0",
55
67
  "ember-disable-prototype-extensions": "^1.1.3",
56
68
  "ember-load-initializers": "^2.1.2",
57
- "ember-maybe-import-regenerator": "^1.0.0",
58
69
  "ember-qunit": "^5.1.5",
59
70
  "ember-resolver": "^8.0.3",
60
- "ember-source": "~3.28.1",
61
- "ember-try": "^1.4.0",
71
+ "ember-source": "~4.1.0",
72
+ "ember-try": "^2.0.0",
62
73
  "loader.js": "^4.7.0",
63
74
  "qunit": "^2.17.2",
64
75
  "qunit-dom": "^2.0.0",
65
76
  "tailwindcss": "^2.2.16",
66
- "typescript": "^4.4.3",
67
- "webpack": "^5.58.0"
77
+ "typescript": "^4.5.5",
78
+ "webpack": "^5.67.0"
68
79
  },
69
80
  "engines": {
70
81
  "node": ">= 10.*"
@@ -78,5 +89,5 @@
78
89
  "ember-addon": {
79
90
  "configPath": "tests/dummy/config"
80
91
  },
81
- "gitHead": "223dcc591866f108f1b95174f4fc5a188096e489"
92
+ "gitHead": "ad5dc7420f12b0cb0af4daa52cd51bf5bbc189be"
82
93
  }