@tsed/schema-formio 7.0.0-beta.11 → 7.0.0-beta.12
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.
|
@@ -8,8 +8,7 @@ function sanitize(customConditional) {
|
|
|
8
8
|
const [signature, ...fn] = str.split("=>");
|
|
9
9
|
let content = fn.join("=>");
|
|
10
10
|
if (!signature.includes("{")) {
|
|
11
|
-
|
|
12
|
-
content = content.replace(new RegExp(reg, "gi"), "");
|
|
11
|
+
content = content.replace(new RegExp(`${signature.trim()}.`, "gi"), "");
|
|
13
12
|
}
|
|
14
13
|
return `show = ${content.trim()}`;
|
|
15
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customConditional.js","sourceRoot":"","sources":["../../../src/decorators/customConditional.ts"],"names":[],"mappings":";;;AAIA,2CAAsC;AACtC,qCAAqC;AAiDrC,SAAS,QAAQ,CAAC,iBAA2B;IAC3C,MAAM,GAAG,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAEzC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC5B,
|
|
1
|
+
{"version":3,"file":"customConditional.js","sourceRoot":"","sources":["../../../src/decorators/customConditional.ts"],"names":[],"mappings":";;;AAIA,2CAAsC;AACtC,qCAAqC;AAiDrC,SAAS,QAAQ,CAAC,iBAA2B;IAC3C,MAAM,GAAG,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAEzC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC5B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;KACzE;IAED,OAAO,UAAU,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;AACpC,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAAC,iBAAgE;IAChG,IAAI,IAAA,gBAAS,EAAC,iBAAiB,CAAC,EAAE;QAChC,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KACjD;IAED,OAAO,IAAA,qBAAS,EAAC;QACf,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC;AARD,8CAQC","sourcesContent":["import {FormioComponent, FormioForm, FormioSubmission} from \"@tsed/formio-types\";\nimport type {Moment} from \"moment\";\nimport type {LoDashStatic} from \"lodash\";\nimport type {Utils} from \"formiojs\";\nimport {Component} from \"./component\";\nimport {isArrowFn} from \"@tsed/core\";\n\nexport interface CustomConditionalCtx<Value = any, Data = any, Row = any> {\n /**\n * The complete submission object.\n */\n form: FormioForm;\n /**\n * The complete submission object.\n */\n submission: FormioSubmission<Data>;\n /**\n * The complete submission data object.\n */\n data: Data;\n /**\n * Contextual \"row\" data, used within DataGrid, EditGrid, and Container components\n */\n row: Row;\n /**\n * The current component JSON\n */\n component: FormioComponent;\n /**\n * The current component instance.\n */\n instance: any;\n /**\n * The current value of the component.\n */\n value: Value;\n /**\n * The moment.js library for date manipulation.\n */\n moment: Moment;\n /**\n * An instance of Lodash.\n */\n _: LoDashStatic;\n /**\n * An instance of the FormioUtils object.\n */\n utils: typeof Utils;\n /**\n * An alias for \"utils\".\n */\n util: typeof Utils;\n}\n\nfunction sanitize(customConditional: Function) {\n const str = customConditional.toString();\n\n const [signature, ...fn] = str.split(\"=>\");\n let content = fn.join(\"=>\");\n\n if (!signature.includes(\"{\")) {\n content = content.replace(new RegExp(`${signature.trim()}.`, \"gi\"), \"\");\n }\n\n return `show = ${content.trim()}`;\n}\n\n/**\n * Adds custom conditional rule to display or not the input form.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param customConditional\n */\nexport function CustomConditional(customConditional: string | ((ctx: CustomConditionalCtx) => any)) {\n if (isArrowFn(customConditional)) {\n customConditional = sanitize(customConditional);\n }\n\n return Component({\n customConditional\n });\n}\n"]}
|
|
@@ -5,8 +5,7 @@ function sanitize(customConditional) {
|
|
|
5
5
|
const [signature, ...fn] = str.split("=>");
|
|
6
6
|
let content = fn.join("=>");
|
|
7
7
|
if (!signature.includes("{")) {
|
|
8
|
-
|
|
9
|
-
content = content.replace(new RegExp(reg, "gi"), "");
|
|
8
|
+
content = content.replace(new RegExp(`${signature.trim()}.`, "gi"), "");
|
|
10
9
|
}
|
|
11
10
|
return `show = ${content.trim()}`;
|
|
12
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customConditional.js","sourceRoot":"","sources":["../../../src/decorators/customConditional.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAiDrC,SAAS,QAAQ,CAAC,iBAA2B;IAC3C,MAAM,GAAG,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAEzC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC5B,
|
|
1
|
+
{"version":3,"file":"customConditional.js","sourceRoot":"","sources":["../../../src/decorators/customConditional.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAiDrC,SAAS,QAAQ,CAAC,iBAA2B;IAC3C,MAAM,GAAG,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAEzC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC5B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;KACzE;IAED,OAAO,UAAU,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;AACpC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,iBAAgE;IAChG,IAAI,SAAS,CAAC,iBAAiB,CAAC,EAAE;QAChC,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KACjD;IAED,OAAO,SAAS,CAAC;QACf,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {FormioComponent, FormioForm, FormioSubmission} from \"@tsed/formio-types\";\nimport type {Moment} from \"moment\";\nimport type {LoDashStatic} from \"lodash\";\nimport type {Utils} from \"formiojs\";\nimport {Component} from \"./component\";\nimport {isArrowFn} from \"@tsed/core\";\n\nexport interface CustomConditionalCtx<Value = any, Data = any, Row = any> {\n /**\n * The complete submission object.\n */\n form: FormioForm;\n /**\n * The complete submission object.\n */\n submission: FormioSubmission<Data>;\n /**\n * The complete submission data object.\n */\n data: Data;\n /**\n * Contextual \"row\" data, used within DataGrid, EditGrid, and Container components\n */\n row: Row;\n /**\n * The current component JSON\n */\n component: FormioComponent;\n /**\n * The current component instance.\n */\n instance: any;\n /**\n * The current value of the component.\n */\n value: Value;\n /**\n * The moment.js library for date manipulation.\n */\n moment: Moment;\n /**\n * An instance of Lodash.\n */\n _: LoDashStatic;\n /**\n * An instance of the FormioUtils object.\n */\n utils: typeof Utils;\n /**\n * An alias for \"utils\".\n */\n util: typeof Utils;\n}\n\nfunction sanitize(customConditional: Function) {\n const str = customConditional.toString();\n\n const [signature, ...fn] = str.split(\"=>\");\n let content = fn.join(\"=>\");\n\n if (!signature.includes(\"{\")) {\n content = content.replace(new RegExp(`${signature.trim()}.`, \"gi\"), \"\");\n }\n\n return `show = ${content.trim()}`;\n}\n\n/**\n * Adds custom conditional rule to display or not the input form.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param customConditional\n */\nexport function CustomConditional(customConditional: string | ((ctx: CustomConditionalCtx) => any)) {\n if (isArrowFn(customConditional)) {\n customConditional = sanitize(customConditional);\n }\n\n return Component({\n customConditional\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/schema-formio",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.12",
|
|
4
4
|
"description": "Transform Ts.ED Schema & JsonSchema to a valid Formio schema",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"tsed"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tsed/formio-types": "7.0.0-beta.
|
|
36
|
+
"@tsed/formio-types": "7.0.0-beta.12",
|
|
37
37
|
"change-case": "4.1.2",
|
|
38
38
|
"tslib": "2.3.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@tsed/core": "7.0.0-beta.
|
|
42
|
-
"@tsed/openspec": "7.0.0-beta.
|
|
43
|
-
"@tsed/schema": "7.0.0-beta.
|
|
41
|
+
"@tsed/core": "7.0.0-beta.12",
|
|
42
|
+
"@tsed/openspec": "7.0.0-beta.12",
|
|
43
|
+
"@tsed/schema": "7.0.0-beta.12"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@tsed/core": "^7.0.0-beta.
|
|
47
|
-
"@tsed/openspec": "^7.0.0-beta.
|
|
48
|
-
"@tsed/schema": "^7.0.0-beta.
|
|
46
|
+
"@tsed/core": "^7.0.0-beta.12",
|
|
47
|
+
"@tsed/openspec": "^7.0.0-beta.12",
|
|
48
|
+
"@tsed/schema": "^7.0.0-beta.12",
|
|
49
49
|
"formiojs": ">=4.0.0",
|
|
50
50
|
"lodash": ">=4.0.0",
|
|
51
51
|
"moment": ">=2.0.0"
|
|
@@ -76,5 +76,8 @@
|
|
|
76
76
|
},
|
|
77
77
|
"homepage": "https://github.com/tsedio/tsed/tree/beta/packages/third-parties/schema-formio",
|
|
78
78
|
"author": "Romain Lenzotti",
|
|
79
|
-
"license": "MIT"
|
|
79
|
+
"license": "MIT",
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"tag": "beta"
|
|
82
|
+
}
|
|
80
83
|
}
|
package/readme.md
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
[](https://badge.fury.io/js/%40tsed%2Fcommon)
|
|
12
12
|
[](https://github.com/semantic-release/semantic-release)
|
|
13
13
|
[](https://github.com/prettier/prettier)
|
|
14
|
-
[](https://github.com/sponsors/romakita)
|
|
15
|
+
[](https://opencollective.com/tsed)
|
|
15
16
|
|
|
16
17
|
</div>
|
|
17
18
|
|