@veltra/desktop 1.2.17 → 1.2.19
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/dist/components/action/action-group.vue.d.ts +3 -3
- package/dist/components/action/action.vue.d.ts +2 -2
- package/dist/components/auto-complete/auto-complete.vue.d.ts +1 -1
- package/dist/components/batch-edit/batch-edit.vue.d.ts +2 -2
- package/dist/components/cascade/cascade.vue.d.ts +7 -7
- package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +1 -1
- package/dist/components/code-editor/basic-setup.js +1 -1
- package/dist/components/code-editor/code-editor.js +8 -8
- package/dist/components/code-editor/code-editor.js.map +1 -1
- package/dist/components/code-editor/lang-loaders.js +16 -0
- package/dist/components/code-editor/lang-loaders.js.map +1 -0
- package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
- package/dist/components/empty/empty.vue.d.ts +1 -1
- package/dist/components/input/input.vue.d.ts +3 -3
- package/dist/components/multi-select/multi-select.vue.d.ts +3 -3
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +6 -6
- package/dist/components/number-input/number-input.vue.d.ts +3 -3
- package/dist/components/progress-nodes/progress-nodes.vue.d.ts +1 -1
- package/dist/components/radio-group/radio-group.vue.d.ts +1 -1
- package/dist/components/select/select.vue.d.ts +2 -2
- package/dist/components/steps/steps.vue.d.ts +2 -2
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +1 -1
- package/dist/components/tabs/tabs.vue.d.ts +1 -1
- package/dist/components/textarea/textarea.vue.d.ts +3 -3
- package/dist/components/tree/tree.vue.d.ts +2 -2
- package/dist/components/tree-select/tree-select.vue.d.ts +5 -5
- package/dist/components/watermark/watermark.vue.d.ts +1 -1
- package/dist/node_modules/.bun/@codemirror_autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_commands@6.10.4/node_modules/@codemirror/commands/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-javascript@6.2.5/node_modules/@codemirror/lang-javascript/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lint@6.9.7/node_modules/@codemirror/lint/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_search@6.7.1/node_modules/@codemirror/search/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_theme-one-dark@6.1.3/node_modules/@codemirror/theme-one-dark/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_view@6.43.4/node_modules/@codemirror/view/dist/index.js +915 -1
- package/dist/node_modules/.bun/@codemirror_view@6.43.4/node_modules/@codemirror/view/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/components/code-editor/code-editor.vue +10 -9
- package/src/components/code-editor/lang-loaders.ts +16 -0
- package/dist/node_modules/.bun/@codemirror_view@6.43.3/node_modules/@codemirror/view/dist/index.js +0 -8862
- package/dist/node_modules/.bun/@codemirror_view@6.43.3/node_modules/@codemirror/view/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veltra/desktop",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src"
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"@cat-kit/core": ">=1.1.8",
|
|
58
58
|
"@cat-kit/excel": ">=1.0.0",
|
|
59
59
|
"@cat-kit/fe": "^1.1.8",
|
|
60
|
-
"@veltra/compositions": "1.2.
|
|
61
|
-
"@veltra/directives": "1.2.
|
|
62
|
-
"@veltra/icons": "1.2.
|
|
63
|
-
"@veltra/styles": "1.2.
|
|
64
|
-
"@veltra/utils": "1.2.
|
|
60
|
+
"@veltra/compositions": "1.2.19",
|
|
61
|
+
"@veltra/directives": "1.2.19",
|
|
62
|
+
"@veltra/icons": "1.2.19",
|
|
63
|
+
"@veltra/styles": "1.2.19",
|
|
64
|
+
"@veltra/utils": "1.2.19",
|
|
65
65
|
"vue": ">=3.5.39"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
@@ -20,9 +20,10 @@ import {
|
|
|
20
20
|
type CSSProperties
|
|
21
21
|
} from 'vue'
|
|
22
22
|
|
|
23
|
-
import type {
|
|
23
|
+
import type { CodeEditorProps } from '../../types'
|
|
24
24
|
import { UScroll } from '../scroll'
|
|
25
25
|
import { basicSetup } from './basic-setup'
|
|
26
|
+
import { loadLanguage } from './lang-loaders'
|
|
26
27
|
|
|
27
28
|
defineOptions({ name: 'UCodeEditor' })
|
|
28
29
|
|
|
@@ -58,13 +59,6 @@ const rootStyle = computed<CSSProperties>(() => ({
|
|
|
58
59
|
const containerRef = useTemplateRef('container')
|
|
59
60
|
const editor = shallowRef<EditorView | null>(null)
|
|
60
61
|
|
|
61
|
-
const langLoaders: Record<CodeEditorLang, () => Promise<Extension>> = {
|
|
62
|
-
js: () => import('@codemirror/lang-javascript').then((m) => m.javascript({ typescript: true })),
|
|
63
|
-
sql: () => import('@codemirror/lang-sql').then((m) => m.sql()),
|
|
64
|
-
java: () => import('@codemirror/lang-java').then((m) => m.java()),
|
|
65
|
-
json: () => import('@codemirror/lang-json').then((m) => m.json())
|
|
66
|
-
}
|
|
67
|
-
|
|
68
62
|
const themeCompartment = new Compartment()
|
|
69
63
|
const editableCompartment = new Compartment()
|
|
70
64
|
const readOnlyCompartment = new Compartment()
|
|
@@ -161,7 +155,14 @@ async function applyLanguage() {
|
|
|
161
155
|
if (!view) return
|
|
162
156
|
const myToken = ++langToken
|
|
163
157
|
const { language } = props
|
|
164
|
-
|
|
158
|
+
|
|
159
|
+
if (!language) {
|
|
160
|
+
if (myToken !== langToken || editor.value !== view) return
|
|
161
|
+
view.dispatch({ effects: langCompartment.reconfigure([]) })
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const ext = await loadLanguage(language)
|
|
165
166
|
if (myToken !== langToken || editor.value !== view) return
|
|
166
167
|
view.dispatch({ effects: langCompartment.reconfigure(ext) })
|
|
167
168
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state'
|
|
2
|
+
|
|
3
|
+
import type { CodeEditorLang } from '../../types'
|
|
4
|
+
|
|
5
|
+
/** 语言包动态加载器,新增语言只需在此注册一条 */
|
|
6
|
+
const LANG_LOADERS: Record<CodeEditorLang, () => Promise<Extension>> = {
|
|
7
|
+
js: () => import('@codemirror/lang-javascript').then((m) => m.javascript({ typescript: true })),
|
|
8
|
+
sql: () => import('@codemirror/lang-sql').then((m) => m.sql()),
|
|
9
|
+
java: () => import('@codemirror/lang-java').then((m) => m.java()),
|
|
10
|
+
json: () => import('@codemirror/lang-json').then((m) => m.json())
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** 按需加载语言扩展;模块缓存由运行时保证,重复切换同一语言不会重复下载 */
|
|
14
|
+
export function loadLanguage(lang: CodeEditorLang): Promise<Extension> {
|
|
15
|
+
return LANG_LOADERS[lang]()
|
|
16
|
+
}
|