@sealcode/jdd 0.8.4 → 0.8.5
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/.nyc_output/5e04dab5-853d-4723-8330-e33ecbca8dcb.json +1 -0
- package/.nyc_output/processinfo/5e04dab5-853d-4723-8330-e33ecbca8dcb.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/.xunit +48 -0
- package/@types/component-arguments/boolean.d.ts +11 -0
- package/@types/component-arguments/component-arguments.d.ts +1 -0
- package/coverage/clover.xml +967 -0
- package/lib/component-arguments/boolean.js +41 -0
- package/lib/component-arguments/boolean.js.map +1 -0
- package/lib/component-arguments/component-arguments.js +1 -0
- package/lib/component-arguments/component-arguments.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComponentArgument } from "../index.js";
|
|
2
|
+
export class BooleanArgument extends ComponentArgument {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.example_values = [true, false];
|
|
6
|
+
}
|
|
7
|
+
countWords(ctx, value) {
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
getSubArgument() {
|
|
11
|
+
return [null, [], null];
|
|
12
|
+
}
|
|
13
|
+
async receivedToParsed(context, value) {
|
|
14
|
+
if (value == "false") {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
// JDD sends the values of the fields from the form and then they are merged with the previous state of the form.
|
|
18
|
+
// HTML does not send any value for a checkbox that is unchecked — so we don't get a chance to parse it.
|
|
19
|
+
// To overcome it, we always add a hidden input that sets the value to "false"
|
|
20
|
+
// if the checkbox is unchecked, then only the "false" value gets sent
|
|
21
|
+
// if the checkbox is checked, then two values are sent under the same name, and the value is parsed as an array:
|
|
22
|
+
// ["false", "on"]
|
|
23
|
+
if (Array.isArray(value) && value[1] == "on") {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return Boolean(value);
|
|
27
|
+
}
|
|
28
|
+
async parsedToStorage(context, value) {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
async storageToParsed(context, value) {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
getTypeName() {
|
|
35
|
+
return "boolean";
|
|
36
|
+
}
|
|
37
|
+
getEmptyValue() {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=boolean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/component-arguments/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAc,MAAM,aAAa,CAAC;AAE5D,MAAM,OAAO,eAAgB,SAAQ,iBAIpC;IAJD;;QA0CC,mBAAc,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAShC,CAAC;IA9CA,UAAU,CAAC,GAAe,EAAE,KAAc;QACzC,OAAO,CAAC,CAAC;IACV,CAAC;IACD,cAAc;QACb,OAAc,CAAC,IAAI,EAAE,EAAc,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,gBAAgB,CACrB,OAAmB,EACnB,KAAa;QAEb,IAAI,KAAK,IAAI,OAAO,EAAE;YACrB,OAAO,KAAK,CAAC;SACb;QACD,iHAAiH;QACjH,wGAAwG;QACxG,8EAA8E;QAC9E,sEAAsE;QACtE,iHAAiH;QACjH,kBAAkB;QAClB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;YAC7C,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,KAAK,CAAC,eAAe,CACpB,OAAmB,EACnB,KAAc;QAEd,OAAO,KAAK,CAAC;IACd,CAAC;IACD,KAAK,CAAC,eAAe,CACpB,OAAmB,EACnB,KAAc;QAEd,OAAO,KAAK,CAAC;IACd,CAAC;IAGD,WAAW;QACV,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,aAAa;QACZ,OAAO,KAAK,CAAC;IACd,CAAC;CACD"}
|
|
@@ -13,5 +13,6 @@ export { Number } from "./number.js";
|
|
|
13
13
|
export { Color } from "./color.js";
|
|
14
14
|
export { Link } from "./link.js";
|
|
15
15
|
export { Code } from "./code.js";
|
|
16
|
+
export { BooleanArgument as Boolean } from "./boolean.js";
|
|
16
17
|
export { CollectionName } from "./collection-name.js";
|
|
17
18
|
//# sourceMappingURL=component-arguments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-arguments.js","sourceRoot":"","sources":["../../src/component-arguments/component-arguments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"component-arguments.js","sourceRoot":"","sources":["../../src/component-arguments/component-arguments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|