@projectcaluma/ember-form-builder 14.1.0 → 14.2.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.
@@ -54,7 +54,7 @@ export default class CfbFormEditorCopyModal extends Component {
54
54
  );
55
55
 
56
56
  this.router.transitionTo("edit", changeset.slug);
57
- } catch (e) {
57
+ } catch {
58
58
  this.notification.danger(
59
59
  this.intl.t("caluma.form-builder.notification.form.create.error"),
60
60
  );
@@ -87,7 +87,7 @@ export default class CfbFormEditorGeneral extends Component {
87
87
  );
88
88
 
89
89
  this.args.onAfterSubmit?.(form);
90
- } catch (e) {
90
+ } catch {
91
91
  this.notification.danger(
92
92
  this.intl.t(
93
93
  `caluma.form-builder.notification.form.${
@@ -45,7 +45,7 @@ export default class CfbFormEditorQuestionOptions extends Component {
45
45
  "caluma.form-builder.notification.form.reorder-options.success",
46
46
  ),
47
47
  );
48
- } catch (e) {
48
+ } catch {
49
49
  this.notification.danger(
50
50
  this.intl.t(
51
51
  "caluma.form-builder.notification.form.reorder-options.error",
@@ -2,10 +2,11 @@ import { action } from "@ember/object";
2
2
  import { guidFor } from "@ember/object/internals";
3
3
  import { service } from "@ember/service";
4
4
  import Component from "@glimmer/component";
5
- import jexl from "jexl";
6
5
 
7
6
  import { hasQuestionType } from "@projectcaluma/ember-core/helpers/has-question-type";
8
7
 
8
+ const cleanJexl = (expr) => expr.replace(/\s/g, "");
9
+
9
10
  export default class CfbFormEditorQuestionListItem extends Component {
10
11
  @service router;
11
12
 
@@ -14,33 +15,31 @@ export default class CfbFormEditorQuestionListItem extends Component {
14
15
  }
15
16
 
16
17
  get required() {
17
- try {
18
- return jexl.evalSync(this.args.question?.isRequired);
19
- } catch (error) {
20
- return this.args.question?.isRequired;
21
- }
18
+ return this.requiredType !== "not-required";
22
19
  }
23
20
 
24
21
  get requiredType() {
25
- const required = this.required;
26
- return required === true
22
+ const required = cleanJexl(this.args.question?.isRequired ?? "");
23
+
24
+ return required === "true"
27
25
  ? "required"
28
- : required
29
- ? "conditional"
30
- : "not-required";
26
+ : required === "false"
27
+ ? "not-required"
28
+ : "conditional";
31
29
  }
32
30
 
33
31
  get hidden() {
34
- try {
35
- return jexl.evalSync(this.args.question?.isHidden);
36
- } catch (error) {
37
- return this.args.question?.isHidden;
38
- }
32
+ return this.hiddenType !== "not-hidden";
39
33
  }
40
34
 
41
35
  get hiddenType() {
42
- const hidden = this.hidden;
43
- return hidden === true ? "hidden" : hidden ? "conditional" : "not-hidden";
36
+ const hidden = cleanJexl(this.args.question?.isHidden ?? "");
37
+
38
+ return hidden === "true"
39
+ ? "hidden"
40
+ : hidden === "false"
41
+ ? "not-hidden"
42
+ : "conditional";
44
43
  }
45
44
 
46
45
  get showFormLink() {
@@ -120,7 +120,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
120
120
  "caluma.form-builder.notification.form.reorder-questions.success",
121
121
  ),
122
122
  );
123
- } catch (e) {
123
+ } catch {
124
124
  this.notification.danger(
125
125
  this.intl.t(
126
126
  "caluma.form-builder.notification.form.reorder-questions.error",
@@ -154,7 +154,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
154
154
  this.questionTask.perform();
155
155
 
156
156
  this.args.onAfterAddQuestion?.(question);
157
- } catch (e) {
157
+ } catch {
158
158
  this.notification.danger(
159
159
  this.intl.t("caluma.form-builder.notification.form.add-question.error"),
160
160
  );
@@ -182,7 +182,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
182
182
  );
183
183
 
184
184
  this.args.onAfterRemoveQuestion?.(question);
185
- } catch (e) {
185
+ } catch {
186
186
  this.notification.danger(
187
187
  this.intl.t(
188
188
  "caluma.form-builder.notification.form.remove-question.error",
@@ -22,7 +22,7 @@ export default class CfbFormEditorQuestionUsage extends Component {
22
22
  }
23
23
 
24
24
  get otherForms() {
25
- return this.forms.value?.length - 1 ?? 0;
25
+ return (this.forms.value?.length ?? 1) - 1;
26
26
  }
27
27
 
28
28
  forms = trackedFunction(this, async () => {
@@ -445,7 +445,6 @@ export default class CfbFormEditorQuestion extends Component {
445
445
 
446
446
  this.args.onAfterSubmit?.(question);
447
447
  } catch (e) {
448
- // eslint-disable-next-line no-console
449
448
  console.error(e);
450
449
  this.notification.danger(
451
450
  this.intl.t("caluma.form-builder.notification.question.save.error"),
@@ -95,7 +95,7 @@ export class SlugUniquenessValidator {
95
95
  } else if (this.type === "option") {
96
96
  count = response.allQuestions.edges[0].node.options.totalCount;
97
97
  }
98
- } catch (error) {
98
+ } catch {
99
99
  // do nothing, which will result in count being Infinity which will return
100
100
  // a validation error
101
101
  }
package/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- // eslint-disable-next-line n/no-unpublished-require
4
3
  const { buildEngine } = require("ember-engines/lib/engine-addon");
5
4
 
6
5
  module.exports = buildEngine({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-form-builder",
3
- "version": "14.1.0",
3
+ "version": "14.2.0",
4
4
  "description": "Ember engine for building Caluma forms.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -48,8 +48,8 @@
48
48
  "lodash.isequal": "^4.5.0",
49
49
  "reactiveweb": "^1.3.0",
50
50
  "uikit": "^3.22.0",
51
- "@projectcaluma/ember-core": "^14.1.0",
52
- "@projectcaluma/ember-form": "^14.1.0"
51
+ "@projectcaluma/ember-form": "^14.2.0",
52
+ "@projectcaluma/ember-core": "^14.2.0"
53
53
  },
54
54
  "//": [
55
55
  "TODO: remove obsolete dependency to `ember-data` which is only necessary",
@@ -61,7 +61,7 @@
61
61
  "@ember/optional-features": "2.2.0",
62
62
  "@ember/test-helpers": "4.0.4",
63
63
  "@embroider/test-setup": "4.0.0",
64
- "@faker-js/faker": "9.4.0",
64
+ "@faker-js/faker": "9.7.0",
65
65
  "broccoli-asset-rev": "3.0.0",
66
66
  "ember-autoresize-modifier": "0.7.0",
67
67
  "ember-cli": "6.1.0",
@@ -72,20 +72,20 @@
72
72
  "ember-cli-mirage": "3.0.4",
73
73
  "ember-cli-sri": "2.1.1",
74
74
  "ember-cli-terser": "4.0.2",
75
- "ember-data": "5.3.9",
76
- "ember-engines": "0.11.0",
77
- "ember-qunit": "9.0.1",
75
+ "ember-data": "5.5.0",
76
+ "ember-engines": "0.12.0",
77
+ "ember-qunit": "9.0.2",
78
78
  "ember-sinon-qunit": "7.5.0",
79
79
  "ember-source": "6.1.0",
80
80
  "ember-source-channel-url": "3.0.0",
81
- "ember-try": "3.0.0",
81
+ "ember-try": "4.0.0",
82
82
  "loader.js": "4.7.0",
83
83
  "miragejs": "0.1.48",
84
- "qunit": "2.23.1",
84
+ "qunit": "2.24.1",
85
85
  "qunit-dom": "3.4.0",
86
- "sinon": "19.0.2",
87
- "webpack": "5.97.1",
88
- "@projectcaluma/ember-testing": "14.1.0"
86
+ "sinon": "20.0.0",
87
+ "webpack": "5.99.8",
88
+ "@projectcaluma/ember-testing": "14.2.0"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "ember-engines": "^0.11.0",