@projectcaluma/ember-form-builder 11.0.0-beta.1 → 11.0.0-beta.2
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 +1066 -0
- package/addon/components/cfb-form-editor/question/validation.hbs +1 -0
- package/addon/components/cfb-form-editor/question.hbs +2 -0
- package/addon/engine.js +7 -10
- package/addon/utils/and.js +47 -0
- package/addon/utils/or.js +40 -0
- package/addon/validations/option.js +1 -1
- package/addon/validations/question.js +2 -2
- package/addon/validators/slug.js +1 -1
- package/app/utils/and.js +1 -0
- package/app/utils/or.js +1 -0
- package/index.js +6 -4
- package/package.json +17 -14
|
@@ -341,6 +341,7 @@
|
|
|
341
341
|
@noMatchesMessage={{t
|
|
342
342
|
"caluma.form-builder.question.search-empty"
|
|
343
343
|
}}
|
|
344
|
+
@renderInPlace={{true}}
|
|
344
345
|
as |form|
|
|
345
346
|
>
|
|
346
347
|
<span
|
|
@@ -413,6 +414,7 @@
|
|
|
413
414
|
"caluma.form-builder.question.search-placeholder"
|
|
414
415
|
}}
|
|
415
416
|
@noMatchesMessage={{t "caluma.form-builder.question.search-empty"}}
|
|
417
|
+
@renderInPlace={{true}}
|
|
416
418
|
as |form|
|
|
417
419
|
>
|
|
418
420
|
<span class="uk-width-auto uk-margin-small-right uk-text-truncate">
|
package/addon/engine.js
CHANGED
|
@@ -6,16 +6,13 @@ import config from "./config/environment";
|
|
|
6
6
|
|
|
7
7
|
const { modulePrefix } = config;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Resolver,
|
|
9
|
+
export default class FormBuilderEngine extends Engine {
|
|
10
|
+
modulePrefix = modulePrefix;
|
|
11
|
+
Resolver = Resolver;
|
|
13
12
|
|
|
14
|
-
dependencies
|
|
13
|
+
dependencies = {
|
|
15
14
|
services: ["apollo", "notification", "intl", "caluma-options", "validator"],
|
|
16
|
-
}
|
|
17
|
-
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
18
17
|
|
|
19
|
-
loadInitializers(
|
|
20
|
-
|
|
21
|
-
export default Eng;
|
|
18
|
+
loadInitializers(FormBuilderEngine, modulePrefix);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { typeOf } from "@ember/utils";
|
|
2
|
+
import { isPromise } from "validated-changeset";
|
|
3
|
+
|
|
4
|
+
function notTrue(value) {
|
|
5
|
+
return typeOf(value) !== "boolean" || !value;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function handleResult(result) {
|
|
9
|
+
if (notTrue(result)) throw result;
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Accepts an array of ember-changeset-validations validation functions.
|
|
15
|
+
*
|
|
16
|
+
* Copied and updated from nucleartide/ember-changeset-hofs
|
|
17
|
+
* @module and
|
|
18
|
+
*/
|
|
19
|
+
export default function and(...validators) {
|
|
20
|
+
return (key, newValue, oldValue, changes, object) => {
|
|
21
|
+
for (let i = 0; i < validators.length; i++) {
|
|
22
|
+
const validation = validators[i](
|
|
23
|
+
key,
|
|
24
|
+
newValue,
|
|
25
|
+
oldValue,
|
|
26
|
+
changes,
|
|
27
|
+
object
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (isPromise(validation)) {
|
|
31
|
+
let promise = validation.then(handleResult);
|
|
32
|
+
|
|
33
|
+
for (let j = i + 1; j < validators.length; j++) {
|
|
34
|
+
promise = promise
|
|
35
|
+
.then(() => validators[j](key, newValue, oldValue, changes, object))
|
|
36
|
+
.then(handleResult);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return promise.catch((err) => err);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (notTrue(validation)) return validation;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return true;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isPromise } from "validated-changeset";
|
|
2
|
+
|
|
3
|
+
function isTrue(value) {
|
|
4
|
+
return value === true;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function handleResult(result) {
|
|
8
|
+
if (isTrue(result)) throw true;
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Copied and updated from nucleartide/ember-changeset-hofs
|
|
14
|
+
* @module or
|
|
15
|
+
*/
|
|
16
|
+
export default function or(...validators) {
|
|
17
|
+
return (key, newValue, oldValue, changes, object) => {
|
|
18
|
+
let validation;
|
|
19
|
+
|
|
20
|
+
for (let i = 0; i < validators.length; i++) {
|
|
21
|
+
validation = validators[i](key, newValue, oldValue, changes, object);
|
|
22
|
+
|
|
23
|
+
if (isPromise(validation)) {
|
|
24
|
+
let promise = validation.then(handleResult);
|
|
25
|
+
|
|
26
|
+
for (let j = i + 1; j < validators.length; j++) {
|
|
27
|
+
promise = promise
|
|
28
|
+
.then(() => validators[j](key, newValue, oldValue, changes, object))
|
|
29
|
+
.then(handleResult);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return promise.catch((err) => err);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (isTrue(validation)) return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return validation;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
validateLength,
|
|
4
4
|
} from "ember-changeset-validations/validators";
|
|
5
5
|
|
|
6
|
-
import and from "@projectcaluma/ember-
|
|
6
|
+
import and from "@projectcaluma/ember-form-builder/utils/and";
|
|
7
7
|
import validateSlug from "@projectcaluma/ember-form-builder/validators/slug";
|
|
8
8
|
|
|
9
9
|
export default {
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import validateGtLt from "../validators/gt-lt";
|
|
8
8
|
import validateOptions from "../validators/options";
|
|
9
9
|
|
|
10
|
-
import and from "@projectcaluma/ember-
|
|
11
|
-
import or from "@projectcaluma/ember-
|
|
10
|
+
import and from "@projectcaluma/ember-form-builder/utils/and";
|
|
11
|
+
import or from "@projectcaluma/ember-form-builder/utils/or";
|
|
12
12
|
import validateSlug from "@projectcaluma/ember-form-builder/validators/slug";
|
|
13
13
|
import validateType from "@projectcaluma/ember-form-builder/validators/type";
|
|
14
14
|
|
package/addon/validators/slug.js
CHANGED
package/app/utils/and.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@projectcaluma/ember-form-builder/utils/and";
|
package/app/utils/or.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@projectcaluma/ember-form-builder/utils/or";
|
package/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line node/no-unpublished-require
|
|
4
|
-
const
|
|
4
|
+
const { buildEngine } = require("ember-engines/lib/engine-addon");
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
module.exports = EngineAddon.extend({
|
|
6
|
+
module.exports = buildEngine({
|
|
8
7
|
name: require("./package.json").name,
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
lazyLoading: {
|
|
10
|
+
enabled: false,
|
|
11
|
+
},
|
|
10
12
|
|
|
11
13
|
included(...args) {
|
|
12
14
|
this._super.included.apply(this, args);
|
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.2",
|
|
4
4
|
"description": "Ember engine for building Caluma forms.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -14,23 +14,26 @@
|
|
|
14
14
|
"test:ember": "ember test",
|
|
15
15
|
"test:ember-compatibility": "ember try:each"
|
|
16
16
|
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"ember-engines": ">= 0.8"
|
|
19
|
+
},
|
|
17
20
|
"dependencies": {
|
|
18
|
-
"@ember/render-modifiers": "^2.0.
|
|
21
|
+
"@ember/render-modifiers": "^2.0.3",
|
|
19
22
|
"@glimmer/component": "^1.0.4",
|
|
20
23
|
"@glimmer/tracking": "^1.0.4",
|
|
21
|
-
"@projectcaluma/ember-core": "^11.0.0-beta.
|
|
22
|
-
"@projectcaluma/ember-form": "^11.0.0-beta.
|
|
24
|
+
"@projectcaluma/ember-core": "^11.0.0-beta.2",
|
|
25
|
+
"@projectcaluma/ember-form": "^11.0.0-beta.2",
|
|
23
26
|
"codejar": "^3.5.0",
|
|
24
27
|
"ember-apollo-client": "^3.2.0",
|
|
25
|
-
"ember-auto-import": "^2.
|
|
26
|
-
"ember-changeset": "^
|
|
27
|
-
"ember-changeset-validations": "^
|
|
28
|
+
"ember-auto-import": "^2.3.0",
|
|
29
|
+
"ember-changeset": "^4.0.0-beta.1",
|
|
30
|
+
"ember-changeset-validations": "^4.0.0-beta.2",
|
|
28
31
|
"ember-cli-babel": "^7.26.11",
|
|
29
32
|
"ember-cli-htmlbars": "^6.0.1",
|
|
30
33
|
"ember-composable-helpers": "^5.0.0",
|
|
31
34
|
"ember-concurrency": "^2.2.0",
|
|
32
35
|
"ember-engines-router-service": "^0.3.0",
|
|
33
|
-
"ember-fetch": "^8.
|
|
36
|
+
"ember-fetch": "^8.1.1",
|
|
34
37
|
"ember-math-helpers": "^2.18.0",
|
|
35
38
|
"ember-pikaday": "^3.0.0",
|
|
36
39
|
"ember-power-select": "^5.0.3",
|
|
@@ -47,17 +50,17 @@
|
|
|
47
50
|
"devDependencies": {
|
|
48
51
|
"@ember/optional-features": "2.0.0",
|
|
49
52
|
"@ember/test-helpers": "2.6.0",
|
|
50
|
-
"@embroider/test-setup": "0.
|
|
51
|
-
"@
|
|
53
|
+
"@embroider/test-setup": "0.50.2",
|
|
54
|
+
"@faker-js/faker": "6.0.0-alpha.3",
|
|
55
|
+
"@projectcaluma/ember-testing": "10.2.0-beta.1",
|
|
52
56
|
"broccoli-asset-rev": "3.0.0",
|
|
53
57
|
"ember-cli": "3.28.5",
|
|
54
58
|
"ember-cli-code-coverage": "1.0.3",
|
|
55
59
|
"ember-cli-dependency-checker": "3.2.0",
|
|
56
60
|
"ember-cli-inject-live-reload": "2.1.0",
|
|
57
|
-
"ember-cli-mirage": "2.
|
|
61
|
+
"ember-cli-mirage": "2.3.1",
|
|
58
62
|
"ember-cli-sri": "2.1.1",
|
|
59
63
|
"ember-cli-terser": "4.0.2",
|
|
60
|
-
"ember-data": "3.28.7",
|
|
61
64
|
"ember-disable-prototype-extensions": "1.1.3",
|
|
62
65
|
"ember-engines": "0.8.20",
|
|
63
66
|
"ember-export-application-global": "2.0.1",
|
|
@@ -68,12 +71,12 @@
|
|
|
68
71
|
"ember-source": "3.28.8",
|
|
69
72
|
"ember-source-channel-url": "3.0.0",
|
|
70
73
|
"ember-try": "2.0.0",
|
|
71
|
-
"faker": "5.5.3",
|
|
72
74
|
"loader.js": "4.7.0",
|
|
75
|
+
"miragejs": "0.1.43",
|
|
73
76
|
"npm-run-all": "4.1.5",
|
|
74
77
|
"qunit": "2.17.2",
|
|
75
78
|
"qunit-dom": "2.0.0",
|
|
76
|
-
"webpack": "5.
|
|
79
|
+
"webpack": "5.66.0"
|
|
77
80
|
},
|
|
78
81
|
"engines": {
|
|
79
82
|
"node": "12.* || 14.* || >= 16"
|