mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix lang select
This commit is contained in:
1 parent
ce8b77a6f7
commit
865f30fe42
9 files changed
+32
-34
No files matched your search
@@ -10,8 +10,8 @@
|
||||
"lint": "eslint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blueprintjs/core": "4.11.4",
|
||||
"@blueprintjs/select": "4.8.4",
|
||||
"@blueprintjs/core": "4.11.6",
|
||||
"@blueprintjs/select": "4.8.6",
|
||||
"@fontsource/dm-mono": "^4.5.10",
|
||||
"@fontsource/fira-code": "^4.5.12",
|
||||
"@fontsource/inconsolata": "^4.5.9",
|
||||
@@ -31,8 +31,8 @@
|
||||
"@types/qrcode": "^1.5.0",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"@types/redux-logger": "^3.0.9",
|
||||
"@types/serviceworker": "^0.0.54",
|
||||
"@types/sharedworker": "^0.0.83",
|
||||
"@types/serviceworker": "^0.0.55",
|
||||
"@types/sharedworker": "^0.0.84",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@vscode/codicons": "^0.0.32",
|
||||
"autoprefixer": "^10.4.13",
|
||||
@@ -44,7 +44,7 @@
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"css-loader": "^6.7.1",
|
||||
"diff": "^5.1.0",
|
||||
"diff-dom": "^4.2.7",
|
||||
"diff-dom": "^4.2.8",
|
||||
"echarts": "^5.4.0",
|
||||
"emojis-keywords": "2.0.0",
|
||||
"emojis-list": "2.1.0",
|
||||
@@ -68,7 +68,7 @@
|
||||
"monaco-editor": "0.33.0",
|
||||
"monaco-editor-nls": "^2.0.0",
|
||||
"monaco-editor-webpack-plugin": "^7.0.1",
|
||||
"monaco-graphql": "^1.1.3",
|
||||
"monaco-graphql": "^1.1.4",
|
||||
"monaco-themes": "^0.4.2",
|
||||
"monaco-yaml": "^4.0.2",
|
||||
"nanoid": "^4.0.0",
|
||||
@@ -107,7 +107,7 @@
|
||||
"timeago-react": "^3.0.5",
|
||||
"timeago.js": "^4.0.2",
|
||||
"ts-loader": "^9.4.1",
|
||||
"vditor": "^3.8.17",
|
||||
"vditor": "^3.8.18",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"web-streams-polyfill": "^3.2.1",
|
||||
"webpack": "^5.74.0",
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
import CustomSelectAutoComplete from 'vj/components/autocomplete/CustomSelectAutoComplete';
|
||||
import { NamedPage } from 'vj/misc/Page';
|
||||
import i18n from 'vj/utils/i18n';
|
||||
|
||||
const page = new NamedPage('domain_edit', () => {
|
||||
const prefixes = new Set(Object.keys(window.LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||
const langs = [
|
||||
{ key: '_', name: i18n('objective') },
|
||||
...Object.keys(window.LANGS).filter((i) => !prefixes.has(i)).map((i) => (
|
||||
{ name: `${i.includes('.') ? `${window.LANGS[i.split('.')[0]].display}/` : ''}${window.LANGS[i].display}`, _id: i }
|
||||
)),
|
||||
];
|
||||
const langs = Object.keys(window.LANGS).filter((i) => !prefixes.has(i)).map((i) => (
|
||||
{ name: `${i.includes('.') ? `${window.LANGS[i.split('.')[0]].display}/` : ''}${window.LANGS[i].display}`, _id: i }
|
||||
));
|
||||
|
||||
const $langSelect = $('[name=langs]');
|
||||
$langSelect.val(($langSelect.val() as string).split(',').filter((i) => !prefixes.has(i)));
|
||||
@@ -17,7 +13,7 @@ const page = new NamedPage('domain_edit', () => {
|
||||
const select: CustomSelectAutoComplete<true> = CustomSelectAutoComplete.getOrConstruct($('[name=langs]'), { multi: true, data: langs });
|
||||
select.onChange((val) => {
|
||||
const value = val.split(',');
|
||||
value.push(...Array.from(new Set(value.filter((i) => i.includes('.')).map((i) => i.split('.')[0]))));
|
||||
value.push(...new Set(value.filter((i) => i.includes('.')).map((i) => i.split('.')[0])));
|
||||
$langSelect.val(value.join(','));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user