@projectcaluma/ember-form-builder 11.0.0-beta.4 → 11.0.0-beta.8
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 +42 -0
- package/addon/components/cfb-form-editor/general.js +4 -4
- 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.js +5 -1
- package/addon/components/cfb-form-editor/question.hbs +3 -3
- package/addon/components/cfb-form-editor/question.js +11 -4
- package/addon/components/cfb-form-list.hbs +1 -1
- package/addon/components/cfb-form-list.js +7 -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/modifiers/pikaday.js +2 -0
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
# [@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)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **pikaday:** add pikaday modifier reexport in engines ([c13d302](https://github.com/projectcaluma/ember-caluma/commit/c13d3021bb8fe82e1245a60182af01287c507697))
|
|
7
|
+
|
|
8
|
+
# [@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)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** remove moment altogether and update ember-pikday ([b2f7fa2](https://github.com/projectcaluma/ember-caluma/commit/b2f7fa28fa076897addd36e5964c926c671508ff))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* **deps:** The host app now needs to opt-in to use the default
|
|
19
|
+
pikaday styles: https://github.com/adopted-ember-addons/ember-pikaday#styles
|
|
20
|
+
|
|
21
|
+
# [@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)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **validation:** sync format validator validation with backend ([ee66968](https://github.com/projectcaluma/ember-caluma/commit/ee66968230b9f0e4c5a4df8bdb3f8e58b44b5b82))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### BREAKING CHANGES
|
|
30
|
+
|
|
31
|
+
* **validation:** Use the `formatValidators` property of the backend to store and read
|
|
32
|
+
format validators instead of the `meta.formatValidators` so the backend
|
|
33
|
+
validates as well. For more information on how to migrate check the
|
|
34
|
+
migration guide to v11.
|
|
35
|
+
|
|
36
|
+
# [@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)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **form-builder:** fix active filter in form list ([87a1016](https://github.com/projectcaluma/ember-caluma/commit/87a1016eb646436f04f7e6e891502f329fd8e8a0))
|
|
42
|
+
|
|
1
43
|
# [@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)
|
|
2
44
|
|
|
3
45
|
|
|
@@ -102,11 +102,11 @@ 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
|
+
|
|
105
108
|
/* istanbul ignore next */
|
|
106
|
-
if (
|
|
107
|
-
getOwner(this).resolveRegistration("config:environment").environment !==
|
|
108
|
-
"test"
|
|
109
|
-
) {
|
|
109
|
+
if (environment !== "test") {
|
|
110
110
|
yield timeout(500);
|
|
111
111
|
}
|
|
112
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
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
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";
|
|
@@ -55,7 +56,10 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
|
|
|
55
56
|
const mode = this.mode;
|
|
56
57
|
const search = mode !== "reorder" ? this.search : "";
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
const { environment } =
|
|
60
|
+
getOwner(this).resolveRegistration("config:environment");
|
|
61
|
+
|
|
62
|
+
if (search && environment !== "test") {
|
|
59
63
|
yield timeout(500);
|
|
60
64
|
}
|
|
61
65
|
|
|
@@ -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
|
|
|
@@ -106,6 +106,7 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
106
106
|
subForm: {},
|
|
107
107
|
meta: {},
|
|
108
108
|
dataSource: "",
|
|
109
|
+
formatValidators: null,
|
|
109
110
|
// action button
|
|
110
111
|
action: ACTIONS[0],
|
|
111
112
|
color: COLORS[0],
|
|
@@ -258,6 +259,9 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
258
259
|
minLength: parseInt(changeset.get("minLength")),
|
|
259
260
|
maxLength: parseInt(changeset.get("maxLength")),
|
|
260
261
|
placeholder: changeset.get("placeholder"),
|
|
262
|
+
formatValidators: changeset
|
|
263
|
+
.get("formatValidators")
|
|
264
|
+
?.edges.map((edge) => edge.node.slug),
|
|
261
265
|
};
|
|
262
266
|
}
|
|
263
267
|
|
|
@@ -266,6 +270,9 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
266
270
|
minLength: parseInt(changeset.get("minLength")),
|
|
267
271
|
maxLength: parseInt(changeset.get("maxLength")),
|
|
268
272
|
placeholder: changeset.get("placeholder"),
|
|
273
|
+
formatValidators: changeset
|
|
274
|
+
.get("formatValidators")
|
|
275
|
+
?.edges.map((edge) => edge.node.slug),
|
|
269
276
|
};
|
|
270
277
|
}
|
|
271
278
|
|
|
@@ -419,11 +426,11 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
419
426
|
|
|
420
427
|
@restartableTask
|
|
421
428
|
*validateSlug(slug, changeset) {
|
|
429
|
+
const { environment } =
|
|
430
|
+
getOwner(this).resolveRegistration("config:environment");
|
|
431
|
+
|
|
422
432
|
/* istanbul ignore next */
|
|
423
|
-
if (
|
|
424
|
-
getOwner(this).resolveRegistration("config:environment").environment !==
|
|
425
|
-
"test"
|
|
426
|
-
) {
|
|
433
|
+
if (environment !== "test") {
|
|
427
434
|
yield timeout(500);
|
|
428
435
|
}
|
|
429
436
|
|
|
@@ -5,7 +5,7 @@
|
|
|
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>
|
|
@@ -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/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.8",
|
|
4
4
|
"description": "Ember engine for building Caluma forms.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -18,42 +18,42 @@
|
|
|
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.4",
|
|
25
|
+
"@projectcaluma/ember-form": "^11.0.0-beta.11",
|
|
26
26
|
"codejar": "^3.5.0",
|
|
27
27
|
"ember-apollo-client": "^3.2.0",
|
|
28
28
|
"ember-auto-import": "^2.4.0",
|
|
29
|
-
"ember-changeset": "^4.0.0-beta.
|
|
29
|
+
"ember-changeset": "^4.0.0-beta.4",
|
|
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",
|
|
33
33
|
"ember-composable-helpers": "^5.0.0",
|
|
34
|
-
"ember-concurrency": "^2.2.
|
|
34
|
+
"ember-concurrency": "^2.2.1",
|
|
35
35
|
"ember-engines-router-service": "^0.3.0",
|
|
36
36
|
"ember-fetch": "^8.1.1",
|
|
37
|
+
"ember-intl": "^5.7.2",
|
|
37
38
|
"ember-math-helpers": "^2.18.1",
|
|
38
|
-
"ember-pikaday": "^
|
|
39
|
+
"ember-pikaday": "^4.0.0",
|
|
39
40
|
"ember-power-select": "^5.0.3",
|
|
40
|
-
"ember-resources": "^4.
|
|
41
|
+
"ember-resources": "^4.3.1",
|
|
41
42
|
"ember-test-selectors": "^6.0.0",
|
|
42
|
-
"ember-uikit": "^5.0.0
|
|
43
|
-
"ember-validated-form": "^5.
|
|
43
|
+
"ember-uikit": "^5.0.0",
|
|
44
|
+
"ember-validated-form": "^5.2.2",
|
|
44
45
|
"graphql": "^15.8.0",
|
|
45
46
|
"graphql-tag": "^2.12.6",
|
|
46
47
|
"jexl": "^2.3.0",
|
|
47
|
-
"moment": "^2.29.1",
|
|
48
48
|
"prismjs": "^1.26.0"
|
|
49
49
|
},
|
|
50
50
|
"//": "TODO: remove ember-data when https://github.com/ember-engines/ember-engines/pull/794 is released",
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@ember/optional-features": "2.0.0",
|
|
53
53
|
"@ember/test-helpers": "2.6.0",
|
|
54
|
-
"@embroider/test-setup": "1.
|
|
55
|
-
"@faker-js/faker": "6.0.0-alpha.
|
|
56
|
-
"@projectcaluma/ember-testing": "
|
|
54
|
+
"@embroider/test-setup": "1.2.0",
|
|
55
|
+
"@faker-js/faker": "6.0.0-alpha.6",
|
|
56
|
+
"@projectcaluma/ember-testing": "11.0.0-beta.3",
|
|
57
57
|
"broccoli-asset-rev": "3.0.0",
|
|
58
58
|
"ember-cli": "3.28.5",
|
|
59
59
|
"ember-cli-code-coverage": "1.0.3",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"ember-cli-mirage": "2.4.0",
|
|
63
63
|
"ember-cli-sri": "2.1.1",
|
|
64
64
|
"ember-cli-terser": "4.0.2",
|
|
65
|
-
"ember-data": "3.28.
|
|
65
|
+
"ember-data": "3.28.8",
|
|
66
66
|
"ember-disable-prototype-extensions": "1.1.3",
|
|
67
67
|
"ember-engines": "0.8.20",
|
|
68
68
|
"ember-export-application-global": "2.0.1",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"npm-run-all": "4.1.5",
|
|
79
79
|
"qunit": "2.17.2",
|
|
80
80
|
"qunit-dom": "2.0.0",
|
|
81
|
-
"webpack": "5.
|
|
81
|
+
"webpack": "5.69.0"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|
|
84
84
|
"node": "12.* || 14.* || >= 16"
|