@projectcaluma/ember-form 11.0.0-beta.19 → 11.0.0-beta.21
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +26 -0
- package/addon/components/cf-field/input/checkbox.hbs +1 -1
- package/addon/components/cf-field/input/radio.hbs +1 -1
- package/addon/components/cf-field/input/table.hbs +1 -0
- package/addon/components/cf-field/label.hbs +4 -2
- package/addon/components/cf-field.js +6 -3
- package/addon/gql/queries/document-forms.graphql +1 -1
- package/addon/gql/queries/dynamic-options.graphql +1 -1
- package/addon/lib/field.js +23 -24
- package/package.json +13 -13
- package/translations/de.yaml +1 -1
- package/translations/en.yaml +1 -1
- package/translations/fr.yaml +1 -1
- package/addon/components/cf-field/label.js +0 -11
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.21](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.20...@projectcaluma/ember-form-v11.0.0-beta.21) (2022-06-09)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* **caluma:** use new filter syntax of caluma ([7a00c03](https://github.com/projectcaluma/ember-caluma/commit/7a00c03a103933d9e48dd88adb7382441a298742))
|
7
|
+
|
8
|
+
|
9
|
+
### BREAKING CHANGES
|
10
|
+
|
11
|
+
* **caluma:** `ember-caluma` now requires Caluma version >=
|
12
|
+
8.0.0-beta.6
|
13
|
+
|
14
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.20](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.19...@projectcaluma/ember-form-v11.0.0-beta.20) (2022-06-09)
|
15
|
+
|
16
|
+
|
17
|
+
### Bug Fixes
|
18
|
+
|
19
|
+
* **form:** improve validation of choice and multiple choice fields ([e828fad](https://github.com/projectcaluma/ember-caluma/commit/e828fad9557fd521ca9eec63af74f8cee12e3910))
|
20
|
+
* **form:** pass context to table row form ([af1031a](https://github.com/projectcaluma/ember-caluma/commit/af1031ae9e8138a404cd043199709025092da882))
|
21
|
+
|
22
|
+
|
23
|
+
### Features
|
24
|
+
|
25
|
+
* **form:** add option to bypass the timeout when saving a field ([a2ba306](https://github.com/projectcaluma/ember-caluma/commit/a2ba306306f90a2d2279b34550507241f0987961))
|
26
|
+
|
1
27
|
# [@projectcaluma/ember-form-v11.0.0-beta.19](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.18...@projectcaluma/ember-form-v11.0.0-beta.19) (2022-05-09)
|
2
28
|
|
3
29
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
name={{@field.pk}}
|
11
11
|
value={{option.slug}}
|
12
12
|
checked={{eq option.slug @field.answer.value}}
|
13
|
-
disabled={{@disabled}}
|
13
|
+
disabled={{or option.disabled @disabled}}
|
14
14
|
{{on "change" (fn @onSave option.slug)}}
|
15
15
|
/>
|
16
16
|
{{#if (and option.disabled (not @disabled))}}
|
@@ -1,11 +1,13 @@
|
|
1
|
-
<label class="uk-form-label" for={{@field.pk}}>
|
1
|
+
<label class="uk-form-label" for={{@field.pk}} ...attributes>
|
2
2
|
<span class="uk-text-bold">
|
3
3
|
{{@field.question.raw.label}}
|
4
4
|
</span>
|
5
5
|
|
6
|
-
{{#if
|
6
|
+
{{#if (and (not @field.question.isCalculated) @field.optional)}}
|
7
7
|
<span
|
8
8
|
class="uk-margin-small-left uk-text-muted uk-text-lowercase uk-text-normal"
|
9
9
|
>({{t "caluma.form.optional"}})</span>
|
10
10
|
{{/if}}
|
11
|
+
|
12
|
+
{{yield}}
|
11
13
|
</label>
|
@@ -65,15 +65,18 @@ export default class CfFieldComponent extends Component {
|
|
65
65
|
* reduce the amount of saved values when changed rapidly.
|
66
66
|
*
|
67
67
|
* @method save
|
68
|
-
* @param {String|Number|String[]} value
|
68
|
+
* @param {String|Number|String[]} value The new value to save to the field
|
69
|
+
* @param {Boolean} bypassTimeout Whether to bypass the timeout
|
69
70
|
*/
|
70
71
|
@restartableTask
|
71
|
-
*save(value) {
|
72
|
+
*save(value, bypassTimeout = false) {
|
72
73
|
/* istanbul ignore next */
|
73
74
|
if (macroCondition(isTesting())) {
|
74
75
|
// no timeout
|
75
76
|
} else {
|
76
|
-
|
77
|
+
if (!bypassTimeout) {
|
78
|
+
yield timeout(500);
|
79
|
+
}
|
77
80
|
}
|
78
81
|
|
79
82
|
if (this.args.field.answer) {
|
package/addon/lib/field.js
CHANGED
@@ -582,10 +582,10 @@ export default class Field extends Base {
|
|
582
582
|
@cached
|
583
583
|
get errors() {
|
584
584
|
return this._errors.map(({ type, context, value }) => {
|
585
|
-
return this.intl.t(
|
586
|
-
|
587
|
-
|
588
|
-
);
|
585
|
+
return this.intl.t(`caluma.form.validation.${type}`, {
|
586
|
+
...context,
|
587
|
+
value,
|
588
|
+
});
|
589
589
|
});
|
590
590
|
}
|
591
591
|
|
@@ -742,10 +742,7 @@ export default class Field extends Base {
|
|
742
742
|
* @private
|
743
743
|
*/
|
744
744
|
_validateChoiceQuestion() {
|
745
|
-
return
|
746
|
-
allowBlank: true,
|
747
|
-
in: (this.options || []).map(({ slug }) => slug),
|
748
|
-
});
|
745
|
+
return this._validateOption(this.answer.value, true);
|
749
746
|
}
|
750
747
|
|
751
748
|
/**
|
@@ -757,15 +754,9 @@ export default class Field extends Base {
|
|
757
754
|
* @private
|
758
755
|
*/
|
759
756
|
_validateMultipleChoiceQuestion() {
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
}
|
764
|
-
return value.map((value) =>
|
765
|
-
validate("inclusion", value, {
|
766
|
-
in: (this.options || []).map(({ slug }) => slug),
|
767
|
-
})
|
768
|
-
);
|
757
|
+
return this.answer.value
|
758
|
+
? this.answer.value.map((value) => this._validateOption(value))
|
759
|
+
: true;
|
769
760
|
}
|
770
761
|
|
771
762
|
/**
|
@@ -779,9 +770,7 @@ export default class Field extends Base {
|
|
779
770
|
async _validateDynamicChoiceQuestion() {
|
780
771
|
await this.question.dynamicOptions;
|
781
772
|
|
782
|
-
return
|
783
|
-
in: (this.options || []).map(({ slug }) => slug),
|
784
|
-
});
|
773
|
+
return this._validateOption(this.answer.value);
|
785
774
|
}
|
786
775
|
|
787
776
|
/**
|
@@ -801,10 +790,20 @@ export default class Field extends Base {
|
|
801
790
|
|
802
791
|
await this.question.dynamicOptions;
|
803
792
|
|
804
|
-
return value.map((value) =>
|
805
|
-
|
806
|
-
|
807
|
-
|
793
|
+
return value.map((value) => this._validateOption(value));
|
794
|
+
}
|
795
|
+
|
796
|
+
_validateOption(value, allowBlank = false) {
|
797
|
+
const label = Array.isArray(this.selected)
|
798
|
+
? this.selected.find((selected) => selected.slug === value)?.label
|
799
|
+
: this.selected?.label;
|
800
|
+
|
801
|
+
return validate("inclusion", value, {
|
802
|
+
in: (this.options || [])
|
803
|
+
.filter((option) => !option.disabled)
|
804
|
+
.map(({ slug }) => slug),
|
805
|
+
allowBlank,
|
806
|
+
label: label ?? value,
|
808
807
|
});
|
809
808
|
}
|
810
809
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@projectcaluma/ember-form",
|
3
|
-
"version": "11.0.0-beta.
|
3
|
+
"version": "11.0.0-beta.21",
|
4
4
|
"description": "Ember addon for rendering Caluma forms.",
|
5
5
|
"keywords": [
|
6
6
|
"ember-addon"
|
@@ -15,13 +15,13 @@
|
|
15
15
|
},
|
16
16
|
"dependencies": {
|
17
17
|
"@ember/string": "^3.0.0",
|
18
|
-
"@embroider/macros": "^1.
|
19
|
-
"@embroider/util": "^1.
|
18
|
+
"@embroider/macros": "^1.7.1",
|
19
|
+
"@embroider/util": "^1.7.1",
|
20
20
|
"@glimmer/component": "^1.1.2",
|
21
21
|
"@glimmer/tracking": "^1.1.2",
|
22
22
|
"@projectcaluma/ember-core": "^11.0.0-beta.7",
|
23
23
|
"ember-apollo-client": "^4.0.2",
|
24
|
-
"ember-auto-import": "^2.4.
|
24
|
+
"ember-auto-import": "^2.4.2",
|
25
25
|
"ember-autoresize-modifier": "^0.5.0",
|
26
26
|
"ember-cli-babel": "^7.26.11",
|
27
27
|
"ember-cli-htmlbars": "^6.0.1",
|
@@ -31,10 +31,10 @@
|
|
31
31
|
"ember-fetch": "^8.1.1",
|
32
32
|
"ember-in-viewport": "^4.0.2",
|
33
33
|
"ember-intl": "^5.7.2",
|
34
|
-
"ember-math-helpers": "^2.18.
|
34
|
+
"ember-math-helpers": "^2.18.2",
|
35
35
|
"ember-pikaday": "^4.0.0",
|
36
36
|
"ember-power-select": "^5.0.4",
|
37
|
-
"ember-resources": "^4.
|
37
|
+
"ember-resources": "^4.8.2",
|
38
38
|
"ember-uikit": "^5.1.3",
|
39
39
|
"ember-validators": "^4.1.2",
|
40
40
|
"graphql": "^15.8.0",
|
@@ -45,10 +45,10 @@
|
|
45
45
|
},
|
46
46
|
"devDependencies": {
|
47
47
|
"@ember/optional-features": "2.0.0",
|
48
|
-
"@ember/test-helpers": "2.
|
49
|
-
"@embroider/test-setup": "1.
|
50
|
-
"@faker-js/faker": "
|
51
|
-
"@projectcaluma/ember-testing": "11.0.0-beta.
|
48
|
+
"@ember/test-helpers": "2.8.1",
|
49
|
+
"@embroider/test-setup": "1.7.1",
|
50
|
+
"@faker-js/faker": "7.2.0",
|
51
|
+
"@projectcaluma/ember-testing": "11.0.0-beta.9",
|
52
52
|
"@projectcaluma/ember-workflow": "^11.0.0-beta.7",
|
53
53
|
"broccoli-asset-rev": "3.0.0",
|
54
54
|
"ember-cli": "3.28.5",
|
@@ -68,15 +68,15 @@
|
|
68
68
|
"ember-source-channel-url": "3.0.0",
|
69
69
|
"ember-try": "2.0.0",
|
70
70
|
"loader.js": "4.7.0",
|
71
|
-
"miragejs": "0.1.
|
71
|
+
"miragejs": "0.1.45",
|
72
72
|
"npm-run-all": "4.1.5",
|
73
73
|
"qunit": "2.19.1",
|
74
74
|
"qunit-dom": "2.0.0",
|
75
75
|
"uuid": "8.3.2",
|
76
|
-
"webpack": "5.
|
76
|
+
"webpack": "5.73.0"
|
77
77
|
},
|
78
78
|
"peerDependencies": {
|
79
|
-
"@projectcaluma/ember-workflow": "^11.0.0-beta.
|
79
|
+
"@projectcaluma/ember-workflow": "^11.0.0-beta.7"
|
80
80
|
},
|
81
81
|
"peerDependenciesMeta": {
|
82
82
|
"@projectcaluma/ember-workflow": {
|
package/translations/de.yaml
CHANGED
@@ -46,7 +46,7 @@ caluma:
|
|
46
46
|
greaterThanOrEqualTo: "Die Eingabe in diesem Feld darf nicht kleiner als {gte} sein"
|
47
47
|
lessThanOrEqualTo: "Die Eingabe in diesem Feld darf nicht grösser als {lte} sein"
|
48
48
|
notAnInteger: "Bitte geben Sie eine ganze Zahl ein"
|
49
|
-
inclusion: "
|
49
|
+
inclusion: '"{label}" ist kein gültiger Wert für dieses Feld'
|
50
50
|
deleteFailed: "Beim Löschen ist ein Fehler aufgetreten."
|
51
51
|
uploadFailed: "Beim Hochladen ist ein Fehler aufgetreten."
|
52
52
|
format: "{errorMsg}"
|
package/translations/en.yaml
CHANGED
@@ -46,7 +46,7 @@ caluma:
|
|
46
46
|
greaterThanOrEqualTo: "The value of this field must be greater than or equal to {gte}"
|
47
47
|
lessThanOrEqualTo: "The value of this field must be less than or equal to {lte}"
|
48
48
|
notAnInteger: "The value of this field must be an integer"
|
49
|
-
inclusion: "
|
49
|
+
inclusion: '"{label}" is not a valid value for this field'
|
50
50
|
deleteFailed: "An error occured during deletion."
|
51
51
|
uploadFailed: "An error occured during upload."
|
52
52
|
format: "{errorMsg}"
|
package/translations/fr.yaml
CHANGED
@@ -46,7 +46,7 @@ caluma:
|
|
46
46
|
greaterThanOrEqualTo: "La valeur indiquée dans ce champ ne doit pas être inférieure à {gte} "
|
47
47
|
lessThanOrEqualTo: "L'entrée dans ce champ ne doit pas être supérieure à {lte} "
|
48
48
|
notAnInteger: "Veuillez entrer un nombre entier"
|
49
|
-
inclusion: "
|
49
|
+
inclusion: '"{label}" n''est pas une valeur valide pour ce champ'
|
50
50
|
deleteFailed: "Une erreur est survenue lors de la suppression."
|
51
51
|
uploadFailed: "Une erreur s'est produite pendant le téléchargement."
|
52
52
|
format: "{errorMsg}"
|