diff --git a/package.json b/package.json index ca06d22..43ef39f 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "format": "prettier --write src/" }, "dependencies": { - "@cool-vue/crud": "^8.0.2", + "@cool-vue/crud": "^8.0.3", "@element-plus/icons-vue": "^2.3.1", "@vueuse/core": "^12.5.0", "@wangeditor/editor": "^5.1.23", diff --git a/packages/crud/package.json b/packages/crud/package.json index 20fa82b..db994c3 100644 --- a/packages/crud/package.json +++ b/packages/crud/package.json @@ -1,6 +1,6 @@ { "name": "@cool-vue/crud", - "version": "8.0.2", + "version": "8.0.3", "private": false, "main": "./dist/index.umd.js", "module": "./dist/index.es.js", diff --git a/packages/crud/src/components/table/helper/height.ts b/packages/crud/src/components/table/helper/height.ts index 48503ca..76f0586 100644 --- a/packages/crud/src/components/table/helper/height.ts +++ b/packages/crud/src/components/table/helper/height.ts @@ -1,6 +1,6 @@ import { debounce, last } from "lodash-es"; import { nextTick, onActivated, onMounted, ref } from "vue"; -import { addClass } from "../../../utils"; +import { addClass, removeClass } from "../../../utils"; import { mitt } from "../../../utils/mitt"; // 表格高度 @@ -54,6 +54,11 @@ export function useHeight({ config, Table }: { Table: Vue.Ref; config: ClTa n = n.nextSibling; } + // 移除 cl-row--last + arr.forEach((e) => { + removeClass(e, "cl-row--last"); + }); + // 最后一个可视元素 const z = last(arr); diff --git a/packages/crud/types/components/form-tabs/index.d.ts b/packages/crud/types/components/form-tabs/index.d.ts index 87f5288..429a6d7 100644 --- a/packages/crud/types/components/form-tabs/index.d.ts +++ b/packages/crud/types/components/form-tabs/index.d.ts @@ -33,6 +33,6 @@ declare const _default: import('vue').DefineComponent, { type: "default" | "card"; labels: unknown[]; - justify: "center" | "left" | "right" | "justify" | "start" | "end" | "match-parent"; + justify: "left" | "center" | "right" | "justify" | "start" | "end" | "match-parent"; }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>; export default _default; diff --git a/packages/crud/types/components/table/helper/height.d.ts b/packages/crud/types/components/table/helper/height.d.ts index d1bb96a..12d050a 100644 --- a/packages/crud/types/components/table/helper/height.d.ts +++ b/packages/crud/types/components/table/helper/height.d.ts @@ -3,5 +3,5 @@ export declare function useHeight({ config, Table }: { config: ClTable.Config; }): { maxHeight: import('vue').Ref; - calcMaxHeight: import('lodash-es').DebouncedFunc<() => Promise>; + calcMaxHeight: import('lodash').DebouncedFunc<() => Promise>; }; diff --git a/packages/crud/types/components/table/helper/index.d.ts b/packages/crud/types/components/table/helper/index.d.ts index 6f8a1ef..871f60f 100644 --- a/packages/crud/types/components/table/helper/index.d.ts +++ b/packages/crud/types/components/table/helper/index.d.ts @@ -87,6 +87,10 @@ export declare function useTable(props: any): { type: BooleanConstructor; default: boolean; }; + preserveExpandedContent: { + type: BooleanConstructor; + default: boolean; + }; }>> & { onScroll?: ((...args: any[]) => any) | undefined; onSelect?: ((...args: any[]) => any) | undefined; @@ -151,7 +155,7 @@ export declare function useTable(props: any): { width: string; height: string; } | null>; - debouncedUpdateLayout: import('lodash-es').DebouncedFunc<() => void>; + debouncedUpdateLayout: import('lodash').DebouncedFunc<() => void>; handleFixedMousewheel: (event: any, data: any) => void; setCurrentRow: (row: any) => void; getSelectionRows: () => any; @@ -209,6 +213,7 @@ export declare function useTable(props: any): { indent: number; flexible: boolean; scrollbarTabindex: string | number; + preserveExpandedContent: boolean; }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, { P: {}; B: {}; @@ -304,6 +309,10 @@ export declare function useTable(props: any): { type: BooleanConstructor; default: boolean; }; + preserveExpandedContent: { + type: BooleanConstructor; + default: boolean; + }; }>> & { onScroll?: ((...args: any[]) => any) | undefined; onSelect?: ((...args: any[]) => any) | undefined; @@ -368,7 +377,7 @@ export declare function useTable(props: any): { width: string; height: string; } | null>; - debouncedUpdateLayout: import('lodash-es').DebouncedFunc<() => void>; + debouncedUpdateLayout: import('lodash').DebouncedFunc<() => void>; handleFixedMousewheel: (event: any, data: any) => void; setCurrentRow: (row: any) => void; getSelectionRows: () => any; @@ -426,6 +435,7 @@ export declare function useTable(props: any): { indent: number; flexible: boolean; scrollbarTabindex: string | number; + preserveExpandedContent: boolean; }>, import('vue').CreateComponentPublicInstanceWithMixins; @@ -514,6 +524,10 @@ export declare function useTable(props: any): { type: BooleanConstructor; default: boolean; }; + preserveExpandedContent: { + type: BooleanConstructor; + default: boolean; + }; }>> & { onScroll?: ((...args: any[]) => any) | undefined; onSelect?: ((...args: any[]) => any) | undefined; @@ -578,7 +592,7 @@ export declare function useTable(props: any): { width: string; height: string; } | null>; - debouncedUpdateLayout: import('lodash-es').DebouncedFunc<() => void>; + debouncedUpdateLayout: import('lodash').DebouncedFunc<() => void>; handleFixedMousewheel: (event: any, data: any) => void; setCurrentRow: (row: any) => void; getSelectionRows: () => any; @@ -636,6 +650,7 @@ export declare function useTable(props: any): { indent: number; flexible: boolean; scrollbarTabindex: string | number; + preserveExpandedContent: boolean; }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, { P: {}; B: {}; @@ -731,6 +746,10 @@ export declare function useTable(props: any): { type: BooleanConstructor; default: boolean; }; + preserveExpandedContent: { + type: BooleanConstructor; + default: boolean; + }; }>> & { onScroll?: ((...args: any[]) => any) | undefined; onSelect?: ((...args: any[]) => any) | undefined; @@ -795,7 +814,7 @@ export declare function useTable(props: any): { width: string; height: string; } | null>; - debouncedUpdateLayout: import('lodash-es').DebouncedFunc<() => void>; + debouncedUpdateLayout: import('lodash').DebouncedFunc<() => void>; handleFixedMousewheel: (event: any, data: any) => void; setCurrentRow: (row: any) => void; getSelectionRows: () => any; @@ -853,6 +872,7 @@ export declare function useTable(props: any): { indent: number; flexible: boolean; scrollbarTabindex: string | number; + preserveExpandedContent: boolean; }>>; config: { columns: { diff --git a/src/plugins/upload/components/upload-item/index.vue b/src/plugins/upload/components/upload-item/index.vue index f7137af..64cd65c 100644 --- a/src/plugins/upload/components/upload-item/index.vue +++ b/src/plugins/upload/components/upload-item/index.vue @@ -33,7 +33,7 @@
- {{ fileName(item.name || url) }} + {{ item.name || url }} {{ item.error }}
@@ -123,7 +123,7 @@ import { ZoomIn, Delete, VideoPause, VideoPlay } from '@element-plus/icons-vue'; import { ContextMenu } from '@cool-vue/crud'; import { useCool } from '/@/cool'; import { extname } from '/@/cool/utils'; -import { fileName, getRule } from '../../utils'; +import { getRule } from '../../utils'; import { ElMessage } from 'element-plus'; import { useClipboard } from '@vueuse/core'; import Viewer from './viewer.vue'; @@ -280,7 +280,7 @@ onMounted(() => { height: 100%; width: 100%; cursor: pointer; - border-radius: 6px; + border-radius: 8px; overflow: hidden; background-color: var(--el-fill-color-light); border: 1px solid var(--el-fill-color-light); @@ -349,7 +349,7 @@ onMounted(() => { top: 0; height: 100%; width: 100%; - background-color: rgba(0, 0, 0, 0.5); + background-color: rgba(0, 0, 0, 0.1); pointer-events: none; transition: opacity 0.3s; opacity: 0; @@ -388,7 +388,7 @@ onMounted(() => { color: #fff; font-size: 12px; padding: 2px 4px; - border-radius: 2px; + border-radius: 4px; text-transform: uppercase; max-width: 65px; box-sizing: border-box; diff --git a/src/plugins/upload/hooks/index.ts b/src/plugins/upload/hooks/index.ts index d3f0ab9..4d113c5 100644 --- a/src/plugins/upload/hooks/index.ts +++ b/src/plugins/upload/hooks/index.ts @@ -1,6 +1,6 @@ import { ElMessage } from 'element-plus'; import { module, service } from '/@/cool'; -import { uuid } from '/@/cool/utils'; +import { extname, filename, uuid } from '/@/cool/utils'; import { pathJoin } from '../utils'; import { useBase } from '/$/base'; import { type AxiosProgressEvent } from 'axios'; @@ -29,11 +29,14 @@ export function useUpload() { // 本地上传 const isLocal = mode == 'local'; + // 文件扩展名 + const ext = extname(file.name); + // 文件名 - const fileName = fileId + '_' + file.name; + const name = filename(file.name) + '_' + fileId + ext; // Key - let key = isLocal ? fileName : pathJoin(prefixPath!, fileName); + let key = isLocal ? name : pathJoin(prefixPath!, name); // 多种上传请求 const next = async ({ host, preview, data }: Upload.Request) => { diff --git a/src/plugins/upload/utils/index.ts b/src/plugins/upload/utils/index.ts index b461cb8..d1b2f31 100644 --- a/src/plugins/upload/utils/index.ts +++ b/src/plugins/upload/utils/index.ts @@ -19,11 +19,6 @@ export function fileSize(size = 0): string { return (size / Math.pow(num, 4)).toFixed(2) + 'T'; } -// 文件名 -export function fileName(url: string) { - return filename(url.substring(url.indexOf('_') + 1)); -} - // 文件规则 export function fileRule(path?: string) { const d = rules.find(e => {