@projectcaluma/ember-form 14.3.0 → 14.3.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/addon/lib/document.js +2 -2
- package/addon/lib/field.js +13 -6
- package/package.json +5 -5
package/addon/lib/document.js
CHANGED
@@ -6,9 +6,9 @@ import { cached } from "tracked-toolbox";
|
|
6
6
|
|
7
7
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
8
8
|
import {
|
9
|
+
flatten,
|
9
10
|
intersects,
|
10
11
|
mapby,
|
11
|
-
flatten,
|
12
12
|
} from "@projectcaluma/ember-core/utils/jexl";
|
13
13
|
import Base from "@projectcaluma/ember-form/lib/base";
|
14
14
|
|
@@ -280,7 +280,7 @@ export default class Document extends Base {
|
|
280
280
|
}
|
281
281
|
|
282
282
|
if (field.hidden || [undefined, null].includes(field.value)) {
|
283
|
-
return
|
283
|
+
return defaultValue ?? (field.question.isMultipleChoice ? [] : null);
|
284
284
|
}
|
285
285
|
|
286
286
|
if (field.question.isTable) {
|
package/addon/lib/field.js
CHANGED
@@ -6,7 +6,7 @@ import { camelize } from "@ember/string";
|
|
6
6
|
import { isEmpty } from "@ember/utils";
|
7
7
|
import { tracked } from "@glimmer/tracking";
|
8
8
|
import { queryManager } from "ember-apollo-client";
|
9
|
-
import {
|
9
|
+
import { dropTask, lastValue, restartableTask } from "ember-concurrency";
|
10
10
|
import { validate } from "ember-validators";
|
11
11
|
import isEqual from "lodash.isequal";
|
12
12
|
import { cached } from "tracked-toolbox";
|
@@ -50,14 +50,21 @@ const MUTATION_MAP = {
|
|
50
50
|
TableAnswer: saveDocumentTableAnswerMutation,
|
51
51
|
};
|
52
52
|
|
53
|
-
const
|
53
|
+
const fieldIsHidden = (field) => {
|
54
|
+
return field.hidden;
|
55
|
+
};
|
56
|
+
|
57
|
+
const fieldIsEmpty = (field) => {
|
54
58
|
return (
|
55
|
-
field.
|
56
|
-
(
|
57
|
-
(field.answer.value === null || field.answer.value === undefined))
|
59
|
+
!field.question.isTable &&
|
60
|
+
(field.answer.value === null || field.answer.value === undefined)
|
58
61
|
);
|
59
62
|
};
|
60
63
|
|
64
|
+
const fieldIsHiddenOrEmpty = (field) => {
|
65
|
+
return fieldIsHidden(field) || fieldIsEmpty(field);
|
66
|
+
};
|
67
|
+
|
61
68
|
/**
|
62
69
|
* An object which represents a combination of a question and an answer.
|
63
70
|
*
|
@@ -521,7 +528,7 @@ export default class Field extends Base {
|
|
521
528
|
if (
|
522
529
|
this.fieldset.field?.hidden ||
|
523
530
|
(this.hiddenDependencies.length &&
|
524
|
-
this.hiddenDependencies.every(
|
531
|
+
this.hiddenDependencies.every(fieldIsHidden))
|
525
532
|
) {
|
526
533
|
return true;
|
527
534
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@projectcaluma/ember-form",
|
3
|
-
"version": "14.3.
|
3
|
+
"version": "14.3.1",
|
4
4
|
"description": "Ember addon for rendering Caluma forms.",
|
5
5
|
"keywords": [
|
6
6
|
"ember-addon"
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"luxon": "^3.5.0",
|
42
42
|
"reactiveweb": "^1.3.0",
|
43
43
|
"tracked-toolbox": "^2.0.0",
|
44
|
-
"@projectcaluma/ember-core": "^14.3.
|
44
|
+
"@projectcaluma/ember-core": "^14.3.1"
|
45
45
|
},
|
46
46
|
"devDependencies": {
|
47
47
|
"@ember/optional-features": "2.2.0",
|
@@ -72,12 +72,12 @@
|
|
72
72
|
"uikit": "3.23.7",
|
73
73
|
"uuid": "11.1.0",
|
74
74
|
"webpack": "5.99.8",
|
75
|
-
"@projectcaluma/ember-testing": "14.3.
|
76
|
-
"@projectcaluma/ember-workflow": "14.3.
|
75
|
+
"@projectcaluma/ember-testing": "14.3.1",
|
76
|
+
"@projectcaluma/ember-workflow": "14.3.1"
|
77
77
|
},
|
78
78
|
"peerDependencies": {
|
79
79
|
"ember-source": ">= 4.0.0",
|
80
|
-
"@projectcaluma/ember-workflow": "^14.3.
|
80
|
+
"@projectcaluma/ember-workflow": "^14.3.1"
|
81
81
|
},
|
82
82
|
"dependenciesMeta": {
|
83
83
|
"@projectcaluma/ember-core": {
|