@vtx/components 4.0.0-beta.8 → 4.0.0-beta.81
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 +19 -19
- package/es/index.js +3 -0
- package/es/utils/components/LabelIconTip/index.js +7 -7
- package/es/utils/conversionMomentValue/index.js +25 -25
- package/es/utils/filterSpecialCharacters.js +53 -52
- package/es/utils/genCopyable/index.js +6 -6
- package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/es/utils/hooks/useDebounceFn/index.js +4 -4
- package/es/utils/hooks/useDebounceValue/index.js +6 -6
- package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +5 -5
- package/es/utils/index.js +1 -2
- package/es/utils/isBrowser/index.js +7 -7
- package/es/utils/isUrl/index.js +4 -4
- package/es/utils/merge/index.js +4 -4
- package/es/utils/nanoid/index.js +4 -4
- package/es/utils/omitBoolean/index.js +4 -4
- package/es/utils/parseValueToMoment/index.js +4 -4
- package/es/utils/proFieldParsingText/index.js +10 -10
- package/es/utils/transformKeySubmitValue/index.js +57 -57
- package/es/utils/useEditableArray/index.js +46 -46
- package/es/utils/useEditableMap/index.js +22 -22
- package/es/utils/useMediaQuery/index.js +5 -5
- package/es/vtx-combogrid/Combogrid.js +5 -4
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-datagrid/Store/Provide.js +106 -137
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/es/vtx-datagrid/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +124 -32
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +102 -20
- package/es/vtx-datagrid/style/index.less +242 -242
- package/es/vtx-date-picker/QdatePicker.js +1 -1
- package/es/vtx-date-picker/style/index.less +39 -39
- package/es/vtx-descriptions/Descriptions.js +29 -0
- package/es/vtx-descriptions/index.js +3 -0
- package/es/vtx-descriptions/style/index.js +19 -0
- package/es/vtx-ellipsis-text/index.js +7 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -33
- package/es/vtx-export-async/History.js +15 -7
- package/es/vtx-export-async/index.js +45 -15
- package/es/vtx-export-async/util.js +16 -5
- package/es/vtx-form-layout/Card.js +10 -10
- package/es/vtx-form-layout/Divider.js +1 -1
- package/es/vtx-form-layout/FormItem.js +16 -16
- package/es/vtx-form-layout/Pane.js +23 -12
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/Preview.js +11 -6
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +211 -70
- package/es/vtx-import/result.js +28 -26
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +30 -19
- package/es/vtx-import2/style/index.js +60 -9
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/TabLayout.js +6 -6
- package/es/vtx-page-layout/TableLayout.js +10 -10
- package/es/vtx-page-layout/TreeLayout.js +6 -6
- package/es/vtx-page-layout/container.js +2 -2
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +37 -33
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_US.js +57 -3
- package/es/vtx-provider/locale/zh_CN.js +57 -3
- package/es/vtx-provider/useStyle/index.js +17 -17
- package/es/vtx-search/index.js +13 -9
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +102 -36
- package/es/vtx-select/style/index.js +11 -56
- package/es/vtx-signature/index.js +5 -4
- package/es/vtx-signature/style/index.js +1 -1
- package/es/vtx-split-pane/Resizer.js +0 -1
- package/es/vtx-split-pane/SplitPane.js +42 -34
- package/es/vtx-split-pane/style/index.js +8 -112
- package/es/vtx-time-picker/index.js +27 -1
- package/es/vtx-transfer/Transfer.js +29 -0
- package/es/vtx-transfer/index.js +3 -0
- package/es/vtx-transfer/style/index.js +19 -0
- package/es/vtx-transfer-select/TransferSelect.js +143 -0
- package/es/vtx-transfer-select/index.js +3 -0
- package/es/vtx-transfer-select/style/index.js +19 -0
- package/es/vtx-tree/index.js +98 -35
- package/es/vtx-tree-select/index.js +71 -105
- package/es/vtx-tree-select/style/index.js +9 -3
- package/es/vtx-upload/FilePreview.js +2 -1
- package/es/vtx-wang-editor/index.js +93 -39
- package/es/vtx-wang-editor/style/index.less +12 -12
- package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/lib/index.js +36 -0
- package/lib/utils/components/LabelIconTip/index.js +7 -7
- package/lib/utils/conversionMomentValue/index.js +25 -25
- package/lib/utils/filterSpecialCharacters.js +54 -52
- package/lib/utils/genCopyable/index.js +6 -6
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/lib/utils/hooks/useDebounceFn/index.js +4 -4
- package/lib/utils/hooks/useDebounceValue/index.js +6 -6
- package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/lib/utils/hooks/useLatest/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +5 -5
- package/lib/utils/index.js +0 -7
- package/lib/utils/isBrowser/index.js +7 -7
- package/lib/utils/isUrl/index.js +4 -4
- package/lib/utils/merge/index.js +4 -4
- package/lib/utils/nanoid/index.js +4 -4
- package/lib/utils/omitBoolean/index.js +4 -4
- package/lib/utils/parseValueToMoment/index.js +4 -4
- package/lib/utils/proFieldParsingText/index.js +10 -10
- package/lib/utils/transformKeySubmitValue/index.js +57 -57
- package/lib/utils/useEditableArray/index.js +46 -46
- package/lib/utils/useEditableMap/index.js +22 -22
- package/lib/utils/useMediaQuery/index.js +5 -5
- package/lib/vtx-combogrid/Combogrid.js +5 -4
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-datagrid/Store/Provide.js +113 -143
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/lib/vtx-datagrid/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +124 -32
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +102 -20
- package/lib/vtx-datagrid/style/index.less +242 -242
- package/lib/vtx-date-picker/QdatePicker.js +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-descriptions/Descriptions.js +38 -0
- package/lib/vtx-descriptions/index.js +15 -0
- package/lib/vtx-descriptions/style/index.js +25 -0
- package/lib/vtx-ellipsis-text/index.js +7 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -34
- package/lib/vtx-export-async/History.js +14 -8
- package/lib/vtx-export-async/index.js +43 -13
- package/lib/vtx-export-async/util.js +16 -5
- package/lib/vtx-form-layout/Card.js +9 -9
- package/lib/vtx-form-layout/Divider.js +1 -1
- package/lib/vtx-form-layout/FormItem.js +16 -16
- package/lib/vtx-form-layout/Pane.js +22 -11
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/Preview.js +11 -6
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +209 -71
- package/lib/vtx-import/result.js +29 -27
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +29 -18
- package/lib/vtx-import2/style/index.js +60 -9
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/TabLayout.js +6 -6
- package/lib/vtx-page-layout/TableLayout.js +10 -10
- package/lib/vtx-page-layout/TreeLayout.js +6 -6
- package/lib/vtx-page-layout/container.js +2 -2
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +37 -33
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_US.js +57 -3
- package/lib/vtx-provider/locale/zh_CN.js +57 -3
- package/lib/vtx-provider/useStyle/index.js +17 -17
- package/lib/vtx-search/index.js +13 -9
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +104 -38
- package/lib/vtx-select/style/index.js +11 -56
- package/lib/vtx-signature/index.js +4 -3
- package/lib/vtx-signature/style/index.js +1 -1
- package/lib/vtx-split-pane/Resizer.js +0 -1
- package/lib/vtx-split-pane/SplitPane.js +40 -31
- package/lib/vtx-split-pane/style/index.js +8 -112
- package/lib/vtx-time-picker/index.js +27 -1
- package/lib/vtx-transfer/Transfer.js +38 -0
- package/lib/vtx-transfer/index.js +15 -0
- package/lib/vtx-transfer/style/index.js +25 -0
- package/lib/vtx-transfer-select/TransferSelect.js +151 -0
- package/lib/vtx-transfer-select/index.js +15 -0
- package/lib/vtx-transfer-select/style/index.js +25 -0
- package/lib/vtx-tree/index.js +96 -33
- package/lib/vtx-tree-select/index.js +71 -105
- package/lib/vtx-tree-select/style/index.js +9 -3
- package/lib/vtx-upload/FilePreview.js +2 -1
- package/lib/vtx-wang-editor/index.js +91 -37
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/package.json +240 -225
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
package/lib/vtx-import/index.js
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.VtxImport = VtxImport;
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _utils = require("@vtx/utils");
|
|
10
10
|
var _antd = require("antd");
|
|
11
|
+
var _md = _interopRequireDefault(require("md5"));
|
|
11
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _getToken = _interopRequireDefault(require("../utils/getToken"));
|
|
12
14
|
var _useSet3 = _interopRequireDefault(require("../utils/useSet"));
|
|
15
|
+
var _vtxModal = _interopRequireDefault(require("../vtx-modal"));
|
|
16
|
+
var _vtxProvider = require("../vtx-provider");
|
|
13
17
|
var _result = _interopRequireDefault(require("./result"));
|
|
14
|
-
var _getToken = _interopRequireDefault(require("../utils/getToken"));
|
|
15
|
-
var _md = _interopRequireDefault(require("md5"));
|
|
16
|
-
var _utils = require("@vtx/utils");
|
|
17
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
18
18
|
var _index = require("./style/index");
|
|
19
|
-
var _vtxProvider = require("../vtx-provider");
|
|
20
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
function
|
|
23
|
-
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 && Object.prototype.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; }
|
|
24
|
-
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; }
|
|
25
|
-
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; }
|
|
26
|
-
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; }
|
|
27
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
|
-
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); }
|
|
21
|
+
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); }
|
|
29
22
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
30
23
|
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."); }
|
|
31
24
|
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); }
|
|
32
25
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
33
26
|
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; } }
|
|
34
27
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
|
-
var
|
|
28
|
+
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; }
|
|
29
|
+
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; }
|
|
30
|
+
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; }
|
|
31
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
32
|
+
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); }
|
|
36
33
|
function VtxImport(props) {
|
|
34
|
+
var templateURL = props.templateURL,
|
|
35
|
+
uploadURL = props.uploadURL,
|
|
36
|
+
afterUpload = props.afterUpload,
|
|
37
|
+
beforeUpload = props.beforeUpload;
|
|
38
|
+
var token = (0, _react.useMemo)(function () {
|
|
39
|
+
return props.token || (0, _getToken.default)();
|
|
40
|
+
}, [props.token]);
|
|
37
41
|
var intl = (0, _vtxProvider.useIntl)();
|
|
38
42
|
var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
|
|
39
43
|
getPrefixCls = _useContext.getPrefixCls;
|
|
@@ -41,14 +45,35 @@ function VtxImport(props) {
|
|
|
41
45
|
var _useStyle = (0, _index.useStyle)(prefixCls),
|
|
42
46
|
wrapSSR = _useStyle.wrapSSR,
|
|
43
47
|
hashId = _useStyle.hashId;
|
|
48
|
+
var TextEnum = _objectSpread({
|
|
49
|
+
rowNumberText: intl.getMessage('import.rowNumber', '行号'),
|
|
50
|
+
errorMessageText: intl.getMessage('import.errorMessage', '错误说明'),
|
|
51
|
+
resultTitleText: intl.getMessage('import.result', '导入结果'),
|
|
52
|
+
btnCloseText: intl.getMessage('switch.close', '关闭'),
|
|
53
|
+
operationText: intl.getMessage('import.operation', '导入'),
|
|
54
|
+
uploadFailedText: intl.getMessage('import.error', '上传失败'),
|
|
55
|
+
parseResponseFailedText: intl.getMessage('import.error', '解析响应失败'),
|
|
56
|
+
uploadSuccessText: intl.getMessage('import.success', '上传成功'),
|
|
57
|
+
parseResponseDataFailedText: intl.getMessage('import.error', '解析响应数据失败'),
|
|
58
|
+
downloadTemplateText: intl.getMessage('import.downloadTemplate', '下载模板'),
|
|
59
|
+
pleaseSelectFileText: intl.getMessage('import.pleaseSelectFile', '请选择需要上传的文件'),
|
|
60
|
+
uploadText: intl.getMessage('import.upload', '上传'),
|
|
61
|
+
selectFileText: intl.getMessage('import.selectFile', '选择文件'),
|
|
62
|
+
noFileSelectedText: intl.getMessage('import.noFileSelected', '未选择任何文件')
|
|
63
|
+
}, props.customEnumText);
|
|
64
|
+
|
|
65
|
+
// 用 useRef 管理 DOM 引用,而不是 state
|
|
66
|
+
var fileInputRef = (0, _react.useRef)(null);
|
|
67
|
+
var iframeRef = (0, _react.useRef)(null);
|
|
68
|
+
var formRef = (0, _react.useRef)(null);
|
|
69
|
+
|
|
70
|
+
// 用于追踪当前 XHR 请求,方便取消
|
|
71
|
+
var xhrRef = (0, _react.useRef)(null);
|
|
44
72
|
var indexRef = (0, _react.useRef)(0);
|
|
45
73
|
var _useSet = (0, _useSet3.default)({
|
|
46
|
-
fileForm: null,
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
// 保存上传的文件
|
|
50
|
-
iframe: null,
|
|
51
|
-
// form表单提交之后跳转的
|
|
74
|
+
// fileForm: null, // form表单
|
|
75
|
+
// fileInput: null, // 保存上传的文件
|
|
76
|
+
// iframe: null, // form表单提交之后跳转的
|
|
52
77
|
useFormData: window.FormData ? true : false,
|
|
53
78
|
// 是否查看
|
|
54
79
|
uploading: false,
|
|
@@ -62,13 +87,22 @@ function VtxImport(props) {
|
|
|
62
87
|
// 导入结果查看
|
|
63
88
|
modalWidth: props.modalWidth || 800,
|
|
64
89
|
columns: props.columns || [{
|
|
65
|
-
title:
|
|
90
|
+
title: TextEnum.rowNumberText,
|
|
66
91
|
dataIndex: 'lineNum',
|
|
67
92
|
key: 'lineNum'
|
|
68
93
|
}, {
|
|
69
|
-
title:
|
|
94
|
+
title: TextEnum.errorMessageText,
|
|
70
95
|
dataIndex: 'messages',
|
|
71
|
-
key: 'messages'
|
|
96
|
+
key: 'messages',
|
|
97
|
+
render: function render(val) {
|
|
98
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
99
|
+
style: {
|
|
100
|
+
display: 'flex',
|
|
101
|
+
width: 600
|
|
102
|
+
},
|
|
103
|
+
children: [" ", val]
|
|
104
|
+
});
|
|
105
|
+
}
|
|
72
106
|
}],
|
|
73
107
|
step: 1,
|
|
74
108
|
chunkSize: props.chunkSize || 10 * 1024 * 1024,
|
|
@@ -76,7 +110,8 @@ function VtxImport(props) {
|
|
|
76
110
|
currentIndex: 0,
|
|
77
111
|
chunkId: '',
|
|
78
112
|
chunks: [],
|
|
79
|
-
operation: props.operation ||
|
|
113
|
+
operation: props.operation || TextEnum.operationText,
|
|
114
|
+
fileName: ''
|
|
80
115
|
}),
|
|
81
116
|
_useSet2 = _slicedToArray(_useSet, 2),
|
|
82
117
|
state = _useSet2[0],
|
|
@@ -111,7 +146,7 @@ function VtxImport(props) {
|
|
|
111
146
|
data.append('chunkNo', i + 1);
|
|
112
147
|
data.append('chunkId', state.chunkId);
|
|
113
148
|
data.append('tenantId', (0, _utils.getVtxToken)('tenantId'));
|
|
114
|
-
data.append('file', new File([e],
|
|
149
|
+
data.append('file', new File([e], fileInputRef.current.files[0].name));
|
|
115
150
|
dataArr.push(data);
|
|
116
151
|
});
|
|
117
152
|
uploadAsync(dataArr);
|
|
@@ -121,6 +156,7 @@ function VtxImport(props) {
|
|
|
121
156
|
function uploadAsync(list) {
|
|
122
157
|
if (indexRef.current < list.length) {
|
|
123
158
|
var xhr = new XMLHttpRequest();
|
|
159
|
+
xhrRef.current = xhr;
|
|
124
160
|
xhr.onload = function () {
|
|
125
161
|
if (xhr.status === 200) {
|
|
126
162
|
setState({
|
|
@@ -131,10 +167,12 @@ function VtxImport(props) {
|
|
|
131
167
|
}
|
|
132
168
|
};
|
|
133
169
|
xhr.onerror = function () {
|
|
134
|
-
_antd.message.error(
|
|
170
|
+
_antd.message.error(TextEnum.uploadFailedText);
|
|
135
171
|
};
|
|
136
172
|
// 发送请求
|
|
137
173
|
xhr.open('POST', '/cloudFile/common/uploadChunk', true);
|
|
174
|
+
xhr.setRequestHeader('Authorization', token ? "Bearer ".concat(token) : '');
|
|
175
|
+
xhr.setRequestHeader('access_token', token ? "".concat(token) : '');
|
|
138
176
|
xhr.send(list[indexRef.current]);
|
|
139
177
|
} else {
|
|
140
178
|
mergeFile();
|
|
@@ -144,28 +182,42 @@ function VtxImport(props) {
|
|
|
144
182
|
// 合并分片
|
|
145
183
|
function mergeFile() {
|
|
146
184
|
var xhr = new XMLHttpRequest();
|
|
185
|
+
xhrRef.current = xhr;
|
|
147
186
|
// 当上传完成时调用
|
|
148
187
|
xhr.onload = function () {
|
|
149
188
|
if (xhr.status === 200) {
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
|
|
189
|
+
var _res;
|
|
190
|
+
var res;
|
|
191
|
+
try {
|
|
192
|
+
res = JSON.parse(xhr.responseText);
|
|
193
|
+
} catch (e) {
|
|
194
|
+
_antd.message.error(TextEnum.parseResponseFailedText);
|
|
195
|
+
setState({
|
|
196
|
+
uploading: false
|
|
197
|
+
});
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (((_res = res) === null || _res === void 0 ? void 0 : _res.result) == 0) {
|
|
201
|
+
_antd.message.success(TextEnum.uploadSuccessText);
|
|
153
202
|
chunkUpload(res.data);
|
|
154
203
|
} else {
|
|
155
|
-
|
|
204
|
+
var _res2;
|
|
205
|
+
_antd.message.error(((_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.msg) || TextEnum.uploadFailedText);
|
|
156
206
|
}
|
|
157
207
|
}
|
|
158
208
|
};
|
|
159
209
|
xhr.onerror = function () {
|
|
160
|
-
_antd.message.error(
|
|
210
|
+
_antd.message.error(TextEnum.uploadFailedText);
|
|
161
211
|
};
|
|
162
212
|
// 发送请求
|
|
163
213
|
xhr.open('POST', '/cloudFile/common/mergeChunk', true);
|
|
214
|
+
xhr.setRequestHeader('Authorization', token ? "Bearer ".concat(token) : '');
|
|
215
|
+
xhr.setRequestHeader('access_token', token ? "".concat(token) : '');
|
|
164
216
|
var data = new FormData();
|
|
165
217
|
data.append('chunkId', state.chunkId);
|
|
166
218
|
data.append('tenantId', (0, _utils.getVtxToken)('tenantId'));
|
|
167
219
|
data.append('chunkSize', state.chunks.length);
|
|
168
|
-
data.append('fileName',
|
|
220
|
+
data.append('fileName', fileInputRef.current.files[0].name);
|
|
169
221
|
xhr.send(data);
|
|
170
222
|
}
|
|
171
223
|
|
|
@@ -175,6 +227,7 @@ function VtxImport(props) {
|
|
|
175
227
|
var postData = props.postData || {};
|
|
176
228
|
if (state.useFormData) {
|
|
177
229
|
var request = new XMLHttpRequest();
|
|
230
|
+
xhrRef.current = request;
|
|
178
231
|
// 发送请求
|
|
179
232
|
request.open('POST', postUrl);
|
|
180
233
|
request.setRequestHeader('Authorization', token ? "Bearer ".concat(token) : '');
|
|
@@ -205,6 +258,7 @@ function VtxImport(props) {
|
|
|
205
258
|
var postData = props.postData || {};
|
|
206
259
|
if (state.useFormData) {
|
|
207
260
|
var request = new XMLHttpRequest();
|
|
261
|
+
xhrRef.current = request;
|
|
208
262
|
// 发送请求
|
|
209
263
|
request.open('POST', postUrl);
|
|
210
264
|
request.setRequestHeader('Authorization', token ? "Bearer ".concat(token) : '');
|
|
@@ -225,7 +279,7 @@ function VtxImport(props) {
|
|
|
225
279
|
};
|
|
226
280
|
//创建formdata对象
|
|
227
281
|
var fmd = new FormData();
|
|
228
|
-
fmd.append(state.fileKey,
|
|
282
|
+
fmd.append(state.fileKey, fileInputRef.current.files[0]);
|
|
229
283
|
request.send(fmd);
|
|
230
284
|
}
|
|
231
285
|
}
|
|
@@ -256,7 +310,9 @@ function VtxImport(props) {
|
|
|
256
310
|
return postArray.length > 0 ? "".concat(postUrl, "?").concat(postArray.join('&')) : postUrl;
|
|
257
311
|
};
|
|
258
312
|
var closeModal = function closeModal() {
|
|
259
|
-
|
|
313
|
+
if (fileInputRef.current) {
|
|
314
|
+
fileInputRef.current.value = '';
|
|
315
|
+
}
|
|
260
316
|
if (typeof props.close === 'function') {
|
|
261
317
|
props.close();
|
|
262
318
|
} else {
|
|
@@ -267,15 +323,24 @@ function VtxImport(props) {
|
|
|
267
323
|
};
|
|
268
324
|
// 上传之后的回调 - 展示报错信息
|
|
269
325
|
var uploadSuccess = function uploadSuccess(data) {
|
|
270
|
-
|
|
326
|
+
var _parseData;
|
|
327
|
+
if (fileInputRef.current) {
|
|
328
|
+
fileInputRef.current.value = '';
|
|
329
|
+
}
|
|
271
330
|
setState({
|
|
272
331
|
uploading: false
|
|
273
332
|
});
|
|
333
|
+
var parseData;
|
|
334
|
+
try {
|
|
335
|
+
parseData = JSON.parse(data);
|
|
336
|
+
} catch (e) {
|
|
337
|
+
_antd.message.error(TextEnum.parseResponseDataFailedText);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
274
340
|
if (typeof props.afterUpload === 'function') {
|
|
275
341
|
afterUpload(data);
|
|
276
342
|
}
|
|
277
|
-
|
|
278
|
-
if (Array.isArray(parseData === null || parseData === void 0 ? void 0 : parseData.data)) {
|
|
343
|
+
if (Array.isArray((_parseData = parseData) === null || _parseData === void 0 ? void 0 : _parseData.data)) {
|
|
279
344
|
setState({
|
|
280
345
|
resultVisible: true,
|
|
281
346
|
resultData: parseData.data.map(function (item, index) {
|
|
@@ -290,47 +355,46 @@ function VtxImport(props) {
|
|
|
290
355
|
} else {
|
|
291
356
|
// 新增其他错误提示
|
|
292
357
|
if (parseData.result !== 0) {
|
|
293
|
-
|
|
358
|
+
var _parseData2;
|
|
359
|
+
_antd.message.error(((_parseData2 = parseData) === null || _parseData2 === void 0 ? void 0 : _parseData2.msg) || TextEnum.uploadSuccessText);
|
|
294
360
|
}
|
|
295
361
|
}
|
|
296
362
|
};
|
|
297
|
-
var templateURL = props.templateURL,
|
|
298
|
-
uploadURL = props.uploadURL,
|
|
299
|
-
afterUpload = props.afterUpload,
|
|
300
|
-
beforeUpload = props.beforeUpload;
|
|
301
363
|
var modalProps = {
|
|
302
364
|
className: "".concat(prefixCls, "-modal"),
|
|
303
365
|
open: state.visible,
|
|
304
|
-
title:
|
|
366
|
+
title: TextEnum.operationText,
|
|
305
367
|
onCancel: function onCancel() {
|
|
306
368
|
return closeModal();
|
|
307
369
|
},
|
|
308
|
-
maskClosable: false,
|
|
370
|
+
// maskClosable: false,
|
|
371
|
+
mask: {
|
|
372
|
+
closable: false
|
|
373
|
+
},
|
|
309
374
|
footer: [templateURL ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
310
375
|
onClick: function onClick() {
|
|
311
376
|
window.open(templateURL);
|
|
312
377
|
},
|
|
313
|
-
children:
|
|
378
|
+
children: TextEnum.downloadTemplateText
|
|
314
379
|
}, "downloadTemple") : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
315
380
|
type: "primary",
|
|
316
381
|
loading: state.uploading,
|
|
317
382
|
onClick: function onClick() {
|
|
383
|
+
var _fileInputRef$current2;
|
|
318
384
|
if (typeof props.beforeUpload === 'function') {
|
|
319
|
-
var
|
|
385
|
+
var _fileInputRef$current;
|
|
386
|
+
var flag = beforeUpload((_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 || (_fileInputRef$current = _fileInputRef$current.files) === null || _fileInputRef$current === void 0 ? void 0 : _fileInputRef$current[0]);
|
|
320
387
|
if (!flag) {
|
|
321
|
-
|
|
322
|
-
setState({
|
|
323
|
-
fileInput: null
|
|
324
|
-
});
|
|
388
|
+
fileInputRef.current.value = '';
|
|
325
389
|
return;
|
|
326
390
|
}
|
|
327
391
|
}
|
|
328
|
-
if (
|
|
392
|
+
if ((_fileInputRef$current2 = fileInputRef.current) !== null && _fileInputRef$current2 !== void 0 && _fileInputRef$current2.value) {
|
|
329
393
|
setState({
|
|
330
394
|
uploading: true
|
|
331
395
|
});
|
|
332
396
|
// 上传文件
|
|
333
|
-
checkFile(
|
|
397
|
+
checkFile(fileInputRef.current.files[0]);
|
|
334
398
|
// const postUrl = getPostURL();
|
|
335
399
|
// if (state.useFormData) {
|
|
336
400
|
// const request = new XMLHttpRequest();
|
|
@@ -350,16 +414,17 @@ function VtxImport(props) {
|
|
|
350
414
|
// request.send(fmd);
|
|
351
415
|
// }
|
|
352
416
|
} else {
|
|
353
|
-
_antd.message.info(
|
|
417
|
+
_antd.message.info(TextEnum.pleaseSelectFileText);
|
|
354
418
|
}
|
|
355
419
|
},
|
|
356
|
-
children:
|
|
420
|
+
children: TextEnum.uploadText
|
|
357
421
|
}, "uploadSubmit"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
358
422
|
onClick: function onClick() {
|
|
359
423
|
closeModal();
|
|
360
424
|
},
|
|
361
|
-
children:
|
|
362
|
-
}, "closeWindow")]
|
|
425
|
+
children: TextEnum.btnCloseText
|
|
426
|
+
}, "closeWindow")],
|
|
427
|
+
width: 520
|
|
363
428
|
};
|
|
364
429
|
var resultProps = {
|
|
365
430
|
visible: state.resultVisible,
|
|
@@ -370,38 +435,109 @@ function VtxImport(props) {
|
|
|
370
435
|
resultVisible: false
|
|
371
436
|
});
|
|
372
437
|
},
|
|
373
|
-
modalWidth: state.modalWidth
|
|
438
|
+
modalWidth: state.modalWidth,
|
|
439
|
+
TextEnum: TextEnum
|
|
374
440
|
};
|
|
441
|
+
|
|
442
|
+
// 组件卸载时清理
|
|
443
|
+
(0, _react.useEffect)(function () {
|
|
444
|
+
return function () {
|
|
445
|
+
// 取消进行中的 XHR 请求
|
|
446
|
+
if (xhrRef.current) {
|
|
447
|
+
xhrRef.current.abort();
|
|
448
|
+
xhrRef.current = null;
|
|
449
|
+
}
|
|
450
|
+
// 清理文件输入
|
|
451
|
+
if (fileInputRef.current) {
|
|
452
|
+
fileInputRef.current.value = '';
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
}, []);
|
|
375
456
|
(0, _react.useEffect)(function () {
|
|
376
457
|
if (state.chunkId) {
|
|
377
458
|
startUpload();
|
|
378
459
|
}
|
|
379
460
|
}, [state.chunkId]);
|
|
380
|
-
|
|
381
|
-
|
|
461
|
+
var truncateFileName = function truncateFileName(fileName) {
|
|
462
|
+
var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 28;
|
|
463
|
+
if (fileName.length <= maxLength) return fileName;
|
|
464
|
+
var extIndex = fileName.lastIndexOf('.');
|
|
465
|
+
var ext = extIndex !== -1 ? fileName.slice(extIndex) : '';
|
|
466
|
+
var name = extIndex !== -1 ? fileName.slice(0, extIndex) : fileName;
|
|
467
|
+
var availableLength = maxLength - ext.length - 3; // 3 是 "..."
|
|
468
|
+
if (availableLength <= 0) return "...".concat(ext);
|
|
469
|
+
var startLength = Math.ceil(availableLength / 2);
|
|
470
|
+
var endLength = Math.floor(availableLength / 2);
|
|
471
|
+
var start = name.slice(0, startLength);
|
|
472
|
+
var end = name.slice(-endLength);
|
|
473
|
+
return "".concat(start, "...").concat(end).concat(ext);
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
// 处理文件选择变化
|
|
477
|
+
var handleFileChange = function handleFileChange(event) {
|
|
478
|
+
var _event$target$files;
|
|
479
|
+
var file = (_event$target$files = event.target.files) === null || _event$target$files === void 0 ? void 0 : _event$target$files[0];
|
|
480
|
+
if (file) {
|
|
481
|
+
setState(function (prev) {
|
|
482
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
483
|
+
fileName: truncateFileName(file.name)
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
// 这里可以添加文件上传或其他处理逻辑
|
|
487
|
+
// 例如:uploadFile(file);
|
|
488
|
+
} else {
|
|
489
|
+
setState(function (prev) {
|
|
490
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
491
|
+
fileName: ''
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
var handleSelectFile = function handleSelectFile() {
|
|
497
|
+
var _fileInputRef$current3;
|
|
498
|
+
(_fileInputRef$current3 = fileInputRef.current) === null || _fileInputRef$current3 === void 0 || _fileInputRef$current3.click();
|
|
499
|
+
};
|
|
500
|
+
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_vtxModal.default, _objectSpread(_objectSpread({}, modalProps), {}, {
|
|
501
|
+
children: [props.children, /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
|
|
382
502
|
encType: "multipart/form-data",
|
|
383
503
|
method: "post",
|
|
384
504
|
target: "tmp",
|
|
385
505
|
action: uploadURL,
|
|
386
|
-
ref:
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
506
|
+
ref: formRef,
|
|
507
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
508
|
+
className: "".concat(prefixCls, "-btn"),
|
|
509
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
510
|
+
onClick: handleSelectFile,
|
|
511
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
512
|
+
className: "".concat(prefixCls, "-label"),
|
|
513
|
+
children: TextEnum.selectFileText
|
|
514
|
+
})
|
|
515
|
+
}), state.fileName ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
516
|
+
title: state.fileName,
|
|
517
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
518
|
+
className: "".concat(prefixCls, "-file-name"),
|
|
519
|
+
children: state.fileName
|
|
520
|
+
})
|
|
521
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
522
|
+
className: "".concat(prefixCls, "-file-name"),
|
|
523
|
+
children: TextEnum.noFileSelectedText
|
|
524
|
+
})]
|
|
525
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
390
526
|
type: "file",
|
|
391
527
|
name: state.fileKey,
|
|
392
528
|
accept: state.accept,
|
|
393
|
-
ref:
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
529
|
+
ref: fileInputRef,
|
|
530
|
+
style: {
|
|
531
|
+
display: 'none'
|
|
532
|
+
},
|
|
533
|
+
onChange: handleFileChange
|
|
534
|
+
})]
|
|
397
535
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
|
|
398
536
|
name: "tmp",
|
|
399
537
|
style: {
|
|
400
538
|
display: 'none'
|
|
401
539
|
},
|
|
402
|
-
ref:
|
|
403
|
-
if (dom) state.iframe = dom;
|
|
404
|
-
}
|
|
540
|
+
ref: iframeRef
|
|
405
541
|
}), state.resultVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_result.default, _objectSpread({}, resultProps))]
|
|
406
542
|
})));
|
|
407
543
|
}
|
|
@@ -412,11 +548,13 @@ VtxImport.propTypes = {
|
|
|
412
548
|
postData: _propTypes.default.object,
|
|
413
549
|
fileKey: _propTypes.default.string,
|
|
414
550
|
accept: _propTypes.default.string,
|
|
551
|
+
token: _propTypes.default.string,
|
|
415
552
|
operation: _propTypes.default.string,
|
|
416
553
|
close: _propTypes.default.func,
|
|
417
554
|
afterUpload: _propTypes.default.func,
|
|
418
555
|
modalWidth: _propTypes.default.number,
|
|
419
556
|
columns: _propTypes.default.array,
|
|
557
|
+
customEnumText: _propTypes.default.object,
|
|
420
558
|
children: _propTypes.default.object,
|
|
421
559
|
beforeUpload: _propTypes.default.func,
|
|
422
560
|
chunkSize: _propTypes.default.number
|
package/lib/vtx-import/result.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -10,22 +9,26 @@ var _antd = require("antd");
|
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
10
|
var _useSet3 = _interopRequireDefault(require("../utils/useSet"));
|
|
12
11
|
var _vtxDatagrid = _interopRequireDefault(require("../vtx-datagrid"));
|
|
13
|
-
var
|
|
12
|
+
var _vtxModal = _interopRequireDefault(require("../vtx-modal"));
|
|
14
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function
|
|
17
|
-
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; }
|
|
18
|
-
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; }
|
|
19
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
20
|
-
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); }
|
|
15
|
+
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); }
|
|
21
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
22
17
|
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."); }
|
|
23
18
|
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); }
|
|
24
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
25
20
|
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; } }
|
|
26
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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; }
|
|
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; }
|
|
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; }
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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); }
|
|
27
27
|
function VtxImportResult(props) {
|
|
28
|
-
var
|
|
28
|
+
var TextEnum = _objectSpread({
|
|
29
|
+
resultTitleText: '导入结果',
|
|
30
|
+
btnCloseText: '关闭'
|
|
31
|
+
}, props.TextEnum);
|
|
29
32
|
var _useSet = (0, _useSet3.default)({
|
|
30
33
|
visible: props.visible || false,
|
|
31
34
|
dataSource: props.dataSource || [],
|
|
@@ -35,47 +38,45 @@ function VtxImportResult(props) {
|
|
|
35
38
|
_useSet2 = _slicedToArray(_useSet, 1),
|
|
36
39
|
state = _useSet2[0];
|
|
37
40
|
var modalProps = {
|
|
38
|
-
bodyStyle: {
|
|
39
|
-
backgroundColor: '#f8f8f8'
|
|
40
|
-
},
|
|
41
|
+
bodyStyle: {},
|
|
41
42
|
open: state.visible,
|
|
42
|
-
title:
|
|
43
|
+
title: TextEnum.resultTitleText,
|
|
43
44
|
onCancel: function onCancel() {
|
|
44
45
|
if (typeof props.hideVisible === 'function') {
|
|
45
46
|
props.hideVisible();
|
|
46
47
|
}
|
|
47
48
|
},
|
|
48
49
|
width: state.modalWidth,
|
|
49
|
-
maskClosable: false,
|
|
50
|
+
// maskClosable: false,
|
|
51
|
+
mask: {
|
|
52
|
+
closable: false
|
|
53
|
+
},
|
|
50
54
|
footer: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
51
55
|
onClick: function onClick() {
|
|
52
56
|
if (typeof props.hideVisible === 'function') {
|
|
53
57
|
props.hideVisible();
|
|
54
58
|
}
|
|
55
59
|
},
|
|
56
|
-
children:
|
|
60
|
+
children: TextEnum.btnCloseText
|
|
57
61
|
}, "closeWindow")]
|
|
58
62
|
};
|
|
59
63
|
var newTableProps = {
|
|
64
|
+
toolba: false,
|
|
60
65
|
columns: state.columns,
|
|
61
66
|
dataSource: state.dataSource,
|
|
62
67
|
startIndex: 1,
|
|
63
68
|
size: 'small',
|
|
64
69
|
headFootHeight: 50,
|
|
65
70
|
pagination: false,
|
|
66
|
-
autoFit: false
|
|
71
|
+
autoFit: false,
|
|
72
|
+
scroll: {
|
|
73
|
+
y: 550
|
|
74
|
+
}
|
|
67
75
|
};
|
|
68
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
69
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
width: '100%',
|
|
73
|
-
overflow: 'auto'
|
|
74
|
-
},
|
|
75
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vtxDatagrid.default, _objectSpread({
|
|
76
|
-
toolbar: false
|
|
77
|
-
}, newTableProps))
|
|
78
|
-
})
|
|
76
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_vtxModal.default, _objectSpread(_objectSpread({}, modalProps), {}, {
|
|
77
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vtxDatagrid.default, _objectSpread({
|
|
78
|
+
toolbar: false
|
|
79
|
+
}, newTableProps))
|
|
79
80
|
}));
|
|
80
81
|
}
|
|
81
82
|
VtxImportResult.propTypes = {
|
|
@@ -83,6 +84,7 @@ VtxImportResult.propTypes = {
|
|
|
83
84
|
dataSource: _propTypes.default.array,
|
|
84
85
|
columns: _propTypes.default.array,
|
|
85
86
|
modalWidth: _propTypes.default.number,
|
|
86
|
-
hideVisible: _propTypes.default.func
|
|
87
|
+
hideVisible: _propTypes.default.func,
|
|
88
|
+
TextEnum: _propTypes.default.object
|
|
87
89
|
};
|
|
88
90
|
var _default = exports.default = VtxImportResult;
|
|
@@ -13,7 +13,22 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
13
13
|
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); }
|
|
14
14
|
var genVtxImportStyle = function genVtxImportStyle(token) {
|
|
15
15
|
var componentCls = token.componentCls;
|
|
16
|
-
return _defineProperty({}, componentCls, {
|
|
16
|
+
return _defineProperty({}, componentCls, _defineProperty({
|
|
17
|
+
'.ant-modal-container': {
|
|
18
|
+
padding: 0,
|
|
19
|
+
'.ant-modal-header': {
|
|
20
|
+
padding: 20
|
|
21
|
+
},
|
|
22
|
+
'.ant-modal-body': {
|
|
23
|
+
padding: 20
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, '&-btn', {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
justifyContent: 'flex-start',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
gap: 8
|
|
31
|
+
}));
|
|
17
32
|
};
|
|
18
33
|
function useStyle(prefixCls) {
|
|
19
34
|
return (0, _vtxProvider.useStyle)('VtxImport', function (token) {
|
|
@@ -107,6 +107,7 @@ Content.propTypes = {
|
|
|
107
107
|
customText: _propTypes.default.string,
|
|
108
108
|
extraText: _propTypes.default.string,
|
|
109
109
|
TextEnum: _propTypes.default.object,
|
|
110
|
-
extraDom: [
|
|
110
|
+
// extraDom: [PropTypes.string, PropTypes.node],
|
|
111
|
+
extraDom: _propTypes.default.object
|
|
111
112
|
};
|
|
112
113
|
var _default = exports.default = Content;
|