@vtx/components 4.0.0-beta.9 → 4.0.0-beta.90
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 +6 -6
- 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 +109 -140
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/index.js +2 -1
- package/es/vtx-datagrid/ToolBar/style.js +6 -3
- package/es/vtx-datagrid/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +134 -37
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +108 -18
- 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 +2 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -38
- package/es/vtx-export-async/History.js +15 -7
- package/es/vtx-export-async/index.js +18 -8
- package/es/vtx-export-async/util.js +16 -5
- package/es/vtx-form-layout/FormItem.js +16 -16
- package/es/vtx-form-layout/style/index.js +6 -4
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +143 -42
- 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 +29 -19
- package/es/vtx-import2/style/index.js +59 -8
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-modal/style/index.js +5 -2
- 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 +33 -31
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_GB.js +1 -1
- package/es/vtx-provider/locale/en_US.js +58 -4
- 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 +30 -12
- package/es/vtx-search/style/index.js +6 -3
- package/es/vtx-select/index.js +123 -40
- package/es/vtx-select/style/index.js +11 -56
- 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 +27 -9
- package/es/vtx-tree-select/index.js +81 -110
- 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 +41 -32
- package/es/vtx-wang-editor/style/index.less +12 -12
- 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 +6 -6
- 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 +112 -142
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/index.js +2 -1
- package/lib/vtx-datagrid/ToolBar/style.js +6 -3
- package/lib/vtx-datagrid/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +134 -37
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +108 -18
- 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 +2 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -39
- package/lib/vtx-export-async/History.js +14 -8
- package/lib/vtx-export-async/index.js +18 -8
- package/lib/vtx-export-async/util.js +16 -5
- package/lib/vtx-form-layout/FormItem.js +16 -16
- package/lib/vtx-form-layout/style/index.js +6 -4
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +141 -43
- 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 -19
- package/lib/vtx-import2/style/index.js +59 -8
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-modal/style/index.js +5 -2
- 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 +33 -31
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_GB.js +1 -1
- package/lib/vtx-provider/locale/en_US.js +58 -4
- 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 +32 -12
- package/lib/vtx-search/style/index.js +6 -3
- package/lib/vtx-select/index.js +125 -42
- package/lib/vtx-select/style/index.js +11 -56
- 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 +27 -9
- package/lib/vtx-tree-select/index.js +81 -112
- 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 +39 -30
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/package.json +239 -238
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -26,7 +26,6 @@ var center = function center() {
|
|
|
26
26
|
};
|
|
27
27
|
var genVtxImageStyle = function genVtxImageStyle(token) {
|
|
28
28
|
var componentCls = token.componentCls;
|
|
29
|
-
console.log('componentCls', componentCls);
|
|
30
29
|
return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-aspectFit', {
|
|
31
30
|
position: 'relative',
|
|
32
31
|
height: '100%',
|
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,6 +45,22 @@ 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);
|
|
44
64
|
|
|
45
65
|
// 用 useRef 管理 DOM 引用,而不是 state
|
|
46
66
|
var fileInputRef = (0, _react.useRef)(null);
|
|
@@ -67,13 +87,22 @@ function VtxImport(props) {
|
|
|
67
87
|
// 导入结果查看
|
|
68
88
|
modalWidth: props.modalWidth || 800,
|
|
69
89
|
columns: props.columns || [{
|
|
70
|
-
title:
|
|
90
|
+
title: TextEnum.rowNumberText,
|
|
71
91
|
dataIndex: 'lineNum',
|
|
72
92
|
key: 'lineNum'
|
|
73
93
|
}, {
|
|
74
|
-
title:
|
|
94
|
+
title: TextEnum.errorMessageText,
|
|
75
95
|
dataIndex: 'messages',
|
|
76
|
-
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
|
+
}
|
|
77
106
|
}],
|
|
78
107
|
step: 1,
|
|
79
108
|
chunkSize: props.chunkSize || 10 * 1024 * 1024,
|
|
@@ -81,7 +110,8 @@ function VtxImport(props) {
|
|
|
81
110
|
currentIndex: 0,
|
|
82
111
|
chunkId: '',
|
|
83
112
|
chunks: [],
|
|
84
|
-
operation: props.operation ||
|
|
113
|
+
operation: props.operation || TextEnum.operationText,
|
|
114
|
+
fileName: ''
|
|
85
115
|
}),
|
|
86
116
|
_useSet2 = _slicedToArray(_useSet, 2),
|
|
87
117
|
state = _useSet2[0],
|
|
@@ -137,10 +167,12 @@ function VtxImport(props) {
|
|
|
137
167
|
}
|
|
138
168
|
};
|
|
139
169
|
xhr.onerror = function () {
|
|
140
|
-
_antd.message.error(
|
|
170
|
+
_antd.message.error(TextEnum.uploadFailedText);
|
|
141
171
|
};
|
|
142
172
|
// 发送请求
|
|
143
173
|
xhr.open('POST', '/cloudFile/common/uploadChunk', true);
|
|
174
|
+
xhr.setRequestHeader('Authorization', token ? "Bearer ".concat(token) : '');
|
|
175
|
+
xhr.setRequestHeader('access_token', token ? "".concat(token) : '');
|
|
144
176
|
xhr.send(list[indexRef.current]);
|
|
145
177
|
} else {
|
|
146
178
|
mergeFile();
|
|
@@ -159,26 +191,28 @@ function VtxImport(props) {
|
|
|
159
191
|
try {
|
|
160
192
|
res = JSON.parse(xhr.responseText);
|
|
161
193
|
} catch (e) {
|
|
162
|
-
_antd.message.error(
|
|
194
|
+
_antd.message.error(TextEnum.parseResponseFailedText);
|
|
163
195
|
setState({
|
|
164
196
|
uploading: false
|
|
165
197
|
});
|
|
166
198
|
return;
|
|
167
199
|
}
|
|
168
200
|
if (((_res = res) === null || _res === void 0 ? void 0 : _res.result) == 0) {
|
|
169
|
-
_antd.message.success(
|
|
201
|
+
_antd.message.success(TextEnum.uploadSuccessText);
|
|
170
202
|
chunkUpload(res.data);
|
|
171
203
|
} else {
|
|
172
204
|
var _res2;
|
|
173
|
-
_antd.message.error(((_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.msg) ||
|
|
205
|
+
_antd.message.error(((_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.msg) || TextEnum.uploadFailedText);
|
|
174
206
|
}
|
|
175
207
|
}
|
|
176
208
|
};
|
|
177
209
|
xhr.onerror = function () {
|
|
178
|
-
_antd.message.error(
|
|
210
|
+
_antd.message.error(TextEnum.uploadFailedText);
|
|
179
211
|
};
|
|
180
212
|
// 发送请求
|
|
181
213
|
xhr.open('POST', '/cloudFile/common/mergeChunk', true);
|
|
214
|
+
xhr.setRequestHeader('Authorization', token ? "Bearer ".concat(token) : '');
|
|
215
|
+
xhr.setRequestHeader('access_token', token ? "".concat(token) : '');
|
|
182
216
|
var data = new FormData();
|
|
183
217
|
data.append('chunkId', state.chunkId);
|
|
184
218
|
data.append('tenantId', (0, _utils.getVtxToken)('tenantId'));
|
|
@@ -300,7 +334,7 @@ function VtxImport(props) {
|
|
|
300
334
|
try {
|
|
301
335
|
parseData = JSON.parse(data);
|
|
302
336
|
} catch (e) {
|
|
303
|
-
_antd.message.error(
|
|
337
|
+
_antd.message.error(TextEnum.parseResponseDataFailedText);
|
|
304
338
|
return;
|
|
305
339
|
}
|
|
306
340
|
if (typeof props.afterUpload === 'function') {
|
|
@@ -322,27 +356,26 @@ function VtxImport(props) {
|
|
|
322
356
|
// 新增其他错误提示
|
|
323
357
|
if (parseData.result !== 0) {
|
|
324
358
|
var _parseData2;
|
|
325
|
-
_antd.message.error(((_parseData2 = parseData) === null || _parseData2 === void 0 ? void 0 : _parseData2.msg) ||
|
|
359
|
+
_antd.message.error(((_parseData2 = parseData) === null || _parseData2 === void 0 ? void 0 : _parseData2.msg) || TextEnum.uploadSuccessText);
|
|
326
360
|
}
|
|
327
361
|
}
|
|
328
362
|
};
|
|
329
|
-
var templateURL = props.templateURL,
|
|
330
|
-
uploadURL = props.uploadURL,
|
|
331
|
-
afterUpload = props.afterUpload,
|
|
332
|
-
beforeUpload = props.beforeUpload;
|
|
333
363
|
var modalProps = {
|
|
334
364
|
className: "".concat(prefixCls, "-modal"),
|
|
335
365
|
open: state.visible,
|
|
336
|
-
title:
|
|
366
|
+
title: TextEnum.operationText,
|
|
337
367
|
onCancel: function onCancel() {
|
|
338
368
|
return closeModal();
|
|
339
369
|
},
|
|
340
|
-
maskClosable: false,
|
|
370
|
+
// maskClosable: false,
|
|
371
|
+
mask: {
|
|
372
|
+
closable: false
|
|
373
|
+
},
|
|
341
374
|
footer: [templateURL ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
342
375
|
onClick: function onClick() {
|
|
343
376
|
window.open(templateURL);
|
|
344
377
|
},
|
|
345
|
-
children:
|
|
378
|
+
children: TextEnum.downloadTemplateText
|
|
346
379
|
}, "downloadTemple") : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
347
380
|
type: "primary",
|
|
348
381
|
loading: state.uploading,
|
|
@@ -381,16 +414,17 @@ function VtxImport(props) {
|
|
|
381
414
|
// request.send(fmd);
|
|
382
415
|
// }
|
|
383
416
|
} else {
|
|
384
|
-
_antd.message.info(
|
|
417
|
+
_antd.message.info(TextEnum.pleaseSelectFileText);
|
|
385
418
|
}
|
|
386
419
|
},
|
|
387
|
-
children:
|
|
420
|
+
children: TextEnum.uploadText
|
|
388
421
|
}, "uploadSubmit"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
389
422
|
onClick: function onClick() {
|
|
390
423
|
closeModal();
|
|
391
424
|
},
|
|
392
|
-
children:
|
|
393
|
-
}, "closeWindow")]
|
|
425
|
+
children: TextEnum.btnCloseText
|
|
426
|
+
}, "closeWindow")],
|
|
427
|
+
width: 520
|
|
394
428
|
};
|
|
395
429
|
var resultProps = {
|
|
396
430
|
visible: state.resultVisible,
|
|
@@ -401,7 +435,8 @@ function VtxImport(props) {
|
|
|
401
435
|
resultVisible: false
|
|
402
436
|
});
|
|
403
437
|
},
|
|
404
|
-
modalWidth: state.modalWidth
|
|
438
|
+
modalWidth: state.modalWidth,
|
|
439
|
+
TextEnum: TextEnum
|
|
405
440
|
};
|
|
406
441
|
|
|
407
442
|
// 组件卸载时清理
|
|
@@ -423,19 +458,80 @@ function VtxImport(props) {
|
|
|
423
458
|
startUpload();
|
|
424
459
|
}
|
|
425
460
|
}, [state.chunkId]);
|
|
426
|
-
|
|
427
|
-
|
|
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", {
|
|
428
502
|
encType: "multipart/form-data",
|
|
429
503
|
method: "post",
|
|
430
504
|
target: "tmp",
|
|
431
505
|
action: uploadURL,
|
|
432
506
|
ref: formRef,
|
|
433
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
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", {
|
|
434
526
|
type: "file",
|
|
435
527
|
name: state.fileKey,
|
|
436
528
|
accept: state.accept,
|
|
437
|
-
ref: fileInputRef
|
|
438
|
-
|
|
529
|
+
ref: fileInputRef,
|
|
530
|
+
style: {
|
|
531
|
+
display: 'none'
|
|
532
|
+
},
|
|
533
|
+
onChange: handleFileChange
|
|
534
|
+
})]
|
|
439
535
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
|
|
440
536
|
name: "tmp",
|
|
441
537
|
style: {
|
|
@@ -452,11 +548,13 @@ VtxImport.propTypes = {
|
|
|
452
548
|
postData: _propTypes.default.object,
|
|
453
549
|
fileKey: _propTypes.default.string,
|
|
454
550
|
accept: _propTypes.default.string,
|
|
551
|
+
token: _propTypes.default.string,
|
|
455
552
|
operation: _propTypes.default.string,
|
|
456
553
|
close: _propTypes.default.func,
|
|
457
554
|
afterUpload: _propTypes.default.func,
|
|
458
555
|
modalWidth: _propTypes.default.number,
|
|
459
556
|
columns: _propTypes.default.array,
|
|
557
|
+
customEnumText: _propTypes.default.object,
|
|
460
558
|
children: _propTypes.default.object,
|
|
461
559
|
beforeUpload: _propTypes.default.func,
|
|
462
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;
|
package/lib/vtx-import2/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var _utils = require("@vtx/utils");
|
|
|
18
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
19
|
var _index = require("./style/index");
|
|
20
20
|
var _vtxProvider = require("../vtx-provider");
|
|
21
|
+
var _vtxModal = _interopRequireDefault(require("../vtx-modal"));
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
24
|
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); }
|
|
@@ -40,7 +41,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
40
41
|
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); }
|
|
41
42
|
function getFileName() {
|
|
42
43
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
43
|
-
var
|
|
44
|
+
var _ref = arguments.length > 1 ? arguments[1] : undefined,
|
|
45
|
+
intl = _ref.intl;
|
|
44
46
|
var index = name.lastIndexOf('.');
|
|
45
47
|
var suffix = name.substring(index);
|
|
46
48
|
return name.substring(0, index) + "(".concat(intl.getMessage('import.errorFile', '错误文件'), ")") + suffix;
|
|
@@ -49,17 +51,20 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
49
51
|
var intl = (0, _vtxProvider.useIntl)();
|
|
50
52
|
var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
|
|
51
53
|
getPrefixCls = _useContext.getPrefixCls;
|
|
52
|
-
var prefixCls = getPrefixCls('
|
|
54
|
+
var prefixCls = getPrefixCls('', 'vtx-import2');
|
|
53
55
|
var _useStyle = (0, _index.useStyle)(prefixCls),
|
|
54
56
|
wrapSSR = _useStyle.wrapSSR,
|
|
55
57
|
hashId = _useStyle.hashId;
|
|
56
58
|
var visible = props.visible,
|
|
57
59
|
close = props.close,
|
|
58
60
|
title = props.title,
|
|
59
|
-
accept = props.accept,
|
|
60
|
-
|
|
61
|
+
_props$accept = props.accept,
|
|
62
|
+
accept = _props$accept === void 0 ? 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,text/csv' : _props$accept,
|
|
63
|
+
_props$fileKey = props.fileKey,
|
|
64
|
+
fileKey = _props$fileKey === void 0 ? 'file' : _props$fileKey,
|
|
61
65
|
uploadURL = props.uploadURL,
|
|
62
|
-
postData = props.postData,
|
|
66
|
+
_props$postData = props.postData,
|
|
67
|
+
postData = _props$postData === void 0 ? {} : _props$postData,
|
|
63
68
|
errorURL = props.errorURL,
|
|
64
69
|
templateURL = props.templateURL,
|
|
65
70
|
afterUpload = props.afterUpload,
|
|
@@ -138,7 +143,7 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
138
143
|
state = _useSet2[0],
|
|
139
144
|
setState = _useSet2[1];
|
|
140
145
|
var token = (0, _getToken.default)();
|
|
141
|
-
if (
|
|
146
|
+
if (props.token) {
|
|
142
147
|
token = props.token;
|
|
143
148
|
}
|
|
144
149
|
var newErrorDownloadName = errorDownloadName;
|
|
@@ -153,7 +158,9 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
153
158
|
}, interval);
|
|
154
159
|
(0, _react.useEffect)(function () {
|
|
155
160
|
if (fileList.length !== 0) {
|
|
156
|
-
fileName.current = getFileName(fileList[0].name
|
|
161
|
+
fileName.current = getFileName(fileList[0].name, {
|
|
162
|
+
intl: intl
|
|
163
|
+
});
|
|
157
164
|
}
|
|
158
165
|
}, [fileList]);
|
|
159
166
|
|
|
@@ -208,6 +215,8 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
208
215
|
};
|
|
209
216
|
// 发送请求
|
|
210
217
|
xhr.open('POST', '/cloudFile/common/uploadChunk', true);
|
|
218
|
+
xhr.setRequestHeader('Authorization', token ? "Bearer ".concat(token) : '');
|
|
219
|
+
xhr.setRequestHeader('access_token', token ? "".concat(token) : '');
|
|
211
220
|
xhr.send(list[indexRef.current]);
|
|
212
221
|
} else {
|
|
213
222
|
mergeFile();
|
|
@@ -233,6 +242,8 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
233
242
|
};
|
|
234
243
|
// 发送请求
|
|
235
244
|
xhr.open('POST', '/cloudFile/common/mergeChunk', true);
|
|
245
|
+
xhr.setRequestHeader('Authorization', token ? "Bearer ".concat(token) : '');
|
|
246
|
+
xhr.setRequestHeader('access_token', token ? "".concat(token) : '');
|
|
236
247
|
var data = new FormData();
|
|
237
248
|
data.append('chunkId', state.chunkId);
|
|
238
249
|
data.append('tenantId', (0, _utils.getVtxToken)('tenantId'));
|
|
@@ -253,7 +264,7 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
253
264
|
}
|
|
254
265
|
request.setRequestHeader('Authorization', token ? "Bearer ".concat(token) : '');
|
|
255
266
|
request.setRequestHeader('access_token', token ? "".concat(token) : '');
|
|
256
|
-
request.setRequestHeader('systemCode', getUrlParam('systemCode') ? getUrlParam('systemCode') : '');
|
|
267
|
+
request.setRequestHeader('systemCode', (0, _utils.getUrlParam)('systemCode') ? (0, _utils.getUrlParam)('systemCode') : '');
|
|
257
268
|
// 添加操作日志
|
|
258
269
|
request.setRequestHeader('operation', encodeURIComponent(JSON.stringify({
|
|
259
270
|
menuId: sessionStorage.getItem('vtxmenuselectedKeys'),
|
|
@@ -336,9 +347,9 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
336
347
|
}
|
|
337
348
|
}
|
|
338
349
|
};
|
|
339
|
-
var onUpload = function onUpload(
|
|
340
|
-
var
|
|
341
|
-
files =
|
|
350
|
+
var onUpload = function onUpload(_ref2) {
|
|
351
|
+
var _ref2$files = _ref2.files,
|
|
352
|
+
files = _ref2$files === void 0 ? fileList : _ref2$files;
|
|
342
353
|
if (typeof props.beforeUpload === 'function') {
|
|
343
354
|
var flag = beforeUpload(files[0]);
|
|
344
355
|
if (!flag) {
|
|
@@ -373,7 +384,10 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
373
384
|
var modelProps = {
|
|
374
385
|
open: visible,
|
|
375
386
|
width: width || 392,
|
|
376
|
-
maskClosable: false,
|
|
387
|
+
// maskClosable: false,
|
|
388
|
+
mask: {
|
|
389
|
+
closable: false
|
|
390
|
+
},
|
|
377
391
|
footer: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
378
392
|
onClick: close,
|
|
379
393
|
children: "".concat(TextEnum.btnCloseText).concat(status === 1 && result ? '(' + countdown + ')' : '')
|
|
@@ -395,7 +409,7 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
395
409
|
})]
|
|
396
410
|
})
|
|
397
411
|
};
|
|
398
|
-
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
412
|
+
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_vtxModal.default, _objectSpread(_objectSpread({}, modelProps), {}, {
|
|
399
413
|
children: [status === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Content.default, {
|
|
400
414
|
prefixCls: prefixCls,
|
|
401
415
|
fileList: fileList,
|
|
@@ -429,11 +443,6 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
|
|
|
429
443
|
})]
|
|
430
444
|
})));
|
|
431
445
|
};
|
|
432
|
-
VtxImport2.defaultProps = {
|
|
433
|
-
fileKey: 'file',
|
|
434
|
-
accept: 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,text/csv',
|
|
435
|
-
postData: {}
|
|
436
|
-
};
|
|
437
446
|
VtxImport2.propTypes = {
|
|
438
447
|
visible: _propTypes.default.bool,
|
|
439
448
|
templateURL: _propTypes.default.string,
|
|
@@ -454,6 +463,7 @@ VtxImport2.propTypes = {
|
|
|
454
463
|
beforeUpload: _propTypes.default.func,
|
|
455
464
|
chunkSize: _propTypes.default.number,
|
|
456
465
|
width: _propTypes.default.number,
|
|
457
|
-
extraDom: [
|
|
466
|
+
// extraDom: [PropTypes.string, PropTypes.node],
|
|
467
|
+
extraDom: _propTypes.default.object
|
|
458
468
|
};
|
|
459
469
|
var _default = exports.default = VtxImport2;
|