diff --git a/docs/package.json b/docs/package.json index a5300534..f57dfc85 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "@vben/docs", - "version": "5.5.6", + "version": "5.5.7", "private": true, "scripts": { "build": "vitepress build", diff --git a/docs/src/en/guide/essentials/settings.md b/docs/src/en/guide/essentials/settings.md index e5aa71a8..59a6c5c0 100644 --- a/docs/src/en/guide/essentials/settings.md +++ b/docs/src/en/guide/essentials/settings.md @@ -21,7 +21,7 @@ The rules are consistent with [Vite Env Variables and Modes](https://vitejs.dev/ console.log(import.meta.env.VITE_PROT); ``` -- Variables starting with `VITE_GLOB_*` will be added to the `_app.config.js` configuration file during packaging. ::: +- Variables starting with `VITE_GLOB_*` will be added to the `_app.config.js` configuration file during packaging. ::: @@ -138,6 +138,27 @@ To add a new dynamically modifiable configuration item, simply follow the steps } ``` +- In `packages/effects/hooks/src/use-app-config.ts`, add the corresponding configuration item, such as: + + ```ts + export function useAppConfig( + env: Record, + isProduction: boolean, + ): ApplicationConfig { + // In production environment, directly use the window._VBEN_ADMIN_PRO_APP_CONF_ global variable + const config = isProduction + ? window._VBEN_ADMIN_PRO_APP_CONF_ + : (env as VbenAdminProAppConfigRaw); + + const { VITE_GLOB_API_URL, VITE_GLOB_OTHER_API_URL } = config; // [!code ++] + + return { + apiURL: VITE_GLOB_API_URL, + otherApiURL: VITE_GLOB_OTHER_API_URL, // [!code ++] + }; + } + ``` + At this point, you can use the `useAppConfig` method within the project to access the newly added configuration item. ```ts diff --git a/docs/src/guide/essentials/settings.md b/docs/src/guide/essentials/settings.md index cca572d8..9b47c04d 100644 --- a/docs/src/guide/essentials/settings.md +++ b/docs/src/guide/essentials/settings.md @@ -21,7 +21,7 @@ console.log(import.meta.env.VITE_PROT); ``` -- 以 `VITE_GLOB_*` 开头的的变量,在打包的时候,会被加入 `_app.config.js`配置文件当中. ::: +- 以 `VITE_GLOB_*` 开头的的变量,在打包的时候,会被加入 `_app.config.js`配置文件当中. ::: @@ -137,6 +137,27 @@ const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD); } ``` +- 在 `packages/effects/hooks/src/use-app-config.ts` 中,新增对应的配置项,如: + + ```ts + export function useAppConfig( + env: Record, + isProduction: boolean, + ): ApplicationConfig { + // 生产环境下,直接使用 window._VBEN_ADMIN_PRO_APP_CONF_ 全局变量 + const config = isProduction + ? window._VBEN_ADMIN_PRO_APP_CONF_ + : (env as VbenAdminProAppConfigRaw); + + const { VITE_GLOB_API_URL, VITE_GLOB_OTHER_API_URL } = config; // [!code ++] + + return { + apiURL: VITE_GLOB_API_URL, + otherApiURL: VITE_GLOB_OTHER_API_URL, // [!code ++] + }; + } + ``` + 到这里,就可以在项目内使用 `useAppConfig`方法获取到新增的配置项了。 ```ts diff --git a/internal/lint-configs/commitlint-config/package.json b/internal/lint-configs/commitlint-config/package.json index c17cde2a..a137f947 100644 --- a/internal/lint-configs/commitlint-config/package.json +++ b/internal/lint-configs/commitlint-config/package.json @@ -1,6 +1,6 @@ { "name": "@vben/commitlint-config", - "version": "5.5.6", + "version": "5.5.7", "private": true, "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", diff --git a/internal/lint-configs/stylelint-config/package.json b/internal/lint-configs/stylelint-config/package.json index ee55c702..8e2a97c2 100644 --- a/internal/lint-configs/stylelint-config/package.json +++ b/internal/lint-configs/stylelint-config/package.json @@ -1,6 +1,6 @@ { "name": "@vben/stylelint-config", - "version": "5.5.6", + "version": "5.5.7", "private": true, "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", diff --git a/internal/node-utils/package.json b/internal/node-utils/package.json index 782c0b30..8b8db745 100644 --- a/internal/node-utils/package.json +++ b/internal/node-utils/package.json @@ -1,6 +1,6 @@ { "name": "@vben/node-utils", - "version": "5.5.6", + "version": "5.5.7", "private": true, "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", diff --git a/internal/tailwind-config/package.json b/internal/tailwind-config/package.json index 9f62a1b7..8506891b 100644 --- a/internal/tailwind-config/package.json +++ b/internal/tailwind-config/package.json @@ -1,6 +1,6 @@ { "name": "@vben/tailwind-config", - "version": "5.5.6", + "version": "5.5.7", "private": true, "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", diff --git a/internal/tsconfig/package.json b/internal/tsconfig/package.json index dd4f6321..44ee3f1b 100644 --- a/internal/tsconfig/package.json +++ b/internal/tsconfig/package.json @@ -1,6 +1,6 @@ { "name": "@vben/tsconfig", - "version": "5.5.6", + "version": "5.5.7", "private": true, "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", diff --git a/package.json b/package.json index 4fe3df68..fa33c97a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vben-admin-monorepo", - "version": "5.5.6", + "version": "5.5.7", "private": true, "keywords": [ "monorepo", diff --git a/packages/@core/base/design/package.json b/packages/@core/base/design/package.json index 4bdfbe32..33e92474 100644 --- a/packages/@core/base/design/package.json +++ b/packages/@core/base/design/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/design", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/base/icons/package.json b/packages/@core/base/icons/package.json index 4d758ca8..9a349883 100644 --- a/packages/@core/base/icons/package.json +++ b/packages/@core/base/icons/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/icons", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/base/shared/package.json b/packages/@core/base/shared/package.json index 05bb218a..b02cc6e4 100644 --- a/packages/@core/base/shared/package.json +++ b/packages/@core/base/shared/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/shared", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/base/typings/package.json b/packages/@core/base/typings/package.json index dc99de24..e2ab1870 100644 --- a/packages/@core/base/typings/package.json +++ b/packages/@core/base/typings/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/typings", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/composables/package.json b/packages/@core/composables/package.json index 3e03540f..08db5106 100644 --- a/packages/@core/composables/package.json +++ b/packages/@core/composables/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/composables", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/preferences/package.json b/packages/@core/preferences/package.json index 828370fd..726b473d 100644 --- a/packages/@core/preferences/package.json +++ b/packages/@core/preferences/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/preferences", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/ui-kit/form-ui/package.json b/packages/@core/ui-kit/form-ui/package.json index 651b3dc5..36ae1678 100644 --- a/packages/@core/ui-kit/form-ui/package.json +++ b/packages/@core/ui-kit/form-ui/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/form-ui", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/ui-kit/layout-ui/package.json b/packages/@core/ui-kit/layout-ui/package.json index d62d1864..57a462fe 100644 --- a/packages/@core/ui-kit/layout-ui/package.json +++ b/packages/@core/ui-kit/layout-ui/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/layout-ui", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/ui-kit/menu-ui/package.json b/packages/@core/ui-kit/menu-ui/package.json index 1ff5741c..760d7646 100644 --- a/packages/@core/ui-kit/menu-ui/package.json +++ b/packages/@core/ui-kit/menu-ui/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/menu-ui", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/ui-kit/popup-ui/src/modal/use-modal.ts b/packages/@core/ui-kit/popup-ui/src/modal/use-modal.ts index 048243da..2037dfd0 100644 --- a/packages/@core/ui-kit/popup-ui/src/modal/use-modal.ts +++ b/packages/@core/ui-kit/popup-ui/src/modal/use-modal.ts @@ -94,8 +94,9 @@ export function useVbenModal( injectData.options?.onOpenChange?.(isOpen); }; + const onClosed = mergedOptions.onClosed; mergedOptions.onClosed = () => { - options.onClosed?.(); + onClosed?.(); if (mergedOptions.destroyOnClose) { injectData.reCreateModal?.(); } diff --git a/packages/@core/ui-kit/shadcn-ui/package.json b/packages/@core/ui-kit/shadcn-ui/package.json index 98900467..11d2918f 100644 --- a/packages/@core/ui-kit/shadcn-ui/package.json +++ b/packages/@core/ui-kit/shadcn-ui/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/shadcn-ui", - "version": "5.5.6", + "version": "5.5.7", "#main": "./dist/index.mjs", "#module": "./dist/index.mjs", "homepage": "https://github.com/vbenjs/vue-vben-admin", diff --git a/packages/@core/ui-kit/shadcn-ui/src/components/button/button.ts b/packages/@core/ui-kit/shadcn-ui/src/components/button/button.ts index 01394caa..bcb7a0c7 100644 --- a/packages/@core/ui-kit/shadcn-ui/src/components/button/button.ts +++ b/packages/@core/ui-kit/shadcn-ui/src/components/button/button.ts @@ -29,14 +29,25 @@ export type ValueType = boolean | number | string; export interface VbenButtonGroupProps extends Pick { + /** 单选模式下允许清除选中 */ + allowClear?: boolean; + /** 值改变前的回调 */ beforeChange?: ( value: ValueType, isChecked: boolean, ) => boolean | PromiseLike | undefined; + /** 按钮样式 */ btnClass?: any; + /** 按钮间隔距离 */ gap?: number; + /** 多选模式下限制最多选择的数量。0表示不限制 */ + maxCount?: number; + /** 是否允许多选 */ multiple?: boolean; + /** 选项 */ options?: { [key: string]: any; label: CustomRenderType; value: ValueType }[]; + /** 显示图标 */ showIcon?: boolean; + /** 尺寸 */ size?: 'large' | 'middle' | 'small'; } diff --git a/packages/@core/ui-kit/shadcn-ui/src/components/button/check-button-group.vue b/packages/@core/ui-kit/shadcn-ui/src/components/button/check-button-group.vue index 6e937891..fd87396e 100644 --- a/packages/@core/ui-kit/shadcn-ui/src/components/button/check-button-group.vue +++ b/packages/@core/ui-kit/shadcn-ui/src/components/button/check-button-group.vue @@ -19,6 +19,8 @@ const props = withDefaults(defineProps(), { multiple: false, showIcon: true, size: 'middle', + allowClear: false, + maxCount: 0, }); const emit = defineEmits(['btnClick']); const btnDefaultProps = computed(() => { @@ -82,12 +84,22 @@ async function onBtnClick(value: ValueType) { if (innerValue.value.includes(value)) { innerValue.value = innerValue.value.filter((item) => item !== value); } else { + if (props.maxCount > 0 && innerValue.value.length >= props.maxCount) { + innerValue.value = innerValue.value.slice(0, props.maxCount - 1); + } innerValue.value.push(value); } modelValue.value = innerValue.value; } else { - innerValue.value = [value]; - modelValue.value = value; + if (props.allowClear && innerValue.value.includes(value)) { + innerValue.value = []; + modelValue.value = undefined; + emit('btnClick', undefined); + return; + } else { + innerValue.value = [value]; + modelValue.value = value; + } } emit('btnClick', value); } @@ -112,12 +124,18 @@ async function onBtnClick(value: ValueType) { @click="onBtnClick(btn.value)" >
- - - + + + + +
diff --git a/packages/@core/ui-kit/tabs-ui/package.json b/packages/@core/ui-kit/tabs-ui/package.json index 86afff5b..bc84b4d6 100644 --- a/packages/@core/ui-kit/tabs-ui/package.json +++ b/packages/@core/ui-kit/tabs-ui/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/tabs-ui", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/constants/package.json b/packages/constants/package.json index 072d6b62..c71e1184 100644 --- a/packages/constants/package.json +++ b/packages/constants/package.json @@ -1,6 +1,6 @@ { "name": "@vben/constants", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/effects/access/package.json b/packages/effects/access/package.json index 51beaa83..e4c39eb2 100644 --- a/packages/effects/access/package.json +++ b/packages/effects/access/package.json @@ -1,6 +1,6 @@ { "name": "@vben/access", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/effects/common-ui/package.json b/packages/effects/common-ui/package.json index 205628d1..7b8f41a7 100644 --- a/packages/effects/common-ui/package.json +++ b/packages/effects/common-ui/package.json @@ -1,6 +1,6 @@ { "name": "@vben/common-ui", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/effects/hooks/package.json b/packages/effects/hooks/package.json index 25a5836a..004f3c50 100644 --- a/packages/effects/hooks/package.json +++ b/packages/effects/hooks/package.json @@ -1,6 +1,6 @@ { "name": "@vben/hooks", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/effects/layouts/package.json b/packages/effects/layouts/package.json index f645da90..a8439a02 100644 --- a/packages/effects/layouts/package.json +++ b/packages/effects/layouts/package.json @@ -1,6 +1,6 @@ { "name": "@vben/layouts", - "version": "5.5.6", + "version": "5.5.7", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/effects/layouts/src/widgets/user-dropdown/user-dropdown.vue b/packages/effects/layouts/src/widgets/user-dropdown/user-dropdown.vue index 8b5f499f..8156324a 100644 --- a/packages/effects/layouts/src/widgets/user-dropdown/user-dropdown.vue +++ b/packages/effects/layouts/src/widgets/user-dropdown/user-dropdown.vue @@ -46,7 +46,11 @@ interface Props { /** * 菜单数组 */ - menus?: Array<{ handler: AnyFunction; icon?: Component; text: string }>; + menus?: Array<{ + handler: AnyFunction; + icon?: Component | Function | string; + text: string; + }>; /** * 标签文本 diff --git a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue index 46c6f16e..d3043b1e 100644 --- a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue +++ b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue @@ -280,6 +280,15 @@ const delegatedFormSlots = computed(() => { return resultSlots.map((key) => key.replace(FORM_SLOT_PREFIX, '')); }); +const showDefaultEmpty = computed(() => { + // 检查是否有原生的 VXE Table 空状态配置 + const hasEmptyText = options.value.emptyText !== undefined; + const hasEmptyRender = options.value.emptyRender !== undefined; + + // 如果有原生配置,就不显示默认的空状态 + return !hasEmptyText && !hasEmptyRender; +}); + async function init() { await nextTick(); const globalGridConfig = VxeUI?.getConfig()?.grid ?? {}; @@ -464,7 +473,7 @@ onUnmounted(() => { -