@projectcaluma/ember-form-builder 11.0.0-beta.3 → 11.0.0-beta.7
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 +14 -5
- 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/package.json +16 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
# [@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)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** remove moment altogether and update ember-pikday ([b2f7fa2](https://github.com/projectcaluma/ember-caluma/commit/b2f7fa28fa076897addd36e5964c926c671508ff))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* **deps:** The host app now needs to opt-in to use the default
|
|
12
|
+
pikaday styles: https://github.com/adopted-ember-addons/ember-pikaday#styles
|
|
13
|
+
|
|
14
|
+
# [@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)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **validation:** sync format validator validation with backend ([ee66968](https://github.com/projectcaluma/ember-caluma/commit/ee66968230b9f0e4c5a4df8bdb3f8e58b44b5b82))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* **validation:** Use the `formatValidators` property of the backend to store and read
|
|
25
|
+
format validators instead of the `meta.formatValidators` so the backend
|
|
26
|
+
validates as well. For more information on how to migrate check the
|
|
27
|
+
migration guide to v11.
|
|
28
|
+
|
|
29
|
+
# [@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)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **form-builder:** fix active filter in form list ([87a1016](https://github.com/projectcaluma/ember-caluma/commit/87a1016eb646436f04f7e6e891502f329fd8e8a0))
|
|
35
|
+
|
|
36
|
+
# [@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)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **form-builder:** omit isRequired property when saving action buttons ([27fb4ff](https://github.com/projectcaluma/ember-caluma/commit/27fb4ff9e394a4c9491c33374f1b088fd09274d3))
|
|
42
|
+
|
|
1
43
|
# [@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
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],
|
|
@@ -221,7 +222,9 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
221
222
|
isArchived: changeset.get("isArchived"),
|
|
222
223
|
};
|
|
223
224
|
|
|
224
|
-
if (
|
|
225
|
+
if (
|
|
226
|
+
!hasQuestionType(changeset, "static", "calculated-float", "action-button")
|
|
227
|
+
) {
|
|
225
228
|
Object.assign(input, {
|
|
226
229
|
isRequired: changeset.get("isRequired"),
|
|
227
230
|
});
|
|
@@ -256,6 +259,9 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
256
259
|
minLength: parseInt(changeset.get("minLength")),
|
|
257
260
|
maxLength: parseInt(changeset.get("maxLength")),
|
|
258
261
|
placeholder: changeset.get("placeholder"),
|
|
262
|
+
formatValidators: changeset
|
|
263
|
+
.get("formatValidators")
|
|
264
|
+
?.edges.map((edge) => edge.node.slug),
|
|
259
265
|
};
|
|
260
266
|
}
|
|
261
267
|
|
|
@@ -264,6 +270,9 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
264
270
|
minLength: parseInt(changeset.get("minLength")),
|
|
265
271
|
maxLength: parseInt(changeset.get("maxLength")),
|
|
266
272
|
placeholder: changeset.get("placeholder"),
|
|
273
|
+
formatValidators: changeset
|
|
274
|
+
.get("formatValidators")
|
|
275
|
+
?.edges.map((edge) => edge.node.slug),
|
|
267
276
|
};
|
|
268
277
|
}
|
|
269
278
|
|
|
@@ -417,11 +426,11 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
417
426
|
|
|
418
427
|
@restartableTask
|
|
419
428
|
*validateSlug(slug, changeset) {
|
|
429
|
+
const { environment } =
|
|
430
|
+
getOwner(this).resolveRegistration("config:environment");
|
|
431
|
+
|
|
420
432
|
/* istanbul ignore next */
|
|
421
|
-
if (
|
|
422
|
-
getOwner(this).resolveRegistration("config:environment").environment !==
|
|
423
|
-
"test"
|
|
424
|
-
) {
|
|
433
|
+
if (environment !== "test") {
|
|
425
434
|
yield timeout(500);
|
|
426
435
|
}
|
|
427
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.7",
|
|
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.4",
|
|
25
|
+
"@projectcaluma/ember-form": "^11.0.0-beta.9",
|
|
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.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,25 +34,26 @@
|
|
|
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-
|
|
38
|
-
"ember-
|
|
37
|
+
"ember-intl": "^5.7.2",
|
|
38
|
+
"ember-math-helpers": "^2.18.1",
|
|
39
|
+
"ember-pikaday": "^4.0.0",
|
|
39
40
|
"ember-power-select": "^5.0.3",
|
|
40
|
-
"ember-resources": "^4.1
|
|
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.0",
|
|
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
|
+
"//": "TODO: remove ember-data when https://github.com/ember-engines/ember-engines/pull/794 is released",
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@ember/optional-features": "2.0.0",
|
|
52
53
|
"@ember/test-helpers": "2.6.0",
|
|
53
54
|
"@embroider/test-setup": "1.0.0",
|
|
54
|
-
"@faker-js/faker": "6.0.0-alpha.
|
|
55
|
-
"@projectcaluma/ember-testing": "
|
|
55
|
+
"@faker-js/faker": "6.0.0-alpha.5",
|
|
56
|
+
"@projectcaluma/ember-testing": "11.0.0-beta.2",
|
|
56
57
|
"broccoli-asset-rev": "3.0.0",
|
|
57
58
|
"ember-cli": "3.28.5",
|
|
58
59
|
"ember-cli-code-coverage": "1.0.3",
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
"ember-cli-mirage": "2.4.0",
|
|
62
63
|
"ember-cli-sri": "2.1.1",
|
|
63
64
|
"ember-cli-terser": "4.0.2",
|
|
65
|
+
"ember-data": "3.28.8",
|
|
64
66
|
"ember-disable-prototype-extensions": "1.1.3",
|
|
65
67
|
"ember-engines": "0.8.20",
|
|
66
68
|
"ember-export-application-global": "2.0.1",
|
|
@@ -76,7 +78,7 @@
|
|
|
76
78
|
"npm-run-all": "4.1.5",
|
|
77
79
|
"qunit": "2.17.2",
|
|
78
80
|
"qunit-dom": "2.0.0",
|
|
79
|
-
"webpack": "5.
|
|
81
|
+
"webpack": "5.68.0"
|
|
80
82
|
},
|
|
81
83
|
"engines": {
|
|
82
84
|
"node": "12.* || 14.* || >= 16"
|