@tsed/schema-formio 6.89.0 → 6.92.1
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.
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enumToComponent = void 0;
|
|
4
4
|
const core_1 = require("@tsed/core");
|
|
5
|
-
const change_case_1 = require("change-case");
|
|
6
5
|
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
7
6
|
function enumToComponent(schema, options) {
|
|
8
7
|
const component = (0, FormioMappersContainer_1.execMapper)("default", schema, options);
|
|
9
8
|
const values = schema.enum.map((value) => {
|
|
10
9
|
return {
|
|
11
|
-
label:
|
|
10
|
+
label: value,
|
|
12
11
|
value
|
|
13
12
|
};
|
|
14
13
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumToComponent.js","sourceRoot":"","sources":["../../../src/components/enumToComponent.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"enumToComponent.js","sourceRoot":"","sources":["../../../src/components/enumToComponent.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,iFAAsF;AAEtF,SAAgB,eAAe,CAAC,MAAW,EAAE,OAAY;IACvD,MAAM,SAAS,GAAG,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;QAC5C,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK;SACN,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE;QAC/B,OAAO,IAAA,kBAAW,EAAC;YACjB,GAAG,SAAS;YACZ,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;aAC7B;YACD,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,OAAO;YACf,aAAa,EAAE,OAAO;YACtB,QAAQ,EAAE,+BAA+B;SAC1C,CAAC,CAAC;KACJ;IAED,OAAO,IAAA,kBAAW,EAAC;QACjB,GAAG,SAAS;QACZ,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAC,CAAC,CAAC;KACrF,CAAC,CAAC;AACL,CAAC;AA1BD,0CA0BC;AAED,IAAA,6CAAoB,EAAC,MAAM,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function enumToComponent(schema: any, options: any) {\n const component = execMapper(\"default\", schema, options);\n const values = schema.enum.map((value: any) => {\n return {\n label: value,\n value\n };\n });\n\n if (component.type === \"select\") {\n return cleanObject({\n ...component,\n data: {\n json: JSON.stringify(values)\n },\n dataSrc: \"json\",\n idPath: \"value\",\n valueProperty: \"value\",\n template: \"<span>{{ item.label }}</span>\"\n });\n }\n\n return cleanObject({\n ...component,\n values: schema[\"x-values\"] || values.map((value: any) => ({...value, shortcut: \"\"}))\n });\n}\n\nregisterFormioMapper(\"enum\", enumToComponent);\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { cleanObject } from "@tsed/core";
|
|
2
|
-
import { sentenceCase } from "change-case";
|
|
3
2
|
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
4
3
|
export function enumToComponent(schema, options) {
|
|
5
4
|
const component = execMapper("default", schema, options);
|
|
6
5
|
const values = schema.enum.map((value) => {
|
|
7
6
|
return {
|
|
8
|
-
label:
|
|
7
|
+
label: value,
|
|
9
8
|
value
|
|
10
9
|
};
|
|
11
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumToComponent.js","sourceRoot":"","sources":["../../../src/components/enumToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"enumToComponent.js","sourceRoot":"","sources":["../../../src/components/enumToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,eAAe,CAAC,MAAW,EAAE,OAAY;IACvD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;QAC5C,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK;SACN,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE;QAC/B,OAAO,WAAW,CAAC;YACjB,GAAG,SAAS;YACZ,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;aAC7B;YACD,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,OAAO;YACf,aAAa,EAAE,OAAO;YACtB,QAAQ,EAAE,+BAA+B;SAC1C,CAAC,CAAC;KACJ;IAED,OAAO,WAAW,CAAC;QACjB,GAAG,SAAS;QACZ,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAC,CAAC,CAAC;KACrF,CAAC,CAAC;AACL,CAAC;AAED,oBAAoB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function enumToComponent(schema: any, options: any) {\n const component = execMapper(\"default\", schema, options);\n const values = schema.enum.map((value: any) => {\n return {\n label: value,\n value\n };\n });\n\n if (component.type === \"select\") {\n return cleanObject({\n ...component,\n data: {\n json: JSON.stringify(values)\n },\n dataSrc: \"json\",\n idPath: \"value\",\n valueProperty: \"value\",\n template: \"<span>{{ item.label }}</span>\"\n });\n }\n\n return cleanObject({\n ...component,\n values: schema[\"x-values\"] || values.map((value: any) => ({...value, shortcut: \"\"}))\n });\n}\n\nregisterFormioMapper(\"enum\", enumToComponent);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/schema-formio",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.92.1",
|
|
4
4
|
"description": "Transform Ts.ED Schema & JsonSchema to a valid Formio schema",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"tsed"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@tsed/formio-types": "6.
|
|
34
|
+
"@tsed/formio-types": "6.92.1",
|
|
35
35
|
"change-case": "4.1.2",
|
|
36
36
|
"tslib": "2.2.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@tsed/core": "6.
|
|
40
|
-
"@tsed/openspec": "6.
|
|
41
|
-
"@tsed/schema": "6.
|
|
39
|
+
"@tsed/core": "6.92.1",
|
|
40
|
+
"@tsed/openspec": "6.92.1",
|
|
41
|
+
"@tsed/schema": "6.92.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@tsed/core": "^6.
|
|
45
|
-
"@tsed/openspec": "^6.
|
|
46
|
-
"@tsed/schema": "^6.
|
|
44
|
+
"@tsed/core": "^6.92.1",
|
|
45
|
+
"@tsed/openspec": "^6.92.1",
|
|
46
|
+
"@tsed/schema": "^6.92.1",
|
|
47
47
|
"formiojs": ">=4.0.0",
|
|
48
48
|
"lodash": ">=4.0.0",
|
|
49
49
|
"moment": ">=2.0.0"
|