@projectcaluma/ember-form-builder 10.0.2 → 11.0.0-beta.3
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 +1082 -0
- package/addon/components/cfb-form-editor/general.hbs +83 -90
- package/addon/components/cfb-form-editor/general.js +11 -6
- package/addon/components/cfb-form-editor/question/default.js +11 -12
- package/addon/components/cfb-form-editor/question/options.hbs +1 -1
- package/addon/components/cfb-form-editor/question/validation.hbs +1 -0
- package/addon/components/cfb-form-editor/question-list/item.hbs +8 -8
- package/addon/components/cfb-form-editor/question-list/item.js +2 -2
- package/addon/components/cfb-form-editor/question-list.hbs +8 -8
- package/addon/components/cfb-form-editor/question-list.js +5 -6
- package/addon/components/cfb-form-editor/question.hbs +3 -2
- package/addon/components/cfb-form-editor/question.js +1 -2
- package/addon/components/cfb-form-editor.hbs +5 -5
- package/addon/components/cfb-form-list/item.hbs +1 -1
- package/addon/components/cfb-form-list.hbs +69 -72
- package/addon/components/cfb-form-list.js +10 -33
- package/addon/components/cfb-navigation.hbs +1 -1
- package/addon/components/cfb-toggle-switch.hbs +2 -2
- package/addon/engine.js +7 -10
- package/addon/gql/fragments/field.graphql +23 -1
- package/addon/gql/fragments/form-info.graphql +1 -0
- package/addon/gql/fragments/question-info.graphql +1 -0
- package/addon/gql/mutations/add-form-question.graphql +2 -0
- package/addon/gql/mutations/remove-form-question.graphql +2 -0
- package/addon/gql/mutations/reorder-form-questions.graphql +2 -0
- package/addon/gql/mutations/save-action-button-question.graphql +1 -0
- package/addon/gql/mutations/save-calculated-float-question.graphql +1 -0
- package/addon/gql/mutations/save-choice-question.graphql +2 -0
- package/addon/gql/mutations/save-date-question.graphql +1 -0
- package/addon/gql/mutations/save-dynamic-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-dynamic-multiple-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-file-question.graphql +1 -0
- package/addon/gql/mutations/save-float-question.graphql +1 -0
- package/addon/gql/mutations/save-form-question.graphql +2 -0
- package/addon/gql/mutations/save-form.graphql +1 -0
- package/addon/gql/mutations/save-integer-question.graphql +1 -0
- package/addon/gql/mutations/save-multiple-choice-question.graphql +2 -0
- package/addon/gql/mutations/save-option.graphql +1 -0
- package/addon/gql/mutations/save-static-question.graphql +1 -0
- package/addon/gql/mutations/save-table-question.graphql +2 -0
- package/addon/gql/mutations/save-text-question.graphql +1 -0
- package/addon/gql/mutations/save-textarea-question.graphql +1 -0
- package/addon/gql/queries/check-form-slug.graphql +1 -0
- package/addon/gql/queries/check-question-slug.graphql +1 -0
- package/addon/gql/queries/form-editor-general.graphql +1 -0
- package/addon/gql/queries/form-editor-question.graphql +7 -0
- package/addon/gql/queries/form-list.graphql +1 -0
- package/addon/gql/queries/search-form-question.graphql +4 -0
- package/addon/gql/queries/search-question.graphql +3 -0
- package/addon/routes/edit/questions/edit.js +1 -1
- package/addon/routes/edit.js +1 -1
- package/addon/templates/edit/questions/edit.hbs +1 -1
- package/addon/templates/edit/questions/new.hbs +1 -4
- package/addon/templates/edit.hbs +5 -5
- package/addon/templates/index.hbs +1 -1
- package/addon/templates/new.hbs +1 -1
- package/addon/utils/and.js +47 -0
- package/addon/utils/or.js +40 -0
- package/addon/validations/option.js +1 -1
- package/addon/validations/question.js +2 -2
- package/addon/validators/slug.js +1 -1
- package/app/utils/and.js +1 -0
- package/app/utils/or.js +1 -0
- package/index.js +6 -4
- package/package.json +28 -25
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { action } from "@ember/object";
|
|
2
1
|
import Component from "@glimmer/component";
|
|
3
2
|
import { tracked } from "@glimmer/tracking";
|
|
4
|
-
import {
|
|
5
|
-
import { timeout } from "ember-concurrency";
|
|
6
|
-
import { restartableTask } from "ember-concurrency-decorators";
|
|
3
|
+
import { timeout, restartableTask } from "ember-concurrency";
|
|
7
4
|
|
|
8
|
-
import
|
|
5
|
+
import { useCalumaQuery } from "@projectcaluma/ember-core/caluma-query";
|
|
9
6
|
import { allForms } from "@projectcaluma/ember-core/caluma-query/queries";
|
|
10
7
|
|
|
11
8
|
export default class ComponentsCfbFormListComponent extends Component {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
formsQuery = useCalumaQuery(this, allForms, () => ({
|
|
10
|
+
options: { pageSize: 20 },
|
|
11
|
+
filter: this.filter,
|
|
12
|
+
order: [{ attribute: "NAME", direction: "ASC" }],
|
|
13
|
+
}));
|
|
15
14
|
|
|
16
15
|
@tracked category = "active";
|
|
17
16
|
@tracked search = "";
|
|
@@ -29,33 +28,11 @@ export default class ComponentsCfbFormListComponent extends Component {
|
|
|
29
28
|
return [isArchived, search].filter(Boolean) || null;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
@action
|
|
33
|
-
setFilter(name, eventOrValue) {
|
|
34
|
-
this[name] =
|
|
35
|
-
eventOrValue instanceof Event ? eventOrValue.target.value : eventOrValue;
|
|
36
|
-
|
|
37
|
-
this.fetchForms.perform();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@action
|
|
41
|
-
submit(event) {
|
|
42
|
-
event.preventDefault();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@action
|
|
46
|
-
loadMoreForms(e) {
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
|
|
49
|
-
this.formsQuery.fetchMore();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
31
|
@restartableTask
|
|
53
|
-
*
|
|
32
|
+
*setFilter(name, eventOrValue) {
|
|
54
33
|
yield timeout(500);
|
|
55
34
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
order: [{ attribute: "NAME", direction: "ASC" }],
|
|
59
|
-
});
|
|
35
|
+
this[name] =
|
|
36
|
+
eventOrValue instanceof Event ? eventOrValue.target.value : eventOrValue;
|
|
60
37
|
}
|
|
61
38
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="uk-flex uk-flex-column {{unless @noMargin
|
|
1
|
+
<div class="uk-flex uk-flex-column {{unless @noMargin 'uk-margin'}}">
|
|
2
2
|
<@labelComponent />
|
|
3
3
|
|
|
4
4
|
<div class="uk-form-controls" ...attributes>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
@size={{@size}}
|
|
8
8
|
@name={{@name}}
|
|
9
9
|
@disabled={{@disabled}}
|
|
10
|
-
@
|
|
10
|
+
@onToggle={{@update}}
|
|
11
11
|
/>
|
|
12
12
|
</div>
|
|
13
13
|
|
package/addon/engine.js
CHANGED
|
@@ -6,16 +6,13 @@ import config from "./config/environment";
|
|
|
6
6
|
|
|
7
7
|
const { modulePrefix } = config;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Resolver,
|
|
9
|
+
export default class FormBuilderEngine extends Engine {
|
|
10
|
+
modulePrefix = modulePrefix;
|
|
11
|
+
Resolver = Resolver;
|
|
13
12
|
|
|
14
|
-
dependencies
|
|
13
|
+
dependencies = {
|
|
15
14
|
services: ["apollo", "notification", "intl", "caluma-options", "validator"],
|
|
16
|
-
}
|
|
17
|
-
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
18
17
|
|
|
19
|
-
loadInitializers(
|
|
20
|
-
|
|
21
|
-
export default Eng;
|
|
18
|
+
loadInitializers(FormBuilderEngine, modulePrefix);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# We can not symlink this file so an exact copy exists in another package:
|
|
2
|
-
# packages/form/addon/gql/fragments/field.graphql
|
|
2
|
+
# packages/form-builder/addon/gql/fragments/field.graphql
|
|
3
3
|
#
|
|
4
4
|
# When changing this file the other must also receive the same changes.
|
|
5
5
|
|
|
6
6
|
fragment SimpleQuestion on Question {
|
|
7
|
+
id
|
|
7
8
|
slug
|
|
8
9
|
label
|
|
9
10
|
isRequired
|
|
@@ -14,6 +15,7 @@ fragment SimpleQuestion on Question {
|
|
|
14
15
|
textMinLength: minLength
|
|
15
16
|
textMaxLength: maxLength
|
|
16
17
|
textDefaultAnswer: defaultAnswer {
|
|
18
|
+
id
|
|
17
19
|
value
|
|
18
20
|
}
|
|
19
21
|
placeholder
|
|
@@ -22,6 +24,7 @@ fragment SimpleQuestion on Question {
|
|
|
22
24
|
textareaMinLength: minLength
|
|
23
25
|
textareaMaxLength: maxLength
|
|
24
26
|
textareaDefaultAnswer: defaultAnswer {
|
|
27
|
+
id
|
|
25
28
|
value
|
|
26
29
|
}
|
|
27
30
|
placeholder
|
|
@@ -30,6 +33,7 @@ fragment SimpleQuestion on Question {
|
|
|
30
33
|
integerMinValue: minValue
|
|
31
34
|
integerMaxValue: maxValue
|
|
32
35
|
integerDefaultAnswer: defaultAnswer {
|
|
36
|
+
id
|
|
33
37
|
value
|
|
34
38
|
}
|
|
35
39
|
placeholder
|
|
@@ -38,6 +42,7 @@ fragment SimpleQuestion on Question {
|
|
|
38
42
|
floatMinValue: minValue
|
|
39
43
|
floatMaxValue: maxValue
|
|
40
44
|
floatDefaultAnswer: defaultAnswer {
|
|
45
|
+
id
|
|
41
46
|
value
|
|
42
47
|
}
|
|
43
48
|
placeholder
|
|
@@ -46,6 +51,7 @@ fragment SimpleQuestion on Question {
|
|
|
46
51
|
choiceOptions: options {
|
|
47
52
|
edges {
|
|
48
53
|
node {
|
|
54
|
+
id
|
|
49
55
|
slug
|
|
50
56
|
label
|
|
51
57
|
isArchived
|
|
@@ -53,6 +59,7 @@ fragment SimpleQuestion on Question {
|
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
choiceDefaultAnswer: defaultAnswer {
|
|
62
|
+
id
|
|
56
63
|
value
|
|
57
64
|
}
|
|
58
65
|
}
|
|
@@ -60,6 +67,7 @@ fragment SimpleQuestion on Question {
|
|
|
60
67
|
multipleChoiceOptions: options {
|
|
61
68
|
edges {
|
|
62
69
|
node {
|
|
70
|
+
id
|
|
63
71
|
slug
|
|
64
72
|
label
|
|
65
73
|
isArchived
|
|
@@ -67,11 +75,13 @@ fragment SimpleQuestion on Question {
|
|
|
67
75
|
}
|
|
68
76
|
}
|
|
69
77
|
multipleChoiceDefaultAnswer: defaultAnswer {
|
|
78
|
+
id
|
|
70
79
|
value
|
|
71
80
|
}
|
|
72
81
|
}
|
|
73
82
|
... on DateQuestion {
|
|
74
83
|
dateDefaultAnswer: defaultAnswer {
|
|
84
|
+
id
|
|
75
85
|
value
|
|
76
86
|
}
|
|
77
87
|
}
|
|
@@ -89,8 +99,10 @@ fragment SimpleQuestion on Question {
|
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
fragment FieldTableQuestion on Question {
|
|
102
|
+
id
|
|
92
103
|
... on TableQuestion {
|
|
93
104
|
rowForm {
|
|
105
|
+
id
|
|
94
106
|
slug
|
|
95
107
|
questions {
|
|
96
108
|
edges {
|
|
@@ -101,6 +113,7 @@ fragment FieldTableQuestion on Question {
|
|
|
101
113
|
}
|
|
102
114
|
}
|
|
103
115
|
tableDefaultAnswer: defaultAnswer {
|
|
116
|
+
id
|
|
104
117
|
value {
|
|
105
118
|
id
|
|
106
119
|
answers {
|
|
@@ -108,6 +121,7 @@ fragment FieldTableQuestion on Question {
|
|
|
108
121
|
node {
|
|
109
122
|
id
|
|
110
123
|
question {
|
|
124
|
+
id
|
|
111
125
|
slug
|
|
112
126
|
}
|
|
113
127
|
... on StringAnswer {
|
|
@@ -134,10 +148,12 @@ fragment FieldTableQuestion on Question {
|
|
|
134
148
|
}
|
|
135
149
|
|
|
136
150
|
fragment FieldQuestion on Question {
|
|
151
|
+
id
|
|
137
152
|
...SimpleQuestion
|
|
138
153
|
...FieldTableQuestion
|
|
139
154
|
... on FormQuestion {
|
|
140
155
|
subForm {
|
|
156
|
+
id
|
|
141
157
|
slug
|
|
142
158
|
name
|
|
143
159
|
questions {
|
|
@@ -145,10 +161,12 @@ fragment FieldQuestion on Question {
|
|
|
145
161
|
node {
|
|
146
162
|
# This part here limits our query to 2 level deep nested forms. This
|
|
147
163
|
# has to be solved in another way!
|
|
164
|
+
id
|
|
148
165
|
...SimpleQuestion
|
|
149
166
|
...FieldTableQuestion
|
|
150
167
|
... on FormQuestion {
|
|
151
168
|
subForm {
|
|
169
|
+
id
|
|
152
170
|
slug
|
|
153
171
|
name
|
|
154
172
|
questions {
|
|
@@ -171,6 +189,7 @@ fragment FieldQuestion on Question {
|
|
|
171
189
|
fragment SimpleAnswer on Answer {
|
|
172
190
|
id
|
|
173
191
|
question {
|
|
192
|
+
id
|
|
174
193
|
slug
|
|
175
194
|
}
|
|
176
195
|
... on StringAnswer {
|
|
@@ -187,6 +206,7 @@ fragment SimpleAnswer on Answer {
|
|
|
187
206
|
}
|
|
188
207
|
... on FileAnswer {
|
|
189
208
|
fileValue: value {
|
|
209
|
+
id
|
|
190
210
|
uploadUrl
|
|
191
211
|
downloadUrl
|
|
192
212
|
metadata
|
|
@@ -199,11 +219,13 @@ fragment SimpleAnswer on Answer {
|
|
|
199
219
|
}
|
|
200
220
|
|
|
201
221
|
fragment FieldAnswer on Answer {
|
|
222
|
+
id
|
|
202
223
|
...SimpleAnswer
|
|
203
224
|
... on TableAnswer {
|
|
204
225
|
tableValue: value {
|
|
205
226
|
id
|
|
206
227
|
form {
|
|
228
|
+
id
|
|
207
229
|
slug
|
|
208
230
|
questions {
|
|
209
231
|
edges {
|
|
@@ -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
|
}
|
|
@@ -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,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
|
}
|
|
@@ -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
|
|
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";
|
package/addon/routes/edit.js
CHANGED
|
@@ -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
|
|
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";
|