@projectcaluma/ember-form-builder 12.8.0 → 12.9.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.
@@ -0,0 +1,16 @@
1
+ <UkButton
2
+ @color="link"
3
+ @onClick={{toggle-action "showAdvanced" this}}
4
+ class="uk-flex uk-flex-middle uk-margin"
5
+ >
6
+ {{#if this.showAdvanced}}
7
+ <UkIcon @icon="triangle-down" />
8
+ {{else}}
9
+ <UkIcon @icon="triangle-right" />
10
+ {{/if}}
11
+ {{t "caluma.form-builder.question.advancedSettings"}}
12
+ </UkButton>
13
+
14
+ {{#if this.showAdvanced}}
15
+ {{yield}}
16
+ {{/if}}
@@ -0,0 +1,6 @@
1
+ import Component from "@glimmer/component";
2
+ import { tracked } from "@glimmer/tracking";
3
+
4
+ export default class CfbFormEditorCfbAdvancedSettings extends Component {
5
+ @tracked showAdvanced = false;
6
+ }
@@ -49,6 +49,14 @@
49
49
  @renderComponent={{component "cfb-toggle-switch" size="small"}}
50
50
  />
51
51
 
52
+ <CfbFormEditor::CfbAdvancedSettings>
53
+ <f.input
54
+ @label={{t "caluma.form-builder.question.meta"}}
55
+ @name="meta"
56
+ @renderComponent={{component "cfb-code-editor" language="json"}}
57
+ />
58
+ </CfbFormEditor::CfbAdvancedSettings>
59
+
52
60
  <div class="uk-text-right">
53
61
  <f.submit
54
62
  @disabled={{f.loading}}
@@ -58,6 +58,8 @@ export default class CfbFormEditorGeneral extends Component {
58
58
 
59
59
  @dropTask
60
60
  *submit(changeset) {
61
+ const rawMeta = changeset.get("meta");
62
+
61
63
  try {
62
64
  const form = yield this.apollo.mutate(
63
65
  {
@@ -69,6 +71,7 @@ export default class CfbFormEditorGeneral extends Component {
69
71
  description: changeset.get("description"),
70
72
  isArchived: changeset.get("isArchived"),
71
73
  isPublished: changeset.get("isPublished"),
74
+ meta: JSON.stringify(rawMeta?.unwrap?.() ?? rawMeta),
72
75
  },
73
76
  },
74
77
  },
@@ -11,6 +11,7 @@ export default class CfbFormEditorQuestionUsage extends Component {
11
11
  @queryManager apollo;
12
12
 
13
13
  @tracked modalVisible = false;
14
+ @tracked _forms = null;
14
15
 
15
16
  get title() {
16
17
  return this.intl.t("caluma.form-builder.question.usage.title", {
@@ -25,18 +26,29 @@ export default class CfbFormEditorQuestionUsage extends Component {
25
26
  }
26
27
 
27
28
  forms = trackedFunction(this, async () => {
29
+ if (!this.args.slug) {
30
+ // The shown question hasn't completely loaded yet
31
+ return [];
32
+ }
33
+ if (this._forms) {
34
+ // we have already fetched the forms previously
35
+ return this._forms;
36
+ }
37
+
28
38
  try {
29
39
  const forms = await this.apollo.query(
30
40
  {
31
41
  query: allFormsForQuestionQuery,
32
42
  variables: {
33
- slug: this.args.model.slug,
43
+ slug: this.args.slug,
34
44
  },
35
45
  fetchPolicy: "no-cache",
36
46
  },
37
47
  "allForms.edges",
38
48
  );
39
49
 
50
+ this._forms = forms; // cache the result
51
+
40
52
  return forms;
41
53
  } catch (error) {
42
54
  console.error(error);
@@ -384,20 +384,7 @@
384
384
  @renderComponent={{component "cfb-toggle-switch" size="small"}}
385
385
  />
386
386
 
387
- <UkButton
388
- @color="link"
389
- @onClick={{toggle-action "showAdvanced" this}}
390
- class="uk-flex uk-flex-middle uk-margin"
391
- >
392
- {{#if this.showAdvanced}}
393
- <UkIcon @icon="triangle-down" />
394
- {{else}}
395
- <UkIcon @icon="triangle-right" />
396
- {{/if}}
397
- {{t "caluma.form-builder.question.advancedSettings"}}
398
- </UkButton>
399
-
400
- {{#if this.showAdvanced}}
387
+ <CfbFormEditor::CfbAdvancedSettings>
401
388
  {{#if (has-question-type f.model "action-button")}}
402
389
  <f.input
403
390
  @name="validateOnEnter"
@@ -438,10 +425,13 @@
438
425
  @name="meta"
439
426
  @renderComponent={{component "cfb-code-editor" language="json"}}
440
427
  />
441
- {{/if}}
428
+ </CfbFormEditor::CfbAdvancedSettings>
442
429
 
443
430
  <div class="uk-flex uk-flex-between uk-flex-middle uk-flex-row-reverse">
444
- <CfbFormEditor::QuestionUsage @model={{f.model}} class="uk-flex-last" />
431
+ <CfbFormEditor::QuestionUsage
432
+ @slug={{changeset-get f.model "slug"}}
433
+ class="uk-flex-last"
434
+ />
445
435
 
446
436
  <f.submit
447
437
  @disabled={{f.loading}}
@@ -5,4 +5,5 @@ fragment FormInfo on Form {
5
5
  description
6
6
  isArchived
7
7
  isPublished
8
+ meta
8
9
  }
@@ -0,0 +1 @@
1
+ export { default } from "@projectcaluma/ember-form-builder/components/cfb-form-editor/cfb-advanced-settings";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-form-builder",
3
- "version": "12.8.0",
3
+ "version": "12.9.0",
4
4
  "description": "Ember engine for building Caluma forms.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -10,7 +10,7 @@
10
10
  "homepage": "https://docs.caluma.io/ember-caluma",
11
11
  "repository": "github:projectcaluma/ember-caluma",
12
12
  "dependencies": {
13
- "@babel/core": "^7.23.6",
13
+ "@babel/core": "^7.23.7",
14
14
  "@ember/legacy-built-in-components": "^0.5.0",
15
15
  "@ember/render-modifiers": "^2.1.0",
16
16
  "@ember/string": "^3.1.1",
@@ -19,7 +19,7 @@
19
19
  "@glimmer/tracking": "^1.1.2",
20
20
  "codejar": "^4.2.0",
21
21
  "ember-apollo-client": "~4.0.2",
22
- "ember-auto-import": "^2.7.1",
22
+ "ember-auto-import": "^2.7.2",
23
23
  "ember-changeset": "^4.1.2",
24
24
  "ember-changeset-validations": "^4.1.1",
25
25
  "ember-cli-babel": "^8.2.0",
@@ -28,7 +28,7 @@
28
28
  "ember-concurrency": "^3.1.1",
29
29
  "ember-engines-router-service": "^0.5.0",
30
30
  "ember-fetch": "^8.1.2",
31
- "ember-flatpickr": "^4.0.0",
31
+ "ember-flatpickr": "^6.0.0",
32
32
  "ember-intl": "^6.4.0",
33
33
  "ember-math-helpers": "^4.0.0",
34
34
  "ember-power-select": "^7.2.0",
@@ -36,6 +36,7 @@
36
36
  "ember-test-selectors": "^6.0.0",
37
37
  "ember-uikit": "^9.0.0",
38
38
  "ember-validated-form": "^7.0.0",
39
+ "flatpickr": "^4.6.13",
39
40
  "graphql": "^15.8.0",
40
41
  "graphql-tag": "^2.12.6",
41
42
  "highlight.js": "^11.9.0",
@@ -43,8 +44,8 @@
43
44
  "jexl": "^2.3.0",
44
45
  "lodash.isequal": "^4.5.0",
45
46
  "uikit": "^3.17.11",
46
- "@projectcaluma/ember-form": "^12.8.0",
47
- "@projectcaluma/ember-core": "^12.8.0"
47
+ "@projectcaluma/ember-core": "^12.9.0",
48
+ "@projectcaluma/ember-form": "^12.9.0"
48
49
  },
49
50
  "//": [
50
51
  "TODO: remove obsolete dependency to `ember-data` which is only necessary",
@@ -72,7 +73,7 @@
72
73
  "ember-load-initializers": "2.1.2",
73
74
  "ember-qunit": "8.0.2",
74
75
  "ember-resolver": "11.0.1",
75
- "ember-source": "5.5.0",
76
+ "ember-source": "5.6.0",
76
77
  "ember-source-channel-url": "3.0.0",
77
78
  "ember-try": "3.0.0",
78
79
  "loader.js": "4.7.0",
@@ -80,7 +81,7 @@
80
81
  "qunit": "2.20.0",
81
82
  "qunit-dom": "3.0.0",
82
83
  "webpack": "5.89.0",
83
- "@projectcaluma/ember-testing": "12.8.0"
84
+ "@projectcaluma/ember-testing": "12.9.0"
84
85
  },
85
86
  "peerDependencies": {
86
87
  "ember-engines": "^0.9.0",