diff --git a/.stylelintrc.cjs b/.stylelintrc.cjs index f2783765..a79e6ed3 100644 --- a/.stylelintrc.cjs +++ b/.stylelintrc.cjs @@ -3,6 +3,7 @@ module.exports = { root: true, // 继承某些已有的规则 + plugins: ['stylelint-order'], extends: [ "stylelint-config-standard", // 配置 stylelint 拓展插件 "stylelint-config-html/vue", // 配置 vue 中 template 样式格式化 @@ -26,7 +27,6 @@ module.exports = { rules: { "function-url-quotes": "always", // URL 的引号 "always(必须加上引号)"|"never(没有引号)" "color-hex-length": "long", // 指定 16 进制颜色的简写或扩写 "short(16进制简写)"|"long(16进制扩写)" - "rule-empty-line-before": "never", // 要求或禁止在规则之前的空行 "always(规则之前必须始终有一个空行)"|"never(规则前绝不能有空行)"|"always-multi-line(多行规则之前必须始终有一个空行)"|"never-multi-line(多行规则之前绝不能有空行)" "font-family-no-missing-generic-family-keyword": null, // 禁止在字体族名称列表中缺少通用字体族关键字 "scss/at-import-partial-extension": null, // 解决不能使用 @import 引入 scss 文件 "property-no-unknown": null, // 禁止未知的属性 @@ -52,6 +52,20 @@ module.exports = { { ignoreAtRules: ["tailwind", "apply", "variants", "responsive", "screen"] } + ], + "order/order": [ + "custom-properties", + "dollar-variables", + "at-rules", + "declarations", + "rules" + ], + // 要求或禁止在规则之前的空行 "always(规则之前必须始终有一个空行)"|"never(规则前绝不能有空行)"|"always-multi-line(多行规则之前必须始终有一个空行)"|"never-multi-line(多行规则之前绝不能有空行)" + "rule-empty-line-before": [ + "always", { + "except": ["first-nested"], + "ignore": ["after-comment"] + } ] }, ignoreFiles: ["**/*.js", "**/*.jsx", "**/*.tsx", "**/*.ts", "**/*.html"] diff --git a/package.json b/package.json index 593e148e..61f5eaa4 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "stylelint-config-standard": "^36.0.0", "stylelint-config-standard-scss": "^13.0.0", "stylelint-config-tailwindcss": "^0.0.7", + "stylelint-order": "^6.0.4", "tailwindcss": "^3.4.6", "typescript": "^5.5.3", "typescript-eslint": "^7.15.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bcb036f2..96c97a40 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -147,6 +147,9 @@ importers: stylelint-config-tailwindcss: specifier: ^0.0.7 version: 0.0.7(stylelint@16.6.1(typescript@5.5.3))(tailwindcss@3.4.6) + stylelint-order: + specifier: ^6.0.4 + version: 6.0.4(stylelint@16.6.1(typescript@5.5.3)) tailwindcss: specifier: ^3.4.6 version: 3.4.6 diff --git a/src/ThemeOverrides.ts b/src/ThemeOverrides.ts index b8965704..80bd838e 100644 --- a/src/ThemeOverrides.ts +++ b/src/ThemeOverrides.ts @@ -13,5 +13,6 @@ export const initialThemeOverrides = (): GlobalThemeOverrides => ({ InternalSelectMenu: {}, Layout: {}, Collapse: {}, - Tree: {} + Tree: {}, + Drawer: {} }); diff --git a/src/components/ConnectionDialog/index.vue b/src/components/ConnectionDialog/index.vue index 5206a3d8..21b2b7b3 100644 --- a/src/components/ConnectionDialog/index.vue +++ b/src/components/ConnectionDialog/index.vue @@ -289,6 +289,7 @@ const handleConnect = async () => { .n-form-item-label { margin-bottom: 25px; } + .n-form-item-blank, .n-form-item-feedback-wrapper { display: none !important; @@ -301,6 +302,7 @@ const handleConnect = async () => { display: none; } } + .remember-password, .advanced_option { display: flex; diff --git a/src/hooks/helper/index.ts b/src/hooks/helper/index.ts new file mode 100644 index 00000000..f205032a --- /dev/null +++ b/src/hooks/helper/index.ts @@ -0,0 +1,192 @@ +import { GlobalThemeOverrides } from 'naive-ui'; +import { initialThemeOverrides } from '@/ThemeOverrides.ts'; + +/** + * @description 获取 HTML 标签中设定的色值 + * @param {string} variableName + */ +const getCssVariableValue = (variableName: string) => { + return getComputedStyle(document.documentElement).getPropertyValue(variableName).trim(); +}; + +/** + * @description 亮色主题下颜色的重设 + */ +export const lightOverrides = () => { + const lightOverrides: GlobalThemeOverrides = initialThemeOverrides(); + + // Spin 相关 + (lightOverrides.Spin as NonNullable).color = getCssVariableValue( + '--el-color-primary-light-1' + ); + (lightOverrides.Spin as NonNullable).textColor = + getCssVariableValue('--el-main-text-color'); + + // List 相关 + (lightOverrides.List as NonNullable).fontSize = '14px'; + (lightOverrides.List as NonNullable).color = + getCssVariableValue('--el-main-bg-color'); + (lightOverrides.List as NonNullable).textColor = + getCssVariableValue('--el-main-text-color'); + + // Tag 相关 + (lightOverrides.Tag as NonNullable).textColor = getCssVariableValue( + '--el-color-primary-light-1' + ); + (lightOverrides.Tag as NonNullable).colorBordered = + getCssVariableValue('--el-color-primary-light-9'); + + // Switch 相关 + (lightOverrides.Switch as NonNullable).railColorActive = + getCssVariableValue('--el-color-primary-light-1'); + (lightOverrides.Switch as NonNullable).boxShadowFocus = + getCssVariableValue('--el-color-primary-light-5'); + + // Dropdown 相关 + (lightOverrides.Dropdown as NonNullable).optionColorHover = + getCssVariableValue('--el-color-primary-light-2'); + (lightOverrides.Dropdown as NonNullable).optionTextColorHover = + '#fff'; + + // Select 相关 + ( + lightOverrides.InternalSelection as NonNullable + ).borderFocus = getCssVariableValue('--el-color-primary-light-6'); + ( + lightOverrides.InternalSelection as NonNullable + ).borderActive = getCssVariableValue('--el-color-primary-light-6'); + ( + lightOverrides.InternalSelection as NonNullable + ).borderHover = getCssVariableValue('--el-color-primary-light-6'); + ( + lightOverrides.InternalSelection as NonNullable + ).boxShadowFocus = getCssVariableValue('--el-color-primary-light-6'); + ( + lightOverrides.InternalSelection as NonNullable + ).boxShadowActive = getCssVariableValue('--el-color-primary-light-6'); + + ( + lightOverrides.InternalSelectMenu as NonNullable + ).optionCheckColor = '#fff'; + ( + lightOverrides.InternalSelectMenu as NonNullable + ).optionTextColorActive = '#fff'; + ( + lightOverrides.InternalSelectMenu as NonNullable + ).optionColorActive = getCssVariableValue('--el-color-primary-light-2'); + ( + lightOverrides.InternalSelectMenu as NonNullable + ).optionColorActivePending = getCssVariableValue('--el-color-primary-light-2'); + + // 折叠面板 + (lightOverrides.Collapse as NonNullable).titleTextColor = + getCssVariableValue('--el-aside-tree-item-title-color'); + (lightOverrides.Collapse as NonNullable).titleFontSize = '11px'; + (lightOverrides.Collapse as NonNullable).titleFontWeight = + '700'; + (lightOverrides.Collapse as NonNullable).arrowColor = + getCssVariableValue('--el-aside-tree-item-arrow-color'); + (lightOverrides.Collapse as NonNullable).dividerColor = + getCssVariableValue('--el-aside-tree-divider-color'); + + // Tree + (lightOverrides.Tree as NonNullable).fontSize = '13px'; + (lightOverrides.Tree as NonNullable).nodeTextColor = + getCssVariableValue('--el-aside-tree-item-title-color'); + + // 抽屉 + (lightOverrides.Drawer as NonNullable).color = + getCssVariableValue('--el-drawer-bg-color'); + + return lightOverrides; +}; + +/** + * @description 暗色模式下的颜色重设 + */ +export const darkOverrides = () => { + const darkOverrides: GlobalThemeOverrides = initialThemeOverrides(); + + (darkOverrides.Spin as NonNullable).color = getCssVariableValue( + '--el-color-primary-light-1' + ); + (darkOverrides.Spin as NonNullable).textColor = + getCssVariableValue('--el-main-text-color'); + + // List 相关 + (darkOverrides.List as NonNullable).fontSize = '14px'; + (darkOverrides.List as NonNullable).color = + getCssVariableValue('--el-main-bg-color'); + (darkOverrides.List as NonNullable).textColor = + getCssVariableValue('--el-main-text-color'); + + // Tag 相关 + (darkOverrides.Tag as NonNullable).textColor = getCssVariableValue( + '--el-color-primary-light-1' + ); + (darkOverrides.Tag as NonNullable).colorBordered = + getCssVariableValue('--el-color-primary-light-9'); + + // Switch 相关 + (darkOverrides.Switch as NonNullable).railColorActive = + getCssVariableValue('--el-color-primary-light-1'); + (darkOverrides.Switch as NonNullable).boxShadowFocus = + getCssVariableValue('--el-color-primary-light-5'); + + // Dropdown 相关 + (darkOverrides.Dropdown as NonNullable).optionColorHover = + getCssVariableValue('--el-color-primary-light-2'); + (darkOverrides.Dropdown as NonNullable).optionTextColorHover = + '#fff'; + + // Select 相关 + ( + darkOverrides.InternalSelection as NonNullable + ).borderFocus = getCssVariableValue('--el-color-primary-light-6'); + ( + darkOverrides.InternalSelection as NonNullable + ).borderActive = getCssVariableValue('--el-color-primary-light-6'); + ( + darkOverrides.InternalSelection as NonNullable + ).borderHover = getCssVariableValue('--el-color-primary-light-6'); + ( + darkOverrides.InternalSelection as NonNullable + ).boxShadowFocus = getCssVariableValue('--el-color-primary-light-6'); + ( + darkOverrides.InternalSelection as NonNullable + ).boxShadowActive = getCssVariableValue('--el-color-primary-light-6'); + + ( + darkOverrides.InternalSelectMenu as NonNullable + ).optionCheckColor = '#fff'; + ( + darkOverrides.InternalSelectMenu as NonNullable + ).optionTextColorActive = '#fff'; + ( + darkOverrides.InternalSelectMenu as NonNullable + ).optionColorActive = getCssVariableValue('--el-color-primary-light-2'); + ( + darkOverrides.InternalSelectMenu as NonNullable + ).optionColorActivePending = getCssVariableValue('--el-color-primary-light-2'); + + // 折叠面板 + (darkOverrides.Collapse as NonNullable).titleTextColor = + getCssVariableValue('--el-aside-tree-item-title-color'); + (darkOverrides.Collapse as NonNullable).titleFontSize = '11px'; + (darkOverrides.Collapse as NonNullable).titleFontWeight = '700'; + (darkOverrides.Collapse as NonNullable).arrowColor = + getCssVariableValue('--el-aside-tree-item-arrow-color'); + (darkOverrides.Collapse as NonNullable).dividerColor = + getCssVariableValue('--el-aside-tree-divider-color'); + + // Tree + (darkOverrides.Tree as NonNullable).fontSize = '13px'; + (darkOverrides.Tree as NonNullable).nodeTextColor = + getCssVariableValue('--el-aside-tree-item-title-color'); + + // 抽屉 + (darkOverrides.Drawer as NonNullable).color = + getCssVariableValue('--el-drawer-bg-color'); + + return darkOverrides; +}; diff --git a/src/hooks/useTheme.ts b/src/hooks/useTheme.ts index a2d4150c..41e3bfc8 100644 --- a/src/hooks/useTheme.ts +++ b/src/hooks/useTheme.ts @@ -1,13 +1,13 @@ -import { useI18n } from 'vue-i18n'; -import { storeToRefs } from 'pinia'; import { Theme } from '@/styles/types'; -import { DEFAULT_PRIMARY } from '@/config'; -import { createDiscreteApi, GlobalThemeOverrides } from 'naive-ui'; +import { useI18n } from 'vue-i18n'; import { asideTheme } from '@/styles/theme/aside.ts'; -import { getLightColor, getDarkColor } from '@/utils'; -import { initialThemeOverrides } from '@/ThemeOverrides.ts'; +import { storeToRefs } from 'pinia'; import { useGlobalStore } from '@/stores/modules/global.ts'; +import { DEFAULT_PRIMARY } from '@/config'; import { mainContentTheme } from '@/styles/theme/mainContent.ts'; +import { createDiscreteApi } from 'naive-ui'; +import { getLightColor, getDarkColor } from '@/utils'; +import { lightOverrides, darkOverrides } from '@/hooks/helper'; /** * @description 全局主题 hooks @@ -37,171 +37,6 @@ export const useTheme = () => { setAsideTheme(); }; - /** - * @description 获取 HTML 标签中设定的色值 - * @param {string} variableName - */ - const getCssVariableValue = (variableName: string) => { - return getComputedStyle(document.documentElement).getPropertyValue(variableName).trim(); - }; - - /** - * @description 亮色主题下颜色的重设 - */ - const lightOverrides = () => { - const lightOverrides: GlobalThemeOverrides = initialThemeOverrides(); - - // Spin 相关 - (lightOverrides.Spin as NonNullable).color = getCssVariableValue( - '--el-color-primary-light-1' - ); - (lightOverrides.Spin as NonNullable).textColor = - getCssVariableValue('--el-main-text-color'); - - // List 相关 - (lightOverrides.List as NonNullable).fontSize = '14px'; - (lightOverrides.List as NonNullable).color = - getCssVariableValue('--el-main-bg-color'); - (lightOverrides.List as NonNullable).textColor = - getCssVariableValue('--el-aside-text-color'); - - // Tag 相关 - (lightOverrides.Tag as NonNullable).textColor = - getCssVariableValue('--el-color-primary-light-1'); - (lightOverrides.Tag as NonNullable).colorBordered = - getCssVariableValue('--el-color-primary-light-9'); - - // Switch 相关 - (lightOverrides.Switch as NonNullable).railColorActive = - getCssVariableValue('--el-color-primary-light-1'); - (lightOverrides.Switch as NonNullable).boxShadowFocus = - getCssVariableValue('--el-color-primary-light-5'); - - // Dropdown 相关 - (lightOverrides.Dropdown as NonNullable).optionColorHover = - getCssVariableValue('--el-color-primary-light-2'); - ( - lightOverrides.Dropdown as NonNullable - ).optionTextColorHover = '#fff'; - - // Select 相关 - ( - lightOverrides.InternalSelection as NonNullable - ).borderFocus = getCssVariableValue('--el-color-primary-light-6'); - ( - lightOverrides.InternalSelection as NonNullable - ).borderActive = getCssVariableValue('--el-color-primary-light-6'); - ( - lightOverrides.InternalSelection as NonNullable - ).borderHover = getCssVariableValue('--el-color-primary-light-6'); - ( - lightOverrides.InternalSelection as NonNullable - ).boxShadowFocus = getCssVariableValue('--el-color-primary-light-6'); - ( - lightOverrides.InternalSelection as NonNullable - ).boxShadowActive = getCssVariableValue('--el-color-primary-light-6'); - - ( - lightOverrides.InternalSelectMenu as NonNullable - ).optionCheckColor = '#fff'; - ( - lightOverrides.InternalSelectMenu as NonNullable - ).optionTextColorActive = '#fff'; - ( - lightOverrides.InternalSelectMenu as NonNullable - ).optionColorActive = getCssVariableValue('--el-color-primary-light-2'); - ( - lightOverrides.InternalSelectMenu as NonNullable - ).optionColorActivePending = getCssVariableValue('--el-color-primary-light-2'); - - return lightOverrides; - }; - - /** - * @description 暗色主题下颜色的重设 - */ - const darkOverrides = () => { - const darkOverrides: GlobalThemeOverrides = initialThemeOverrides(); - - (darkOverrides.Spin as NonNullable).color = getCssVariableValue( - '--el-color-primary-light-1' - ); - (darkOverrides.Spin as NonNullable).textColor = - getCssVariableValue('--el-main-text-color'); - - // List 相关 - (darkOverrides.List as NonNullable).fontSize = '14px'; - (darkOverrides.List as NonNullable).color = - getCssVariableValue('--el-main-bg-color'); - (darkOverrides.List as NonNullable).textColor = - getCssVariableValue('--el-aside-text-color'); - - // Tag 相关 - (darkOverrides.Tag as NonNullable).textColor = getCssVariableValue( - '--el-color-primary-light-1' - ); - (darkOverrides.Tag as NonNullable).colorBordered = - getCssVariableValue('--el-color-primary-light-9'); - - // Switch 相关 - (darkOverrides.Switch as NonNullable).railColorActive = - getCssVariableValue('--el-color-primary-light-1'); - (darkOverrides.Switch as NonNullable).boxShadowFocus = - getCssVariableValue('--el-color-primary-light-5'); - - // Dropdown 相关 - (darkOverrides.Dropdown as NonNullable).optionColorHover = - getCssVariableValue('--el-color-primary-light-2'); - (darkOverrides.Dropdown as NonNullable).optionTextColorHover = - '#fff'; - - // Select 相关 - ( - darkOverrides.InternalSelection as NonNullable - ).borderFocus = getCssVariableValue('--el-color-primary-light-6'); - ( - darkOverrides.InternalSelection as NonNullable - ).borderActive = getCssVariableValue('--el-color-primary-light-6'); - ( - darkOverrides.InternalSelection as NonNullable - ).borderHover = getCssVariableValue('--el-color-primary-light-6'); - ( - darkOverrides.InternalSelection as NonNullable - ).boxShadowFocus = getCssVariableValue('--el-color-primary-light-6'); - ( - darkOverrides.InternalSelection as NonNullable - ).boxShadowActive = getCssVariableValue('--el-color-primary-light-6'); - - ( - darkOverrides.InternalSelectMenu as NonNullable - ).optionCheckColor = '#fff'; - ( - darkOverrides.InternalSelectMenu as NonNullable - ).optionTextColorActive = '#fff'; - ( - darkOverrides.InternalSelectMenu as NonNullable - ).optionColorActive = getCssVariableValue('--el-color-primary-light-2'); - ( - darkOverrides.InternalSelectMenu as NonNullable - ).optionColorActivePending = getCssVariableValue('--el-color-primary-light-2'); - - // 折叠面板 - (darkOverrides.Collapse as NonNullable).titleTextColor = - '#CCCCCC'; - (darkOverrides.Collapse as NonNullable).titleFontSize = - '11px'; - (darkOverrides.Collapse as NonNullable).titleFontWeight = - '700'; - (darkOverrides.Collapse as NonNullable).arrowColor = - '#C5C5C5'; - - // Tree - (darkOverrides.Tree as NonNullable).fontSize = '13px'; - (darkOverrides.Tree as NonNullable).nodeTextColor = '#cccccc'; - - return darkOverrides; - }; - /** * @description 组件颜色重写 */ diff --git a/src/layouts/components/FileManagement/index.vue b/src/layouts/components/FileManagement/index.vue index de187ac2..0b1eb29f 100644 --- a/src/layouts/components/FileManagement/index.vue +++ b/src/layouts/components/FileManagement/index.vue @@ -278,6 +278,7 @@ onUnmounted(() => { .tree-wrapper { height: 100%; overflow: hidden; + :deep(.n-descriptions-header) { height: 35px; margin-bottom: unset; @@ -285,30 +286,40 @@ onUnmounted(() => { font-size: 11px; font-weight: 400; line-height: 40px; - color: var(--el-aside-tree-text-color); + color: var(--el-aside-tree-head-title-color); } + .collapse-item { margin: 0; + &.n-collapse-item--active { height: calc(100vh - 94px); } + :deep(.n-collapse-item__header) { padding-top: 0; + .n-collapse-item__header-main { height: 22px; margin-left: 5px; + .n-collapse-item-arrow { font-size: 16px; + color: var(--el-aside-tree-item-arrow-color); } } } + :deep(.n-collapse-item__content-wrapper) { margin-left: 16px; + .n-collapse-item__content-inner { padding-top: 0; + .tree-item .n-tree-node-wrapper { padding: unset; line-height: 22px; + .n-tree-node-content { padding: 0 6px 0 0; } diff --git a/src/layouts/components/Main/index.vue b/src/layouts/components/Main/index.vue index d9404c1b..eaa4b65b 100644 --- a/src/layouts/components/Main/index.vue +++ b/src/layouts/components/Main/index.vue @@ -55,6 +55,7 @@ const systemTips = reactive([ height: calc(100% - 35px); min-height: 385px; background-color: var(--el-main-bg-color); + :deep(.n-layout-scroll-container) { display: flex; align-items: center; diff --git a/src/layouts/components/NavSearch/index.vue b/src/layouts/components/NavSearch/index.vue index 26a8f8a7..d33cf5de 100644 --- a/src/layouts/components/NavSearch/index.vue +++ b/src/layouts/components/NavSearch/index.vue @@ -1,24 +1,19 @@ diff --git a/src/layouts/index.scss b/src/layouts/index.scss index 40f9c430..39d9fa74 100644 --- a/src/layouts/index.scss +++ b/src/layouts/index.scss @@ -1,25 +1,29 @@ .custom-layout { height: calc(100vh - 35px); + :deep(.n-layout-scroll-container) { .n-layout-header { width: 40px; + .header-content { width: 40px; height: 100%; color: #ffffff; background-color: var(--el-aside-bg-color); - border-right: 1px soild var(--el-aside-border-color); } } + .n-layout-sider { background-color: var(--el-aside-tree-bg-color); - border-left: 1px solid var(--el-aside-border-color); + .n-scrollbar .n-scrollbar-container .n-scrollbar-content { padding: 0 !important; + .file-management { height: calc(100vh - 35px); } } + &::after { position: absolute; top: 0; diff --git a/src/layouts/index.vue b/src/layouts/index.vue index 594802cf..1a8dd678 100644 --- a/src/layouts/index.vue +++ b/src/layouts/index.vue @@ -1,7 +1,7 @@