@projectcaluma/ember-form-builder 11.0.0-beta.3 → 11.0.0-beta.30

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/addon/components/cfb-code-editor.hbs +25 -9
  3. package/addon/components/cfb-code-editor.js +59 -11
  4. package/addon/components/cfb-form-editor/general.hbs +1 -3
  5. package/addon/components/cfb-form-editor/general.js +6 -7
  6. package/addon/components/cfb-form-editor/question/default.hbs +11 -9
  7. package/addon/components/cfb-form-editor/question/options.hbs +3 -3
  8. package/addon/components/cfb-form-editor/question/validation.hbs +16 -14
  9. package/addon/components/cfb-form-editor/question/validation.js +17 -13
  10. package/addon/components/cfb-form-editor/question-list/item.hbs +44 -38
  11. package/addon/components/cfb-form-editor/question-list.hbs +2 -2
  12. package/addon/components/cfb-form-editor/question-list.js +9 -3
  13. package/addon/components/cfb-form-editor/question.hbs +55 -96
  14. package/addon/components/cfb-form-editor/question.js +56 -35
  15. package/addon/components/cfb-form-list.hbs +7 -7
  16. package/addon/components/cfb-form-list.js +44 -11
  17. package/addon/controllers/index.js +6 -0
  18. package/addon/engine.js +1 -1
  19. package/addon/gql/fragments/field.graphql +14 -2
  20. package/addon/gql/mutations/add-form-question.graphql +1 -1
  21. package/addon/gql/mutations/remove-form-question.graphql +1 -1
  22. package/addon/gql/mutations/reorder-form-questions.graphql +1 -1
  23. package/addon/gql/mutations/save-calculated-float-question.graphql +1 -0
  24. package/addon/gql/mutations/save-choice-question.graphql +1 -0
  25. package/addon/gql/mutations/save-date-question.graphql +3 -0
  26. package/addon/gql/mutations/save-dynamic-choice-question.graphql +1 -0
  27. package/addon/gql/mutations/save-dynamic-multiple-choice-question.graphql +1 -0
  28. package/addon/gql/mutations/save-files-question.graphql +14 -0
  29. package/addon/gql/mutations/save-float-question.graphql +1 -0
  30. package/addon/gql/mutations/save-integer-question.graphql +1 -0
  31. package/addon/gql/mutations/save-multiple-choice-question.graphql +1 -0
  32. package/addon/gql/mutations/save-table-question.graphql +1 -0
  33. package/addon/gql/mutations/save-text-question.graphql +1 -0
  34. package/addon/gql/mutations/save-textarea-question.graphql +1 -0
  35. package/addon/gql/queries/all-format-validators.graphql +10 -0
  36. package/addon/gql/queries/check-form-slug.graphql +1 -1
  37. package/addon/gql/queries/check-question-slug.graphql +1 -1
  38. package/addon/gql/queries/form-editor-general.graphql +1 -1
  39. package/addon/gql/queries/form-editor-question.graphql +29 -1
  40. package/addon/gql/queries/search-form-question.graphql +3 -3
  41. package/addon/instance-initializers/form-builder-widget-overrides.js +15 -0
  42. package/addon/modifiers/pikaday.js +2 -0
  43. package/addon/routes/edit/questions/edit.js +2 -1
  44. package/addon/routes/edit.js +1 -1
  45. package/addon/templates/index.hbs +8 -1
  46. package/addon/validations/question.js +6 -0
  47. package/addon/validators/gt-lt.js +17 -38
  48. package/app/instance-initializers/form-builder-widget-overrides.js +4 -0
  49. package/app/styles/@projectcaluma/ember-form-builder.scss +2 -2
  50. package/app/styles/_cfb-uikit-powerselect.scss +2 -0
  51. package/config/environment.js +0 -7
  52. package/index.js +4 -2
  53. package/package.json +53 -40
  54. package/translations/de.yaml +7 -6
  55. package/translations/en.yaml +4 -3
  56. package/translations/fr.yaml +154 -1
  57. package/addon/components/cfb-float-input.hbs +0 -14
  58. package/addon/components/cfb-label.hbs +0 -12
  59. package/addon/gql/mutations/save-file-question.graphql +0 -11
  60. package/app/components/cfb-float-input.js +0 -1
  61. package/app/components/cfb-label.js +0 -1
  62. package/app/styles/_cfb-powerselect.scss +0 -31
package/CHANGELOG.md CHANGED
@@ -1,3 +1,141 @@
1
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.16](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.15...@projectcaluma/ember-form-builder-v11.0.0-beta.16) (2022-08-05)
2
+
3
+
4
+ * feat!: add multi file upload (#2040) ([c4fd004](https://github.com/projectcaluma/ember-caluma/commit/c4fd0049654b2d2e5ea62e5909a45d89cb888b40)), closes [#2040](https://github.com/projectcaluma/ember-caluma/issues/2040)
5
+
6
+
7
+ ### BREAKING CHANGES
8
+
9
+ * This requires the caluma backend version v8.0.0-beta.12
10
+ or later.
11
+
12
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.15](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.14...@projectcaluma/ember-form-builder-v11.0.0-beta.15) (2022-08-02)
13
+
14
+
15
+ ### Features
16
+
17
+ * **analytics:** adds analytics module for caluma ([#1655](https://github.com/projectcaluma/ember-caluma/issues/1655)) ([9573abe](https://github.com/projectcaluma/ember-caluma/commit/9573abe95cd39cb1467113026f2ab7773c3c9143))
18
+
19
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.14](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.13...@projectcaluma/ember-form-builder-v11.0.0-beta.14) (2022-06-09)
20
+
21
+
22
+ ### Features
23
+
24
+ * **caluma:** use new filter syntax of caluma ([7a00c03](https://github.com/projectcaluma/ember-caluma/commit/7a00c03a103933d9e48dd88adb7382441a298742))
25
+
26
+
27
+ ### BREAKING CHANGES
28
+
29
+ * **caluma:** `ember-caluma` now requires Caluma version >=
30
+ 8.0.0-beta.6
31
+
32
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.13](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.12...@projectcaluma/ember-form-builder-v11.0.0-beta.13) (2022-05-09)
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * **deps:** update ember-engines ([5aa5300](https://github.com/projectcaluma/ember-caluma/commit/5aa530074ea7dc08267d8ccc411eb1538537a1b5))
38
+ * **resources:** fix deprecations of ember-resources ([7a84c5c](https://github.com/projectcaluma/ember-caluma/commit/7a84c5c78d5b28f7b5393c64722907728dd5f42b))
39
+
40
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.12](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.11...@projectcaluma/ember-form-builder-v11.0.0-beta.12) (2022-04-07)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * **form-builder:** replace prismjs with highlight.js ([b92732c](https://github.com/projectcaluma/ember-caluma/commit/b92732c4586b2978dda80ad3643b6bd58c9605cb))
46
+
47
+
48
+ ### Features
49
+
50
+ * **cf-field:** add optional hints for form fields ([d847fbf](https://github.com/projectcaluma/ember-caluma/commit/d847fbffa376ea60971fb9e91aff8bf54ce77d50))
51
+
52
+
53
+ ### BREAKING CHANGES
54
+
55
+ * **cf-field:** Question hints requires Caluma >= v7.15.0
56
+
57
+ Add option to create hints for certain question types. These
58
+ are displayed below the input field and can be used to provide
59
+ short, informative messages. Hints are available for all question
60
+ types except for form, static and action button questions.
61
+
62
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.11](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.10...@projectcaluma/ember-form-builder-v11.0.0-beta.11) (2022-03-23)
63
+
64
+
65
+ ### Bug Fixes
66
+
67
+ * **embroider:** add missing dependency on @ember/string ([3a6e6bb](https://github.com/projectcaluma/ember-caluma/commit/3a6e6bb39a8c1a40a2ae00b3d4ea00606a755e25))
68
+
69
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.10](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.9...@projectcaluma/ember-form-builder-v11.0.0-beta.10) (2022-03-11)
70
+
71
+
72
+ ### Bug Fixes
73
+
74
+ * **form-builder:** fix typo in class for code editor ([b00014c](https://github.com/projectcaluma/ember-caluma/commit/b00014c9c7fd737f15fe3592daf85ba2ab89ab23))
75
+
76
+
77
+ ### Features
78
+
79
+ * **form-builder:** add field for editing meta ([9176862](https://github.com/projectcaluma/ember-caluma/commit/91768623f98cfa438ee9f758a951e01da72ceb5d))
80
+ * **form-builder:** add new categories published and unpublished ([52c1c1d](https://github.com/projectcaluma/ember-caluma/commit/52c1c1deaf15991e595e042f643889be64b425a0))
81
+ * **form:** support passing component override classes ([9409c7c](https://github.com/projectcaluma/ember-caluma/commit/9409c7cb5901dcdffec1c0294046da64b74b9922))
82
+
83
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.9](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.8...@projectcaluma/ember-form-builder-v11.0.0-beta.9) (2022-02-23)
84
+
85
+
86
+ ### Features
87
+
88
+ * **form-builder:** autoresize textareas and code editor ([edf0871](https://github.com/projectcaluma/ember-caluma/commit/edf08710ebe0c7d372efa0d37bd0f3589c188dba))
89
+
90
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.8](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.7...@projectcaluma/ember-form-builder-v11.0.0-beta.8) (2022-02-16)
91
+
92
+
93
+ ### Bug Fixes
94
+
95
+ * **pikaday:** add pikaday modifier reexport in engines ([c13d302](https://github.com/projectcaluma/ember-caluma/commit/c13d3021bb8fe82e1245a60182af01287c507697))
96
+
97
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.7](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.6...@projectcaluma/ember-form-builder-v11.0.0-beta.7) (2022-02-07)
98
+
99
+
100
+ ### Bug Fixes
101
+
102
+ * **deps:** remove moment altogether and update ember-pikday ([b2f7fa2](https://github.com/projectcaluma/ember-caluma/commit/b2f7fa28fa076897addd36e5964c926c671508ff))
103
+
104
+
105
+ ### BREAKING CHANGES
106
+
107
+ * **deps:** The host app now needs to opt-in to use the default
108
+ pikaday styles: https://github.com/adopted-ember-addons/ember-pikaday#styles
109
+
110
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.6](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.5...@projectcaluma/ember-form-builder-v11.0.0-beta.6) (2022-02-03)
111
+
112
+
113
+ ### Bug Fixes
114
+
115
+ * **validation:** sync format validator validation with backend ([ee66968](https://github.com/projectcaluma/ember-caluma/commit/ee66968230b9f0e4c5a4df8bdb3f8e58b44b5b82))
116
+
117
+
118
+ ### BREAKING CHANGES
119
+
120
+ * **validation:** Use the `formatValidators` property of the backend to store and read
121
+ format validators instead of the `meta.formatValidators` so the backend
122
+ validates as well. For more information on how to migrate check the
123
+ migration guide to v11.
124
+
125
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.5](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.4...@projectcaluma/ember-form-builder-v11.0.0-beta.5) (2022-02-02)
126
+
127
+
128
+ ### Bug Fixes
129
+
130
+ * **form-builder:** fix active filter in form list ([87a1016](https://github.com/projectcaluma/ember-caluma/commit/87a1016eb646436f04f7e6e891502f329fd8e8a0))
131
+
132
+ # [@projectcaluma/ember-form-builder-v11.0.0-beta.4](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.3...@projectcaluma/ember-form-builder-v11.0.0-beta.4) (2022-02-01)
133
+
134
+
135
+ ### Bug Fixes
136
+
137
+ * **form-builder:** omit isRequired property when saving action buttons ([27fb4ff](https://github.com/projectcaluma/ember-caluma/commit/27fb4ff9e394a4c9491c33374f1b088fd09274d3))
138
+
1
139
  # [@projectcaluma/ember-form-builder-v11.0.0-beta.3](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.2...@projectcaluma/ember-form-builder-v11.0.0-beta.3) (2022-01-24)
2
140
 
3
141
 
@@ -1,11 +1,27 @@
1
- {{component @labelComponent}}
1
+ <div class="uk-margin">
2
+ <@labelComponent />
2
3
 
3
- <div
4
- name={{@name}}
5
- class={{concat "uk-textarea cfb-code-editor language-" @language}}
6
- {{did-insert this.didInsertNode}}
7
- {{will-destroy this.willDestroyNode}}
8
- ></div>
4
+ <div class="uk-form-controls">
5
+ <div
6
+ name={{@name}}
7
+ class="uk-textarea cfb-code-editor {{concat 'language-' @language}}"
8
+ {{did-insert this.didInsertNode}}
9
+ {{will-destroy this.willDestroyNode}}
10
+ {{autoresize mode="height"}}
11
+ ></div>
12
+ </div>
9
13
 
10
- {{component @hintComponent}}
11
- {{component @errorComponent}}
14
+ {{#if (eq @language "markdown")}}
15
+ <small class="uk-text-muted">
16
+ {{t "caluma.form-builder.question.supportsMarkdownPrefix"}}
17
+ <a
18
+ target="_blank"
19
+ rel="noopener noreferrer"
20
+ href="https://www.markdownguide.org/basic-syntax"
21
+ >{{t "caluma.form-builder.question.markdown"}}</a>
22
+ </small>
23
+ {{/if}}
24
+
25
+ <@hintComponent />
26
+ <@errorComponent />
27
+ </div>
@@ -1,25 +1,73 @@
1
1
  import { action } from "@ember/object";
2
+ import { addObserver } from "@ember/object/observers";
2
3
  import Component from "@glimmer/component";
3
- import { tracked } from "@glimmer/tracking";
4
4
  import { CodeJar } from "codejar";
5
- import Prism from "prismjs";
6
- import "prismjs/components/prism-jexl.js";
7
- import "prismjs/components/prism-markdown.js";
5
+ import hljs from "highlight.js/lib/core";
6
+ import json from "highlight.js/lib/languages/json";
7
+ import markdown from "highlight.js/lib/languages/markdown";
8
+ import jexl from "highlightjs-jexl/src/languages/jexl";
9
+
10
+ hljs.registerLanguage("json", json);
11
+ hljs.registerLanguage("markdown", markdown);
12
+ hljs.registerLanguage("jexl", jexl);
8
13
 
9
14
  export default class CfbCodeEditorComponent extends Component {
10
- editor;
11
- @tracked show = false;
15
+ _editor = null;
16
+ _cursor = null;
17
+ _lastValue = null;
18
+
19
+ get value() {
20
+ const value = this.args.value;
21
+
22
+ if (this.args.language === "json" && typeof value === "object") {
23
+ return JSON.stringify(value?.unwrap?.() ?? value, null, 2);
24
+ }
25
+
26
+ return this.args.value;
27
+ }
28
+
29
+ @action
30
+ onUpdate(value) {
31
+ if (this._lastValue === value) return;
32
+
33
+ this._cursor = this._editor.save();
34
+
35
+ if (this.args.language === "json") {
36
+ try {
37
+ value = JSON.parse(value);
38
+ } catch {
39
+ // update value directly
40
+ }
41
+ }
42
+
43
+ this._lastValue = value;
44
+ this.args.update(value);
45
+ this.args.setDirty();
46
+ }
47
+
48
+ @action
49
+ updateCode() {
50
+ this._editor.updateCode(this.value);
51
+
52
+ if (this._cursor) {
53
+ this._editor.restore(this._cursor);
54
+ this._cursor = null;
55
+ }
56
+ }
12
57
 
13
58
  @action
14
59
  didInsertNode(element) {
15
- const highlight = (editor) => Prism.highlightElement(editor);
16
- this.editor = CodeJar(element, highlight);
17
- this.editor.updateCode(this.args.value);
18
- this.editor.onUpdate(this.args.update);
60
+ this._editor = CodeJar(element, (editor) => hljs.highlightElement(editor));
61
+ this._editor.onUpdate(this.onUpdate);
62
+
63
+ this.updateCode();
64
+
65
+ // eslint-disable-next-line ember/no-observers
66
+ addObserver(this.args, "value", this, "updateCode");
19
67
  }
20
68
 
21
69
  @action
22
70
  willDestroyNode() {
23
- this.editor.destroy();
71
+ this._editor.destroy();
24
72
  }
25
73
  }
@@ -55,11 +55,10 @@
55
55
  @name="description"
56
56
  @type="textarea"
57
57
  @label={{t "caluma.form-builder.form.description"}}
58
- @rows="4"
58
+ {{autoresize mode="height"}}
59
59
  />
60
60
 
61
61
  <f.input
62
- class="uk-flex uk-flex-between uk-flex-column"
63
62
  @name="isArchived"
64
63
  @label={{t "caluma.form-builder.form.isArchived"}}
65
64
  @required={{true}}
@@ -67,7 +66,6 @@
67
66
  />
68
67
 
69
68
  <f.input
70
- class="uk-flex uk-flex-between uk-flex-column"
71
69
  @name="isPublished"
72
70
  @label={{t "caluma.form-builder.form.isPublished"}}
73
71
  @required={{true}}
@@ -1,10 +1,10 @@
1
- import { getOwner } from "@ember/application";
2
1
  import { action } from "@ember/object";
3
2
  import { inject as service } from "@ember/service";
3
+ import { macroCondition, isTesting } from "@embroider/macros";
4
4
  import Component from "@glimmer/component";
5
5
  import { queryManager } from "ember-apollo-client";
6
6
  import { timeout, restartableTask, dropTask } from "ember-concurrency";
7
- import { useTask } from "ember-resources";
7
+ import { trackedTask } from "ember-resources/util/ember-concurrency";
8
8
 
9
9
  import FormValidations from "../../validations/form";
10
10
 
@@ -25,7 +25,7 @@ export default class CfbFormEditorGeneral extends Component {
25
25
  return this._data.value?.[0]?.node;
26
26
  }
27
27
 
28
- _data = useTask(this, this.fetchData, () => [this.args.slug]);
28
+ _data = trackedTask(this, this.fetchData, () => [this.args.slug]);
29
29
 
30
30
  @restartableTask
31
31
  *fetchData() {
@@ -103,10 +103,9 @@ export default class CfbFormEditorGeneral extends Component {
103
103
  @restartableTask
104
104
  *validateSlug(slug, changeset) {
105
105
  /* istanbul ignore next */
106
- if (
107
- getOwner(this).resolveRegistration("config:environment").environment !==
108
- "test"
109
- ) {
106
+ if (macroCondition(isTesting())) {
107
+ // no timeout
108
+ } else {
110
109
  yield timeout(500);
111
110
  }
112
111
 
@@ -1,13 +1,15 @@
1
1
  <div class="uk-margin">
2
- {{component @labelComponent}}
2
+ <@labelComponent />
3
3
 
4
- {{component
5
- (get-widget this.field.question)
6
- field=this.field
7
- disabled=false
8
- onSave=this.onUpdate
9
- }}
4
+ <div class="uk-form-controls">
5
+ {{component
6
+ (get-widget this.field.question)
7
+ field=this.field
8
+ disabled=false
9
+ onSave=this.onUpdate
10
+ }}
11
+ </div>
10
12
 
11
- {{component @hintComponent}}
12
- {{component @errorComponent}}
13
+ <@hintComponent />
14
+ <@errorComponent />
13
15
  </div>
@@ -1,5 +1,5 @@
1
1
  <div class="uk-margin">
2
- {{component @labelComponent}}
2
+ <@labelComponent />
3
3
 
4
4
  <UkSortable
5
5
  @handle=".uk-sortable-handle"
@@ -84,6 +84,6 @@
84
84
  </li>
85
85
  </UkSortable>
86
86
 
87
- {{component @hintComponent}}
88
- {{component @errorComponent}}
87
+ <@hintComponent />
88
+ <@errorComponent />
89
89
  </div>
@@ -1,17 +1,19 @@
1
- <div class="uk-margin" {{did-insert (perform this.availableFormatValidators)}}>
2
- {{component @labelComponent}}
1
+ <div class="uk-margin">
2
+ <@labelComponent />
3
3
 
4
- <PowerSelectMultiple
5
- @selected={{this.selected}}
6
- @placeholder={{this.placeholder}}
7
- @options={{this.validators}}
8
- @onChange={{this.updateValidators}}
9
- @renderInPlace={{true}}
10
- as |item|
11
- >
12
- {{item.name}}
13
- </PowerSelectMultiple>
4
+ <div class="uk-form-controls">
5
+ <PowerSelectMultiple
6
+ @selected={{this.selected}}
7
+ @placeholder={{@placeholder}}
8
+ @options={{this.validators}}
9
+ @onChange={{this.updateValidators}}
10
+ @renderInPlace={{true}}
11
+ as |item|
12
+ >
13
+ {{item.name}}
14
+ </PowerSelectMultiple>
15
+ </div>
14
16
 
15
- {{component @hintComponent}}
16
- {{component @errorComponent}}
17
+ <@hintComponent />
18
+ <@errorComponent />
17
19
  </div>
@@ -2,34 +2,38 @@ import { action } from "@ember/object";
2
2
  import Component from "@glimmer/component";
3
3
  import { queryManager } from "ember-apollo-client";
4
4
  import { dropTask } from "ember-concurrency";
5
+ import { trackedTask } from "ember-resources/util/ember-concurrency";
5
6
 
6
- import allFormatValidatorsQuery from "@projectcaluma/ember-core/gql/queries/all-format-validators.graphql";
7
+ import allFormatValidatorsQuery from "@projectcaluma/ember-form-builder/gql/queries/all-format-validators.graphql";
7
8
 
8
9
  export default class CfbFormEditorQuestionValidation extends Component {
9
10
  @queryManager apollo;
10
11
 
11
- @dropTask
12
- *availableFormatValidators() {
13
- const formatValidators = yield this.apollo.watchQuery(
14
- { query: allFormatValidatorsQuery, fetchPolicy: "cache-and-network" },
15
- "allFormatValidators.edges"
16
- );
17
- return formatValidators.map((edge) => edge.node);
18
- }
19
-
20
12
  get validators() {
21
- return this.availableFormatValidators?.lastSuccessful?.value || [];
13
+ return this._validators.value?.map((edge) => edge.node) ?? [];
22
14
  }
23
15
 
24
16
  get selected() {
25
17
  return this.validators.filter((validator) =>
26
- (this.args.value || []).includes(validator.slug)
18
+ (this.args.value?.edges.map((edge) => edge.node.slug) || []).includes(
19
+ validator.slug
20
+ )
21
+ );
22
+ }
23
+
24
+ _validators = trackedTask(this, this.fetchFormatValidators, () => []);
25
+
26
+ @dropTask
27
+ *fetchFormatValidators() {
28
+ return yield this.apollo.watchQuery(
29
+ { query: allFormatValidatorsQuery, fetchPolicy: "cache-and-network" },
30
+ "allFormatValidators.edges"
27
31
  );
28
32
  }
29
33
 
30
34
  @action
31
35
  updateValidators(value) {
32
- this.args.update(value.map((validator) => validator.slug));
36
+ this.args.update({ edges: value.map(({ slug }) => ({ node: { slug } })) });
33
37
  this.args.setDirty();
34
38
  }
35
39
  }
@@ -9,35 +9,33 @@
9
9
  ...attributes
10
10
  >
11
11
  <div class="uk-flex uk-flex-middle">
12
- <span class="uk-width-auto uk-margin-small-right">
13
- {{#if (eq @mode "reorder")}}
14
- <i
15
- role="button"
16
- data-test-sort-handle
17
- uk-icon="menu"
18
- class="uk-sortable-handle"
19
- >
20
- </i>
21
- {{else if (eq @mode "remove")}}
22
- <i
23
- role="button"
24
- data-test-remove-item
25
- uk-icon="minus"
26
- class="cfb-pointer uk-text-danger"
27
- {{on "click" (fn (optional @onRemoveQuestion) @question)}}
28
- >
29
- </i>
30
- {{else if (eq @mode "add")}}
31
- <i
32
- role="button"
33
- data-test-add-item
34
- uk-icon="plus"
35
- class="cfb-pointer uk-text-success"
36
- {{on "click" (fn (optional @onAddQuestion) @question)}}
37
- >
38
- </i>
39
- {{/if}}
40
- </span>
12
+ {{#if (eq @mode "reorder")}}
13
+ <i
14
+ role="button"
15
+ data-test-sort-handle
16
+ uk-icon="menu"
17
+ class="uk-sortable-handle uk-margin-small-right"
18
+ >
19
+ </i>
20
+ {{else if (eq @mode "remove")}}
21
+ <i
22
+ role="button"
23
+ data-test-remove-item
24
+ uk-icon="minus"
25
+ class="cfb-pointer uk-text-danger uk-margin-small-right"
26
+ {{on "click" (fn (optional @onRemoveQuestion) @question)}}
27
+ >
28
+ </i>
29
+ {{else if (eq @mode "add")}}
30
+ <i
31
+ role="button"
32
+ data-test-add-item
33
+ uk-icon="plus"
34
+ class="cfb-pointer uk-text-success uk-margin-small-right"
35
+ {{on "click" (fn (optional @onAddQuestion) @question)}}
36
+ >
37
+ </i>
38
+ {{/if}}
41
39
 
42
40
  {{#if (eq @mode "reorder")}}
43
41
  <a
@@ -80,12 +78,17 @@
80
78
 
81
79
  <span class="uk-position-relative uk-width-auto">
82
80
  <UkBadge
83
- uk-tooltip="title: {{if
84
- this.hidden
85
- (t
86
- (concat 'caluma.form-builder.question-list.hidden.' this.hiddenType)
81
+ {{uk-tooltip
82
+ (if
83
+ this.hidden
84
+ (t
85
+ (concat
86
+ "caluma.form-builder.question-list.hidden." this.hiddenType
87
+ )
88
+ )
87
89
  )
88
- }}; pos: left"
90
+ pos="left"
91
+ }}
89
92
  class="cfb-form-editor__question-list__item__type
90
93
  {{if
91
94
  this.hidden
@@ -103,11 +106,14 @@
103
106
  />
104
107
  {{#if this.required}}
105
108
  <span
106
- uk-tooltip="title: {{t
107
- (concat
108
- 'caluma.form-builder.question-list.required.' this.requiredType
109
+ {{uk-tooltip
110
+ (t
111
+ (concat
112
+ "caluma.form-builder.question-list.required." this.requiredType
113
+ )
109
114
  )
110
- }}; pos: top-left"
115
+ pos="top-left"
116
+ }}
111
117
  title={{t
112
118
  (concat
113
119
  "caluma.form-builder.question-list.required." this.requiredType
@@ -37,7 +37,7 @@
37
37
  </div>
38
38
 
39
39
  {{#if (includes this.mode (array "remove" "add"))}}
40
- <form class="uk-search uk-search-default uk-width-1-1">
40
+ <div class="uk-search uk-search-default uk-width-1-1">
41
41
  <span class="uk-search-icon-flip" uk-search-icon></span>
42
42
  <input
43
43
  class="uk-search-input"
@@ -47,7 +47,7 @@
47
47
  value={{this.search}}
48
48
  {{on "input" (fn (mut this.search))}}
49
49
  />
50
- </form>
50
+ </div>
51
51
  {{/if}}
52
52
 
53
53
  <ul
@@ -1,6 +1,7 @@
1
1
  import { action } from "@ember/object";
2
2
  import { run } from "@ember/runloop";
3
3
  import { inject as service } from "@ember/service";
4
+ import { macroCondition, isTesting } from "@embroider/macros";
4
5
  import Component from "@glimmer/component";
5
6
  import { tracked } from "@glimmer/tracking";
6
7
  import { queryManager } from "ember-apollo-client";
@@ -34,7 +35,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
34
35
  get questions() {
35
36
  return this.mode === "add"
36
37
  ? this.questionTaskValue
37
- : this.questionTaskValue.firstObject?.node.questions.edges;
38
+ : this.questionTaskValue[0]?.node.questions.edges;
38
39
  }
39
40
 
40
41
  // Use built in input component when it works instead of this getter and setter
@@ -55,8 +56,13 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
55
56
  const mode = this.mode;
56
57
  const search = mode !== "reorder" ? this.search : "";
57
58
 
58
- if (search) {
59
- yield timeout(500);
59
+ /* istanbul ignore next */
60
+ if (macroCondition(isTesting())) {
61
+ // no timeout
62
+ } else {
63
+ if (search) {
64
+ yield timeout(500);
65
+ }
60
66
  }
61
67
 
62
68
  if (mode === "add" && this.hasNextPage) {