Skip to content

Commit 55ccdc0

Browse files
committed
sync: code
Squashed commit of the following: commit 79de6bc Author: Netfan <[email protected]> Date: Thu Apr 17 22:23:05 2025 +0800 fix: alert send wrong confirm state to beforeClose (vbenjs#5991) * 修复alert在按下Esc或者点击遮罩关闭时,可能发送错误的isConfirm状态 commit 14bd6dd Author: Netfan <[email protected]> Date: Thu Apr 17 20:25:49 2025 +0800 fix: destroyOnClose works within connectedComponent (vbenjs#5989) * 修复destroyOnClose没能销毁connectedComponent自身的问题 commit 7f269e0 Author: PIPEDREA_WZJ <[email protected]> Date: Thu Apr 17 14:01:39 2025 +0800 Update tailwindcss.md (vbenjs#5602) tailwindcss最新的版本已经是v4.x,vben中使用的是3.x的tailwindcss。在未进行兼容前,会出现运行失败的问题 commit 4baec83 Author: yuh <[email protected]> Date: Thu Apr 17 14:00:46 2025 +0800 feat: add examples: form-upload (vbenjs#5955) * feat: add examples: form-upload * fix: upload: accept and label * fix: upload: 设置表单值、图片预览 commit f7a4d13 Author: Netfan <[email protected]> Date: Wed Apr 16 14:11:04 2025 +0800 fix: fixed arguments of callbacks in `formApi` (vbenjs#5970) * 修复 `handleValuesChange` 传递的参数不是处理后的表单值的问题 * 修复 `handleReset` 未能传递正确参数的问题 commit 0936861 Author: Netfan <[email protected]> Date: Wed Apr 16 11:29:01 2025 +0800 feat: pass `fieldsChanged` into the `handleValuesChange` callback function (vbenjs#5968) * fieldsChanged(已被改变值的字段名)将传入handleValuesChange回调函数 commit 3318d76 Author: ming4762 <[email protected]> Date: Wed Apr 16 11:28:36 2025 +0800 perf: improve `destroyOnClose` for VbenModal (vbenjs#5964) commit 8f3881e Author: LinaBell <[email protected]> Date: Wed Apr 16 11:27:13 2025 +0800 perf: `beforeClose` of drawer support promise (vbenjs#5932) * perf: the beforeClose function of drawer is consistent with that of modal * refactor: drawer test update commit 5252480 Author: zhouda1fu <[email protected]> Date: Wed Apr 16 11:22:59 2025 +0800 fix: missing await in department form(vbenjs#5967) commit d18f561 Author: Netfan <[email protected]> Date: Tue Apr 15 20:52:23 2025 +0800 docs: update alert and apiComponent docs (vbenjs#5961) commit 333998b Author: wyc001122 <[email protected]> Date: Tue Apr 15 20:51:38 2025 +0800 fix: determine if scrollbar has been totally scrolled (vbenjs#5934) * 修复在系统屏幕缩放比例不为100%的情况下,滚动组件对是否已滚动到边界的判断可能不正确的问题 commit 3fb4fba Author: ming4762 <[email protected]> Date: Tue Apr 15 18:49:57 2025 +0800 fix: modal closing animation (vbenjs#5960) commit c7e6210 Author: ming4762 <[email protected]> Date: Tue Apr 15 16:04:44 2025 +0800 feat: `modal`&`drawer` support `center-footer` slot (vbenjs#5956) commit d864085 Author: lztb <[email protected]> Date: Tue Apr 15 16:03:20 2025 +0800 feat: vben-form添加arrayToStringFields属性 (vbenjs#5957) * feat: vben-form添加arrayToStringFields属性 * feat: 修改handleArrayToStringFields和handleStringToArrayFields中嵌套数组格式的处理不一致 --------- Co-authored-by: 米山 <[email protected]> commit fcdc1a1 Author: Netfan <[email protected]> Date: Tue Apr 15 15:32:30 2025 +0800 feat: add more expose methods for `apiComponent` (vbenjs#5958) * 为ApiComponent组件添加getOptions和getValue导出方法。 commit bf7496f Author: Netfan <[email protected]> Date: Tue Apr 15 00:00:05 2025 +0800 feat: add `useAlertContext` for Alert component (vbenjs#5947) * 新增Alert的子组件中获取弹窗上下文的能力 commit 9700150 Author: Netfan <[email protected]> Date: Mon Apr 14 19:56:52 2025 +0800 fix: table actions in fixed column (vbenjs#5945) commit f0e9e55 Author: Netfan <[email protected]> Date: Mon Apr 14 11:48:21 2025 +0800 feat: alert support customize `footer` (vbenjs#5940) * Alert组件支持自定义footer commit ff88274 Author: Netfan <[email protected]> Date: Mon Apr 14 11:18:33 2025 +0800 fix: long navigation menu can be scrolled (vbenjs#5939) * 修复超长的导航菜单无法纵向滚动的问题 commit afce9dc Author: ming4762 <[email protected]> Date: Sun Apr 13 23:02:07 2025 +0800 perf: improve `destroyOnClose` for `VbenModal` (vbenjs#5935) * perf: 优化Vben Modal destroyOnClose,解决destroyOnClose=false,Modal依旧会被销毁的问题 影响范围(重要):destroyOnClose默认为true,这会导致所有的modal都会默认渲染到body radix-vue Dialog组件默认会销毁挂载的组件,所以即使destroyOnClose=false,Modal依旧会被销毁的问题 对于一些大表单重复渲染导致卡顿,ApiComponent也会频繁的加载数据 * fix: modal closing animation --------- Co-authored-by: Netfan <[email protected]> commit b5700bd Author: ming4762 <[email protected]> Date: Sun Apr 13 20:03:18 2025 +0800 perf: improve `autoSelect` of `ApiComponent` (vbenjs#5936) * fix: 修复autoSelect不生效的问题,props.valueField已经被omit了 * feat: ApiComponent autoSelect支持使用函数,可以满足灵活性要求更高的场景 commit a8c4786 Author: Netfan <[email protected]> Date: Sat Apr 12 14:02:35 2025 +0800 feat: api-component support autoSelect prop (vbenjs#5931) * feat: api-component support autoSelect prop * docs: add version requirement commit 2971ccc Author: Netfan <[email protected]> Date: Sat Apr 12 13:41:40 2025 +0800 docs: docs modal z-index fixed, update alert docs (vbenjs#5930) commit 4a2c7b3 Author: Netfan <[email protected]> Date: Sat Apr 12 10:37:47 2025 +0800 fix: alert animation (vbenjs#5927) commit 36bf6fc Author: Netfan <[email protected]> Date: Sat Apr 12 01:44:08 2025 +0800 fix: builtin color change throttled in preference drawer (vbenjs#5924) 修复偏好设置中的自定义主题色拖动选择颜色时页面会明显卡顿的问题 commit f46ec30 Author: Netfan <[email protected]> Date: Sat Apr 12 01:16:57 2025 +0800 fix: theme mode follow the system only `auto` (vbenjs#5923) * 修复主题在未设置为auto时,仍然会跟随系统主题变化的问题。 commit 9bd5a19 Author: Netfan <[email protected]> Date: Sat Apr 12 00:59:56 2025 +0800 fix: alert action button focus, fixed vbenjs#5921 (vbenjs#5922) * 修复Alert组件的按钮焦点切换问题 commit 86da3ce Author: zhang <[email protected]> Date: Wed Apr 9 16:16:56 2025 +0800 chore: 导出框架自带的组件,方便独立页面使用 (vbenjs#5876) commit 329a176 Author: Netfan <[email protected]> Date: Wed Apr 9 01:05:20 2025 +0800 perf: optimize bootstrap modules to speed up first-screen loading (vbenjs#5899) 优化首屏加载速度 commit 9379093 Author: Netfan <[email protected]> Date: Tue Apr 8 20:28:50 2025 +0800 feat: customizable table separator (vbenjs#5898) * 表格的分隔条支持定制背景色或完全移除 commit c9014d0 Author: ming4762 <[email protected]> Date: Tue Apr 8 20:27:03 2025 +0800 perf: 优化关闭页面切换动画的tab切换性能 (vbenjs#5883) commit ed26dca Author: Netfan <[email protected]> Date: Tue Apr 8 16:31:41 2025 +0800 chore: update pnpm-lock.yaml commit 08c6496 Author: Netfan <[email protected]> Date: Tue Apr 8 14:56:40 2025 +0800 chore: update deps commit a8c5df3 Author: Netfan <[email protected]> Date: Tue Apr 8 14:50:05 2025 +0800 fix: possible circular reference issue during build (vbenjs#5894) * 修复构建期间出现的循环引用警告 commit 71e8d12 Author: Netfan <[email protected]> Date: Mon Apr 7 01:21:30 2025 +0800 fix: improve prompt component (vbenjs#5879) * fix: prompt component render fixed * fix: alert buttonAlign default value commit d216fdc Author: Netfan <[email protected]> Date: Sat Apr 5 13:07:52 2025 +0800 feat: support logo text slot (vbenjs#5872) * 基础布局中的LOGO的文字区域允许通过插槽logo-text定制 commit 384c5d7 Author: wyc001122 <[email protected]> Date: Sat Apr 5 11:04:59 2025 +0800 fix: 布局为双列菜单或者水平模式下, 一级菜单高亮问题 (vbenjs#5870) Co-authored-by: 王泳超 <[email protected]> commit b0ad08d Author: Netfan <[email protected]> Date: Fri Apr 4 15:21:09 2025 +0800 feat: use the not-found component instead of the invalid route component in the backend mode (vbenjs#5871) * 后端菜单模式下,使用not-found组件代替无效的路由组件
1 parent 2c92f57 commit 55ccdc0

File tree

4 files changed

+50
-4
lines changed

4 files changed

+50
-4
lines changed

apps/backend-mock/api/upload.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { verifyAccessToken } from '~/utils/jwt-utils';
2+
import { unAuthorizedResponse } from '~/utils/response';
3+
4+
export default eventHandler((event) => {
5+
const userinfo = verifyAccessToken(event);
6+
if (!userinfo) {
7+
return unAuthorizedResponse(event);
8+
}
9+
return useResponseSuccess({
10+
url: 'https://unpkg.com/@vbenjs/[email protected]/source/logo-v1.webp',
11+
});
12+
// return useResponseError("test")
13+
});

packages/@core/ui-kit/popup-ui/src/alert/alert.vue

+5-4
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,13 @@ const getIconRender = computed(() => {
9191
});
9292
9393
function doCancel() {
94-
isConfirm.value = false;
94+
handleCancel();
9595
handleOpenChange(false);
9696
}
9797
9898
function doConfirm() {
99-
isConfirm.value = true;
99+
handleConfirm();
100100
handleOpenChange(false);
101-
emits('confirm');
102101
}
103102
104103
provideAlertContext({
@@ -117,11 +116,13 @@ function handleCancel() {
117116
118117
const loading = ref(false);
119118
async function handleOpenChange(val: boolean) {
119+
const confirmState = isConfirm.value;
120+
isConfirm.value = false;
120121
await nextTick();
121122
if (!val && props.beforeClose) {
122123
loading.value = true;
123124
try {
124-
const res = await props.beforeClose({ isConfirm: isConfirm.value });
125+
const res = await props.beforeClose({ isConfirm: confirmState });
125126
if (res !== false) {
126127
open.value = false;
127128
}

packages/@core/ui-kit/popup-ui/src/modal/use-modal.ts

+7
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
7070
injectData.options?.onOpenChange?.(isOpen);
7171
};
7272

73+
mergedOptions.onClosed = () => {
74+
options.onClosed?.();
75+
if (options.destroyOnClose) {
76+
injectData.reCreateModal?.();
77+
}
78+
};
79+
7380
const api = new ModalApi(mergedOptions);
7481

7582
const extendedApi: ExtendedModalApi = api as never;

playground/src/api/examples/upload.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { requestClient } from '#/api/request';
2+
3+
interface UploadFileParams {
4+
file: File;
5+
onError?: (error: Error) => void;
6+
onProgress?: (progress: { percent: number }) => void;
7+
onSuccess?: (data: any, file: File) => void;
8+
}
9+
export async function upload_file({
10+
file,
11+
onError,
12+
onProgress,
13+
onSuccess,
14+
}: UploadFileParams) {
15+
try {
16+
onProgress?.({ percent: 0 });
17+
18+
const data = await requestClient.upload('/upload', { file });
19+
20+
onProgress?.({ percent: 100 });
21+
onSuccess?.(data, file);
22+
} catch (error) {
23+
onError?.(error instanceof Error ? error : new Error(String(error)));
24+
}
25+
}

0 commit comments

Comments
 (0)