@projectcaluma/ember-form-builder 10.0.0 → 11.0.0-beta.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.
Files changed (45) hide show
  1. package/addon/components/cfb-form-editor/general.hbs +83 -90
  2. package/addon/components/cfb-form-editor/general.js +10 -4
  3. package/addon/components/cfb-form-editor/question/default.js +11 -12
  4. package/addon/components/cfb-form-editor/question-list/item.hbs +4 -4
  5. package/addon/components/cfb-form-editor/question-list.hbs +2 -2
  6. package/addon/components/cfb-form-editor/question-list.js +2 -2
  7. package/addon/components/cfb-form-editor/question.hbs +0 -1
  8. package/addon/components/cfb-form-list.hbs +69 -72
  9. package/addon/components/cfb-form-list.js +10 -33
  10. package/addon/components/cfb-navigation.hbs +1 -1
  11. package/addon/components/cfb-toggle-switch.hbs +1 -1
  12. package/addon/gql/fragments/field.graphql +247 -0
  13. package/addon/gql/fragments/form-info.graphql +1 -0
  14. package/addon/gql/fragments/question-info.graphql +1 -0
  15. package/addon/gql/mutations/add-form-question.graphql +2 -0
  16. package/addon/gql/mutations/remove-form-question.graphql +2 -0
  17. package/addon/gql/mutations/reorder-form-questions.graphql +2 -0
  18. package/addon/gql/mutations/save-action-button-question.graphql +1 -0
  19. package/addon/gql/mutations/save-calculated-float-question.graphql +1 -0
  20. package/addon/gql/mutations/save-choice-question.graphql +2 -0
  21. package/addon/gql/mutations/save-date-question.graphql +1 -0
  22. package/addon/gql/mutations/save-dynamic-choice-question.graphql +1 -0
  23. package/addon/gql/mutations/save-dynamic-multiple-choice-question.graphql +1 -0
  24. package/addon/gql/mutations/save-file-question.graphql +1 -0
  25. package/addon/gql/mutations/save-float-question.graphql +1 -0
  26. package/addon/gql/mutations/save-form-question.graphql +2 -0
  27. package/addon/gql/mutations/save-form.graphql +1 -0
  28. package/addon/gql/mutations/save-integer-question.graphql +1 -0
  29. package/addon/gql/mutations/save-multiple-choice-question.graphql +2 -0
  30. package/addon/gql/mutations/save-option.graphql +1 -0
  31. package/addon/gql/mutations/save-static-question.graphql +1 -0
  32. package/addon/gql/mutations/save-table-question.graphql +2 -0
  33. package/addon/gql/mutations/save-text-question.graphql +1 -0
  34. package/addon/gql/mutations/save-textarea-question.graphql +1 -0
  35. package/addon/gql/queries/check-form-slug.graphql +1 -0
  36. package/addon/gql/queries/check-question-slug.graphql +1 -0
  37. package/addon/gql/queries/form-editor-general.graphql +1 -0
  38. package/addon/gql/queries/form-editor-question.graphql +7 -0
  39. package/addon/gql/queries/form-list.graphql +1 -0
  40. package/addon/gql/queries/search-form-question.graphql +4 -0
  41. package/addon/gql/queries/search-question.graphql +3 -0
  42. package/addon/routes/edit/questions/edit.js +1 -1
  43. package/addon/routes/edit.js +1 -1
  44. package/package.json +18 -18
  45. package/CHANGELOG.md +0 -16
@@ -0,0 +1,247 @@
1
+ # We can not symlink this file so an exact copy exists in another package:
2
+ # packages/form-builder/addon/gql/fragments/field.graphql
3
+ #
4
+ # When changing this file the other must also receive the same changes.
5
+
6
+ fragment SimpleQuestion on Question {
7
+ id
8
+ slug
9
+ label
10
+ isRequired
11
+ isHidden
12
+ meta
13
+ infoText
14
+ ... on TextQuestion {
15
+ textMinLength: minLength
16
+ textMaxLength: maxLength
17
+ textDefaultAnswer: defaultAnswer {
18
+ id
19
+ value
20
+ }
21
+ placeholder
22
+ }
23
+ ... on TextareaQuestion {
24
+ textareaMinLength: minLength
25
+ textareaMaxLength: maxLength
26
+ textareaDefaultAnswer: defaultAnswer {
27
+ id
28
+ value
29
+ }
30
+ placeholder
31
+ }
32
+ ... on IntegerQuestion {
33
+ integerMinValue: minValue
34
+ integerMaxValue: maxValue
35
+ integerDefaultAnswer: defaultAnswer {
36
+ id
37
+ value
38
+ }
39
+ placeholder
40
+ }
41
+ ... on FloatQuestion {
42
+ floatMinValue: minValue
43
+ floatMaxValue: maxValue
44
+ floatDefaultAnswer: defaultAnswer {
45
+ id
46
+ value
47
+ }
48
+ placeholder
49
+ }
50
+ ... on ChoiceQuestion {
51
+ choiceOptions: options {
52
+ edges {
53
+ node {
54
+ id
55
+ slug
56
+ label
57
+ isArchived
58
+ }
59
+ }
60
+ }
61
+ choiceDefaultAnswer: defaultAnswer {
62
+ id
63
+ value
64
+ }
65
+ }
66
+ ... on MultipleChoiceQuestion {
67
+ multipleChoiceOptions: options {
68
+ edges {
69
+ node {
70
+ id
71
+ slug
72
+ label
73
+ isArchived
74
+ }
75
+ }
76
+ }
77
+ multipleChoiceDefaultAnswer: defaultAnswer {
78
+ id
79
+ value
80
+ }
81
+ }
82
+ ... on DateQuestion {
83
+ dateDefaultAnswer: defaultAnswer {
84
+ id
85
+ value
86
+ }
87
+ }
88
+ ... on StaticQuestion {
89
+ staticContent
90
+ }
91
+ ... on CalculatedFloatQuestion {
92
+ calcExpression
93
+ }
94
+ ... on ActionButtonQuestion {
95
+ action
96
+ color
97
+ validateOnEnter
98
+ }
99
+ }
100
+
101
+ fragment FieldTableQuestion on Question {
102
+ id
103
+ ... on TableQuestion {
104
+ rowForm {
105
+ id
106
+ slug
107
+ questions {
108
+ edges {
109
+ node {
110
+ ...SimpleQuestion
111
+ }
112
+ }
113
+ }
114
+ }
115
+ tableDefaultAnswer: defaultAnswer {
116
+ id
117
+ value {
118
+ id
119
+ answers {
120
+ edges {
121
+ node {
122
+ id
123
+ question {
124
+ id
125
+ slug
126
+ }
127
+ ... on StringAnswer {
128
+ stringValue: value
129
+ }
130
+ ... on IntegerAnswer {
131
+ integerValue: value
132
+ }
133
+ ... on FloatAnswer {
134
+ floatValue: value
135
+ }
136
+ ... on ListAnswer {
137
+ listValue: value
138
+ }
139
+ ... on DateAnswer {
140
+ dateValue: value
141
+ }
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
149
+
150
+ fragment FieldQuestion on Question {
151
+ id
152
+ ...SimpleQuestion
153
+ ...FieldTableQuestion
154
+ ... on FormQuestion {
155
+ subForm {
156
+ id
157
+ slug
158
+ name
159
+ questions {
160
+ edges {
161
+ node {
162
+ # This part here limits our query to 2 level deep nested forms. This
163
+ # has to be solved in another way!
164
+ id
165
+ ...SimpleQuestion
166
+ ...FieldTableQuestion
167
+ ... on FormQuestion {
168
+ subForm {
169
+ id
170
+ slug
171
+ name
172
+ questions {
173
+ edges {
174
+ node {
175
+ ...SimpleQuestion
176
+ ...FieldTableQuestion
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+ }
188
+
189
+ fragment SimpleAnswer on Answer {
190
+ id
191
+ question {
192
+ id
193
+ slug
194
+ }
195
+ ... on StringAnswer {
196
+ stringValue: value
197
+ }
198
+ ... on IntegerAnswer {
199
+ integerValue: value
200
+ }
201
+ ... on FloatAnswer {
202
+ floatValue: value
203
+ }
204
+ ... on ListAnswer {
205
+ listValue: value
206
+ }
207
+ ... on FileAnswer {
208
+ fileValue: value {
209
+ id
210
+ uploadUrl
211
+ downloadUrl
212
+ metadata
213
+ name
214
+ }
215
+ }
216
+ ... on DateAnswer {
217
+ dateValue: value
218
+ }
219
+ }
220
+
221
+ fragment FieldAnswer on Answer {
222
+ id
223
+ ...SimpleAnswer
224
+ ... on TableAnswer {
225
+ tableValue: value {
226
+ id
227
+ form {
228
+ id
229
+ slug
230
+ questions {
231
+ edges {
232
+ node {
233
+ ...FieldQuestion
234
+ }
235
+ }
236
+ }
237
+ }
238
+ answers {
239
+ edges {
240
+ node {
241
+ ...SimpleAnswer
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
@@ -1,4 +1,5 @@
1
1
  fragment FormInfo on Form {
2
+ id
2
3
  name
3
4
  slug
4
5
  description
@@ -1,4 +1,5 @@
1
1
  fragment QuestionInfo on Question {
2
+ id
2
3
  slug
3
4
  label
4
5
  isRequired
@@ -4,10 +4,12 @@
4
4
  mutation AddFormQuestion($input: AddFormQuestionInput!, $search: String) {
5
5
  addFormQuestion(input: $input) {
6
6
  form {
7
+ id
7
8
  ...FormInfo
8
9
  questions(search: $search) {
9
10
  edges {
10
11
  node {
12
+ id
11
13
  ...QuestionInfo
12
14
  }
13
15
  }
@@ -4,10 +4,12 @@
4
4
  mutation RemoveFormQuestion($input: RemoveFormQuestionInput!, $search: String) {
5
5
  removeFormQuestion(input: $input) {
6
6
  form {
7
+ id
7
8
  ...FormInfo
8
9
  questions(search: $search) {
9
10
  edges {
10
11
  node {
12
+ id
11
13
  ...QuestionInfo
12
14
  }
13
15
  }
@@ -7,10 +7,12 @@ mutation ReorderFormQuestions(
7
7
  ) {
8
8
  reorderFormQuestions(input: $input) {
9
9
  form {
10
+ id
10
11
  ...FormInfo
11
12
  questions(search: $search) {
12
13
  edges {
13
14
  node {
15
+ id
14
16
  ...QuestionInfo
15
17
  }
16
18
  }
@@ -3,6 +3,7 @@
3
3
  mutation SaveActionButtonQuestion($input: SaveActionButtonQuestionInput!) {
4
4
  saveActionButtonQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on ActionButtonQuestion {
8
9
  action
@@ -5,6 +5,7 @@ mutation SaveCalculatedFloatQuestion(
5
5
  ) {
6
6
  saveCalculatedFloatQuestion(input: $input) {
7
7
  question {
8
+ id
8
9
  ...QuestionInfo
9
10
  ... on CalculatedFloatQuestion {
10
11
  calcExpression
@@ -3,11 +3,13 @@
3
3
  mutation SaveChoiceQuestion($input: SaveChoiceQuestionInput!) {
4
4
  saveChoiceQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on ChoiceQuestion {
8
9
  options {
9
10
  edges {
10
11
  node {
12
+ id
11
13
  label
12
14
  slug
13
15
  }
@@ -3,6 +3,7 @@
3
3
  mutation SaveDateQuestion($input: SaveDateQuestionInput!) {
4
4
  saveDateQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  }
8
9
  clientMutationId
@@ -3,6 +3,7 @@
3
3
  mutation SaveDynamicChoiceQuestion($input: SaveDynamicChoiceQuestionInput!) {
4
4
  saveDynamicChoiceQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on DynamicChoiceQuestion {
8
9
  dataSource
@@ -5,6 +5,7 @@ mutation SaveDynamicMultipleChoiceQuestion(
5
5
  ) {
6
6
  saveDynamicMultipleChoiceQuestion(input: $input) {
7
7
  question {
8
+ id
8
9
  ...QuestionInfo
9
10
  ... on DynamicMultipleChoiceQuestion {
10
11
  dataSource
@@ -3,6 +3,7 @@
3
3
  mutation SaveFileQuestion($input: SaveFileQuestionInput!) {
4
4
  saveFileQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  }
8
9
  clientMutationId
@@ -3,6 +3,7 @@
3
3
  mutation SaveFloatQuestion($input: SaveFloatQuestionInput!) {
4
4
  saveFloatQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on FloatQuestion {
8
9
  floatMinValue: minValue
@@ -3,9 +3,11 @@
3
3
  mutation SaveFormQuestion($input: SaveFormQuestionInput!) {
4
4
  saveFormQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on FormQuestion {
8
9
  subForm {
10
+ id
9
11
  slug
10
12
  }
11
13
  }
@@ -3,6 +3,7 @@
3
3
  mutation SaveForm($input: SaveFormInput!) {
4
4
  saveForm(input: $input) {
5
5
  form {
6
+ id
6
7
  ...FormInfo
7
8
  }
8
9
  clientMutationId
@@ -3,6 +3,7 @@
3
3
  mutation SaveIntegerQuestion($input: SaveIntegerQuestionInput!) {
4
4
  saveIntegerQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on IntegerQuestion {
8
9
  integerMinValue: minValue
@@ -3,11 +3,13 @@
3
3
  mutation SaveMultipleChoiceQuestion($input: SaveMultipleChoiceQuestionInput!) {
4
4
  saveMultipleChoiceQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on MultipleChoiceQuestion {
8
9
  options {
9
10
  edges {
10
11
  node {
12
+ id
11
13
  label
12
14
  slug
13
15
  }
@@ -1,6 +1,7 @@
1
1
  mutation SaveOption($input: SaveOptionInput!) {
2
2
  saveOption(input: $input) {
3
3
  option {
4
+ id
4
5
  label
5
6
  slug
6
7
  }
@@ -3,6 +3,7 @@
3
3
  mutation SaveStaticQuestion($input: SaveStaticQuestionInput!) {
4
4
  saveStaticQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on StaticQuestion {
8
9
  staticContent
@@ -3,9 +3,11 @@
3
3
  mutation SaveTableQuestion($input: SaveTableQuestionInput!) {
4
4
  saveTableQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on TableQuestion {
8
9
  rowForm {
10
+ id
9
11
  slug
10
12
  }
11
13
  }
@@ -3,6 +3,7 @@
3
3
  mutation SaveTextQuestion($input: SaveTextQuestionInput!) {
4
4
  saveTextQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on TextQuestion {
8
9
  minLength
@@ -3,6 +3,7 @@
3
3
  mutation SaveTextareaQuestion($input: SaveTextareaQuestionInput!) {
4
4
  saveTextareaQuestion(input: $input) {
5
5
  question {
6
+ id
6
7
  ...QuestionInfo
7
8
  ... on TextareaQuestion {
8
9
  minLength
@@ -2,6 +2,7 @@ query CheckFormSlug($slug: String!) {
2
2
  allForms(filter: [{ slug: $slug }]) {
3
3
  edges {
4
4
  node {
5
+ id
5
6
  slug
6
7
  }
7
8
  }
@@ -2,6 +2,7 @@ query CheckQuestionSlug($slug: String!) {
2
2
  allQuestions(filter: [{ slug: $slug }]) {
3
3
  edges {
4
4
  node {
5
+ id
5
6
  slug
6
7
  }
7
8
  }
@@ -4,6 +4,7 @@ query FormEditorGeneral($slug: String!) {
4
4
  allForms(filter: [{ slug: $slug }]) {
5
5
  edges {
6
6
  node {
7
+ id
7
8
  ...FormInfo
8
9
  }
9
10
  }
@@ -5,6 +5,7 @@ query FormEditorQuestion($slug: String!) {
5
5
  allQuestions(filter: [{ slug: $slug }]) {
6
6
  edges {
7
7
  node {
8
+ id
8
9
  ...QuestionInfo
9
10
  ... on IntegerQuestion {
10
11
  integerMaxValue: maxValue
@@ -52,6 +53,7 @@ query FormEditorQuestion($slug: String!) {
52
53
  options {
53
54
  edges {
54
55
  node {
56
+ id
55
57
  label
56
58
  slug
57
59
  isArchived
@@ -67,6 +69,7 @@ query FormEditorQuestion($slug: String!) {
67
69
  options {
68
70
  edges {
69
71
  node {
72
+ id
70
73
  label
71
74
  slug
72
75
  isArchived
@@ -86,10 +89,12 @@ query FormEditorQuestion($slug: String!) {
86
89
  }
87
90
  ... on TableQuestion {
88
91
  rowForm {
92
+ id
89
93
  slug
90
94
  questions {
91
95
  edges {
92
96
  node {
97
+ id
93
98
  slug
94
99
  label
95
100
  }
@@ -101,6 +106,7 @@ query FormEditorQuestion($slug: String!) {
101
106
  tableValue: value {
102
107
  id
103
108
  form {
109
+ id
104
110
  slug
105
111
  questions {
106
112
  edges {
@@ -122,6 +128,7 @@ query FormEditorQuestion($slug: String!) {
122
128
  }
123
129
  ... on FormQuestion {
124
130
  subForm {
131
+ id
125
132
  slug
126
133
  }
127
134
  }
@@ -4,6 +4,7 @@ query FormList($filter: [FormFilterSetType], $order: [FormOrderSetType]) {
4
4
  allForms(filter: $filter, order: $order) {
5
5
  edges {
6
6
  node {
7
+ id
7
8
  ...FormInfo
8
9
  }
9
10
  }
@@ -4,19 +4,23 @@ query SearchFormQuestion($slug: String!, $search: String, $archived: Boolean) {
4
4
  allForms(filter: [{ slug: $slug }]) {
5
5
  edges {
6
6
  node {
7
+ id
7
8
  slug
8
9
  questions(search: $search, isArchived: $archived) {
9
10
  edges {
10
11
  node {
12
+ id
11
13
  ...QuestionInfo
12
14
  ... on FormQuestion {
13
15
  subForm {
16
+ id
14
17
  slug
15
18
  name
16
19
  }
17
20
  }
18
21
  ... on TableQuestion {
19
22
  rowForm {
23
+ id
20
24
  slug
21
25
  name
22
26
  }
@@ -22,15 +22,18 @@ query SearchQuestion(
22
22
  totalCount
23
23
  edges {
24
24
  node {
25
+ id
25
26
  ...QuestionInfo
26
27
  ... on FormQuestion {
27
28
  subForm {
29
+ id
28
30
  slug
29
31
  name
30
32
  }
31
33
  }
32
34
  ... on TableQuestion {
33
35
  rowForm {
36
+ id
34
37
  slug
35
38
  name
36
39
  }
@@ -1,7 +1,7 @@
1
1
  import Route from "@ember/routing/route";
2
2
  import { inject as service } from "@ember/service";
3
3
  import { queryManager } from "ember-apollo-client";
4
- import { lastValue, dropTask } from "ember-concurrency-decorators";
4
+ import { lastValue, dropTask } from "ember-concurrency";
5
5
  import { gql } from "graphql-tag";
6
6
 
7
7
  import { navigationTitle } from "@projectcaluma/ember-form-builder/decorators";
@@ -1,7 +1,7 @@
1
1
  import Route from "@ember/routing/route";
2
2
  import { inject as service } from "@ember/service";
3
3
  import { queryManager } from "ember-apollo-client";
4
- import { lastValue, dropTask } from "ember-concurrency-decorators";
4
+ import { lastValue, dropTask } from "ember-concurrency";
5
5
  import { gql } from "graphql-tag";
6
6
 
7
7
  import { navigationTitle } from "@projectcaluma/ember-form-builder/decorators";