@vortex-ui/env-puzzle 2.0.0-beta.9 → 3.0.0-beta.2
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/README.md +46 -46
- package/lib/b-map/b-map.d.ts +1 -1
- package/lib/b-map/b-map.js +100 -162
- package/lib/b-map/b-map.js.map +1 -1
- package/lib/b-map/custom-overlay.js +17 -37
- package/lib/b-map/custom-overlay.js.map +1 -1
- package/lib/b-map/drawing.js +11 -25
- package/lib/b-map/drawing.js.map +1 -1
- package/lib/b-map/index.d.ts +2 -2
- package/lib/b-map/index.js +4 -16
- package/lib/b-map/index.js.map +1 -1
- package/lib/b-map/js/marker-clusterer.js +223 -339
- package/lib/b-map/js/marker-clusterer.js.map +1 -1
- package/lib/b-map/lushu.js +17 -36
- package/lib/b-map/lushu.js.map +1 -1
- package/lib/b-map/marker-clusterer.js +6 -14
- package/lib/b-map/marker-clusterer.js.map +1 -1
- package/lib/b-map/marker.js +32 -70
- package/lib/b-map/marker.js.map +1 -1
- package/lib/b-map/polygon.js +5 -13
- package/lib/b-map/polygon.js.map +1 -1
- package/lib/b-map/style/css.js.map +1 -1
- package/lib/b-map/style/index.js.map +1 -1
- package/lib/b-map/style/index.less +10 -10
- package/lib/create-modal/create-modal.d.ts +3 -2
- package/lib/create-modal/create-modal.js +163 -307
- package/lib/create-modal/create-modal.js.map +1 -1
- package/lib/create-modal/index.d.ts +1 -2
- package/lib/create-modal/index.js +2 -8
- package/lib/create-modal/index.js.map +1 -1
- package/lib/create-modal/style/css.js +0 -18
- package/lib/create-modal/style/css.js.map +1 -1
- package/lib/create-modal/style/index.css +2 -2
- package/lib/create-modal/style/index.d.ts +0 -9
- package/lib/create-modal/style/index.js +0 -18
- package/lib/create-modal/style/index.js.map +1 -1
- package/lib/create-modal/style/index.less +116 -119
- package/lib/global.less +5 -6
- package/lib/import-modal/import-modal.d.ts +3 -1
- package/lib/import-modal/import-modal.js +140 -204
- package/lib/import-modal/import-modal.js.map +1 -1
- package/lib/import-modal/index.js +2 -6
- package/lib/import-modal/index.js.map +1 -1
- package/lib/import-modal/style/css.js +0 -10
- package/lib/import-modal/style/css.js.map +1 -1
- package/lib/import-modal/style/index.d.ts +0 -5
- package/lib/import-modal/style/index.js +0 -10
- package/lib/import-modal/style/index.js.map +1 -1
- package/lib/import-modal/style/index.less +14 -15
- package/lib/index.js +1 -14
- package/lib/index.js.map +1 -1
- package/lib/interface/index.js.map +1 -1
- package/lib/mapv-Layer/Function.js +0 -2
- package/lib/mapv-Layer/Function.js.map +1 -1
- package/lib/mapv-Layer/index.js +2 -6
- package/lib/mapv-Layer/index.js.map +1 -1
- package/lib/mapv-Layer/mapv-Layer.js +19 -40
- package/lib/mapv-Layer/mapv-Layer.js.map +1 -1
- package/lib/mapv-Layer/style/css.js.map +1 -1
- package/lib/mapv-Layer/style/index.js.map +1 -1
- package/lib/percent/index.d.ts +1 -1
- package/lib/percent/index.js +2 -7
- package/lib/percent/index.js.map +1 -1
- package/lib/percent/interface.js.map +1 -1
- package/lib/percent/line-percent.js +20 -37
- package/lib/percent/line-percent.js.map +1 -1
- package/lib/percent/percent.js +20 -43
- package/lib/percent/percent.js.map +1 -1
- package/lib/percent/style/css.js.map +1 -1
- package/lib/percent/style/index.js.map +1 -1
- package/lib/percent/style/index.less +41 -41
- package/lib/scroll/index.js +2 -6
- package/lib/scroll/index.js.map +1 -1
- package/lib/scroll/scroll.d.ts +1 -1
- package/lib/scroll/scroll.js +19 -47
- package/lib/scroll/scroll.js.map +1 -1
- package/lib/scroll/style/css.js.map +1 -1
- package/lib/scroll/style/index.js.map +1 -1
- package/lib/scroll/style/index.less +3 -3
- package/lib/scroll-select/index.js +2 -6
- package/lib/scroll-select/index.js.map +1 -1
- package/lib/scroll-select/scrollSelect.d.ts +2 -1
- package/lib/scroll-select/scrollSelect.js +144 -218
- package/lib/scroll-select/scrollSelect.js.map +1 -1
- package/lib/scroll-select/style/css.js +0 -2
- package/lib/scroll-select/style/css.js.map +1 -1
- package/lib/scroll-select/style/index.d.ts +0 -1
- package/lib/scroll-select/style/index.js +0 -2
- package/lib/scroll-select/style/index.js.map +1 -1
- package/lib/scroll-select/style/index.less +7 -7
- package/lib/style/color.less +1 -1
- package/lib/table/index.js +2 -6
- package/lib/table/index.js.map +1 -1
- package/lib/table/style/css.js +0 -2
- package/lib/table/style/css.js.map +1 -1
- package/lib/table/style/index.d.ts +0 -1
- package/lib/table/style/index.js +0 -2
- package/lib/table/style/index.js.map +1 -1
- package/lib/table/table.d.ts +1 -1
- package/lib/table/table.js +24 -56
- package/lib/table/table.js.map +1 -1
- package/lib/template/action.d.ts +3 -1
- package/lib/template/action.js +93 -132
- package/lib/template/action.js.map +1 -1
- package/lib/template/card-table.d.ts +7 -6
- package/lib/template/card-table.js +40 -82
- package/lib/template/card-table.js.map +1 -1
- package/lib/template/card.d.ts +1 -1
- package/lib/template/card.js +20 -38
- package/lib/template/card.js.map +1 -1
- package/lib/template/check-row.d.ts +2 -1
- package/lib/template/check-row.js +7 -12
- package/lib/template/check-row.js.map +1 -1
- package/lib/template/field.js +8 -24
- package/lib/template/field.js.map +1 -1
- package/lib/template/filter.d.ts +1 -2
- package/lib/template/filter.js +25 -63
- package/lib/template/filter.js.map +1 -1
- package/lib/template/icon.js +4 -15
- package/lib/template/icon.js.map +1 -1
- package/lib/template/index.d.ts +2 -3
- package/lib/template/index.js +4 -12
- package/lib/template/index.js.map +1 -1
- package/lib/template/interface.js.map +1 -1
- package/lib/template/renderColumnButtons.js +80 -104
- package/lib/template/renderColumnButtons.js.map +1 -1
- package/lib/template/style/action.css +3 -2
- package/lib/template/style/action.less +74 -71
- package/lib/template/style/card.css +2 -2
- package/lib/template/style/card.less +87 -88
- package/lib/template/style/check-row.less +27 -27
- package/lib/template/style/css.js +0 -36
- package/lib/template/style/css.js.map +1 -1
- package/lib/template/style/field.less +11 -11
- package/lib/template/style/filter.css +0 -29
- package/lib/template/style/filter.less +46 -72
- package/lib/template/style/icon.less +7 -7
- package/lib/template/style/index.css +8 -42
- package/lib/template/style/index.d.ts +0 -18
- package/lib/template/style/index.js +0 -36
- package/lib/template/style/index.js.map +1 -1
- package/lib/template/style/index.less +48 -49
- package/lib/template/style/table.css +0 -6
- package/lib/template/style/table.less +79 -91
- package/lib/template/table.d.ts +7 -5
- package/lib/template/table.js +23 -45
- package/lib/template/table.js.map +1 -1
- package/lib/template/template.d.ts +4 -4
- package/lib/template/template.js +134 -258
- package/lib/template/template.js.map +1 -1
- package/lib/template/toolbar.d.ts +1 -1
- package/lib/template/toolbar.js +57 -63
- package/lib/template/toolbar.js.map +1 -1
- package/lib/to-map/container.js +58 -112
- package/lib/to-map/container.js.map +1 -1
- package/lib/to-map/draw-area.js +14 -34
- package/lib/to-map/draw-area.js.map +1 -1
- package/lib/to-map/index.d.ts +1 -1
- package/lib/to-map/index.js +2 -7
- package/lib/to-map/index.js.map +1 -1
- package/lib/to-map/style/css.js +0 -2
- package/lib/to-map/style/css.js.map +1 -1
- package/lib/to-map/style/index.d.ts +0 -1
- package/lib/to-map/style/index.js +0 -2
- package/lib/to-map/style/index.js.map +1 -1
- package/lib/to-map/style/index.less +86 -86
- package/lib/to-map/to-map.js +22 -49
- package/lib/to-map/to-map.js.map +1 -1
- package/lib/upload/index.js +2 -6
- package/lib/upload/index.js.map +1 -1
- package/lib/upload/style/css.js +0 -5
- package/lib/upload/style/css.js.map +1 -1
- package/lib/upload/style/index.d.ts +0 -2
- package/lib/upload/style/index.js +0 -5
- package/lib/upload/style/index.js.map +1 -1
- package/lib/upload/upload.d.ts +4 -1
- package/lib/upload/upload.js +164 -245
- package/lib/upload/upload.js.map +1 -1
- package/lib/use-simple-res/demos/index.d.ts +2 -1
- package/lib/use-simple-res/demos/index.js +31 -59
- package/lib/use-simple-res/demos/index.js.map +1 -1
- package/lib/use-simple-res/index.d.ts +0 -1
- package/lib/use-simple-res/index.js +61 -75
- package/lib/use-simple-res/index.js.map +1 -1
- package/lib/use-simple-res/style/css.js.map +1 -1
- package/lib/use-simple-res/style/index.js.map +1 -1
- package/lib/utils/dom-util.js +8 -27
- package/lib/utils/dom-util.js.map +1 -1
- package/lib/utils/request-util.d.ts +10 -1
- package/lib/utils/request-util.js +170 -45
- package/lib/utils/request-util.js.map +1 -1
- package/lib/utils/string-util.d.ts +2 -0
- package/lib/utils/string-util.js +34 -16
- package/lib/utils/string-util.js.map +1 -1
- package/lib/view-modal/index.d.ts +0 -1
- package/lib/view-modal/index.js +2 -8
- package/lib/view-modal/index.js.map +1 -1
- package/lib/view-modal/style/css.js +0 -12
- package/lib/view-modal/style/css.js.map +1 -1
- package/lib/view-modal/style/index.css +3 -41
- package/lib/view-modal/style/index.d.ts +0 -7
- package/lib/view-modal/style/index.js +0 -12
- package/lib/view-modal/style/index.js.map +1 -1
- package/lib/view-modal/style/index.less +42 -57
- package/lib/view-modal/view-modal.d.ts +1 -1
- package/lib/view-modal/view-modal.js +36 -86
- package/lib/view-modal/view-modal.js.map +1 -1
- package/package.json +157 -143
- package/lib/style/css.js +0 -13
- package/lib/style/css.js.map +0 -1
- package/lib/style/darkGreen.css +0 -719
- package/lib/style/darkGreen.less +0 -482
- package/lib/style/index.d.ts +0 -2
- package/lib/style/index.js +0 -13
- package/lib/style/index.js.map +0 -1
- package/lib/template/vtx-search/index.d.ts +0 -2
- package/lib/template/vtx-search/index.js +0 -126
- package/lib/template/vtx-search/index.js.map +0 -1
- package/lib/template/vtx-search/style/index.css +0 -92
- package/lib/template/vtx-search/style/index.less +0 -92
package/lib/upload/upload.js
CHANGED
|
@@ -1,67 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _viewerjs = _interopRequireDefault(require("viewerjs"));
|
|
13
|
-
|
|
14
|
-
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
15
|
-
|
|
16
|
-
var _message = _interopRequireDefault(require("antd/lib/message"));
|
|
17
|
-
|
|
18
|
-
var _upload = _interopRequireDefault(require("antd/lib/upload"));
|
|
19
|
-
|
|
10
|
+
var _antd = require("antd");
|
|
20
11
|
var _icons = require("@ant-design/icons");
|
|
21
|
-
|
|
22
12
|
var _ahooks = require("ahooks");
|
|
23
|
-
|
|
24
13
|
var _requestUtil = _interopRequireDefault(require("../utils/request-util"));
|
|
25
|
-
|
|
26
|
-
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
|
27
|
-
|
|
14
|
+
var _debounce = _interopRequireDefault(require("lodash-es/debounce"));
|
|
28
15
|
var _utils = require("@vtx/utils");
|
|
29
|
-
|
|
30
|
-
function _interopRequireDefault(
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
36
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
37
|
-
|
|
16
|
+
var _stringUtil = _interopRequireDefault(require("../utils/string-util"));
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t3 in e) "default" !== _t3 && {}.hasOwnProperty.call(e, _t3) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t3)) && (i.get || i.set) ? o(f, _t3, i) : f[_t3] = e[_t3]); return f; })(e, t); }
|
|
19
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
38
20
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
45
|
-
|
|
46
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
47
|
-
|
|
21
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
22
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
23
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
24
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
25
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
48
26
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
49
|
-
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
55
|
-
|
|
56
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
57
|
-
|
|
27
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
28
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
29
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
30
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
58
31
|
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
59
32
|
function adopt(value) {
|
|
60
33
|
return value instanceof P ? value : new P(function (resolve) {
|
|
61
34
|
resolve(value);
|
|
62
35
|
});
|
|
63
36
|
}
|
|
64
|
-
|
|
65
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
66
38
|
function fulfilled(value) {
|
|
67
39
|
try {
|
|
@@ -70,7 +42,6 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
|
|
|
70
42
|
reject(e);
|
|
71
43
|
}
|
|
72
44
|
}
|
|
73
|
-
|
|
74
45
|
function rejected(value) {
|
|
75
46
|
try {
|
|
76
47
|
step(generator["throw"](value));
|
|
@@ -78,115 +49,102 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
|
|
|
78
49
|
reject(e);
|
|
79
50
|
}
|
|
80
51
|
}
|
|
81
|
-
|
|
82
52
|
function step(result) {
|
|
83
53
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
84
54
|
}
|
|
85
|
-
|
|
86
55
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
87
56
|
});
|
|
88
57
|
};
|
|
89
|
-
|
|
90
58
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
91
59
|
var t = {};
|
|
92
|
-
|
|
93
|
-
for (var p in s) {
|
|
94
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
95
|
-
}
|
|
96
|
-
|
|
60
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
97
61
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
98
62
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
99
63
|
}
|
|
100
64
|
return t;
|
|
101
65
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
_message["default"].error(msg);
|
|
66
|
+
var debouncedMessage = (0, _debounce["default"])(function (msg) {
|
|
67
|
+
_antd.message.error(msg);
|
|
105
68
|
}, 500);
|
|
106
|
-
|
|
69
|
+
var systemToken = (0, _utils.getUrlParam)('token') || _stringUtil["default"].getSystemInfo('token');
|
|
107
70
|
var HJYUpload = function HJYUpload(props) {
|
|
71
|
+
var token = props.token || systemToken;
|
|
108
72
|
var _useState = (0, _react.useState)([]),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
73
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
74
|
+
fileListState = _useState2[0],
|
|
75
|
+
setfileListState = _useState2[1];
|
|
113
76
|
var _useState3 = (0, _react.useState)([]),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
77
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
78
|
+
imageList = _useState4[0],
|
|
79
|
+
setImageList = _useState4[1];
|
|
118
80
|
var _useState5 = (0, _react.useState)(null),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
81
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
82
|
+
viewer = _useState6[0],
|
|
83
|
+
setViewer = _useState6[1];
|
|
123
84
|
var viewerRef = (0, _react.useRef)(null);
|
|
124
|
-
|
|
125
85
|
var _props$postData = props.postData,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
86
|
+
postData = _props$postData === void 0 ? {} : _props$postData,
|
|
87
|
+
fileList = props.fileList,
|
|
88
|
+
viewMode = props.viewMode,
|
|
89
|
+
previewMode = props.previewMode,
|
|
90
|
+
maxFileSize = props.maxFileSize,
|
|
91
|
+
downLoadURL = props.downLoadURL,
|
|
92
|
+
action = props.action,
|
|
93
|
+
_props$downloadPdfFil = props.downloadPdfFileUrl,
|
|
94
|
+
downloadPdfFileUrl = _props$downloadPdfFil === void 0 ? '/cloudFile/common/downloadPdfFile' : _props$downloadPdfFil,
|
|
95
|
+
rest = __rest(props, ["postData", "fileList", "viewMode", "previewMode", "maxFileSize", "downLoadURL", "action", "downloadPdfFileUrl"]);
|
|
135
96
|
(0, _ahooks.useMount)(function () {
|
|
136
97
|
if (viewerRef === null || viewerRef === void 0 ? void 0 : viewerRef.current) {
|
|
137
98
|
var _viewer = new _viewerjs["default"](viewerRef.current, {});
|
|
138
|
-
|
|
139
99
|
setViewer(_viewer);
|
|
140
100
|
}
|
|
141
101
|
});
|
|
142
102
|
(0, _ahooks.useUnmount)(function () {
|
|
143
103
|
viewer === null || viewer === void 0 ? void 0 : viewer.destroy();
|
|
144
104
|
});
|
|
145
|
-
|
|
146
105
|
var uplaodBtn = function uplaodBtn() {
|
|
147
106
|
if (props.listType === 'picture-card') {
|
|
148
107
|
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_icons.PlusOutlined, null), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("div", null, "\u4E0A\u4F20"));
|
|
149
108
|
}
|
|
150
|
-
|
|
151
|
-
return /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
109
|
+
return /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
152
110
|
icon: /*#__PURE__*/_react["default"].createElement(_icons.UploadOutlined, null)
|
|
153
111
|
}, "\u4E0A\u4F20");
|
|
154
112
|
};
|
|
155
|
-
|
|
156
113
|
var getImgUrl = function getImgUrl(id) {
|
|
157
114
|
if (id && !id.startsWith('http') && !id.startsWith('/cloud')) {
|
|
158
115
|
id = (window.apiPrefix ? "".concat(window.apiPrefix).concat(downLoadURL) : downLoadURL) + id;
|
|
159
116
|
}
|
|
160
|
-
|
|
117
|
+
if (id === null || id === void 0 ? void 0 : id.includes('token=')) {
|
|
118
|
+
return id;
|
|
119
|
+
}
|
|
120
|
+
if (id === null || id === void 0 ? void 0 : id.includes('?')) {
|
|
121
|
+
id = "".concat(id, "&token=").concat(token);
|
|
122
|
+
} else {
|
|
123
|
+
id = "".concat(id, "?token=").concat(token);
|
|
124
|
+
}
|
|
161
125
|
return id;
|
|
162
126
|
};
|
|
163
|
-
|
|
164
127
|
(0, _react.useEffect)(function () {
|
|
165
128
|
if (Array.isArray(fileList)) {
|
|
166
129
|
setfileListState(fileList.map(function (item) {
|
|
167
130
|
var _a, _b, _c;
|
|
168
|
-
|
|
169
131
|
var temp = Object.assign({}, item);
|
|
170
132
|
temp.url = getImgUrl((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id);
|
|
171
133
|
return temp;
|
|
172
|
-
}));
|
|
173
|
-
|
|
174
|
-
var imagelist = [];
|
|
175
|
-
|
|
134
|
+
}));
|
|
135
|
+
// 只有图片的才可以预览,这边需要判断是否是图片
|
|
136
|
+
var imagelist = [];
|
|
137
|
+
// 只能通过后缀来判断
|
|
176
138
|
fileList.map(function (item) {
|
|
177
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/
|
|
178
|
-
return
|
|
179
|
-
while (1) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
case 1:
|
|
187
|
-
case "end":
|
|
188
|
-
return _context.stop();
|
|
189
|
-
}
|
|
139
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee() {
|
|
140
|
+
return _regenerator().w(function (_context) {
|
|
141
|
+
while (1) switch (_context.n) {
|
|
142
|
+
case 0:
|
|
143
|
+
if (getExt(item.type) === 'image') {
|
|
144
|
+
imagelist.push(item);
|
|
145
|
+
}
|
|
146
|
+
case 1:
|
|
147
|
+
return _context.a(2);
|
|
190
148
|
}
|
|
191
149
|
}, _callee);
|
|
192
150
|
}));
|
|
@@ -200,21 +158,16 @@ var HJYUpload = function HJYUpload(props) {
|
|
|
200
158
|
data: postData,
|
|
201
159
|
onChange: function onChange(info) {
|
|
202
160
|
setfileListState(info.fileList);
|
|
203
|
-
|
|
204
161
|
if (info.file.response && info.file.response.message) {
|
|
205
|
-
|
|
162
|
+
_antd.message.error(info.file.response.message || '上传失败!');
|
|
206
163
|
}
|
|
207
|
-
|
|
208
164
|
var copyfileListState = _toConsumableArray(info.fileList);
|
|
209
|
-
|
|
210
165
|
if (info.file.status !== 'uploading') {
|
|
211
166
|
copyfileListState = copyfileListState.filter(function (item) {
|
|
212
167
|
var _a, _b;
|
|
213
|
-
|
|
214
168
|
if (item.uid !== info.file.uid) {
|
|
215
169
|
return true;
|
|
216
170
|
}
|
|
217
|
-
|
|
218
171
|
if (Array.isArray((_a = item === null || item === void 0 ? void 0 : item.response) === null || _a === void 0 ? void 0 : _a.data) && ((_b = item.response.data[0]) === null || _b === void 0 ? void 0 : _b.id)) {
|
|
219
172
|
return true;
|
|
220
173
|
} else {
|
|
@@ -223,7 +176,6 @@ var HJYUpload = function HJYUpload(props) {
|
|
|
223
176
|
});
|
|
224
177
|
setfileListState(copyfileListState);
|
|
225
178
|
}
|
|
226
|
-
|
|
227
179
|
if (props === null || props === void 0 ? void 0 : props.onChange) {
|
|
228
180
|
props.onChange({
|
|
229
181
|
file: info.file,
|
|
@@ -232,183 +184,153 @@ var HJYUpload = function HJYUpload(props) {
|
|
|
232
184
|
}
|
|
233
185
|
},
|
|
234
186
|
onPreview: function onPreview(file) {
|
|
235
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/
|
|
236
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, imageIndex, res;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (!(props.listType === 'picture-card')) {
|
|
243
|
-
_context2.next = 26;
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
_context2.t0 = getExt(file.type);
|
|
248
|
-
_context2.next = _context2.t0 === 'image' ? 4 : _context2.t0 === 'pdf' ? 8 : _context2.t0 === 'document' ? 10 : 25;
|
|
249
|
-
break;
|
|
250
|
-
|
|
251
|
-
case 4:
|
|
252
|
-
imageIndex = imageList.map(function (item) {
|
|
253
|
-
return item.uid;
|
|
254
|
-
}).indexOf(file.uid);
|
|
255
|
-
viewer === null || viewer === void 0 ? void 0 : viewer.update();
|
|
256
|
-
viewer === null || viewer === void 0 ? void 0 : viewer.view(imageIndex);
|
|
257
|
-
return _context2.abrupt("break", 26);
|
|
258
|
-
|
|
259
|
-
case 8:
|
|
260
|
-
if (previewMode === null || previewMode === void 0 ? void 0 : previewMode.includes('pdf')) {
|
|
261
|
-
window.open(getUrl((_c = (_b = (_a = file === null || file === void 0 ? void 0 : file.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id));
|
|
262
|
-
} else {
|
|
263
|
-
downloadFile(file);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
return _context2.abrupt("break", 26);
|
|
267
|
-
|
|
268
|
-
case 10:
|
|
269
|
-
if (!(previewMode === null || previewMode === void 0 ? void 0 : previewMode.includes('document'))) {
|
|
270
|
-
_context2.next = 23;
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
_context2.prev = 11;
|
|
275
|
-
_context2.next = 14;
|
|
276
|
-
return _requestUtil["default"].get("/cloudFile/common/downloadPdfFile?id=".concat((_f = (_e = (_d = file === null || file === void 0 ? void 0 : file.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.id, "&openmode=inline"), {});
|
|
277
|
-
|
|
278
|
-
case 14:
|
|
279
|
-
res = _context2.sent;
|
|
280
|
-
|
|
281
|
-
if (res) {
|
|
282
|
-
window.open("/cloudFile/common/downloadPdfFile?id=".concat((_j = (_h = (_g = file === null || file === void 0 ? void 0 : file.response) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.id, "&openmode=inline"));
|
|
283
|
-
} else {
|
|
284
|
-
downloadFile(file);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
_context2.next = 21;
|
|
187
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee2() {
|
|
188
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, imageIndex, hied, res, _t, _t2;
|
|
189
|
+
return _regenerator().w(function (_context2) {
|
|
190
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
191
|
+
case 0:
|
|
192
|
+
if (!(props.listType === 'picture-card' || props.defaultPreview)) {
|
|
193
|
+
_context2.n = 11;
|
|
288
194
|
break;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
195
|
+
}
|
|
196
|
+
_t = getExt(file.type);
|
|
197
|
+
_context2.n = _t === 'image' ? 1 : _t === 'pdf' ? 2 : _t === 'document' ? 3 : 10;
|
|
198
|
+
break;
|
|
199
|
+
case 1:
|
|
200
|
+
imageIndex = imageList.map(function (item) {
|
|
201
|
+
return item.uid;
|
|
202
|
+
}).indexOf(file.uid);
|
|
203
|
+
viewer === null || viewer === void 0 ? void 0 : viewer.update();
|
|
204
|
+
viewer === null || viewer === void 0 ? void 0 : viewer.view(imageIndex);
|
|
205
|
+
return _context2.a(3, 11);
|
|
206
|
+
case 2:
|
|
207
|
+
if (previewMode === null || previewMode === void 0 ? void 0 : previewMode.includes('pdf')) {
|
|
208
|
+
window.open(getUrl((_c = (_b = (_a = file === null || file === void 0 ? void 0 : file.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id));
|
|
209
|
+
} else {
|
|
293
210
|
downloadFile(file);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
211
|
+
}
|
|
212
|
+
return _context2.a(3, 11);
|
|
213
|
+
case 3:
|
|
214
|
+
if (!(previewMode === null || previewMode === void 0 ? void 0 : previewMode.includes('document'))) {
|
|
215
|
+
_context2.n = 8;
|
|
297
216
|
break;
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
217
|
+
}
|
|
218
|
+
_context2.p = 4;
|
|
219
|
+
hied = _antd.message.loading('下载中...', 0);
|
|
220
|
+
_context2.n = 5;
|
|
221
|
+
return _requestUtil["default"].get("".concat(downloadPdfFileUrl, "?id=").concat((_f = (_e = (_d = file === null || file === void 0 ? void 0 : file.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.id, "&openmode=inline&token=").concat(token), {});
|
|
222
|
+
case 5:
|
|
223
|
+
res = _context2.v;
|
|
224
|
+
if (res) {
|
|
225
|
+
hied();
|
|
226
|
+
window.open("".concat(downloadPdfFileUrl, "?id=").concat((_j = (_h = (_g = file === null || file === void 0 ? void 0 : file.response) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.id, "&openmode=inline&token=").concat(token));
|
|
227
|
+
} else {
|
|
307
228
|
downloadFile(file);
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
229
|
+
}
|
|
230
|
+
_context2.n = 7;
|
|
231
|
+
break;
|
|
232
|
+
case 6:
|
|
233
|
+
_context2.p = 6;
|
|
234
|
+
_t2 = _context2.v;
|
|
235
|
+
downloadFile(file);
|
|
236
|
+
case 7:
|
|
237
|
+
_context2.n = 9;
|
|
238
|
+
break;
|
|
239
|
+
case 8:
|
|
240
|
+
downloadFile(file);
|
|
241
|
+
case 9:
|
|
242
|
+
return _context2.a(3, 11);
|
|
243
|
+
case 10:
|
|
244
|
+
// 下载文件
|
|
245
|
+
downloadFile(file);
|
|
246
|
+
case 11:
|
|
247
|
+
if (props === null || props === void 0 ? void 0 : props.onPreview) props.onPreview(file);
|
|
248
|
+
case 12:
|
|
249
|
+
return _context2.a(2);
|
|
316
250
|
}
|
|
317
|
-
}, _callee2, null, [[
|
|
251
|
+
}, _callee2, null, [[4, 6]]);
|
|
318
252
|
}));
|
|
319
253
|
},
|
|
320
254
|
previewFile: function previewFile(file) {
|
|
321
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/
|
|
322
|
-
return
|
|
323
|
-
while (1) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
resolve("/".concat(file.name));
|
|
340
|
-
}
|
|
341
|
-
}));
|
|
342
|
-
|
|
343
|
-
case 1:
|
|
344
|
-
case "end":
|
|
345
|
-
return _context3.stop();
|
|
346
|
-
}
|
|
255
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee3() {
|
|
256
|
+
return _regenerator().w(function (_context3) {
|
|
257
|
+
while (1) switch (_context3.n) {
|
|
258
|
+
case 0:
|
|
259
|
+
return _context3.a(2, new Promise(function (resolve, reject) {
|
|
260
|
+
if (getExt(file.type) === 'image') {
|
|
261
|
+
var reader = new FileReader();
|
|
262
|
+
reader.readAsDataURL(file);
|
|
263
|
+
reader.onload = function () {
|
|
264
|
+
return resolve(reader.result);
|
|
265
|
+
};
|
|
266
|
+
reader.onerror = function (error) {
|
|
267
|
+
return reject(error);
|
|
268
|
+
};
|
|
269
|
+
} else {
|
|
270
|
+
resolve("/".concat(file.name));
|
|
271
|
+
}
|
|
272
|
+
}));
|
|
347
273
|
}
|
|
348
274
|
}, _callee3);
|
|
349
275
|
}));
|
|
350
276
|
},
|
|
351
277
|
beforeUpload: function beforeUpload(file, afterfileListState) {
|
|
352
|
-
var unit = (props === null || props === void 0 ? void 0 : props.remindUnit) ? props === null || props === void 0 ? void 0 : props.remindUnit : props.listType === 'picture-card' ? '张' : '个';
|
|
353
|
-
|
|
278
|
+
var unit = (props === null || props === void 0 ? void 0 : props.remindUnit) ? props === null || props === void 0 ? void 0 : props.remindUnit : props.listType === 'picture-card' ? '张' : '个';
|
|
279
|
+
// 限制文件大小
|
|
354
280
|
if (maxFileSize && typeof maxFileSize === 'number') {
|
|
355
281
|
var limit = file.size < maxFileSize;
|
|
356
|
-
|
|
357
282
|
if (!limit) {
|
|
358
283
|
debouncedMessage("\u8BF7\u4E0A\u4F20".concat(maxFileSize / 1024 / 1024, "M\u4EE5\u5185\u7684\u6587\u4EF6"));
|
|
359
|
-
return
|
|
284
|
+
return _antd.Upload.LIST_IGNORE;
|
|
360
285
|
}
|
|
361
286
|
}
|
|
362
|
-
|
|
363
287
|
if (typeof props.maxCount === 'number' && afterfileListState.length + fileListState.length > props.maxCount) {
|
|
364
288
|
// 减少提示错误次数, 思路,防抖 这边有个问题 就是防抖的这个方法 return fasle 不上传
|
|
365
289
|
debouncedMessage("\u6700\u591A\u4E0A\u4F20".concat(props.maxCount).concat(unit));
|
|
366
|
-
return
|
|
290
|
+
return _antd.Upload.LIST_IGNORE;
|
|
367
291
|
}
|
|
368
|
-
|
|
369
292
|
if (props === null || props === void 0 ? void 0 : props.beforeUpload) {
|
|
370
293
|
return props.beforeUpload(file, afterfileListState);
|
|
371
294
|
}
|
|
372
|
-
|
|
373
295
|
return true;
|
|
374
296
|
},
|
|
375
297
|
showUploadList: {
|
|
376
298
|
showRemoveIcon: !viewMode
|
|
377
299
|
},
|
|
378
300
|
headers: {
|
|
379
|
-
access_token:
|
|
380
|
-
Authorization: 'Bearer ' +
|
|
301
|
+
access_token: token,
|
|
302
|
+
Authorization: 'Bearer ' + token
|
|
381
303
|
}
|
|
382
304
|
}), rest);
|
|
383
|
-
|
|
384
305
|
var getSrc = function getSrc(item) {
|
|
385
|
-
var _a, _b, _c, _d, _e, _f;
|
|
386
|
-
|
|
306
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
307
|
+
var id = item.thumbUrl;
|
|
387
308
|
if (Array.isArray((_a = item === null || item === void 0 ? void 0 : item.response) === null || _a === void 0 ? void 0 : _a.data) && ((_b = item.response.data[0]) === null || _b === void 0 ? void 0 : _b.id)) {
|
|
388
|
-
|
|
389
|
-
|
|
309
|
+
id = (_c = item.response.data[0]) === null || _c === void 0 ? void 0 : _c.id;
|
|
310
|
+
if (id && !id.startsWith('http') && !id.startsWith('/cloud')) {
|
|
311
|
+
id = "".concat(window.apiPrefix ? "".concat(window.apiPrefix).concat(downLoadURL) : downLoadURL).concat((_e = (_d = item === null || item === void 0 ? void 0 : item.response) === null || _d === void 0 ? void 0 : _d.data[0]) === null || _e === void 0 ? void 0 : _e.id);
|
|
312
|
+
} else {
|
|
313
|
+
id = "".concat((_g = (_f = item === null || item === void 0 ? void 0 : item.response) === null || _f === void 0 ? void 0 : _f.data[0]) === null || _g === void 0 ? void 0 : _g.id);
|
|
314
|
+
}
|
|
315
|
+
if (id === null || id === void 0 ? void 0 : id.includes('?')) {
|
|
316
|
+
id = "".concat(id, "&openmode=inline&token=").concat(token);
|
|
317
|
+
} else {
|
|
318
|
+
id = "".concat(id, "?openmode=inline&token=").concat(token);
|
|
390
319
|
}
|
|
391
|
-
|
|
392
|
-
return "".concat(window.apiPrefix ? "".concat(window.apiPrefix).concat(downLoadURL) : downLoadURL).concat((_f = (_e = item === null || item === void 0 ? void 0 : item.response) === null || _e === void 0 ? void 0 : _e.data[0]) === null || _f === void 0 ? void 0 : _f.id, "&openmode=inline");
|
|
393
320
|
}
|
|
394
|
-
|
|
395
|
-
return item.thumbUrl;
|
|
321
|
+
return id;
|
|
396
322
|
};
|
|
397
|
-
|
|
398
323
|
var getUrl = function getUrl(uuid) {
|
|
399
324
|
if (uuid.includes('/')) {
|
|
400
325
|
return uuid;
|
|
401
326
|
}
|
|
402
|
-
|
|
403
|
-
return "".concat(window.apiPrefix ? "".concat(window.apiPrefix).concat(downLoadURL) : downLoadURL).concat(uuid, "&openmode=inline");
|
|
327
|
+
return "".concat(window.apiPrefix ? "".concat(window.apiPrefix).concat(downLoadURL) : downLoadURL).concat(uuid, "&openmode=inline&token=").concat(token);
|
|
404
328
|
};
|
|
405
|
-
|
|
406
329
|
var downloadFile = function downloadFile(file) {
|
|
407
330
|
var url = getSrc(file);
|
|
408
331
|
url && _requestUtil["default"].downloadFileName(url, file.name);
|
|
409
332
|
};
|
|
410
|
-
|
|
411
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_upload["default"], Object.assign({}, uploadProps), typeof props.maxCount === 'number' && fileListState.length >= props.maxCount || viewMode ? null : uplaodBtn()), props.listType === 'picture-card' ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
333
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_antd.Upload, Object.assign({}, uploadProps), typeof props.maxCount === 'number' && fileListState.length >= props.maxCount || viewMode ? null : uplaodBtn()), props.listType === 'picture-card' || props.defaultPreview ? (/*#__PURE__*/_react["default"].createElement("div", {
|
|
412
334
|
style: {
|
|
413
335
|
display: 'none'
|
|
414
336
|
}
|
|
@@ -421,9 +343,8 @@ var HJYUpload = function HJYUpload(props) {
|
|
|
421
343
|
src: getSrc(item),
|
|
422
344
|
alt: item.name
|
|
423
345
|
}));
|
|
424
|
-
}))) : null);
|
|
346
|
+
})))) : null);
|
|
425
347
|
};
|
|
426
|
-
|
|
427
348
|
var getExt = function getExt(type) {
|
|
428
349
|
if (type === null || type === void 0 ? void 0 : type.includes('image')) return 'image';
|
|
429
350
|
if (type === null || type === void 0 ? void 0 : type.includes('pdf')) return 'pdf';
|
|
@@ -431,7 +352,6 @@ var getExt = function getExt(type) {
|
|
|
431
352
|
if (type === null || type === void 0 ? void 0 : type.includes('word')) return 'document';
|
|
432
353
|
return 'undefined';
|
|
433
354
|
};
|
|
434
|
-
|
|
435
355
|
HJYUpload.defaultProps = {
|
|
436
356
|
action: "/cloudFile/common/uploadFile",
|
|
437
357
|
downLoadURL: '/cloudFile/common/downloadFile?id=',
|
|
@@ -440,6 +360,5 @@ HJYUpload.defaultProps = {
|
|
|
440
360
|
maxFileSize: 20 * 1024 * 1024
|
|
441
361
|
};
|
|
442
362
|
HJYUpload.displayName = 'HJYUpload';
|
|
443
|
-
var _default = HJYUpload;
|
|
444
|
-
exports["default"] = _default;
|
|
363
|
+
var _default = exports["default"] = HJYUpload;
|
|
445
364
|
//# sourceMappingURL=upload.js.map
|