@projectcaluma/ember-form-builder 9.0.2 → 9.0.6
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/addon/components/cfb-float-input.hbs +14 -0
- package/addon/components/cfb-float-input.js +10 -4
- package/addon/components/cfb-form-editor/general.hbs +90 -86
- package/addon/components/cfb-form-editor/general.js +43 -45
- package/addon/components/cfb-form-editor/question/default/table.js +12 -0
- package/addon/components/cfb-form-editor/question/default.hbs +11 -9
- package/addon/components/cfb-form-editor/question/default.js +19 -29
- package/addon/components/cfb-form-editor/question/options.hbs +80 -82
- package/addon/components/cfb-form-editor/question/options.js +116 -105
- package/addon/components/cfb-form-editor/question/validation.hbs +14 -12
- package/addon/components/cfb-form-editor/question/validation.js +21 -30
- package/addon/components/cfb-form-editor/question-list/item.js +2 -4
- package/addon/components/cfb-form-editor/question.hbs +386 -360
- package/addon/components/cfb-form-editor/question.js +136 -145
- package/addon/components/cfb-form-list.hbs +1 -1
- package/addon/components/cfb-jexl-boolean-toggle-switch.hbs +12 -10
- package/addon/components/cfb-jexl-boolean-toggle-switch.js +11 -10
- package/addon/components/cfb-label.hbs +12 -4
- package/addon/components/cfb-navigation.js +1 -1
- package/addon/components/cfb-toggle-switch.hbs +14 -12
- package/addon/controllers/edit/questions/edit.js +4 -1
- package/addon/controllers/edit/questions/new.js +4 -1
- package/addon/controllers/edit.js +4 -4
- package/addon/controllers/index.js +5 -2
- package/addon/controllers/new.js +4 -1
- package/addon/engine.js +1 -8
- package/addon/validators/gt-lt.js +3 -2
- package/app/components/{cfb-float-input/input.js → cfb-form-editor/question/default/table.js} +1 -1
- package/package.json +18 -16
- package/translations/de.yaml +2 -2
- package/translations/en.yaml +2 -2
- package/addon/components/cfb-float-input/input.js +0 -12
- package/addon/components/cfb-label.js +0 -5
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { action } from "@ember/object";
|
|
2
|
+
import Component from "@glimmer/component";
|
|
2
3
|
|
|
3
|
-
export default
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export default class CfbFloatInput extends Component {
|
|
5
|
+
@action
|
|
6
|
+
onUpdate(event) {
|
|
7
|
+
event.preventDefault();
|
|
8
|
+
this.args.update(event.target.value);
|
|
9
|
+
this.args.setDirty();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,94 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
{{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
required=true
|
|
17
|
-
on-update=(action "updateName")
|
|
18
|
-
}}
|
|
19
|
-
|
|
20
|
-
{{#if (or slug (not prefix))}}
|
|
21
|
-
{{f.input
|
|
22
|
-
type="text"
|
|
23
|
-
label=(t "caluma.form-builder.form.slug")
|
|
24
|
-
name="slug"
|
|
25
|
-
required=true
|
|
26
|
-
disabled=slug
|
|
27
|
-
on-update=(action "updateSlug")
|
|
28
|
-
}}
|
|
29
|
-
{{else}}
|
|
1
|
+
<div
|
|
2
|
+
{{did-insert (perform this.data)}}
|
|
3
|
+
{{did-update (perform this.data) @slug}}
|
|
4
|
+
>
|
|
5
|
+
{{#if this.data.isRunning}}
|
|
6
|
+
<div class="uk-flex uk-flex-center uk-flex-middle uk-height-small">
|
|
7
|
+
<UkSpinner ratio="2" />
|
|
8
|
+
</div>
|
|
9
|
+
{{else}}
|
|
10
|
+
{{#with this.data.lastSuccessful.value.firstObject.node as |model|}}
|
|
11
|
+
<ValidatedForm
|
|
12
|
+
@model={{changeset model this.Validations}}
|
|
13
|
+
@on-submit={{perform this.submit}}
|
|
14
|
+
as |f|
|
|
15
|
+
>
|
|
30
16
|
<f.input
|
|
31
|
-
@
|
|
17
|
+
@type="text"
|
|
18
|
+
@label={{t "caluma.form-builder.form.name"}}
|
|
19
|
+
@name="name"
|
|
32
20
|
@required={{true}}
|
|
33
|
-
@
|
|
34
|
-
|
|
35
|
-
@on-update={{action "updateSlug" value="target.value"}}
|
|
36
|
-
as |fi|
|
|
37
|
-
>
|
|
38
|
-
<div class="cfb-prefixed">
|
|
39
|
-
<span class="cfb-prefixed-slug">{{prefix}}</span>
|
|
21
|
+
@on-update={{this.updateName}}
|
|
22
|
+
/>
|
|
40
23
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
24
|
+
{{#if (or @slug (not this.prefix))}}
|
|
25
|
+
<f.input
|
|
26
|
+
@type="text"
|
|
27
|
+
@name="slug"
|
|
28
|
+
@label={{t "caluma.form-builder.form.slug"}}
|
|
29
|
+
@required={{true}}
|
|
30
|
+
@disabled={{@slug}}
|
|
31
|
+
@on-update={{this.updateSlug}}
|
|
32
|
+
/>
|
|
33
|
+
{{else}}
|
|
34
|
+
<f.input
|
|
35
|
+
@name="slug"
|
|
36
|
+
@required={{true}}
|
|
37
|
+
@disabled={{@slug}}
|
|
38
|
+
@label={{t "caluma.form-builder.question.slug"}}
|
|
39
|
+
@on-update={{this.updateSlug value="target.value"}}
|
|
40
|
+
as |fi|
|
|
41
|
+
>
|
|
42
|
+
<div class="cfb-prefixed">
|
|
43
|
+
<span class="cfb-prefixed-slug">{{this.prefix}}</span>
|
|
44
|
+
<f.input
|
|
45
|
+
@type="text"
|
|
46
|
+
@model={{fi.model}}
|
|
47
|
+
@name={{fi.name}}
|
|
48
|
+
@value={{fi.value}}
|
|
49
|
+
@update={{fi.update}}
|
|
50
|
+
@setDirty={{fi.setDirty}}
|
|
51
|
+
@inputId={{fi.inputId}}
|
|
52
|
+
@isValid={{fi.isValid}}
|
|
53
|
+
@isInvalid={{fi.isInvalid}}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</f.input>
|
|
57
|
+
{{/if}}
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
<f.input
|
|
60
|
+
@name="description"
|
|
61
|
+
@type="textarea"
|
|
62
|
+
@label={{t "caluma.form-builder.form.description"}}
|
|
63
|
+
@rows="4"
|
|
64
|
+
/>
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
<f.input
|
|
67
|
+
class="uk-flex uk-flex-between uk-flex-column"
|
|
68
|
+
@name="isArchived"
|
|
69
|
+
@label={{t "caluma.form-builder.form.isArchived"}}
|
|
70
|
+
@required={{true}}
|
|
71
|
+
@renderComponent={{component "cfb-toggle-switch" size="small"}}
|
|
72
|
+
/>
|
|
70
73
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
<f.input
|
|
75
|
+
class="uk-flex uk-flex-between uk-flex-column"
|
|
76
|
+
@name="isPublished"
|
|
77
|
+
@label={{t "caluma.form-builder.form.isPublished"}}
|
|
78
|
+
@required={{true}}
|
|
79
|
+
@renderComponent={{component "cfb-toggle-switch" size="small"}}
|
|
80
|
+
/>
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
<div class="uk-text-right">
|
|
83
|
+
<f.submit
|
|
84
|
+
@disabled={{or f.loading f.model.isInvalid}}
|
|
85
|
+
@label={{t "caluma.form-builder.global.save"}}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
</ValidatedForm>
|
|
89
|
+
{{else}}
|
|
90
|
+
<div
|
|
91
|
+
class="uk-text-center uk-text-muted uk-padding uk-padding-remove-horizontal"
|
|
92
|
+
>
|
|
93
|
+
{{uk-icon "bolt" ratio=5}}
|
|
94
|
+
<p>{{t "caluma.form-builder.form.not-found" slug=@slug}}</p>
|
|
84
95
|
</div>
|
|
85
|
-
|
|
86
|
-
{{
|
|
87
|
-
|
|
88
|
-
class="uk-text-center uk-text-muted uk-padding uk-padding-remove-horizontal"
|
|
89
|
-
>
|
|
90
|
-
{{uk-icon "bolt" ratio=5}}
|
|
91
|
-
<p>{{t "caluma.form-builder.form.not-found" slug=slug}}</p>
|
|
92
|
-
</div>
|
|
93
|
-
{{/with}}
|
|
94
|
-
{{/if}}
|
|
96
|
+
{{/with}}
|
|
97
|
+
{{/if}}
|
|
98
|
+
</div>
|
|
@@ -1,35 +1,30 @@
|
|
|
1
1
|
import { getOwner } from "@ember/application";
|
|
2
2
|
import { A } from "@ember/array";
|
|
3
|
-
import
|
|
4
|
-
import { computed } from "@ember/object";
|
|
3
|
+
import { action } from "@ember/object";
|
|
5
4
|
import { inject as service } from "@ember/service";
|
|
5
|
+
import Component from "@glimmer/component";
|
|
6
6
|
import { queryManager } from "ember-apollo-client";
|
|
7
7
|
import { optional } from "ember-composable-helpers/helpers/optional";
|
|
8
|
-
import {
|
|
8
|
+
import { timeout, restartableTask, dropTask } from "ember-concurrency";
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FormValidations from "../../validations/form";
|
|
11
11
|
|
|
12
12
|
import slugify from "@projectcaluma/ember-core/utils/slugify";
|
|
13
13
|
import saveFormMutation from "@projectcaluma/ember-form-builder/gql/mutations/save-form.graphql";
|
|
14
14
|
import checkFormSlugQuery from "@projectcaluma/ember-form-builder/gql/queries/check-form-slug.graphql";
|
|
15
15
|
import formEditorGeneralQuery from "@projectcaluma/ember-form-builder/gql/queries/form-editor-general.graphql";
|
|
16
16
|
|
|
17
|
-
export default Component
|
|
18
|
-
|
|
17
|
+
export default class CfbFormEditorGeneral extends Component {
|
|
18
|
+
@service notification;
|
|
19
|
+
@service intl;
|
|
20
|
+
@service calumaOptions;
|
|
21
|
+
@queryManager apollo;
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
intl: service(),
|
|
22
|
-
calumaOptions: service(),
|
|
23
|
+
Validations = FormValidations;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this._super();
|
|
28
|
-
this.data.perform();
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
data: task(function* () {
|
|
32
|
-
if (!this.slug) {
|
|
25
|
+
@restartableTask
|
|
26
|
+
*data() {
|
|
27
|
+
if (!this.args.slug) {
|
|
33
28
|
return A([
|
|
34
29
|
{
|
|
35
30
|
node: {
|
|
@@ -45,22 +40,24 @@ export default Component.extend({
|
|
|
45
40
|
return yield this.apollo.watchQuery(
|
|
46
41
|
{
|
|
47
42
|
query: formEditorGeneralQuery,
|
|
48
|
-
variables: { slug: this.slug },
|
|
43
|
+
variables: { slug: this.args.slug },
|
|
49
44
|
fetchPolicy: "cache-and-network",
|
|
50
45
|
},
|
|
51
46
|
"allForms.edges"
|
|
52
47
|
);
|
|
53
|
-
}
|
|
48
|
+
}
|
|
54
49
|
|
|
55
|
-
prefix
|
|
50
|
+
get prefix() {
|
|
56
51
|
return this.calumaOptions.namespace
|
|
57
52
|
? `${this.calumaOptions.namespace}-`
|
|
58
53
|
: "";
|
|
59
|
-
}
|
|
54
|
+
}
|
|
60
55
|
|
|
61
|
-
|
|
56
|
+
@dropTask
|
|
57
|
+
*submit(changeset) {
|
|
62
58
|
try {
|
|
63
|
-
const slug =
|
|
59
|
+
const slug =
|
|
60
|
+
((!this.args.slug && this.prefix) || "") + changeset.get("slug");
|
|
64
61
|
|
|
65
62
|
const form = yield this.apollo.mutate(
|
|
66
63
|
{
|
|
@@ -81,24 +78,25 @@ export default Component.extend({
|
|
|
81
78
|
this.notification.success(
|
|
82
79
|
this.intl.t(
|
|
83
80
|
`caluma.form-builder.notification.form.${
|
|
84
|
-
this.slug ? "save" : "create"
|
|
81
|
+
this.args.slug ? "save" : "create"
|
|
85
82
|
}.success`
|
|
86
83
|
)
|
|
87
84
|
);
|
|
88
85
|
|
|
89
|
-
optional([this.
|
|
86
|
+
optional([this.args["on-after-submit"]])(form);
|
|
90
87
|
} catch (e) {
|
|
91
88
|
this.notification.danger(
|
|
92
89
|
this.intl.t(
|
|
93
90
|
`caluma.form-builder.notification.form.${
|
|
94
|
-
this.slug ? "save" : "create"
|
|
91
|
+
this.args.slug ? "save" : "create"
|
|
95
92
|
}.error`
|
|
96
93
|
)
|
|
97
94
|
);
|
|
98
95
|
}
|
|
99
|
-
}
|
|
96
|
+
}
|
|
100
97
|
|
|
101
|
-
|
|
98
|
+
@restartableTask
|
|
99
|
+
*validateSlug(slug, changeset) {
|
|
102
100
|
/* istanbul ignore next */
|
|
103
101
|
if (
|
|
104
102
|
getOwner(this).resolveRegistration("config:environment").environment !==
|
|
@@ -121,24 +119,24 @@ export default Component.extend({
|
|
|
121
119
|
this.intl.t("caluma.form-builder.validations.form.slug")
|
|
122
120
|
);
|
|
123
121
|
}
|
|
124
|
-
}
|
|
122
|
+
}
|
|
125
123
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
@action
|
|
125
|
+
updateName(value, changeset) {
|
|
126
|
+
changeset.set("name", value);
|
|
129
127
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
if (!this.args.slug) {
|
|
129
|
+
const slug = slugify(value, { locale: this.intl.primaryLocale });
|
|
130
|
+
changeset.set("slug", slug);
|
|
133
131
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
this.validateSlug.perform(this.prefix + slug, changeset);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
137
135
|
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
@action
|
|
137
|
+
updateSlug(value, changeset) {
|
|
138
|
+
changeset.set("slug", value);
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
140
|
+
this.validateSlug.perform(this.prefix + value, changeset);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import TableComponent from "@projectcaluma/ember-form/components/cf-field/input/table";
|
|
2
|
+
import { parseDocument } from "@projectcaluma/ember-form/lib/parsers";
|
|
3
|
+
|
|
4
|
+
export default class CfbFormEditorQuestionDefaultTableComponent extends TableComponent {
|
|
5
|
+
parseDocument(raw) {
|
|
6
|
+
raw.form.questions.edges = raw.form.questions.edges.map((edge) => ({
|
|
7
|
+
node: { ...edge.node, isHidden: "false", isRequired: "false" },
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
return parseDocument(raw);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
<div class="uk-margin">
|
|
2
|
+
{{component @labelComponent}}
|
|
2
3
|
|
|
3
|
-
{{component
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}}
|
|
4
|
+
{{component
|
|
5
|
+
(get-widget this.field.question)
|
|
6
|
+
field=this.field
|
|
7
|
+
disabled=false
|
|
8
|
+
onSave=this.onUpdate
|
|
9
|
+
}}
|
|
9
10
|
|
|
10
|
-
{{component hintComponent}}
|
|
11
|
-
{{component errorComponent}}
|
|
11
|
+
{{component @hintComponent}}
|
|
12
|
+
{{component @errorComponent}}
|
|
13
|
+
</div>
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { getOwner } from "@ember/application";
|
|
2
|
-
|
|
3
|
-
import { action, computed, get, set } from "@ember/object";
|
|
2
|
+
import { action } from "@ember/object";
|
|
4
3
|
import { inject as service } from "@ember/service";
|
|
5
|
-
import
|
|
4
|
+
import Component from "@glimmer/component";
|
|
6
5
|
|
|
7
6
|
import { TYPE_MAP } from "@projectcaluma/ember-form/lib/field";
|
|
8
7
|
|
|
9
|
-
export default class CfbFormEditorQuestionDefault extends
|
|
8
|
+
export default class CfbFormEditorQuestionDefault extends Component {
|
|
10
9
|
@service router;
|
|
11
10
|
|
|
12
|
-
@computed("model.{id,__typename}")
|
|
13
11
|
get question() {
|
|
14
12
|
const raw = {
|
|
15
|
-
...this.model.get("data"),
|
|
16
|
-
...this.model.get("change"),
|
|
13
|
+
...this.args.model.get("data"),
|
|
14
|
+
...this.args.model.get("change"),
|
|
17
15
|
// While we want the real value, typename, etc. of the question,
|
|
18
16
|
// the question should never be required or hidden in the form-builder.
|
|
19
17
|
// We need to set a value here as no value will lead to a Jexl error.
|
|
@@ -31,13 +29,13 @@ export default class CfbFormEditorQuestionDefault extends RenderComponent {
|
|
|
31
29
|
|
|
32
30
|
if (
|
|
33
31
|
["ChoiceQuestion", "MultipleChoiceQuestion"].includes(
|
|
34
|
-
this.model.__typename
|
|
32
|
+
this.args.model.__typename
|
|
35
33
|
)
|
|
36
34
|
) {
|
|
37
35
|
// Use Power Select for choice questions to save space.
|
|
38
36
|
raw.meta = { widgetOverride: "cf-field/input/powerselect" };
|
|
39
37
|
|
|
40
|
-
const key = this.model.__typename
|
|
38
|
+
const key = this.args.model.__typename
|
|
41
39
|
.replace(/^./, (match) => match.toLowerCase())
|
|
42
40
|
.replace("Question", "Options");
|
|
43
41
|
|
|
@@ -45,42 +43,33 @@ export default class CfbFormEditorQuestionDefault extends RenderComponent {
|
|
|
45
43
|
delete raw.options;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
if (this.model.__typename === "TableQuestion") {
|
|
46
|
+
if (this.args.model.__typename === "TableQuestion") {
|
|
49
47
|
raw.meta = { widgetOverride: "cfb-form-editor/question/default/table" };
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
return raw;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
// This @computed decorator is important. Otherwise, Ember will - under some
|
|
56
|
-
// circumstances - enter the getter method multiple times and throw an error.
|
|
57
|
-
@computed(
|
|
58
|
-
"model.{__typename,slug}",
|
|
59
|
-
"question",
|
|
60
|
-
"question.slug",
|
|
61
|
-
"router.currentRoute.attributes.formSlug",
|
|
62
|
-
"value.content"
|
|
63
|
-
)
|
|
64
53
|
get field() {
|
|
65
54
|
const rootForm = {
|
|
66
55
|
slug:
|
|
67
56
|
// There is no currentRoute in the integration tests.
|
|
68
|
-
|
|
57
|
+
this.router?.currentRoute?.attributes?.formSlug || "dv-form",
|
|
69
58
|
meta: {},
|
|
70
59
|
questions: [this.question],
|
|
71
60
|
__typename: "Form",
|
|
72
61
|
};
|
|
73
62
|
|
|
74
63
|
const newAnswer = {
|
|
75
|
-
id: btoa(`Answer:dv-answer-${this.model.slug}`),
|
|
76
|
-
__typename: TYPE_MAP[this.model.__typename],
|
|
64
|
+
id: btoa(`Answer:dv-answer-${this.args.model.slug}`),
|
|
65
|
+
__typename: TYPE_MAP[this.args.model.__typename],
|
|
77
66
|
};
|
|
78
67
|
|
|
79
68
|
// The value depends on where it comes from. If there is a default value
|
|
80
69
|
// present on load the `value.content` will be set. After an update through
|
|
81
70
|
// this component the value will be a POJO on `value`.
|
|
82
71
|
const answer = {
|
|
83
|
-
...(this.
|
|
72
|
+
...(this.args._value?.content || this.args._value || newAnswer),
|
|
84
73
|
question: this.question,
|
|
85
74
|
};
|
|
86
75
|
|
|
@@ -108,7 +97,7 @@ export default class CfbFormEditorQuestionDefault extends RenderComponent {
|
|
|
108
97
|
.factoryFor("caluma-model:document")
|
|
109
98
|
.create({
|
|
110
99
|
raw: {
|
|
111
|
-
id: btoa(`Document:dv-document-${this.model.slug}`),
|
|
100
|
+
id: btoa(`Document:dv-document-${this.args.model.slug}`),
|
|
112
101
|
rootForm,
|
|
113
102
|
forms: [rootForm],
|
|
114
103
|
answers: [answer],
|
|
@@ -119,12 +108,13 @@ export default class CfbFormEditorQuestionDefault extends RenderComponent {
|
|
|
119
108
|
return document.findField(this.question.slug);
|
|
120
109
|
}
|
|
121
110
|
|
|
122
|
-
@action
|
|
123
|
-
|
|
111
|
+
@action
|
|
112
|
+
async onUpdate(value) {
|
|
113
|
+
this.field.answer.value = value;
|
|
124
114
|
|
|
125
115
|
await this.field.validate.perform();
|
|
126
116
|
|
|
127
|
-
this.update({
|
|
117
|
+
this.args.update({
|
|
128
118
|
[this.field.answer._valueKey]: this.field.answer.serializedValue,
|
|
129
119
|
__typename: this.field.answer.__typename,
|
|
130
120
|
id: this.field.answer.id,
|
|
@@ -132,9 +122,9 @@ export default class CfbFormEditorQuestionDefault extends RenderComponent {
|
|
|
132
122
|
|
|
133
123
|
if (this.field.errors.length > 0) {
|
|
134
124
|
// The errors must be pushed after calling update.
|
|
135
|
-
this.model.pushErrors(this.name, ...this.field.errors);
|
|
125
|
+
this.args.model.pushErrors(this.args.name, ...this.field.errors);
|
|
136
126
|
}
|
|
137
127
|
|
|
138
|
-
this.setDirty();
|
|
128
|
+
this.args.setDirty();
|
|
139
129
|
}
|
|
140
130
|
}
|