@projectcaluma/ember-form-builder 11.0.0-beta.9 → 11.0.1
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.
- package/CHANGELOG.md +82 -0
- package/addon/components/cfb-code-editor.hbs +26 -10
- package/addon/components/cfb-code-editor.js +60 -11
- package/addon/components/cfb-form-editor/general.js +6 -7
- package/addon/components/cfb-form-editor/question/default.hbs +11 -9
- package/addon/components/cfb-form-editor/question/default.js +9 -4
- package/addon/components/cfb-form-editor/question/options.hbs +3 -3
- package/addon/components/cfb-form-editor/question/validation.hbs +15 -13
- package/addon/components/cfb-form-editor/question/validation.js +2 -2
- package/addon/components/cfb-form-editor/question-list/item.hbs +44 -38
- package/addon/components/cfb-form-editor/question-list.hbs +2 -2
- package/addon/components/cfb-form-editor/question-list.js +9 -7
- package/addon/components/cfb-form-editor/question.hbs +51 -90
- package/addon/components/cfb-form-editor/question.js +46 -34
- package/addon/components/cfb-form-list.hbs +7 -7
- package/addon/components/cfb-form-list.js +42 -15
- package/addon/controllers/index.js +6 -0
- package/addon/gql/mutations/add-form-question.graphql +1 -1
- package/addon/gql/mutations/remove-form-question.graphql +1 -1
- package/addon/gql/mutations/reorder-form-questions.graphql +1 -1
- package/addon/gql/mutations/save-calculated-float-question.graphql +1 -0
- package/addon/gql/mutations/save-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-date-question.graphql +3 -0
- package/addon/gql/mutations/save-dynamic-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-dynamic-multiple-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-files-question.graphql +14 -0
- package/addon/gql/mutations/save-float-question.graphql +1 -0
- package/addon/gql/mutations/save-integer-question.graphql +1 -0
- package/addon/gql/mutations/save-multiple-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-table-question.graphql +1 -0
- package/addon/gql/mutations/save-text-question.graphql +1 -0
- package/addon/gql/mutations/save-textarea-question.graphql +1 -0
- package/addon/gql/queries/check-form-slug.graphql +1 -1
- package/addon/gql/queries/check-question-slug.graphql +1 -1
- package/addon/gql/queries/form-editor-general.graphql +1 -1
- package/addon/gql/queries/form-editor-question.graphql +16 -2
- package/addon/gql/queries/search-form-question.graphql +3 -3
- package/addon/instance-initializers/form-builder-widget-overrides.js +15 -0
- package/addon/routes/edit/questions/edit.js +2 -1
- package/addon/routes/edit.js +1 -1
- package/addon/templates/index.hbs +8 -1
- package/addon/validations/question.js +13 -4
- package/addon/validators/gt-lt.js +17 -38
- package/addon/validators/jexl.js +49 -0
- package/app/instance-initializers/form-builder-widget-overrides.js +4 -0
- package/app/styles/@projectcaluma/ember-form-builder.scss +1 -1
- package/app/styles/_cfb-uikit-powerselect.scss +2 -0
- package/blueprints/@projectcaluma/ember-form-builder/index.js +1 -1
- package/config/environment.js +0 -7
- package/index.js +4 -2
- package/package.json +58 -48
- package/translations/de.yaml +5 -4
- package/translations/en.yaml +4 -3
- package/translations/fr.yaml +4 -4
- package/addon/components/cfb-float-input.hbs +0 -14
- package/addon/components/cfb-label.hbs +0 -12
- package/addon/gql/fragments/field.graphql +0 -247
- package/addon/gql/mutations/save-file-question.graphql +0 -11
- package/addon/modifiers/pikaday.js +0 -2
- package/app/components/cfb-float-input.js +0 -1
- package/app/components/cfb-label.js +0 -1
- package/app/styles/_cfb-powerselect.scss +0 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
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
|
+
|
|
1
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)
|
|
2
84
|
|
|
3
85
|
|
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
<div class="uk-margin">
|
|
2
|
+
<@labelComponent />
|
|
2
3
|
|
|
3
|
-
<div
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
{{on "blur" @setDirty}}
|
|
12
|
+
></div>
|
|
13
|
+
</div>
|
|
10
14
|
|
|
11
|
-
{{
|
|
12
|
-
|
|
15
|
+
{{#if (eq @language "markdown")}}
|
|
16
|
+
<small class="uk-text-muted">
|
|
17
|
+
{{t "caluma.form-builder.question.supportsMarkdownPrefix"}}
|
|
18
|
+
<a
|
|
19
|
+
target="_blank"
|
|
20
|
+
rel="noopener noreferrer"
|
|
21
|
+
href="https://www.markdownguide.org/basic-syntax"
|
|
22
|
+
>{{t "caluma.form-builder.question.markdown"}}</a>
|
|
23
|
+
</small>
|
|
24
|
+
{{/if}}
|
|
25
|
+
|
|
26
|
+
<@hintComponent />
|
|
27
|
+
<@errorComponent />
|
|
28
|
+
</div>
|
|
@@ -1,25 +1,74 @@
|
|
|
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
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
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.configure({ ignoreUnescapedHTML: true });
|
|
11
|
+
|
|
12
|
+
hljs.registerLanguage("json", json);
|
|
13
|
+
hljs.registerLanguage("markdown", markdown);
|
|
14
|
+
hljs.registerLanguage("jexl", jexl);
|
|
8
15
|
|
|
9
16
|
export default class CfbCodeEditorComponent extends Component {
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
_editor = null;
|
|
18
|
+
_cursor = null;
|
|
19
|
+
_lastValue = null;
|
|
20
|
+
|
|
21
|
+
get value() {
|
|
22
|
+
const value = this.args.value;
|
|
23
|
+
|
|
24
|
+
if (this.args.language === "json" && typeof value === "object") {
|
|
25
|
+
return JSON.stringify(value?.unwrap?.() ?? value, null, 2);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return this.args.value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@action
|
|
32
|
+
onUpdate(value) {
|
|
33
|
+
if (this._lastValue === value) return;
|
|
34
|
+
|
|
35
|
+
this._cursor = this._editor.save();
|
|
36
|
+
|
|
37
|
+
if (this.args.language === "json") {
|
|
38
|
+
try {
|
|
39
|
+
value = JSON.parse(value);
|
|
40
|
+
} catch {
|
|
41
|
+
// update value directly
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this._lastValue = value;
|
|
46
|
+
this.args.update(value);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@action
|
|
50
|
+
updateCode() {
|
|
51
|
+
this._editor.updateCode(this.value);
|
|
52
|
+
|
|
53
|
+
if (this._cursor) {
|
|
54
|
+
this._editor.restore(this._cursor);
|
|
55
|
+
this._cursor = null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
12
58
|
|
|
13
59
|
@action
|
|
14
60
|
didInsertNode(element) {
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
|
|
18
|
-
this.
|
|
61
|
+
this._editor = CodeJar(element, (editor) => hljs.highlightElement(editor));
|
|
62
|
+
this._editor.onUpdate(this.onUpdate);
|
|
63
|
+
|
|
64
|
+
this.updateCode();
|
|
65
|
+
|
|
66
|
+
// eslint-disable-next-line ember/no-observers
|
|
67
|
+
addObserver(this.args, "value", this, "updateCode");
|
|
19
68
|
}
|
|
20
69
|
|
|
21
70
|
@action
|
|
22
71
|
willDestroyNode() {
|
|
23
|
-
this.
|
|
72
|
+
this._editor.destroy();
|
|
24
73
|
}
|
|
25
74
|
}
|
|
@@ -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 {
|
|
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 =
|
|
28
|
+
_data = trackedTask(this, this.fetchData, () => [this.args.slug]);
|
|
29
29
|
|
|
30
30
|
@restartableTask
|
|
31
31
|
*fetchData() {
|
|
@@ -102,11 +102,10 @@ export default class CfbFormEditorGeneral extends Component {
|
|
|
102
102
|
|
|
103
103
|
@restartableTask
|
|
104
104
|
*validateSlug(slug, changeset) {
|
|
105
|
-
const { environment } =
|
|
106
|
-
getOwner(this).resolveRegistration("config:environment");
|
|
107
|
-
|
|
108
105
|
/* istanbul ignore next */
|
|
109
|
-
if (
|
|
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
|
-
|
|
2
|
+
<@labelComponent />
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
+
<@hintComponent />
|
|
14
|
+
<@errorComponent />
|
|
13
15
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getOwner } from "@ember/application";
|
|
2
2
|
import { action } from "@ember/object";
|
|
3
3
|
import { inject as service } from "@ember/service";
|
|
4
|
+
import { camelize } from "@ember/string";
|
|
4
5
|
import Component from "@glimmer/component";
|
|
5
6
|
|
|
6
7
|
import { TYPE_MAP } from "@projectcaluma/ember-form/lib/field";
|
|
@@ -60,16 +61,20 @@ export default class CfbFormEditorQuestionDefault extends Component {
|
|
|
60
61
|
__typename: "Form",
|
|
61
62
|
};
|
|
62
63
|
|
|
64
|
+
const typename = TYPE_MAP[this.args.model.__typename];
|
|
65
|
+
const valueKey = camelize(typename.replace(/Answer$/, "Value"));
|
|
66
|
+
|
|
63
67
|
const newAnswer = {
|
|
64
68
|
id: btoa(`Answer:dv-answer-${this.args.model.slug}`),
|
|
65
|
-
__typename:
|
|
69
|
+
__typename: typename,
|
|
70
|
+
[valueKey]: undefined,
|
|
66
71
|
};
|
|
67
72
|
|
|
68
73
|
// The value depends on where it comes from. If there is a default value
|
|
69
74
|
// present on load the `value.content` will be set. After an update through
|
|
70
75
|
// this component the value will be a POJO on `value`.
|
|
71
76
|
const answer = {
|
|
72
|
-
...(this.args.
|
|
77
|
+
...(this.args.value?.content ?? this.args.value ?? newAnswer),
|
|
73
78
|
question: this.question,
|
|
74
79
|
};
|
|
75
80
|
|
|
@@ -115,8 +120,8 @@ export default class CfbFormEditorQuestionDefault extends Component {
|
|
|
115
120
|
|
|
116
121
|
this.args.update({
|
|
117
122
|
[this.field.answer._valueKey]: this.field.answer.serializedValue,
|
|
118
|
-
__typename: this.field.answer.__typename,
|
|
119
|
-
id: this.field.answer.id,
|
|
123
|
+
__typename: this.field.answer.raw.__typename,
|
|
124
|
+
id: this.field.answer.raw.id,
|
|
120
125
|
});
|
|
121
126
|
|
|
122
127
|
if (this.field.errors.length > 0) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="uk-margin">
|
|
2
|
-
|
|
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
|
-
|
|
88
|
-
|
|
87
|
+
<@hintComponent />
|
|
88
|
+
<@errorComponent />
|
|
89
89
|
</div>
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
<div class="uk-margin">
|
|
2
|
-
|
|
2
|
+
<@labelComponent />
|
|
3
3
|
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
+
<@hintComponent />
|
|
18
|
+
<@errorComponent />
|
|
17
19
|
</div>
|
|
@@ -2,7 +2,7 @@ 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 {
|
|
5
|
+
import { trackedTask } from "ember-resources/util/ember-concurrency";
|
|
6
6
|
|
|
7
7
|
import allFormatValidatorsQuery from "@projectcaluma/ember-form-builder/gql/queries/all-format-validators.graphql";
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ export default class CfbFormEditorQuestionValidation extends Component {
|
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
_validators =
|
|
24
|
+
_validators = trackedTask(this, this.fetchFormatValidators, () => []);
|
|
25
25
|
|
|
26
26
|
@dropTask
|
|
27
27
|
*fetchFormatValidators() {
|
|
@@ -9,35 +9,33 @@
|
|
|
9
9
|
...attributes
|
|
10
10
|
>
|
|
11
11
|
<div class="uk-flex uk-flex-middle">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
(
|
|
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
|
-
|
|
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
|
|
107
|
-
(
|
|
108
|
-
|
|
109
|
+
{{uk-tooltip
|
|
110
|
+
(t
|
|
111
|
+
(concat
|
|
112
|
+
"caluma.form-builder.question-list.required." this.requiredType
|
|
113
|
+
)
|
|
109
114
|
)
|
|
110
|
-
|
|
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
|
-
<
|
|
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
|
-
</
|
|
50
|
+
</div>
|
|
51
51
|
{{/if}}
|
|
52
52
|
|
|
53
53
|
<ul
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getOwner } from "@ember/application";
|
|
2
1
|
import { action } from "@ember/object";
|
|
3
2
|
import { run } from "@ember/runloop";
|
|
4
3
|
import { inject as service } from "@ember/service";
|
|
4
|
+
import { macroCondition, isTesting } from "@embroider/macros";
|
|
5
5
|
import Component from "@glimmer/component";
|
|
6
6
|
import { tracked } from "@glimmer/tracking";
|
|
7
7
|
import { queryManager } from "ember-apollo-client";
|
|
@@ -35,7 +35,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
|
|
|
35
35
|
get questions() {
|
|
36
36
|
return this.mode === "add"
|
|
37
37
|
? this.questionTaskValue
|
|
38
|
-
: this.questionTaskValue
|
|
38
|
+
: this.questionTaskValue[0]?.node.questions.edges;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Use built in input component when it works instead of this getter and setter
|
|
@@ -56,11 +56,13 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
|
|
|
56
56
|
const mode = this.mode;
|
|
57
57
|
const search = mode !== "reorder" ? this.search : "";
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
/* istanbul ignore next */
|
|
60
|
+
if (macroCondition(isTesting())) {
|
|
61
|
+
// no timeout
|
|
62
|
+
} else {
|
|
63
|
+
if (search) {
|
|
64
|
+
yield timeout(500);
|
|
65
|
+
}
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
if (mode === "add" && this.hasNextPage) {
|