@projectcaluma/ember-form-builder 11.0.0-beta.2 → 11.0.0-beta.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/CHANGELOG.md +45 -0
- package/addon/components/cfb-form-editor/general.hbs +1 -1
- package/addon/components/cfb-form-editor/general.js +5 -6
- package/addon/components/cfb-form-editor/question/options.hbs +1 -1
- package/addon/components/cfb-form-editor/question/validation.hbs +2 -2
- package/addon/components/cfb-form-editor/question/validation.js +17 -13
- package/addon/components/cfb-form-editor/question-list/item.hbs +4 -4
- package/addon/components/cfb-form-editor/question-list/item.js +2 -2
- package/addon/components/cfb-form-editor/question-list.hbs +6 -6
- package/addon/components/cfb-form-editor/question-list.js +8 -5
- package/addon/components/cfb-form-editor/question.hbs +4 -4
- package/addon/components/cfb-form-editor/question.js +15 -7
- package/addon/components/cfb-form-editor.hbs +5 -5
- package/addon/components/cfb-form-list/item.hbs +1 -1
- package/addon/components/cfb-form-list.hbs +4 -4
- package/addon/components/cfb-form-list.js +7 -1
- package/addon/components/cfb-toggle-switch.hbs +1 -1
- package/addon/engine.js +1 -1
- package/addon/gql/queries/all-format-validators.graphql +10 -0
- package/addon/gql/queries/form-editor-question.graphql +14 -0
- package/addon/templates/edit/questions/edit.hbs +1 -1
- package/addon/templates/edit/questions/new.hbs +1 -4
- package/addon/templates/edit.hbs +5 -5
- package/addon/templates/index.hbs +1 -1
- package/addon/templates/new.hbs +1 -1
- package/package.json +17 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
# [@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)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **validation:** sync format validator validation with backend ([ee66968](https://github.com/projectcaluma/ember-caluma/commit/ee66968230b9f0e4c5a4df8bdb3f8e58b44b5b82))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* **validation:** Use the `formatValidators` property of the backend to store and read
|
|
12
|
+
format validators instead of the `meta.formatValidators` so the backend
|
|
13
|
+
validates as well. For more information on how to migrate check the
|
|
14
|
+
migration guide to v11.
|
|
15
|
+
|
|
16
|
+
# [@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)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* **form-builder:** fix active filter in form list ([87a1016](https://github.com/projectcaluma/ember-caluma/commit/87a1016eb646436f04f7e6e891502f329fd8e8a0))
|
|
22
|
+
|
|
23
|
+
# [@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)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* **form-builder:** omit isRequired property when saving action buttons ([27fb4ff](https://github.com/projectcaluma/ember-caluma/commit/27fb4ff9e394a4c9491c33374f1b088fd09274d3))
|
|
29
|
+
|
|
30
|
+
# [@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)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### chore
|
|
34
|
+
|
|
35
|
+
* **deps:** update ember-uikit to v5 beta ([6568d39](https://github.com/projectcaluma/ember-caluma/commit/6568d398216d33b44da5b659830ca3c200dd7012))
|
|
36
|
+
* **form-builder:** rename actions from dasherized to camelized ([6a79484](https://github.com/projectcaluma/ember-caluma/commit/6a7948435f1e38e1f8b9cca82d1e091742afcc08))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### BREAKING CHANGES
|
|
40
|
+
|
|
41
|
+
* **form-builder:** All previously dasherized expected actions are now
|
|
42
|
+
camelized. E.g `@on-add-question` becomes `@onAddQuestion`.
|
|
43
|
+
* **deps:** All `@projectcaluma/ember-*` packages now require
|
|
44
|
+
`ember-uikit` v5+.
|
|
45
|
+
|
|
1
46
|
# [@projectcaluma/ember-form-builder-v11.0.0-beta.2](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-builder-v11.0.0-beta.1...@projectcaluma/ember-form-builder-v11.0.0-beta.2) (2022-01-18)
|
|
2
47
|
|
|
3
48
|
|
|
@@ -3,7 +3,6 @@ import { action } from "@ember/object";
|
|
|
3
3
|
import { inject as service } from "@ember/service";
|
|
4
4
|
import Component from "@glimmer/component";
|
|
5
5
|
import { queryManager } from "ember-apollo-client";
|
|
6
|
-
import { optional } from "ember-composable-helpers/helpers/optional";
|
|
7
6
|
import { timeout, restartableTask, dropTask } from "ember-concurrency";
|
|
8
7
|
import { useTask } from "ember-resources";
|
|
9
8
|
|
|
@@ -89,7 +88,7 @@ export default class CfbFormEditorGeneral extends Component {
|
|
|
89
88
|
)
|
|
90
89
|
);
|
|
91
90
|
|
|
92
|
-
|
|
91
|
+
this.args.onAfterSubmit?.(form);
|
|
93
92
|
} catch (e) {
|
|
94
93
|
this.notification.danger(
|
|
95
94
|
this.intl.t(
|
|
@@ -103,11 +102,11 @@ export default class CfbFormEditorGeneral extends Component {
|
|
|
103
102
|
|
|
104
103
|
@restartableTask
|
|
105
104
|
*validateSlug(slug, changeset) {
|
|
105
|
+
const { environment } =
|
|
106
|
+
getOwner(this).resolveRegistration("config:environment");
|
|
107
|
+
|
|
106
108
|
/* istanbul ignore next */
|
|
107
|
-
if (
|
|
108
|
-
getOwner(this).resolveRegistration("config:environment").environment !==
|
|
109
|
-
"test"
|
|
110
|
-
) {
|
|
109
|
+
if (environment !== "test") {
|
|
111
110
|
yield timeout(500);
|
|
112
111
|
}
|
|
113
112
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<div class="uk-margin"
|
|
1
|
+
<div class="uk-margin">
|
|
2
2
|
{{component @labelComponent}}
|
|
3
3
|
|
|
4
4
|
<PowerSelectMultiple
|
|
5
5
|
@selected={{this.selected}}
|
|
6
|
-
@placeholder={{
|
|
6
|
+
@placeholder={{@placeholder}}
|
|
7
7
|
@options={{this.validators}}
|
|
8
8
|
@onChange={{this.updateValidators}}
|
|
9
9
|
@renderInPlace={{true}}
|
|
@@ -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 { useTask } from "ember-resources";
|
|
5
6
|
|
|
6
|
-
import allFormatValidatorsQuery from "@projectcaluma/ember-
|
|
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.
|
|
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(
|
|
18
|
+
(this.args.value?.edges.map((edge) => edge.node.slug) || []).includes(
|
|
19
|
+
validator.slug
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_validators = useTask(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((
|
|
36
|
+
this.args.update({ edges: value.map(({ slug }) => ({ node: { slug } })) });
|
|
33
37
|
this.args.setDirty();
|
|
34
38
|
}
|
|
35
39
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
@question.isArchived
|
|
5
5
|
"cfb-form-editor__question-list__item__archived"
|
|
6
6
|
}}
|
|
7
|
-
{{did-insert (fn (optional @
|
|
8
|
-
{{will-destroy (fn (optional @
|
|
7
|
+
{{did-insert (fn (optional @onRegister) this.elementId @question.slug)}}
|
|
8
|
+
{{will-destroy (fn (optional @onUnregister) this.elementId @question.slug)}}
|
|
9
9
|
...attributes
|
|
10
10
|
>
|
|
11
11
|
<div class="uk-flex uk-flex-middle">
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
data-test-remove-item
|
|
25
25
|
uk-icon="minus"
|
|
26
26
|
class="cfb-pointer uk-text-danger"
|
|
27
|
-
{{on "click" (fn (optional @
|
|
27
|
+
{{on "click" (fn (optional @onRemoveQuestion) @question)}}
|
|
28
28
|
>
|
|
29
29
|
</i>
|
|
30
30
|
{{else if (eq @mode "add")}}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
data-test-add-item
|
|
34
34
|
uk-icon="plus"
|
|
35
35
|
class="cfb-pointer uk-text-success"
|
|
36
|
-
{{on "click" (fn (optional @
|
|
36
|
+
{{on "click" (fn (optional @onAddQuestion) @question)}}
|
|
37
37
|
>
|
|
38
38
|
</i>
|
|
39
39
|
{{/if}}
|
|
@@ -51,12 +51,12 @@ export default class CfbFormEditorQuestionListItem extends Component {
|
|
|
51
51
|
@action
|
|
52
52
|
editQuestion(question, e) {
|
|
53
53
|
e.preventDefault();
|
|
54
|
-
this.args
|
|
54
|
+
this.args.onEditQuestion?.(question);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
@action
|
|
58
58
|
clickForm(form, e) {
|
|
59
59
|
e.preventDefault();
|
|
60
|
-
this.args
|
|
60
|
+
this.args.onClickForm?.(form);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
data-test-question-list-item={{item.node.slug}}
|
|
77
77
|
@mode={{this.mode}}
|
|
78
78
|
@question={{item.node}}
|
|
79
|
-
@
|
|
80
|
-
@
|
|
81
|
-
@
|
|
82
|
-
@
|
|
83
|
-
@
|
|
84
|
-
@
|
|
79
|
+
@onEditQuestion={{@onEditQuestion}}
|
|
80
|
+
@onRemoveQuestion={{perform this.removeQuestion}}
|
|
81
|
+
@onAddQuestion={{perform this.addQuestion}}
|
|
82
|
+
@onClickForm={{@onClickForm}}
|
|
83
|
+
@onRegister={{this.registerChild}}
|
|
84
|
+
@onUnregister={{this.unregisterChild}}
|
|
85
85
|
/>
|
|
86
86
|
{{else}}
|
|
87
87
|
<li
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { getOwner } from "@ember/application";
|
|
1
2
|
import { action } from "@ember/object";
|
|
2
3
|
import { run } from "@ember/runloop";
|
|
3
4
|
import { inject as service } from "@ember/service";
|
|
4
5
|
import Component from "@glimmer/component";
|
|
5
6
|
import { tracked } from "@glimmer/tracking";
|
|
6
7
|
import { queryManager } from "ember-apollo-client";
|
|
7
|
-
import { optional } from "ember-composable-helpers/helpers/optional";
|
|
8
8
|
import {
|
|
9
9
|
timeout,
|
|
10
10
|
enqueueTask,
|
|
@@ -56,7 +56,10 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
|
|
|
56
56
|
const mode = this.mode;
|
|
57
57
|
const search = mode !== "reorder" ? this.search : "";
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
const { environment } =
|
|
60
|
+
getOwner(this).resolveRegistration("config:environment");
|
|
61
|
+
|
|
62
|
+
if (search && environment !== "test") {
|
|
60
63
|
yield timeout(500);
|
|
61
64
|
}
|
|
62
65
|
|
|
@@ -148,7 +151,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
|
|
|
148
151
|
|
|
149
152
|
this.questionTask.perform();
|
|
150
153
|
|
|
151
|
-
|
|
154
|
+
this.args.onAfterAddQuestion?.(question);
|
|
152
155
|
} catch (e) {
|
|
153
156
|
this.notification.danger(
|
|
154
157
|
this.intl.t("caluma.form-builder.notification.form.add-question.error")
|
|
@@ -176,7 +179,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
|
|
|
176
179
|
)
|
|
177
180
|
);
|
|
178
181
|
|
|
179
|
-
|
|
182
|
+
this.args.onAfterRemoveQuestion?.(question);
|
|
180
183
|
} catch (e) {
|
|
181
184
|
this.notification.danger(
|
|
182
185
|
this.intl.t(
|
|
@@ -238,7 +241,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
|
|
|
238
241
|
createNewQuestion(e) {
|
|
239
242
|
e.preventDefault();
|
|
240
243
|
|
|
241
|
-
this.args
|
|
244
|
+
this.args.onCreateQuestion?.();
|
|
242
245
|
this.setMode("reorder");
|
|
243
246
|
}
|
|
244
247
|
}
|
|
@@ -207,13 +207,13 @@
|
|
|
207
207
|
/>
|
|
208
208
|
|
|
209
209
|
<f.input
|
|
210
|
-
@name="
|
|
210
|
+
@name="formatValidators"
|
|
211
211
|
@label={{t "caluma.form-builder.question.formatValidators"}}
|
|
212
212
|
@placeholder={{t "caluma.form-builder.question.choose"}}
|
|
213
213
|
@required={{false}}
|
|
214
214
|
@renderComponent={{component "cfb-form-editor/question/validation"}}
|
|
215
|
-
@on-update={{changeset-set f.model "
|
|
216
|
-
@value={{changeset-get f.model "
|
|
215
|
+
@on-update={{changeset-set f.model "formatValidators"}}
|
|
216
|
+
@value={{changeset-get f.model "formatValidators"}}
|
|
217
217
|
/>
|
|
218
218
|
{{/if}}
|
|
219
219
|
|
|
@@ -450,7 +450,7 @@
|
|
|
450
450
|
|
|
451
451
|
<UkButton
|
|
452
452
|
@color="link"
|
|
453
|
-
@
|
|
453
|
+
@onClick={{toggle-action "showAdvanced" this}}
|
|
454
454
|
class="uk-flex uk-flex-middle uk-margin"
|
|
455
455
|
>
|
|
456
456
|
{{#if this.showAdvanced}}
|
|
@@ -8,7 +8,6 @@ import { tracked } from "@glimmer/tracking";
|
|
|
8
8
|
import { queryManager } from "ember-apollo-client";
|
|
9
9
|
import Changeset from "ember-changeset";
|
|
10
10
|
import lookupValidator from "ember-changeset-validations";
|
|
11
|
-
import { optional } from "ember-composable-helpers/helpers/optional";
|
|
12
11
|
import { dropTask, restartableTask, task, timeout } from "ember-concurrency";
|
|
13
12
|
import { all } from "rsvp";
|
|
14
13
|
|
|
@@ -107,6 +106,7 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
107
106
|
subForm: {},
|
|
108
107
|
meta: {},
|
|
109
108
|
dataSource: "",
|
|
109
|
+
formatValidators: null,
|
|
110
110
|
// action button
|
|
111
111
|
action: ACTIONS[0],
|
|
112
112
|
color: COLORS[0],
|
|
@@ -222,7 +222,9 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
222
222
|
isArchived: changeset.get("isArchived"),
|
|
223
223
|
};
|
|
224
224
|
|
|
225
|
-
if (
|
|
225
|
+
if (
|
|
226
|
+
!hasQuestionType(changeset, "static", "calculated-float", "action-button")
|
|
227
|
+
) {
|
|
226
228
|
Object.assign(input, {
|
|
227
229
|
isRequired: changeset.get("isRequired"),
|
|
228
230
|
});
|
|
@@ -257,6 +259,9 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
257
259
|
minLength: parseInt(changeset.get("minLength")),
|
|
258
260
|
maxLength: parseInt(changeset.get("maxLength")),
|
|
259
261
|
placeholder: changeset.get("placeholder"),
|
|
262
|
+
formatValidators: changeset
|
|
263
|
+
.get("formatValidators")
|
|
264
|
+
?.edges.map((edge) => edge.node.slug),
|
|
260
265
|
};
|
|
261
266
|
}
|
|
262
267
|
|
|
@@ -265,6 +270,9 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
265
270
|
minLength: parseInt(changeset.get("minLength")),
|
|
266
271
|
maxLength: parseInt(changeset.get("maxLength")),
|
|
267
272
|
placeholder: changeset.get("placeholder"),
|
|
273
|
+
formatValidators: changeset
|
|
274
|
+
.get("formatValidators")
|
|
275
|
+
?.edges.map((edge) => edge.node.slug),
|
|
268
276
|
};
|
|
269
277
|
}
|
|
270
278
|
|
|
@@ -406,7 +414,7 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
406
414
|
this.intl.t("caluma.form-builder.notification.question.save.success")
|
|
407
415
|
);
|
|
408
416
|
|
|
409
|
-
|
|
417
|
+
this.args.onAfterSubmit?.(question);
|
|
410
418
|
} catch (e) {
|
|
411
419
|
// eslint-disable-next-line no-console
|
|
412
420
|
console.error(e);
|
|
@@ -418,11 +426,11 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
418
426
|
|
|
419
427
|
@restartableTask
|
|
420
428
|
*validateSlug(slug, changeset) {
|
|
429
|
+
const { environment } =
|
|
430
|
+
getOwner(this).resolveRegistration("config:environment");
|
|
431
|
+
|
|
421
432
|
/* istanbul ignore next */
|
|
422
|
-
if (
|
|
423
|
-
getOwner(this).resolveRegistration("config:environment").environment !==
|
|
424
|
-
"test"
|
|
425
|
-
) {
|
|
433
|
+
if (environment !== "test") {
|
|
426
434
|
yield timeout(500);
|
|
427
435
|
}
|
|
428
436
|
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
{{else}}
|
|
13
13
|
<CfbFormEditor::QuestionList
|
|
14
14
|
@form={{@slug}}
|
|
15
|
-
@
|
|
16
|
-
@
|
|
17
|
-
@
|
|
18
|
-
@
|
|
19
|
-
@
|
|
15
|
+
@onEditQuestion={{@onEditQuestion}}
|
|
16
|
+
@onCreateQuestion={{@onCreateQuestion}}
|
|
17
|
+
@onAfterAddQuestion={{@onAfterAddQuestion}}
|
|
18
|
+
@onAfterRemoveQuestion={{@onAfterRemoveQuestion}}
|
|
19
|
+
@onClickForm={{@onClickForm}}
|
|
20
20
|
/>
|
|
21
21
|
{{/if}}
|
|
22
22
|
</div>
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
{{#each (array "active" "archived" "all") as |category|}}
|
|
4
4
|
<UkButton
|
|
5
5
|
data-test-filter={{category}}
|
|
6
|
-
@
|
|
6
|
+
@onClick={{fn (perform this.setFilter) "category" category}}
|
|
7
7
|
@label={{t (concat "caluma.form-builder.form." category)}}
|
|
8
|
-
@
|
|
8
|
+
@color={{if (eq this.category category) "primary"}}
|
|
9
9
|
/>
|
|
10
10
|
{{/each}}
|
|
11
11
|
</div>
|
|
12
12
|
<div>
|
|
13
13
|
<UkButton
|
|
14
14
|
data-test-new-form
|
|
15
|
-
@
|
|
15
|
+
@onClick={{optional @onNewForm}}
|
|
16
16
|
@label={{t "caluma.form-builder.form.new"}}
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<CfbFormList::Item
|
|
38
38
|
data-test-form-list-item={{item.slug}}
|
|
39
39
|
@item={{item}}
|
|
40
|
-
@
|
|
40
|
+
@onEditForm={{@onEditForm}}
|
|
41
41
|
/>
|
|
42
42
|
{{/each}}
|
|
43
43
|
{{#if this.formsQuery.isLoading}}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getOwner } from "@ember/application";
|
|
1
2
|
import Component from "@glimmer/component";
|
|
2
3
|
import { tracked } from "@glimmer/tracking";
|
|
3
4
|
import { timeout, restartableTask } from "ember-concurrency";
|
|
@@ -30,7 +31,12 @@ export default class ComponentsCfbFormListComponent extends Component {
|
|
|
30
31
|
|
|
31
32
|
@restartableTask
|
|
32
33
|
*setFilter(name, eventOrValue) {
|
|
33
|
-
|
|
34
|
+
const { environment } =
|
|
35
|
+
getOwner(this).resolveRegistration("config:environment");
|
|
36
|
+
|
|
37
|
+
if (environment !== "test") {
|
|
38
|
+
yield timeout(500);
|
|
39
|
+
}
|
|
34
40
|
|
|
35
41
|
this[name] =
|
|
36
42
|
eventOrValue instanceof Event ? eventOrValue.target.value : eventOrValue;
|
package/addon/engine.js
CHANGED
|
@@ -11,7 +11,7 @@ export default class FormBuilderEngine extends Engine {
|
|
|
11
11
|
Resolver = Resolver;
|
|
12
12
|
|
|
13
13
|
dependencies = {
|
|
14
|
-
services: ["apollo", "notification", "intl", "caluma-options"
|
|
14
|
+
services: ["apollo", "notification", "intl", "caluma-options"],
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -33,11 +33,25 @@ query FormEditorQuestion($slug: String!) {
|
|
|
33
33
|
id
|
|
34
34
|
stringValue: value
|
|
35
35
|
}
|
|
36
|
+
formatValidators {
|
|
37
|
+
edges {
|
|
38
|
+
node {
|
|
39
|
+
slug
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
36
43
|
}
|
|
37
44
|
... on TextareaQuestion {
|
|
38
45
|
minLength
|
|
39
46
|
maxLength
|
|
40
47
|
placeholder
|
|
48
|
+
formatValidators {
|
|
49
|
+
edges {
|
|
50
|
+
node {
|
|
51
|
+
slug
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
41
55
|
defaultAnswer {
|
|
42
56
|
id
|
|
43
57
|
stringValue: value
|
package/addon/templates/edit.hbs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<CfbFormEditor
|
|
2
2
|
@slug={{@model}}
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@
|
|
6
|
-
@
|
|
7
|
-
@
|
|
3
|
+
@onEditQuestion={{this.editQuestion}}
|
|
4
|
+
@onCreateQuestion={{this.createQuestion}}
|
|
5
|
+
@onAfterAddQuestion={{this.editQuestion}}
|
|
6
|
+
@onAfterRemoveQuestion={{this.afterRemoveQuestion}}
|
|
7
|
+
@onClickForm={{this.clickForm}}
|
|
8
8
|
>
|
|
9
9
|
{{outlet}}
|
|
10
10
|
</CfbFormEditor>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<CfbFormList @
|
|
1
|
+
<CfbFormList @onNewForm={{this.newForm}} @onEditForm={{this.editForm}} />
|
package/addon/templates/new.hbs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-form-builder",
|
|
3
|
-
"version": "11.0.0-beta.
|
|
3
|
+
"version": "11.0.0-beta.6",
|
|
4
4
|
"description": "Ember engine for building Caluma forms.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"ember-engines": ">= 0.8"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@ember/render-modifiers": "^2.0.
|
|
21
|
+
"@ember/render-modifiers": "^2.0.4",
|
|
22
22
|
"@glimmer/component": "^1.0.4",
|
|
23
23
|
"@glimmer/tracking": "^1.0.4",
|
|
24
|
-
"@projectcaluma/ember-core": "^11.0.0-beta.
|
|
25
|
-
"@projectcaluma/ember-form": "^11.0.0-beta.
|
|
24
|
+
"@projectcaluma/ember-core": "^11.0.0-beta.3",
|
|
25
|
+
"@projectcaluma/ember-form": "^11.0.0-beta.7",
|
|
26
26
|
"codejar": "^3.5.0",
|
|
27
27
|
"ember-apollo-client": "^3.2.0",
|
|
28
|
-
"ember-auto-import": "^2.
|
|
29
|
-
"ember-changeset": "^4.0.0-beta.
|
|
28
|
+
"ember-auto-import": "^2.4.0",
|
|
29
|
+
"ember-changeset": "^4.0.0-beta.2",
|
|
30
30
|
"ember-changeset-validations": "^4.0.0-beta.2",
|
|
31
31
|
"ember-cli-babel": "^7.26.11",
|
|
32
32
|
"ember-cli-htmlbars": "^6.0.1",
|
|
@@ -34,12 +34,13 @@
|
|
|
34
34
|
"ember-concurrency": "^2.2.0",
|
|
35
35
|
"ember-engines-router-service": "^0.3.0",
|
|
36
36
|
"ember-fetch": "^8.1.1",
|
|
37
|
-
"ember-
|
|
37
|
+
"ember-intl": "^5.7.2",
|
|
38
|
+
"ember-math-helpers": "^2.18.1",
|
|
38
39
|
"ember-pikaday": "^3.0.0",
|
|
39
40
|
"ember-power-select": "^5.0.3",
|
|
40
|
-
"ember-resources": "^4.
|
|
41
|
+
"ember-resources": "^4.2.0",
|
|
41
42
|
"ember-test-selectors": "^6.0.0",
|
|
42
|
-
"ember-uikit": "^
|
|
43
|
+
"ember-uikit": "^5.0.0-beta.11",
|
|
43
44
|
"ember-validated-form": "^5.1.1",
|
|
44
45
|
"graphql": "^15.8.0",
|
|
45
46
|
"graphql-tag": "^2.12.6",
|
|
@@ -47,20 +48,22 @@
|
|
|
47
48
|
"moment": "^2.29.1",
|
|
48
49
|
"prismjs": "^1.26.0"
|
|
49
50
|
},
|
|
51
|
+
"//": "TODO: remove ember-data when https://github.com/ember-engines/ember-engines/pull/794 is released",
|
|
50
52
|
"devDependencies": {
|
|
51
53
|
"@ember/optional-features": "2.0.0",
|
|
52
54
|
"@ember/test-helpers": "2.6.0",
|
|
53
|
-
"@embroider/test-setup": "0.
|
|
54
|
-
"@faker-js/faker": "6.0.0-alpha.
|
|
55
|
-
"@projectcaluma/ember-testing": "
|
|
55
|
+
"@embroider/test-setup": "1.0.0",
|
|
56
|
+
"@faker-js/faker": "6.0.0-alpha.5",
|
|
57
|
+
"@projectcaluma/ember-testing": "11.0.0-beta.1",
|
|
56
58
|
"broccoli-asset-rev": "3.0.0",
|
|
57
59
|
"ember-cli": "3.28.5",
|
|
58
60
|
"ember-cli-code-coverage": "1.0.3",
|
|
59
61
|
"ember-cli-dependency-checker": "3.2.0",
|
|
60
62
|
"ember-cli-inject-live-reload": "2.1.0",
|
|
61
|
-
"ember-cli-mirage": "2.
|
|
63
|
+
"ember-cli-mirage": "2.4.0",
|
|
62
64
|
"ember-cli-sri": "2.1.1",
|
|
63
65
|
"ember-cli-terser": "4.0.2",
|
|
66
|
+
"ember-data": "3.28.7",
|
|
64
67
|
"ember-disable-prototype-extensions": "1.1.3",
|
|
65
68
|
"ember-engines": "0.8.20",
|
|
66
69
|
"ember-export-application-global": "2.0.1",
|
|
@@ -76,7 +79,7 @@
|
|
|
76
79
|
"npm-run-all": "4.1.5",
|
|
77
80
|
"qunit": "2.17.2",
|
|
78
81
|
"qunit-dom": "2.0.0",
|
|
79
|
-
"webpack": "5.
|
|
82
|
+
"webpack": "5.68.0"
|
|
80
83
|
},
|
|
81
84
|
"engines": {
|
|
82
85
|
"node": "12.* || 14.* || >= 16"
|