@projectcaluma/ember-form-builder 12.1.0 → 12.3.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.
@@ -46,7 +46,7 @@ export default class CfbFormEditorGeneral extends Component {
46
46
  variables: { slug: this.args.slug },
47
47
  fetchPolicy: "cache-and-network",
48
48
  },
49
- "allForms.edges"
49
+ "allForms.edges",
50
50
  );
51
51
  }
52
52
 
@@ -72,15 +72,15 @@ export default class CfbFormEditorGeneral extends Component {
72
72
  },
73
73
  },
74
74
  },
75
- "saveForm.form"
75
+ "saveForm.form",
76
76
  );
77
77
 
78
78
  this.notification.success(
79
79
  this.intl.t(
80
80
  `caluma.form-builder.notification.form.${
81
81
  this.args.slug ? "save" : "create"
82
- }.success`
83
- )
82
+ }.success`,
83
+ ),
84
84
  );
85
85
 
86
86
  this.args.onAfterSubmit?.(form);
@@ -89,8 +89,8 @@ export default class CfbFormEditorGeneral extends Component {
89
89
  this.intl.t(
90
90
  `caluma.form-builder.notification.form.${
91
91
  this.args.slug ? "save" : "create"
92
- }.error`
93
- )
92
+ }.error`,
93
+ ),
94
94
  );
95
95
  }
96
96
  }
@@ -30,11 +30,13 @@ export default class CfbFormEditorQuestionDefault extends Component {
30
30
 
31
31
  if (
32
32
  ["ChoiceQuestion", "MultipleChoiceQuestion"].includes(
33
- this.args.model.__typename
33
+ this.args.model.__typename,
34
34
  )
35
35
  ) {
36
- // Use Power Select for choice questions to save space.
37
- raw.meta = { widgetOverride: "cf-field/input/powerselect" };
36
+ if (!this.args.disableChoicePowerselectOverride) {
37
+ // Use Power Select for choice questions to save space.
38
+ raw.meta = { widgetOverride: "cf-field/input/powerselect" };
39
+ }
38
40
 
39
41
  const key = this.args.model.__typename
40
42
  .replace(/^./, (match) => match.toLowerCase())
@@ -42,14 +42,14 @@ export default class CfbFormEditorQuestionOptions extends Component {
42
42
 
43
43
  this.notification.success(
44
44
  this.intl.t(
45
- "caluma.form-builder.notification.form.reorder-options.success"
46
- )
45
+ "caluma.form-builder.notification.form.reorder-options.success",
46
+ ),
47
47
  );
48
48
  } catch (e) {
49
49
  this.notification.danger(
50
50
  this.intl.t(
51
- "caluma.form-builder.notification.form.reorder-options.error"
52
- )
51
+ "caluma.form-builder.notification.form.reorder-options.error",
52
+ ),
53
53
  );
54
54
  }
55
55
  }
@@ -68,7 +68,7 @@ export default class CfbFormEditorQuestionOptions extends Component {
68
68
  question: this.args.model.slug,
69
69
  },
70
70
  lookupValidator(OptionValidations),
71
- OptionValidations
71
+ OptionValidations,
72
72
  ),
73
73
  ]);
74
74
 
@@ -103,7 +103,7 @@ export default class CfbFormEditorQuestionOptions extends Component {
103
103
  const options = [...sortable.$el.children].slice(0, -1);
104
104
 
105
105
  this.reorderOptions.perform(
106
- options.map((option) => option.firstElementChild.firstElementChild.id)
106
+ options.map((option) => option.firstElementChild.firstElementChild.id),
107
107
  );
108
108
  }
109
109
  }
@@ -16,8 +16,8 @@ export default class CfbFormEditorQuestionValidation extends Component {
16
16
  get selected() {
17
17
  return this.validators.filter((validator) =>
18
18
  (this.args.value?.edges.map((edge) => edge.node.slug) || []).includes(
19
- validator.slug
20
- )
19
+ validator.slug,
20
+ ),
21
21
  );
22
22
  }
23
23
 
@@ -27,7 +27,7 @@ export default class CfbFormEditorQuestionValidation extends Component {
27
27
  *fetchFormatValidators() {
28
28
  return yield this.apollo.watchQuery(
29
29
  { query: allFormatValidatorsQuery, fetchPolicy: "cache-and-network" },
30
- "allFormatValidators.edges"
30
+ "allFormatValidators.edges",
31
31
  );
32
32
  }
33
33
 
@@ -77,7 +77,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
77
77
  },
78
78
  fetchPolicy: "network-only",
79
79
  },
80
- "allQuestions"
80
+ "allQuestions",
81
81
  );
82
82
 
83
83
  this.cursor = questions.pageInfo.endCursor;
@@ -97,7 +97,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
97
97
  },
98
98
  fetchPolicy: "cache-and-network",
99
99
  },
100
- "allForms.edges"
100
+ "allForms.edges",
101
101
  );
102
102
  }
103
103
 
@@ -117,14 +117,14 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
117
117
 
118
118
  this.notification.success(
119
119
  this.intl.t(
120
- "caluma.form-builder.notification.form.reorder-questions.success"
121
- )
120
+ "caluma.form-builder.notification.form.reorder-questions.success",
121
+ ),
122
122
  );
123
123
  } catch (e) {
124
124
  this.notification.danger(
125
125
  this.intl.t(
126
- "caluma.form-builder.notification.form.reorder-questions.error"
127
- )
126
+ "caluma.form-builder.notification.form.reorder-questions.error",
127
+ ),
128
128
  );
129
129
  }
130
130
  }
@@ -145,8 +145,8 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
145
145
 
146
146
  this.notification.success(
147
147
  this.intl.t(
148
- "caluma.form-builder.notification.form.add-question.success"
149
- )
148
+ "caluma.form-builder.notification.form.add-question.success",
149
+ ),
150
150
  );
151
151
 
152
152
  this._resetParameters();
@@ -156,7 +156,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
156
156
  this.args.onAfterAddQuestion?.(question);
157
157
  } catch (e) {
158
158
  this.notification.danger(
159
- this.intl.t("caluma.form-builder.notification.form.add-question.error")
159
+ this.intl.t("caluma.form-builder.notification.form.add-question.error"),
160
160
  );
161
161
  }
162
162
  }
@@ -177,16 +177,16 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
177
177
 
178
178
  this.notification.success(
179
179
  this.intl.t(
180
- "caluma.form-builder.notification.form.remove-question.success"
181
- )
180
+ "caluma.form-builder.notification.form.remove-question.success",
181
+ ),
182
182
  );
183
183
 
184
184
  this.args.onAfterRemoveQuestion?.(question);
185
185
  } catch (e) {
186
186
  this.notification.danger(
187
187
  this.intl.t(
188
- "caluma.form-builder.notification.form.remove-question.error"
189
- )
188
+ "caluma.form-builder.notification.form.remove-question.error",
189
+ ),
190
190
  );
191
191
  }
192
192
  }
@@ -195,7 +195,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
195
195
  const children = [...sortable.$el.children];
196
196
 
197
197
  this.reorderQuestions.perform(
198
- children.map((child) => this._children[child.id])
198
+ children.map((child) => this._children[child.id]),
199
199
  );
200
200
  }
201
201
 
@@ -208,7 +208,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
208
208
  @action
209
209
  setupUIkit() {
210
210
  UIkit.util.on("#question-list", "moved", (...args) =>
211
- run(this, this._handleMoved, ...args)
211
+ run(this, this._handleMoved, ...args),
212
212
  );
213
213
  }
214
214
 
@@ -405,6 +405,12 @@
405
405
  @label={{t "caluma.form-builder.question.validateOnEnter"}}
406
406
  @renderComponent={{component "cfb-toggle-switch" size="small"}}
407
407
  />
408
+ <f.input
409
+ @name="showValidation"
410
+ @required={{true}}
411
+ @label={{t "caluma.form-builder.question.showValidation"}}
412
+ @renderComponent={{component "cfb-toggle-switch" size="small"}}
413
+ />
408
414
  {{/if}}
409
415
 
410
416
  <f.input
@@ -110,6 +110,7 @@ export default class CfbFormEditorQuestion extends Component {
110
110
  action: ACTIONS[0],
111
111
  color: COLORS[0],
112
112
  validateOnEnter: false,
113
+ showValidation: false,
113
114
  __typename: Object.keys(TYPES)[0],
114
115
  },
115
116
  },
@@ -122,7 +123,7 @@ export default class CfbFormEditorQuestion extends Component {
122
123
  variables: { slug: this.args.slug },
123
124
  fetchPolicy: "cache-and-network",
124
125
  },
125
- "allQuestions.edges"
126
+ "allQuestions.edges",
126
127
  );
127
128
  }
128
129
 
@@ -137,7 +138,7 @@ export default class CfbFormEditorQuestion extends Component {
137
138
  },
138
139
  fetchPolicy: "cache-and-network",
139
140
  },
140
- "allForms.edges"
141
+ "allForms.edges",
141
142
  );
142
143
  if (!forms.map) {
143
144
  return [];
@@ -151,7 +152,7 @@ export default class CfbFormEditorQuestion extends Component {
151
152
  *availableDataSources() {
152
153
  const dataSources = yield this.apollo.watchQuery(
153
154
  { query: allDataSourcesQuery, fetchPolicy: "cache-and-network" },
154
- "allDataSources.edges"
155
+ "allDataSources.edges",
155
156
  );
156
157
  return dataSources.map((edge) => {
157
158
  return {
@@ -348,6 +349,7 @@ export default class CfbFormEditorQuestion extends Component {
348
349
  action: changeset.get("action"),
349
350
  color: changeset.get("color"),
350
351
  validateOnEnter: Boolean(changeset.get("validateOnEnter")),
352
+ showValidation: Boolean(changeset.get("showValidation")),
351
353
  };
352
354
  }
353
355
 
@@ -363,7 +365,7 @@ export default class CfbFormEditorQuestion extends Component {
363
365
  mutation: saveOptionMutation,
364
366
  variables: { input: { label, slug, isArchived } },
365
367
  });
366
- })
368
+ }),
367
369
  );
368
370
  }
369
371
 
@@ -412,7 +414,7 @@ export default class CfbFormEditorQuestion extends Component {
412
414
  mutation: TYPES[typename],
413
415
  variables: { input },
414
416
  },
415
- `save${typename}.question`
417
+ `save${typename}.question`,
416
418
  );
417
419
 
418
420
  yield this.saveDefaultAnswer.perform(question, changeset);
@@ -432,7 +434,7 @@ export default class CfbFormEditorQuestion extends Component {
432
434
  }
433
435
 
434
436
  this.notification.success(
435
- this.intl.t("caluma.form-builder.notification.question.save.success")
437
+ this.intl.t("caluma.form-builder.notification.question.save.success"),
436
438
  );
437
439
 
438
440
  this.args.onAfterSubmit?.(question);
@@ -440,7 +442,7 @@ export default class CfbFormEditorQuestion extends Component {
440
442
  // eslint-disable-next-line no-console
441
443
  console.error(e);
442
444
  this.notification.danger(
443
- this.intl.t("caluma.form-builder.notification.question.save.error")
445
+ this.intl.t("caluma.form-builder.notification.question.save.error"),
444
446
  );
445
447
  }
446
448
  }
@@ -456,8 +458,8 @@ export default class CfbFormEditorQuestion extends Component {
456
458
  new Changeset(
457
459
  { ...edge.node, slugUnlinked: false, question: this.model.slug },
458
460
  lookupValidator(optionValidations),
459
- optionValidations
460
- )
461
+ optionValidations,
462
+ ),
461
463
  ) ?? [
462
464
  new Changeset(
463
465
  {
@@ -469,14 +471,14 @@ export default class CfbFormEditorQuestion extends Component {
469
471
  question: this.model.slug,
470
472
  },
471
473
  lookupValidator(optionValidations),
472
- optionValidations
474
+ optionValidations,
473
475
  ),
474
476
  ];
475
477
 
476
478
  this.changeset = new Changeset(
477
479
  { ...this.model, options },
478
480
  lookupValidator(validations),
479
- validations
481
+ validations,
480
482
  );
481
483
  }
482
484
  }
@@ -13,7 +13,7 @@ export default class CfbNavigationComponent extends Component {
13
13
  const routeParts = currentRoute.split(".");
14
14
  return routeParts
15
15
  .map((routeName, index) =>
16
- this._lookupRoute(routeName, routeParts, index)
16
+ this._lookupRoute(routeName, routeParts, index),
17
17
  )
18
18
  .filter((route) => route && route.__navigationTitleProperty);
19
19
  }
@@ -9,6 +9,7 @@ mutation SaveActionButtonQuestion($input: SaveActionButtonQuestionInput!) {
9
9
  action
10
10
  color
11
11
  validateOnEnter
12
+ showValidation
12
13
  }
13
14
  }
14
15
  clientMutationId
@@ -170,6 +170,7 @@ query FormEditorQuestion($slug: String!) {
170
170
  action
171
171
  color
172
172
  validateOnEnter
173
+ showValidation
173
174
  }
174
175
  }
175
176
  }
@@ -32,7 +32,7 @@ export default class EditQuestionsEditRoute extends Route {
32
32
  `,
33
33
  variables: { slug },
34
34
  },
35
- "allQuestions.edges"
35
+ "allQuestions.edges",
36
36
  );
37
37
 
38
38
  return question?.node.label;
@@ -31,7 +31,7 @@ export default class EditRoute extends Route {
31
31
  `,
32
32
  variables: { slug },
33
33
  },
34
- "allForms.edges"
34
+ "allForms.edges",
35
35
  );
36
36
 
37
37
  return form?.node.name;
@@ -24,7 +24,7 @@ export default function and(...validators) {
24
24
  newValue,
25
25
  oldValue,
26
26
  changes,
27
- object
27
+ object,
28
28
  );
29
29
 
30
30
  if (isPromise(validation)) {
@@ -22,67 +22,67 @@ export default {
22
22
  validateType("FormQuestion", true),
23
23
  validateType("StaticQuestion", true),
24
24
  validateType("FilesQuestion", true),
25
- validateLength({ max: 1024, allowBlank: true })
25
+ validateLength({ max: 1024, allowBlank: true }),
26
26
  ),
27
27
  integerMinValue: or(
28
28
  validateType("IntegerQuestion", false),
29
29
  and(
30
30
  validateNumber({ allowBlank: true, integer: true }),
31
- validateGtLt({ lt: "integerMaxValue", allowNone: true })
32
- )
31
+ validateGtLt({ lt: "integerMaxValue", allowNone: true }),
32
+ ),
33
33
  ),
34
34
  integerMaxValue: or(
35
35
  validateType("IntegerQuestion", false),
36
36
  and(
37
37
  validateNumber({ allowBlank: true, integer: true }),
38
- validateGtLt({ gt: "integerMinValue", allowNone: true })
39
- )
38
+ validateGtLt({ gt: "integerMinValue", allowNone: true }),
39
+ ),
40
40
  ),
41
41
 
42
42
  floatMinValue: or(
43
43
  validateType("FloatQuestion", false),
44
44
  and(
45
45
  validateNumber({ allowBlank: true }),
46
- validateGtLt({ lt: "floatMaxValue", allowNone: true })
47
- )
46
+ validateGtLt({ lt: "floatMaxValue", allowNone: true }),
47
+ ),
48
48
  ),
49
49
  floatMaxValue: or(
50
50
  validateType("FloatQuestion", false),
51
51
  and(
52
52
  validateNumber({ allowBlank: true }),
53
- validateGtLt({ gt: "floatMinValue", allowNone: true })
54
- )
53
+ validateGtLt({ gt: "floatMinValue", allowNone: true }),
54
+ ),
55
55
  ),
56
56
 
57
57
  minLength: or(
58
58
  and(
59
59
  validateType("TextQuestion", false),
60
- validateType("TextareaQuestion", false)
60
+ validateType("TextareaQuestion", false),
61
61
  ),
62
- validateNumber({ gt: 0, allowBlank: true })
62
+ validateNumber({ gt: 0, allowBlank: true }),
63
63
  ),
64
64
  maxLength: or(
65
65
  and(
66
66
  validateType("TextQuestion", false),
67
- validateType("TextareaQuestion", false)
67
+ validateType("TextareaQuestion", false),
68
68
  ),
69
- validateNumber({ gt: 0, allowBlank: true })
69
+ validateNumber({ gt: 0, allowBlank: true }),
70
70
  ),
71
71
 
72
72
  options: or(
73
73
  and(
74
74
  validateType("MultipleChoiceQuestion", false),
75
- validateType("ChoiceQuestion", false)
75
+ validateType("ChoiceQuestion", false),
76
76
  ),
77
- and(validateOptions(), validateLength({ min: 1 }))
77
+ and(validateOptions(), validateLength({ min: 1 })),
78
78
  ),
79
79
  "rowForm.slug": or(
80
80
  validateType("TableQuestion", false),
81
- validatePresence(true)
81
+ validatePresence(true),
82
82
  ),
83
83
  "subForm.slug": or(
84
84
  validateType("FormQuestion", false),
85
- validatePresence(true)
85
+ validatePresence(true),
86
86
  ),
87
87
  isHidden: validateJexl(),
88
88
  isRequired: validateJexl(),
@@ -20,7 +20,7 @@ export default function validateGtLt(options = {}) {
20
20
  newValue,
21
21
  oldValue,
22
22
  changes,
23
- content
23
+ content,
24
24
  );
25
25
  };
26
26
  }
@@ -12,6 +12,7 @@ const TRANSFORMS = [
12
12
  "sum",
13
13
  "avg",
14
14
  "stringify",
15
+ "flatten",
15
16
  ];
16
17
  const BINARY_OPS = ["intersects"];
17
18
 
@@ -36,7 +36,7 @@ export class SlugUniquenessValidator {
36
36
 
37
37
  async validate(key, newValue, oldValue, changes, context) {
38
38
  const application = importSync(
39
- "@projectcaluma/ember-form-builder/-private/application"
39
+ "@projectcaluma/ember-form-builder/-private/application",
40
40
  ).default;
41
41
 
42
42
  setOwner(this, application.instance);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-form-builder",
3
- "version": "12.1.0",
3
+ "version": "12.3.0",
4
4
  "description": "Ember engine for building Caluma forms.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -13,7 +13,7 @@
13
13
  "@ember/legacy-built-in-components": "^0.4.2",
14
14
  "@ember/render-modifiers": "^2.1.0",
15
15
  "@ember/string": "^3.1.1",
16
- "@embroider/macros": "^1.11.1",
16
+ "@embroider/macros": "^1.13.0",
17
17
  "@glimmer/component": "^1.1.2",
18
18
  "@glimmer/tracking": "^1.1.2",
19
19
  "codejar": "^3.7.0",
@@ -24,14 +24,14 @@
24
24
  "ember-cli-babel": "^7.26.11",
25
25
  "ember-cli-htmlbars": "^6.2.0",
26
26
  "ember-composable-helpers": "^5.0.0",
27
- "ember-concurrency": "^2.3.7",
27
+ "ember-concurrency": "^3.0.0",
28
28
  "ember-engines-router-service": "^0.3.0",
29
29
  "ember-fetch": "^8.1.2",
30
30
  "ember-flatpickr": "^4.0.0",
31
31
  "ember-intl": "^5.7.2",
32
32
  "ember-math-helpers": "^3.0.0",
33
- "ember-power-select": "^7.0.0",
34
- "ember-resources": "^5.6.4",
33
+ "ember-power-select": "^7.1.0",
34
+ "ember-resources": "^6.3.1",
35
35
  "ember-test-selectors": "^6.0.0",
36
36
  "ember-uikit": "^8.0.0",
37
37
  "ember-validated-form": "^6.2.0",
@@ -40,9 +40,9 @@
40
40
  "highlight.js": "^11.8.0",
41
41
  "highlightjs-jexl": "^0.0.5",
42
42
  "jexl": "^2.3.0",
43
- "uikit": "^3.16.22",
44
- "@projectcaluma/ember-core": "^12.1.0",
45
- "@projectcaluma/ember-form": "^12.1.0"
43
+ "uikit": "^3.16.23",
44
+ "@projectcaluma/ember-core": "^12.3.0",
45
+ "@projectcaluma/ember-form": "^12.3.0"
46
46
  },
47
47
  "//": [
48
48
  "TODO: remove obsolete dependency to `ember-data` which is only necessary",
@@ -52,7 +52,7 @@
52
52
  ],
53
53
  "devDependencies": {
54
54
  "@ember/optional-features": "2.0.0",
55
- "@ember/test-helpers": "3.1.0",
55
+ "@ember/test-helpers": "3.2.0",
56
56
  "@embroider/test-setup": "3.0.1",
57
57
  "@faker-js/faker": "8.0.2",
58
58
  "broccoli-asset-rev": "3.0.0",
@@ -64,20 +64,20 @@
64
64
  "ember-cli-mirage": "3.0.0-alpha.3",
65
65
  "ember-cli-sri": "2.1.1",
66
66
  "ember-cli-terser": "4.0.2",
67
- "ember-data": "4.12.0",
67
+ "ember-data": "4.12.3",
68
68
  "ember-engines": "0.9.0",
69
69
  "ember-load-initializers": "2.1.2",
70
70
  "ember-qunit": "7.0.0",
71
- "ember-resolver": "10.1.1",
72
- "ember-source": "4.12.0",
71
+ "ember-resolver": "11.0.0",
72
+ "ember-source": "4.12.3",
73
73
  "ember-source-channel-url": "3.0.0",
74
74
  "ember-try": "2.0.0",
75
75
  "loader.js": "4.7.0",
76
76
  "miragejs": "0.1.47",
77
77
  "qunit": "2.19.4",
78
78
  "qunit-dom": "2.0.0",
79
- "webpack": "5.87.0",
80
- "@projectcaluma/ember-testing": "12.1.0"
79
+ "webpack": "5.88.2",
80
+ "@projectcaluma/ember-testing": "12.3.0"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "ember-engines": "^0.9.0",
@@ -115,6 +115,7 @@ caluma:
115
115
  action: "Aktion"
116
116
  color: "Farbe"
117
117
  validateOnEnter: "Validierung beim Betreten des Fensters"
118
+ showValidation: "Validierungs-Fehler anzeigen"
118
119
 
119
120
  actions:
120
121
  COMPLETE: "Abschliessen"
@@ -115,6 +115,7 @@ caluma:
115
115
  action: "Action"
116
116
  color: "Color"
117
117
  validateOnEnter: "Validate on entering the viewport"
118
+ showValidation: "Show validation errors"
118
119
 
119
120
  actions:
120
121
  COMPLETE: "Complete"