@projectcaluma/ember-form-builder 11.0.0-beta.3 → 11.0.0-beta.30
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 +138 -0
- package/addon/components/cfb-code-editor.hbs +25 -9
- package/addon/components/cfb-code-editor.js +59 -11
- package/addon/components/cfb-form-editor/general.hbs +1 -3
- package/addon/components/cfb-form-editor/general.js +6 -7
- package/addon/components/cfb-form-editor/question/default.hbs +11 -9
- package/addon/components/cfb-form-editor/question/options.hbs +3 -3
- package/addon/components/cfb-form-editor/question/validation.hbs +16 -14
- package/addon/components/cfb-form-editor/question/validation.js +17 -13
- package/addon/components/cfb-form-editor/question-list/item.hbs +44 -38
- package/addon/components/cfb-form-editor/question-list.hbs +2 -2
- package/addon/components/cfb-form-editor/question-list.js +9 -3
- package/addon/components/cfb-form-editor/question.hbs +55 -96
- package/addon/components/cfb-form-editor/question.js +56 -35
- package/addon/components/cfb-form-list.hbs +7 -7
- package/addon/components/cfb-form-list.js +44 -11
- package/addon/controllers/index.js +6 -0
- package/addon/engine.js +1 -1
- package/addon/gql/fragments/field.graphql +14 -2
- package/addon/gql/mutations/add-form-question.graphql +1 -1
- package/addon/gql/mutations/remove-form-question.graphql +1 -1
- package/addon/gql/mutations/reorder-form-questions.graphql +1 -1
- package/addon/gql/mutations/save-calculated-float-question.graphql +1 -0
- package/addon/gql/mutations/save-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-date-question.graphql +3 -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-files-question.graphql +14 -0
- package/addon/gql/mutations/save-float-question.graphql +1 -0
- package/addon/gql/mutations/save-integer-question.graphql +1 -0
- package/addon/gql/mutations/save-multiple-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-table-question.graphql +1 -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/all-format-validators.graphql +10 -0
- package/addon/gql/queries/check-form-slug.graphql +1 -1
- package/addon/gql/queries/check-question-slug.graphql +1 -1
- package/addon/gql/queries/form-editor-general.graphql +1 -1
- package/addon/gql/queries/form-editor-question.graphql +29 -1
- package/addon/gql/queries/search-form-question.graphql +3 -3
- package/addon/instance-initializers/form-builder-widget-overrides.js +15 -0
- package/addon/modifiers/pikaday.js +2 -0
- package/addon/routes/edit/questions/edit.js +2 -1
- package/addon/routes/edit.js +1 -1
- package/addon/templates/index.hbs +8 -1
- package/addon/validations/question.js +6 -0
- package/addon/validators/gt-lt.js +17 -38
- package/app/instance-initializers/form-builder-widget-overrides.js +4 -0
- package/app/styles/@projectcaluma/ember-form-builder.scss +2 -2
- package/app/styles/_cfb-uikit-powerselect.scss +2 -0
- package/config/environment.js +0 -7
- package/index.js +4 -2
- package/package.json +53 -40
- package/translations/de.yaml +7 -6
- package/translations/en.yaml +4 -3
- package/translations/fr.yaml +154 -1
- package/addon/components/cfb-float-input.hbs +0 -14
- package/addon/components/cfb-label.hbs +0 -12
- package/addon/gql/mutations/save-file-question.graphql +0 -11
- package/app/components/cfb-float-input.js +0 -1
- package/app/components/cfb-label.js +0 -1
- package/app/styles/_cfb-powerselect.scss +0 -31
|
@@ -19,6 +19,7 @@ fragment SimpleQuestion on Question {
|
|
|
19
19
|
value
|
|
20
20
|
}
|
|
21
21
|
placeholder
|
|
22
|
+
hintText
|
|
22
23
|
}
|
|
23
24
|
... on TextareaQuestion {
|
|
24
25
|
textareaMinLength: minLength
|
|
@@ -28,6 +29,7 @@ fragment SimpleQuestion on Question {
|
|
|
28
29
|
value
|
|
29
30
|
}
|
|
30
31
|
placeholder
|
|
32
|
+
hintText
|
|
31
33
|
}
|
|
32
34
|
... on IntegerQuestion {
|
|
33
35
|
integerMinValue: minValue
|
|
@@ -37,6 +39,7 @@ fragment SimpleQuestion on Question {
|
|
|
37
39
|
value
|
|
38
40
|
}
|
|
39
41
|
placeholder
|
|
42
|
+
hintText
|
|
40
43
|
}
|
|
41
44
|
... on FloatQuestion {
|
|
42
45
|
floatMinValue: minValue
|
|
@@ -46,6 +49,7 @@ fragment SimpleQuestion on Question {
|
|
|
46
49
|
value
|
|
47
50
|
}
|
|
48
51
|
placeholder
|
|
52
|
+
hintText
|
|
49
53
|
}
|
|
50
54
|
... on ChoiceQuestion {
|
|
51
55
|
choiceOptions: options {
|
|
@@ -62,6 +66,7 @@ fragment SimpleQuestion on Question {
|
|
|
62
66
|
id
|
|
63
67
|
value
|
|
64
68
|
}
|
|
69
|
+
hintText
|
|
65
70
|
}
|
|
66
71
|
... on MultipleChoiceQuestion {
|
|
67
72
|
multipleChoiceOptions: options {
|
|
@@ -78,18 +83,24 @@ fragment SimpleQuestion on Question {
|
|
|
78
83
|
id
|
|
79
84
|
value
|
|
80
85
|
}
|
|
86
|
+
hintText
|
|
81
87
|
}
|
|
82
88
|
... on DateQuestion {
|
|
83
89
|
dateDefaultAnswer: defaultAnswer {
|
|
84
90
|
id
|
|
85
91
|
value
|
|
86
92
|
}
|
|
93
|
+
hintText
|
|
87
94
|
}
|
|
88
95
|
... on StaticQuestion {
|
|
89
96
|
staticContent
|
|
90
97
|
}
|
|
91
98
|
... on CalculatedFloatQuestion {
|
|
92
99
|
calcExpression
|
|
100
|
+
hintText
|
|
101
|
+
}
|
|
102
|
+
... on FilesQuestion {
|
|
103
|
+
hintText
|
|
93
104
|
}
|
|
94
105
|
... on ActionButtonQuestion {
|
|
95
106
|
action
|
|
@@ -112,6 +123,7 @@ fragment FieldTableQuestion on Question {
|
|
|
112
123
|
}
|
|
113
124
|
}
|
|
114
125
|
}
|
|
126
|
+
hintText
|
|
115
127
|
tableDefaultAnswer: defaultAnswer {
|
|
116
128
|
id
|
|
117
129
|
value {
|
|
@@ -204,8 +216,8 @@ fragment SimpleAnswer on Answer {
|
|
|
204
216
|
... on ListAnswer {
|
|
205
217
|
listValue: value
|
|
206
218
|
}
|
|
207
|
-
... on
|
|
208
|
-
|
|
219
|
+
... on FilesAnswer {
|
|
220
|
+
filesValue: value {
|
|
209
221
|
id
|
|
210
222
|
uploadUrl
|
|
211
223
|
downloadUrl
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#import QuestionInfo from '../fragments/question-info.graphql'
|
|
2
|
+
|
|
3
|
+
mutation SaveFilesQuestion($input: SaveFilesQuestionInput!) {
|
|
4
|
+
saveFilesQuestion(input: $input) {
|
|
5
|
+
question {
|
|
6
|
+
id
|
|
7
|
+
...QuestionInfo
|
|
8
|
+
... on FilesQuestion {
|
|
9
|
+
hintText
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
clientMutationId
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#import FieldQuestion, FieldTableQuestion, SimpleAnswer, SimpleQuestion from '../fragments/field.graphql'
|
|
3
3
|
|
|
4
4
|
query FormEditorQuestion($slug: String!) {
|
|
5
|
-
allQuestions(filter: [{
|
|
5
|
+
allQuestions(filter: [{ slugs: [$slug] }]) {
|
|
6
6
|
edges {
|
|
7
7
|
node {
|
|
8
8
|
id
|
|
@@ -11,6 +11,7 @@ query FormEditorQuestion($slug: String!) {
|
|
|
11
11
|
integerMaxValue: maxValue
|
|
12
12
|
integerMinValue: minValue
|
|
13
13
|
placeholder
|
|
14
|
+
hintText
|
|
14
15
|
defaultAnswer {
|
|
15
16
|
id
|
|
16
17
|
integerValue: value
|
|
@@ -20,6 +21,7 @@ query FormEditorQuestion($slug: String!) {
|
|
|
20
21
|
floatMaxValue: maxValue
|
|
21
22
|
floatMinValue: minValue
|
|
22
23
|
placeholder
|
|
24
|
+
hintText
|
|
23
25
|
defaultAnswer {
|
|
24
26
|
id
|
|
25
27
|
floatValue: value
|
|
@@ -29,21 +31,38 @@ query FormEditorQuestion($slug: String!) {
|
|
|
29
31
|
minLength
|
|
30
32
|
maxLength
|
|
31
33
|
placeholder
|
|
34
|
+
hintText
|
|
32
35
|
defaultAnswer {
|
|
33
36
|
id
|
|
34
37
|
stringValue: value
|
|
35
38
|
}
|
|
39
|
+
formatValidators {
|
|
40
|
+
edges {
|
|
41
|
+
node {
|
|
42
|
+
slug
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
36
46
|
}
|
|
37
47
|
... on TextareaQuestion {
|
|
38
48
|
minLength
|
|
39
49
|
maxLength
|
|
40
50
|
placeholder
|
|
51
|
+
formatValidators {
|
|
52
|
+
edges {
|
|
53
|
+
node {
|
|
54
|
+
slug
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
hintText
|
|
41
59
|
defaultAnswer {
|
|
42
60
|
id
|
|
43
61
|
stringValue: value
|
|
44
62
|
}
|
|
45
63
|
}
|
|
46
64
|
... on DateQuestion {
|
|
65
|
+
hintText
|
|
47
66
|
defaultAnswer {
|
|
48
67
|
id
|
|
49
68
|
dateValue: value
|
|
@@ -60,6 +79,7 @@ query FormEditorQuestion($slug: String!) {
|
|
|
60
79
|
}
|
|
61
80
|
}
|
|
62
81
|
}
|
|
82
|
+
hintText
|
|
63
83
|
defaultAnswer {
|
|
64
84
|
id
|
|
65
85
|
listValue: value
|
|
@@ -76,6 +96,7 @@ query FormEditorQuestion($slug: String!) {
|
|
|
76
96
|
}
|
|
77
97
|
}
|
|
78
98
|
}
|
|
99
|
+
hintText
|
|
79
100
|
defaultAnswer {
|
|
80
101
|
id
|
|
81
102
|
stringValue: value
|
|
@@ -83,9 +104,11 @@ query FormEditorQuestion($slug: String!) {
|
|
|
83
104
|
}
|
|
84
105
|
... on DynamicMultipleChoiceQuestion {
|
|
85
106
|
dataSource
|
|
107
|
+
hintText
|
|
86
108
|
}
|
|
87
109
|
... on DynamicChoiceQuestion {
|
|
88
110
|
dataSource
|
|
111
|
+
hintText
|
|
89
112
|
}
|
|
90
113
|
... on TableQuestion {
|
|
91
114
|
rowForm {
|
|
@@ -101,6 +124,7 @@ query FormEditorQuestion($slug: String!) {
|
|
|
101
124
|
}
|
|
102
125
|
}
|
|
103
126
|
}
|
|
127
|
+
hintText
|
|
104
128
|
defaultAnswer {
|
|
105
129
|
id
|
|
106
130
|
tableValue: value {
|
|
@@ -137,6 +161,10 @@ query FormEditorQuestion($slug: String!) {
|
|
|
137
161
|
}
|
|
138
162
|
... on CalculatedFloatQuestion {
|
|
139
163
|
calcExpression
|
|
164
|
+
hintText
|
|
165
|
+
}
|
|
166
|
+
... on FilesQuestion {
|
|
167
|
+
hintText
|
|
140
168
|
}
|
|
141
169
|
... on ActionButtonQuestion {
|
|
142
170
|
action
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#import QuestionInfo from '../fragments/question-info.graphql'
|
|
2
2
|
|
|
3
|
-
query SearchFormQuestion($slug: String!, $search: String
|
|
4
|
-
allForms(filter: [{
|
|
3
|
+
query SearchFormQuestion($slug: String!, $search: String) {
|
|
4
|
+
allForms(filter: [{ slugs: [$slug] }]) {
|
|
5
5
|
edges {
|
|
6
6
|
node {
|
|
7
7
|
id
|
|
8
8
|
slug
|
|
9
|
-
questions(search: $search
|
|
9
|
+
questions(filter: [{ search: $search }]) {
|
|
10
10
|
edges {
|
|
11
11
|
node {
|
|
12
12
|
id
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import DefaultTableComponent from "@projectcaluma/ember-form-builder/components/cfb-form-editor/question/default/table";
|
|
2
|
+
|
|
3
|
+
export function initialize(appInstance) {
|
|
4
|
+
const options = appInstance.lookup("service:caluma-options");
|
|
5
|
+
|
|
6
|
+
options.registerComponentOverride({
|
|
7
|
+
component: "cfb-form-editor/question/default/table",
|
|
8
|
+
componentClass: DefaultTableComponent,
|
|
9
|
+
types: [],
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
initialize,
|
|
15
|
+
};
|
package/addon/routes/edit.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
<CfbFormList
|
|
1
|
+
<CfbFormList
|
|
2
|
+
@search={{this.search}}
|
|
3
|
+
@category={{this.category}}
|
|
4
|
+
@onNewForm={{this.newForm}}
|
|
5
|
+
@onEditForm={{this.editForm}}
|
|
6
|
+
@onUpdateSearch={{fn (mut this.search)}}
|
|
7
|
+
@onUpdateCategory={{fn (mut this.category)}}
|
|
8
|
+
/>
|
|
@@ -16,6 +16,12 @@ export default {
|
|
|
16
16
|
label: and(validatePresence(true), validateLength({ max: 1024 })),
|
|
17
17
|
slug: validateSlug(),
|
|
18
18
|
|
|
19
|
+
hintText: or(
|
|
20
|
+
validateType("FormQuestion", true),
|
|
21
|
+
validateType("StaticQuestion", true),
|
|
22
|
+
validateType("FilesQuestion", true),
|
|
23
|
+
validateLength({ max: 1024, allowBlank: true })
|
|
24
|
+
),
|
|
19
25
|
integerMinValue: or(
|
|
20
26
|
validateType("IntegerQuestion", false),
|
|
21
27
|
and(
|
|
@@ -1,47 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import buildMessage from "ember-changeset-validations/utils/validation-errors";
|
|
1
|
+
import { validateNumber } from "ember-changeset-validations/validators";
|
|
3
2
|
|
|
4
|
-
export default function validateGtLt(options = {
|
|
3
|
+
export default function validateGtLt(options = {}) {
|
|
5
4
|
return (key, newValue, oldValue, changes, content) => {
|
|
6
|
-
newValue = Number(newValue);
|
|
7
|
-
|
|
8
|
-
if (!newValue) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const messages = getMessages();
|
|
13
5
|
const data = { ...content, ...changes };
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
return dependentValue
|
|
19
|
-
? Number(newValue) > Number(dependentValue) ||
|
|
20
|
-
buildMessage(key, {
|
|
21
|
-
type: "greaterThan",
|
|
22
|
-
value: newValue,
|
|
23
|
-
context: {
|
|
24
|
-
gt: messages.getDescriptionFor(options.gt),
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
: true;
|
|
28
|
-
}
|
|
7
|
+
const parsedOptions = Object.entries(options).reduce((parsed, [k, v]) => {
|
|
8
|
+
const value =
|
|
9
|
+
/^(g|l)t(e)?$/.test(k) && typeof v === "string" ? data[v] : v;
|
|
29
10
|
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
if (value) {
|
|
12
|
+
return { ...parsed, [k]: value };
|
|
13
|
+
}
|
|
32
14
|
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
buildMessage(key, {
|
|
36
|
-
type: "lessThan",
|
|
37
|
-
value: newValue,
|
|
38
|
-
context: {
|
|
39
|
-
lt: messages.getDescriptionFor(options.lt),
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
: true;
|
|
43
|
-
}
|
|
15
|
+
return parsed;
|
|
16
|
+
}, {});
|
|
44
17
|
|
|
45
|
-
return
|
|
18
|
+
return validateNumber(parsedOptions)(
|
|
19
|
+
key,
|
|
20
|
+
newValue,
|
|
21
|
+
oldValue,
|
|
22
|
+
changes,
|
|
23
|
+
content
|
|
24
|
+
);
|
|
46
25
|
};
|
|
47
26
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@import "../cfb-form-editor/question-list/item";
|
|
4
4
|
@import "../cfb-form-editor/question";
|
|
5
5
|
@import "../cfb-navigation";
|
|
6
|
-
@import "../cfb-powerselect";
|
|
6
|
+
@import "../cfb-uikit-powerselect";
|
|
7
7
|
|
|
8
8
|
.cfb-pointer {
|
|
9
9
|
cursor: pointer;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
.cfb-code-editor {
|
|
23
23
|
font-family: $base-code-font-family;
|
|
24
24
|
letter-spacing: normal;
|
|
25
|
-
height: 70px;
|
|
25
|
+
min-height: 70px;
|
|
26
26
|
line-height: 16px;
|
|
27
27
|
tab-size: 4;
|
|
28
28
|
}
|
package/config/environment.js
CHANGED
package/index.js
CHANGED
|
@@ -11,8 +11,10 @@ module.exports = buildEngine({
|
|
|
11
11
|
},
|
|
12
12
|
|
|
13
13
|
included(...args) {
|
|
14
|
-
this.
|
|
14
|
+
const app = this._findHost(this);
|
|
15
|
+
|
|
16
|
+
app.options["ember-validated-form"] = { theme: "uikit" };
|
|
15
17
|
|
|
16
|
-
this.
|
|
18
|
+
this._super.included.apply(this, args);
|
|
17
19
|
},
|
|
18
20
|
});
|