Browse Source

perf: optimize local startup speed and add header Class configuration to drawer (#4840)

Vben 4 months ago
parent
commit
9cf0573921

+ 6 - 0
docs/.vitepress/config/shared.mts

@@ -62,6 +62,11 @@ export const shared = defineConfig({
           postcssIsolateStyles({ includeFiles: [/vp-doc\.css/] }),
         ],
       },
+      preprocessorOptions: {
+        scss: {
+          api: 'modern',
+        },
+      },
     },
     json: {
       stringify: true,
@@ -97,6 +102,7 @@ export const shared = defineConfig({
       host: true,
       port: 6173,
     },
+
     ssr: {
       external: ['@vue/repl'],
     },

+ 4 - 2
internal/vite-config/src/config/application.ts

@@ -6,6 +6,7 @@ import path, { relative } from 'node:path';
 
 import { findMonorepoRoot } from '@vben/node-utils';
 
+import { NodePackageImporter } from 'sass';
 import { defineConfig, loadEnv, mergeConfig } from 'vite';
 
 import { defaultImportmapOptions, getDefaultPwaOptions } from '../options';
@@ -85,7 +86,7 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
           clientFiles: [
             './index.html',
             './src/bootstrap.ts',
-            './src/{views,layouts,router,store,api}/*',
+            './src/{views,layouts,router,store,api,adapter}/*',
           ],
         },
       },
@@ -113,7 +114,8 @@ function createCssOptions(injectGlobalScss = true) {
               }
               return content;
             },
-            api: 'modern-compiler',
+            api: 'modern',
+            importers: [new NodePackageImporter()],
           },
         }
       : {},

+ 0 - 29
internal/vite-config/src/plugins/vxe-table.ts

@@ -4,35 +4,6 @@ import { lazyImport, VxeResolver } from 'vite-plugin-lazy-import';
 
 async function viteVxeTableImportsPlugin(): Promise<PluginOption> {
   return [
-    // {
-    //   config() {
-    //     return {
-    //       optimizeDeps: {
-    //         include: [
-    //           'vxe-pc-ui/es/vxe-button/index.js',
-    //           'vxe-pc-ui/es/vxe-checkbox/index.js',
-    //           'vxe-pc-ui/es/vxe-icon/index.js',
-    //           'vxe-pc-ui/es/vxe-input/index.js',
-    //           'vxe-pc-ui/es/vxe-loading/index.js',
-    //           'vxe-pc-ui/es/vxe-modal/index.js',
-    //           'vxe-pc-ui/es/vxe-pager/index.js',
-    //           'vxe-pc-ui/es/vxe-radio-group/index.js',
-    //           'vxe-pc-ui/es/vxe-select/index.js',
-    //           'vxe-pc-ui/es/vxe-tooltip/index.js',
-    //           'vxe-pc-ui/es/vxe-ui/index.js',
-    //           'vxe-pc-ui/es/vxe-upload/index.js',
-    //           'vxe-table/es/vxe-colgroup/index.js',
-    //           'vxe-table/es/vxe-column/index.js',
-    //           'vxe-table/es/vxe-grid/index.js',
-    //           'vxe-table/es/vxe-table/index.js',
-    //           'vxe-table/es/vxe-toolbar/index.js',
-    //           'vxe-table/es/vxe-ui/index.js',
-    //         ],
-    //       },
-    //     };
-    //   },
-    //   name: 'vxe-table-adapter',
-    // },
     lazyImport({
       resolvers: [
         VxeResolver({

+ 9 - 1
packages/@core/ui-kit/popup-ui/src/drawer/drawer.ts

@@ -7,7 +7,7 @@ export interface DrawerProps {
    * 取消按钮文字
    */
   cancelText?: string;
-  class?: string;
+  class?: any;
   /**
    * 是否显示右上角的关闭按钮
    * @default true
@@ -42,6 +42,14 @@ export interface DrawerProps {
    * @default true
    */
   footer?: boolean;
+  /**
+   * 弹窗底部样式
+   */
+  footerClass?: any;
+  /**
+   * 弹窗头部样式
+   */
+  headerClass?: any;
   /**
    * 弹窗是否显示
    * @default false

+ 15 - 4
packages/@core/ui-kit/popup-ui/src/drawer/drawer.vue

@@ -56,6 +56,8 @@ const {
   contentClass,
   description,
   footer: showFooter,
+  footerClass,
+  headerClass,
   loading: showLoading,
   modal,
   openAutoFocus,
@@ -130,9 +132,13 @@ function handleFocusOutside(e: Event) {
     >
       <SheetHeader
         :class="
-          cn('!flex flex-row items-center justify-between border-b px-6 py-5', {
-            'px-4 py-3': closable,
-          })
+          cn(
+            '!flex flex-row items-center justify-between border-b px-6 py-5',
+            headerClass,
+            {
+              'px-4 py-3': closable,
+            },
+          )
         "
       >
         <div>
@@ -186,7 +192,12 @@ function handleFocusOutside(e: Event) {
 
       <SheetFooter
         v-if="showFooter"
-        class="w-full flex-row items-center justify-end border-t p-2 px-3"
+        :class="
+          cn(
+            'w-full flex-row items-center justify-end border-t p-2 px-3',
+            footerClass,
+          )
+        "
       >
         <slot name="prepend-footer"></slot>
         <slot name="footer">

File diff suppressed because it is too large
+ 234 - 228
pnpm-lock.yaml


+ 11 - 11
pnpm-workspace.yaml

@@ -51,7 +51,7 @@ catalog:
   '@types/sortablejs': ^1.15.8
   '@typescript-eslint/eslint-plugin': ^8.13.0
   '@typescript-eslint/parser': ^8.13.0
-  '@vee-validate/zod': ^4.14.6
+  '@vee-validate/zod': ^4.14.7
   '@vite-pwa/vitepress': ^0.5.3
   '@vitejs/plugin-vue': ^5.1.4
   '@vitejs/plugin-vue-jsx': ^4.0.1
@@ -76,8 +76,8 @@ catalog:
   cross-env: ^7.0.3
   cspell: ^8.16.0
   cssnano: ^7.0.6
-  cz-git: ^1.10.1
-  czg: ^1.10.1
+  cz-git: ^1.11.0
+  czg: ^1.11.0
   dayjs: ^1.11.13
   defu: ^6.1.4
   depcheck: ^1.4.7
@@ -90,7 +90,7 @@ catalog:
   eslint-plugin-eslint-comments: ^3.2.0
   eslint-plugin-import-x: ^4.4.0
   eslint-plugin-jsdoc: ^50.4.3
-  eslint-plugin-jsonc: ^2.16.0
+  eslint-plugin-jsonc: ^2.17.0
   eslint-plugin-n: ^17.13.1
   eslint-plugin-no-only-tests: ^3.3.0
   eslint-plugin-perfectionist: ^3.9.1
@@ -114,14 +114,14 @@ catalog:
   lint-staged: ^15.2.10
   lodash.clonedeep: ^4.5.0
   lodash.get: ^4.4.2
-  lucide-vue-next: ^0.454.0
+  lucide-vue-next: ^0.456.0
   medium-zoom: ^1.1.0
   naive-ui: ^2.40.1
-  nitropack: ^2.10.3
+  nitropack: ^2.10.4
   nprogress: ^0.2.0
   ora: ^8.1.1
   pinia: 2.2.2
-  pinia-plugin-persistedstate: ^4.1.2
+  pinia-plugin-persistedstate: ^4.1.3
   pkg-types: ^1.2.1
   playwright: ^1.48.2
   postcss: ^8.4.47
@@ -134,7 +134,7 @@ catalog:
   prettier-plugin-tailwindcss: ^0.6.8
   publint: ^0.2.12
   qrcode: ^1.5.4
-  radix-vue: ^1.9.8
+  radix-vue: ^1.9.9
   resolve.exports: ^2.0.2
   rimraf: ^6.0.1
   rollup: ^4.24.4
@@ -158,7 +158,7 @@ catalog:
   typescript: ^5.6.3
   unbuild: ^3.0.0-rc.11
   unplugin-element-plus: ^0.8.0
-  vee-validate: ^4.14.6
+  vee-validate: ^4.14.7
   vite: ^5.4.10
   vite-plugin-compression: ^0.5.1
   vite-plugin-dts: 4.2.1
@@ -174,8 +174,8 @@ catalog:
   vue-i18n: ^10.0.4
   vue-router: ^4.4.5
   vue-tsc: ^2.1.10
-  vxe-pc-ui: ^4.2.45
-  vxe-table: ^4.8.2
+  vxe-pc-ui: ^4.2.46
+  vxe-table: ^4.8.8
   watermark-js-plus: ^1.5.7
   zod: ^3.23.8
   zod-defaults: ^0.1.3

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