diff --git a/package.json b/package.json
index a536b6b..f9625f0 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "nova-admin",
"type": "module",
- "version": "0.9.14",
+ "version": "0.9.15",
"private": true,
"description": "a clean and concise back-end management template based on Vue3, Vite5, Typescript, and Naive UI.",
"author": {
@@ -50,42 +50,42 @@
"sizecheck": "npx vite-bundle-visualizer"
},
"dependencies": {
- "@vueuse/core": "^13.1.0",
- "alova": "^3.2.10",
+ "@vueuse/core": "^13.3.0",
+ "alova": "^3.3.2",
"colord": "^2.9.3",
"echarts": "^5.6.0",
- "md-editor-v3": "^5.4.5",
- "pinia": "^3.0.2",
- "pinia-plugin-persistedstate": "^4.2.0",
+ "md-editor-v3": "^5.6.1",
+ "pinia": "^3.0.3",
+ "pinia-plugin-persistedstate": "^4.3.0",
"quill": "^2.0.3",
"radash": "^12.1.0",
- "vue": "^3.5.13",
+ "vue": "^3.5.16",
"vue-draggable-plus": "^0.6.0",
- "vue-i18n": "^11.1.3",
- "vue-router": "^4.5.0"
+ "vue-i18n": "^11.1.5",
+ "vue-router": "^4.5.1"
},
"devDependencies": {
- "@antfu/eslint-config": "^4.12.0",
+ "@antfu/eslint-config": "^4.14.1",
"@iconify-json/icon-park-outline": "^1.2.2",
"@iconify/vue": "^4.3.0",
- "@types/node": "^22.14.1",
- "@vitejs/plugin-vue": "^5.2.3",
- "@vitejs/plugin-vue-jsx": "^4.1.2",
- "eslint": "^9.24.0",
- "lint-staged": "^15.5.1",
- "naive-ui": "^2.41.0",
+ "@types/node": "^24.0.1",
+ "@vitejs/plugin-vue": "^5.2.4",
+ "@vitejs/plugin-vue-jsx": "^4.2.0",
+ "eslint": "^9.29.0",
+ "lint-staged": "^16.1.2",
+ "naive-ui": "^2.41.1",
"sass": "^1.86.3",
- "simple-git-hooks": "^2.12.1",
+ "simple-git-hooks": "^2.13.0",
"typescript": "^5.8.3",
- "unocss": "^0.65.4",
- "unplugin-auto-import": "^19.1.2",
+ "unocss": "^66.2.0",
+ "unplugin-auto-import": "^19.3.0",
"unplugin-icons": "^22.1.0",
- "unplugin-vue-components": "^28.5.0",
- "vite": "^6.2.6",
+ "unplugin-vue-components": "^28.7.0",
+ "vite": "^6.3.5",
"vite-bundle-visualizer": "^1.2.1",
"vite-plugin-compression": "^0.5.1",
- "vite-plugin-vue-devtools": "7.7.2",
- "vue-tsc": "^2.2.8"
+ "vite-plugin-vue-devtools": "7.7.6",
+ "vue-tsc": "^2.2.10"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
diff --git a/src/components/common/IconSelect.vue b/src/components/common/IconSelect.vue
index ca37302..fc53171 100644
--- a/src/components/common/IconSelect.vue
+++ b/src/components/common/IconSelect.vue
@@ -95,17 +95,22 @@ function handleSelectIconTag(icon: string) {
// 包含当前分类或所有图标列表
const icons = computed(() => {
+ if (!iconList.value[currentTab.value])
+ return []
const hasTag = !!currentTag.value
- if (hasTag)
- return iconList.value[currentTab.value]?.categories[currentTag.value]
- else
- return iconList.value[currentTab.value].icons
+ return hasTag
+ ? iconList.value[currentTab.value]?.categories[currentTag.value] || []
+ : iconList.value[currentTab.value].icons || []
})
// 符合搜索条件的图标列表
+const filteredIcons = computed(() => {
+ return icons.value?.filter(i => i.includes(searchValue.value)) || []
+})
+
+// 当前页显示的图标
const visibleIcons = computed(() => {
- return icons.value?.filter(i => i
- .includes(searchValue.value))?.slice((currentPage.value - 1) * 200, (currentPage.value) * 200)
+ return filteredIcons.value.slice((currentPage.value - 1) * 200, currentPage.value * 200)
})
const showModal = ref(false)
@@ -191,7 +196,7 @@ function clearIcon() {
diff --git a/src/hooks/useTabScroll.ts b/src/hooks/useTabScroll.ts
index fb449af..4923c36 100644
--- a/src/hooks/useTabScroll.ts
+++ b/src/hooks/useTabScroll.ts
@@ -1,5 +1,5 @@
import type { NScrollbar } from 'naive-ui'
-import { ref, watchEffect, type Ref } from 'vue'
+import { ref, type Ref, watchEffect } from 'vue'
import { throttle } from 'radash'
export function useTabScroll(currentTabPath: Ref) {
@@ -9,7 +9,7 @@ export function useTabScroll(currentTabPath: Ref) {
const handleTabSwitch = (distance: number) => {
scrollbar.value?.scrollTo({
left: distance,
- behavior: 'smooth'
+ behavior: 'smooth',
})
}
@@ -18,7 +18,7 @@ export function useTabScroll(currentTabPath: Ref) {
const currentTabElement = document.querySelector(`[data-tab-path="${currentTabPath.value}"]`) as HTMLElement
const tabBarScrollWrapper = document.querySelector('.tab-bar-scroller-wrapper .n-scrollbar-container')
const tabBarScrollContent = document.querySelector('.tab-bar-scroller-content')
-
+
if (currentTabElement && tabBarScrollContent && tabBarScrollWrapper) {
const tabLeft = currentTabElement.offsetLeft
const tabBarLeft = tabBarScrollWrapper.scrollLeft
@@ -28,7 +28,8 @@ export function useTabScroll(currentTabPath: Ref) {
if (tabLeft + tabWidth + safeArea.value + containerPR > wrapperWidth + tabBarLeft) {
handleTabSwitch(tabLeft + tabWidth + containerPR - wrapperWidth + safeArea.value)
- } else if (tabLeft - safeArea.value < tabBarLeft) {
+ }
+ else if (tabLeft - safeArea.value < tabBarLeft) {
handleTabSwitch(tabLeft - safeArea.value)
}
}
@@ -38,7 +39,7 @@ export function useTabScroll(currentTabPath: Ref) {
const handleScroll = throttle({ interval: 120 }, (step: number) => {
scrollbar.value?.scrollBy({
left: step * 400,
- behavior: 'smooth'
+ behavior: 'smooth',
})
})
@@ -59,6 +60,6 @@ export function useTabScroll(currentTabPath: Ref) {
scrollbar,
onWheel,
safeArea,
- handleTabSwitch
+ handleTabSwitch,
}
}
diff --git a/src/service/http/config.ts b/src/service/http/config.ts
index 7cd4fe1..92c947b 100644
--- a/src/service/http/config.ts
+++ b/src/service/http/config.ts
@@ -1,4 +1,5 @@
import { $t } from '@/utils'
+
/** 默认实例的Aixos配置 */
export const DEFAULT_ALOVA_OPTIONS = {
// 请求超时时间,默认15秒
diff --git a/src/typings/global.d.ts b/src/typings/global.d.ts
index 0790ab1..d90956b 100644
--- a/src/typings/global.d.ts
+++ b/src/typings/global.d.ts
@@ -28,12 +28,6 @@ declare namespace NaiveUI {
type ThemeColor = 'default' | 'error' | 'primary' | 'info' | 'success' | 'warning'
}
-// 修复naive-ui的TabPane组件的slots类型 https://github.com/tusen-ai/naive-ui/issues/6779 ,但是直接这样会导致更多类型报错,也无法查看naive-ui的源码
-// declare module 'naive-ui' {
-// interface TabPaneSlots {
-// tab?: () => VNode[]
-// }
-// }
declare namespace Storage {
interface Session {
dict: DictMap
diff --git a/src/utils/index.ts b/src/utils/index.ts
index fe11a47..30b48af 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -2,3 +2,4 @@ export * from './storage'
export * from './array'
export * from './i18n'
export * from './icon'
+export * from './normalize'
diff --git a/src/utils/normalize.ts b/src/utils/normalize.ts
new file mode 100644
index 0000000..170c36d
--- /dev/null
+++ b/src/utils/normalize.ts
@@ -0,0 +1,22 @@
+/**
+ * 统一化存储单位,字节转化为英文缩写`bytes`, `KB`, `MB`, `GB`
+ *
+ * @param {number} bytes 需要转换的字节大小
+ * @returns {string} 转化后的字节字符串
+ * @example
+ * ```
+ * // Output: '1 MB'
+ * normalizeSizeUnits(1048576)
+ * ```
+ */
+export function normalizeSizeUnits(bytes: number): string {
+ if (bytes === 0)
+ return '0 bytes'
+
+ const units = ['bytes', 'KB', 'MB', 'GB']
+ const index = Math.floor(Math.log(bytes) / Math.log(1024))
+ const size = +(bytes / 1024 ** index).toFixed(2)
+ const unit = units[index]
+
+ return `${size} ${unit}`
+}
diff --git a/src/views/dashboard/workbench/components/chart.vue b/src/views/dashboard/workbench/components/chart.vue
index 2bb4461..cd47f6f 100644
--- a/src/views/dashboard/workbench/components/chart.vue
+++ b/src/views/dashboard/workbench/components/chart.vue
@@ -1,6 +1,7 @@