@tolgee/ui
Advanced tools
Comparing version 4.8.5 to 4.8.6
@@ -60,3 +60,3 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { | ||
}; | ||
return (React.createElement(React.Fragment, null, availableLanguages && (React.createElement(ScFormControl, { variant: "outlined", size: "small" }, | ||
return (React.createElement(React.Fragment, null, availableLanguages && (React.createElement(ScFormControl, { variant: "outlined", size: "small", style: { maxWidth: 250 } }, | ||
React.createElement(Select, { multiple: true, value: selected.map(function (o) { return o.value; }), onChange: function (value) { return onChange(value); }, input: React.createElement(OutlinedInput, null), renderValue: function (selected) { return selected.join(', '); }, MenuProps: { | ||
@@ -63,0 +63,0 @@ style: { zIndex: DEVTOOLS_Z_INDEX }, |
@@ -78,2 +78,4 @@ var __assign = (this && this.__assign) || function () { | ||
import { isLanguagePermitted } from '../tools/isLanguagePermitted'; | ||
import { putBaseLangFirst, putBaseLangFirstTags } from './languageHelpers'; | ||
var MAX_LANGUAGES_SELECTED = 5; | ||
var responseToTranslationData = function (data) { | ||
@@ -375,4 +377,11 @@ var translations = {}; | ||
: !coreService.isAuthorizedTo('keys.edit')); | ||
var _p = __read(useState(undefined), 2), availableLanguages = _p[0], setAvailableLanguages = _p[1]; | ||
var _q = __read(useState(properties.preferredLanguages || new Set([properties.currentLanguage])), 2), selectedLanguages = _q[0], setSelectedLanguages = _q[1]; | ||
var _p = __read(useState(undefined), 2), availableLanguages = _p[0], _setAvailableLanguages = _p[1]; | ||
var setAvailableLanguages = function (data) { | ||
_setAvailableLanguages(putBaseLangFirst(data)); | ||
}; | ||
var getInitialLanguages = function () { | ||
var langs = Array.from(properties.preferredLanguages || [properties.currentLanguage]); | ||
return new Set(langs.slice(0, MAX_LANGUAGES_SELECTED)); | ||
}; | ||
var _q = __read(useState(getInitialLanguages()), 2), selectedLanguages = _q[0], setSelectedLanguages = _q[1]; | ||
// sets the default value for base language if is not stored already | ||
@@ -402,2 +411,6 @@ useEffect(function () { | ||
]); | ||
var baseLang = availableLanguages === null || availableLanguages === void 0 ? void 0 : availableLanguages.find(function (_a) { | ||
var base = _a.base; | ||
return base; | ||
}); | ||
var contextValue = { | ||
@@ -412,3 +425,3 @@ input: props.input, | ||
availableLanguages: availableLanguages, | ||
selectedLanguages: selectedLanguages, | ||
selectedLanguages: putBaseLangFirstTags(selectedLanguages, baseLang === null || baseLang === void 0 ? void 0 : baseLang.tag), | ||
formDisabled: formDisabled, | ||
@@ -415,0 +428,0 @@ translations: translations, |
{ | ||
"name": "@tolgee/ui", | ||
"version": "4.8.5", | ||
"version": "4.8.6", | ||
"description": "Translation mode UI for @tolgee/core package", | ||
@@ -39,3 +39,3 @@ "main": "index.js", | ||
"@testing-library/jest-dom": "^5.11.4", | ||
"@tolgee/core": "^4.8.0", | ||
"@tolgee/core": "^4.8.6", | ||
"@types/jest": "^27.0.2", | ||
@@ -80,3 +80,3 @@ "@types/node": "^17.0.8", | ||
"homepage": "https://github.com/tolgee/tolgee-js#readme", | ||
"gitHead": "dfa152a3c0d830f72c0e923e4aacc3190a66f17d", | ||
"gitHead": "80769a4fb18fef78600998371e7e7f67e83026b0", | ||
"publishConfig": { | ||
@@ -83,0 +83,0 @@ "access": "public" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18161587
94
85517