🔱: [client] sync upgrade with 4 commits [trident-sync]

build: publish success
build: publish success
perf: antdv示例增加保存列宽功能
pull/349/head
GitHub Actions Bot 2025-03-19 19:25:03 +00:00
parent 2b4b15f558
commit d2652baf22
4 changed files with 65 additions and 6 deletions

View File

@ -3,6 +3,21 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/fast-crud/fast-crud/compare/v1.25.5...v1.25.6) (2025-03-19)
**Note:** Version bump only for package @fast-crud/fs-admin-antdv4
## [1.25.5](https://github.com/fast-crud/fast-crud/compare/v1.25.4...v1.25.5) (2025-03-19)
### Bug Fixes
* 修复 antdv 弹出菜单边框过大的问题 ([fe4a044](https://github.com/fast-crud/fast-crud/commit/fe4a0442bf8fcdc3120b6de788ff318933b6bfab))
* 修复 antdv懒加载后dropdown按钮无法点击的bug ([30ee067](https://github.com/fast-crud/fast-crud/commit/30ee067580fb663bbe550d50abf63c1fd89504a1))
### Performance Improvements
* antdv示例增加保存列宽功能 ([a1218b0](https://github.com/fast-crud/fast-crud/commit/a1218b0451eb73fae8e337128e79b6e1fd4184eb))
## [1.25.4](https://github.com/fast-crud/fast-crud/compare/v1.25.3...v1.25.4) (2025-03-04) ## [1.25.4](https://github.com/fast-crud/fast-crud/compare/v1.25.3...v1.25.4) (2025-03-04)
### Performance Improvements ### Performance Improvements

View File

@ -1,6 +1,6 @@
{ {
"name": "@fast-crud/fs-admin-antdv4", "name": "@fast-crud/fs-admin-antdv4",
"version": "1.25.4", "version": "1.25.6",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@ -27,10 +27,10 @@
"@aws-sdk/client-s3": "^3.535.0", "@aws-sdk/client-s3": "^3.535.0",
"@aws-sdk/s3-request-presigner": "^3.535.0", "@aws-sdk/s3-request-presigner": "^3.535.0",
"@ctrl/tinycolor": "^4.1.0", "@ctrl/tinycolor": "^4.1.0",
"@fast-crud/fast-crud": "^1.25.4", "@fast-crud/fast-crud": "^1.25.6",
"@fast-crud/fast-extends": "^1.25.4", "@fast-crud/fast-extends": "^1.25.6",
"@fast-crud/ui-antdv4": "^1.25.4", "@fast-crud/ui-antdv4": "^1.25.6",
"@fast-crud/ui-interface": "^1.25.4", "@fast-crud/ui-interface": "^1.25.6",
"@iconify/tailwind": "^1.2.0", "@iconify/tailwind": "^1.2.0",
"@iconify/vue": "^4.1.1", "@iconify/vue": "^4.1.1",
"@manypkg/get-packages": "^2.2.2", "@manypkg/get-packages": "^2.2.2",

View File

@ -0,0 +1,33 @@
import { debounce } from "lodash-es";
import { LocalStorage } from "/@/utils/util.storage";
export class ColumnSizeSaver {
save: (key: string, size: number) => void;
constructor() {
this.save = debounce((key: string, size: number) => {
const saveKey = this.getKey();
let data = LocalStorage.get(saveKey);
if (!data) {
data = {};
}
data[key] = size;
LocalStorage.set(saveKey, data);
});
}
getKey() {
const loc = window.location;
const currentUrl = `${loc.pathname}${loc.search}${loc.hash}`;
return `columnSize-${currentUrl}`;
}
get(key: string) {
const saveKey = this.getKey();
const row = LocalStorage.get(saveKey);
return row?.[key];
}
clear() {
const saveKey = this.getKey();
LocalStorage.remove(saveKey);
}
}
export const columnSizeSaver = new ColumnSizeSaver();

View File

@ -11,11 +11,13 @@ import { useCrudPermission } from "../permission";
import { GetSignedUrl } from "/@/views/crud/component/uploader/s3/api"; import { GetSignedUrl } from "/@/views/crud/component/uploader/s3/api";
import { notification } from "ant-design-vue"; import { notification } from "ant-design-vue";
import { usePreferences } from "/@/vben/preferences"; import { usePreferences } from "/@/vben/preferences";
import { columnSizeSaver } from "/@/plugin/fast-crud/column-size-saver";
function install(app: any, options: any = {}) { function install(app: any, options: any = {}) {
app.use(UiAntdv); app.use(UiAntdv);
//设置日志级别 //设置日志级别
setLogger({ level: "debug" }); setLogger({ level: "debug" });
app.use(FastCrud, { app.use(FastCrud, {
i18n: options.i18n, i18n: options.i18n,
async dictRequest({ url }: any) { async dictRequest({ url }: any) {
@ -53,6 +55,7 @@ function install(app: any, options: any = {}) {
onResizeColumn: (w: number, col: any) => { onResizeColumn: (w: number, col: any) => {
if (crudBinding.value?.table?.columnsMap && crudBinding.value?.table?.columnsMap[col.key]) { if (crudBinding.value?.table?.columnsMap && crudBinding.value?.table?.columnsMap[col.key]) {
crudBinding.value.table.columnsMap[col.key].width = w; crudBinding.value.table.columnsMap[col.key].width = w;
columnSizeSaver.save(col.key, w);
} }
}, },
conditionalRender: { conditionalRender: {
@ -72,6 +75,11 @@ function install(app: any, options: any = {}) {
toolbar: { toolbar: {
export: { export: {
fileType: "excel" fileType: "excel"
},
columnsFilter: {
async onReset() {
columnSizeSaver.clear();
}
} }
}, },
rowHandle: { rowHandle: {
@ -381,7 +389,10 @@ function install(app: any, options: any = {}) {
} }
if (columnProps.column.resizable == null) { if (columnProps.column.resizable == null) {
columnProps.column.resizable = true; columnProps.column.resizable = true;
if (!columnProps.column.width) { const savedColumnWidth = columnSizeSaver.get(columnProps.key as string);
if (savedColumnWidth) {
columnProps.column.width = savedColumnWidth;
} else if (!columnProps.column.width) {
columnProps.column.width = 200; columnProps.column.width = 200;
} }
} }