@allthings/structured-ticket-form 7.0.1-dev.1 → 7.0.2-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/components/molecules/CustomForm.js +4 -3
- package/lib/components/molecules/CustomForm.js.map +1 -1
- package/lib/components/molecules/TranslatedSelectWidget.d.ts +2 -0
- package/lib/components/molecules/TranslatedSelectWidget.js +26 -0
- package/lib/components/molecules/TranslatedSelectWidget.js.map +1 -0
- package/package.json +4 -4
|
@@ -28,6 +28,7 @@ import { withTheme } from '@rjsf/core';
|
|
|
28
28
|
import { Theme as MaterialUITheme } from '@rjsf/mui';
|
|
29
29
|
import { useEffect, useState } from 'react';
|
|
30
30
|
import { translateSchema } from "../../translator.js";
|
|
31
|
+
import { TranslatedSelectWidget } from './TranslatedSelectWidget.js';
|
|
31
32
|
var styles = {
|
|
32
33
|
formContainer: css({
|
|
33
34
|
display: 'flex',
|
|
@@ -90,12 +91,12 @@ var mainTheme = {
|
|
|
90
91
|
};
|
|
91
92
|
var Form = withTheme(MaterialUITheme);
|
|
92
93
|
export var CustomForm = function (properties) {
|
|
93
|
-
var schema = properties.schema, languageSchema = properties.languageSchema, currentLanguage = properties.currentLanguage, _a = properties.theme, theme = _a === void 0 ? {} : _a, _b = properties.componentsTheme, componentsTheme = _b === void 0 ? {} : _b, restProperties = __rest(properties, ["schema", "languageSchema", "currentLanguage", "theme", "componentsTheme"]);
|
|
94
|
-
var
|
|
94
|
+
var schema = properties.schema, languageSchema = properties.languageSchema, currentLanguage = properties.currentLanguage, _a = properties.theme, theme = _a === void 0 ? {} : _a, _b = properties.componentsTheme, componentsTheme = _b === void 0 ? {} : _b, _c = properties.widgets, widgets = _c === void 0 ? {} : _c, restProperties = __rest(properties, ["schema", "languageSchema", "currentLanguage", "theme", "componentsTheme", "widgets"]);
|
|
95
|
+
var _d = useState(translateSchema(schema, currentLanguage, languageSchema)), translatedSchema = _d[0], setTranslatedSchema = _d[1];
|
|
95
96
|
var muiTheme = createTheme(__assign(__assign(__assign({}, mainTheme), { components: __assign(__assign({}, mainComponentsTheme), componentsTheme) }), theme));
|
|
96
97
|
useEffect(function () {
|
|
97
98
|
setTranslatedSchema(translateSchema(schema, currentLanguage, languageSchema));
|
|
98
99
|
}, [languageSchema, schema, currentLanguage]);
|
|
99
|
-
return (_jsx("div", { css: styles.formContainer, children: _jsx(ThemeProvider, { theme: muiTheme, children: _jsx(Form, __assign({ liveOmit: "onChange", omitExtraData: true, schema: translatedSchema }, restProperties, { children: _jsx("button", { css: styles.hiddenButton, disabled: true, type: "submit" }) })) }) }));
|
|
100
|
+
return (_jsx("div", { css: styles.formContainer, children: _jsx(ThemeProvider, { theme: muiTheme, children: _jsx(Form, __assign({ liveOmit: "onChange", omitExtraData: true, schema: translatedSchema }, restProperties, { widgets: __assign(__assign({}, widgets), { SelectWidget: TranslatedSelectWidget }), children: _jsx("button", { css: styles.hiddenButton, disabled: true, type: "submit" }) })) }) }));
|
|
100
101
|
};
|
|
101
102
|
//# sourceMappingURL=CustomForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomForm.js","sourceRoot":"","sources":["../../../src/components/molecules/CustomForm.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,OAAO,EAAE,GAAG,EAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AAEpD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAG3C,OAAO,EAAE,eAAe,EAAE,yBAAoB;AAE9C,IAAM,MAAM,GAAG;IACb,aAAa,EAAE,GAAG,CAAC;QACjB,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,QAAQ;QACvB,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,MAAM;QACjB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,MAAM;KACd,CAAC;IACF,YAAY,EAAE,GAAG,CAAC;QAChB,OAAO,EAAE,CAAC;QACV,UAAU,EAAE,QAAQ;KACrB,CAAC;CACH,CAAA;AAED,IAAM,mBAAmB,GAAG;IAC1B,UAAU,EAAE;QACV,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,MAAM,EAAE,CAAC;gBACT,UAAU,EAAE,QAAiB;aAC9B;SACF;KACF;IACD,cAAc,EAAE;QACd,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,QAAiB;aAC5B;SACF;KACF;IACD,YAAY,EAAE;QACZ,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,EAAE;aACb;SACF;KACF;IACD,aAAa,EAAE;QACb,cAAc,EAAE;YACd,WAAW,EAAE;gBACX,QAAQ,EAAE,QAAiB;aAC5B;SACF;KACF;IACD,YAAY,EAAE;QACZ,YAAY,EAAE;YACZ,OAAO,EAAE,UAAmB;SAC7B;KACF;CACF,CAAA;AAED,IAAM,SAAS,GAAG;IAChB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,EAAE,EAAE;YACF,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAA;AAED,IAAM,IAAI,GAAG,SAAS,CAAC,eAAe,CAAC,CAAA;AAEvC,MAAM,CAAC,IAAM,UAAU,GAAG,UAAC,UAAiC;IAExD,IAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"CustomForm.js","sourceRoot":"","sources":["../../../src/components/molecules/CustomForm.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,OAAO,EAAE,GAAG,EAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,WAAW,EA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,GACO,GACZ,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
+
import SelectWidget from '@rjsf/mui/lib/SelectWidget';
|
|
14
|
+
export var TranslatedSelectWidget = function (properties) {
|
|
15
|
+
var _a;
|
|
16
|
+
var schema = properties === null || properties === void 0 ? void 0 : properties.schema;
|
|
17
|
+
if (!(schema === null || schema === void 0 ? void 0 : schema.enumNames) || !((_a = properties === null || properties === void 0 ? void 0 : properties.options) === null || _a === void 0 ? void 0 : _a.enumOptions)) {
|
|
18
|
+
return _jsx(SelectWidget, __assign({}, properties));
|
|
19
|
+
}
|
|
20
|
+
var translatedOptions = properties.options.enumOptions.map(function (option, index) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
return (__assign(__assign({}, option), { label: (_b = (_a = schema.enumNames) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : option.label }));
|
|
23
|
+
});
|
|
24
|
+
return (_jsx(SelectWidget, __assign({}, properties, { options: __assign(__assign({}, properties.options), { enumOptions: translatedOptions }) })));
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=TranslatedSelectWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslatedSelectWidget.js","sourceRoot":"","sources":["../../../src/components/molecules/TranslatedSelectWidget.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,YAAY,MAAM,4BAA4B,CAAA;AAIrD,MAAM,CAAC,IAAM,sBAAsB,GAAG,UAAC,UAAuB;;IAC5D,IAAM,MAAM,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAE1B,CAAA;IAED,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,CAAA,IAAI,CAAC,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,0CAAE,WAAW,CAAA,EAAE,CAAC;QAC5D,OAAO,KAAC,YAAY,eAAK,UAAU,EAAI,CAAA;IACzC,CAAC;IAED,IAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAC1D,UAAC,MAAM,EAAE,KAAK;;QAAK,OAAA,uBACd,MAAM,KACT,KAAK,EAAE,MAAA,MAAA,MAAM,CAAC,SAAS,0CAAG,KAAK,CAAC,mCAAI,MAAM,CAAC,KAAK,IAChD,CAAA;KAAA,CACH,CAAA;IAED,OAAO,CACL,KAAC,YAAY,eACP,UAAU,IACd,OAAO,wBAAO,UAAU,CAAC,OAAO,KAAE,WAAW,EAAE,iBAAiB,OAChE,CACH,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allthings/structured-ticket-form",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2-dev.0",
|
|
4
4
|
"description": "Simple component to create and edit jsonSchemaForm with possibility to adding translated fields and custom UISchema.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"url": "git+https://github.com/allthings/structured-ticket-form"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
|
-
"node": "^22",
|
|
38
|
+
"node": "^22.13",
|
|
39
39
|
"npm": ">=10"
|
|
40
40
|
},
|
|
41
41
|
"packageManager": "yarn@1.22.22",
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
"lodash-es": "^4.17.23"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@allthings/eslint-config": "
|
|
79
|
+
"@allthings/eslint-config": "3.0.0",
|
|
80
80
|
"@commitlint/cli": "20.4.2",
|
|
81
81
|
"@commitlint/config-conventional": "20.4.2",
|
|
82
82
|
"@types/jest": "30.0.0",
|
|
83
83
|
"@types/lodash-es": "4.17.12",
|
|
84
84
|
"@types/react": "18.3.28",
|
|
85
85
|
"@types/react-dom": "18.3.7",
|
|
86
|
-
"eslint": "
|
|
86
|
+
"eslint": "9.29.0",
|
|
87
87
|
"eslint-import-resolver-alias": "1.1.2",
|
|
88
88
|
"eslint-plugin-import": "2.32.0",
|
|
89
89
|
"husky": "9.1.7",
|