@allthings/structured-ticket-form 3.0.2-dev.0 → 4.0.0-dev.0
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/lib/assets/svg/VectorIcon.js +1 -1
- package/lib/assets/svg/VectorIcon.js.map +1 -1
- package/lib/components/atoms/ErrorMessage.d.ts +2 -2
- package/lib/components/atoms/ErrorMessage.js +27 -27
- package/lib/components/atoms/ErrorMessage.js.map +1 -1
- package/lib/components/atoms/LanguageSelector.d.ts +2 -2
- package/lib/components/atoms/LanguageSelector.js +82 -82
- package/lib/components/atoms/LanguageSelector.js.map +1 -1
- package/lib/components/atoms/SchemaHeader.d.ts +2 -2
- package/lib/components/atoms/SchemaHeader.js +34 -33
- package/lib/components/atoms/SchemaHeader.js.map +1 -1
- package/lib/components/atoms/index.d.ts +1 -1
- package/lib/components/atoms/index.js +1 -1
- package/lib/components/atoms/index.js.map +1 -1
- package/lib/components/molecules/CustomForm.d.ts +2 -2
- package/lib/components/molecules/CustomForm.js +20 -20
- package/lib/components/molecules/CustomForm.js.map +1 -1
- package/lib/components/molecules/SchemaEditor.d.ts +2 -2
- package/lib/components/molecules/SchemaEditor.js +4 -4
- package/lib/components/molecules/SchemaEditor.js.map +1 -1
- package/lib/components/molecules/index.d.ts +1 -1
- package/lib/components/molecules/index.js +1 -1
- package/lib/components/molecules/index.js.map +1 -1
- package/lib/components/organism/StructuredTicketEditor.d.ts +2 -2
- package/lib/components/organism/StructuredTicketEditor.js +83 -49
- package/lib/components/organism/StructuredTicketEditor.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -1
- package/lib/hooks/index.js +4 -3
- package/lib/hooks/index.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/jsonFormUtils.d.ts +3 -3
- package/lib/jsonFormUtils.js +59 -55
- package/lib/jsonFormUtils.js.map +1 -1
- package/lib/jsonFormUtils.test.js +1 -0
- package/lib/jsonFormUtils.test.js.map +1 -1
- package/lib/models.d.ts +31 -31
- package/lib/models.js +1 -1
- package/lib/models.js.map +1 -1
- package/lib/style/colors.d.ts +10 -10
- package/lib/style/colors.js +10 -10
- package/lib/style/colors.js.map +1 -1
- package/lib/translator.js +9 -8
- package/lib/translator.js.map +1 -1
- package/package.json +102 -107
package/lib/translator.js
CHANGED
|
@@ -20,23 +20,24 @@ var getDefaultTitle = function (name) { return name && name.replace(/[_-]/g, ' '
|
|
|
20
20
|
var getTypeScope = function (scope, typeName) {
|
|
21
21
|
return "".concat(scope, ".types.").concat(typeName);
|
|
22
22
|
};
|
|
23
|
-
var
|
|
24
|
-
return "".concat(scope, ".fields.").concat(
|
|
23
|
+
var getPropertyScope = function (scope, propertyName) {
|
|
24
|
+
return "".concat(scope, ".fields.").concat(propertyName);
|
|
25
25
|
};
|
|
26
26
|
// Recursively localises given json schema object. Original schema is not modified.
|
|
27
27
|
// schema is json schema object
|
|
28
28
|
// scope is path to root of form/type localised text in i18n object. eg 'forms.editUser'
|
|
29
29
|
// i18n is object containing localised text for schema
|
|
30
30
|
// name is default name for root property, leave undefined for root
|
|
31
|
+
// eslint-disable-next-line complexity
|
|
31
32
|
function translateSchema(schema, scope, messages, name) {
|
|
32
33
|
var _a;
|
|
33
34
|
var newSchema = __assign(__assign({}, schema), lodash_1.default.pickBy({
|
|
35
|
+
description: messages["".concat(scope, ".description")] || schema.description,
|
|
36
|
+
help: messages["".concat(scope, ".help")],
|
|
34
37
|
title: messages[scope] ||
|
|
35
38
|
messages["".concat(scope, ".title")] ||
|
|
36
39
|
schema.title ||
|
|
37
40
|
(!schema.$ref && name ? getDefaultTitle(name) : undefined),
|
|
38
|
-
description: messages["".concat(scope, ".description")] || schema.description,
|
|
39
|
-
help: messages["".concat(scope, ".help")],
|
|
40
41
|
}));
|
|
41
42
|
if (schema.definitions) {
|
|
42
43
|
newSchema.definitions = lodash_1.default.mapValues(schema.definitions, function (typeSchema, typeName) {
|
|
@@ -44,8 +45,8 @@ function translateSchema(schema, scope, messages, name) {
|
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
if (schema.type === 'object') {
|
|
47
|
-
newSchema.properties = lodash_1.default.mapValues(schema.properties, function (
|
|
48
|
-
return translateSchema(
|
|
48
|
+
newSchema.properties = lodash_1.default.mapValues(schema.properties, function (propertySchema, propertyName) {
|
|
49
|
+
return translateSchema(propertySchema, getPropertyScope(scope, propertyName), messages, propertyName);
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
if (schema.enum) {
|
|
@@ -61,8 +62,8 @@ function translateSchema(schema, scope, messages, name) {
|
|
|
61
62
|
newSchema.items = __assign(__assign({}, nsi), { enumNames: enumNames });
|
|
62
63
|
}
|
|
63
64
|
else if (si.properties && si.type === 'object') {
|
|
64
|
-
newSchema.items = __assign(__assign({}, nsi), { properties: lodash_1.default.mapValues(si.properties, function (
|
|
65
|
-
return translateSchema(
|
|
65
|
+
newSchema.items = __assign(__assign({}, nsi), { properties: lodash_1.default.mapValues(si.properties, function (propertySchema, propertyName) {
|
|
66
|
+
return translateSchema(propertySchema, getPropertyScope(scope, propertyName), messages, propertyName);
|
|
66
67
|
}) });
|
|
67
68
|
}
|
|
68
69
|
}
|
package/lib/translator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translator.js","sourceRoot":"","sources":["../src/translator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,kDAAsB;
|
|
1
|
+
{"version":3,"file":"translator.js","sourceRoot":"","sources":["../src/translator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,kDAAsB;AAEtB,IAAM,eAAe,GAAG,UAAC,IAAY,IAAK,OAAA,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,EAAlC,CAAkC,CAAA;AAC5E,IAAM,YAAY,GAAG,UAAC,KAAa,EAAE,QAAgB;IACnD,OAAA,UAAG,KAAK,oBAAU,QAA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OAAO,SAAS,CAAA;AAClB,CAAC;AAhFD,0CAgFC;AAED,qJAAqJ;AACrJ,6JAA6J;AAC7J,uIAAuI;AACvI,qBAAqB;AACrB,2CAA2C;AAC3C,iDAAiD;AACjD,gDAAgD;AAChD,kEAAkE;AAClE,uDAAuD;AACvD,6DAA6D;AAC7D,wDAAwD;AACxD,4DAA4D;AAC5D,0DAA0D;AAC1D,wCAAwC;AACxC,+CAA+C;AAC/C,+CAA+C;AAC/C,oDAAoD;AACpD,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,110 +1,105 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
"name": "@allthings/structured-ticket-form",
|
|
3
|
+
"version": "4.0.0-dev.0",
|
|
4
|
+
"description": "Simple component to create and edit jsonSchemaForm with possibility to adding translated fields and custom UISchema.",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"private": false,
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/allthings/structured-ticket-form"
|
|
10
|
+
},
|
|
11
|
+
"author": "Allthings",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/allthings/structured-ticket-form/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/allthings/structured-ticket-form/#readme",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build:sandbox": "snowpack build --polyfill-node",
|
|
19
|
+
"build": "ttsc --build tsconfig.build.json",
|
|
20
|
+
"lint": "eslint 'src/**/*.{js,ts,tsx}'",
|
|
21
|
+
"prebuild": "rimraf lib",
|
|
22
|
+
"prepare": "husky install",
|
|
23
|
+
"prettier": "prettier --write",
|
|
24
|
+
"preversion": "yarn lint",
|
|
25
|
+
"release": "yarn build && yarn publish --new-version $npm_package_version --tag latest --access public && git push --tags origin HEAD",
|
|
26
|
+
"security-check": "yarn audit --groups dependencies --level high || test $? -lt 7",
|
|
27
|
+
"start": "snowpack dev --polyfill-node",
|
|
28
|
+
"test": "jest --passWithNoTests",
|
|
29
|
+
"test:watch": "jest --watch",
|
|
30
|
+
"up": "yarn upgrade-interactive --latest --exact"
|
|
31
|
+
},
|
|
32
|
+
"resolutions": {
|
|
33
|
+
"@types/react": "17.0.69",
|
|
34
|
+
"@types/react-dom": "17.0.22"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@emotion/react": "^11.11.1",
|
|
38
|
+
"@emotion/styled": "^11.11.0",
|
|
39
|
+
"@monaco-editor/react": "^4.4.5",
|
|
40
|
+
"@mui/icons-material": "^5.14.7",
|
|
41
|
+
"@mui/material": "^5.14.7",
|
|
42
|
+
"@rjsf/core": "^5.12.1",
|
|
43
|
+
"@rjsf/mui": "^5.12.1",
|
|
44
|
+
"@rjsf/utils": "^5.12.1",
|
|
45
|
+
"@rjsf/validator-ajv8": "^5.12.1",
|
|
46
|
+
"json-schema": "^0.4.0",
|
|
47
|
+
"lodash": "^4.17.21",
|
|
48
|
+
"react-jsonschema-form": "^1.8.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@allthings/eslint-config": "2.0.0",
|
|
52
|
+
"@commitlint/cli": "17.8.1",
|
|
53
|
+
"@commitlint/config-conventional": "17.8.1",
|
|
54
|
+
"@snowpack/plugin-typescript": "1.2.1",
|
|
55
|
+
"@types/jest": "27.5.2",
|
|
56
|
+
"@types/lodash": "4.14.200",
|
|
57
|
+
"@types/react": "17.0.69",
|
|
58
|
+
"@types/react-dom": "17.0.22",
|
|
59
|
+
"@types/react-jsonschema-form": "1.7.10",
|
|
60
|
+
"eslint": "8.53.0",
|
|
61
|
+
"husky": "8.0.3",
|
|
62
|
+
"jest": "27.5.1",
|
|
63
|
+
"lint-staged": "14.0.1",
|
|
64
|
+
"prettier": "3.0.3",
|
|
65
|
+
"react": "17.0.2",
|
|
66
|
+
"react-dom": "17.0.2",
|
|
67
|
+
"rimraf": "5.0.5",
|
|
68
|
+
"snowpack": "3.0.10",
|
|
69
|
+
"ts-jest": "27.1.5",
|
|
70
|
+
"ttypescript": "1.5.15",
|
|
71
|
+
"typescript": "4.9.5",
|
|
72
|
+
"typescript-transform-paths": "3.4.6"
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"react": "^16.8 || ^17",
|
|
76
|
+
"react-dom": "^16.8 || ^17"
|
|
77
|
+
},
|
|
78
|
+
"commitlint": {
|
|
79
|
+
"extends": [
|
|
80
|
+
"@commitlint/config-conventional"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"lint-staged": {
|
|
84
|
+
"*.{js,jsx,ts,tsx}": [
|
|
85
|
+
"yarn prettier"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"jest": {
|
|
89
|
+
"roots": [
|
|
90
|
+
"<rootDir>/src"
|
|
91
|
+
],
|
|
92
|
+
"testEnvironment": "jsdom",
|
|
93
|
+
"transform": {
|
|
94
|
+
"\\.[jt]sx?$": "ts-jest"
|
|
21
95
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"homepage": "https://github.com/allthings/structured-ticket-form/#readme",
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@commitlint/cli": "17.6.7",
|
|
34
|
-
"@commitlint/config-conventional": "17.6.7",
|
|
35
|
-
"@snowpack/plugin-typescript": "1.2.1",
|
|
36
|
-
"@types/jest": "27.5.2",
|
|
37
|
-
"@types/lodash": "4.14.196",
|
|
38
|
-
"@types/react": "17.0.62",
|
|
39
|
-
"@types/react-dom": "17.0.20",
|
|
40
|
-
"@types/react-jsonschema-form": "1.7.8",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "5.62.0",
|
|
42
|
-
"@typescript-eslint/parser": "5.62.0",
|
|
43
|
-
"eslint": "7.32.0",
|
|
44
|
-
"eslint-config-prettier": "8.10.0",
|
|
45
|
-
"eslint-config-standard": "16.0.3",
|
|
46
|
-
"eslint-plugin-import": "2.28.0",
|
|
47
|
-
"eslint-plugin-node": "11.1.0",
|
|
48
|
-
"eslint-plugin-prettier": "4.2.1",
|
|
49
|
-
"eslint-plugin-promise": "5.2.0",
|
|
50
|
-
"eslint-plugin-react": "7.33.1",
|
|
51
|
-
"eslint-plugin-react-hooks": "4.6.0",
|
|
52
|
-
"husky": "8.0.3",
|
|
53
|
-
"jest": "27.5.1",
|
|
54
|
-
"lint-staged": "13.2.3",
|
|
55
|
-
"prettier": "2.8.8",
|
|
56
|
-
"react": "17.0.2",
|
|
57
|
-
"react-dom": "17.0.2",
|
|
58
|
-
"rimraf": "5.0.1",
|
|
59
|
-
"snowpack": "3.0.10",
|
|
60
|
-
"ts-jest": "27.1.5",
|
|
61
|
-
"ttypescript": "1.5.15",
|
|
62
|
-
"typescript": "4.9.5",
|
|
63
|
-
"typescript-transform-paths": "3.4.6"
|
|
64
|
-
},
|
|
65
|
-
"peerDependencies": {
|
|
66
|
-
"react": "^16.8 || ^17",
|
|
67
|
-
"react-dom": "^16.8 || ^17"
|
|
68
|
-
},
|
|
69
|
-
"dependencies": {
|
|
70
|
-
"@emotion/react": "^11.11.1",
|
|
71
|
-
"@emotion/styled": "^11.11.0",
|
|
72
|
-
"@monaco-editor/react": "^4.4.5",
|
|
73
|
-
"@mui/icons-material": "^5.14.7",
|
|
74
|
-
"@mui/material": "^5.14.7",
|
|
75
|
-
"@rjsf/core": "^5.12.1",
|
|
76
|
-
"@rjsf/mui": "^5.12.1",
|
|
77
|
-
"@rjsf/utils": "^5.12.1",
|
|
78
|
-
"@rjsf/validator-ajv8": "^5.12.1",
|
|
79
|
-
"json-schema": "^0.4.0",
|
|
80
|
-
"lodash": "^4.17.21",
|
|
81
|
-
"react-jsonschema-form": "^1.8.1"
|
|
82
|
-
},
|
|
83
|
-
"commitlint": {
|
|
84
|
-
"extends": [
|
|
85
|
-
"@commitlint/config-conventional"
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
"lint-staged": {
|
|
89
|
-
"*.{js,jsx,ts,tsx}": [
|
|
90
|
-
"yarn prettier"
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
|
-
"jest": {
|
|
94
|
-
"roots": [
|
|
95
|
-
"<rootDir>/src"
|
|
96
|
-
],
|
|
97
|
-
"testEnvironment": "jsdom",
|
|
98
|
-
"transform": {
|
|
99
|
-
"\\.[jt]sx?$": "ts-jest"
|
|
100
|
-
},
|
|
101
|
-
"moduleFileExtensions": [
|
|
102
|
-
"js",
|
|
103
|
-
"json",
|
|
104
|
-
"ts",
|
|
105
|
-
"tsx"
|
|
106
|
-
],
|
|
107
|
-
"bail": true,
|
|
108
|
-
"collectCoverage": true
|
|
109
|
-
}
|
|
96
|
+
"moduleFileExtensions": [
|
|
97
|
+
"js",
|
|
98
|
+
"json",
|
|
99
|
+
"ts",
|
|
100
|
+
"tsx"
|
|
101
|
+
],
|
|
102
|
+
"bail": true,
|
|
103
|
+
"collectCoverage": true
|
|
104
|
+
}
|
|
110
105
|
}
|