@vortex-ui/env-puzzle 2.0.0-beta.9 → 3.0.0-beta.1
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.js +150 -288
- 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 +2 -0
- package/lib/import-modal/import-modal.js +133 -192
- 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 +141 -215
- 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.js +22 -54
- package/lib/table/table.js.map +1 -1
- package/lib/template/action.d.ts +3 -1
- package/lib/template/action.js +80 -116
- package/lib/template/action.js.map +1 -1
- package/lib/template/card-table.d.ts +4 -4
- 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 +0 -1
- 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 +64 -95
- 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 +5 -4
- package/lib/template/table.js +21 -43
- package/lib/template/table.js.map +1 -1
- package/lib/template/template.d.ts +3 -3
- 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 +52 -56
- package/lib/template/toolbar.js.map +1 -1
- package/lib/to-map/container.js +48 -95
- package/lib/to-map/container.js.map +1 -1
- package/lib/to-map/draw-area.js +12 -32
- 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 +20 -47
- 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 +3 -0
- package/lib/upload/upload.js +158 -237
- 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.js +60 -73
- 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.js +28 -75
- 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,41 @@
|
|
|
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
10
|
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
15
|
-
|
|
16
11
|
var _message = _interopRequireDefault(require("antd/lib/message"));
|
|
17
|
-
|
|
18
12
|
var _upload = _interopRequireDefault(require("antd/lib/upload"));
|
|
19
|
-
|
|
20
13
|
var _icons = require("@ant-design/icons");
|
|
21
|
-
|
|
22
14
|
var _ahooks = require("ahooks");
|
|
23
|
-
|
|
24
15
|
var _requestUtil = _interopRequireDefault(require("../utils/request-util"));
|
|
25
|
-
|
|
26
|
-
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
|
27
|
-
|
|
16
|
+
var _debounce = _interopRequireDefault(require("lodash-es/debounce"));
|
|
28
17
|
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
|
-
|
|
18
|
+
var _stringUtil = _interopRequireDefault(require("../utils/string-util"));
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
20
|
+
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); }
|
|
21
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
38
22
|
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
|
-
|
|
23
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
24
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
25
|
+
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 }; })(); }
|
|
26
|
+
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); }
|
|
27
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
48
28
|
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
|
-
|
|
29
|
+
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; } }
|
|
30
|
+
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; }
|
|
31
|
+
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; } }
|
|
32
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
58
33
|
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
59
34
|
function adopt(value) {
|
|
60
35
|
return value instanceof P ? value : new P(function (resolve) {
|
|
61
36
|
resolve(value);
|
|
62
37
|
});
|
|
63
38
|
}
|
|
64
|
-
|
|
65
39
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
66
40
|
function fulfilled(value) {
|
|
67
41
|
try {
|
|
@@ -70,7 +44,6 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
|
|
|
70
44
|
reject(e);
|
|
71
45
|
}
|
|
72
46
|
}
|
|
73
|
-
|
|
74
47
|
function rejected(value) {
|
|
75
48
|
try {
|
|
76
49
|
step(generator["throw"](value));
|
|
@@ -78,115 +51,102 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
|
|
|
78
51
|
reject(e);
|
|
79
52
|
}
|
|
80
53
|
}
|
|
81
|
-
|
|
82
54
|
function step(result) {
|
|
83
55
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
84
56
|
}
|
|
85
|
-
|
|
86
57
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
87
58
|
});
|
|
88
59
|
};
|
|
89
|
-
|
|
90
60
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
91
61
|
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
|
-
|
|
62
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
97
63
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
98
64
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
99
65
|
}
|
|
100
66
|
return t;
|
|
101
67
|
};
|
|
102
|
-
|
|
103
|
-
var debouncedMessage = (0, _lodash["default"])(function (msg) {
|
|
68
|
+
var debouncedMessage = (0, _debounce["default"])(function (msg) {
|
|
104
69
|
_message["default"].error(msg);
|
|
105
70
|
}, 500);
|
|
106
|
-
|
|
71
|
+
var systemToken = (0, _utils.getUrlParam)('token') || _stringUtil["default"].getSystemInfo('token');
|
|
107
72
|
var HJYUpload = function HJYUpload(props) {
|
|
73
|
+
var token = props.token || systemToken;
|
|
108
74
|
var _useState = (0, _react.useState)([]),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
75
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
76
|
+
fileListState = _useState2[0],
|
|
77
|
+
setfileListState = _useState2[1];
|
|
113
78
|
var _useState3 = (0, _react.useState)([]),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
79
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
80
|
+
imageList = _useState4[0],
|
|
81
|
+
setImageList = _useState4[1];
|
|
118
82
|
var _useState5 = (0, _react.useState)(null),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
83
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
84
|
+
viewer = _useState6[0],
|
|
85
|
+
setViewer = _useState6[1];
|
|
123
86
|
var viewerRef = (0, _react.useRef)(null);
|
|
124
|
-
|
|
125
87
|
var _props$postData = props.postData,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
88
|
+
postData = _props$postData === void 0 ? {} : _props$postData,
|
|
89
|
+
fileList = props.fileList,
|
|
90
|
+
viewMode = props.viewMode,
|
|
91
|
+
previewMode = props.previewMode,
|
|
92
|
+
maxFileSize = props.maxFileSize,
|
|
93
|
+
downLoadURL = props.downLoadURL,
|
|
94
|
+
action = props.action,
|
|
95
|
+
_props$downloadPdfFil = props.downloadPdfFileUrl,
|
|
96
|
+
downloadPdfFileUrl = _props$downloadPdfFil === void 0 ? '/cloudFile/common/downloadPdfFile' : _props$downloadPdfFil,
|
|
97
|
+
rest = __rest(props, ["postData", "fileList", "viewMode", "previewMode", "maxFileSize", "downLoadURL", "action", "downloadPdfFileUrl"]);
|
|
135
98
|
(0, _ahooks.useMount)(function () {
|
|
136
99
|
if (viewerRef === null || viewerRef === void 0 ? void 0 : viewerRef.current) {
|
|
137
100
|
var _viewer = new _viewerjs["default"](viewerRef.current, {});
|
|
138
|
-
|
|
139
101
|
setViewer(_viewer);
|
|
140
102
|
}
|
|
141
103
|
});
|
|
142
104
|
(0, _ahooks.useUnmount)(function () {
|
|
143
105
|
viewer === null || viewer === void 0 ? void 0 : viewer.destroy();
|
|
144
106
|
});
|
|
145
|
-
|
|
146
107
|
var uplaodBtn = function uplaodBtn() {
|
|
147
108
|
if (props.listType === 'picture-card') {
|
|
148
109
|
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
110
|
}
|
|
150
|
-
|
|
151
111
|
return /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
152
112
|
icon: /*#__PURE__*/_react["default"].createElement(_icons.UploadOutlined, null)
|
|
153
113
|
}, "\u4E0A\u4F20");
|
|
154
114
|
};
|
|
155
|
-
|
|
156
115
|
var getImgUrl = function getImgUrl(id) {
|
|
157
116
|
if (id && !id.startsWith('http') && !id.startsWith('/cloud')) {
|
|
158
117
|
id = (window.apiPrefix ? "".concat(window.apiPrefix).concat(downLoadURL) : downLoadURL) + id;
|
|
159
118
|
}
|
|
160
|
-
|
|
119
|
+
if (id === null || id === void 0 ? void 0 : id.includes('token=')) {
|
|
120
|
+
return id;
|
|
121
|
+
}
|
|
122
|
+
if (id === null || id === void 0 ? void 0 : id.includes('?')) {
|
|
123
|
+
id = "".concat(id, "&token=").concat(token);
|
|
124
|
+
} else {
|
|
125
|
+
id = "".concat(id, "?token=").concat(token);
|
|
126
|
+
}
|
|
161
127
|
return id;
|
|
162
128
|
};
|
|
163
|
-
|
|
164
129
|
(0, _react.useEffect)(function () {
|
|
165
130
|
if (Array.isArray(fileList)) {
|
|
166
131
|
setfileListState(fileList.map(function (item) {
|
|
167
132
|
var _a, _b, _c;
|
|
168
|
-
|
|
169
133
|
var temp = Object.assign({}, item);
|
|
170
134
|
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
135
|
return temp;
|
|
172
|
-
}));
|
|
173
|
-
|
|
174
|
-
var imagelist = [];
|
|
175
|
-
|
|
136
|
+
}));
|
|
137
|
+
// 只有图片的才可以预览,这边需要判断是否是图片
|
|
138
|
+
var imagelist = [];
|
|
139
|
+
// 只能通过后缀来判断
|
|
176
140
|
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
|
-
}
|
|
141
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee() {
|
|
142
|
+
return _regenerator().w(function (_context) {
|
|
143
|
+
while (1) switch (_context.n) {
|
|
144
|
+
case 0:
|
|
145
|
+
if (getExt(item.type) === 'image') {
|
|
146
|
+
imagelist.push(item);
|
|
147
|
+
}
|
|
148
|
+
case 1:
|
|
149
|
+
return _context.a(2);
|
|
190
150
|
}
|
|
191
151
|
}, _callee);
|
|
192
152
|
}));
|
|
@@ -200,21 +160,16 @@ var HJYUpload = function HJYUpload(props) {
|
|
|
200
160
|
data: postData,
|
|
201
161
|
onChange: function onChange(info) {
|
|
202
162
|
setfileListState(info.fileList);
|
|
203
|
-
|
|
204
163
|
if (info.file.response && info.file.response.message) {
|
|
205
164
|
_message["default"].error(info.file.response.message || '上传失败!');
|
|
206
165
|
}
|
|
207
|
-
|
|
208
166
|
var copyfileListState = _toConsumableArray(info.fileList);
|
|
209
|
-
|
|
210
167
|
if (info.file.status !== 'uploading') {
|
|
211
168
|
copyfileListState = copyfileListState.filter(function (item) {
|
|
212
169
|
var _a, _b;
|
|
213
|
-
|
|
214
170
|
if (item.uid !== info.file.uid) {
|
|
215
171
|
return true;
|
|
216
172
|
}
|
|
217
|
-
|
|
218
173
|
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
174
|
return true;
|
|
220
175
|
} else {
|
|
@@ -223,7 +178,6 @@ var HJYUpload = function HJYUpload(props) {
|
|
|
223
178
|
});
|
|
224
179
|
setfileListState(copyfileListState);
|
|
225
180
|
}
|
|
226
|
-
|
|
227
181
|
if (props === null || props === void 0 ? void 0 : props.onChange) {
|
|
228
182
|
props.onChange({
|
|
229
183
|
file: info.file,
|
|
@@ -232,183 +186,153 @@ var HJYUpload = function HJYUpload(props) {
|
|
|
232
186
|
}
|
|
233
187
|
},
|
|
234
188
|
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;
|
|
189
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee2() {
|
|
190
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, imageIndex, hied, res, _t, _t2;
|
|
191
|
+
return _regenerator().w(function (_context2) {
|
|
192
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
193
|
+
case 0:
|
|
194
|
+
if (!(props.listType === 'picture-card' || props.defaultPreview)) {
|
|
195
|
+
_context2.n = 11;
|
|
288
196
|
break;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
197
|
+
}
|
|
198
|
+
_t = getExt(file.type);
|
|
199
|
+
_context2.n = _t === 'image' ? 1 : _t === 'pdf' ? 2 : _t === 'document' ? 3 : 10;
|
|
200
|
+
break;
|
|
201
|
+
case 1:
|
|
202
|
+
imageIndex = imageList.map(function (item) {
|
|
203
|
+
return item.uid;
|
|
204
|
+
}).indexOf(file.uid);
|
|
205
|
+
viewer === null || viewer === void 0 ? void 0 : viewer.update();
|
|
206
|
+
viewer === null || viewer === void 0 ? void 0 : viewer.view(imageIndex);
|
|
207
|
+
return _context2.a(3, 11);
|
|
208
|
+
case 2:
|
|
209
|
+
if (previewMode === null || previewMode === void 0 ? void 0 : previewMode.includes('pdf')) {
|
|
210
|
+
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));
|
|
211
|
+
} else {
|
|
293
212
|
downloadFile(file);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
213
|
+
}
|
|
214
|
+
return _context2.a(3, 11);
|
|
215
|
+
case 3:
|
|
216
|
+
if (!(previewMode === null || previewMode === void 0 ? void 0 : previewMode.includes('document'))) {
|
|
217
|
+
_context2.n = 8;
|
|
297
218
|
break;
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
219
|
+
}
|
|
220
|
+
_context2.p = 4;
|
|
221
|
+
hied = _message["default"].loading('下载中...', 0);
|
|
222
|
+
_context2.n = 5;
|
|
223
|
+
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), {});
|
|
224
|
+
case 5:
|
|
225
|
+
res = _context2.v;
|
|
226
|
+
if (res) {
|
|
227
|
+
hied();
|
|
228
|
+
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));
|
|
229
|
+
} else {
|
|
307
230
|
downloadFile(file);
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
231
|
+
}
|
|
232
|
+
_context2.n = 7;
|
|
233
|
+
break;
|
|
234
|
+
case 6:
|
|
235
|
+
_context2.p = 6;
|
|
236
|
+
_t2 = _context2.v;
|
|
237
|
+
downloadFile(file);
|
|
238
|
+
case 7:
|
|
239
|
+
_context2.n = 9;
|
|
240
|
+
break;
|
|
241
|
+
case 8:
|
|
242
|
+
downloadFile(file);
|
|
243
|
+
case 9:
|
|
244
|
+
return _context2.a(3, 11);
|
|
245
|
+
case 10:
|
|
246
|
+
// 下载文件
|
|
247
|
+
downloadFile(file);
|
|
248
|
+
case 11:
|
|
249
|
+
if (props === null || props === void 0 ? void 0 : props.onPreview) props.onPreview(file);
|
|
250
|
+
case 12:
|
|
251
|
+
return _context2.a(2);
|
|
316
252
|
}
|
|
317
|
-
}, _callee2, null, [[
|
|
253
|
+
}, _callee2, null, [[4, 6]]);
|
|
318
254
|
}));
|
|
319
255
|
},
|
|
320
256
|
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
|
-
}
|
|
257
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee3() {
|
|
258
|
+
return _regenerator().w(function (_context3) {
|
|
259
|
+
while (1) switch (_context3.n) {
|
|
260
|
+
case 0:
|
|
261
|
+
return _context3.a(2, new Promise(function (resolve, reject) {
|
|
262
|
+
if (getExt(file.type) === 'image') {
|
|
263
|
+
var reader = new FileReader();
|
|
264
|
+
reader.readAsDataURL(file);
|
|
265
|
+
reader.onload = function () {
|
|
266
|
+
return resolve(reader.result);
|
|
267
|
+
};
|
|
268
|
+
reader.onerror = function (error) {
|
|
269
|
+
return reject(error);
|
|
270
|
+
};
|
|
271
|
+
} else {
|
|
272
|
+
resolve("/".concat(file.name));
|
|
273
|
+
}
|
|
274
|
+
}));
|
|
347
275
|
}
|
|
348
276
|
}, _callee3);
|
|
349
277
|
}));
|
|
350
278
|
},
|
|
351
279
|
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
|
-
|
|
280
|
+
var unit = (props === null || props === void 0 ? void 0 : props.remindUnit) ? props === null || props === void 0 ? void 0 : props.remindUnit : props.listType === 'picture-card' ? '张' : '个';
|
|
281
|
+
// 限制文件大小
|
|
354
282
|
if (maxFileSize && typeof maxFileSize === 'number') {
|
|
355
283
|
var limit = file.size < maxFileSize;
|
|
356
|
-
|
|
357
284
|
if (!limit) {
|
|
358
285
|
debouncedMessage("\u8BF7\u4E0A\u4F20".concat(maxFileSize / 1024 / 1024, "M\u4EE5\u5185\u7684\u6587\u4EF6"));
|
|
359
286
|
return _upload["default"].LIST_IGNORE;
|
|
360
287
|
}
|
|
361
288
|
}
|
|
362
|
-
|
|
363
289
|
if (typeof props.maxCount === 'number' && afterfileListState.length + fileListState.length > props.maxCount) {
|
|
364
290
|
// 减少提示错误次数, 思路,防抖 这边有个问题 就是防抖的这个方法 return fasle 不上传
|
|
365
291
|
debouncedMessage("\u6700\u591A\u4E0A\u4F20".concat(props.maxCount).concat(unit));
|
|
366
292
|
return _upload["default"].LIST_IGNORE;
|
|
367
293
|
}
|
|
368
|
-
|
|
369
294
|
if (props === null || props === void 0 ? void 0 : props.beforeUpload) {
|
|
370
295
|
return props.beforeUpload(file, afterfileListState);
|
|
371
296
|
}
|
|
372
|
-
|
|
373
297
|
return true;
|
|
374
298
|
},
|
|
375
299
|
showUploadList: {
|
|
376
300
|
showRemoveIcon: !viewMode
|
|
377
301
|
},
|
|
378
302
|
headers: {
|
|
379
|
-
access_token:
|
|
380
|
-
Authorization: 'Bearer ' +
|
|
303
|
+
access_token: token,
|
|
304
|
+
Authorization: 'Bearer ' + token
|
|
381
305
|
}
|
|
382
306
|
}), rest);
|
|
383
|
-
|
|
384
307
|
var getSrc = function getSrc(item) {
|
|
385
|
-
var _a, _b, _c, _d, _e, _f;
|
|
386
|
-
|
|
308
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
309
|
+
var id = item.thumbUrl;
|
|
387
310
|
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
|
-
|
|
311
|
+
id = (_c = item.response.data[0]) === null || _c === void 0 ? void 0 : _c.id;
|
|
312
|
+
if (id && !id.startsWith('http') && !id.startsWith('/cloud')) {
|
|
313
|
+
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);
|
|
314
|
+
} else {
|
|
315
|
+
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);
|
|
316
|
+
}
|
|
317
|
+
if (id === null || id === void 0 ? void 0 : id.includes('?')) {
|
|
318
|
+
id = "".concat(id, "&openmode=inline&token=").concat(token);
|
|
319
|
+
} else {
|
|
320
|
+
id = "".concat(id, "?openmode=inline&token=").concat(token);
|
|
390
321
|
}
|
|
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
322
|
}
|
|
394
|
-
|
|
395
|
-
return item.thumbUrl;
|
|
323
|
+
return id;
|
|
396
324
|
};
|
|
397
|
-
|
|
398
325
|
var getUrl = function getUrl(uuid) {
|
|
399
326
|
if (uuid.includes('/')) {
|
|
400
327
|
return uuid;
|
|
401
328
|
}
|
|
402
|
-
|
|
403
|
-
return "".concat(window.apiPrefix ? "".concat(window.apiPrefix).concat(downLoadURL) : downLoadURL).concat(uuid, "&openmode=inline");
|
|
329
|
+
return "".concat(window.apiPrefix ? "".concat(window.apiPrefix).concat(downLoadURL) : downLoadURL).concat(uuid, "&openmode=inline&token=").concat(token);
|
|
404
330
|
};
|
|
405
|
-
|
|
406
331
|
var downloadFile = function downloadFile(file) {
|
|
407
332
|
var url = getSrc(file);
|
|
408
333
|
url && _requestUtil["default"].downloadFileName(url, file.name);
|
|
409
334
|
};
|
|
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", {
|
|
335
|
+
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' || props.defaultPreview ? (/*#__PURE__*/_react["default"].createElement("div", {
|
|
412
336
|
style: {
|
|
413
337
|
display: 'none'
|
|
414
338
|
}
|
|
@@ -421,9 +345,8 @@ var HJYUpload = function HJYUpload(props) {
|
|
|
421
345
|
src: getSrc(item),
|
|
422
346
|
alt: item.name
|
|
423
347
|
}));
|
|
424
|
-
}))) : null);
|
|
348
|
+
})))) : null);
|
|
425
349
|
};
|
|
426
|
-
|
|
427
350
|
var getExt = function getExt(type) {
|
|
428
351
|
if (type === null || type === void 0 ? void 0 : type.includes('image')) return 'image';
|
|
429
352
|
if (type === null || type === void 0 ? void 0 : type.includes('pdf')) return 'pdf';
|
|
@@ -431,7 +354,6 @@ var getExt = function getExt(type) {
|
|
|
431
354
|
if (type === null || type === void 0 ? void 0 : type.includes('word')) return 'document';
|
|
432
355
|
return 'undefined';
|
|
433
356
|
};
|
|
434
|
-
|
|
435
357
|
HJYUpload.defaultProps = {
|
|
436
358
|
action: "/cloudFile/common/uploadFile",
|
|
437
359
|
downLoadURL: '/cloudFile/common/downloadFile?id=',
|
|
@@ -440,6 +362,5 @@ HJYUpload.defaultProps = {
|
|
|
440
362
|
maxFileSize: 20 * 1024 * 1024
|
|
441
363
|
};
|
|
442
364
|
HJYUpload.displayName = 'HJYUpload';
|
|
443
|
-
var _default = HJYUpload;
|
|
444
|
-
exports["default"] = _default;
|
|
365
|
+
var _default = exports["default"] = HJYUpload;
|
|
445
366
|
//# sourceMappingURL=upload.js.map
|