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