@projectcaluma/ember-form-builder 9.0.2 → 9.0.6

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 (33) hide show
  1. package/addon/components/cfb-float-input.hbs +14 -0
  2. package/addon/components/cfb-float-input.js +10 -4
  3. package/addon/components/cfb-form-editor/general.hbs +90 -86
  4. package/addon/components/cfb-form-editor/general.js +43 -45
  5. package/addon/components/cfb-form-editor/question/default/table.js +12 -0
  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 +21 -30
  12. package/addon/components/cfb-form-editor/question-list/item.js +2 -4
  13. package/addon/components/cfb-form-editor/question.hbs +386 -360
  14. package/addon/components/cfb-form-editor/question.js +136 -145
  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-navigation.js +1 -1
  20. package/addon/components/cfb-toggle-switch.hbs +14 -12
  21. package/addon/controllers/edit/questions/edit.js +4 -1
  22. package/addon/controllers/edit/questions/new.js +4 -1
  23. package/addon/controllers/edit.js +4 -4
  24. package/addon/controllers/index.js +5 -2
  25. package/addon/controllers/new.js +4 -1
  26. package/addon/engine.js +1 -8
  27. package/addon/validators/gt-lt.js +3 -2
  28. package/app/components/{cfb-float-input/input.js → cfb-form-editor/question/default/table.js} +1 -1
  29. package/package.json +18 -16
  30. package/translations/de.yaml +2 -2
  31. package/translations/en.yaml +2 -2
  32. package/addon/components/cfb-float-input/input.js +0 -12
  33. package/addon/components/cfb-label.js +0 -5
@@ -1,88 +1,96 @@
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 f.model "static" "calculated-float")
90
+ (not (includes f.model.isRequired (array "true" "false")))
91
+ )
92
+ )
93
+ }}
86
94
  <f.input
87
95
  @name="isRequired"
88
96
  @label={{t "caluma.form-builder.question.isRequired"}}
@@ -91,32 +99,50 @@
91
99
  "cfb-jexl-boolean-toggle-switch"
92
100
  size="small"
93
101
  }}
94
- class="uk-flex uk-flex-between uk-flex-column"
95
102
  />
96
- </div>
103
+ {{/if}}
104
+ </div>
105
+
106
+ {{#if (has-question-type f.model "calculated-float")}}
107
+ <f.input
108
+ @label={{t "caluma.form-builder.question.calcExpression"}}
109
+ @name="calcExpression"
110
+ @renderComponent={{component "cfb-code-editor" language="jexl"}}
111
+ />
97
112
  {{/if}}
98
- </div>
99
113
 
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}}
114
+ {{#if (has-question-type f.model "static")}}
115
+ <div class="uk-margin">
116
+ <f.input
117
+ @label={{t "caluma.form-builder.question.staticContent"}}
118
+ @name="staticContent"
119
+ @renderComponent={{component
120
+ "cfb-code-editor"
121
+ language="markdown"
122
+ className="uk-margin-remove-bottom"
123
+ }}
124
+ class="uk-margin-remove-bottom"
125
+ />
126
+ <small class="uk-text-muted">
127
+ {{t "caluma.form-builder.question.supportsMarkdownPrefix"}}
128
+ <a
129
+ target="_blank"
130
+ rel="noopener noreferrer"
131
+ href="https://www.markdownguide.org/basic-syntax"
132
+ >{{t "caluma.form-builder.question.markdown"}}</a>
133
+ </small>
134
+ </div>
135
+ {{/if}}
108
136
 
109
- {{#if (has-question-type f.model "static")}}
110
137
  <div class="uk-margin">
111
138
  <f.input
112
- @label={{t "caluma.form-builder.question.staticContent"}}
113
- @name="staticContent"
139
+ @label={{t "caluma.form-builder.question.infoText"}}
140
+ @name="infoText"
114
141
  @renderComponent={{component
115
142
  "cfb-code-editor"
116
143
  language="markdown"
117
144
  className="uk-margin-remove-bottom"
118
145
  }}
119
- class="uk-margin-remove-bottom"
120
146
  />
121
147
  <small class="uk-text-muted">
122
148
  {{t "caluma.form-builder.question.supportsMarkdownPrefix"}}
@@ -127,148 +153,125 @@
127
153
  >{{t "caluma.form-builder.question.markdown"}}</a>
128
154
  </small>
129
155
  </div>
130
- {{/if}}
131
-
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>
151
156
 
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}}
157
+ {{#if (has-question-type f.model "text" "textarea" "integer" "float")}}
158
+ <f.input
159
+ @name="placeholder"
160
+ @label={{t "caluma.form-builder.question.placeholder"}}
161
+ />
162
+ {{/if}}
158
163
 
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"
164
+ {{#if
165
+ (and
166
+ @slug
167
+ (has-question-type
168
+ f.model
169
+ "text"
170
+ "textarea"
171
+ "integer"
172
+ "float"
173
+ "choice"
174
+ "multiple-choice"
175
+ "date"
176
+ "table"
177
+ )
172
178
  )
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}}
179
+ }}
180
+ <f.input
181
+ @name="defaultAnswer"
182
+ @label={{t "caluma.form-builder.question.defaultValue"}}
183
+ @renderComponent={{component "cfb-form-editor/question/default"}}
184
+ />
185
+ {{/if}}
181
186
 
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
- />
187
+ {{#if (has-question-type f.model "text" "textarea")}}
188
+ <f.input
189
+ @type="number"
190
+ @name="minLength"
191
+ @label={{t "caluma.form-builder.question.min-length"}}
192
+ />
188
193
 
189
- <f.input
190
- @type="number"
191
- @name="maxLength"
192
- @label={{t "caluma.form-builder.question.max-length"}}
193
- />
194
+ <f.input
195
+ @type="number"
196
+ @name="maxLength"
197
+ @label={{t "caluma.form-builder.question.max-length"}}
198
+ />
194
199
 
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}}
200
+ <f.input
201
+ @name="meta.formatValidators"
202
+ @label={{t "caluma.form-builder.question.formatValidators"}}
203
+ @placeholder={{t "caluma.form-builder.question.choose"}}
204
+ @required={{false}}
205
+ @renderComponent={{component "cfb-form-editor/question/validation"}}
206
+ @on-update={{changeset-set f.model "meta.formatValidators"}}
207
+ @value={{changeset-get f.model "meta.formatValidators"}}
208
+ />
209
+ {{/if}}
205
210
 
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
- />
214
- </div>
211
+ {{#if (has-question-type f.model "float")}}
212
+ <div uk-grid class="uk-grid-small uk-child-width-1-2 uk-margin">
213
+ <div>
214
+ <f.input
215
+ @name="floatMinValue"
216
+ @label={{t "caluma.form-builder.question.min-value"}}
217
+ @renderComponent={{component "cfb-float-input"}}
218
+ />
219
+ </div>
215
220
 
216
- <div>
217
- <f.input
218
- @name="floatMaxValue"
219
- @label={{t "caluma.form-builder.question.max-value"}}
220
- @renderComponent={{component "cfb-float-input"}}
221
- />
221
+ <div>
222
+ <f.input
223
+ @name="floatMaxValue"
224
+ @label={{t "caluma.form-builder.question.max-value"}}
225
+ @renderComponent={{component "cfb-float-input"}}
226
+ />
227
+ </div>
222
228
  </div>
223
- </div>
224
- {{/if}}
229
+ {{/if}}
225
230
 
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
- />
234
- </div>
231
+ {{#if (has-question-type f.model "integer")}}
232
+ <div uk-grid class="uk-grid-small uk-child-width-1-2 uk-margin">
233
+ <div>
234
+ <f.input
235
+ @type="number"
236
+ @name="integerMinValue"
237
+ @label={{t "caluma.form-builder.question.min-value"}}
238
+ />
239
+ </div>
235
240
 
236
- <div>
237
- <f.input
238
- @type="number"
239
- @name="integerMaxValue"
240
- @label={{t "caluma.form-builder.question.max-value"}}
241
- />
241
+ <div>
242
+ <f.input
243
+ @type="number"
244
+ @name="integerMaxValue"
245
+ @label={{t "caluma.form-builder.question.max-value"}}
246
+ />
247
+ </div>
242
248
  </div>
243
- </div>
244
- {{/if}}
249
+ {{/if}}
245
250
 
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}}
251
+ {{#if (has-question-type f.model "choice" "multiple-choice")}}
252
+ <f.input
253
+ @name="options"
254
+ @label={{t "caluma.form-builder.question.options"}}
255
+ @required={{true}}
256
+ @renderComponent={{component "cfb-form-editor/question/options"}}
257
+ />
258
+ {{/if}}
254
259
 
255
- {{#if
256
- (has-question-type f.model "dynamic-choice" "dynamic-multiple-choice")
257
- }}
258
- <f.input
259
- @name="dataSource"
260
- @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"
268
- />
269
- {{/if}}
260
+ {{#if
261
+ (has-question-type f.model "dynamic-choice" "dynamic-multiple-choice")
262
+ }}
263
+ <f.input
264
+ @name="dataSource"
265
+ @type="select"
266
+ @required={{true}}
267
+ @label={{t "caluma.form-builder.question.dataSource"}}
268
+ @options={{or this.availableDataSources.lastSuccessful.value array}}
269
+ @optionTargetPath="name"
270
+ @optionLabelPath="info"
271
+ @includeBlank={{t "caluma.form-builder.question.choose"}}
272
+ />
273
+ {{/if}}
270
274
 
271
- <div data-test-hide-label>
272
275
  <f.input
273
276
  @name="meta.hideLabel"
274
277
  @required={{true}}
@@ -276,131 +279,146 @@
276
279
  @renderComponent={{component "cfb-toggle-switch" size="small"}}
277
280
  @on-update={{changeset-set f.model "meta.hideLabel"}}
278
281
  @value={{changeset-get f.model "meta.hideLabel"}}
279
- class="uk-flex uk-flex-between uk-flex-column"
280
282
  />
281
- </div>
282
283
 
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"
284
+ {{#if (has-question-type f.model "table")}}
285
+ <div class="uk-margin">
286
+ <f.input
287
+ @name="rowForm.slug"
288
+ @label={{t "caluma.form-builder.question.rowForm"}}
289
+ @required={{true}}
290
+ @on-update={{this.updateRowForm}}
291
+ @value={{find-by
292
+ "slug"
293
+ (changeset-get f.model "rowForm.slug")
294
+ this.availableForms.lastSuccessful.value
295
+ }}
296
+ as |fi|
315
297
  >
316
- {{form.name}}
317
- </span>
318
- </PowerSelect>
319
- </f.input>
298
+ <PowerSelect
299
+ @options={{or this.availableForms.lastSuccessful.value array}}
300
+ @selected={{fi.value}}
301
+ @placeholder={{t "caluma.form-builder.question.choose"}}
302
+ @onBlur={{fi.setDirty}}
303
+ @onChange={{fi.update}}
304
+ @searchField="slug"
305
+ @searchEnabled={{true}}
306
+ @searchPlaceholder={{t
307
+ "caluma.form-builder.question.search-placeholder"
308
+ }}
309
+ @noMatchesMessage={{t
310
+ "caluma.form-builder.question.search-empty"
311
+ }}
312
+ as |form|
313
+ >
314
+ <span
315
+ class="uk-width-auto uk-margin-small-right uk-text-truncate"
316
+ >
317
+ {{form.slug}}
318
+ </span>
319
+ <span
320
+ class="highlight-option uk-text-muted uk-width-expand uk-margin-small-right uk-text-small uk-text-truncate"
321
+ >
322
+ {{form.name}}
323
+ </span>
324
+ </PowerSelect>
325
+ </f.input>
326
+ </div>
320
327
 
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}}
328
+ {{#if @slug}}
329
+ <div class="uk-margin">
330
+ <f.input
331
+ @name="meta.columnsToDisplay"
332
+ @label={{t "caluma.form-builder.question.columnsToDisplay"}}
333
+ >
334
+ {{#each this.model.rowForm.questions.edges as |rowEdge|}}
335
+ {{#let rowEdge.node as |row|}}
336
+ <label class="cf-checkbox_label">
337
+ <input
338
+ type="checkbox"
339
+ value={{row.slug}}
340
+ checked={{includes
341
+ row.slug
342
+ this.model.meta.columnsToDisplay
343
+ }}
344
+ class="uk-checkbox uk-margin-small-right"
345
+ {{on
346
+ "change"
347
+ (fn this.toggleColumnToDisplay row.slug f.model)
348
+ }}
349
+ />
350
+ {{row.label}}
351
+ </label>
352
+ {{/let}}
353
+ {{/each}}
354
+ </f.input>
355
+ </div>
356
+ {{/if}}
357
+ {{/if}}
343
358
 
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|
356
- >
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"
359
+ {{#if (has-question-type f.model "form")}}
360
+ <f.input
361
+ @name="subForm.slug"
362
+ @label={{t "caluma.form-builder.question.subForm"}}
363
+ @required={{true}}
364
+ @on-update={{this.updateSubForm}}
365
+ @value={{find-by
366
+ "slug"
367
+ (changeset-get f.model "subForm.slug")
368
+ this.availableForms.lastSuccessful.value
367
369
  }}
368
- @noMatchesMessage={{t "caluma.form-builder.question.search-empty"}}
369
- as |form|
370
+ as |fi|
370
371
  >
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"
372
+ <PowerSelect
373
+ @options={{or this.availableForms.lastSuccessful.value array}}
374
+ @selected={{fi.value}}
375
+ @placeholder={{t "caluma.form-builder.question.choose"}}
376
+ @onBlur={{fi.setDirty}}
377
+ @onChange={{fi.update}}
378
+ @searchField="slug"
379
+ @searchEnabled={{true}}
380
+ @searchPlaceholder={{t
381
+ "caluma.form-builder.question.search-placeholder"
382
+ }}
383
+ @noMatchesMessage={{t "caluma.form-builder.question.search-empty"}}
384
+ as |form|
376
385
  >
377
- {{form.name}}
378
- </span>
379
- </PowerSelect>
380
- </f.input>
381
- {{/if}}
386
+ <span class="uk-width-auto uk-margin-small-right uk-text-truncate">
387
+ {{form.slug}}
388
+ </span>
389
+ <span
390
+ class="highlight-option uk-text-muted uk-width-expand uk-margin-small-right uk-text-small uk-text-truncate"
391
+ >
392
+ {{form.name}}
393
+ </span>
394
+ </PowerSelect>
395
+ </f.input>
396
+ {{/if}}
382
397
 
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
- />
398
+ <f.input
399
+ @name="meta.widgetOverride"
400
+ @label={{t "caluma.form-builder.question.widgetOverride"}}
401
+ @type="select"
402
+ @allowClear={{true}}
403
+ @optionTargetPath="component"
404
+ @optionLabelPath="label"
405
+ @options={{this.availableOverrides}}
406
+ class="uk-flex uk-flex-between uk-flex-column"
407
+ />
393
408
 
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
- />
409
+ <f.input
410
+ @name="isArchived"
411
+ @label={{t "caluma.form-builder.question.isArchived"}}
412
+ @required={{true}}
413
+ @renderComponent={{component "cfb-toggle-switch" size="small"}}
414
+ class="uk-flex uk-flex-between uk-flex-column"
415
+ />
401
416
 
402
- <p>
403
- <UkButton @color="link" @on-click={{toggle-action "showAdvanced" this}}>
417
+ <UkButton
418
+ @color="link"
419
+ @on-click={{toggle-action "showAdvanced" this}}
420
+ class="uk-flex uk-flex-middle uk-margin"
421
+ >
404
422
  {{#if this.showAdvanced}}
405
423
  <UkIcon @icon="triangle-down" />
406
424
  {{else}}
@@ -408,32 +426,40 @@
408
426
  {{/if}}
409
427
  {{t "caluma.form-builder.question.advancedSettings"}}
410
428
  </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
429
 
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}}
430
+ {{#if this.showAdvanced}}
431
+ <div class="uk-margin">
432
+ <f.input
433
+ @label={{t "caluma.form-builder.question.isHidden"}}
434
+ @name="isHidden"
435
+ @renderComponent={{component "cfb-code-editor" language="jexl"}}
436
+ />
437
+ </div>
427
438
 
428
- <div class="uk-text-right">
429
- <f.submit @label={{t "caluma.form-builder.global.save"}} />
439
+ {{#if (not (has-question-type f.model "static" "calculated-float"))}}
440
+ <div class="uk-margin">
441
+ <f.input
442
+ @label={{t "caluma.form-builder.question.isRequired"}}
443
+ @name="isRequired"
444
+ @renderComponent={{component "cfb-code-editor" language="jexl"}}
445
+ />
446
+ </div>
447
+ {{/if}}
448
+ {{/if}}
449
+
450
+ <div class="uk-text-right">
451
+ <f.submit
452
+ @disabled={{or f.loading f.model.isInvalid}}
453
+ @label={{t "caluma.form-builder.global.save"}}
454
+ />
455
+ </div>
456
+ </ValidatedForm>
457
+ {{else}}
458
+ <div
459
+ class="uk-text-center uk-text-muted uk-padding uk-padding-remove-horizontal"
460
+ >
461
+ <UkIcon @icon="bolt" @ratio={{5}} />
462
+ <p>{{t "caluma.form-builder.question.not-found" slug=@slug}}</p>
430
463
  </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}}
464
+ {{/if}}
465
+ </div>