@projectcaluma/ember-form-builder 9.0.1 → 9.0.2

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.
@@ -45,6 +45,10 @@ export default class CfbFormEditorQuestionDefault extends RenderComponent {
45
45
  delete raw.options;
46
46
  }
47
47
 
48
+ if (this.model.__typename === "TableQuestion") {
49
+ raw.meta = { widgetOverride: "cfb-form-editor/question/default/table" };
50
+ }
51
+
48
52
  return raw;
49
53
  }
50
54
 
@@ -80,6 +84,26 @@ export default class CfbFormEditorQuestionDefault extends RenderComponent {
80
84
  question: this.question,
81
85
  };
82
86
 
87
+ if (answer?.tableValue?.length) {
88
+ answer.tableValue = answer.tableValue.map((doc) => ({
89
+ ...doc,
90
+ form: doc.form
91
+ ? {
92
+ ...doc.form,
93
+ questions: {
94
+ edges: doc.form.questions.edges.map((edge) => ({
95
+ node: {
96
+ ...edge.node,
97
+ isHidden: "false",
98
+ isRequired: "false",
99
+ },
100
+ })),
101
+ },
102
+ }
103
+ : null,
104
+ }));
105
+ }
106
+
83
107
  const document = getOwner(this)
84
108
  .factoryFor("caluma-model:document")
85
109
  .create({
@@ -44,7 +44,7 @@
44
44
  data-test-edit-question
45
45
  href="#"
46
46
  class="uk-width-auto uk-margin-small-right uk-text-bold"
47
- {{on "click" (fn (optional @on-edit-question) @question)}}
47
+ {{on "click" (fn this.editQuestion @question)}}
48
48
  >
49
49
  {{@question.slug}}
50
50
  {{#if @question.isArchived}}({{t
@@ -71,9 +71,7 @@
71
71
  class="uk-width-expand uk-margin-small-right uk-text-small uk-text-truncate"
72
72
  {{on
73
73
  "click"
74
- (fn
75
- (optional @on-click-form) (or @question.subForm @question.rowForm)
76
- )
74
+ (fn this.clickForm (or @question.subForm @question.rowForm))
77
75
  }}
78
76
  >
79
77
  {{or @question.subForm.name @question.rowForm.name}}
@@ -1,3 +1,4 @@
1
+ import { action } from "@ember/object";
1
2
  import { guidFor } from "@ember/object/internals";
2
3
  import Component from "@glimmer/component";
3
4
  import jexl from "jexl";
@@ -48,4 +49,16 @@ export default class CfbFormEditorQuestionListItem extends Component {
48
49
  (hasQuestionType(question, "form") || hasQuestionType(question, "table"))
49
50
  );
50
51
  }
52
+
53
+ @action
54
+ editQuestion(question, e) {
55
+ e.preventDefault();
56
+ this.args["on-edit-question"]?.(question);
57
+ }
58
+
59
+ @action
60
+ clickForm(form, e) {
61
+ e.preventDefault();
62
+ this.args["on-click-form"]?.(form);
63
+ }
51
64
  }
@@ -62,12 +62,7 @@
62
62
  <a
63
63
  href="#"
64
64
  data-test-new-question
65
- {{on
66
- "click"
67
- (queue
68
- (fn (optional @on-create-question)) (fn this.setMode "reorder")
69
- )
70
- }}
65
+ {{on "click" this.createNewQuestion}}
71
66
  >
72
67
  {{t "caluma.form-builder.question.create"}}
73
68
  </a>
@@ -105,8 +100,8 @@
105
100
  {{/each}}
106
101
  {{#if (and this.hasNextPage (eq this.mode "add"))}}
107
102
  <li class="uk-text-center cfb-pointer"><a
108
- {{on "click" (perform this.questionTask)}}
109
103
  href="#"
104
+ {{on "click" (perform this.questionTask)}}
110
105
  >{{t "caluma.form-builder.question.loadMore"}}</a></li>
111
106
  {{/if}}
112
107
  {{/if}}
@@ -51,9 +51,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
51
51
  @lastValue("questionTask") questionTaskValue = [];
52
52
  @restartableTask
53
53
  *questionTask(event) {
54
- if (event?.preventDefault) {
55
- event.preventDefault();
56
- }
54
+ event?.preventDefault?.();
57
55
 
58
56
  const mode = this.mode;
59
57
  const search = mode !== "reorder" ? this.search : "";
@@ -235,4 +233,12 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
235
233
  this._resetParameters();
236
234
  this.questionTask.perform();
237
235
  }
236
+
237
+ @action
238
+ createNewQuestion(e) {
239
+ e.preventDefault();
240
+
241
+ this.args["on-create-question"]?.();
242
+ this.setMode("reorder");
243
+ }
238
244
  }
@@ -43,7 +43,9 @@ export default class ComponentsCfbFormListComponent extends Component {
43
43
  }
44
44
 
45
45
  @action
46
- loadMoreForms() {
46
+ loadMoreForms(e) {
47
+ e.preventDefault();
48
+
47
49
  this.formsQuery.fetchMore();
48
50
  }
49
51
 
@@ -8,13 +8,10 @@ module.exports = {
8
8
  packages: [
9
9
  { name: "@projectcaluma/ember-core" },
10
10
  { name: "@projectcaluma/ember-form" },
11
- { name: "ember-changeset" },
12
- { name: "ember-composable-helpers" },
13
11
  { name: "ember-engines" },
14
12
  { name: "ember-math-helpers" },
15
13
  { name: "ember-pikaday" },
16
14
  { name: "ember-power-select" },
17
- { name: "ember-validated-form" },
18
15
  ],
19
16
  });
20
17
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-form-builder",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "description": "Ember engine for building Caluma forms.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -18,8 +18,8 @@
18
18
  "@ember/render-modifiers": "^1.0.2",
19
19
  "@glimmer/component": "^1.0.4",
20
20
  "@glimmer/tracking": "^1.0.4",
21
- "@projectcaluma/ember-core": "9.0.0",
22
- "@projectcaluma/ember-form": "9.0.1",
21
+ "@projectcaluma/ember-core": "9.0.1",
22
+ "@projectcaluma/ember-form": "9.0.2",
23
23
  "codejar": "^3.5.0",
24
24
  "ember-apollo-client": "^3.2.0",
25
25
  "ember-auto-import": "^2.2.0",
@@ -31,17 +31,17 @@
31
31
  "ember-concurrency": "^2.1.2",
32
32
  "ember-concurrency-decorators": "^2.0.3",
33
33
  "ember-fetch": "^8.0.4",
34
- "ember-math-helpers": "^2.16.0",
34
+ "ember-math-helpers": "^2.17.3",
35
35
  "ember-pikaday": "^3.0.0",
36
36
  "ember-power-select": "^4.1.6",
37
37
  "ember-test-selectors": "^6.0.0",
38
38
  "ember-uikit": "^4.0.0",
39
39
  "ember-validated-form": "^3.0.3",
40
- "graphql": "^15.5.3",
40
+ "graphql": "^15.6.0",
41
41
  "graphql-tag": "^2.12.5",
42
42
  "jexl": "^2.3.0",
43
43
  "moment": "^2.29.1",
44
- "prismjs": "^1.24.1"
44
+ "prismjs": "^1.25.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@ember/optional-features": "2.0.0",
@@ -69,9 +69,9 @@
69
69
  "faker": "5.5.3",
70
70
  "loader.js": "4.7.0",
71
71
  "npm-run-all": "4.1.5",
72
- "qunit": "2.17.1",
72
+ "qunit": "2.17.2",
73
73
  "qunit-dom": "2.0.0",
74
- "webpack": "5.52.1"
74
+ "webpack": "5.53.0"
75
75
  },
76
76
  "engines": {
77
77
  "node": "10.* || >= 12"