Compare commits

..

No commits in common. "c2a7f09e9e8dc1f9a2cbb90ce155b4e7ed73ff2d" and "90a4c8e69f0cbfdb733b4f2995b5e302a9160d05" have entirely different histories.

10 changed files with 27 additions and 51 deletions

View File

@ -13,7 +13,7 @@
"format": "prettier --write src/"
},
"dependencies": {
"@cool-vue/crud": "^8.0.3",
"@cool-vue/crud": "^8.0.2",
"@element-plus/icons-vue": "^2.3.1",
"@vueuse/core": "^12.5.0",
"@wangeditor/editor": "^5.1.23",

View File

@ -1,6 +1,6 @@
{
"name": "@cool-vue/crud",
"version": "8.0.3",
"version": "8.0.2",
"private": false,
"main": "./dist/index.umd.js",
"module": "./dist/index.es.js",

View File

@ -1,6 +1,6 @@
import { debounce, last } from "lodash-es";
import { nextTick, onActivated, onMounted, ref } from "vue";
import { addClass, removeClass } from "../../../utils";
import { addClass } from "../../../utils";
import { mitt } from "../../../utils/mitt";
// 表格高度
@ -54,11 +54,6 @@ export function useHeight({ config, Table }: { Table: Vue.Ref<any>; config: ClTa
n = n.nextSibling;
}
// 移除 cl-row--last
arr.forEach((e) => {
removeClass(e, "cl-row--last");
});
// 最后一个可视元素
const z = last(arr);

View File

@ -33,6 +33,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
}>, {
type: "default" | "card";
labels: unknown[];
justify: "left" | "center" | "right" | "justify" | "start" | "end" | "match-parent";
justify: "center" | "left" | "right" | "justify" | "start" | "end" | "match-parent";
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
export default _default;

View File

@ -3,5 +3,5 @@ export declare function useHeight({ config, Table }: {
config: ClTable.Config;
}): {
maxHeight: import('vue').Ref<number, number>;
calcMaxHeight: import('lodash').DebouncedFunc<() => Promise<void>>;
calcMaxHeight: import('lodash-es').DebouncedFunc<() => Promise<void>>;
};

View File

@ -87,10 +87,6 @@ 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;
@ -155,7 +151,7 @@ export declare function useTable(props: any): {
width: string;
height: string;
} | null>;
debouncedUpdateLayout: import('lodash').DebouncedFunc<() => void>;
debouncedUpdateLayout: import('lodash-es').DebouncedFunc<() => void>;
handleFixedMousewheel: (event: any, data: any) => void;
setCurrentRow: (row: any) => void;
getSelectionRows: () => any;
@ -213,7 +209,6 @@ 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: {};
@ -309,10 +304,6 @@ 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;
@ -377,7 +368,7 @@ export declare function useTable(props: any): {
width: string;
height: string;
} | null>;
debouncedUpdateLayout: import('lodash').DebouncedFunc<() => void>;
debouncedUpdateLayout: import('lodash-es').DebouncedFunc<() => void>;
handleFixedMousewheel: (event: any, data: any) => void;
setCurrentRow: (row: any) => void;
getSelectionRows: () => any;
@ -435,7 +426,6 @@ export declare function useTable(props: any): {
indent: number;
flexible: boolean;
scrollbarTabindex: string | number;
preserveExpandedContent: boolean;
}>, import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
data: {
type: import('vue').PropType<import('element-plus/es/components/table/src/table/defaults.mjs').DefaultRow[]>;
@ -524,10 +514,6 @@ 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;
@ -592,7 +578,7 @@ export declare function useTable(props: any): {
width: string;
height: string;
} | null>;
debouncedUpdateLayout: import('lodash').DebouncedFunc<() => void>;
debouncedUpdateLayout: import('lodash-es').DebouncedFunc<() => void>;
handleFixedMousewheel: (event: any, data: any) => void;
setCurrentRow: (row: any) => void;
getSelectionRows: () => any;
@ -650,7 +636,6 @@ 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: {};
@ -746,10 +731,6 @@ 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;
@ -814,7 +795,7 @@ export declare function useTable(props: any): {
width: string;
height: string;
} | null>;
debouncedUpdateLayout: import('lodash').DebouncedFunc<() => void>;
debouncedUpdateLayout: import('lodash-es').DebouncedFunc<() => void>;
handleFixedMousewheel: (event: any, data: any) => void;
setCurrentRow: (row: any) => void;
getSelectionRows: () => any;
@ -872,7 +853,6 @@ export declare function useTable(props: any): {
indent: number;
flexible: boolean;
scrollbarTabindex: string | number;
preserveExpandedContent: boolean;
}>>;
config: {
columns: {

View File

@ -33,7 +33,7 @@
</div>
<!-- 文件名 -->
<div class="cl-upload-item__name">
<span>{{ item.name || url }}</span>
<span>{{ fileName(item.name || url) }}</span>
<span v-show="item.error" class="error">{{ item.error }}</span>
</div>
</template>
@ -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 { getRule } from '../../utils';
import { fileName, 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: 8px;
border-radius: 6px;
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.1);
background-color: rgba(0, 0, 0, 0.5);
pointer-events: none;
transition: opacity 0.3s;
opacity: 0;
@ -388,7 +388,7 @@ onMounted(() => {
color: #fff;
font-size: 12px;
padding: 2px 4px;
border-radius: 4px;
border-radius: 2px;
text-transform: uppercase;
max-width: 65px;
box-sizing: border-box;

View File

@ -334,12 +334,6 @@ async function onBeforeUpload(file: any, item?: Upload.Item) {
return true;
}
//
if (file.size / 1024 / 1024 >= limitSize) {
ElMessage.error(t('上传文件大小不能超过 {n}MB!', { n: limitSize }));
return false;
}
//
if (props.beforeUpload) {
let r = props.beforeUpload(file, item, { next });
@ -354,6 +348,11 @@ async function onBeforeUpload(file: any, item?: Upload.Item) {
return r;
} else {
if (file.size / 1024 / 1024 >= limitSize) {
ElMessage.error(t('上传文件大小不能超过 {n}MB!', { n: limitSize }));
return false;
}
return next();
}
}

View File

@ -1,6 +1,6 @@
import { ElMessage } from 'element-plus';
import { module, service } from '/@/cool';
import { extname, filename, uuid } from '/@/cool/utils';
import { uuid } from '/@/cool/utils';
import { pathJoin } from '../utils';
import { useBase } from '/$/base';
import { type AxiosProgressEvent } from 'axios';
@ -29,14 +29,11 @@ export function useUpload() {
// 本地上传
const isLocal = mode == 'local';
// 文件扩展名
const ext = extname(file.name);
// 文件名
const name = filename(file.name) + '_' + fileId + ext;
const fileName = fileId + '_' + file.name;
// Key
let key = isLocal ? name : pathJoin(prefixPath!, name);
let key = isLocal ? fileName : pathJoin(prefixPath!, fileName);
// 多种上传请求
const next = async ({ host, preview, data }: Upload.Request) => {

View File

@ -19,6 +19,11 @@ 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 => {