vue-element-ui-x 0.1.7-beta → 0.1.9-beta
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/Attachments/index.js +229 -237
- package/lib/components/Conversations/index.js +13 -13
- package/lib/components/FilesCard/index.js +207 -211
- package/lib/components/Sender/index.js +15 -15
- package/lib/components/Thinking/index.js +11 -11
- package/lib/components/ThoughtChain/index.js +14 -14
- package/lib/index.common.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +282 -290
- package/lib/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/Attachments/src/main.vue +10 -10
- package/src/components/Conversations/src/main.vue +636 -635
- package/src/components/FilesCard/src/main.vue +4 -8
- package/src/components/Sender/src/main.vue +4 -3
- package/src/components/Thinking/src/main.vue +195 -195
- package/src/components/ThoughtChain/src/main.vue +293 -293
- package/src/styles/Thinking.scss +112 -112
- package/lib/attachments.js +0 -3082
- package/lib/bubble-list.js +0 -13840
- package/lib/bubble.js +0 -13125
- package/lib/conversations.js +0 -18825
- package/lib/files-card.js +0 -2471
- package/lib/mixins.js +0 -1016
- package/lib/prompts.js +0 -832
- package/lib/sender.js +0 -1911
- package/lib/think.js +0 -799
- package/lib/thinking.js +0 -809
- package/lib/thought-chain.js +0 -30391
- package/lib/typewriter.js +0 -12788
- package/lib/welcome.js +0 -755
|
@@ -17830,7 +17830,7 @@ ___CSS_LOADER_EXPORT___.push([module.i, ".el-x-conversations-container{display:f
|
|
|
17830
17830
|
// ESM COMPAT FLAG
|
|
17831
17831
|
__webpack_require__.r(__webpack_exports__);
|
|
17832
17832
|
|
|
17833
|
-
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Conversations/src/main.vue?vue&type=template&id=
|
|
17833
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Conversations/src/main.vue?vue&type=template&id=8c14ca04
|
|
17834
17834
|
var render = function render() {
|
|
17835
17835
|
var _vm = this,
|
|
17836
17836
|
_c = _vm._self._c;
|
|
@@ -17864,8 +17864,8 @@ var render = function render() {
|
|
|
17864
17864
|
class: {
|
|
17865
17865
|
"active-sticky": _vm.stickyGroupKeys.has(group.key)
|
|
17866
17866
|
}
|
|
17867
|
-
}, [_vm._t("
|
|
17868
|
-
return [_vm._v(_vm._s(group.title))];
|
|
17867
|
+
}, [_vm._t("group-title", function () {
|
|
17868
|
+
return [_vm._v("\n " + _vm._s(group.title) + "\n ")];
|
|
17869
17869
|
}, {
|
|
17870
17870
|
group: group
|
|
17871
17871
|
})], 2), _vm._v(" "), _c("div", {
|
|
@@ -18013,7 +18013,10 @@ var render = function render() {
|
|
|
18013
18013
|
var staticRenderFns = [];
|
|
18014
18014
|
render._withStripped = true;
|
|
18015
18015
|
|
|
18016
|
-
// CONCATENATED MODULE: ./src/components/Conversations/src/main.vue?vue&type=template&id=
|
|
18016
|
+
// CONCATENATED MODULE: ./src/components/Conversations/src/main.vue?vue&type=template&id=8c14ca04
|
|
18017
|
+
|
|
18018
|
+
// EXTERNAL MODULE: ./node_modules/lodash/lodash.js
|
|
18019
|
+
var lodash = __webpack_require__(6);
|
|
18017
18020
|
|
|
18018
18021
|
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Conversations/src/components/item.vue?vue&type=template&id=7f512f4a
|
|
18019
18022
|
var itemvue_type_template_id_7f512f4a_render = function render() {
|
|
@@ -18386,9 +18389,6 @@ var component = Object(componentNormalizer["a" /* default */])(
|
|
|
18386
18389
|
)
|
|
18387
18390
|
|
|
18388
18391
|
/* harmony default export */ var components_item = (component.exports);
|
|
18389
|
-
// EXTERNAL MODULE: ./node_modules/lodash/lodash.js
|
|
18390
|
-
var lodash = __webpack_require__(6);
|
|
18391
|
-
|
|
18392
18392
|
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Conversations/src/main.vue?vue&type=script&lang=js
|
|
18393
18393
|
|
|
18394
18394
|
|
|
@@ -18763,10 +18763,10 @@ var lodash = __webpack_require__(6);
|
|
|
18763
18763
|
var injectStylesIntoStyleTag = __webpack_require__(3);
|
|
18764
18764
|
var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
|
|
18765
18765
|
|
|
18766
|
-
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Conversations/src/main.vue?vue&type=style&index=0&id=
|
|
18767
|
-
var
|
|
18766
|
+
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Conversations/src/main.vue?vue&type=style&index=0&id=8c14ca04&prod&lang=scss
|
|
18767
|
+
var mainvue_type_style_index_0_id_8c14ca04_prod_lang_scss = __webpack_require__(87);
|
|
18768
18768
|
|
|
18769
|
-
// CONCATENATED MODULE: ./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Conversations/src/main.vue?vue&type=style&index=0&id=
|
|
18769
|
+
// CONCATENATED MODULE: ./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Conversations/src/main.vue?vue&type=style&index=0&id=8c14ca04&prod&lang=scss
|
|
18770
18770
|
|
|
18771
18771
|
|
|
18772
18772
|
|
|
@@ -18775,12 +18775,12 @@ var options = {};
|
|
|
18775
18775
|
options.insert = "head";
|
|
18776
18776
|
options.singleton = false;
|
|
18777
18777
|
|
|
18778
|
-
var update = injectStylesIntoStyleTag_default()(
|
|
18778
|
+
var update = injectStylesIntoStyleTag_default()(mainvue_type_style_index_0_id_8c14ca04_prod_lang_scss["a" /* default */], options);
|
|
18779
18779
|
|
|
18780
18780
|
|
|
18781
18781
|
|
|
18782
|
-
/* harmony default export */ var
|
|
18783
|
-
// CONCATENATED MODULE: ./src/components/Conversations/src/main.vue?vue&type=style&index=0&id=
|
|
18782
|
+
/* harmony default export */ var src_mainvue_type_style_index_0_id_8c14ca04_prod_lang_scss = (mainvue_type_style_index_0_id_8c14ca04_prod_lang_scss["a" /* default */].locals || {});
|
|
18783
|
+
// CONCATENATED MODULE: ./src/components/Conversations/src/main.vue?vue&type=style&index=0&id=8c14ca04&prod&lang=scss
|
|
18784
18784
|
|
|
18785
18785
|
// CONCATENATED MODULE: ./src/components/Conversations/src/main.vue
|
|
18786
18786
|
|
|
@@ -275,7 +275,7 @@ module.exports = function (cssWithMappingToString) {
|
|
|
275
275
|
|
|
276
276
|
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
|
|
277
277
|
// Module
|
|
278
|
-
___CSS_LOADER_EXPORT___.push([module.i, ".el-x-filescard[data-v-
|
|
278
|
+
___CSS_LOADER_EXPORT___.push([module.i, ".el-x-filescard[data-v-28b3b638]{width:fit-content;padding:12px;display:flex;flex-wrap:nowrap;gap:8px;align-items:center;border-radius:8px;position:relative;background:rgba(0,0,0,.06);max-width:var(--elx-files-card-max-width)}.el-x-filescard .el-x-filescard-progress[data-v-28b3b638]{position:absolute;top:0;left:0;bottom:0;background:rgba(0,0,0,.08);border-radius:8px;transition:width .2s ease}.el-x-filescard .el-x-filescard-delete-icon[data-v-28b3b638]{position:absolute;top:-8px;right:-6px;cursor:pointer;color:rgba(0,0,0,.4);display:none}.el-x-filescard .el-x-filescard-delete-icon[data-v-28b3b638]:hover{color:#ff4d4f}.el-x-filescard:hover .el-x-filescard-delete-icon[data-v-28b3b638]{display:block}.el-x-filescard-square[data-v-28b3b638]{padding:0;margin:0}.el-x-filescard-icon[data-v-28b3b638]{flex:none;font-size:var(--elx-files-card-icon-size)}.el-x-filescard-img[data-v-28b3b638]{flex:none;width:var(--elx-files-card-icon-size);height:var(--elx-files-card-icon-size);border-radius:8px;object-fit:cover}.el-x-filescard-content[data-v-28b3b638]{flex:auto;min-width:0;display:flex;flex-direction:column;align-items:stretch;justify-content:space-between;height:100%}.el-x-filescard-content .el-x-filescard-name[data-v-28b3b638]{display:flex;flex-wrap:nowrap;max-width:100%;font-size:14px}.el-x-filescard-content .el-x-filescard-name .el-x-filescard-name-prefix[data-v-28b3b638]{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-x-filescard-content .el-x-filescard-name .el-x-filescard-name-suffix[data-v-28b3b638]{flex:none}.el-x-filescard-content .el-x-filescard-description[data-v-28b3b638]{flex:none;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:rgba(0,0,0,.4);font-size:12px}.el-x-filescard-content .el-x-filescard-description-error[data-v-28b3b638]{color:#ff4d4f}.image-preview-container[data-v-28b3b638]{position:relative;padding:0px;width:var(--elx-files-card-icon-size);height:var(--elx-files-card-icon-size);display:inline-block;border-radius:8px;overflow:hidden;transition:all .3s}.image-preview-container .preview-mask[data-v-28b3b638]{position:absolute;inset:0;width:100%;display:flex;justify-content:center;align-items:center;opacity:0;background:rgba(0,0,0,.65);color:#fff;font-size:10px;transition:opacity .3s}.image-preview-container .preview-mask .el-icon-view[data-v-28b3b638]{font-size:10px;margin-right:2px;display:flex;align-items:center;height:100%;margin-top:2px}.image-preview-container .preview-mask[data-v-28b3b638]:hover{opacity:1;transition:opacity .3s;cursor:pointer}.image-preview-container-square .preview-mask[data-v-28b3b638]{font-size:14px}.image-preview-container-square .preview-mask .el-icon-view[data-v-28b3b638]{font-size:12px}.preview-mask-loading[data-v-28b3b638]{position:absolute;inset:0;width:100%;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,.65);color:#fff;transition:all .3s}.preview-mask-loading .circle-progress[data-v-28b3b638]{width:100% !important;height:100% !important;display:flex;justify-content:center;align-items:center}.preview-mask-loading .circle-progress .el-progress-circle[data-v-28b3b638]{width:calc(100% - 12px) !important;height:calc(100% - 12px) !important}.preview-mask-loading .circle-progress .el-progress-circle svg>path[data-v-28b3b638]:nth-child(1){stroke:hsla(0,0%,100%,.2);stroke-width:8px}.preview-mask-loading .circle-progress .el-progress__text[data-v-28b3b638]{color:#fff;font-size:14px}.preview-mask-error[data-v-28b3b638]{position:absolute;inset:0;width:100%;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,.5);font-size:12px;transition:all .3s;color:#ff4d4f;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-image-viewer__progress[data-v-28b3b638]{display:none}.fade-enter-active[data-v-28b3b638],.fade-leave-active[data-v-28b3b638]{transition:opacity .3s}.fade-enter-from[data-v-28b3b638],.fade-leave-to[data-v-28b3b638]{opacity:0}", ""]);
|
|
279
279
|
// Exports
|
|
280
280
|
/* harmony default export */ __webpack_exports__["a"] = (___CSS_LOADER_EXPORT___);
|
|
281
281
|
|
|
@@ -289,7 +289,7 @@ ___CSS_LOADER_EXPORT___.push([module.i, ".el-x-filescard[data-v-10b2c201]{width:
|
|
|
289
289
|
// ESM COMPAT FLAG
|
|
290
290
|
__webpack_require__.r(__webpack_exports__);
|
|
291
291
|
|
|
292
|
-
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FilesCard/src/main.vue?vue&type=template&id=
|
|
292
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FilesCard/src/main.vue?vue&type=template&id=28b3b638&scoped=true
|
|
293
293
|
var render = function render() {
|
|
294
294
|
var _vm = this,
|
|
295
295
|
_c = _vm._self._c;
|
|
@@ -346,13 +346,11 @@ var render = function render() {
|
|
|
346
346
|
staticClass: "el-x-filescard-img",
|
|
347
347
|
attrs: {
|
|
348
348
|
src: _vm._previewImgUrl,
|
|
349
|
-
"preview-src-list": _vm.
|
|
350
|
-
fit: "cover"
|
|
351
|
-
"show-progress": false,
|
|
352
|
-
"hide-on-click-modal": ""
|
|
349
|
+
"preview-src-list": _vm._previewImgUrl ? [_vm._previewImgUrl] : [],
|
|
350
|
+
fit: "cover"
|
|
353
351
|
},
|
|
354
352
|
on: {
|
|
355
|
-
|
|
353
|
+
click: function ($event) {
|
|
356
354
|
return _vm.handlePreviewAction("self");
|
|
357
355
|
}
|
|
358
356
|
}
|
|
@@ -458,8 +456,201 @@ var render = function render() {
|
|
|
458
456
|
var staticRenderFns = [];
|
|
459
457
|
render._withStripped = true;
|
|
460
458
|
|
|
461
|
-
// CONCATENATED MODULE: ./src/components/FilesCard/src/main.vue?vue&type=template&id=
|
|
459
|
+
// CONCATENATED MODULE: ./src/components/FilesCard/src/main.vue?vue&type=template&id=28b3b638&scoped=true
|
|
462
460
|
|
|
461
|
+
// CONCATENATED MODULE: ./src/utils/index.js
|
|
462
|
+
/**
|
|
463
|
+
* 判断文件类型是否为图片
|
|
464
|
+
* @param {string} type 文件类型
|
|
465
|
+
* @returns {boolean} 是否为图片类型
|
|
466
|
+
*/
|
|
467
|
+
const isImageFileType = type => type.indexOf('image/') === 0;
|
|
468
|
+
const MEASURE_SIZE = 200;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* 预览图片文件并生成预览URL
|
|
472
|
+
* @param {File|Blob} file 图片文件对象
|
|
473
|
+
* @returns {Promise<string>} 返回图片预览URL的Promise
|
|
474
|
+
*/
|
|
475
|
+
function previewImage(file) {
|
|
476
|
+
return new Promise(resolve => {
|
|
477
|
+
if (!file || !file.type || !isImageFileType(file.type)) {
|
|
478
|
+
resolve('');
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
const img = new Image();
|
|
482
|
+
img.onload = () => {
|
|
483
|
+
const {
|
|
484
|
+
width,
|
|
485
|
+
height
|
|
486
|
+
} = img;
|
|
487
|
+
const ratio = width / height;
|
|
488
|
+
const MEASURE_SIZE_WIDTH = ratio > 1 ? MEASURE_SIZE : MEASURE_SIZE * ratio;
|
|
489
|
+
const MEASURE_SIZE_HEIGHT = ratio > 1 ? MEASURE_SIZE / ratio : MEASURE_SIZE;
|
|
490
|
+
const canvas = document.createElement('canvas');
|
|
491
|
+
canvas.width = MEASURE_SIZE_WIDTH;
|
|
492
|
+
canvas.height = MEASURE_SIZE_HEIGHT;
|
|
493
|
+
canvas.style.cssText = `position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE_WIDTH}px; height: ${MEASURE_SIZE_HEIGHT}px; z-index: 9999; display: none;`;
|
|
494
|
+
document.body.appendChild(canvas);
|
|
495
|
+
const ctx = canvas.getContext('2d');
|
|
496
|
+
ctx.drawImage(img, 0, 0, MEASURE_SIZE_WIDTH, MEASURE_SIZE_HEIGHT);
|
|
497
|
+
const dataURL = canvas.toDataURL();
|
|
498
|
+
document.body.removeChild(canvas);
|
|
499
|
+
window.URL.revokeObjectURL(img.src);
|
|
500
|
+
resolve(dataURL);
|
|
501
|
+
};
|
|
502
|
+
img.crossOrigin = 'anonymous';
|
|
503
|
+
if (file.type.startsWith('image/svg+xml')) {
|
|
504
|
+
const reader = new FileReader();
|
|
505
|
+
reader.onload = () => {
|
|
506
|
+
if (reader.result && typeof reader.result === 'string') {
|
|
507
|
+
img.src = reader.result;
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
reader.readAsDataURL(file);
|
|
511
|
+
} else if (file.type.startsWith('image/gif')) {
|
|
512
|
+
const reader = new FileReader();
|
|
513
|
+
reader.onload = () => {
|
|
514
|
+
if (reader.result) {
|
|
515
|
+
resolve(reader.result);
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
reader.readAsDataURL(file);
|
|
519
|
+
} else {
|
|
520
|
+
img.src = window.URL.createObjectURL(file);
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* 根据文件后缀名获取文件类型
|
|
527
|
+
* @param {string} fileExtension 文件后缀名
|
|
528
|
+
* @returns {{lowerCase: string, upperCase: string}} 返回文件类型对象
|
|
529
|
+
*/
|
|
530
|
+
function getFileType(fileExtension) {
|
|
531
|
+
// 去除后缀名开头的点,并转换为小写
|
|
532
|
+
const cleanExtension = fileExtension.replace('.', '').toLowerCase();
|
|
533
|
+
if (!cleanExtension) {
|
|
534
|
+
return {
|
|
535
|
+
lowerCase: 'unknown',
|
|
536
|
+
upperCase: 'Unknown'
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
const imageExtensions = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg', 'webp'];
|
|
540
|
+
const wordExtensions = ['doc', 'docx'];
|
|
541
|
+
const excelExtensions = ['xls', 'xlsx'];
|
|
542
|
+
const pptExtensions = ['ppt', 'pptx'];
|
|
543
|
+
const audioExtensions = ['mp3', 'wav', 'ogg', 'flac'];
|
|
544
|
+
const videoExtensions = ['mp4', 'avi', 'mov', 'mkv'];
|
|
545
|
+
const codeExtensions = ['js', 'ts', 'html', 'css', 'py', 'java', 'c', 'cpp', 'json', 'php'];
|
|
546
|
+
const databaseExtensions = ['sql', 'db', 'sqlite'];
|
|
547
|
+
const zipExtensions = ['zip', 'rar', '7z'];
|
|
548
|
+
const markExtensions = ['md', 'mdx'];
|
|
549
|
+
if (imageExtensions.includes(cleanExtension)) {
|
|
550
|
+
return {
|
|
551
|
+
lowerCase: 'image',
|
|
552
|
+
upperCase: 'Image'
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
if (wordExtensions.includes(cleanExtension)) {
|
|
556
|
+
return {
|
|
557
|
+
lowerCase: 'word',
|
|
558
|
+
upperCase: 'Word'
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
if (excelExtensions.includes(cleanExtension)) {
|
|
562
|
+
return {
|
|
563
|
+
lowerCase: 'excel',
|
|
564
|
+
upperCase: 'Excel'
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
if (pptExtensions.includes(cleanExtension)) {
|
|
568
|
+
return {
|
|
569
|
+
lowerCase: 'ppt',
|
|
570
|
+
upperCase: 'Ppt'
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
if (cleanExtension === 'pdf') {
|
|
574
|
+
return {
|
|
575
|
+
lowerCase: 'pdf',
|
|
576
|
+
upperCase: 'Pdf'
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
if (cleanExtension === 'txt') {
|
|
580
|
+
return {
|
|
581
|
+
lowerCase: 'txt',
|
|
582
|
+
upperCase: 'Txt'
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
if (markExtensions.includes(cleanExtension)) {
|
|
586
|
+
return {
|
|
587
|
+
lowerCase: 'mark',
|
|
588
|
+
upperCase: 'Markdown'
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
if (audioExtensions.includes(cleanExtension)) {
|
|
592
|
+
return {
|
|
593
|
+
lowerCase: 'audio',
|
|
594
|
+
upperCase: 'Audio'
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
if (videoExtensions.includes(cleanExtension)) {
|
|
598
|
+
return {
|
|
599
|
+
lowerCase: 'video',
|
|
600
|
+
upperCase: 'Video'
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
if (codeExtensions.includes(cleanExtension)) {
|
|
604
|
+
return {
|
|
605
|
+
lowerCase: 'code',
|
|
606
|
+
upperCase: 'Code'
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
if (databaseExtensions.includes(cleanExtension)) {
|
|
610
|
+
return {
|
|
611
|
+
lowerCase: 'database',
|
|
612
|
+
upperCase: 'Database'
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
if (cleanExtension === 'lnk') {
|
|
616
|
+
return {
|
|
617
|
+
lowerCase: 'link',
|
|
618
|
+
upperCase: 'Link'
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
if (zipExtensions.includes(cleanExtension)) {
|
|
622
|
+
return {
|
|
623
|
+
lowerCase: 'zip',
|
|
624
|
+
upperCase: 'Zip'
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
if (cleanExtension === 'obj' || cleanExtension === 'fbx' || cleanExtension === 'glb') {
|
|
628
|
+
return {
|
|
629
|
+
lowerCase: 'three',
|
|
630
|
+
upperCase: '3D'
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
return {
|
|
634
|
+
lowerCase: 'file',
|
|
635
|
+
upperCase: 'File'
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* 获取文件大小
|
|
641
|
+
* @param {number} size 文件大小
|
|
642
|
+
* @returns {string} 返回文件大小
|
|
643
|
+
*/
|
|
644
|
+
function getSize(size) {
|
|
645
|
+
let retSize = size;
|
|
646
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
|
|
647
|
+
let unitIndex = 0;
|
|
648
|
+
while (retSize >= 1024 && unitIndex < units.length - 1) {
|
|
649
|
+
retSize /= 1024;
|
|
650
|
+
unitIndex++;
|
|
651
|
+
}
|
|
652
|
+
return `${retSize.toFixed(0)} ${units[unitIndex]}`;
|
|
653
|
+
}
|
|
463
654
|
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FilesCard/src/fileSvg/audio.vue?vue&type=template&id=70981d96
|
|
464
655
|
var audiovue_type_template_id_70981d96_render = function render() {
|
|
465
656
|
var _vm = this,
|
|
@@ -1698,199 +1889,6 @@ const colorMap = {
|
|
|
1698
1889
|
file: '#FFC757',
|
|
1699
1890
|
unknown: '#6E9DA4'
|
|
1700
1891
|
};
|
|
1701
|
-
// CONCATENATED MODULE: ./src/utils/index.js
|
|
1702
|
-
/**
|
|
1703
|
-
* 判断文件类型是否为图片
|
|
1704
|
-
* @param {string} type 文件类型
|
|
1705
|
-
* @returns {boolean} 是否为图片类型
|
|
1706
|
-
*/
|
|
1707
|
-
const isImageFileType = type => type.indexOf('image/') === 0;
|
|
1708
|
-
const MEASURE_SIZE = 200;
|
|
1709
|
-
|
|
1710
|
-
/**
|
|
1711
|
-
* 预览图片文件并生成预览URL
|
|
1712
|
-
* @param {File|Blob} file 图片文件对象
|
|
1713
|
-
* @returns {Promise<string>} 返回图片预览URL的Promise
|
|
1714
|
-
*/
|
|
1715
|
-
function previewImage(file) {
|
|
1716
|
-
return new Promise(resolve => {
|
|
1717
|
-
if (!file || !file.type || !isImageFileType(file.type)) {
|
|
1718
|
-
resolve('');
|
|
1719
|
-
return;
|
|
1720
|
-
}
|
|
1721
|
-
const img = new Image();
|
|
1722
|
-
img.onload = () => {
|
|
1723
|
-
const {
|
|
1724
|
-
width,
|
|
1725
|
-
height
|
|
1726
|
-
} = img;
|
|
1727
|
-
const ratio = width / height;
|
|
1728
|
-
const MEASURE_SIZE_WIDTH = ratio > 1 ? MEASURE_SIZE : MEASURE_SIZE * ratio;
|
|
1729
|
-
const MEASURE_SIZE_HEIGHT = ratio > 1 ? MEASURE_SIZE / ratio : MEASURE_SIZE;
|
|
1730
|
-
const canvas = document.createElement('canvas');
|
|
1731
|
-
canvas.width = MEASURE_SIZE_WIDTH;
|
|
1732
|
-
canvas.height = MEASURE_SIZE_HEIGHT;
|
|
1733
|
-
canvas.style.cssText = `position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE_WIDTH}px; height: ${MEASURE_SIZE_HEIGHT}px; z-index: 9999; display: none;`;
|
|
1734
|
-
document.body.appendChild(canvas);
|
|
1735
|
-
const ctx = canvas.getContext('2d');
|
|
1736
|
-
ctx.drawImage(img, 0, 0, MEASURE_SIZE_WIDTH, MEASURE_SIZE_HEIGHT);
|
|
1737
|
-
const dataURL = canvas.toDataURL();
|
|
1738
|
-
document.body.removeChild(canvas);
|
|
1739
|
-
window.URL.revokeObjectURL(img.src);
|
|
1740
|
-
resolve(dataURL);
|
|
1741
|
-
};
|
|
1742
|
-
img.crossOrigin = 'anonymous';
|
|
1743
|
-
if (file.type.startsWith('image/svg+xml')) {
|
|
1744
|
-
const reader = new FileReader();
|
|
1745
|
-
reader.onload = () => {
|
|
1746
|
-
if (reader.result && typeof reader.result === 'string') {
|
|
1747
|
-
img.src = reader.result;
|
|
1748
|
-
}
|
|
1749
|
-
};
|
|
1750
|
-
reader.readAsDataURL(file);
|
|
1751
|
-
} else if (file.type.startsWith('image/gif')) {
|
|
1752
|
-
const reader = new FileReader();
|
|
1753
|
-
reader.onload = () => {
|
|
1754
|
-
if (reader.result) {
|
|
1755
|
-
resolve(reader.result);
|
|
1756
|
-
}
|
|
1757
|
-
};
|
|
1758
|
-
reader.readAsDataURL(file);
|
|
1759
|
-
} else {
|
|
1760
|
-
img.src = window.URL.createObjectURL(file);
|
|
1761
|
-
}
|
|
1762
|
-
});
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
/**
|
|
1766
|
-
* 根据文件后缀名获取文件类型
|
|
1767
|
-
* @param {string} fileExtension 文件后缀名
|
|
1768
|
-
* @returns {{lowerCase: string, upperCase: string}} 返回文件类型对象
|
|
1769
|
-
*/
|
|
1770
|
-
function getFileType(fileExtension) {
|
|
1771
|
-
// 去除后缀名开头的点,并转换为小写
|
|
1772
|
-
const cleanExtension = fileExtension.replace('.', '').toLowerCase();
|
|
1773
|
-
if (!cleanExtension) {
|
|
1774
|
-
return {
|
|
1775
|
-
lowerCase: 'unknown',
|
|
1776
|
-
upperCase: 'Unknown'
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1779
|
-
const imageExtensions = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg', 'webp'];
|
|
1780
|
-
const wordExtensions = ['doc', 'docx'];
|
|
1781
|
-
const excelExtensions = ['xls', 'xlsx'];
|
|
1782
|
-
const pptExtensions = ['ppt', 'pptx'];
|
|
1783
|
-
const audioExtensions = ['mp3', 'wav', 'ogg', 'flac'];
|
|
1784
|
-
const videoExtensions = ['mp4', 'avi', 'mov', 'mkv'];
|
|
1785
|
-
const codeExtensions = ['js', 'ts', 'html', 'css', 'py', 'java', 'c', 'cpp', 'json', 'php'];
|
|
1786
|
-
const databaseExtensions = ['sql', 'db', 'sqlite'];
|
|
1787
|
-
const zipExtensions = ['zip', 'rar', '7z'];
|
|
1788
|
-
const markExtensions = ['md', 'mdx'];
|
|
1789
|
-
if (imageExtensions.includes(cleanExtension)) {
|
|
1790
|
-
return {
|
|
1791
|
-
lowerCase: 'image',
|
|
1792
|
-
upperCase: 'Image'
|
|
1793
|
-
};
|
|
1794
|
-
}
|
|
1795
|
-
if (wordExtensions.includes(cleanExtension)) {
|
|
1796
|
-
return {
|
|
1797
|
-
lowerCase: 'word',
|
|
1798
|
-
upperCase: 'Word'
|
|
1799
|
-
};
|
|
1800
|
-
}
|
|
1801
|
-
if (excelExtensions.includes(cleanExtension)) {
|
|
1802
|
-
return {
|
|
1803
|
-
lowerCase: 'excel',
|
|
1804
|
-
upperCase: 'Excel'
|
|
1805
|
-
};
|
|
1806
|
-
}
|
|
1807
|
-
if (pptExtensions.includes(cleanExtension)) {
|
|
1808
|
-
return {
|
|
1809
|
-
lowerCase: 'ppt',
|
|
1810
|
-
upperCase: 'Ppt'
|
|
1811
|
-
};
|
|
1812
|
-
}
|
|
1813
|
-
if (cleanExtension === 'pdf') {
|
|
1814
|
-
return {
|
|
1815
|
-
lowerCase: 'pdf',
|
|
1816
|
-
upperCase: 'Pdf'
|
|
1817
|
-
};
|
|
1818
|
-
}
|
|
1819
|
-
if (cleanExtension === 'txt') {
|
|
1820
|
-
return {
|
|
1821
|
-
lowerCase: 'txt',
|
|
1822
|
-
upperCase: 'Txt'
|
|
1823
|
-
};
|
|
1824
|
-
}
|
|
1825
|
-
if (markExtensions.includes(cleanExtension)) {
|
|
1826
|
-
return {
|
|
1827
|
-
lowerCase: 'mark',
|
|
1828
|
-
upperCase: 'Markdown'
|
|
1829
|
-
};
|
|
1830
|
-
}
|
|
1831
|
-
if (audioExtensions.includes(cleanExtension)) {
|
|
1832
|
-
return {
|
|
1833
|
-
lowerCase: 'audio',
|
|
1834
|
-
upperCase: 'Audio'
|
|
1835
|
-
};
|
|
1836
|
-
}
|
|
1837
|
-
if (videoExtensions.includes(cleanExtension)) {
|
|
1838
|
-
return {
|
|
1839
|
-
lowerCase: 'video',
|
|
1840
|
-
upperCase: 'Video'
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
1843
|
-
if (codeExtensions.includes(cleanExtension)) {
|
|
1844
|
-
return {
|
|
1845
|
-
lowerCase: 'code',
|
|
1846
|
-
upperCase: 'Code'
|
|
1847
|
-
};
|
|
1848
|
-
}
|
|
1849
|
-
if (databaseExtensions.includes(cleanExtension)) {
|
|
1850
|
-
return {
|
|
1851
|
-
lowerCase: 'database',
|
|
1852
|
-
upperCase: 'Database'
|
|
1853
|
-
};
|
|
1854
|
-
}
|
|
1855
|
-
if (cleanExtension === 'lnk') {
|
|
1856
|
-
return {
|
|
1857
|
-
lowerCase: 'link',
|
|
1858
|
-
upperCase: 'Link'
|
|
1859
|
-
};
|
|
1860
|
-
}
|
|
1861
|
-
if (zipExtensions.includes(cleanExtension)) {
|
|
1862
|
-
return {
|
|
1863
|
-
lowerCase: 'zip',
|
|
1864
|
-
upperCase: 'Zip'
|
|
1865
|
-
};
|
|
1866
|
-
}
|
|
1867
|
-
if (cleanExtension === 'obj' || cleanExtension === 'fbx' || cleanExtension === 'glb') {
|
|
1868
|
-
return {
|
|
1869
|
-
lowerCase: 'three',
|
|
1870
|
-
upperCase: '3D'
|
|
1871
|
-
};
|
|
1872
|
-
}
|
|
1873
|
-
return {
|
|
1874
|
-
lowerCase: 'file',
|
|
1875
|
-
upperCase: 'File'
|
|
1876
|
-
};
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
/**
|
|
1880
|
-
* 获取文件大小
|
|
1881
|
-
* @param {number} size 文件大小
|
|
1882
|
-
* @returns {string} 返回文件大小
|
|
1883
|
-
*/
|
|
1884
|
-
function getSize(size) {
|
|
1885
|
-
let retSize = size;
|
|
1886
|
-
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
|
|
1887
|
-
let unitIndex = 0;
|
|
1888
|
-
while (retSize >= 1024 && unitIndex < units.length - 1) {
|
|
1889
|
-
retSize /= 1024;
|
|
1890
|
-
unitIndex++;
|
|
1891
|
-
}
|
|
1892
|
-
return `${retSize.toFixed(0)} ${units[unitIndex]}`;
|
|
1893
|
-
}
|
|
1894
1892
|
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FilesCard/src/main.vue?vue&type=script&lang=js
|
|
1895
1893
|
|
|
1896
1894
|
|
|
@@ -2094,12 +2092,10 @@ function getSize(size) {
|
|
|
2094
2092
|
},
|
|
2095
2093
|
handlePreviewAction(type) {
|
|
2096
2094
|
if (this.imgPreview && this.$refs.imgRef && this._previewImgUrl && type === 'mask') {
|
|
2097
|
-
console.log(this.$refs.imgRef);
|
|
2098
2095
|
this.$refs.imgRef.clickHandler();
|
|
2099
|
-
// this.$refs.imgRef.showPreview()
|
|
2100
2096
|
}
|
|
2101
2097
|
if (type === 'self') {
|
|
2102
|
-
this.$emit('
|
|
2098
|
+
this.$emit('image-preview', {
|
|
2103
2099
|
...this.propsData
|
|
2104
2100
|
});
|
|
2105
2101
|
}
|
|
@@ -2127,10 +2123,10 @@ function getSize(size) {
|
|
|
2127
2123
|
var injectStylesIntoStyleTag = __webpack_require__(3);
|
|
2128
2124
|
var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
|
|
2129
2125
|
|
|
2130
|
-
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FilesCard/src/main.vue?vue&type=style&index=0&id=
|
|
2131
|
-
var
|
|
2126
|
+
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FilesCard/src/main.vue?vue&type=style&index=0&id=28b3b638&prod&lang=scss&scoped=true
|
|
2127
|
+
var mainvue_type_style_index_0_id_28b3b638_prod_lang_scss_scoped_true = __webpack_require__(25);
|
|
2132
2128
|
|
|
2133
|
-
// CONCATENATED MODULE: ./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FilesCard/src/main.vue?vue&type=style&index=0&id=
|
|
2129
|
+
// CONCATENATED MODULE: ./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FilesCard/src/main.vue?vue&type=style&index=0&id=28b3b638&prod&lang=scss&scoped=true
|
|
2134
2130
|
|
|
2135
2131
|
|
|
2136
2132
|
|
|
@@ -2139,12 +2135,12 @@ var options = {};
|
|
|
2139
2135
|
options.insert = "head";
|
|
2140
2136
|
options.singleton = false;
|
|
2141
2137
|
|
|
2142
|
-
var update = injectStylesIntoStyleTag_default()(
|
|
2138
|
+
var update = injectStylesIntoStyleTag_default()(mainvue_type_style_index_0_id_28b3b638_prod_lang_scss_scoped_true["a" /* default */], options);
|
|
2143
2139
|
|
|
2144
2140
|
|
|
2145
2141
|
|
|
2146
|
-
/* harmony default export */ var
|
|
2147
|
-
// CONCATENATED MODULE: ./src/components/FilesCard/src/main.vue?vue&type=style&index=0&id=
|
|
2142
|
+
/* harmony default export */ var src_mainvue_type_style_index_0_id_28b3b638_prod_lang_scss_scoped_true = (mainvue_type_style_index_0_id_28b3b638_prod_lang_scss_scoped_true["a" /* default */].locals || {});
|
|
2143
|
+
// CONCATENATED MODULE: ./src/components/FilesCard/src/main.vue?vue&type=style&index=0&id=28b3b638&prod&lang=scss&scoped=true
|
|
2148
2144
|
|
|
2149
2145
|
// CONCATENATED MODULE: ./src/components/FilesCard/src/main.vue
|
|
2150
2146
|
|
|
@@ -2161,7 +2157,7 @@ var main_component = Object(componentNormalizer["a" /* default */])(
|
|
|
2161
2157
|
staticRenderFns,
|
|
2162
2158
|
false,
|
|
2163
2159
|
null,
|
|
2164
|
-
"
|
|
2160
|
+
"28b3b638",
|
|
2165
2161
|
null
|
|
2166
2162
|
|
|
2167
2163
|
)
|