@projectcaluma/ember-form-builder 9.0.5 → 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.
Files changed (69) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/addon/components/cfb-float-input.hbs +14 -0
  3. package/addon/components/cfb-float-input.js +10 -4
  4. package/addon/components/cfb-form-editor/general.hbs +90 -86
  5. package/addon/components/cfb-form-editor/general.js +43 -45
  6. package/addon/components/cfb-form-editor/question/default.hbs +11 -9
  7. package/addon/components/cfb-form-editor/question/default.js +19 -29
  8. package/addon/components/cfb-form-editor/question/options.hbs +80 -82
  9. package/addon/components/cfb-form-editor/question/options.js +116 -105
  10. package/addon/components/cfb-form-editor/question/validation.hbs +14 -12
  11. package/addon/components/cfb-form-editor/question/validation.js +22 -31
  12. package/addon/components/cfb-form-editor/question-list/item.js +2 -4
  13. package/addon/components/cfb-form-editor/question.hbs +455 -380
  14. package/addon/components/cfb-form-editor/question.js +162 -138
  15. package/addon/components/cfb-form-list.hbs +1 -1
  16. package/addon/components/cfb-jexl-boolean-toggle-switch.hbs +12 -10
  17. package/addon/components/cfb-jexl-boolean-toggle-switch.js +11 -10
  18. package/addon/components/cfb-label.hbs +12 -4
  19. package/addon/components/cfb-toggle-switch.hbs +14 -12
  20. package/addon/gql/mutations/add-form-question.graphql +2 -2
  21. package/addon/gql/mutations/remove-form-question.graphql +2 -2
  22. package/addon/gql/mutations/reorder-form-questions.graphql +2 -2
  23. package/addon/gql/mutations/save-action-button-question.graphql +15 -0
  24. package/addon/gql/mutations/save-calculated-float-question.graphql +1 -1
  25. package/addon/gql/mutations/save-choice-question.graphql +1 -1
  26. package/addon/gql/mutations/save-date-question.graphql +1 -1
  27. package/addon/gql/mutations/save-default-date-answer.graphql +2 -6
  28. package/addon/gql/mutations/save-default-float-answer.graphql +2 -6
  29. package/addon/gql/mutations/save-default-integer-answer.graphql +2 -6
  30. package/addon/gql/mutations/save-default-list-answer.graphql +2 -6
  31. package/addon/gql/mutations/save-default-string-answer.graphql +2 -6
  32. package/addon/gql/mutations/save-default-table-answer.graphql +2 -6
  33. package/addon/gql/mutations/save-dynamic-choice-question.graphql +1 -1
  34. package/addon/gql/mutations/save-dynamic-multiple-choice-question.graphql +1 -1
  35. package/addon/gql/mutations/save-file-question.graphql +1 -1
  36. package/addon/gql/mutations/save-float-question.graphql +1 -1
  37. package/addon/gql/mutations/save-form-question.graphql +1 -1
  38. package/addon/gql/mutations/save-form.graphql +1 -1
  39. package/addon/gql/mutations/save-integer-question.graphql +1 -1
  40. package/addon/gql/mutations/save-multiple-choice-question.graphql +1 -1
  41. package/addon/gql/mutations/save-static-question.graphql +1 -1
  42. package/addon/gql/mutations/save-table-question.graphql +1 -1
  43. package/addon/gql/mutations/save-text-question.graphql +1 -1
  44. package/addon/gql/mutations/save-textarea-question.graphql +1 -1
  45. package/addon/gql/queries/form-editor-general.graphql +1 -1
  46. package/addon/gql/queries/form-editor-question.graphql +7 -3
  47. package/addon/gql/queries/form-list.graphql +1 -1
  48. package/addon/gql/queries/search-form-question.graphql +1 -1
  49. package/addon/gql/queries/search-question.graphql +1 -1
  50. package/addon/routes/edit/questions/edit.js +1 -1
  51. package/addon/routes/edit.js +1 -1
  52. package/package.json +21 -21
  53. package/translations/de.yaml +18 -4
  54. package/translations/en.yaml +18 -4
  55. package/addon/components/cfb-float-input/input.js +0 -12
  56. package/addon/components/cfb-label.js +0 -5
  57. package/addon/gql/fragments/field-answer.graphql +0 -57
  58. package/addon/gql/fragments/field-question.graphql +0 -159
  59. package/addon/gql/mutations/archive-form.graphql +0 -5
  60. package/addon/gql/mutations/remove-document.graphql +0 -5
  61. package/addon/gql/queries/all-format-validators.graphql +0 -12
  62. package/addon/gql/queries/all-work-items.graphql +0 -9
  63. package/addon/gql/queries/data-source.graphql +0 -10
  64. package/addon/gql/queries/get-document-answers.graphql +0 -21
  65. package/addon/gql/queries/get-document-forms.graphql +0 -20
  66. package/addon/gql/queries/get-document-used-dynamic-options.graphql +0 -12
  67. package/addon/gql/queries/get-dynamic-options.graphql +0 -29
  68. package/addon/gql/queries/get-fileanswer-info.graphql +0 -13
  69. package/app/components/cfb-float-input/input.js +0 -1
@@ -1,88 +1,98 @@
1
- {{#if this.data.isRunning}}
2
- <div class="uk-flex uk-flex-center uk-flex-middle uk-height-small">
3
- <UkSpinner @ratio={{2}} />
4
- </div>
5
- {{else if this.model}}
6
- <ValidatedForm
7
- @model={{this.changeset}}
8
- @on-submit={{perform this.submit}}
9
- as |f|
10
- >
11
- {{#if (and f.model.isDirty @slug)}}
12
- <div class="uk-alert-warning uk-animation-fade" uk-alert>
13
- <a href="#" class="uk-alert-close" uk-close></a>
14
- <div uk-grid class="uk-grid-small">
15
- <div class="uk-width-auto uk-flex uk-flex-middle">
16
- <UkIcon @icon="warning" @ratio={{1.2}} />
17
- </div>
18
- <div class="uk-width-expand">
19
- <strong>{{t
20
- "caluma.form-builder.question.minor-info-title"
21
- }}</strong>
22
- {{t "caluma.form-builder.question.minor-info"}}
1
+ <div {{did-insert this.fetchData}} {{did-update this.fetchData @slug @form}}>
2
+ {{#if this.data.isRunning}}
3
+ <div class="uk-flex uk-flex-center uk-flex-middle uk-height-small">
4
+ <UkSpinner @ratio={{2}} />
5
+ </div>
6
+ {{else if this.model}}
7
+ <ValidatedForm
8
+ @model={{this.changeset}}
9
+ @on-submit={{perform this.submit}}
10
+ as |f|
11
+ >
12
+ {{#if (and f.model.isDirty @slug)}}
13
+ <div class="uk-alert-warning uk-animation-fade" uk-alert>
14
+ <a href="#" class="uk-alert-close" uk-close></a>
15
+ <div uk-grid class="uk-grid-small">
16
+ <div class="uk-width-auto uk-flex uk-flex-middle">
17
+ <UkIcon @icon="warning" @ratio={{1.2}} />
18
+ </div>
19
+ <div class="uk-width-expand">
20
+ <strong>{{t
21
+ "caluma.form-builder.question.minor-info-title"
22
+ }}</strong>
23
+ {{t "caluma.form-builder.question.minor-info"}}
24
+ </div>
23
25
  </div>
24
26
  </div>
25
- </div>
26
- {{/if}}
27
+ {{/if}}
27
28
 
28
- <f.input
29
- @type="select"
30
- @options={{this.possibleTypes}}
31
- @optionLabelPath="label"
32
- @optionTargetPath="value"
33
- @label={{t "caluma.form-builder.question.type"}}
34
- @hint={{t "caluma.form-builder.question.type-disabled"}}
35
- @name="__typename"
36
- @required={{true}}
37
- @disabled={{@slug}}
38
- />
29
+ <f.input
30
+ @type="select"
31
+ @options={{this.possibleTypes}}
32
+ @optionLabelPath="label"
33
+ @optionTargetPath="value"
34
+ @label={{t "caluma.form-builder.question.type"}}
35
+ @hint={{t "caluma.form-builder.question.type-disabled"}}
36
+ @name="__typename"
37
+ @required={{true}}
38
+ @disabled={{@slug}}
39
+ @on-update={{changeset-set f.model "__typename"}}
40
+ />
39
41
 
40
- <f.input
41
- @label={{t "caluma.form-builder.question.label"}}
42
- @name="label"
43
- @required={{true}}
44
- @on-update={{action "updateLabel"}}
45
- />
42
+ <f.input
43
+ @label={{t "caluma.form-builder.question.label"}}
44
+ @name="label"
45
+ @required={{true}}
46
+ @on-update={{this.updateLabel}}
47
+ />
46
48
 
47
- <div uk-grid class="uk-grid-small uk-margin">
48
- <div class="uk-width-expand">
49
- {{#if (or @slug (not this.prefix))}}
50
- <f.input
51
- @label={{t "caluma.form-builder.question.slug"}}
52
- @name="slug"
53
- @required={{true}}
54
- @disabled={{@slug}}
55
- @on-update={{action "updateSlug"}}
56
- />
57
- {{else}}
58
- <f.input
59
- @name="slug"
60
- @required={{true}}
61
- @disabled={{@slug}}
62
- @label={{t "caluma.form-builder.question.slug"}}
63
- @on-update={{action "updateSlug" value="target.value"}}
64
- as |fi|
65
- >
66
- <div class="cfb-prefixed">
67
- <span class="cfb-prefixed-slug">{{this.prefix}}</span>
49
+ <div uk-grid class="uk-grid-small uk-margin">
50
+ <div class="uk-width-expand">
51
+ {{#if (or @slug (not this.prefix))}}
52
+ <f.input
53
+ @name="slug"
54
+ @label={{t "caluma.form-builder.question.slug"}}
55
+ @required={{true}}
56
+ @disabled={{@slug}}
57
+ @on-update={{this.updateSlug}}
58
+ />
59
+ {{else}}
60
+ <f.input
61
+ @name="slug"
62
+ @label={{t "caluma.form-builder.question.slug"}}
63
+ @required={{true}}
64
+ @disabled={{@slug}}
65
+ @on-update={{this.updateSlug value="target.value"}}
66
+ as |fi|
67
+ >
68
+ <div class="cfb-prefixed">
69
+ <span class="cfb-prefixed-slug">{{this.prefix}}</span>
68
70
 
69
- <ValidatedInput::types::-themes::uikit::input
70
- @model={{fi.model}}
71
- @name={{fi.name}}
72
- @value={{fi.value}}
73
- @update={{fi.update}}
74
- @setDirty={{fi.setDirty}}
75
- @inputId={{fi.inputId}}
76
- @isValid={{fi.isValid}}
77
- @isInvalid={{fi.isInvalid}}
78
- />
79
- </div>
80
- </f.input>
81
- {{/if}}
82
- </div>
71
+ <f.input
72
+ @model={{fi.model}}
73
+ @name={{fi.name}}
74
+ @value={{fi.value}}
75
+ @update={{fi.update}}
76
+ @setDirty={{fi.setDirty}}
77
+ @inputId={{fi.inputId}}
78
+ @isValid={{fi.isValid}}
79
+ @isInvalid={{fi.isInvalid}}
80
+ />
81
+ </div>
82
+ </f.input>
83
+ {{/if}}
84
+ </div>
83
85
 
84
- {{#if this.requiredToggleVisible}}
85
- <div class="uk-width-auto uk-flex">
86
+ {{#if
87
+ (not
88
+ (or
89
+ (has-question-type
90
+ f.model "static" "calculated-float" "action-button"
91
+ )
92
+ (not (includes f.model.isRequired (array "true" "false")))
93
+ )
94
+ )
95
+ }}
86
96
  <f.input
87
97
  @name="isRequired"
88
98
  @label={{t "caluma.form-builder.question.isRequired"}}
@@ -91,316 +101,357 @@
91
101
  "cfb-jexl-boolean-toggle-switch"
92
102
  size="small"
93
103
  }}
94
- class="uk-flex uk-flex-between uk-flex-column"
95
104
  />
105
+ {{/if}}
106
+ </div>
107
+
108
+ {{#if (has-question-type f.model "calculated-float")}}
109
+ <f.input
110
+ @label={{t "caluma.form-builder.question.calcExpression"}}
111
+ @name="calcExpression"
112
+ @renderComponent={{component "cfb-code-editor" language="jexl"}}
113
+ />
114
+ {{/if}}
115
+
116
+ {{#if (has-question-type f.model "static")}}
117
+ <div class="uk-margin">
118
+ <f.input
119
+ @label={{t "caluma.form-builder.question.staticContent"}}
120
+ @name="staticContent"
121
+ @renderComponent={{component
122
+ "cfb-code-editor"
123
+ language="markdown"
124
+ className="uk-margin-remove-bottom"
125
+ }}
126
+ class="uk-margin-remove-bottom"
127
+ />
128
+ <small class="uk-text-muted">
129
+ {{t "caluma.form-builder.question.supportsMarkdownPrefix"}}
130
+ <a
131
+ target="_blank"
132
+ rel="noopener noreferrer"
133
+ href="https://www.markdownguide.org/basic-syntax"
134
+ >{{t "caluma.form-builder.question.markdown"}}</a>
135
+ </small>
96
136
  </div>
97
137
  {{/if}}
98
- </div>
99
138
 
100
- {{#if (has-question-type f.model "calculated-float")}}
101
- <f.input
102
- @type="textarea"
103
- @label={{t "caluma.form-builder.question.calcExpression"}}
104
- @name="calcExpression"
105
- class="uk-margin-remove-bottom"
106
- />
107
- {{/if}}
139
+ {{#if (has-question-type f.model "action-button")}}
140
+ <f.input
141
+ @label={{t "caluma.form-builder.question.confirmationText"}}
142
+ @name="infoText"
143
+ @type="textarea"
144
+ />
145
+ {{else}}
146
+ <div class="uk-margin">
147
+ <f.input
148
+ @label={{t "caluma.form-builder.question.infoText"}}
149
+ @name="infoText"
150
+ @renderComponent={{component
151
+ "cfb-code-editor"
152
+ language="markdown"
153
+ className="uk-margin-remove-bottom"
154
+ }}
155
+ />
156
+ <small class="uk-text-muted">
157
+ {{t "caluma.form-builder.question.supportsMarkdownPrefix"}}
158
+ <a
159
+ target="_blank"
160
+ rel="noopener noreferrer"
161
+ href="https://www.markdownguide.org/basic-syntax"
162
+ >{{t "caluma.form-builder.question.markdown"}}</a>
163
+ </small>
164
+ </div>
165
+ {{/if}}
108
166
 
109
- {{#if (has-question-type f.model "static")}}
110
- <div class="uk-margin">
167
+ {{#if (has-question-type f.model "text" "textarea" "integer" "float")}}
111
168
  <f.input
112
- @label={{t "caluma.form-builder.question.staticContent"}}
113
- @name="staticContent"
114
- @renderComponent={{component
115
- "cfb-code-editor"
116
- language="markdown"
117
- className="uk-margin-remove-bottom"
118
- }}
119
- class="uk-margin-remove-bottom"
169
+ @name="placeholder"
170
+ @label={{t "caluma.form-builder.question.placeholder"}}
120
171
  />
121
- <small class="uk-text-muted">
122
- {{t "caluma.form-builder.question.supportsMarkdownPrefix"}}
123
- <a
124
- target="_blank"
125
- rel="noopener noreferrer"
126
- href="https://www.markdownguide.org/basic-syntax"
127
- >{{t "caluma.form-builder.question.markdown"}}</a>
128
- </small>
129
- </div>
130
- {{/if}}
172
+ {{/if}}
131
173
 
132
- <div class="uk-margin">
133
- <f.input
134
- @label={{t "caluma.form-builder.question.infoText"}}
135
- @name="infoText"
136
- @renderComponent={{component
137
- "cfb-code-editor"
138
- language="markdown"
139
- className="uk-margin-remove-bottom"
140
- }}
141
- />
142
- <small class="uk-text-muted">
143
- {{t "caluma.form-builder.question.supportsMarkdownPrefix"}}
144
- <a
145
- target="_blank"
146
- rel="noopener noreferrer"
147
- href="https://www.markdownguide.org/basic-syntax"
148
- >{{t "caluma.form-builder.question.markdown"}}</a>
149
- </small>
150
- </div>
174
+ {{#if
175
+ (and
176
+ @slug
177
+ (has-question-type
178
+ f.model
179
+ "text"
180
+ "textarea"
181
+ "integer"
182
+ "float"
183
+ "choice"
184
+ "multiple-choice"
185
+ "date"
186
+ "table"
187
+ )
188
+ )
189
+ }}
190
+ <f.input
191
+ @name="defaultAnswer"
192
+ @label={{t "caluma.form-builder.question.defaultValue"}}
193
+ @renderComponent={{component "cfb-form-editor/question/default"}}
194
+ />
195
+ {{/if}}
151
196
 
152
- {{#if (has-question-type f.model "text" "textarea" "integer" "float")}}
153
- <f.input
154
- @name="placeholder"
155
- @label={{t "caluma.form-builder.question.placeholder"}}
156
- />
157
- {{/if}}
197
+ {{#if (has-question-type f.model "text" "textarea")}}
198
+ <f.input
199
+ @type="number"
200
+ @name="minLength"
201
+ @label={{t "caluma.form-builder.question.min-length"}}
202
+ />
158
203
 
159
- {{#if
160
- (and
161
- @slug
162
- (has-question-type
163
- f.model
164
- "text"
165
- "textarea"
166
- "integer"
167
- "float"
168
- "choice"
169
- "multiple-choice"
170
- "date"
171
- "table"
172
- )
173
- )
174
- }}
175
- <f.input
176
- @name="defaultAnswer"
177
- @label={{t "caluma.form-builder.question.defaultValue"}}
178
- @renderComponent={{component "cfb-form-editor/question/default"}}
179
- />
180
- {{/if}}
204
+ <f.input
205
+ @type="number"
206
+ @name="maxLength"
207
+ @label={{t "caluma.form-builder.question.max-length"}}
208
+ />
181
209
 
182
- {{#if (has-question-type f.model "text" "textarea")}}
183
- <f.input
184
- @type="number"
185
- @name="minLength"
186
- @label={{t "caluma.form-builder.question.min-length"}}
187
- />
210
+ <f.input
211
+ @name="meta.formatValidators"
212
+ @label={{t "caluma.form-builder.question.formatValidators"}}
213
+ @placeholder={{t "caluma.form-builder.question.choose"}}
214
+ @required={{false}}
215
+ @renderComponent={{component "cfb-form-editor/question/validation"}}
216
+ @on-update={{changeset-set f.model "meta.formatValidators"}}
217
+ @value={{changeset-get f.model "meta.formatValidators"}}
218
+ />
219
+ {{/if}}
188
220
 
189
- <f.input
190
- @type="number"
191
- @name="maxLength"
192
- @label={{t "caluma.form-builder.question.max-length"}}
193
- />
221
+ {{#if (has-question-type f.model "action-button")}}
222
+ <f.input
223
+ @type="select"
224
+ @options={{this.possibleActions}}
225
+ @optionLabelPath="label"
226
+ @optionTargetPath="value"
227
+ @label={{t "caluma.form-builder.question.action"}}
228
+ @name="action"
229
+ @required={{true}}
230
+ />
231
+ <f.input
232
+ @type="select"
233
+ @options={{this.possibleColors}}
234
+ @optionLabelPath="label"
235
+ @optionTargetPath="value"
236
+ @label={{t "caluma.form-builder.question.color"}}
237
+ @name="color"
238
+ @required={{true}}
239
+ />
240
+ {{/if}}
194
241
 
195
- <f.input
196
- @name="meta.formatValidators"
197
- @label={{t "caluma.form-builder.question.formatValidators"}}
198
- @placeholder={{t "caluma.form-builder.question.choose"}}
199
- @required={{false}}
200
- @renderComponent={{component "cfb-form-editor/question/validation"}}
201
- @on-update={{changeset-set f.model "meta.formatValidators"}}
202
- @value={{changeset-get f.model "meta.formatValidators"}}
203
- />
204
- {{/if}}
242
+ {{#if (has-question-type f.model "float")}}
243
+ <div uk-grid class="uk-grid-small uk-child-width-1-2 uk-margin">
244
+ <div>
245
+ <f.input
246
+ @name="floatMinValue"
247
+ @label={{t "caluma.form-builder.question.min-value"}}
248
+ @renderComponent={{component "cfb-float-input"}}
249
+ />
250
+ </div>
205
251
 
206
- {{#if (has-question-type f.model "float")}}
207
- <div uk-grid class="uk-grid-small uk-child-width-1-2 uk-margin">
208
- <div>
209
- <f.input
210
- @name="floatMinValue"
211
- @label={{t "caluma.form-builder.question.min-value"}}
212
- @renderComponent={{component "cfb-float-input"}}
213
- />
252
+ <div>
253
+ <f.input
254
+ @name="floatMaxValue"
255
+ @label={{t "caluma.form-builder.question.max-value"}}
256
+ @renderComponent={{component "cfb-float-input"}}
257
+ />
258
+ </div>
214
259
  </div>
260
+ {{/if}}
215
261
 
216
- <div>
217
- <f.input
218
- @name="floatMaxValue"
219
- @label={{t "caluma.form-builder.question.max-value"}}
220
- @renderComponent={{component "cfb-float-input"}}
221
- />
222
- </div>
223
- </div>
224
- {{/if}}
262
+ {{#if (has-question-type f.model "integer")}}
263
+ <div uk-grid class="uk-grid-small uk-child-width-1-2 uk-margin">
264
+ <div>
265
+ <f.input
266
+ @type="number"
267
+ @name="integerMinValue"
268
+ @label={{t "caluma.form-builder.question.min-value"}}
269
+ />
270
+ </div>
225
271
 
226
- {{#if (has-question-type f.model "integer")}}
227
- <div uk-grid class="uk-grid-small uk-child-width-1-2 uk-margin">
228
- <div>
229
- <f.input
230
- @type="number"
231
- @name="integerMinValue"
232
- @label={{t "caluma.form-builder.question.min-value"}}
233
- />
272
+ <div>
273
+ <f.input
274
+ @type="number"
275
+ @name="integerMaxValue"
276
+ @label={{t "caluma.form-builder.question.max-value"}}
277
+ />
278
+ </div>
234
279
  </div>
280
+ {{/if}}
281
+
282
+ {{#if (has-question-type f.model "choice" "multiple-choice")}}
283
+ <f.input
284
+ @name="options"
285
+ @label={{t "caluma.form-builder.question.options"}}
286
+ @required={{true}}
287
+ @renderComponent={{component "cfb-form-editor/question/options"}}
288
+ />
289
+ {{/if}}
290
+
291
+ {{#if
292
+ (has-question-type f.model "dynamic-choice" "dynamic-multiple-choice")
293
+ }}
294
+ <f.input
295
+ @name="dataSource"
296
+ @type="select"
297
+ @required={{true}}
298
+ @label={{t "caluma.form-builder.question.dataSource"}}
299
+ @options={{or this.availableDataSources.lastSuccessful.value array}}
300
+ @optionTargetPath="name"
301
+ @optionLabelPath="info"
302
+ @includeBlank={{t "caluma.form-builder.question.choose"}}
303
+ />
304
+ {{/if}}
305
+
306
+ {{#if (not (has-question-type f.model "action-button"))}}
307
+ <f.input
308
+ @name="meta.hideLabel"
309
+ @required={{true}}
310
+ @label={{t "caluma.form-builder.question.hideLabel"}}
311
+ @renderComponent={{component "cfb-toggle-switch" size="small"}}
312
+ @on-update={{changeset-set f.model "meta.hideLabel"}}
313
+ @value={{changeset-get f.model "meta.hideLabel"}}
314
+ />
315
+ {{/if}}
235
316
 
236
- <div>
317
+ {{#if (has-question-type f.model "table")}}
318
+ <div class="uk-margin">
237
319
  <f.input
238
- @type="number"
239
- @name="integerMaxValue"
240
- @label={{t "caluma.form-builder.question.max-value"}}
241
- />
320
+ @name="rowForm.slug"
321
+ @label={{t "caluma.form-builder.question.rowForm"}}
322
+ @required={{true}}
323
+ @on-update={{this.updateRowForm}}
324
+ @value={{find-by
325
+ "slug"
326
+ (changeset-get f.model "rowForm.slug")
327
+ this.availableForms.lastSuccessful.value
328
+ }}
329
+ as |fi|
330
+ >
331
+ <PowerSelect
332
+ @options={{or this.availableForms.lastSuccessful.value array}}
333
+ @selected={{fi.value}}
334
+ @placeholder={{t "caluma.form-builder.question.choose"}}
335
+ @onBlur={{fi.setDirty}}
336
+ @onChange={{fi.update}}
337
+ @searchField="slug"
338
+ @searchEnabled={{true}}
339
+ @searchPlaceholder={{t
340
+ "caluma.form-builder.question.search-placeholder"
341
+ }}
342
+ @noMatchesMessage={{t
343
+ "caluma.form-builder.question.search-empty"
344
+ }}
345
+ as |form|
346
+ >
347
+ <span
348
+ class="uk-width-auto uk-margin-small-right uk-text-truncate"
349
+ >
350
+ {{form.slug}}
351
+ </span>
352
+ <span
353
+ class="highlight-option uk-text-muted uk-width-expand uk-margin-small-right uk-text-small uk-text-truncate"
354
+ >
355
+ {{form.name}}
356
+ </span>
357
+ </PowerSelect>
358
+ </f.input>
242
359
  </div>
243
- </div>
244
- {{/if}}
245
360
 
246
- {{#if (has-question-type f.model "choice" "multiple-choice")}}
247
- <f.input
248
- @name="options"
249
- @label={{t "caluma.form-builder.question.options"}}
250
- @required={{true}}
251
- @renderComponent={{component "cfb-form-editor/question/options"}}
252
- />
253
- {{/if}}
361
+ {{#if @slug}}
362
+ <div class="uk-margin">
363
+ <f.input
364
+ @name="meta.columnsToDisplay"
365
+ @label={{t "caluma.form-builder.question.columnsToDisplay"}}
366
+ >
367
+ {{#each this.model.rowForm.questions.edges as |rowEdge|}}
368
+ {{#let rowEdge.node as |row|}}
369
+ <label class="cf-checkbox_label">
370
+ <input
371
+ type="checkbox"
372
+ value={{row.slug}}
373
+ checked={{includes
374
+ row.slug
375
+ this.model.meta.columnsToDisplay
376
+ }}
377
+ class="uk-checkbox uk-margin-small-right"
378
+ {{on
379
+ "change"
380
+ (fn this.toggleColumnToDisplay row.slug f.model)
381
+ }}
382
+ />
383
+ {{row.label}}
384
+ </label>
385
+ {{/let}}
386
+ {{/each}}
387
+ </f.input>
388
+ </div>
389
+ {{/if}}
390
+ {{/if}}
391
+
392
+ {{#if (has-question-type f.model "form")}}
393
+ <f.input
394
+ @name="subForm.slug"
395
+ @label={{t "caluma.form-builder.question.subForm"}}
396
+ @required={{true}}
397
+ @on-update={{this.updateSubForm}}
398
+ @value={{find-by
399
+ "slug"
400
+ (changeset-get f.model "subForm.slug")
401
+ this.availableForms.lastSuccessful.value
402
+ }}
403
+ as |fi|
404
+ >
405
+ <PowerSelect
406
+ @options={{or this.availableForms.lastSuccessful.value array}}
407
+ @selected={{fi.value}}
408
+ @placeholder={{t "caluma.form-builder.question.choose"}}
409
+ @onBlur={{fi.setDirty}}
410
+ @onChange={{fi.update}}
411
+ @searchField="slug"
412
+ @searchEnabled={{true}}
413
+ @searchPlaceholder={{t
414
+ "caluma.form-builder.question.search-placeholder"
415
+ }}
416
+ @noMatchesMessage={{t "caluma.form-builder.question.search-empty"}}
417
+ as |form|
418
+ >
419
+ <span class="uk-width-auto uk-margin-small-right uk-text-truncate">
420
+ {{form.slug}}
421
+ </span>
422
+ <span
423
+ class="highlight-option uk-text-muted uk-width-expand uk-margin-small-right uk-text-small uk-text-truncate"
424
+ >
425
+ {{form.name}}
426
+ </span>
427
+ </PowerSelect>
428
+ </f.input>
429
+ {{/if}}
254
430
 
255
- {{#if
256
- (has-question-type f.model "dynamic-choice" "dynamic-multiple-choice")
257
- }}
258
431
  <f.input
259
- @name="dataSource"
432
+ @name="meta.widgetOverride"
433
+ @label={{t "caluma.form-builder.question.widgetOverride"}}
260
434
  @type="select"
261
- @required={{true}}
262
- @label={{t "caluma.form-builder.question.dataSource"}}
263
- @options={{or this.availableDataSources.lastSuccessful.value array}}
264
- @optionTargetPath="name"
265
- @optionLabelPath="info"
266
- @includeBlank={{t "caluma.form-builder.question.choose"}}
267
- class="uk-flex uk-flex-betwten uk-flex-column"
435
+ @allowClear={{true}}
436
+ @optionTargetPath="component"
437
+ @optionLabelPath="label"
438
+ @options={{this.availableOverrides}}
439
+ class="uk-flex uk-flex-between uk-flex-column"
268
440
  />
269
- {{/if}}
270
441
 
271
- <div data-test-hide-label>
272
442
  <f.input
273
- @name="meta.hideLabel"
443
+ @name="isArchived"
444
+ @label={{t "caluma.form-builder.question.isArchived"}}
274
445
  @required={{true}}
275
- @label={{t "caluma.form-builder.question.hideLabel"}}
276
446
  @renderComponent={{component "cfb-toggle-switch" size="small"}}
277
- @on-update={{changeset-set f.model "meta.hideLabel"}}
278
- @value={{changeset-get f.model "meta.hideLabel"}}
279
447
  class="uk-flex uk-flex-between uk-flex-column"
280
448
  />
281
- </div>
282
-
283
- {{#if (has-question-type f.model "table")}}
284
- <f.input
285
- @name="rowForm.slug"
286
- @label={{t "caluma.form-builder.question.rowForm"}}
287
- @required={{true}}
288
- @on-update={{action "updateRowForm"}}
289
- @value={{find-by
290
- "slug"
291
- (changeset-get f.model "rowForm.slug")
292
- this.availableForms.lastSuccessful.value
293
- }}
294
- as |fi|
295
- >
296
- <PowerSelect
297
- @options={{or this.availableForms.lastSuccessful.value array}}
298
- @selected={{fi.value}}
299
- @placeholder={{t "caluma.form-builder.question.choose"}}
300
- @onBlur={{fi.setDirty}}
301
- @onChange={{queue fi.update (fn (mut fi.value))}}
302
- @searchField="slug"
303
- @searchEnabled={{true}}
304
- @searchPlaceholder={{t
305
- "caluma.form-builder.question.search-placeholder"
306
- }}
307
- @noMatchesMessage={{t "caluma.form-builder.question.search-empty"}}
308
- as |form|
309
- >
310
- <span class="uk-width-auto uk-margin-small-right uk-text-truncate">
311
- {{form.slug}}
312
- </span>
313
- <span
314
- class="highlight-option uk-text-muted uk-width-expand uk-margin-small-right uk-text-small uk-text-truncate"
315
- >
316
- {{form.name}}
317
- </span>
318
- </PowerSelect>
319
- </f.input>
320
-
321
- <f.input
322
- @name="meta.columnsToDisplay"
323
- @label={{t "caluma.form-builder.question.columnsToDisplay"}}
324
- as |fi|
325
- >
326
- {{#each this.model.rowForm.questions.edges as |rowEdge|}}
327
- {{#let rowEdge.node as |row|}}
328
- <label class="cf-checkbox_label">
329
- <input
330
- type="checkbox"
331
- value={{row.slug}}
332
- checked={{includes row.slug this.model.meta.columnsToDisplay}}
333
- onclick={{action "toggleColumnToDisplay" row.slug}}
334
- onfocusout={{fi.setDirty}}
335
- class="uk-checkbox uk-margin-small-right"
336
- />
337
- {{row.label}}
338
- </label>
339
- {{/let}}
340
- {{/each}}
341
- </f.input>
342
- {{/if}}
343
449
 
344
- {{#if (has-question-type f.model "form")}}
345
- <f.input
346
- @name="subForm.slug"
347
- @label={{t "caluma.form-builder.question.subForm"}}
348
- @required={{true}}
349
- @on-update={{action "updateSubForm"}}
350
- @value={{find-by
351
- "slug"
352
- (changeset-get f.model "subForm.slug")
353
- this.availableForms.lastSuccessful.value
354
- }}
355
- as |fi|
450
+ <UkButton
451
+ @color="link"
452
+ @on-click={{toggle-action "showAdvanced" this}}
453
+ class="uk-flex uk-flex-middle uk-margin"
356
454
  >
357
- <PowerSelect
358
- @options={{or this.availableForms.lastSuccessful.value array}}
359
- @selected={{fi.value}}
360
- @placeholder={{t "caluma.form-builder.question.choose"}}
361
- @onBlur={{fi.setDirty}}
362
- @onChange={{queue fi.update (fn (mut fi.value))}}
363
- @searchField="slug"
364
- @searchEnabled={{true}}
365
- @searchPlaceholder={{t
366
- "caluma.form-builder.question.search-placeholder"
367
- }}
368
- @noMatchesMessage={{t "caluma.form-builder.question.search-empty"}}
369
- as |form|
370
- >
371
- <span class="uk-width-auto uk-margin-small-right uk-text-truncate">
372
- {{form.slug}}
373
- </span>
374
- <span
375
- class="highlight-option uk-text-muted uk-width-expand uk-margin-small-right uk-text-small uk-text-truncate"
376
- >
377
- {{form.name}}
378
- </span>
379
- </PowerSelect>
380
- </f.input>
381
- {{/if}}
382
-
383
- <f.input
384
- @name="meta.widgetOverride"
385
- @label={{t "caluma.form-builder.question.widgetOverride"}}
386
- @type="select"
387
- @allowClear={{true}}
388
- @optionTargetPath="component"
389
- @optionLabelPath="label"
390
- @options={{this.availableOverrides}}
391
- class="uk-flex uk-flex-between uk-flex-column"
392
- />
393
-
394
- <f.input
395
- @name="isArchived"
396
- @label={{t "caluma.form-builder.question.isArchived"}}
397
- @required={{true}}
398
- @renderComponent={{component "cfb-toggle-switch" size="small"}}
399
- class="uk-flex uk-flex-between uk-flex-column"
400
- />
401
-
402
- <p>
403
- <UkButton @color="link" @on-click={{toggle-action "showAdvanced" this}}>
404
455
  {{#if this.showAdvanced}}
405
456
  <UkIcon @icon="triangle-down" />
406
457
  {{else}}
@@ -408,32 +459,56 @@
408
459
  {{/if}}
409
460
  {{t "caluma.form-builder.question.advancedSettings"}}
410
461
  </UkButton>
411
- </p>
412
- {{#if this.showAdvanced}}
413
- <f.input
414
- @label={{t "caluma.form-builder.question.isHidden"}}
415
- @name="isHidden"
416
- @renderComponent={{component "cfb-code-editor" language="jexl"}}
417
- />
418
462
 
419
- {{#unless this.requiredIrrelevant}}
420
- <f.input
421
- @label={{t "caluma.form-builder.question.isRequired"}}
422
- @name="isRequired"
423
- @renderComponent={{component "cfb-code-editor" language="jexl"}}
424
- />
425
- {{/unless}}
426
- {{/if}}
463
+ {{#if this.showAdvanced}}
464
+ {{#if (has-question-type f.model "action-button")}}
465
+ <f.input
466
+ @name="validateOnEnter"
467
+ @required={{true}}
468
+ @label={{t "caluma.form-builder.question.validateOnEnter"}}
469
+ @renderComponent={{component "cfb-toggle-switch" size="small"}}
470
+ class="uk-flex uk-flex-between uk-flex-column"
471
+ />
472
+ {{/if}}
427
473
 
428
- <div class="uk-text-right">
429
- <f.submit @label={{t "caluma.form-builder.global.save"}} />
474
+ <div class="uk-margin">
475
+ <f.input
476
+ @label={{t "caluma.form-builder.question.isHidden"}}
477
+ @name="isHidden"
478
+ @renderComponent={{component "cfb-code-editor" language="jexl"}}
479
+ />
480
+ </div>
481
+
482
+ {{#if
483
+ (not
484
+ (has-question-type
485
+ f.model "static" "calculated-float" "action-button"
486
+ )
487
+ )
488
+ }}
489
+ <div class="uk-margin">
490
+ <f.input
491
+ @label={{t "caluma.form-builder.question.isRequired"}}
492
+ @name="isRequired"
493
+ @renderComponent={{component "cfb-code-editor" language="jexl"}}
494
+ />
495
+ </div>
496
+ {{/if}}
497
+ {{/if}}
498
+
499
+ <div class="uk-text-right">
500
+ <f.submit
501
+ @disabled={{or f.loading f.model.isInvalid}}
502
+ @label={{t "caluma.form-builder.global.save"}}
503
+ />
504
+ </div>
505
+ </ValidatedForm>
506
+ {{else}}
507
+ <div
508
+ class="uk-text-center uk-text-muted uk-padding uk-padding-remove-horizontal"
509
+ >
510
+ <UkIcon @icon="bolt" @ratio={{5}} />
511
+ <p>{{t "caluma.form-builder.question.not-found" slug=@slug}}</p>
430
512
  </div>
431
- </ValidatedForm>
432
- {{else}}
433
- <div
434
- class="uk-text-center uk-text-muted uk-padding uk-padding-remove-horizontal"
435
- >
436
- <UkIcon @icon="bolt" @ratio={{5}} />
437
- <p>{{t "caluma.form-builder.question.not-found" slug=@slug}}</p>
438
- </div>
439
- {{/if}}
513
+ {{/if}}
514
+ </div>