@projectcaluma/ember-form-builder 9.0.5 → 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.
- package/addon/components/cfb-float-input.hbs +14 -0
- package/addon/components/cfb-float-input.js +10 -4
- package/addon/components/cfb-form-editor/general.hbs +90 -86
- package/addon/components/cfb-form-editor/general.js +43 -45
- package/addon/components/cfb-form-editor/question/default.hbs +11 -9
- package/addon/components/cfb-form-editor/question/default.js +19 -29
- package/addon/components/cfb-form-editor/question/options.hbs +80 -82
- package/addon/components/cfb-form-editor/question/options.js +116 -105
- package/addon/components/cfb-form-editor/question/validation.hbs +14 -12
- package/addon/components/cfb-form-editor/question/validation.js +21 -30
- package/addon/components/cfb-form-editor/question-list/item.js +2 -4
- package/addon/components/cfb-form-editor/question.hbs +386 -360
- package/addon/components/cfb-form-editor/question.js +130 -138
- package/addon/components/cfb-form-list.hbs +1 -1
- package/addon/components/cfb-jexl-boolean-toggle-switch.hbs +12 -10
- package/addon/components/cfb-jexl-boolean-toggle-switch.js +11 -10
- package/addon/components/cfb-label.hbs +12 -4
- package/addon/components/cfb-toggle-switch.hbs +14 -12
- package/package.json +15 -15
- package/translations/de.yaml +2 -2
- package/translations/en.yaml +2 -2
- package/addon/components/cfb-float-input/input.js +0 -12
- package/addon/components/cfb-label.js +0 -5
- package/app/components/cfb-float-input/input.js +0 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { getOwner } from "@ember/application";
|
|
2
2
|
import { A } from "@ember/array";
|
|
3
|
-
import
|
|
4
|
-
import { computed, get } from "@ember/object";
|
|
5
|
-
import { reads } from "@ember/object/computed";
|
|
3
|
+
import { action } from "@ember/object";
|
|
6
4
|
import { inject as service } from "@ember/service";
|
|
7
5
|
import { camelize } from "@ember/string";
|
|
6
|
+
import Component from "@glimmer/component";
|
|
7
|
+
import { tracked } from "@glimmer/tracking";
|
|
8
8
|
import { queryManager } from "ember-apollo-client";
|
|
9
9
|
import Changeset from "ember-changeset";
|
|
10
10
|
import lookupValidator from "ember-changeset-validations";
|
|
11
11
|
import { optional } from "ember-composable-helpers/helpers/optional";
|
|
12
|
-
import { task, timeout } from "ember-concurrency";
|
|
12
|
+
import { dropTask, restartableTask, task, timeout } from "ember-concurrency";
|
|
13
13
|
import { all } from "rsvp";
|
|
14
14
|
|
|
15
|
+
import { hasQuestionType } from "@projectcaluma/ember-core/helpers/has-question-type";
|
|
15
16
|
import slugify from "@projectcaluma/ember-core/utils/slugify";
|
|
16
17
|
import addFormQuestionMutation from "@projectcaluma/ember-form-builder/gql/mutations/add-form-question.graphql";
|
|
17
18
|
import removeDefaultAnswerMutation from "@projectcaluma/ember-form-builder/gql/mutations/remove-default-answer.graphql";
|
|
@@ -68,33 +69,17 @@ const TYPES_ANSWER = {
|
|
|
68
69
|
TableAnswer: saveDefaultTableAnswerMutation,
|
|
69
70
|
};
|
|
70
71
|
|
|
71
|
-
export default Component
|
|
72
|
-
|
|
72
|
+
export default class CfbFormEditorQuestion extends Component {
|
|
73
|
+
@service notification;
|
|
74
|
+
@service intl;
|
|
75
|
+
@service calumaOptions;
|
|
76
|
+
@queryManager apollo;
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
intl: service(),
|
|
76
|
-
calumaOptions: service(),
|
|
78
|
+
@tracked linkSlug = true;
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
possibleTypes: computed(function () {
|
|
83
|
-
return Object.keys(TYPES).map((value) => ({
|
|
84
|
-
value,
|
|
85
|
-
label: this.intl.t(`caluma.form-builder.question.types.${value}`),
|
|
86
|
-
}));
|
|
87
|
-
}),
|
|
88
|
-
|
|
89
|
-
async didReceiveAttrs() {
|
|
90
|
-
this._super();
|
|
91
|
-
await this.data.perform();
|
|
92
|
-
await this.availableForms.perform();
|
|
93
|
-
await this.availableDataSources.perform();
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
data: task(function* () {
|
|
97
|
-
if (!this.slug) {
|
|
80
|
+
@restartableTask
|
|
81
|
+
*data() {
|
|
82
|
+
if (!this.args.slug) {
|
|
98
83
|
return A([
|
|
99
84
|
{
|
|
100
85
|
node: {
|
|
@@ -125,14 +110,15 @@ export default Component.extend({
|
|
|
125
110
|
return yield this.apollo.watchQuery(
|
|
126
111
|
{
|
|
127
112
|
query: formEditorQuestionQuery,
|
|
128
|
-
variables: { slug: this.slug },
|
|
113
|
+
variables: { slug: this.args.slug },
|
|
129
114
|
fetchPolicy: "cache-and-network",
|
|
130
115
|
},
|
|
131
116
|
"allQuestions.edges"
|
|
132
117
|
);
|
|
133
|
-
}
|
|
118
|
+
}
|
|
134
119
|
|
|
135
|
-
|
|
120
|
+
@restartableTask
|
|
121
|
+
*availableForms() {
|
|
136
122
|
const forms = yield this.apollo.watchQuery(
|
|
137
123
|
{
|
|
138
124
|
query: formListQuery,
|
|
@@ -147,10 +133,31 @@ export default Component.extend({
|
|
|
147
133
|
if (!forms.map) {
|
|
148
134
|
return [];
|
|
149
135
|
}
|
|
150
|
-
return forms.mapBy("node").filter((form) => form.slug !== this.form);
|
|
151
|
-
}
|
|
136
|
+
return forms.mapBy("node").filter((form) => form.slug !== this.args.form);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@restartableTask
|
|
140
|
+
*availableDataSources() {
|
|
141
|
+
const dataSources = yield this.apollo.watchQuery(
|
|
142
|
+
{ query: allDataSourcesQuery, fetchPolicy: "cache-and-network" },
|
|
143
|
+
"allDataSources.edges"
|
|
144
|
+
);
|
|
145
|
+
return dataSources.map((edge) => {
|
|
146
|
+
return {
|
|
147
|
+
...edge.node,
|
|
148
|
+
__typename: undefined,
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
get possibleTypes() {
|
|
154
|
+
return Object.keys(TYPES).map((value) => ({
|
|
155
|
+
value,
|
|
156
|
+
label: this.intl.t(`caluma.form-builder.question.types.${value}`),
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
152
159
|
|
|
153
|
-
availableOverrides
|
|
160
|
+
get availableOverrides() {
|
|
154
161
|
const type = this.changeset.get("__typename");
|
|
155
162
|
const overrides = this.calumaOptions
|
|
156
163
|
.getComponentOverrides()
|
|
@@ -162,54 +169,25 @@ export default Component.extend({
|
|
|
162
169
|
{ label: this.intl.t("caluma.form.power-select.null"), component: "" },
|
|
163
170
|
...overrides,
|
|
164
171
|
];
|
|
165
|
-
}
|
|
172
|
+
}
|
|
166
173
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
"allDataSources.edges"
|
|
171
|
-
);
|
|
172
|
-
return dataSources.map((edge) => {
|
|
173
|
-
return {
|
|
174
|
-
...edge.node,
|
|
175
|
-
__typename: undefined,
|
|
176
|
-
};
|
|
177
|
-
});
|
|
178
|
-
}).restartable(),
|
|
174
|
+
get model() {
|
|
175
|
+
return this.data.lastSuccessful?.value?.firstObject?.node;
|
|
176
|
+
}
|
|
179
177
|
|
|
180
|
-
|
|
178
|
+
get changeset() {
|
|
179
|
+
return new Changeset(this.model, lookupValidator(validations), validations);
|
|
180
|
+
}
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
return new Changeset(this.model, lookupValidator(validations));
|
|
184
|
-
}),
|
|
185
|
-
|
|
186
|
-
prefix: computed("calumaOptions.namespace", function () {
|
|
182
|
+
get prefix() {
|
|
187
183
|
return this.calumaOptions.namespace
|
|
188
184
|
? `${this.calumaOptions.namespace}-`
|
|
189
185
|
: "";
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
requiredIrrelevant: computed("changeset.__typename", function () {
|
|
193
|
-
return ["StaticQuestion", "CalculatedFloatQuestion"].includes(
|
|
194
|
-
this.changeset.__typename
|
|
195
|
-
);
|
|
196
|
-
}),
|
|
197
|
-
|
|
198
|
-
requiredToggleVisible: computed(
|
|
199
|
-
"changeset.isRequired",
|
|
200
|
-
"requiredIrrelevant",
|
|
201
|
-
function () {
|
|
202
|
-
// the required toggle is only shown if the JEXL is a simple boolean and
|
|
203
|
-
// it's not irrelevant since it's not a question that takes any input
|
|
204
|
-
return (
|
|
205
|
-
["true", "false"].includes(this.changeset.isRequired) &&
|
|
206
|
-
!this.requiredIrrelevant
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
),
|
|
186
|
+
}
|
|
210
187
|
|
|
211
188
|
getInput(changeset) {
|
|
212
|
-
const slug =
|
|
189
|
+
const slug =
|
|
190
|
+
((!this.args.slug && this.prefix) || "") + changeset.get("slug");
|
|
213
191
|
|
|
214
192
|
const input = {
|
|
215
193
|
slug,
|
|
@@ -220,7 +198,7 @@ export default Component.extend({
|
|
|
220
198
|
isArchived: changeset.get("isArchived"),
|
|
221
199
|
};
|
|
222
200
|
|
|
223
|
-
if (!
|
|
201
|
+
if (!hasQuestionType(changeset, "static", "calculated-float")) {
|
|
224
202
|
Object.assign(input, {
|
|
225
203
|
isRequired: changeset.get("isRequired"),
|
|
226
204
|
});
|
|
@@ -232,7 +210,7 @@ export default Component.extend({
|
|
|
232
210
|
}
|
|
233
211
|
|
|
234
212
|
return input;
|
|
235
|
-
}
|
|
213
|
+
}
|
|
236
214
|
|
|
237
215
|
_getIntegerQuestionInput(changeset) {
|
|
238
216
|
return {
|
|
@@ -240,7 +218,7 @@ export default Component.extend({
|
|
|
240
218
|
maxValue: parseInt(changeset.get("integerMaxValue")),
|
|
241
219
|
placeholder: changeset.get("placeholder"),
|
|
242
220
|
};
|
|
243
|
-
}
|
|
221
|
+
}
|
|
244
222
|
|
|
245
223
|
_getFloatQuestionInput(changeset) {
|
|
246
224
|
return {
|
|
@@ -248,7 +226,7 @@ export default Component.extend({
|
|
|
248
226
|
maxValue: parseFloat(changeset.get("floatMaxValue")),
|
|
249
227
|
placeholder: changeset.get("placeholder"),
|
|
250
228
|
};
|
|
251
|
-
}
|
|
229
|
+
}
|
|
252
230
|
|
|
253
231
|
_getTextQuestionInput(changeset) {
|
|
254
232
|
return {
|
|
@@ -256,7 +234,7 @@ export default Component.extend({
|
|
|
256
234
|
maxLength: parseInt(changeset.get("maxLength")),
|
|
257
235
|
placeholder: changeset.get("placeholder"),
|
|
258
236
|
};
|
|
259
|
-
}
|
|
237
|
+
}
|
|
260
238
|
|
|
261
239
|
_getTextareaQuestionInput(changeset) {
|
|
262
240
|
return {
|
|
@@ -264,59 +242,60 @@ export default Component.extend({
|
|
|
264
242
|
maxLength: parseInt(changeset.get("maxLength")),
|
|
265
243
|
placeholder: changeset.get("placeholder"),
|
|
266
244
|
};
|
|
267
|
-
}
|
|
245
|
+
}
|
|
268
246
|
|
|
269
247
|
_getMultipleChoiceQuestionInput(changeset) {
|
|
270
248
|
return {
|
|
271
249
|
options: changeset.get("options.edges").map(({ node: { slug } }) => slug),
|
|
272
250
|
};
|
|
273
|
-
}
|
|
251
|
+
}
|
|
274
252
|
|
|
275
253
|
_getChoiceQuestionInput(changeset) {
|
|
276
254
|
return {
|
|
277
255
|
options: changeset.get("options.edges").map(({ node: { slug } }) => slug),
|
|
278
256
|
};
|
|
279
|
-
}
|
|
257
|
+
}
|
|
280
258
|
|
|
281
259
|
_getDynamicMultipleChoiceQuestionInput(changeset) {
|
|
282
260
|
return {
|
|
283
261
|
dataSource: changeset.get("dataSource"),
|
|
284
262
|
};
|
|
285
|
-
}
|
|
263
|
+
}
|
|
286
264
|
|
|
287
265
|
_getDynamicChoiceQuestionInput(changeset) {
|
|
288
266
|
return {
|
|
289
267
|
dataSource: changeset.get("dataSource"),
|
|
290
268
|
};
|
|
291
|
-
}
|
|
269
|
+
}
|
|
292
270
|
|
|
293
271
|
_getTableQuestionInput(changeset) {
|
|
294
272
|
return {
|
|
295
273
|
rowForm: changeset.get("rowForm.slug"),
|
|
296
274
|
};
|
|
297
|
-
}
|
|
275
|
+
}
|
|
298
276
|
|
|
299
277
|
_getFormQuestionInput(changeset) {
|
|
300
278
|
return {
|
|
301
279
|
subForm: changeset.get("subForm.slug"),
|
|
302
280
|
};
|
|
303
|
-
}
|
|
281
|
+
}
|
|
304
282
|
|
|
305
283
|
_getStaticQuestionInput(changeset) {
|
|
306
284
|
return {
|
|
307
285
|
staticContent: changeset.get("staticContent"),
|
|
308
286
|
};
|
|
309
|
-
}
|
|
287
|
+
}
|
|
310
288
|
|
|
311
289
|
_getCalculatedFloatQuestionInput(changeset) {
|
|
312
290
|
return {
|
|
313
291
|
calcExpression: changeset.get("calcExpression"),
|
|
314
292
|
};
|
|
315
|
-
}
|
|
293
|
+
}
|
|
316
294
|
|
|
317
|
-
|
|
295
|
+
@task
|
|
296
|
+
*saveOptions(changeset) {
|
|
318
297
|
yield all(
|
|
319
|
-
(get(
|
|
298
|
+
(changeset.get("options.edges") || []).map(async ({ node: option }) => {
|
|
320
299
|
const { label, slug, isArchived } = option;
|
|
321
300
|
|
|
322
301
|
await this.apollo.mutate({
|
|
@@ -325,9 +304,10 @@ export default Component.extend({
|
|
|
325
304
|
});
|
|
326
305
|
})
|
|
327
306
|
);
|
|
328
|
-
}
|
|
307
|
+
}
|
|
329
308
|
|
|
330
|
-
|
|
309
|
+
@task
|
|
310
|
+
*saveDefaultAnswer(question, changeset) {
|
|
331
311
|
if (!changeset.get("defaultAnswer")) {
|
|
332
312
|
return;
|
|
333
313
|
}
|
|
@@ -357,9 +337,10 @@ export default Component.extend({
|
|
|
357
337
|
}
|
|
358
338
|
|
|
359
339
|
yield this.apollo.mutate({ mutation, variables: { input } });
|
|
360
|
-
}
|
|
340
|
+
}
|
|
361
341
|
|
|
362
|
-
|
|
342
|
+
@dropTask
|
|
343
|
+
*submit(changeset) {
|
|
363
344
|
try {
|
|
364
345
|
yield this.saveOptions.perform(changeset);
|
|
365
346
|
|
|
@@ -375,14 +356,14 @@ export default Component.extend({
|
|
|
375
356
|
|
|
376
357
|
yield this.saveDefaultAnswer.perform(question, changeset);
|
|
377
358
|
|
|
378
|
-
if (!this.slug) {
|
|
359
|
+
if (!this.args.slug) {
|
|
379
360
|
// This is a new question which must be added to the form after creating it
|
|
380
361
|
yield this.apollo.mutate({
|
|
381
362
|
mutation: addFormQuestionMutation,
|
|
382
363
|
variables: {
|
|
383
364
|
input: {
|
|
384
365
|
question: question.slug,
|
|
385
|
-
form: this.form,
|
|
366
|
+
form: this.args.form,
|
|
386
367
|
},
|
|
387
368
|
search: "",
|
|
388
369
|
},
|
|
@@ -393,7 +374,7 @@ export default Component.extend({
|
|
|
393
374
|
this.intl.t("caluma.form-builder.notification.question.save.success")
|
|
394
375
|
);
|
|
395
376
|
|
|
396
|
-
optional([this.
|
|
377
|
+
optional([this.args["on-after-submit"]])(question);
|
|
397
378
|
} catch (e) {
|
|
398
379
|
// eslint-disable-next-line no-console
|
|
399
380
|
console.error(e);
|
|
@@ -401,9 +382,10 @@ export default Component.extend({
|
|
|
401
382
|
this.intl.t("caluma.form-builder.notification.question.save.error")
|
|
402
383
|
);
|
|
403
384
|
}
|
|
404
|
-
}
|
|
385
|
+
}
|
|
405
386
|
|
|
406
|
-
|
|
387
|
+
@restartableTask
|
|
388
|
+
*validateSlug(slug, changeset) {
|
|
407
389
|
/* istanbul ignore next */
|
|
408
390
|
if (
|
|
409
391
|
getOwner(this).resolveRegistration("config:environment").environment !==
|
|
@@ -426,46 +408,56 @@ export default Component.extend({
|
|
|
426
408
|
this.intl.t("caluma.form-builder.validations.question.slug")
|
|
427
409
|
);
|
|
428
410
|
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
actions: {
|
|
432
|
-
updateLabel(value, changeset) {
|
|
433
|
-
changeset.set("label", value);
|
|
434
|
-
|
|
435
|
-
if (!this.slug && this.linkSlug) {
|
|
436
|
-
const slug = slugify(value, { locale: this.intl.primaryLocale });
|
|
437
|
-
|
|
438
|
-
changeset.set("slug", slug);
|
|
439
|
-
|
|
440
|
-
this.validateSlug.perform(this.prefix + slug, changeset);
|
|
441
|
-
}
|
|
442
|
-
},
|
|
411
|
+
}
|
|
443
412
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
/*
|
|
452
|
-
* This function adds the selected slugs to the columns to display
|
|
453
|
-
* list if it isnt present, otherwise it will remove the slug.
|
|
454
|
-
*/
|
|
455
|
-
toggleColumnToDisplay(value) {
|
|
456
|
-
const displayed = new Set(this.changeset.get("meta.columnsToDisplay"));
|
|
413
|
+
@action
|
|
414
|
+
async fetchData() {
|
|
415
|
+
await this.data.perform();
|
|
416
|
+
await this.availableForms.perform();
|
|
417
|
+
await this.availableDataSources.perform();
|
|
418
|
+
}
|
|
457
419
|
|
|
458
|
-
|
|
420
|
+
@action
|
|
421
|
+
updateLabel(value, changeset) {
|
|
422
|
+
changeset.set("label", value);
|
|
459
423
|
|
|
460
|
-
|
|
461
|
-
|
|
424
|
+
if (!this.args.slug && this.linkSlug) {
|
|
425
|
+
const slug = slugify(value, { locale: this.intl.primaryLocale });
|
|
462
426
|
|
|
463
|
-
|
|
464
|
-
changeset.set("subForm.slug", value.slug);
|
|
465
|
-
},
|
|
427
|
+
changeset.set("slug", slug);
|
|
466
428
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
429
|
+
this.validateSlug.perform(this.prefix + slug, changeset);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
@action
|
|
434
|
+
updateSlug(value, changeset) {
|
|
435
|
+
changeset.set("slug", value);
|
|
436
|
+
this.linkSlug = false;
|
|
437
|
+
|
|
438
|
+
this.validateSlug.perform(this.prefix + value, changeset);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/*
|
|
442
|
+
* This function adds the selected slugs to the columns to display
|
|
443
|
+
* list if it isnt present, otherwise it will remove the slug.
|
|
444
|
+
*/
|
|
445
|
+
@action
|
|
446
|
+
toggleColumnToDisplay(value, changeset) {
|
|
447
|
+
const displayed = new Set(changeset.get("meta.columnsToDisplay"));
|
|
448
|
+
|
|
449
|
+
displayed.delete(value) || displayed.add(value);
|
|
450
|
+
|
|
451
|
+
changeset.set("meta.columnsToDisplay", [...displayed]);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
@action
|
|
455
|
+
updateSubForm(value, changeset) {
|
|
456
|
+
changeset.set("subForm.slug", value.slug);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
@action
|
|
460
|
+
updateRowForm(value, changeset) {
|
|
461
|
+
changeset.set("rowForm.slug", value.slug);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</form>
|
|
40
40
|
{{#if this.formsQuery.isLoading}}
|
|
41
41
|
<div class="uk-height-small uk-flex uk-flex-center uk-flex-middle">
|
|
42
|
-
|
|
42
|
+
<UkSpinner ratio="2" />
|
|
43
43
|
</div>
|
|
44
44
|
{{else if this.formsQuery.value.length}}
|
|
45
45
|
<ul data-test-form-list class="uk-list uk-list-divider uk-list-large">
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
labelComponent=labelComponent
|
|
3
|
-
hintComponent=hintComponent
|
|
4
|
-
errorComponent=errorComponent
|
|
5
|
-
|
|
6
|
-
size=size
|
|
7
|
-
name=name
|
|
8
|
-
|
|
9
|
-
update=
|
|
10
|
-
}}
|
|
1
|
+
<CfbToggleSwitch
|
|
2
|
+
@labelComponent={{@labelComponent}}
|
|
3
|
+
@hintComponent={{@hintComponent}}
|
|
4
|
+
@errorComponent={{@errorComponent}}
|
|
5
|
+
@disabled={{@disabled}}
|
|
6
|
+
@size={{@size}}
|
|
7
|
+
@name={{@name}}
|
|
8
|
+
@value={{this.boolValue}}
|
|
9
|
+
@update={{this.toggle}}
|
|
10
|
+
@noMargin={{true}}
|
|
11
|
+
class="uk-flex uk-flex-middle uk-height-1-1"
|
|
12
|
+
/>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { action } from "@ember/object";
|
|
2
|
+
import Component from "@glimmer/component";
|
|
3
3
|
|
|
4
|
-
export default
|
|
5
|
-
boolValue
|
|
4
|
+
export default class CfbJexlBooleanToggleSwitch extends Component {
|
|
5
|
+
get boolValue() {
|
|
6
|
+
return this.args.value === "true";
|
|
7
|
+
}
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
9
|
+
@action
|
|
10
|
+
toggle(boolValue) {
|
|
11
|
+
this.args.update(String(boolValue));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<label
|
|
2
|
+
class="uk-form-label uk-flex uk-flex-between"
|
|
3
|
+
for={{@inputId}}
|
|
4
|
+
...attributes
|
|
5
|
+
>
|
|
6
|
+
{{yield}}{{@label}}
|
|
7
|
+
{{#unless @required}}
|
|
8
|
+
<span class="uk-text-muted uk-text-lowercase">
|
|
9
|
+
({{t "caluma.form-builder.global.optional"}})
|
|
10
|
+
</span>
|
|
11
|
+
{{/unless}}
|
|
12
|
+
</label>
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
<div class="uk-flex uk-flex-column {{unless @noMargin "uk-margin"}}">
|
|
2
|
+
<@labelComponent />
|
|
2
3
|
|
|
3
|
-
<div class="uk-form-controls">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
</div>
|
|
4
|
+
<div class="uk-form-controls" ...attributes>
|
|
5
|
+
<UkToggleSwitch
|
|
6
|
+
@value={{@value}}
|
|
7
|
+
@size={{@size}}
|
|
8
|
+
@name={{@name}}
|
|
9
|
+
@disabled={{@disabled}}
|
|
10
|
+
@on-toggle={{@update}}
|
|
11
|
+
/>
|
|
12
|
+
</div>
|
|
12
13
|
|
|
13
|
-
<@hintComponent />
|
|
14
|
-
<@errorComponent />
|
|
14
|
+
<@hintComponent />
|
|
15
|
+
<@errorComponent />
|
|
16
|
+
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-form-builder",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.6",
|
|
4
4
|
"description": "Ember engine for building Caluma forms.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"@ember/render-modifiers": "^2.0.0",
|
|
19
19
|
"@glimmer/component": "^1.0.4",
|
|
20
20
|
"@glimmer/tracking": "^1.0.4",
|
|
21
|
-
"@projectcaluma/ember-core": "9.0
|
|
22
|
-
"@projectcaluma/ember-form": "9.1.
|
|
21
|
+
"@projectcaluma/ember-core": "9.1.0",
|
|
22
|
+
"@projectcaluma/ember-form": "9.1.2",
|
|
23
23
|
"codejar": "^3.5.0",
|
|
24
24
|
"ember-apollo-client": "^3.2.0",
|
|
25
|
-
"ember-auto-import": "^2.2.
|
|
25
|
+
"ember-auto-import": "^2.2.3",
|
|
26
26
|
"ember-changeset": "^3.15.0",
|
|
27
27
|
"ember-changeset-validations": "^3.16.0",
|
|
28
28
|
"ember-cli-babel": "^7.26.6",
|
|
29
|
-
"ember-cli-htmlbars": "^
|
|
29
|
+
"ember-cli-htmlbars": "^6.0.0",
|
|
30
30
|
"ember-composable-helpers": "^4.5.0",
|
|
31
|
-
"ember-concurrency": "^2.
|
|
31
|
+
"ember-concurrency": "^2.2.0",
|
|
32
32
|
"ember-concurrency-decorators": "^2.0.3",
|
|
33
33
|
"ember-engines-router-service": "^0.3.0",
|
|
34
34
|
"ember-fetch": "^8.0.4",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"ember-power-select": "^4.1.6",
|
|
38
38
|
"ember-test-selectors": "^6.0.0",
|
|
39
39
|
"ember-uikit": "^4.0.0",
|
|
40
|
-
"ember-validated-form": "^
|
|
41
|
-
"graphql": "^15.6.
|
|
40
|
+
"ember-validated-form": "^5.0.0",
|
|
41
|
+
"graphql": "^15.6.1",
|
|
42
42
|
"graphql-tag": "^2.12.5",
|
|
43
43
|
"jexl": "^2.3.0",
|
|
44
44
|
"moment": "^2.29.1",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@ember/optional-features": "2.0.0",
|
|
49
|
-
"@ember/test-helpers": "2.
|
|
50
|
-
"@embroider/test-setup": "0.
|
|
49
|
+
"@ember/test-helpers": "2.6.0",
|
|
50
|
+
"@embroider/test-setup": "0.47.1",
|
|
51
51
|
"@projectcaluma/ember-testing": "9.0.0",
|
|
52
52
|
"broccoli-asset-rev": "3.0.0",
|
|
53
|
-
"ember-cli": "3.28.
|
|
53
|
+
"ember-cli": "3.28.3",
|
|
54
54
|
"ember-cli-code-coverage": "1.0.3",
|
|
55
55
|
"ember-cli-dependency-checker": "3.2.0",
|
|
56
56
|
"ember-cli-inject-live-reload": "2.1.0",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"ember-cli-terser": "4.0.2",
|
|
60
60
|
"ember-data": "3.28.3",
|
|
61
61
|
"ember-disable-prototype-extensions": "1.1.3",
|
|
62
|
-
"ember-engines": "0.8.
|
|
62
|
+
"ember-engines": "0.8.20",
|
|
63
63
|
"ember-export-application-global": "2.0.1",
|
|
64
64
|
"ember-load-initializers": "2.1.2",
|
|
65
65
|
"ember-maybe-import-regenerator": "1.0.0",
|
|
66
|
-
"ember-qunit": "5.1.
|
|
66
|
+
"ember-qunit": "5.1.5",
|
|
67
67
|
"ember-resolver": "8.0.3",
|
|
68
|
-
"ember-source": "3.28.
|
|
68
|
+
"ember-source": "3.28.6",
|
|
69
69
|
"ember-source-channel-url": "3.0.0",
|
|
70
70
|
"ember-try": "1.4.0",
|
|
71
71
|
"faker": "5.5.3",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"npm-run-all": "4.1.5",
|
|
74
74
|
"qunit": "2.17.2",
|
|
75
75
|
"qunit-dom": "2.0.0",
|
|
76
|
-
"webpack": "5.
|
|
76
|
+
"webpack": "5.61.0"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": "10.* || >= 12"
|
package/translations/de.yaml
CHANGED
|
@@ -75,8 +75,8 @@ caluma:
|
|
|
75
75
|
choose: "-- bitte wählen --"
|
|
76
76
|
search-placeholder: "Hier tippen um zu suchen"
|
|
77
77
|
search-empty: "Keine Formulare gefunden"
|
|
78
|
-
columnsToDisplay: "Spalten zur Anzeige
|
|
79
|
-
calcExpression: "Berechnungsformel"
|
|
78
|
+
columnsToDisplay: "Spalten zur Anzeige im Formular"
|
|
79
|
+
calcExpression: "Berechnungsformel (JEXL)"
|
|
80
80
|
|
|
81
81
|
new: "Neue Frage"
|
|
82
82
|
|
package/translations/en.yaml
CHANGED
|
@@ -75,8 +75,8 @@ caluma:
|
|
|
75
75
|
choose: "-- please choose --"
|
|
76
76
|
search-placeholder: "Type here to search forms"
|
|
77
77
|
search-empty: "Search didn't match any forms"
|
|
78
|
-
columnsToDisplay: "
|
|
79
|
-
calcExpression: "Calculation formula"
|
|
78
|
+
columnsToDisplay: "Columns to be shown in the form"
|
|
79
|
+
calcExpression: "Calculation formula (JEXL)"
|
|
80
80
|
|
|
81
81
|
new: "New question"
|
|
82
82
|
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import InputComponent from "ember-validated-form/components/validated-input/types/-themes/uikit/input";
|
|
2
|
-
|
|
3
|
-
export default InputComponent.extend({
|
|
4
|
-
init(...args) {
|
|
5
|
-
this._super(...args);
|
|
6
|
-
|
|
7
|
-
this.set("type", "number");
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
attributeBindings: ["step"],
|
|
11
|
-
step: "any",
|
|
12
|
-
});
|