Sfoglia il codice sorgente

Update UI依赖版本升级

Yue 1 settimana fa
parent
commit
bbc86adc90

+ 28 - 32
UI/VAP_V3.VUE/package.json

@@ -14,11 +14,11 @@
 		"lint:style": "stylelint src/**/*.{css,scss,vue} --cache --fix"
 	},
 	"dependencies": {
-		"@element-plus/icons-vue": "^2.1.0",
+		"@element-plus/icons-vue": "^2.3.2",
 		"@popperjs/core": "^2.11.8",
 		"@vueup/vue-quill": "^1.2.0",
 		"@vueuse/core": "^10.9.0",
-		"axios": "^1.4.0",
+		"axios": "^1.13.1",
 		"bootstrap": "^5.3.1",
 		"bootstrap-icons": "^1.10.5",
 		"bpmn-js": "16.4.0",
@@ -30,26 +30,25 @@
 		"diagram-js": "12.3.0",
 		"didi": "9.0.2",
 		"echarts": "^5.4.3",
-		"element-plus": "^2.10.5",
+		"element-plus": "^2.11.7",
 		"file-saver": "^2.0.5",
-		"jsencrypt": "^3.3.2",
+		"jsencrypt": "^3.5.4",
 		"jsqr": "^1.4.0",
 		"min-dash": "^4.1.1",
 		"nprogress": "^0.2.0",
 		"object-path": "^0.11.8",
-		"pinia": "^2.1.6",
+		"pinia": "3.0.3",
 		"prism-themes": "^1.9.0",
 		"prismjs": "^1.29.0",
 		"quill": "^1.3.7",
 		"tiny-svg": "^3.0.0",
-		"vite-plugin-svg-icons": "^2.0.1",
-		"vue": "^3.3.4",
+		"vue": "3.5.22",
 		"vue-cropper": "1.0.3",
-		"vue-i18n": "^9.12.1",
-		"vue-json-pretty": "2.4.0",
-		"vue-router": "^4.2.4",
+		"vue-i18n": "11.1.12",
+		"vue-json-pretty": "2.6.0",
+		"vue-router": "4.6.3",
 		"vue3-treeselect-ts": "^0.0.4",
-		"vxe-table": "4.5.22",
+		"vxe-table": "4.17.7",
 		"zeebe-bpmn-moddle": "1.0.0"
 	},
 	"devDependencies": {
@@ -66,24 +65,19 @@
 		"@types/prismjs": "^1.26.0",
 		"@typescript-eslint/eslint-plugin": "^6.1.0",
 		"@vitejs/plugin-basic-ssl": "^2.1.0",
-		"@vitejs/plugin-vue": "^4.2.3",
-		"@vue/eslint-config-prettier": "^7.0.0",
-		"@vue/eslint-config-typescript": "^11.0.0",
+		"@vitejs/plugin-vue": "6.0.5",
+		"@vue/eslint-config-prettier": "10.2.0",
+		"@vue/eslint-config-typescript": "14.6.0",
 		"@vue/tsconfig": "^0.7.0",
-		"eslint": "^8.47.0",
-		"eslint-config-prettier": "^9.0.0",
-		"eslint-config-standard-with-typescript": "^38.0.0",
-		"eslint-plugin-import": "^2.25.2",
-		"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
-		"eslint-plugin-prettier": "^5.0.0",
-		"eslint-plugin-promise": "^6.0.0",
-		"eslint-plugin-vue": "^9.17.0",
+		"eslint": "9.39.1",
+		"eslint-plugin-prettier": "5.5.4",
+		"eslint-plugin-vue": "9.32.0",
 		"postcss": "^8.4.28",
 		"postcss-html": "^1.5.0",
 		"postcss-scss": "^4.0.7",
-		"prettier": "^3.0.2",
+		"prettier": "^3.6.2",
 		"rollup-plugin-visualizer": "^5.11.0",
-		"sass": "1.63.4",
+		"sass": "1.98.0",
 		"sass-loader": "^13.3.2",
 		"stylelint": "^15.10.3",
 		"stylelint-config-prettier": "^9.0.5",
@@ -95,14 +89,16 @@
 		"stylelint-order": "^6.0.3",
 		"stylelint-scss": "^5.1.0",
 		"terser": "^5.26.0",
-		"typescript": "^5.0.2",
-		"unplugin-auto-import": "^0.16.6",
-		"unplugin-icons": "^0.19.0",
-		"unplugin-vue-components": "^0.25.1",
-		"vite": "^4.4.5",
-		"vite-plugin-compression": "^0.5.1",
+		"typescript": "~5.9.3",
+		"unplugin-auto-import": "21.0.0",
+		"unplugin-icons": "23.0.1",
+		"unplugin-vue-components": "31.0.0",
+		"unplugin-vue-setup-extend-plus": "1.0.1",
+		"vite": "7.3.2",
 		"vite-plugin-eslint": "^1.8.1",
-		"vite-plugin-vue-setup-extend": "^0.4.0",
-		"vue-tsc": "^1.8.5"
+		"vite-plugin-svg-icons-ng": "^1.5.2",
+		"vite-plugin-vue-devtools": "8.0.7",
+		"vitest": "4.0.18",
+		"vue-tsc": "^3.2.5"
 	}
 }

File diff suppressed because it is too large
+ 0 - 0
UI/VAP_V3.VUE/src/assets/icons/svg/button.svg


+ 5 - 5
UI/VAP_V3.VUE/src/core/vb-dom/_utils/DomHelpers.ts

@@ -32,7 +32,7 @@ function getCSSVariableValue(variableName: string) {
 function getElementActualCss(el: HTMLElement, prop: any, cache: boolean) {
 	let css = ""
 
-	if (!el.getAttribute("kt-hidden-" + prop) ?? !cache) {
+	if (!el.getAttribute("kt-hidden-" + prop) || !cache) {
 		let value
 
 		// the element is hidden so:
@@ -57,7 +57,7 @@ function getElementActualCss(el: HTMLElement, prop: any, cache: boolean) {
 	} else {
 		// store it in cache
 		const attributeValue = el.getAttribute("kt-hidden-" + prop)
-		if (attributeValue ?? attributeValue === "0") {
+		if (attributeValue !== null && attributeValue !== undefined && attributeValue !== "0") {
 			return parseFloat(attributeValue)
 		}
 	}
@@ -154,7 +154,7 @@ function getHighestZindex(el: HTMLElement) {
 		// This makes behavior of this function consistent across browsers
 		// WebKit always returns auto if the element is positioned
 		const position = buffer.style.getPropertyValue("position")
-		if (position === "absolute" ?? position === "relative" ?? position === "fixed") {
+		if (position === "absolute" || position === "relative" || position === "fixed") {
 			// IE returns 0 when zIndex is not specified
 			// other browsers return a string
 			// we ignore the case of nested elements with an explicit value of 0
@@ -220,7 +220,7 @@ function throttle(timer: number | undefined, func: Function, delay?: number) {
 }
 
 function getElementChildren(element: HTMLElement, selector: string): HTMLElement[] | null {
-	if (!element ?? !element.childNodes) {
+	if (!element || !element.childNodes) {
 		return null
 	}
 
@@ -253,7 +253,7 @@ function isMobileDevice(): boolean {
 }
 
 function slide(el: HTMLElement, dir: string, speed: number, callback: any) {
-	if (!el ?? (dir === "up" && !isVisibleElement(el)) ?? (dir === "down" && isVisibleElement(el))) {
+	if (!el || (dir === "up" && !isVisibleElement(el)) || (dir === "down" && isVisibleElement(el))) {
 		return
 	}
 

+ 1 - 1
UI/VAP_V3.VUE/src/core/vb-dom/components/_ScrollComponent.ts

@@ -209,7 +209,7 @@ class ScrollComponent {
 	public update = () => {
 		// Activate/deactivate
 		if (
-			this.getOption("activate") === true ??
+			this.getOption("activate") === true ||
 			!this.element.hasAttribute(`${prefix}scroll-activate`)
 		) {
 			this.setupHeight()

+ 4 - 1
UI/VAP_V3.VUE/tsconfig.config.json

@@ -12,6 +12,9 @@
 		"types": [
 			"node"
 		],
-		"verbatimModuleSyntax": false
+		"verbatimModuleSyntax": false,
+		"moduleResolution": "bundler",
+		"module": "ESNext",
+		"target": "ES2020"
 	}
 }

+ 1 - 1
UI/VAP_V3.VUE/tsconfig.json

@@ -15,7 +15,7 @@
 	"compilerOptions": {
 		"target": "ES2020",
 		"module": "ESNext",
-		"moduleResolution": "Bundler",
+		"moduleResolution": "bundler",
 		"lib": [
 			"ESNext",
 			"DOM",

+ 15 - 3
UI/VAP_V3.VUE/vite.config.ts

@@ -109,6 +109,17 @@ export default defineConfig(({ mode, command }) => {
 			// https://cn.vitejs.dev/config/#resolve-extensions
 			extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"]
 		},
+		// Sass 配置
+		css: {
+			preprocessorOptions: {
+				scss: {
+					//  silenceDeprecations 用于抑制特定的 Sass 弃用警告
+					silenceDeprecations: ["import", "global-builtin", "color-functions", "if-function"],
+					// 保持额外的选项兼容性
+					api: "modern-compiler"
+				}
+			}
+		},
 		// vite 相关配置
 		server: {
 			port: Number(env.VITE_APP_PORT),
@@ -120,11 +131,12 @@ export default defineConfig(({ mode, command }) => {
 			strictPort: true,
 			open: true,
 			// 开启https
-			https: false,
+			https: env.VITE_APP_HTTPS === "true" ? { cert: undefined, key: undefined } : undefined,
 			proxy: {
 				[env.VITE_APP_BASE_API]: {
-					//target: "http://localhost:8080",
-					target: env.VITE_APP_PROXY_URL,
+					target: "http://localhost:6071",
+					// target: env.VITE_APP_PROXY_URL,
+					// target: "http://192.168.0.104:6080",
 					changeOrigin: true,
 					rewrite: (path) => path.replace(new RegExp("^" + env.VITE_APP_BASE_API), "")
 				}

+ 112 - 21
UI/VAP_V3.VUE/vite/plugins/_compression.ts

@@ -1,27 +1,118 @@
-import compression from "vite-plugin-compression"
+import { promises as fs } from "fs"
+import path from "path"
+import zlib from "zlib"
+import { promisify } from "util"
+import type { Plugin, ResolvedConfig } from "vite"
 
-export default function createCompression(env: Record<string, string>) {
-	const { VITE_BUILD_COMPRESS } = env
-	const plugin = []
-	if (VITE_BUILD_COMPRESS != "") {
-		const compressList = VITE_BUILD_COMPRESS.split(",")
-		if (compressList.includes("gzip")) {
-			plugin.push(
-				compression({
-					ext: ".gz",
-					deleteOriginFile: false
-				})
-			)
-		}
-		if (compressList.includes("brotli")) {
-			plugin.push(
-				compression({
-					ext: ".br",
-					algorithm: "brotliCompress",
-					deleteOriginFile: false
+const gzip = promisify(zlib.gzip)
+const brotliCompress = promisify(zlib.brotliCompress)
+const compressibleFileRE = /\.(js|mjs|json|css|html)$/i
+const defaultThreshold = 1025
+
+type CompressionKind = "gzip" | "brotli"
+
+const compressionHandlers: Record<
+	CompressionKind,
+	{ ext: string; compress: (content: Buffer) => Promise<Buffer> }
+> = {
+	gzip: {
+		ext: ".gz",
+		compress: (content) => gzip(content, { level: zlib.constants.Z_BEST_COMPRESSION })
+	},
+	brotli: {
+		ext: ".br",
+		compress: (content) =>
+			brotliCompress(content, {
+				params: {
+					[zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY,
+					[zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT
+				}
+			})
+	}
+}
+
+async function collectFiles(rootDir: string): Promise<string[]> {
+	const entries = await fs.readdir(rootDir, { withFileTypes: true })
+	const files = await Promise.all(
+		entries.map(async (entry) => {
+			const fullPath = path.join(rootDir, entry.name)
+			if (entry.isDirectory()) {
+				return collectFiles(fullPath)
+			}
+			return compressibleFileRE.test(entry.name) ? [fullPath] : []
+		})
+	)
+	return files.flat()
+}
+
+function createCompressionPlugin(kind: CompressionKind): Plugin {
+	const handler = compressionHandlers[kind]
+	let config: ResolvedConfig | undefined
+
+	return {
+		name: `local:compression:${kind}`,
+		apply: "build",
+		enforce: "post",
+		configResolved(resolvedConfig) {
+			config = resolvedConfig
+		},
+		async closeBundle() {
+			const outputDir = path.resolve(process.cwd(), config?.build.outDir ?? "dist")
+			const files = await collectFiles(outputDir)
+			const compressedEntries: Array<{ file: string; originalKb: string; compressedKb: string }> =
+				[]
+
+			await Promise.all(
+				files.map(async (filePath) => {
+					const stat = await fs.stat(filePath)
+					if (stat.size < defaultThreshold) {
+						return
+					}
+
+					const content = await fs.readFile(filePath)
+					const compressed = await handler.compress(content)
+					const outputFile = `${filePath}${handler.ext}`
+
+					await fs.writeFile(outputFile, compressed)
+					compressedEntries.push({
+						file: path.relative(outputDir, outputFile).replace(/\\/g, "/"),
+						originalKb: (stat.size / 1024).toFixed(2),
+						compressedKb: (compressed.byteLength / 1024).toFixed(2)
+					})
 				})
 			)
+
+			if (!compressedEntries.length) {
+				return
+			}
+
+			compressedEntries.sort((a, b) => a.file.localeCompare(b.file))
+			config?.logger.info(`\n[compression:${kind}] generated ${compressedEntries.length} files`)
+			for (const entry of compressedEntries) {
+				config?.logger.info(
+					`${path.basename(outputDir)}/${entry.file} ${entry.originalKb}kb -> ${entry.compressedKb}kb`
+				)
+			}
+			config?.logger.info("")
 		}
 	}
-	return plugin
+}
+
+export default (env: Record<string, string>) => {
+	const { VITE_BUILD_COMPRESS } = env
+	const plugins: Plugin[] = []
+	if (!VITE_BUILD_COMPRESS) {
+		return plugins
+	}
+
+	const compressionList = VITE_BUILD_COMPRESS.split(",").map((item) =>
+		item.trim()
+	) as CompressionKind[]
+	if (compressionList.includes("gzip")) {
+		plugins.push(createCompressionPlugin("gzip"))
+	}
+	if (compressionList.includes("brotli")) {
+		plugins.push(createCompressionPlugin("brotli"))
+	}
+	return plugins
 }

+ 1 - 1
UI/VAP_V3.VUE/vite/plugins/_setup-extend.ts

@@ -1,4 +1,4 @@
-import setupExtend from "vite-plugin-vue-setup-extend"
+import setupExtend from "unplugin-vue-setup-extend-plus/vite"
 // 此插件可以在 使用setup语法糖的时候直接为组件定义name
 export default function createSetupExtend() {
 	return setupExtend()

+ 1 - 1
UI/VAP_V3.VUE/vite/plugins/_svg-icon.ts

@@ -1,4 +1,4 @@
-import { createSvgIconsPlugin } from "vite-plugin-svg-icons"
+import { createSvgIconsPlugin } from "vite-plugin-svg-icons-ng"
 import path from "path"
 
 export default function createSvgIcon(isBuild: boolean) {

+ 11 - 3
UI/VAP_V3.VUE/vite/plugins/index.ts

@@ -1,16 +1,24 @@
+import type { PluginOption } from "vite"
 import vue from "@vitejs/plugin-vue"
+import vueDevTools from "vite-plugin-vue-devtools"
 import createAutoImport from "./_auto-import"
 import createSetupExtend from "./_setup-extend"
 import createIcons from "./_icons"
 import createSvgIcon from "./_svg-icon"
 import createCompression from "./_compression"
 
-export default function createVitePlugins(viteEnv: Record<string, string>, isBuild = false): any[] {
-	const vitePlugins = [vue()]
+export default function createVitePlugins(
+	viteEnv: Record<string, string>,
+	isBuild = false
+): PluginOption[] {
+	const vitePlugins: PluginOption[] = [vue()]
+	vitePlugins.push(vueDevTools())
 	vitePlugins.push(...createAutoImport())
 	vitePlugins.push(createSetupExtend())
 	vitePlugins.push(createIcons())
 	vitePlugins.push(createSvgIcon(isBuild))
-	isBuild && vitePlugins.push(...createCompression(viteEnv))
+	if (isBuild) {
+		vitePlugins.push(...createCompression(viteEnv))
+	}
 	return vitePlugins
 }

Some files were not shown because too many files changed in this diff