fan-standard-comp 3.2.0 → 3.2.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 +1 -33
- package/dist/09cd8e9be7081f2166444cce393fe968.svg +54 -0
- package/dist/e3378c145b7db195ad068735e15fb28a.svg +165 -0
- package/dist/fan-standard-comp.umd.js +166 -444
- package/dist/fonts/iconfont.ttf +0 -0
- package/dist/fonts/iconfont.woff +0 -0
- package/dist/fonts/lg.ttf +0 -0
- package/dist/fonts/lg.woff +0 -0
- package/dist/fonts/lg.woff2 +0 -0
- package/es/ButtonGroup/ButtonList.d.ts +2 -1
- package/es/ButtonGroup/ButtonMenu.d.ts +2 -1
- package/es/ButtonGroup/PopConfirmTitle.js +5 -5
- package/es/ButtonGroup/index.d.ts +3 -1
- package/es/ButtonGroup/index.js +147 -178
- package/es/ButtonGroup/style/index.less +4 -1
- package/es/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
- package/es/CalendarCoordPicker/CalendarMonthPicker.js +26 -0
- package/es/CalendarCoordPicker/index.d.ts +8 -0
- package/es/CalendarCoordPicker/index.js +296 -0
- package/es/CalendarCoordPicker/index.less +31 -0
- package/es/ConfigContext/index.d.ts +7 -0
- package/es/ConfigContext/index.js +12 -0
- package/es/DragContent/index.d.ts +1 -1
- package/es/DragContent/index.js +5 -5
- package/es/FormComp/ChunkUploader/api.js +14 -14
- package/es/FormComp/ChunkUploader/index.js +132 -139
- package/es/FormComp/ChunkUploader/lib.js +21 -21
- package/es/FormComp/ChunkUploader/upload-queue.class.js +64 -66
- package/es/FormComp/EditButton/index.d.ts +1 -1
- package/es/FormComp/EditButton/index.js +15 -17
- package/es/FormComp/FieldComponent/ReUpload.d.ts +1 -1
- package/es/FormComp/FieldComponent/ReUpload.js +37 -23
- package/es/FormComp/FieldComponent/RefactorTextarea.js +32 -0
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +72 -19
- package/es/FormComp/FieldComponent/TitleNode.d.ts +2 -1
- package/es/FormComp/FieldComponent/index.d.ts +1 -1
- package/es/FormComp/FieldComponent/index.js +33 -23
- package/es/FormComp/FieldComponent/setReadonlyValues.js +6 -6
- package/es/FormComp/RenderItemGroup/index.js +24 -8
- package/es/FormComp/Uploader/index.d.ts +3 -1
- package/es/FormComp/Uploader/index.js +243 -119
- package/es/FormComp/VarTemplate/index.js +57 -64
- package/es/ImageGallery/ImagePreview.d.ts +13 -0
- package/es/ImageGallery/ImagePreview.js +168 -0
- package/es/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
- package/es/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
- package/es/ImageGallery/PreviewStyles/lg-video.css +144 -0
- package/es/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
- package/es/ImageGallery/PreviewStyles/lightgallery.css +728 -0
- package/es/ImageGallery/SliderContent.d.ts +7 -0
- package/es/ImageGallery/SliderContent.js +699 -0
- package/es/ImageGallery/Thumbnail.d.ts +3 -0
- package/es/ImageGallery/Thumbnail.js +296 -0
- package/es/ImageGallery/hook/uniqueId.d.ts +1 -0
- package/es/ImageGallery/hook/uniqueId.js +10 -0
- package/es/ImageGallery/index.d.ts +4 -0
- package/es/ImageGallery/index.js +29 -0
- package/es/ImageGallery/style/index.less +5 -0
- package/es/ImageGallery/types.d.ts +5 -0
- package/es/ImageGallery/types.js +1 -0
- package/es/NavLeafScroll/index.js +94 -50
- package/es/RefactorTree/index.d.ts +1 -1
- package/es/RefactorTree/index.js +6 -6
- package/es/RefactorTree/indexTreeNode.d.ts +1 -1
- package/es/RefactorTree/indexTreeNode.js +19 -17
- package/es/RefactorTree/util.js +18 -18
- package/es/SpecIcon/fonts/demo_index.html +559 -5
- package/es/SpecIcon/fonts/iconfont.css +101 -3
- package/es/SpecIcon/fonts/iconfont.js +34 -27
- package/es/SpecIcon/fonts/iconfont.json +168 -0
- package/es/SpecIcon/fonts/iconfont.svg +163 -171
- package/es/SpecIcon/fonts/iconfont.ttf +0 -0
- package/es/SpecIcon/fonts/iconfont.woff +0 -0
- package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/es/SpecIcon/style/iconfont.less +106 -11
- package/es/SplitterLayout/Pane.d.ts +1 -1
- package/es/SplitterLayout/index.js +25 -26
- package/es/StandardContent/SplitterLayout/Pane.js +3 -3
- package/es/StandardContent/SplitterLayout/index.js +25 -26
- package/es/StandardContent/SubfieldContent.d.ts +1 -1
- package/es/StandardContent/WrapperContent.d.ts +1 -1
- package/es/StandardDragModal/index.d.ts +11 -3
- package/es/StandardDragModal/index.js +25 -3
- package/es/StandardFilter/index.d.ts +5 -16
- package/es/StandardFilter/index.js +212 -200
- package/es/StandardFilter/indexClass.d.ts +37 -0
- package/es/StandardFilter/indexClass.js +217 -0
- package/es/StandardFilter/style/index.less +82 -9
- package/es/StandardForm/StepForm.d.ts +1 -1
- package/es/StandardForm/StepForm.js +28 -22
- package/es/StandardForm/TabForm.d.ts +1 -1
- package/es/StandardForm/TabForm.js +41 -43
- package/es/StandardForm/index.d.ts +1 -1
- package/es/StandardForm/index.js +5 -5
- package/es/StandardModal/UpdateFormRef.js +0 -1
- package/es/StandardModal/index.d.ts +2 -1
- package/es/StandardModal/index.js +25 -39
- package/es/StandardPanel/index.d.ts +1 -1
- package/es/StandardPanel/index.js +7 -7
- package/es/StandardTable/index.d.ts +1 -0
- package/es/StandardTable/index.js +44 -26
- package/es/components/IconNode/index.d.ts +1 -1
- package/es/components/IconNode/index.js +0 -1
- package/es/data/general.config.js +31 -0
- package/es/index.d.ts +3 -1
- package/es/index.js +6 -2
- package/es/utils/filterPermission.js +7 -10
- package/es/utils/getParentNodes.js +101 -26
- package/es/utils/index.js +2 -3
- package/es/utils/urlUtils.js +76 -0
- package/lib/ButtonGroup/ButtonList.d.ts +2 -1
- package/lib/ButtonGroup/ButtonList.js +2 -3
- package/lib/ButtonGroup/ButtonMenu.d.ts +2 -1
- package/lib/ButtonGroup/ButtonMenu.js +2 -3
- package/lib/ButtonGroup/PopConfirmTitle.js +7 -8
- package/lib/ButtonGroup/index.d.ts +3 -1
- package/lib/ButtonGroup/index.js +151 -183
- package/lib/ButtonGroup/style/index.less +4 -1
- package/lib/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
- package/lib/CalendarCoordPicker/CalendarMonthPicker.js +36 -0
- package/lib/CalendarCoordPicker/index.d.ts +8 -0
- package/lib/CalendarCoordPicker/index.js +305 -0
- package/lib/CalendarCoordPicker/index.less +31 -0
- package/lib/ConfigContext/index.d.ts +7 -0
- package/lib/ConfigContext/index.js +17 -0
- package/lib/DragContent/DragBar.js +2 -3
- package/lib/DragContent/index.d.ts +1 -1
- package/lib/DragContent/index.js +9 -10
- package/lib/FormComp/ChunkUploader/api.js +15 -15
- package/lib/FormComp/ChunkUploader/index.js +135 -142
- package/lib/FormComp/ChunkUploader/lib.js +22 -22
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +66 -69
- package/lib/FormComp/ChunkUploader/worker.js +1 -1
- package/lib/FormComp/EditButton/index.d.ts +1 -1
- package/lib/FormComp/EditButton/index.js +19 -22
- package/lib/FormComp/FieldComponent/ReUpload.d.ts +1 -1
- package/lib/FormComp/FieldComponent/ReUpload.js +40 -28
- package/lib/FormComp/FieldComponent/RefactorTextarea.js +42 -0
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +75 -23
- package/lib/FormComp/FieldComponent/TitleNode.d.ts +2 -1
- package/lib/FormComp/FieldComponent/TitleNode.js +2 -3
- package/lib/FormComp/FieldComponent/index.d.ts +1 -1
- package/lib/FormComp/FieldComponent/index.js +38 -26
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +15 -20
- package/lib/FormComp/RenderItemGroup/index.js +26 -11
- package/lib/FormComp/Uploader/index.d.ts +3 -1
- package/lib/FormComp/Uploader/index.js +244 -123
- package/lib/FormComp/VarTemplate/index.js +63 -71
- package/lib/FormComp/index.js +1 -1
- package/lib/ImageGallery/ImagePreview.d.ts +13 -0
- package/lib/ImageGallery/ImagePreview.js +178 -0
- package/lib/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
- package/lib/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
- package/lib/ImageGallery/PreviewStyles/lg-video.css +144 -0
- package/lib/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
- package/lib/ImageGallery/PreviewStyles/lightgallery.css +728 -0
- package/lib/ImageGallery/SliderContent.d.ts +7 -0
- package/lib/ImageGallery/SliderContent.js +708 -0
- package/lib/ImageGallery/Thumbnail.d.ts +3 -0
- package/lib/ImageGallery/Thumbnail.js +306 -0
- package/lib/ImageGallery/hook/uniqueId.d.ts +1 -0
- package/lib/ImageGallery/hook/uniqueId.js +17 -0
- package/lib/ImageGallery/index.d.ts +4 -0
- package/lib/ImageGallery/index.js +36 -0
- package/lib/ImageGallery/style/index.less +5 -0
- package/lib/ImageGallery/types.d.ts +5 -0
- package/lib/ImageGallery/types.js +5 -0
- package/lib/NavLeafScroll/index.js +98 -55
- package/lib/RefactorTree/index.d.ts +1 -1
- package/lib/RefactorTree/index.js +10 -11
- package/lib/RefactorTree/indexTreeNode.d.ts +1 -1
- package/lib/RefactorTree/indexTreeNode.js +23 -22
- package/lib/RefactorTree/util.js +18 -18
- package/lib/SpecIcon/fonts/demo_index.html +559 -5
- package/lib/SpecIcon/fonts/iconfont.css +101 -3
- package/lib/SpecIcon/fonts/iconfont.js +34 -27
- package/lib/SpecIcon/fonts/iconfont.json +168 -0
- package/lib/SpecIcon/fonts/iconfont.svg +163 -171
- package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/lib/SpecIcon/index.js +2 -3
- package/lib/SpecIcon/style/iconfont.less +106 -11
- package/lib/SplitterLayout/Pane.d.ts +1 -1
- package/lib/SplitterLayout/Pane.js +2 -3
- package/lib/SplitterLayout/index.js +27 -29
- package/lib/StandardContent/SplitterLayout/Pane.js +5 -6
- package/lib/StandardContent/SplitterLayout/index.js +27 -29
- package/lib/StandardContent/SubfieldContent.d.ts +1 -1
- package/lib/StandardContent/SubfieldContent.js +2 -3
- package/lib/StandardContent/WrapperContent.d.ts +1 -1
- package/lib/StandardContent/WrapperContent.js +2 -3
- package/lib/StandardDragModal/index.d.ts +11 -3
- package/lib/StandardDragModal/index.js +27 -33
- package/lib/StandardFilter/index.d.ts +5 -16
- package/lib/StandardFilter/index.js +215 -201
- package/lib/StandardFilter/indexClass.d.ts +37 -0
- package/lib/StandardFilter/indexClass.js +223 -0
- package/lib/StandardFilter/style/index.less +82 -9
- package/lib/StandardForm/ActionList.js +2 -3
- package/lib/StandardForm/StepForm.d.ts +1 -1
- package/lib/StandardForm/StepForm.js +32 -27
- package/lib/StandardForm/TabForm.d.ts +1 -1
- package/lib/StandardForm/TabForm.js +45 -48
- package/lib/StandardForm/index.d.ts +1 -1
- package/lib/StandardForm/index.js +9 -10
- package/lib/StandardModal/UpdateFormRef.js +3 -4
- package/lib/StandardModal/index.d.ts +2 -1
- package/lib/StandardModal/index.js +29 -43
- package/lib/StandardPanel/index.d.ts +1 -1
- package/lib/StandardPanel/index.js +11 -12
- package/lib/StandardTable/index.d.ts +1 -0
- package/lib/StandardTable/index.js +49 -29
- package/lib/components/IconNode/index.d.ts +1 -1
- package/lib/components/IconNode/index.js +2 -4
- package/lib/components/index.js +1 -1
- package/lib/data/func.code.js +2 -3
- package/lib/data/general.config.js +33 -3
- package/lib/data/index.js +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +30 -10
- package/lib/utils/ValueFormat.js +1 -2
- package/lib/utils/filterPermission.js +11 -18
- package/lib/utils/getParentNodes.js +103 -29
- package/lib/utils/index.js +5 -27
- package/lib/utils/urlUtils.js +82 -0
- package/package.json +14 -9
- package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
- package/dist/fonts/iconfont.eot +0 -0
- package/es/StandardDragModal/ChangeStandardModal.d.ts +0 -44
- package/es/StandardDragModal/ChangeStandardModal.js +0 -493
- package/es/StandardDragModal/DraggableModal.d.ts +0 -7
- package/es/StandardDragModal/DraggableModal.js +0 -31
- package/es/StandardDragModal/DraggableModalContext.d.ts +0 -9
- package/es/StandardDragModal/DraggableModalContext.js +0 -5
- package/es/StandardDragModal/DraggableModalInner.d.ts +0 -16
- package/es/StandardDragModal/DraggableModalInner.js +0 -114
- package/es/StandardDragModal/DraggableModalProvider.d.ts +0 -4
- package/es/StandardDragModal/DraggableModalProvider.js +0 -40
- package/es/StandardDragModal/Modal.d.ts +0 -11
- package/es/StandardDragModal/Modal.js +0 -24
- package/es/StandardDragModal/ResizeHandle.d.ts +0 -2
- package/es/StandardDragModal/ResizeHandle.js +0 -8
- package/es/StandardDragModal/clamp.d.ts +0 -1
- package/es/StandardDragModal/clamp.js +0 -3
- package/es/StandardDragModal/draggableModalReducer.d.ts +0 -66
- package/es/StandardDragModal/draggableModalReducer.js +0 -157
- package/es/StandardDragModal/getWindowSize.d.ts +0 -4
- package/es/StandardDragModal/getWindowSize.js +0 -6
- package/es/StandardDragModal/index.less +0 -65
- package/es/StandardDragModal/useDrag.d.ts +0 -5
- package/es/StandardDragModal/useDrag.js +0 -66
- package/es/StandardDragModal/usePrevious.d.ts +0 -1
- package/es/StandardDragModal/usePrevious.js +0 -8
- package/es/StandardDragModal/useResize.d.ts +0 -7
- package/es/StandardDragModal/useResize.js +0 -74
- package/es/utils/dictSelectUtil.js +0 -153
- package/lib/StandardDragModal/ChangeStandardModal.d.ts +0 -44
- package/lib/StandardDragModal/ChangeStandardModal.js +0 -502
- package/lib/StandardDragModal/DraggableModal.d.ts +0 -7
- package/lib/StandardDragModal/DraggableModal.js +0 -40
- package/lib/StandardDragModal/DraggableModalContext.d.ts +0 -9
- package/lib/StandardDragModal/DraggableModalContext.js +0 -15
- package/lib/StandardDragModal/DraggableModalInner.d.ts +0 -16
- package/lib/StandardDragModal/DraggableModalInner.js +0 -124
- package/lib/StandardDragModal/DraggableModalProvider.d.ts +0 -4
- package/lib/StandardDragModal/DraggableModalProvider.js +0 -48
- package/lib/StandardDragModal/Modal.d.ts +0 -11
- package/lib/StandardDragModal/Modal.js +0 -32
- package/lib/StandardDragModal/ResizeHandle.d.ts +0 -2
- package/lib/StandardDragModal/ResizeHandle.js +0 -18
- package/lib/StandardDragModal/clamp.d.ts +0 -1
- package/lib/StandardDragModal/clamp.js +0 -10
- package/lib/StandardDragModal/draggableModalReducer.d.ts +0 -66
- package/lib/StandardDragModal/draggableModalReducer.js +0 -167
- package/lib/StandardDragModal/getWindowSize.d.ts +0 -4
- package/lib/StandardDragModal/getWindowSize.js +0 -13
- package/lib/StandardDragModal/index.less +0 -65
- package/lib/StandardDragModal/useDrag.d.ts +0 -5
- package/lib/StandardDragModal/useDrag.js +0 -73
- package/lib/StandardDragModal/usePrevious.d.ts +0 -1
- package/lib/StandardDragModal/usePrevious.js +0 -15
- package/lib/StandardDragModal/useResize.d.ts +0 -7
- package/lib/StandardDragModal/useResize.js +0 -81
- package/lib/utils/dictSelectUtil.js +0 -161
|
@@ -15,20 +15,22 @@ var _tslib = require("tslib");
|
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _icons = require("@ant-design/icons");
|
|
17
17
|
var _util = require("./util");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
18
|
+
require("./style/index.less");
|
|
19
|
+
var _ImagePreview = _interopRequireDefault(require("../../ImageGallery/ImagePreview"));
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
24
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
23
25
|
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."); }
|
|
24
|
-
function _iterableToArray(
|
|
25
|
-
function _arrayWithoutHoles(
|
|
26
|
-
function _slicedToArray(
|
|
26
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
27
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
28
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
27
29
|
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."); }
|
|
28
|
-
function _unsupportedIterableToArray(
|
|
29
|
-
function _arrayLikeToArray(
|
|
30
|
-
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)
|
|
31
|
-
function _arrayWithHoles(
|
|
30
|
+
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; } }
|
|
31
|
+
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; }
|
|
32
|
+
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; } }
|
|
33
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /* eslint-disable */ // import StandardModal from "../../StandardModal";
|
|
32
34
|
var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
33
35
|
var accept = props.accept,
|
|
34
36
|
extraExt = props.extraExt,
|
|
@@ -40,55 +42,62 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
40
42
|
value = props.value,
|
|
41
43
|
_props$size = props.size,
|
|
42
44
|
size = _props$size === void 0 ? 2 * 1024 * 1024 : _props$size,
|
|
43
|
-
_props$modalSize = props.modalSize,
|
|
44
|
-
modalSize = _props$modalSize === void 0 ? 'md' : _props$modalSize,
|
|
45
|
-
_props$modalConfig = props.modalConfig,
|
|
46
|
-
modalConfig = _props$modalConfig === void 0 ? {} : _props$modalConfig,
|
|
47
45
|
onPreview = props.onPreview,
|
|
48
46
|
beforeUpload = props.beforeUpload,
|
|
49
|
-
limit = props.limit;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
limit = props.limit;
|
|
48
|
+
// 图片预览数据
|
|
49
|
+
// const [showConfig, setShowConfig] = useState({ visible: false, url: '' })
|
|
50
|
+
// 用于展示的缩略图
|
|
51
|
+
var _useState = (0, _react.useState)([]),
|
|
54
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
uploaderFileList = _useState2[0],
|
|
54
|
+
setUploaderFileList = _useState2[1];
|
|
55
|
+
// const [previewerList, setPreviewerList] = useState([])
|
|
56
|
+
var _useState3 = (0, _react.useState)(false),
|
|
58
57
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
showPreview = _useState4[0],
|
|
59
|
+
setShowPreview = _useState4[1];
|
|
60
|
+
var _useState5 = (0, _react.useState)(-1),
|
|
61
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
62
|
+
previewCurrent = _useState6[0],
|
|
63
|
+
setPreviewerCurrent = _useState6[1];
|
|
61
64
|
(0, _react.useEffect)(function () {
|
|
62
65
|
if (!value) {
|
|
63
|
-
|
|
66
|
+
setUploaderFileList([]);
|
|
64
67
|
return;
|
|
65
68
|
}
|
|
66
69
|
var S4 = function S4() {
|
|
67
70
|
return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
|
|
68
71
|
};
|
|
69
72
|
if (Object.prototype.toString.call(value) === '[object Array]') {
|
|
70
|
-
|
|
73
|
+
var newFilesValue = _toConsumableArray(value);
|
|
74
|
+
setUploaderFileList((newFilesValue || []).map(function (file) {
|
|
71
75
|
file.uid = file.uid || "".concat(S4(), "-").concat(S4());
|
|
72
76
|
file.url = file.downloadUrl || file.url;
|
|
73
77
|
file.status = 'done';
|
|
78
|
+
file.previewUrl = file.downloadUrl || file.url; // 给预览地址
|
|
74
79
|
return file;
|
|
75
80
|
}));
|
|
76
81
|
return;
|
|
77
82
|
}
|
|
78
83
|
if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
79
|
-
|
|
84
|
+
/* eslint-disable nwo-multi-spaces */
|
|
85
|
+
setUploaderFileList([Object.assign({
|
|
80
86
|
uid: "".concat(S4(), "-").concat(S4()),
|
|
81
87
|
url: value.downloadUrl || value.url,
|
|
82
|
-
status: 'done'
|
|
88
|
+
status: 'done',
|
|
89
|
+
previewUrl: value.downloadUrl || value.url
|
|
83
90
|
}, value)]);
|
|
91
|
+
/* eslint-enable no-multi-spaces */
|
|
84
92
|
return;
|
|
85
93
|
}
|
|
86
94
|
if (Object.prototype.toString.call(value) === '[object String]') {
|
|
87
|
-
|
|
95
|
+
setUploaderFileList([{
|
|
88
96
|
uid: "".concat(S4(), "-").concat(S4()),
|
|
89
97
|
url: value,
|
|
90
98
|
name: '附件',
|
|
91
|
-
status: 'done'
|
|
99
|
+
status: 'done',
|
|
100
|
+
previewUrl: value
|
|
92
101
|
}]);
|
|
93
102
|
return;
|
|
94
103
|
}
|
|
@@ -104,37 +113,56 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
104
113
|
return res;
|
|
105
114
|
}, [fileType, extraExt]);
|
|
106
115
|
// 点击文件链接或预览图标时的回调
|
|
107
|
-
var handlePreview = (0, _react.useCallback)(function (file) {
|
|
108
|
-
return (0, _tslib.__awaiter)(void 0, void 0, void 0, /*#__PURE__*/
|
|
109
|
-
var
|
|
110
|
-
return
|
|
111
|
-
while (1) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
116
|
+
var handlePreview = (0, _react.useCallback)(function (file, files) {
|
|
117
|
+
return (0, _tslib.__awaiter)(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
118
|
+
var pList;
|
|
119
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
120
|
+
while (1) switch (_context.prev = _context.next) {
|
|
121
|
+
case 0:
|
|
122
|
+
_context.next = 2;
|
|
123
|
+
return fileListPreviewer(_toConsumableArray(files));
|
|
124
|
+
case 2:
|
|
125
|
+
pList = _context.sent;
|
|
126
|
+
setUploaderFileList(pList);
|
|
127
|
+
setPreviewerCurrent(pList.findIndex(function (item) {
|
|
128
|
+
return item.uid === file.uid;
|
|
129
|
+
}));
|
|
130
|
+
setShowPreview(true);
|
|
131
|
+
/*
|
|
132
|
+
// 方式二:只先转换当前图片
|
|
133
|
+
const pList: any = [...files]
|
|
134
|
+
const matchIndex = pList.findIndex((item: FileTypeProps) => item.uid === file.uid)
|
|
135
|
+
const matchPreview = pList[matchIndex]
|
|
136
|
+
// 判断当前是否有预览图
|
|
137
|
+
if (!matchPreview.url && !matchPreview.previewUrl) {
|
|
138
|
+
// 无预览地址,需要先转换
|
|
139
|
+
const res = await getBase64(matchPreview.originFileObj);
|
|
140
|
+
if (res && res.status === 'success') {
|
|
141
|
+
matchPreview.previewUrl = res.url;
|
|
142
|
+
}
|
|
143
|
+
pList.splice(matchIndex, 1, matchPreview)
|
|
144
|
+
} else {
|
|
145
|
+
// 有预览地址,暂时不做处理
|
|
146
|
+
}
|
|
147
|
+
setUploaderFileList(pList)
|
|
148
|
+
setPreviewerCurrent(matchIndex)
|
|
149
|
+
setShowPreview(true)*/
|
|
150
|
+
// if (!file.url && !file.preview) {
|
|
151
|
+
// const res = await getBase64(file.originFileObj);
|
|
152
|
+
// if (res && res.status === 'success') {
|
|
153
|
+
// file.preview = res.url;
|
|
154
|
+
// }
|
|
155
|
+
// }
|
|
156
|
+
// console.log('file', file.uid)
|
|
157
|
+
// const previewItem = pList.find((item: FileTypeProps) => item.uid === file.uid)
|
|
158
|
+
// setShowConfig({ visible: true, url: previewItem.previewUrl })
|
|
159
|
+
case 6:
|
|
160
|
+
case "end":
|
|
161
|
+
return _context.stop();
|
|
134
162
|
}
|
|
135
163
|
}, _callee);
|
|
136
164
|
}));
|
|
137
|
-
}, [
|
|
165
|
+
}, []);
|
|
138
166
|
// 检查文件是否规范
|
|
139
167
|
var handleCheck = (0, _react.useCallback)(function (file) {
|
|
140
168
|
var isLtSize = file.size < size;
|
|
@@ -145,70 +173,129 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
145
173
|
return true;
|
|
146
174
|
}, [fileType, size]);
|
|
147
175
|
var handleChange = (0, _react.useCallback)(function (res) {
|
|
148
|
-
return (0, _tslib.__awaiter)(void 0, void 0, void 0, /*#__PURE__*/
|
|
176
|
+
return (0, _tslib.__awaiter)(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
149
177
|
var isOk, result, list;
|
|
150
|
-
return
|
|
151
|
-
while (1) {
|
|
152
|
-
|
|
178
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
179
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
180
|
+
case 0:
|
|
181
|
+
if (!(res.file.status === 'removed')) {
|
|
182
|
+
_context2.next = 4;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
setUploaderFileList(res.fileList);
|
|
186
|
+
onChange && onChange(isOnly ? res.fileList[0] && res.fileList[0].originFileObj : res.fileList);
|
|
187
|
+
return _context2.abrupt("return");
|
|
188
|
+
case 4:
|
|
189
|
+
isOk = handleCheck(res.file);
|
|
190
|
+
if (isOk) {
|
|
191
|
+
list = res.fileList.map(function (file) {
|
|
192
|
+
if (!file.previewUrl) {
|
|
193
|
+
console.log('无预览URL', file);
|
|
194
|
+
}
|
|
195
|
+
// if (!file.url) {
|
|
196
|
+
// file.url = file.thumbUrl
|
|
197
|
+
// }
|
|
198
|
+
return file;
|
|
199
|
+
}); // const previewUrls = ( res.fileList || []).map((item: any) => {
|
|
200
|
+
// return getPreviewInfo(item)
|
|
201
|
+
// });
|
|
202
|
+
// let resultList = await Promise.all(previewUrls).catch((err) => {
|
|
203
|
+
// console.log('Promise.all==>转换base64失败', err)
|
|
204
|
+
// })
|
|
205
|
+
result = _toConsumableArray(list || []);
|
|
206
|
+
setUploaderFileList(result);
|
|
207
|
+
onChange && onChange(isOnly ? result[0] && result[0].originFileObj : result);
|
|
208
|
+
}
|
|
209
|
+
case 6:
|
|
210
|
+
case "end":
|
|
211
|
+
return _context2.stop();
|
|
212
|
+
}
|
|
213
|
+
}, _callee2);
|
|
214
|
+
}));
|
|
215
|
+
}, [isOnly, handleCheck, uploaderFileList]);
|
|
216
|
+
var getPreviewInfo = function getPreviewInfo(file) {
|
|
217
|
+
return new Promise(function (resolve, reject) {
|
|
218
|
+
return (0, _tslib.__awaiter)(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
219
|
+
var res;
|
|
220
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
221
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
153
222
|
case 0:
|
|
154
|
-
if (!(
|
|
155
|
-
|
|
223
|
+
if (!(!file.url && !file.previewUrl)) {
|
|
224
|
+
_context3.next = 8;
|
|
156
225
|
break;
|
|
157
226
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
onChange && onChange(isOnly ? result[0] && result[0].originFileObj : result);
|
|
227
|
+
_context3.next = 3;
|
|
228
|
+
return (0, _util.getBase64)(file.originFileObj);
|
|
229
|
+
case 3:
|
|
230
|
+
res = _context3.sent;
|
|
231
|
+
if (res && res.status === 'success') {
|
|
232
|
+
file.previewUrl = res.url;
|
|
233
|
+
}
|
|
234
|
+
// console.log('转换成功', file)
|
|
235
|
+
resolve(Object.assign({}, file));
|
|
236
|
+
_context3.next = 10;
|
|
237
|
+
break;
|
|
238
|
+
case 8:
|
|
239
|
+
if (!file.previewUrl) {
|
|
240
|
+
file.previewUrl = file.url;
|
|
173
241
|
}
|
|
174
|
-
|
|
242
|
+
// 已经转换过,无需再转换
|
|
243
|
+
// console.log('已经转换过,无需再转换', file)
|
|
244
|
+
resolve(Object.assign({}, file));
|
|
245
|
+
case 10:
|
|
175
246
|
case "end":
|
|
176
|
-
return
|
|
247
|
+
return _context3.stop();
|
|
177
248
|
}
|
|
249
|
+
}, _callee3);
|
|
250
|
+
}));
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
var fileListPreviewer = function fileListPreviewer(files) {
|
|
254
|
+
return (0, _tslib.__awaiter)(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
255
|
+
var previewUrls, resultList;
|
|
256
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
257
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
258
|
+
case 0:
|
|
259
|
+
previewUrls = (files || []).map(function (item) {
|
|
260
|
+
return getPreviewInfo(item);
|
|
261
|
+
});
|
|
262
|
+
_context4.next = 3;
|
|
263
|
+
return Promise.all(previewUrls).catch(function (err) {
|
|
264
|
+
console.log('Promise.all==>转换base64失败', err);
|
|
265
|
+
});
|
|
266
|
+
case 3:
|
|
267
|
+
resultList = _context4.sent;
|
|
268
|
+
return _context4.abrupt("return", resultList);
|
|
269
|
+
case 5:
|
|
270
|
+
case "end":
|
|
271
|
+
return _context4.stop();
|
|
178
272
|
}
|
|
179
|
-
},
|
|
273
|
+
}, _callee4);
|
|
180
274
|
}));
|
|
181
|
-
}
|
|
275
|
+
};
|
|
276
|
+
var handleClose = function handleClose() {
|
|
277
|
+
setShowPreview(false);
|
|
278
|
+
};
|
|
182
279
|
// 渲染预览窗口
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
203
|
-
style: {
|
|
204
|
-
maxWidth: '100%'
|
|
205
|
-
},
|
|
206
|
-
src: url,
|
|
207
|
-
alt: ""
|
|
208
|
-
})));
|
|
209
|
-
}
|
|
210
|
-
return null;
|
|
211
|
-
}, [fileType, showConfig]);
|
|
280
|
+
/* const renderPreviewComponent = useMemo(
|
|
281
|
+
() => {
|
|
282
|
+
if (fileType === 'image' || fileType === 'svg') {
|
|
283
|
+
const { visible, url } = showConfig
|
|
284
|
+
return (
|
|
285
|
+
<StandardModal visible={visible} hideFooter={true}
|
|
286
|
+
onCancel={() => setShowConfig({ visible: false, url: '' })}
|
|
287
|
+
size={modalSize}
|
|
288
|
+
zIndex={2000}
|
|
289
|
+
{...modalConfig}
|
|
290
|
+
>
|
|
291
|
+
<div style={{ textAlign: 'center' }}><img style={{ maxWidth: '100%' }} src={url} alt=""/></div>
|
|
292
|
+
</StandardModal>
|
|
293
|
+
)
|
|
294
|
+
}
|
|
295
|
+
return null
|
|
296
|
+
},
|
|
297
|
+
[fileType, showConfig]
|
|
298
|
+
)*/
|
|
212
299
|
var renderChildrenComponent = (0, _react.useMemo)(function () {
|
|
213
300
|
var renderButton = function renderButton() {
|
|
214
301
|
if (fileType === 'image' || fileType === 'svg') {
|
|
@@ -222,26 +309,60 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
222
309
|
className: 'spec-uploader-button'
|
|
223
310
|
}, /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, null), "\u70B9\u51FB\u9009\u62E9");
|
|
224
311
|
};
|
|
312
|
+
if (isOnly && uploaderFileList.length === 1 || limit && uploaderFileList.length === limit) {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
225
315
|
if (children) {
|
|
226
316
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " ", children, " ");
|
|
227
317
|
}
|
|
228
|
-
if (isOnly && fileList.length === 1 || limit && fileList.length === limit) {
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
318
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderButton());
|
|
232
|
-
}, [fileType, isOnly, children,
|
|
319
|
+
}, [fileType, isOnly, children, uploaderFileList, limit]);
|
|
233
320
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_upload.default, Object.assign({}, props, {
|
|
234
321
|
ref: ref,
|
|
235
322
|
accept: splitAccept,
|
|
236
|
-
fileList:
|
|
323
|
+
fileList: uploaderFileList,
|
|
237
324
|
listType: fileType === 'image' || fileType === 'svg' ? 'picture-card' : 'text',
|
|
238
325
|
className: "spec-uploader ".concat(className),
|
|
239
|
-
onPreview: onPreview ? onPreview : fileType === 'image' || fileType === 'svg' ?
|
|
326
|
+
onPreview: onPreview ? onPreview : fileType === 'image' || fileType === 'svg' ? function (file) {
|
|
327
|
+
return handlePreview(file, uploaderFileList);
|
|
328
|
+
} : function () {},
|
|
240
329
|
beforeUpload: beforeUpload ? beforeUpload : function () {
|
|
241
330
|
return false;
|
|
242
331
|
},
|
|
243
332
|
onChange: handleChange
|
|
244
|
-
}), renderChildrenComponent),
|
|
333
|
+
}), renderChildrenComponent), (fileType === 'image' || fileType === 'svg') && showPreview && /*#__PURE__*/_react.default.createElement(_ImagePreview.default, {
|
|
334
|
+
hasThumbnail: true,
|
|
335
|
+
open: showPreview,
|
|
336
|
+
onClose: handleClose,
|
|
337
|
+
current: previewCurrent,
|
|
338
|
+
galleryItems: uploaderFileList
|
|
339
|
+
}, (uploaderFileList || []).map(function (item, ind) {
|
|
340
|
+
// console.log('uploaderFileList=>item', item)
|
|
341
|
+
/* <!-- HTML5 Video --->
|
|
342
|
+
<a
|
|
343
|
+
data-lg-size="1280-720"
|
|
344
|
+
data-video='{"source": [{"src":"/videos/video1.mp4", "type":"video/mp4"}], "tracks": [{"src": "{/videos/title.txt", "kind":"captions", "srclang": "en", "label": "English", "default": "true"}], "attributes": {"preload": false, "playsinline": true, "controls": true}}'
|
|
345
|
+
data-poster="/images/demo/youtube-video-poster.jpg"
|
|
346
|
+
data-sub-html="<h4>'Peck Pocketed' by Kevin Herron | Disney Favorite</h4>"
|
|
347
|
+
>
|
|
348
|
+
<img
|
|
349
|
+
width="300"
|
|
350
|
+
height="100"
|
|
351
|
+
class="img-responsive"
|
|
352
|
+
src="/images/demo/youtube-video-poster.jpg"
|
|
353
|
+
/>
|
|
354
|
+
</a>*/
|
|
355
|
+
return /*#__PURE__*/_react.default.createElement("a", {
|
|
356
|
+
key: (item === null || item === void 0 ? void 0 : item.uid) || ind,
|
|
357
|
+
"data-src": item === null || item === void 0 ? void 0 : item.previewUrl,
|
|
358
|
+
"data-thumb-src": (item === null || item === void 0 ? void 0 : item.thumbUrl) || (item === null || item === void 0 ? void 0 : item.url)
|
|
359
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
360
|
+
src: (item === null || item === void 0 ? void 0 : item.thumbUrl) || (item === null || item === void 0 ? void 0 : item.url),
|
|
361
|
+
style: {
|
|
362
|
+
maxWidth: '100%'
|
|
363
|
+
}
|
|
364
|
+
}));
|
|
365
|
+
// return <img className={'test-image'} key={item?.uid || ind} alt={item.uid} src={item?.previewUrl}/>
|
|
366
|
+
})));
|
|
245
367
|
}); // as IUploader
|
|
246
|
-
var _default = Uploader;
|
|
247
|
-
exports.default = _default;
|
|
368
|
+
var _default = exports.default = Uploader;
|