@panpanzhao/component-ui 1.24.1225 → 1.24.1226
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/component-ui.common.js +708 -727
- package/lib/{components/0.worker.js → component-ui.common.worker.js} +89 -482
- package/lib/components/crud.js +2 -5
- package/lib/components/dialog.js +4 -4
- package/lib/components/drawer.js +2 -2
- package/lib/components/form-drawer.js +4 -4
- package/lib/components/form-input.js +943 -962
- package/lib/components/form-item.js +4 -4
- package/lib/components/form-query.js +2 -2
- package/lib/components/formula.js +20 -20
- package/lib/components/hash.worker.worker.js +659 -0
- package/lib/components/table-column.js +10 -10
- package/lib/components/table-editable.js +6 -6
- package/lib/components/table-operate.js +2 -5
- package/lib/components/table-search.js +6 -6
- package/lib/components/table.js +4 -4
- package/lib/components/timeline.js +2 -2
- package/lib/components/tree-line.js +2 -2
- package/lib/index.js +1 -1
- package/lib/index.worker.js +1 -0
- package/package.json +2 -1
- package/lib/0.worker.js +0 -1
|
@@ -564,489 +564,96 @@
|
|
|
564
564
|
__webpack_require__.r(__webpack_exports__);
|
|
565
565
|
/* harmony import */ var _spark_md5_min_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
566
566
|
/* harmony import */ var _spark_md5_min_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_spark_md5_min_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
return
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
u.value = t, i(u);
|
|
657
|
-
}, function (t) {
|
|
658
|
-
return invoke("throw", t, i, a);
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
a(c.arg);
|
|
662
|
-
}
|
|
663
|
-
var r;
|
|
664
|
-
o(this, "_invoke", {
|
|
665
|
-
value: function value(t, n) {
|
|
666
|
-
function callInvokeWithMethodAndArg() {
|
|
667
|
-
return new e(function (e, r) {
|
|
668
|
-
invoke(t, n, e, r);
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
function makeInvokeMethod(e, r, n) {
|
|
676
|
-
var o = h;
|
|
677
|
-
return function (i, a) {
|
|
678
|
-
if (o === f) throw new Error("Generator is already running");
|
|
679
|
-
if (o === s) {
|
|
680
|
-
if ("throw" === i) throw a;
|
|
681
|
-
return {
|
|
682
|
-
value: t,
|
|
683
|
-
done: !0
|
|
684
|
-
};
|
|
685
|
-
}
|
|
686
|
-
for (n.method = i, n.arg = a;;) {
|
|
687
|
-
var c = n.delegate;
|
|
688
|
-
if (c) {
|
|
689
|
-
var u = maybeInvokeDelegate(c, n);
|
|
690
|
-
if (u) {
|
|
691
|
-
if (u === y) continue;
|
|
692
|
-
return u;
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
696
|
-
if (o === h) throw o = s, n.arg;
|
|
697
|
-
n.dispatchException(n.arg);
|
|
698
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
699
|
-
o = f;
|
|
700
|
-
var p = tryCatch(e, r, n);
|
|
701
|
-
if ("normal" === p.type) {
|
|
702
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
703
|
-
return {
|
|
704
|
-
value: p.arg,
|
|
705
|
-
done: n.done
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
function maybeInvokeDelegate(e, r) {
|
|
713
|
-
var n = r.method,
|
|
714
|
-
o = e.iterator[n];
|
|
715
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
716
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
717
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
718
|
-
var a = i.arg;
|
|
719
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
720
|
-
}
|
|
721
|
-
function pushTryEntry(t) {
|
|
722
|
-
var e = {
|
|
723
|
-
tryLoc: t[0]
|
|
724
|
-
};
|
|
725
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
726
|
-
}
|
|
727
|
-
function resetTryEntry(t) {
|
|
728
|
-
var e = t.completion || {};
|
|
729
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
730
|
-
}
|
|
731
|
-
function Context(t) {
|
|
732
|
-
this.tryEntries = [{
|
|
733
|
-
tryLoc: "root"
|
|
734
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
735
|
-
}
|
|
736
|
-
function values(e) {
|
|
737
|
-
if (e || "" === e) {
|
|
738
|
-
var r = e[a];
|
|
739
|
-
if (r) return r.call(e);
|
|
740
|
-
if ("function" == typeof e.next) return e;
|
|
741
|
-
if (!isNaN(e.length)) {
|
|
742
|
-
var o = -1,
|
|
743
|
-
i = function next() {
|
|
744
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
745
|
-
return next.value = t, next.done = !0, next;
|
|
746
|
-
};
|
|
747
|
-
return i.next = i;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
751
|
-
}
|
|
752
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
753
|
-
value: GeneratorFunctionPrototype,
|
|
754
|
-
configurable: !0
|
|
755
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
756
|
-
value: GeneratorFunction,
|
|
757
|
-
configurable: !0
|
|
758
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
759
|
-
var e = "function" == typeof t && t.constructor;
|
|
760
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
761
|
-
}, e.mark = function (t) {
|
|
762
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
763
|
-
}, e.awrap = function (t) {
|
|
764
|
-
return {
|
|
765
|
-
__await: t
|
|
766
|
-
};
|
|
767
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
768
|
-
return this;
|
|
769
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
770
|
-
void 0 === i && (i = Promise);
|
|
771
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
772
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
773
|
-
return t.done ? t.value : a.next();
|
|
774
|
-
});
|
|
775
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
776
|
-
return this;
|
|
777
|
-
}), define(g, "toString", function () {
|
|
778
|
-
return "[object Generator]";
|
|
779
|
-
}), e.keys = function (t) {
|
|
780
|
-
var e = Object(t),
|
|
781
|
-
r = [];
|
|
782
|
-
for (var n in e) r.push(n);
|
|
783
|
-
return r.reverse(), function next() {
|
|
784
|
-
for (; r.length;) {
|
|
785
|
-
var t = r.pop();
|
|
786
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
787
|
-
}
|
|
788
|
-
return next.done = !0, next;
|
|
789
|
-
};
|
|
790
|
-
}, e.values = values, Context.prototype = {
|
|
791
|
-
constructor: Context,
|
|
792
|
-
reset: function reset(e) {
|
|
793
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
794
|
-
},
|
|
795
|
-
stop: function stop() {
|
|
796
|
-
this.done = !0;
|
|
797
|
-
var t = this.tryEntries[0].completion;
|
|
798
|
-
if ("throw" === t.type) throw t.arg;
|
|
799
|
-
return this.rval;
|
|
800
|
-
},
|
|
801
|
-
dispatchException: function dispatchException(e) {
|
|
802
|
-
if (this.done) throw e;
|
|
803
|
-
var r = this;
|
|
804
|
-
function handle(n, o) {
|
|
805
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
806
|
-
}
|
|
807
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
808
|
-
var i = this.tryEntries[o],
|
|
809
|
-
a = i.completion;
|
|
810
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
811
|
-
if (i.tryLoc <= this.prev) {
|
|
812
|
-
var c = n.call(i, "catchLoc"),
|
|
813
|
-
u = n.call(i, "finallyLoc");
|
|
814
|
-
if (c && u) {
|
|
815
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
816
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
817
|
-
} else if (c) {
|
|
818
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
819
|
-
} else {
|
|
820
|
-
if (!u) throw new Error("try statement without catch or finally");
|
|
821
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
},
|
|
826
|
-
abrupt: function abrupt(t, e) {
|
|
827
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
828
|
-
var o = this.tryEntries[r];
|
|
829
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
830
|
-
var i = o;
|
|
831
|
-
break;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
835
|
-
var a = i ? i.completion : {};
|
|
836
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
837
|
-
},
|
|
838
|
-
complete: function complete(t, e) {
|
|
839
|
-
if ("throw" === t.type) throw t.arg;
|
|
840
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
841
|
-
},
|
|
842
|
-
finish: function finish(t) {
|
|
843
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
844
|
-
var r = this.tryEntries[e];
|
|
845
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
846
|
-
}
|
|
847
|
-
},
|
|
848
|
-
catch: function _catch(t) {
|
|
849
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
850
|
-
var r = this.tryEntries[e];
|
|
851
|
-
if (r.tryLoc === t) {
|
|
852
|
-
var n = r.completion;
|
|
853
|
-
if ("throw" === n.type) {
|
|
854
|
-
var o = n.arg;
|
|
855
|
-
resetTryEntry(r);
|
|
856
|
-
}
|
|
857
|
-
return o;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
throw new Error("illegal catch attempt");
|
|
861
|
-
},
|
|
862
|
-
delegateYield: function delegateYield(e, r, n) {
|
|
863
|
-
return this.delegate = {
|
|
864
|
-
iterator: values(e),
|
|
865
|
-
resultName: r,
|
|
866
|
-
nextLoc: n
|
|
867
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
868
|
-
}
|
|
869
|
-
}, e;
|
|
870
|
-
}
|
|
871
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
872
|
-
try {
|
|
873
|
-
var info = gen[key](arg);
|
|
874
|
-
var value = info.value;
|
|
875
|
-
} catch (error) {
|
|
876
|
-
reject(error);
|
|
877
|
-
return;
|
|
878
|
-
}
|
|
879
|
-
if (info.done) {
|
|
880
|
-
resolve(value);
|
|
881
|
-
} else {
|
|
882
|
-
Promise.resolve(value).then(_next, _throw);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
function _asyncToGenerator(fn) {
|
|
886
|
-
return function () {
|
|
887
|
-
var self = this,
|
|
888
|
-
args = arguments;
|
|
889
|
-
return new Promise(function (resolve, reject) {
|
|
890
|
-
var gen = fn.apply(self, args);
|
|
891
|
-
function _next(value) {
|
|
892
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
893
|
-
}
|
|
894
|
-
function _throw(err) {
|
|
895
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
896
|
-
}
|
|
897
|
-
_next(undefined);
|
|
898
|
-
});
|
|
899
|
-
};
|
|
900
|
-
}
|
|
567
|
+
|
|
568
|
+
// self.importScripts("spark-md5.min.js");
|
|
569
|
+
|
|
570
|
+
// 创建文件切片
|
|
571
|
+
function createFileChunk(file, chunkSize) {
|
|
572
|
+
return new Promise((resolve, reject) => {
|
|
573
|
+
let fileChunkList = [];
|
|
574
|
+
let cur = 0;
|
|
575
|
+
while (cur < file.size) {
|
|
576
|
+
// Blob 接口的 slice() 方法创建并返回一个新的 Blob 对象,该对象包含调用它的 blob 的子集中的数据。
|
|
577
|
+
fileChunkList.push({ chunkFile: file.slice(cur, cur + chunkSize) });
|
|
578
|
+
cur += chunkSize;
|
|
579
|
+
}
|
|
580
|
+
// 返回全部文件切片
|
|
581
|
+
resolve(fileChunkList);
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// 加载并计算文件切片的MD5
|
|
586
|
+
async function calculateChunksHash(fileChunkList) {
|
|
587
|
+
// 初始化脚本
|
|
588
|
+
const spark = new _spark_md5_min_js__WEBPACK_IMPORTED_MODULE_0___default.a.ArrayBuffer();
|
|
589
|
+
// const spark = new self.SparkMD5.ArrayBuffer();
|
|
590
|
+
|
|
591
|
+
// 计算切片进度(拓展功能,可自行添加)
|
|
592
|
+
let percentage = 0;
|
|
593
|
+
// 计算切片次数
|
|
594
|
+
let count = 0;
|
|
595
|
+
|
|
596
|
+
// 递归函数,用于处理文件切片
|
|
597
|
+
async function loadNext(index) {
|
|
598
|
+
if (index >= fileChunkList.length) {
|
|
599
|
+
// 所有切片都已处理完毕
|
|
600
|
+
const md5 = spark.end();
|
|
601
|
+
return md5; // 返回最终的MD5值
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return new Promise((resolve, reject) => {
|
|
605
|
+
const reader = new FileReader();
|
|
606
|
+
reader.readAsArrayBuffer(fileChunkList[index].chunkFile);
|
|
607
|
+
reader.onload = (e) => {
|
|
608
|
+
count++;
|
|
609
|
+
spark.append(e.target.result);
|
|
610
|
+
|
|
611
|
+
// 更新进度并处理下一个切片
|
|
612
|
+
percentage += 100 / fileChunkList.length;
|
|
613
|
+
self.postMessage({ percentage }); // 发送进度到主线程
|
|
614
|
+
|
|
615
|
+
resolve(loadNext(index + 1)); // 递归调用,处理下一个切片
|
|
616
|
+
};
|
|
617
|
+
reader.onerror = (err) => {
|
|
618
|
+
reject(err); // 如果读取错误,则拒绝Promise
|
|
619
|
+
};
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
try {
|
|
624
|
+
// 开始计算切片
|
|
625
|
+
const fileHash = await loadNext(0); // 等待所有切片处理完毕
|
|
626
|
+
self.postMessage({ percentage: 100, fileHash, fileChunkList }); // 发送最终结果到主线程
|
|
627
|
+
self.close(); // 关闭Worker
|
|
628
|
+
} catch (err) {
|
|
629
|
+
self.postMessage({ name: "error", data: err }); // 发送错误到主线程
|
|
630
|
+
self.close(); // 关闭Worker
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// 监听消息
|
|
635
|
+
self.addEventListener(
|
|
636
|
+
"message",
|
|
637
|
+
async (e) => {
|
|
638
|
+
try {
|
|
639
|
+
const { file, chunkSize } = e.data;
|
|
640
|
+
const fileChunkList = await createFileChunk(file, chunkSize); // 创建文件切片
|
|
641
|
+
await calculateChunksHash(fileChunkList); // 等待计算完成
|
|
642
|
+
} catch (err) {
|
|
643
|
+
// 这里实际上不会捕获到calculateChunksHash中的错误,因为错误已经在Worker内部处理了
|
|
644
|
+
// 但如果未来有其他的异步操作,这里可以捕获到它们
|
|
645
|
+
console.error("worker监听发生错误:", err);
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
false
|
|
649
|
+
);
|
|
650
|
+
|
|
651
|
+
// 主线程可以监听 Worker 是否发生错误。如果发生错误,Worker 会触发主线程的error事件。
|
|
652
|
+
self.addEventListener("error", function (event) {
|
|
653
|
+
console.log("Worker触发主线程的error事件:", event);
|
|
654
|
+
self.close(); // 关闭Worker
|
|
655
|
+
});
|
|
901
656
|
|
|
902
|
-
// self.importScripts("spark-md5.min.js");
|
|
903
|
-
|
|
904
|
-
// 创建文件切片
|
|
905
|
-
function createFileChunk(file, chunkSize) {
|
|
906
|
-
return new Promise(function (resolve, reject) {
|
|
907
|
-
var fileChunkList = [];
|
|
908
|
-
var cur = 0;
|
|
909
|
-
while (cur < file.size) {
|
|
910
|
-
// Blob 接口的 slice() 方法创建并返回一个新的 Blob 对象,该对象包含调用它的 blob 的子集中的数据。
|
|
911
|
-
fileChunkList.push({
|
|
912
|
-
chunkFile: file.slice(cur, cur + chunkSize)
|
|
913
|
-
});
|
|
914
|
-
cur += chunkSize;
|
|
915
|
-
}
|
|
916
|
-
// 返回全部文件切片
|
|
917
|
-
resolve(fileChunkList);
|
|
918
|
-
});
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
// 加载并计算文件切片的MD5
|
|
922
|
-
function calculateChunksHash(_x) {
|
|
923
|
-
return _calculateChunksHash.apply(this, arguments);
|
|
924
|
-
} // 监听消息
|
|
925
|
-
function _calculateChunksHash() {
|
|
926
|
-
_calculateChunksHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(fileChunkList) {
|
|
927
|
-
var spark, percentage, count, loadNext, _loadNext, fileHash;
|
|
928
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
929
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
930
|
-
case 0:
|
|
931
|
-
_loadNext = function _loadNext3() {
|
|
932
|
-
_loadNext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(index) {
|
|
933
|
-
var md5;
|
|
934
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
935
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
936
|
-
case 0:
|
|
937
|
-
if (!(index >= fileChunkList.length)) {
|
|
938
|
-
_context2.next = 3;
|
|
939
|
-
break;
|
|
940
|
-
}
|
|
941
|
-
// 所有切片都已处理完毕
|
|
942
|
-
md5 = spark.end();
|
|
943
|
-
return _context2.abrupt("return", md5);
|
|
944
|
-
case 3:
|
|
945
|
-
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
946
|
-
var reader = new FileReader();
|
|
947
|
-
reader.readAsArrayBuffer(fileChunkList[index].chunkFile);
|
|
948
|
-
reader.onload = function (e) {
|
|
949
|
-
count++;
|
|
950
|
-
spark.append(e.target.result);
|
|
951
|
-
|
|
952
|
-
// 更新进度并处理下一个切片
|
|
953
|
-
percentage += 100 / fileChunkList.length;
|
|
954
|
-
self.postMessage({
|
|
955
|
-
percentage: percentage
|
|
956
|
-
}); // 发送进度到主线程
|
|
957
|
-
|
|
958
|
-
resolve(loadNext(index + 1)); // 递归调用,处理下一个切片
|
|
959
|
-
};
|
|
960
|
-
reader.onerror = function (err) {
|
|
961
|
-
reject(err); // 如果读取错误,则拒绝Promise
|
|
962
|
-
};
|
|
963
|
-
}));
|
|
964
|
-
case 4:
|
|
965
|
-
case "end":
|
|
966
|
-
return _context2.stop();
|
|
967
|
-
}
|
|
968
|
-
}, _callee2);
|
|
969
|
-
}));
|
|
970
|
-
return _loadNext.apply(this, arguments);
|
|
971
|
-
};
|
|
972
|
-
loadNext = function _loadNext2(_x3) {
|
|
973
|
-
return _loadNext.apply(this, arguments);
|
|
974
|
-
};
|
|
975
|
-
// 初始化脚本
|
|
976
|
-
spark = new _spark_md5_min_js__WEBPACK_IMPORTED_MODULE_0___default.a.ArrayBuffer(); // const spark = new self.SparkMD5.ArrayBuffer();
|
|
977
|
-
// 计算切片进度(拓展功能,可自行添加)
|
|
978
|
-
percentage = 0; // 计算切片次数
|
|
979
|
-
count = 0; // 递归函数,用于处理文件切片
|
|
980
|
-
_context3.prev = 5;
|
|
981
|
-
_context3.next = 8;
|
|
982
|
-
return loadNext(0);
|
|
983
|
-
case 8:
|
|
984
|
-
fileHash = _context3.sent;
|
|
985
|
-
// 等待所有切片处理完毕
|
|
986
|
-
self.postMessage({
|
|
987
|
-
percentage: 100,
|
|
988
|
-
fileHash: fileHash,
|
|
989
|
-
fileChunkList: fileChunkList
|
|
990
|
-
}); // 发送最终结果到主线程
|
|
991
|
-
self.close(); // 关闭Worker
|
|
992
|
-
_context3.next = 17;
|
|
993
|
-
break;
|
|
994
|
-
case 13:
|
|
995
|
-
_context3.prev = 13;
|
|
996
|
-
_context3.t0 = _context3["catch"](5);
|
|
997
|
-
self.postMessage({
|
|
998
|
-
name: "error",
|
|
999
|
-
data: _context3.t0
|
|
1000
|
-
}); // 发送错误到主线程
|
|
1001
|
-
self.close();
|
|
1002
|
-
// 关闭Worker
|
|
1003
|
-
case 17:
|
|
1004
|
-
case "end":
|
|
1005
|
-
return _context3.stop();
|
|
1006
|
-
}
|
|
1007
|
-
}, _callee3, null, [[5, 13]]);
|
|
1008
|
-
}));
|
|
1009
|
-
return _calculateChunksHash.apply(this, arguments);
|
|
1010
|
-
}
|
|
1011
|
-
self.addEventListener("message", /*#__PURE__*/function () {
|
|
1012
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
1013
|
-
var _e$data, file, chunkSize, fileChunkList;
|
|
1014
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1015
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1016
|
-
case 0:
|
|
1017
|
-
_context.prev = 0;
|
|
1018
|
-
_e$data = e.data, file = _e$data.file, chunkSize = _e$data.chunkSize;
|
|
1019
|
-
_context.next = 4;
|
|
1020
|
-
return createFileChunk(file, chunkSize);
|
|
1021
|
-
case 4:
|
|
1022
|
-
fileChunkList = _context.sent;
|
|
1023
|
-
_context.next = 7;
|
|
1024
|
-
return calculateChunksHash(fileChunkList);
|
|
1025
|
-
case 7:
|
|
1026
|
-
_context.next = 12;
|
|
1027
|
-
break;
|
|
1028
|
-
case 9:
|
|
1029
|
-
_context.prev = 9;
|
|
1030
|
-
_context.t0 = _context["catch"](0);
|
|
1031
|
-
// 这里实际上不会捕获到calculateChunksHash中的错误,因为错误已经在Worker内部处理了
|
|
1032
|
-
// 但如果未来有其他的异步操作,这里可以捕获到它们
|
|
1033
|
-
console.error("worker监听发生错误:", _context.t0);
|
|
1034
|
-
case 12:
|
|
1035
|
-
case "end":
|
|
1036
|
-
return _context.stop();
|
|
1037
|
-
}
|
|
1038
|
-
}, _callee, null, [[0, 9]]);
|
|
1039
|
-
}));
|
|
1040
|
-
return function (_x2) {
|
|
1041
|
-
return _ref.apply(this, arguments);
|
|
1042
|
-
};
|
|
1043
|
-
}(), false);
|
|
1044
|
-
|
|
1045
|
-
// 主线程可以监听 Worker 是否发生错误。如果发生错误,Worker 会触发主线程的error事件。
|
|
1046
|
-
self.addEventListener("error", function (event) {
|
|
1047
|
-
console.log("Worker触发主线程的error事件:", event);
|
|
1048
|
-
self.close(); // 关闭Worker
|
|
1049
|
-
});
|
|
1050
657
|
|
|
1051
658
|
/***/ })
|
|
1052
659
|
/******/ ]);
|
package/lib/components/crud.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 79);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ([
|
|
@@ -2268,10 +2268,7 @@ module.exports = require("@panpanzhao/component-ui/lib/components/table-search")
|
|
|
2268
2268
|
/* 76 */,
|
|
2269
2269
|
/* 77 */,
|
|
2270
2270
|
/* 78 */,
|
|
2271
|
-
/* 79
|
|
2272
|
-
/* 80 */,
|
|
2273
|
-
/* 81 */,
|
|
2274
|
-
/* 82 */
|
|
2271
|
+
/* 79 */
|
|
2275
2272
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2276
2273
|
|
|
2277
2274
|
"use strict";
|
package/lib/components/dialog.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 80);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -206,14 +206,14 @@ module.exports = require("element-ui/lib/mixins/emitter");
|
|
|
206
206
|
|
|
207
207
|
/***/ }),
|
|
208
208
|
|
|
209
|
-
/***/
|
|
209
|
+
/***/ 67:
|
|
210
210
|
/***/ (function(module, exports) {
|
|
211
211
|
|
|
212
212
|
module.exports = require("element-ui/lib/mixins/migrating");
|
|
213
213
|
|
|
214
214
|
/***/ }),
|
|
215
215
|
|
|
216
|
-
/***/
|
|
216
|
+
/***/ 80:
|
|
217
217
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
218
218
|
|
|
219
219
|
"use strict";
|
|
@@ -360,7 +360,7 @@ var popup_ = __webpack_require__(33);
|
|
|
360
360
|
var popup_default = /*#__PURE__*/__webpack_require__.n(popup_);
|
|
361
361
|
|
|
362
362
|
// EXTERNAL MODULE: external "element-ui/lib/mixins/migrating"
|
|
363
|
-
var migrating_ = __webpack_require__(
|
|
363
|
+
var migrating_ = __webpack_require__(67);
|
|
364
364
|
var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
|
|
365
365
|
|
|
366
366
|
// EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
|
package/lib/components/drawer.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 81);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -206,7 +206,7 @@ module.exports = require("element-ui/lib/mixins/emitter");
|
|
|
206
206
|
|
|
207
207
|
/***/ }),
|
|
208
208
|
|
|
209
|
-
/***/
|
|
209
|
+
/***/ 81:
|
|
210
210
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
211
211
|
|
|
212
212
|
"use strict";
|