@projectcaluma/ember-form 9.3.0 → 10.0.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 +21 -0
- package/addon/components/cf-field/input/action-button.hbs +1 -1
- package/addon/components/cf-field/input/action-button.js +7 -0
- package/addon/components/document-validity.js +3 -5
- package/addon/gql/fragments/{field-question.graphql → field.graphql} +56 -0
- package/addon/gql/mutations/save-document-date-answer.graphql +2 -2
- package/addon/gql/mutations/save-document-file-answer.graphql +2 -2
- package/addon/gql/mutations/save-document-float-answer.graphql +2 -2
- package/addon/gql/mutations/save-document-integer-answer.graphql +2 -2
- package/addon/gql/mutations/save-document-list-answer.graphql +2 -2
- package/addon/gql/mutations/save-document-string-answer.graphql +2 -2
- package/addon/gql/mutations/save-document-table-answer.graphql +2 -2
- package/addon/gql/mutations/save-document.graphql +2 -2
- package/addon/gql/queries/get-document-answers.graphql +15 -2
- package/addon/gql/queries/get-document-forms.graphql +2 -2
- package/addon/gql/queries/get-dynamic-options.graphql +1 -1
- package/addon/gql/queries/get-fileanswer-info.graphql +1 -1
- package/addon/lib/document.js +16 -4
- package/addon/lib/field.js +1 -1
- package/package.json +7 -7
- package/addon/gql/fragments/field-answer.graphql +0 -57
package/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# [@projectcaluma/ember-form-v10.0.0](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v9.3.0...@projectcaluma/ember-form-v10.0.0) (2021-11-25)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* **form:** return default value for answer transform if empty ([ed703bc](https://github.com/projectcaluma/ember-caluma/commit/ed703bc2505e0ec59ec5b5ed6df4e0bb4f93db12))
|
7
|
+
|
8
|
+
|
9
|
+
### chore
|
10
|
+
|
11
|
+
* **deps:** update dependencies and drop support for node 10 ([51d6dee](https://github.com/projectcaluma/ember-caluma/commit/51d6deeda9811518622ba0cefd8d3876651dab4f))
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* **action-button:** improve detection of work item for action button ([f00b7b0](https://github.com/projectcaluma/ember-caluma/commit/f00b7b06ac114c5bee2267132518c13ee1502ad0))
|
17
|
+
|
18
|
+
|
19
|
+
### BREAKING CHANGES
|
20
|
+
|
21
|
+
* **deps:** Remove support for node v10
|
@@ -23,6 +23,13 @@ export default class CfFieldInputActionButtonComponent extends Component {
|
|
23
23
|
);
|
24
24
|
}
|
25
25
|
|
26
|
+
get workItem() {
|
27
|
+
return (
|
28
|
+
this.args.context?.actionButtonWorkItemId ||
|
29
|
+
this.args.field.document.workItemUuid
|
30
|
+
);
|
31
|
+
}
|
32
|
+
|
26
33
|
get action() {
|
27
34
|
return this.args.field.question.action.toLowerCase();
|
28
35
|
}
|
@@ -37,11 +37,9 @@ export default class DocumentValidity extends Component {
|
|
37
37
|
|
38
38
|
@restartableTask
|
39
39
|
*_validate() {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
})
|
44
|
-
);
|
40
|
+
for (const field of this.args.document.fields) {
|
41
|
+
yield field.validate.linked().perform();
|
42
|
+
}
|
45
43
|
|
46
44
|
if (this.isValid) {
|
47
45
|
this.args.onValid?.();
|
@@ -162,3 +162,59 @@ fragment FieldQuestion on Question {
|
|
162
162
|
}
|
163
163
|
}
|
164
164
|
}
|
165
|
+
|
166
|
+
fragment SimpleAnswer on Answer {
|
167
|
+
id
|
168
|
+
question {
|
169
|
+
slug
|
170
|
+
}
|
171
|
+
... on StringAnswer {
|
172
|
+
stringValue: value
|
173
|
+
}
|
174
|
+
... on IntegerAnswer {
|
175
|
+
integerValue: value
|
176
|
+
}
|
177
|
+
... on FloatAnswer {
|
178
|
+
floatValue: value
|
179
|
+
}
|
180
|
+
... on ListAnswer {
|
181
|
+
listValue: value
|
182
|
+
}
|
183
|
+
... on FileAnswer {
|
184
|
+
fileValue: value {
|
185
|
+
uploadUrl
|
186
|
+
downloadUrl
|
187
|
+
metadata
|
188
|
+
name
|
189
|
+
}
|
190
|
+
}
|
191
|
+
... on DateAnswer {
|
192
|
+
dateValue: value
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
fragment FieldAnswer on Answer {
|
197
|
+
...SimpleAnswer
|
198
|
+
... on TableAnswer {
|
199
|
+
tableValue: value {
|
200
|
+
id
|
201
|
+
form {
|
202
|
+
slug
|
203
|
+
questions {
|
204
|
+
edges {
|
205
|
+
node {
|
206
|
+
...FieldQuestion
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
answers {
|
212
|
+
edges {
|
213
|
+
node {
|
214
|
+
...SimpleAnswer
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import * from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
mutation ($input: SaveDocumentDateAnswerInput!) {
|
3
|
+
mutation SaveDocumentDateAnswer($input: SaveDocumentDateAnswerInput!) {
|
4
4
|
saveDocumentDateAnswer(input: $input) {
|
5
5
|
answer {
|
6
6
|
...FieldAnswer
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import * from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
mutation ($input: SaveDocumentFileAnswerInput!) {
|
3
|
+
mutation SaveDocumentFileAnswer($input: SaveDocumentFileAnswerInput!) {
|
4
4
|
saveDocumentFileAnswer(input: $input) {
|
5
5
|
answer {
|
6
6
|
...FieldAnswer
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import * from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
mutation ($input: SaveDocumentFloatAnswerInput!) {
|
3
|
+
mutation SaveDocumentFloatAnswer($input: SaveDocumentFloatAnswerInput!) {
|
4
4
|
saveDocumentFloatAnswer(input: $input) {
|
5
5
|
answer {
|
6
6
|
...FieldAnswer
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import * from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
mutation ($input: SaveDocumentIntegerAnswerInput!) {
|
3
|
+
mutation SaveDocumentIntegerAnswer($input: SaveDocumentIntegerAnswerInput!) {
|
4
4
|
saveDocumentIntegerAnswer(input: $input) {
|
5
5
|
answer {
|
6
6
|
...FieldAnswer
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import * from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
mutation ($input: SaveDocumentListAnswerInput!) {
|
3
|
+
mutation SaveDocumentListAnswer($input: SaveDocumentListAnswerInput!) {
|
4
4
|
saveDocumentListAnswer(input: $input) {
|
5
5
|
answer {
|
6
6
|
...FieldAnswer
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import * from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
mutation ($input: SaveDocumentStringAnswerInput!) {
|
3
|
+
mutation SaveDocumentStringAnswer($input: SaveDocumentStringAnswerInput!) {
|
4
4
|
saveDocumentStringAnswer(input: $input) {
|
5
5
|
answer {
|
6
6
|
...FieldAnswer
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import * from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
mutation ($input: SaveDocumentTableAnswerInput!) {
|
3
|
+
mutation saveDocumentTableAnswer($input: SaveDocumentTableAnswerInput!) {
|
4
4
|
saveDocumentTableAnswer(input: $input) {
|
5
5
|
answer {
|
6
6
|
...FieldAnswer
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import * from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
mutation ($input: SaveDocumentInput!) {
|
3
|
+
mutation SaveDocument($input: SaveDocumentInput!) {
|
4
4
|
saveDocument(input: $input) {
|
5
5
|
document {
|
6
6
|
id
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import * from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
query ($id: ID!) {
|
3
|
+
query GetDocumentAnswers($id: ID!) {
|
4
4
|
allDocuments(filter: [{ id: $id }]) {
|
5
5
|
edges {
|
6
6
|
node {
|
@@ -11,6 +11,19 @@ query ($id: ID!) {
|
|
11
11
|
workItem {
|
12
12
|
id
|
13
13
|
}
|
14
|
+
case {
|
15
|
+
id
|
16
|
+
workItems {
|
17
|
+
edges {
|
18
|
+
node {
|
19
|
+
id
|
20
|
+
task {
|
21
|
+
id
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
14
27
|
answers {
|
15
28
|
edges {
|
16
29
|
node {
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#import FieldQuestion, FieldTableQuestion, SimpleQuestion from '../fragments/field.graphql'
|
2
2
|
|
3
|
-
query ($slug: String!) {
|
3
|
+
query GetDocumentForms($slug: String!) {
|
4
4
|
allForms(filter: [{ slug: $slug }]) {
|
5
5
|
edges {
|
6
6
|
node {
|
package/addon/lib/document.js
CHANGED
@@ -83,9 +83,21 @@ export default Base.extend({
|
|
83
83
|
return decodeId(this.raw.id);
|
84
84
|
}),
|
85
85
|
|
86
|
-
workItemUuid: computed(
|
87
|
-
|
88
|
-
|
86
|
+
workItemUuid: computed(
|
87
|
+
"raw.{workItem.id,case.workItems.edges.[]}",
|
88
|
+
function () {
|
89
|
+
// The document is either directly attached to a work item (via
|
90
|
+
// CompleteTaskFormTask) or it's the case document and therefore
|
91
|
+
// indirectly attached to a work item (via CompleteWorkflowFormTask)
|
92
|
+
const rawId =
|
93
|
+
this.raw.workItem?.id ||
|
94
|
+
this.raw.case?.workItems.edges.find(
|
95
|
+
(edge) => edge.node.task.__typename === "CompleteWorkflowFormTask"
|
96
|
+
)?.node.id;
|
97
|
+
|
98
|
+
return rawId ? decodeId(rawId) : null;
|
99
|
+
}
|
100
|
+
),
|
89
101
|
|
90
102
|
/**
|
91
103
|
* The root form of this document
|
@@ -234,7 +246,7 @@ export default Base.extend({
|
|
234
246
|
}
|
235
247
|
|
236
248
|
if (field.hidden || [undefined, null].includes(field.value)) {
|
237
|
-
return field.question.isMultipleChoice ? [] : null;
|
249
|
+
return defaultValue ?? field.question.isMultipleChoice ? [] : null;
|
238
250
|
}
|
239
251
|
|
240
252
|
if (field.question.__typename === "TableQuestion") {
|
package/addon/lib/field.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@projectcaluma/ember-form",
|
3
|
-
"version": "
|
3
|
+
"version": "10.0.0",
|
4
4
|
"description": "Ember addon for rendering Caluma forms.",
|
5
5
|
"keywords": [
|
6
6
|
"ember-addon"
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"dependencies": {
|
17
17
|
"@glimmer/component": "^1.0.4",
|
18
18
|
"@glimmer/tracking": "^1.0.4",
|
19
|
-
"@projectcaluma/ember-core": "
|
19
|
+
"@projectcaluma/ember-core": "^10.0.0",
|
20
20
|
"ember-apollo-client": "^3.2.0",
|
21
21
|
"ember-auto-import": "^2.2.3",
|
22
22
|
"ember-cli-babel": "^7.26.6",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"ember-intl": "^5.7.0",
|
29
29
|
"ember-math-helpers": "^2.18.0",
|
30
30
|
"ember-pikaday": "^3.0.0",
|
31
|
-
"ember-power-select": "^4.1.
|
31
|
+
"ember-power-select": "^4.1.7",
|
32
32
|
"ember-uikit": "^4.0.0",
|
33
33
|
"graphql": "^15.6.1",
|
34
34
|
"jexl": "^2.3.0",
|
@@ -40,10 +40,10 @@
|
|
40
40
|
"@ember/optional-features": "2.0.0",
|
41
41
|
"@ember/test-helpers": "2.6.0",
|
42
42
|
"@embroider/test-setup": "0.47.2",
|
43
|
-
"@projectcaluma/ember-testing": "9.
|
43
|
+
"@projectcaluma/ember-testing": "9.1.0",
|
44
44
|
"@projectcaluma/ember-workflow": "9.0.3",
|
45
45
|
"broccoli-asset-rev": "3.0.0",
|
46
|
-
"ember-cli": "3.28.
|
46
|
+
"ember-cli": "3.28.4",
|
47
47
|
"ember-cli-code-coverage": "1.0.3",
|
48
48
|
"ember-cli-dependency-checker": "3.2.0",
|
49
49
|
"ember-cli-inject-live-reload": "2.1.0",
|
@@ -65,10 +65,10 @@
|
|
65
65
|
"qunit": "2.17.2",
|
66
66
|
"qunit-dom": "2.0.0",
|
67
67
|
"uuid": "8.3.2",
|
68
|
-
"webpack": "5.64.
|
68
|
+
"webpack": "5.64.1"
|
69
69
|
},
|
70
70
|
"engines": {
|
71
|
-
"node": "
|
71
|
+
"node": "12.* || 14.* || >= 16"
|
72
72
|
},
|
73
73
|
"ember": {
|
74
74
|
"edition": "octane"
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# import * from '@projectcaluma/ember-form/gql/fragments/field-question.graphql'
|
2
|
-
|
3
|
-
fragment SimpleAnswer on Answer {
|
4
|
-
id
|
5
|
-
question {
|
6
|
-
slug
|
7
|
-
}
|
8
|
-
... on StringAnswer {
|
9
|
-
stringValue: value
|
10
|
-
}
|
11
|
-
... on IntegerAnswer {
|
12
|
-
integerValue: value
|
13
|
-
}
|
14
|
-
... on FloatAnswer {
|
15
|
-
floatValue: value
|
16
|
-
}
|
17
|
-
... on ListAnswer {
|
18
|
-
listValue: value
|
19
|
-
}
|
20
|
-
... on FileAnswer {
|
21
|
-
fileValue: value {
|
22
|
-
uploadUrl
|
23
|
-
downloadUrl
|
24
|
-
metadata
|
25
|
-
name
|
26
|
-
}
|
27
|
-
}
|
28
|
-
... on DateAnswer {
|
29
|
-
dateValue: value
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
fragment FieldAnswer on Answer {
|
34
|
-
...SimpleAnswer
|
35
|
-
... on TableAnswer {
|
36
|
-
tableValue: value {
|
37
|
-
id
|
38
|
-
form {
|
39
|
-
slug
|
40
|
-
questions {
|
41
|
-
edges {
|
42
|
-
node {
|
43
|
-
...FieldQuestion
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}
|
48
|
-
answers {
|
49
|
-
edges {
|
50
|
-
node {
|
51
|
-
...SimpleAnswer
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
57
|
-
}
|