venus-design 1.0.76 → 1.0.78
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.
|
@@ -55,7 +55,7 @@ export interface UltimateSearchProps<T> {
|
|
|
55
55
|
export declare const createUltimateSearchNews: <T extends Record<string, any>>(config: UltimateSearchProps<T>) => ProColumns<T>;
|
|
56
56
|
export declare const createUltimateSearch: <T extends Record<string, any>>(column: ProColumns<T>, dataIndex?: string, title?: string, socketSearch?: boolean, searchType?: 'flat' | 'tree', showHistory?: boolean, theme?: ThemeType) => ProColumns<T>;
|
|
57
57
|
declare const _default: {
|
|
58
|
-
createUltimateSearch: <T extends Record<string, any>>(column: ProColumns<T>, dataIndex?: string, title?: string | undefined, socketSearch?: boolean, searchType?: "
|
|
58
|
+
createUltimateSearch: <T extends Record<string, any>>(column: ProColumns<T>, dataIndex?: string, title?: string | undefined, socketSearch?: boolean, searchType?: "flat" | "tree", showHistory?: boolean, theme?: ThemeType) => ProColumns<T>;
|
|
59
59
|
createUltimateFilter: ({ dataIndex, title, dataSource, options, showSearch, showHistory, theme }: UltimateFilterProps) => Partial<ColumnType<any>>;
|
|
60
60
|
createUltimateSearchNews: <T_1 extends Record<string, any>>(config: UltimateSearchProps<T_1>) => ProColumns<T_1>;
|
|
61
61
|
};
|
package/dist/ProForm/index.d.ts
CHANGED
|
@@ -132,6 +132,12 @@ export declare const VenusFormSlider: (props: any) => React.JSX.Element;
|
|
|
132
132
|
* @returns
|
|
133
133
|
*/
|
|
134
134
|
export declare const VenusFormUploadPro: (props: any) => React.JSX.Element;
|
|
135
|
+
/**
|
|
136
|
+
* 上传组件
|
|
137
|
+
* @param props
|
|
138
|
+
* @returns
|
|
139
|
+
*/
|
|
140
|
+
export declare const VenusFormEditor: (props: any) => React.JSX.Element;
|
|
135
141
|
/**
|
|
136
142
|
* 新上传组件
|
|
137
143
|
*/
|
package/dist/ProForm/index.js
CHANGED
|
@@ -66,13 +66,14 @@ var _excluded = ["children", "pageLoading", "pageFormClassName", "submitter", "s
|
|
|
66
66
|
_excluded38 = ["comAttr", "placeholder", "disabled", "isDuo"],
|
|
67
67
|
_excluded39 = ["comAttr", "placeholder", "disabled", "isDuo"],
|
|
68
68
|
_excluded40 = ["comAttr", "placeholder", "disabled", "isDuo"],
|
|
69
|
-
_excluded41 = ["comAttr", "placeholder", "disabled", "isDuo"]
|
|
69
|
+
_excluded41 = ["comAttr", "placeholder", "disabled", "isDuo"],
|
|
70
|
+
_excluded42 = ["comAttr", "placeholder", "disabled", "isDuo"];
|
|
70
71
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
71
72
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
72
73
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
73
74
|
import React from 'react';
|
|
74
75
|
import classnames from 'classnames';
|
|
75
|
-
import { CheckBoxInput, NumberPercent, NumberUnit, RadioAndInput, Search, TreeSelect, UploadImage, VenusUploadSecLevelForm, Upload, VenusUploadSecLevel } from "./..";
|
|
76
|
+
import { CheckBoxInput, NumberPercent, NumberUnit, RadioAndInput, Search, TreeSelect, UploadImage, VenusUploadSecLevelForm, Upload, VenusUploadSecLevel, VenusEditor } from "./..";
|
|
76
77
|
import "./styles.less";
|
|
77
78
|
import { StyleProvider, legacyLogicalPropertiesTransformer } from "@ant-design/cssinjs";
|
|
78
79
|
var ProForm = function ProForm(props) {
|
|
@@ -905,17 +906,32 @@ export var VenusFormUploadPro = function VenusFormUploadPro(props) {
|
|
|
905
906
|
disabled: disabled
|
|
906
907
|
}, comAttr)));
|
|
907
908
|
};
|
|
908
|
-
|
|
909
909
|
/**
|
|
910
|
-
*
|
|
910
|
+
* 上传组件
|
|
911
|
+
* @param props
|
|
912
|
+
* @returns
|
|
911
913
|
*/
|
|
912
|
-
export var
|
|
914
|
+
export var VenusFormEditor = function VenusFormEditor(props) {
|
|
913
915
|
var _props$comAttr36 = props.comAttr,
|
|
914
916
|
comAttr = _props$comAttr36 === void 0 ? {} : _props$comAttr36,
|
|
915
917
|
placeholder = props.placeholder,
|
|
916
918
|
disabled = props.disabled,
|
|
917
919
|
isDuo = props.isDuo,
|
|
918
920
|
others = _objectWithoutProperties(props, _excluded41);
|
|
921
|
+
return /*#__PURE__*/React.createElement(FormItem2, others, /*#__PURE__*/React.createElement(VenusEditor, _extends({
|
|
922
|
+
disabled: disabled
|
|
923
|
+
}, comAttr)));
|
|
924
|
+
};
|
|
925
|
+
/**
|
|
926
|
+
* 新上传组件
|
|
927
|
+
*/
|
|
928
|
+
export var VenusFormUploadSecLevel = function VenusFormUploadSecLevel(props) {
|
|
929
|
+
var _props$comAttr37 = props.comAttr,
|
|
930
|
+
comAttr = _props$comAttr37 === void 0 ? {} : _props$comAttr37,
|
|
931
|
+
placeholder = props.placeholder,
|
|
932
|
+
disabled = props.disabled,
|
|
933
|
+
isDuo = props.isDuo,
|
|
934
|
+
others = _objectWithoutProperties(props, _excluded42);
|
|
919
935
|
return /*#__PURE__*/React.createElement(FormItem2, others, /*#__PURE__*/React.createElement(VenusUploadSecLevel, _extends({
|
|
920
936
|
placeholder: placeholder,
|
|
921
937
|
isDuo: isDuo,
|
|
@@ -5,6 +5,8 @@ import "antd/es/button/style";
|
|
|
5
5
|
import _Button from "antd/es/button";
|
|
6
6
|
import "antd/es/tooltip/style";
|
|
7
7
|
import _Tooltip from "antd/es/tooltip";
|
|
8
|
+
import "antd/es/progress/style";
|
|
9
|
+
import _Progress from "antd/es/progress";
|
|
8
10
|
import "antd/es/message/style";
|
|
9
11
|
import _message from "antd/es/message";
|
|
10
12
|
import "antd/es/upload/style";
|
|
@@ -17,16 +19,11 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
17
19
|
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 new 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 new 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 new 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; }
|
|
18
20
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
19
21
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
20
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
21
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
24
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
26
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
27
|
-
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."); }
|
|
28
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
30
27
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
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."); }
|
|
32
29
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -55,72 +52,117 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
55
52
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
56
53
|
level = _useState6[0],
|
|
57
54
|
setLevel = _useState6[1];
|
|
55
|
+
|
|
56
|
+
// 外部只给“已完成”数据,用 map 快速索引
|
|
58
57
|
useEffect(function () {
|
|
59
|
-
|
|
58
|
+
var outerMap = new Map(
|
|
60
59
|
//@ts-ignore
|
|
61
|
-
|
|
62
|
-
return [f.
|
|
60
|
+
(props.value || []).map(function (f) {
|
|
61
|
+
return [f.fileId || f.uid, f];
|
|
63
62
|
}));
|
|
63
|
+
|
|
64
|
+
// 回显层只更新“已完成”部分的信息,不动正在上传的
|
|
64
65
|
setFileList(function (prev) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var target = outerMap.get(file.uid || file.fileId);
|
|
66
|
+
return prev.map(function (file) {
|
|
67
|
+
var key = file.fileId || file.uid;
|
|
68
|
+
var target = outerMap.get(key);
|
|
69
69
|
return target ? _objectSpread(_objectSpread(_objectSpread({}, file), target), {}, {
|
|
70
70
|
status: 'done'
|
|
71
71
|
}) : file;
|
|
72
|
-
})
|
|
73
|
-
return !prev.some(function (p) {
|
|
74
|
-
return p.uid === f.uid || p.fileId === f.fileId;
|
|
75
|
-
});
|
|
76
|
-
})));
|
|
72
|
+
});
|
|
77
73
|
});
|
|
78
|
-
}, [props.value]);
|
|
79
|
-
/**
|
|
80
|
-
* 上传文件
|
|
81
|
-
*/
|
|
74
|
+
}, [props.value, level]);
|
|
82
75
|
var onChange = function onChange(info) {
|
|
83
|
-
var
|
|
76
|
+
var file = info.file,
|
|
77
|
+
newFileList = info.fileList;
|
|
78
|
+
|
|
79
|
+
/* 0. 预计算:外部已完成的密级映射 */
|
|
84
80
|
var dataLevel = [];
|
|
85
|
-
(props.value || []).
|
|
81
|
+
(props.value || []).forEach(function (v) {
|
|
86
82
|
dataLevel[v.id] = v.secId;
|
|
87
83
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
84
|
+
|
|
85
|
+
/* 0.5 如果 antd 已经标记为 error,直接删掉(保持原来“失败物理删除”逻辑)*/
|
|
86
|
+
var cleanedList = newFileList.filter(function (f) {
|
|
87
|
+
return f.status !== 'error';
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
/* 1. 用清理后的列表继续走你原有逻辑 */
|
|
91
|
+
setFileList(cleanedList);
|
|
92
|
+
|
|
93
|
+
/* 2. 仅当“当前文件” done 时,再决定 success / error */
|
|
94
|
+
if (file.status === 'done' && file.response) {
|
|
95
|
+
if (file.response.success) {
|
|
96
|
+
/* 2.1 真正成功 -> 补充 fileId 与密级 */
|
|
97
|
+
setFileList(function (prev) {
|
|
98
|
+
var map = new Map(prev.map(function (f) {
|
|
99
|
+
return [f.uid, f];
|
|
100
|
+
}));
|
|
101
|
+
var target = map.get(file.uid);
|
|
102
|
+
if (target) {
|
|
103
|
+
var _ref, _dataLevel$target$fil;
|
|
104
|
+
target.status = 'done';
|
|
105
|
+
target.percent = 100;
|
|
106
|
+
target.fileId = file.response.data.fileId;
|
|
107
|
+
target.secId = (_ref = (_dataLevel$target$fil = dataLevel[target.fileId]) !== null && _dataLevel$target$fil !== void 0 ? _dataLevel$target$fil :
|
|
108
|
+
// 外部表单里已有
|
|
109
|
+
level && level[target.fileId]) !== null && _ref !== void 0 ? _ref :
|
|
110
|
+
// 组件内刚选的
|
|
111
|
+
undefined;
|
|
112
|
+
}
|
|
113
|
+
return Array.from(map.values());
|
|
114
|
+
});
|
|
115
|
+
} else {
|
|
116
|
+
/* 2.2 后端明确失败 -> 标红但不删除(也可删除,按你原逻辑)*/
|
|
117
|
+
setFileList(function (prev) {
|
|
118
|
+
var map = new Map(prev.map(function (f) {
|
|
119
|
+
return [f.uid, f];
|
|
120
|
+
}));
|
|
121
|
+
var target = map.get(file.uid);
|
|
122
|
+
if (target) target.status = 'error';
|
|
123
|
+
return Array.from(map.values());
|
|
124
|
+
});
|
|
125
|
+
_message.error(file.response.message || '文件上传失败!请重新上传');
|
|
110
126
|
}
|
|
111
|
-
} catch (err) {
|
|
112
|
-
_iterator.e(err);
|
|
113
|
-
} finally {
|
|
114
|
-
_iterator.f();
|
|
115
127
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
var
|
|
128
|
+
|
|
129
|
+
/* 3. 用你原来的“双键 Map”再合并一次,保证 fileId / secId 不丢 */
|
|
130
|
+
var fileMap = new Map();
|
|
131
|
+
fileList.forEach(function (f) {
|
|
132
|
+
var key = f.fileId || f.uid;
|
|
133
|
+
fileMap.set(key, f);
|
|
134
|
+
});
|
|
135
|
+
//@ts-ignore
|
|
136
|
+
newFileList.forEach(function (f) {
|
|
119
137
|
var _f$response;
|
|
120
|
-
|
|
138
|
+
var key = f.fileId || f.uid;
|
|
139
|
+
var target = _objectSpread({}, f);
|
|
140
|
+
if ((_f$response = f.response) !== null && _f$response !== void 0 && _f$response.success) {
|
|
141
|
+
var _ref2, _dataLevel$target$fil2;
|
|
142
|
+
target.fileId = f.response.data.fileId;
|
|
143
|
+
target.secId = (_ref2 = (_dataLevel$target$fil2 = dataLevel[target.fileId]) !== null && _dataLevel$target$fil2 !== void 0 ? _dataLevel$target$fil2 : level && level[target.fileId]) !== null && _ref2 !== void 0 ? _ref2 : undefined;
|
|
144
|
+
}
|
|
145
|
+
fileMap.set(key, target);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
/* 4. 把失败的项物理删除(同原逻辑)*/
|
|
149
|
+
var failedUids = [];
|
|
150
|
+
newFileList.forEach(function (f) {
|
|
151
|
+
if (f.response && !f.response.success) failedUids.push(f.uid);
|
|
121
152
|
});
|
|
122
|
-
|
|
153
|
+
failedUids.forEach(function (uid) {
|
|
154
|
+
return fileMap.delete(uid);
|
|
155
|
+
});
|
|
156
|
+
var merged = Array.from(fileMap.values());
|
|
157
|
+
setFileList(merged);
|
|
158
|
+
|
|
159
|
+
/* 5. 只回写“已完成”给表单 */
|
|
160
|
+
propsOnChange(merged.filter(function (f) {
|
|
161
|
+
var _f$response2;
|
|
162
|
+
return f.fileId || ((_f$response2 = f.response) === null || _f$response2 === void 0 ? void 0 : _f$response2.success);
|
|
163
|
+
}));
|
|
123
164
|
};
|
|
165
|
+
// 上传完成后,调用表单的 onChange 回调
|
|
124
166
|
var propsOnChange = function propsOnChange(files) {
|
|
125
167
|
if (props.onChange) {
|
|
126
168
|
props.onChange(files);
|
|
@@ -128,7 +170,7 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
128
170
|
};
|
|
129
171
|
//删除文件
|
|
130
172
|
var onRemove = /*#__PURE__*/function () {
|
|
131
|
-
var
|
|
173
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
|
132
174
|
var res;
|
|
133
175
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
134
176
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -139,9 +181,11 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
139
181
|
res = _context.sent;
|
|
140
182
|
if (res && res.success) {
|
|
141
183
|
_message.success(res.message);
|
|
142
|
-
setFileList(
|
|
143
|
-
return
|
|
144
|
-
|
|
184
|
+
setFileList(function (prev) {
|
|
185
|
+
return prev.filter(function (f) {
|
|
186
|
+
return (f.fileId || f.uid) !== (file.fileId || file.uid);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
145
189
|
}
|
|
146
190
|
case 4:
|
|
147
191
|
case "end":
|
|
@@ -150,7 +194,7 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
150
194
|
}, _callee);
|
|
151
195
|
}));
|
|
152
196
|
return function onRemove(_x) {
|
|
153
|
-
return
|
|
197
|
+
return _ref3.apply(this, arguments);
|
|
154
198
|
};
|
|
155
199
|
}();
|
|
156
200
|
/*
|
|
@@ -158,34 +202,25 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
158
202
|
* @param info
|
|
159
203
|
*/
|
|
160
204
|
var onSelectLevelChange = function onSelectLevelChange() {
|
|
161
|
-
var files = [];
|
|
162
205
|
var dataLevel = [];
|
|
163
|
-
(props.value || []).
|
|
206
|
+
(props.value || []).forEach(function (v) {
|
|
164
207
|
dataLevel[v.id] = v.secId;
|
|
165
208
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
_iterator2.e(err);
|
|
182
|
-
} finally {
|
|
183
|
-
_iterator2.f();
|
|
184
|
-
}
|
|
185
|
-
setFileList(files);
|
|
186
|
-
propsOnChange(files.filter(function (f) {
|
|
187
|
-
var _f$response2;
|
|
188
|
-
return f.fileId || ((_f$response2 = f.response) === null || _f$response2 === void 0 ? void 0 : _f$response2.success);
|
|
209
|
+
|
|
210
|
+
/* 1. 双键 Map 去重:优先 fileId,其次 uid */
|
|
211
|
+
var fileMap = new Map();
|
|
212
|
+
fileList.forEach(function (f) {
|
|
213
|
+
var _ref4, _dataLevel$f$fileId;
|
|
214
|
+
var key = f.fileId || f.uid;
|
|
215
|
+
// 更新 secId
|
|
216
|
+
f.secId = (_ref4 = (_dataLevel$f$fileId = dataLevel[f.fileId]) !== null && _dataLevel$f$fileId !== void 0 ? _dataLevel$f$fileId : level && level[f.fileId]) !== null && _ref4 !== void 0 ? _ref4 : undefined;
|
|
217
|
+
fileMap.set(key, f);
|
|
218
|
+
});
|
|
219
|
+
var merged = Array.from(fileMap.values());
|
|
220
|
+
setFileList(merged);
|
|
221
|
+
propsOnChange(merged.filter(function (f) {
|
|
222
|
+
var _f$response3;
|
|
223
|
+
return f.fileId || ((_f$response3 = f.response) === null || _f$response3 === void 0 ? void 0 : _f$response3.success);
|
|
189
224
|
}));
|
|
190
225
|
};
|
|
191
226
|
// 密级改变时,更新文件密级
|
|
@@ -199,38 +234,43 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
199
234
|
* 选择密级
|
|
200
235
|
*/
|
|
201
236
|
var onSelectLevel = /*#__PURE__*/function () {
|
|
202
|
-
var
|
|
203
|
-
var
|
|
237
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(v, file) {
|
|
238
|
+
var _file$response;
|
|
239
|
+
var key, fileId;
|
|
204
240
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
205
241
|
while (1) switch (_context2.prev = _context2.next) {
|
|
206
242
|
case 0:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
243
|
+
// 1. 函数式更新,用参数 prev 而不是外部 level
|
|
244
|
+
key = file.fileId || file.uid; //@ts-ignore
|
|
245
|
+
setLevel(function (prev) {
|
|
246
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, key, v));
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// 2. 调接口依旧用 fileId
|
|
250
|
+
if (!(file.fileId || (_file$response = file.response) !== null && _file$response !== void 0 && _file$response.success)) {
|
|
251
|
+
_context2.next = 6;
|
|
211
252
|
break;
|
|
212
253
|
}
|
|
213
254
|
fileId = file.fileId || file.response.data.fileId;
|
|
214
|
-
_context2.next =
|
|
255
|
+
_context2.next = 6;
|
|
215
256
|
return updateFileSecLevelNew(fileId, v.value);
|
|
216
|
-
case
|
|
257
|
+
case 6:
|
|
217
258
|
case "end":
|
|
218
259
|
return _context2.stop();
|
|
219
260
|
}
|
|
220
261
|
}, _callee2);
|
|
221
262
|
}));
|
|
222
263
|
return function onSelectLevel(_x2, _x3) {
|
|
223
|
-
return
|
|
264
|
+
return _ref5.apply(this, arguments);
|
|
224
265
|
};
|
|
225
266
|
}();
|
|
226
|
-
|
|
267
|
+
/* ---------- 2. beforeUpload:强制 status=uploading ---------- */
|
|
227
268
|
var handleBeforeUpload = function handleBeforeUpload(file) {
|
|
228
269
|
if (file.size > MAX_SIZE) {
|
|
229
270
|
_message.error('文件大小不能超过 100MB');
|
|
230
|
-
return _Upload.LIST_IGNORE;
|
|
231
|
-
// 或者 return false; // 原生 input 阻止上传
|
|
271
|
+
return _Upload.LIST_IGNORE;
|
|
232
272
|
}
|
|
233
|
-
return true;
|
|
273
|
+
return true; // 继续上传
|
|
234
274
|
};
|
|
235
275
|
var Component = props.component && props.component == "Dragger" ? Dragger : _Upload;
|
|
236
276
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Spin, {
|
|
@@ -238,27 +278,12 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
238
278
|
}, /*#__PURE__*/React.createElement(Component, _extends({
|
|
239
279
|
beforeUpload: handleBeforeUpload,
|
|
240
280
|
disabled: props.disabled,
|
|
241
|
-
showUploadList: {
|
|
242
|
-
showDownloadIcon: true,
|
|
243
|
-
downloadIcon: function downloadIcon(file) {
|
|
244
|
-
return /*#__PURE__*/React.createElement(DownLoad, {
|
|
245
|
-
hideProgress: true,
|
|
246
|
-
params: {
|
|
247
|
-
method: 'get'
|
|
248
|
-
},
|
|
249
|
-
fileName: function fileName() {
|
|
250
|
-
return file.name;
|
|
251
|
-
},
|
|
252
|
-
text: /*#__PURE__*/React.createElement("a", {
|
|
253
|
-
rel: "noopener noreferrer"
|
|
254
|
-
}, /*#__PURE__*/React.createElement(DownloadOutlined, null)),
|
|
255
|
-
loadUrl: downloadFile(file.fileId)
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
281
|
itemRender: function itemRender(originNode, file, fileList, actions) {
|
|
282
|
+
/* 上传中 / 成功 / 失败 不同 UI */
|
|
283
|
+
var uploading = file.status === 'uploading';
|
|
284
|
+
var error = file.status === 'error';
|
|
260
285
|
return /*#__PURE__*/React.createElement(FileCard, {
|
|
261
|
-
key: file.fileId,
|
|
286
|
+
key: "".concat(file.fileId || file.uid),
|
|
262
287
|
style: {
|
|
263
288
|
backgroundColor: props.disabled ? "#f5f5f5" : ""
|
|
264
289
|
},
|
|
@@ -266,7 +291,21 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
266
291
|
}, /*#__PURE__*/React.createElement(FileInfo, null, /*#__PURE__*/React.createElement("span", {
|
|
267
292
|
className: "name",
|
|
268
293
|
title: file.name
|
|
269
|
-
}, file.name)
|
|
294
|
+
}, file.name), uploading && /*#__PURE__*/React.createElement("div", {
|
|
295
|
+
style: {
|
|
296
|
+
width: 180,
|
|
297
|
+
marginTop: 4
|
|
298
|
+
}
|
|
299
|
+
}, /*#__PURE__*/React.createElement(_Progress, {
|
|
300
|
+
percent: Math.round(file.percent || 0),
|
|
301
|
+
size: "small",
|
|
302
|
+
strokeColor: "#1890ff"
|
|
303
|
+
})), error && /*#__PURE__*/React.createElement("span", {
|
|
304
|
+
style: {
|
|
305
|
+
color: '#ff4d4f',
|
|
306
|
+
fontSize: 12
|
|
307
|
+
}
|
|
308
|
+
}, "\u4E0A\u4F20\u5931\u8D25")), /*#__PURE__*/React.createElement(Actions, null, /*#__PURE__*/React.createElement(Item, {
|
|
270
309
|
layout: "horizontal"
|
|
271
310
|
// 关键:让表单知道这是 fileList[index].secId
|
|
272
311
|
,
|
|
@@ -288,7 +327,7 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
288
327
|
style: {
|
|
289
328
|
width: 120
|
|
290
329
|
}
|
|
291
|
-
})), /*#__PURE__*/React.createElement(_Tooltip, {
|
|
330
|
+
})), !uploading && /*#__PURE__*/React.createElement(_Tooltip, {
|
|
292
331
|
title: "\u4E0B\u8F7D"
|
|
293
332
|
}, /*#__PURE__*/React.createElement("a", {
|
|
294
333
|
href: downloadFile(file.fileId),
|
|
@@ -299,7 +338,7 @@ var VenusUploadSecLevel = function VenusUploadSecLevel(props) {
|
|
|
299
338
|
style: {
|
|
300
339
|
color: 'red'
|
|
301
340
|
},
|
|
302
|
-
disabled: props.disabled,
|
|
341
|
+
disabled: props.disabled || uploading,
|
|
303
342
|
onClick: function onClick() {
|
|
304
343
|
return onRemove(file);
|
|
305
344
|
}
|