vue-element-ui-x 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Sender/index.js +1 -1
- package/lib/components/ThoughtChain/index.js +30 -30
- package/lib/index.common.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +774 -774
- package/lib/index.umd.js +1 -1
- package/package.json +5 -10
- package/src/components/Attachments/index.js +0 -8
- package/src/components/Attachments/src/main.vue +0 -529
- package/src/components/Bubble/index.js +0 -6
- package/src/components/Bubble/src/main.vue +0 -288
- package/src/components/BubbleList/index.js +0 -8
- package/src/components/BubbleList/src/loading.vue +0 -75
- package/src/components/BubbleList/src/main.vue +0 -444
- package/src/components/Conversations/index.js +0 -8
- package/src/components/Conversations/src/components/item.vue +0 -350
- package/src/components/Conversations/src/main.vue +0 -587
- package/src/components/FilesCard/index.js +0 -8
- package/src/components/FilesCard/src/fileSvg/audio.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/changeFileName.bat +0 -18
- package/src/components/FilesCard/src/fileSvg/code.vue +0 -35
- package/src/components/FilesCard/src/fileSvg/database.vue +0 -94
- package/src/components/FilesCard/src/fileSvg/excel.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/file.vue +0 -40
- package/src/components/FilesCard/src/fileSvg/image.vue +0 -40
- package/src/components/FilesCard/src/fileSvg/index.js +0 -46
- package/src/components/FilesCard/src/fileSvg/link.vue +0 -54
- package/src/components/FilesCard/src/fileSvg/mark.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/pdf.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/ppt.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/three.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/txt.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/unknown.vue +0 -54
- package/src/components/FilesCard/src/fileSvg/video.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/word.vue +0 -38
- package/src/components/FilesCard/src/fileSvg/zip.vue +0 -38
- package/src/components/FilesCard/src/main.vue +0 -403
- package/src/components/FilesCard/src/options.js +0 -18
- package/src/components/Prompts/index.js +0 -8
- package/src/components/Prompts/src/main.vue +0 -248
- package/src/components/Sender/index.js +0 -8
- package/src/components/Sender/src/components/ClearButton.vue +0 -28
- package/src/components/Sender/src/components/Loading.vue +0 -53
- package/src/components/Sender/src/components/LoadingButton.vue +0 -37
- package/src/components/Sender/src/components/SendButton.vue +0 -26
- package/src/components/Sender/src/components/SpeechButton.vue +0 -24
- package/src/components/Sender/src/components/SpeechLoading.vue +0 -87
- package/src/components/Sender/src/components/SpeechLoadingButton.vue +0 -41
- package/src/components/Sender/src/main.vue +0 -803
- package/src/components/Thinking/index.js +0 -8
- package/src/components/Thinking/src/main.vue +0 -199
- package/src/components/ThoughtChain/index.js +0 -8
- package/src/components/ThoughtChain/src/main.vue +0 -291
- package/src/components/Typewriter/index.js +0 -8
- package/src/components/Typewriter/src/main.vue +0 -255
- package/src/components/Welcome/index.js +0 -8
- package/src/components/Welcome/src/main.vue +0 -151
- package/src/index.js +0 -104
- package/src/locale/index.js +0 -97
- package/src/locale/lang/ar.js +0 -18
- package/src/locale/lang/de.js +0 -18
- package/src/locale/lang/en.js +0 -18
- package/src/locale/lang/es.js +0 -18
- package/src/locale/lang/fr.js +0 -18
- package/src/locale/lang/index.js +0 -62
- package/src/locale/lang/it.js +0 -18
- package/src/locale/lang/ja.js +0 -18
- package/src/locale/lang/ko.js +0 -18
- package/src/locale/lang/pt-br.js +0 -18
- package/src/locale/lang/ru-RU.js +0 -18
- package/src/locale/lang/zh-CN.js +0 -18
- package/src/locale/lang/zh-TW.js +0 -18
- package/src/locale/mixin.js +0 -9
- package/src/mixins/index.js +0 -49
- package/src/mixins/recordMixin.js +0 -117
- package/src/mixins/sendMixin.js +0 -450
- package/src/mixins/streamMixin.js +0 -497
- package/src/styles/Attachments.scss +0 -236
- package/src/styles/Bubble.scss +0 -158
- package/src/styles/BubbleList.scss +0 -148
- package/src/styles/Conversations.scss +0 -283
- package/src/styles/FilesCard.scss +0 -222
- package/src/styles/Prompts.scss +0 -197
- package/src/styles/Sender.scss +0 -207
- package/src/styles/Thinking.scss +0 -142
- package/src/styles/ThoughtChain.scss +0 -113
- package/src/styles/Typewriter.scss +0 -66
- package/src/styles/Welcome.scss +0 -283
- package/src/theme/var.scss +0 -183
- package/src/utils/index.js +0 -199
- package/src/utils/scrollDetector.js +0 -34
package/src/theme/var.scss
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
// Element UI X 变量代理系统
|
|
2
|
-
// 替代 element-ui/packages/theme-chalk/src/common/var 的完整变量定义
|
|
3
|
-
|
|
4
|
-
// ===== 过渡动画 =====
|
|
5
|
-
$--all-transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) !default;
|
|
6
|
-
$--fade-transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1) !default;
|
|
7
|
-
$--fade-linear-transition: opacity 200ms linear !default;
|
|
8
|
-
$--md-fade-transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
9
|
-
opacity 300ms cubic-bezier(0.23, 1, 0.32, 1) !default;
|
|
10
|
-
$--border-transition-base: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) !default;
|
|
11
|
-
$--color-transition-base: color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) !default;
|
|
12
|
-
|
|
13
|
-
// ===== 基础颜色 =====
|
|
14
|
-
$--color-primary: #409eff !default;
|
|
15
|
-
$--color-white: #ffffff !default;
|
|
16
|
-
$--color-black: #000000 !default;
|
|
17
|
-
$--color-primary-light-1: #53a8ff !default;
|
|
18
|
-
$--color-primary-light-2: #66b1ff !default;
|
|
19
|
-
$--color-primary-light-3: #79bbff !default;
|
|
20
|
-
$--color-primary-light-4: #8cc5ff !default;
|
|
21
|
-
$--color-primary-light-5: #a0cfff !default;
|
|
22
|
-
$--color-primary-light-6: #b3d8ff !default;
|
|
23
|
-
$--color-primary-light-7: #c6e2ff !default;
|
|
24
|
-
$--color-primary-light-8: #d9ecff !default;
|
|
25
|
-
$--color-primary-light-9: #ecf5ff !default;
|
|
26
|
-
|
|
27
|
-
$--color-success: #67c23a !default;
|
|
28
|
-
$--color-warning: #e6a23c !default;
|
|
29
|
-
$--color-danger: #f56c6c !default;
|
|
30
|
-
$--color-info: #909399 !default;
|
|
31
|
-
|
|
32
|
-
$--color-success-light: #b3e19d !default;
|
|
33
|
-
$--color-warning-light: #f3d19e !default;
|
|
34
|
-
$--color-danger-light: #fbc4c4 !default;
|
|
35
|
-
$--color-info-light: #c8c9cc !default;
|
|
36
|
-
|
|
37
|
-
$--color-success-lighter: #d9f2be !default;
|
|
38
|
-
$--color-warning-lighter: #f9e8cf !default;
|
|
39
|
-
$--color-danger-lighter: #fde2e2 !default;
|
|
40
|
-
$--color-info-lighter: #e4e5e6 !default;
|
|
41
|
-
|
|
42
|
-
// ===== 文字颜色 =====
|
|
43
|
-
$--color-text-primary: #303133 !default;
|
|
44
|
-
$--color-text-regular: #606266 !default;
|
|
45
|
-
$--color-text-secondary: #909399 !default;
|
|
46
|
-
$--color-text-placeholder: #c0c4cc !default;
|
|
47
|
-
|
|
48
|
-
// ===== 边框颜色 =====
|
|
49
|
-
$--border-color-base: #dcdfe6 !default;
|
|
50
|
-
$--border-color-light: #e4e7ed !default;
|
|
51
|
-
$--border-color-lighter: #ebeef5 !default;
|
|
52
|
-
$--border-color-extra-light: #f2f6fc !default;
|
|
53
|
-
|
|
54
|
-
// ===== 背景颜色 =====
|
|
55
|
-
$--background-color-base: #f5f7fa !default;
|
|
56
|
-
|
|
57
|
-
// ===== 链接颜色 =====
|
|
58
|
-
$--link-color: $--color-primary-light-2 !default;
|
|
59
|
-
$--link-hover-color: $--color-primary !default;
|
|
60
|
-
|
|
61
|
-
// ===== 边框样式 =====
|
|
62
|
-
$--border-width-base: 1px !default;
|
|
63
|
-
$--border-style-base: solid !default;
|
|
64
|
-
$--border-color-hover: $--color-text-placeholder !default;
|
|
65
|
-
$--border-base: $--border-width-base $--border-style-base $--border-color-base !default;
|
|
66
|
-
|
|
67
|
-
$--border-radius-base: 4px !default;
|
|
68
|
-
$--border-radius-small: 2px !default;
|
|
69
|
-
$--border-radius-circle: 100% !default;
|
|
70
|
-
$--border-radius-zero: 0 !default;
|
|
71
|
-
|
|
72
|
-
// ===== 阴影 =====
|
|
73
|
-
$--box-shadow-base: 0 2px 4px rgba(0, 0, 0, 0.12),
|
|
74
|
-
0 0 6px rgba(0, 0, 0, 0.04) !default;
|
|
75
|
-
$--box-shadow-dark: 0 2px 4px rgba(0, 0, 0, 0.12),
|
|
76
|
-
0 0 6px rgba(0, 0, 0, 0.12) !default;
|
|
77
|
-
$--box-shadow-light: 0 2px 12px 0 rgba(0, 0, 0, 0.1) !default;
|
|
78
|
-
|
|
79
|
-
// ===== 填充 =====
|
|
80
|
-
$--fill-base: $--color-white !default;
|
|
81
|
-
|
|
82
|
-
// ===== 字体 =====
|
|
83
|
-
$--font-path: 'fonts' !default;
|
|
84
|
-
$--font-display: 'auto' !default;
|
|
85
|
-
$--font-size-extra-large: 20px !default;
|
|
86
|
-
$--font-size-large: 18px !default;
|
|
87
|
-
$--font-size-medium: 16px !default;
|
|
88
|
-
$--font-size-base: 14px !default;
|
|
89
|
-
$--font-size-small: 13px !default;
|
|
90
|
-
$--font-size-extra-small: 12px !default;
|
|
91
|
-
$--font-weight-primary: 500 !default;
|
|
92
|
-
$--font-weight-secondary: 100 !default;
|
|
93
|
-
$--font-line-height-primary: 24px !default;
|
|
94
|
-
$--font-line-height-secondary: 16px !default;
|
|
95
|
-
$--font-color-disabled-base: #bbb !default;
|
|
96
|
-
|
|
97
|
-
// ===== 尺寸 =====
|
|
98
|
-
$--size-base: 14px !default;
|
|
99
|
-
|
|
100
|
-
// ===== 层级 =====
|
|
101
|
-
$--index-normal: 1 !default;
|
|
102
|
-
$--index-top: 1000 !default;
|
|
103
|
-
$--index-popper: 2000 !default;
|
|
104
|
-
|
|
105
|
-
// ===== 禁用状态 =====
|
|
106
|
-
$--disabled-fill-base: $--background-color-base !default;
|
|
107
|
-
$--disabled-color-base: $--color-text-placeholder !default;
|
|
108
|
-
$--disabled-border-base: $--border-color-light !default;
|
|
109
|
-
|
|
110
|
-
// ===== 图标 =====
|
|
111
|
-
$--icon-color: #666 !default;
|
|
112
|
-
$--icon-color-base: $--color-info !default;
|
|
113
|
-
|
|
114
|
-
// ===== 消息背景色 =====
|
|
115
|
-
$--message-background-color: #edf2fc !default;
|
|
116
|
-
|
|
117
|
-
// ===== CSS 变量定义 =====
|
|
118
|
-
:root {
|
|
119
|
-
--color-primary: #{$--color-primary};
|
|
120
|
-
--color-success: #{$--color-success};
|
|
121
|
-
--color-warning: #{$--color-warning};
|
|
122
|
-
--color-danger: #{$--color-danger};
|
|
123
|
-
--color-info: #{$--color-info};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// ===== Element UI X 扩展变量 =====
|
|
127
|
-
$--el-x-color-primary: $--color-primary;
|
|
128
|
-
$--el-x-color-success: $--color-success;
|
|
129
|
-
|
|
130
|
-
// 字体大小
|
|
131
|
-
$--el-x-font-size-small: $--font-size-small !default;
|
|
132
|
-
$--el-x-font-size-base: $--font-size-base !default;
|
|
133
|
-
$--el-x-font-size-medium: $--font-size-medium !default;
|
|
134
|
-
$--el-x-font-size-large: $--font-size-large !default;
|
|
135
|
-
$--el-x-font-size-extra-large: $--font-size-extra-large !default;
|
|
136
|
-
|
|
137
|
-
// 字体颜色
|
|
138
|
-
$--el-x-text-color-primary: $--color-text-primary !default;
|
|
139
|
-
$--el-x-text-color-regular: $--color-text-regular !default;
|
|
140
|
-
$--el-x-text-color-secondary: $--color-text-secondary !default;
|
|
141
|
-
$--el-x-text-color-placeholder: $--color-text-placeholder !default;
|
|
142
|
-
$--el-x-text-color-disabled: $--color-text-placeholder !default;
|
|
143
|
-
|
|
144
|
-
// 行高
|
|
145
|
-
$--el-x-font-line-height-primary: $--font-line-height-primary;
|
|
146
|
-
|
|
147
|
-
// 填充背景
|
|
148
|
-
$--el-x-fill-color: $--message-background-color;
|
|
149
|
-
|
|
150
|
-
// 边框
|
|
151
|
-
$--el-x-border-radius-base: $--border-radius-base;
|
|
152
|
-
$--el-x-border-radius-md: 8px;
|
|
153
|
-
$--el-x-border-radius-round: 20px;
|
|
154
|
-
$--el-x-border-radius-small: $--border-radius-small;
|
|
155
|
-
$--el-x-border-radius-circle: $--border-radius-circle;
|
|
156
|
-
|
|
157
|
-
// 间距
|
|
158
|
-
$--el-x-spacing-xs: 4px !default;
|
|
159
|
-
$--el-x-spacing-sm: 8px !default;
|
|
160
|
-
$--el-x-spacing-md: 12px !default;
|
|
161
|
-
$--el-x-spacing-lg: 16px !default;
|
|
162
|
-
$--el-x-spacing-xl: 20px !default;
|
|
163
|
-
|
|
164
|
-
// 内边距
|
|
165
|
-
$--el-x-padding-xs: 4px !default;
|
|
166
|
-
$--el-x-padding-sm: 8px !default;
|
|
167
|
-
$--el-x-padding-md: 12px !default;
|
|
168
|
-
$--el-x-padding-lg: $--font-size-large !default;
|
|
169
|
-
$--el-x-padding-xl: $--font-size-extra-large !default;
|
|
170
|
-
|
|
171
|
-
// 边框颜色
|
|
172
|
-
$--el-x-border-color: $--border-color-base;
|
|
173
|
-
|
|
174
|
-
// 边框宽度
|
|
175
|
-
$--el-x-border-width: $--border-width-base;
|
|
176
|
-
|
|
177
|
-
// 阴影
|
|
178
|
-
$--el-x-box-shadow-base: $--box-shadow-base;
|
|
179
|
-
|
|
180
|
-
// 边框半径
|
|
181
|
-
$--el-x-border-radius-sm: 2px !default;
|
|
182
|
-
$--el-x-border-radius-md: $--border-radius-base !default;
|
|
183
|
-
$--el-x-border-radius-lg: 8px !default;
|
package/src/utils/index.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 判断文件类型是否为图片
|
|
3
|
-
* @param {string} type 文件类型
|
|
4
|
-
* @returns {boolean} 是否为图片类型
|
|
5
|
-
*/
|
|
6
|
-
export const isImageFileType = type => type.indexOf('image/') === 0;
|
|
7
|
-
|
|
8
|
-
const MEASURE_SIZE = 200;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 预览图片文件并生成预览URL
|
|
12
|
-
* @param {File|Blob} file 图片文件对象
|
|
13
|
-
* @returns {Promise<string>} 返回图片预览URL的Promise
|
|
14
|
-
*/
|
|
15
|
-
export function previewImage(file) {
|
|
16
|
-
return new Promise(resolve => {
|
|
17
|
-
if (!file || !file.type || !isImageFileType(file.type)) {
|
|
18
|
-
resolve('');
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const img = new Image();
|
|
23
|
-
img.onload = () => {
|
|
24
|
-
const { width, height } = img;
|
|
25
|
-
|
|
26
|
-
const ratio = width / height;
|
|
27
|
-
const MEASURE_SIZE_WIDTH = ratio > 1 ? MEASURE_SIZE : MEASURE_SIZE * ratio;
|
|
28
|
-
const MEASURE_SIZE_HEIGHT = ratio > 1 ? MEASURE_SIZE / ratio : MEASURE_SIZE;
|
|
29
|
-
|
|
30
|
-
const canvas = document.createElement('canvas');
|
|
31
|
-
canvas.width = MEASURE_SIZE_WIDTH;
|
|
32
|
-
canvas.height = MEASURE_SIZE_HEIGHT;
|
|
33
|
-
canvas.style.cssText = `position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE_WIDTH}px; height: ${MEASURE_SIZE_HEIGHT}px; z-index: 9999; display: none;`;
|
|
34
|
-
document.body.appendChild(canvas);
|
|
35
|
-
const ctx = canvas.getContext('2d');
|
|
36
|
-
|
|
37
|
-
ctx.drawImage(img, 0, 0, MEASURE_SIZE_WIDTH, MEASURE_SIZE_HEIGHT);
|
|
38
|
-
const dataURL = canvas.toDataURL();
|
|
39
|
-
document.body.removeChild(canvas);
|
|
40
|
-
window.URL.revokeObjectURL(img.src);
|
|
41
|
-
resolve(dataURL);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
img.crossOrigin = 'anonymous';
|
|
45
|
-
if (file.type.startsWith('image/svg+xml')) {
|
|
46
|
-
const reader = new FileReader();
|
|
47
|
-
reader.onload = () => {
|
|
48
|
-
if (reader.result && typeof reader.result === 'string') {
|
|
49
|
-
img.src = reader.result;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
reader.readAsDataURL(file);
|
|
53
|
-
} else if (file.type.startsWith('image/gif')) {
|
|
54
|
-
const reader = new FileReader();
|
|
55
|
-
reader.onload = () => {
|
|
56
|
-
if (reader.result) {
|
|
57
|
-
resolve(reader.result);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
reader.readAsDataURL(file);
|
|
61
|
-
} else {
|
|
62
|
-
img.src = window.URL.createObjectURL(file);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 根据文件后缀名获取文件类型
|
|
69
|
-
* @param {string} fileExtension 文件后缀名
|
|
70
|
-
* @returns {{lowerCase: string, upperCase: string}} 返回文件类型对象
|
|
71
|
-
*/
|
|
72
|
-
export function getFileType(fileExtension) {
|
|
73
|
-
// 去除后缀名开头的点,并转换为小写
|
|
74
|
-
const cleanExtension = fileExtension.replace('.', '').toLowerCase();
|
|
75
|
-
if (!cleanExtension) {
|
|
76
|
-
return {
|
|
77
|
-
lowerCase: 'unknown',
|
|
78
|
-
upperCase: 'Unknown',
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const imageExtensions = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg', 'webp'];
|
|
83
|
-
const wordExtensions = ['doc', 'docx'];
|
|
84
|
-
const excelExtensions = ['xls', 'xlsx'];
|
|
85
|
-
const pptExtensions = ['ppt', 'pptx'];
|
|
86
|
-
const audioExtensions = ['mp3', 'wav', 'ogg', 'flac'];
|
|
87
|
-
const videoExtensions = ['mp4', 'avi', 'mov', 'mkv'];
|
|
88
|
-
const codeExtensions = ['js', 'ts', 'html', 'css', 'py', 'java', 'c', 'cpp', 'json', 'php'];
|
|
89
|
-
const databaseExtensions = ['sql', 'db', 'sqlite'];
|
|
90
|
-
const zipExtensions = ['zip', 'rar', '7z'];
|
|
91
|
-
const markExtensions = ['md', 'mdx'];
|
|
92
|
-
|
|
93
|
-
if (imageExtensions.includes(cleanExtension)) {
|
|
94
|
-
return {
|
|
95
|
-
lowerCase: 'image',
|
|
96
|
-
upperCase: 'Image',
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
if (wordExtensions.includes(cleanExtension)) {
|
|
100
|
-
return {
|
|
101
|
-
lowerCase: 'word',
|
|
102
|
-
upperCase: 'Word',
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
if (excelExtensions.includes(cleanExtension)) {
|
|
106
|
-
return {
|
|
107
|
-
lowerCase: 'excel',
|
|
108
|
-
upperCase: 'Excel',
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
if (pptExtensions.includes(cleanExtension)) {
|
|
112
|
-
return {
|
|
113
|
-
lowerCase: 'ppt',
|
|
114
|
-
upperCase: 'Ppt',
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
if (cleanExtension === 'pdf') {
|
|
118
|
-
return {
|
|
119
|
-
lowerCase: 'pdf',
|
|
120
|
-
upperCase: 'Pdf',
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
if (cleanExtension === 'txt') {
|
|
124
|
-
return {
|
|
125
|
-
lowerCase: 'txt',
|
|
126
|
-
upperCase: 'Txt',
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
if (markExtensions.includes(cleanExtension)) {
|
|
130
|
-
return {
|
|
131
|
-
lowerCase: 'mark',
|
|
132
|
-
upperCase: 'Markdown',
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
if (audioExtensions.includes(cleanExtension)) {
|
|
136
|
-
return {
|
|
137
|
-
lowerCase: 'audio',
|
|
138
|
-
upperCase: 'Audio',
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
if (videoExtensions.includes(cleanExtension)) {
|
|
142
|
-
return {
|
|
143
|
-
lowerCase: 'video',
|
|
144
|
-
upperCase: 'Video',
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
if (codeExtensions.includes(cleanExtension)) {
|
|
148
|
-
return {
|
|
149
|
-
lowerCase: 'code',
|
|
150
|
-
upperCase: 'Code',
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
if (databaseExtensions.includes(cleanExtension)) {
|
|
154
|
-
return {
|
|
155
|
-
lowerCase: 'database',
|
|
156
|
-
upperCase: 'Database',
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
if (cleanExtension === 'lnk') {
|
|
160
|
-
return {
|
|
161
|
-
lowerCase: 'link',
|
|
162
|
-
upperCase: 'Link',
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
if (zipExtensions.includes(cleanExtension)) {
|
|
166
|
-
return {
|
|
167
|
-
lowerCase: 'zip',
|
|
168
|
-
upperCase: 'Zip',
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
if (cleanExtension === 'obj' || cleanExtension === 'fbx' || cleanExtension === 'glb') {
|
|
172
|
-
return {
|
|
173
|
-
lowerCase: 'three',
|
|
174
|
-
upperCase: '3D',
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
return {
|
|
178
|
-
lowerCase: 'file',
|
|
179
|
-
upperCase: 'File',
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* 获取文件大小
|
|
185
|
-
* @param {number} size 文件大小
|
|
186
|
-
* @returns {string} 返回文件大小
|
|
187
|
-
*/
|
|
188
|
-
export function getSize(size) {
|
|
189
|
-
let retSize = size;
|
|
190
|
-
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
|
|
191
|
-
let unitIndex = 0;
|
|
192
|
-
|
|
193
|
-
while (retSize >= 1024 && unitIndex < units.length - 1) {
|
|
194
|
-
retSize /= 1024;
|
|
195
|
-
unitIndex++;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return `${retSize.toFixed(0)} ${units[unitIndex]}`;
|
|
199
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export default function createScrollDetector(elementRef) {
|
|
2
|
-
const state = {
|
|
3
|
-
hasVertical: false,
|
|
4
|
-
hasHorizontal: false,
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const check = () => {
|
|
8
|
-
const el = elementRef.value || elementRef;
|
|
9
|
-
if (!el) return;
|
|
10
|
-
state.hasVertical = el.scrollHeight > el.clientHeight;
|
|
11
|
-
state.hasHorizontal = el.scrollWidth > el.clientWidth;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
let observer = null;
|
|
15
|
-
|
|
16
|
-
const init = () => {
|
|
17
|
-
check();
|
|
18
|
-
observer = new ResizeObserver(check);
|
|
19
|
-
observer.observe(elementRef.value || elementRef);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const destroy = () => {
|
|
23
|
-
if (observer) {
|
|
24
|
-
observer.disconnect();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
state, // 包含hasVertical和hasHorizontal状态
|
|
30
|
-
check, // 检查滚动条状态
|
|
31
|
-
init, // 初始化监听
|
|
32
|
-
destroy, // 销毁监听
|
|
33
|
-
};
|
|
34
|
-
}
|