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

pull/48/MERGE
Vben 2024-11-09 11:12:30 +08:00 committed by GitHub
parent da7d61b160
commit 9cf0573921
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 321 additions and 312 deletions

View File

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

View File

@ -6,6 +6,7 @@ import path, { relative } from 'node:path';
import { findMonorepoRoot } from '@vben/node-utils'; import { findMonorepoRoot } from '@vben/node-utils';
import { NodePackageImporter } from 'sass';
import { defineConfig, loadEnv, mergeConfig } from 'vite'; import { defineConfig, loadEnv, mergeConfig } from 'vite';
import { defaultImportmapOptions, getDefaultPwaOptions } from '../options'; import { defaultImportmapOptions, getDefaultPwaOptions } from '../options';
@ -85,7 +86,7 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
clientFiles: [ clientFiles: [
'./index.html', './index.html',
'./src/bootstrap.ts', './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; return content;
}, },
api: 'modern-compiler', api: 'modern',
importers: [new NodePackageImporter()],
}, },
} }
: {}, : {},

View File

@ -4,35 +4,6 @@ import { lazyImport, VxeResolver } from 'vite-plugin-lazy-import';
async function viteVxeTableImportsPlugin(): Promise<PluginOption> { async function viteVxeTableImportsPlugin(): Promise<PluginOption> {
return [ 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({ lazyImport({
resolvers: [ resolvers: [
VxeResolver({ VxeResolver({

View File

@ -7,7 +7,7 @@ export interface DrawerProps {
* *
*/ */
cancelText?: string; cancelText?: string;
class?: string; class?: any;
/** /**
* *
* @default true * @default true
@ -42,6 +42,14 @@ export interface DrawerProps {
* @default true * @default true
*/ */
footer?: boolean; footer?: boolean;
/**
*
*/
footerClass?: any;
/**
*
*/
headerClass?: any;
/** /**
* *
* @default false * @default false

View File

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

File diff suppressed because it is too large Load Diff

View File

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