mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-10 20:02:54 +00:00
Compare commits
2 Commits
90a4c8e69f
...
c2a7f09e9e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2a7f09e9e | ||
|
|
94d9e7d716 |
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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<any>; config: ClTa
|
||||
n = n.nextSibling;
|
||||
}
|
||||
|
||||
// 移除 cl-row--last
|
||||
arr.forEach((e) => {
|
||||
removeClass(e, "cl-row--last");
|
||||
});
|
||||
|
||||
// 最后一个可视元素
|
||||
const z = last(arr);
|
||||
|
||||
|
||||
@ -33,6 +33,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
||||
}>, {
|
||||
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;
|
||||
|
||||
@ -3,5 +3,5 @@ export declare function useHeight({ config, Table }: {
|
||||
config: ClTable.Config;
|
||||
}): {
|
||||
maxHeight: import('vue').Ref<number, number>;
|
||||
calcMaxHeight: import('lodash-es').DebouncedFunc<() => Promise<void>>;
|
||||
calcMaxHeight: import('lodash').DebouncedFunc<() => Promise<void>>;
|
||||
};
|
||||
|
||||
@ -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<Readonly<import('vue').ExtractPropTypes<{
|
||||
data: {
|
||||
type: import('vue').PropType<import('element-plus/es/components/table/src/table/defaults.mjs').DefaultRow[]>;
|
||||
@ -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: {
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
<!-- 文件名 -->
|
||||
<div class="cl-upload-item__name">
|
||||
<span>{{ fileName(item.name || url) }}</span>
|
||||
<span>{{ 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 { 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;
|
||||
|
||||
@ -334,6 +334,12 @@ 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 });
|
||||
@ -348,11 +354,6 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) => {
|
||||
|
||||
@ -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 => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user