@kmkf-fe-packages/basic-components 0.8.18-alpha.8 → 0.8.19-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +119 -22
- package/dist/index.js +118 -21
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
2
2
|
import { Cascader, DatePicker, InputNumber, Input, Select, Upload, Image, message, Radio, Space, Spin, Modal, Button, Checkbox, Row, Col, Slider, Rate, Form, Tabs, ConfigProvider, Pagination, Popover, Table } from 'antd';
|
|
3
|
-
import { EyeOutlined, DeleteOutlined
|
|
3
|
+
import { EyeOutlined, DeleteOutlined } from '@ant-design/icons';
|
|
4
4
|
import request, { extend as extend$1 } from 'umi-request';
|
|
5
5
|
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
|
6
6
|
import { AddressData, BsAddressData, request as request$1, ExpressData, LogisticsAddressData, uuid } from '@kmkf-fe-packages/kmkf-utils';
|
|
@@ -1173,8 +1173,8 @@ var ApaasUploadAsync = function ApaasUploadAsync(_ref) {
|
|
|
1173
1173
|
})));
|
|
1174
1174
|
};
|
|
1175
1175
|
|
|
1176
|
-
var css_248z$2 = ".index-module_imageBox__1rpoB {\n display: flex;\n flex-wrap: wrap;\n}\n.index-module_imageBox__1rpoB .ant-upload-picture-card-wrapper {\n width: auto;\n}\n.index-module_imageBox__1rpoB .index-module_inputImage__MyiR1 {\n width: 80px;\n height: 80px;\n border: 1px dashed #ccc;\n outline: none;\n background-color: rgba(0, 0, 0, 0);\n text-indent: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imageShow__3BNqT {\n padding: 8px;\n border: 1px solid #d9d9d9;\n border-radius: 2px;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP {\n width: 100px;\n height: 80px;\n position: relative;\n border-radius: 2px;\n margin-right: 8px;\n margin-bottom: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP:hover {\n background: transparent;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP:hover .index-module_mask__uy8r2:before {\n opacity: 1;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP img {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP .index-module_delete__28zCp {\n position: absolute;\n right: 0px;\n top: 0px;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2::before {\n position: absolute;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n transition: all 0.3s;\n content: ' ';\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2:hover .index-module_actions__1-6f4 {\n opacity: 1;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 .index-module_actions__1-6f4 {\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: 10;\n white-space: nowrap;\n transform: translate(-50%, -50%);\n opacity: 0;\n transition: all 0.3s;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 .index-module_actions__1-6f4 .index-module_icon__3yEcS {\n font-size: 16px;\n color: #fff;\n padding: 0 4px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C {\n display: inline-block;\n margin-right: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C .index-module_fakeBox__3W1d- {\n width: 80px;\n height: 80px;\n border-radius: 2px;\n background: #F2F3F5;\n text-align: center;\n color: #86909C;\n padding-top: 16px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C .index-module_fakeBox__3W1d- .index-module_addBtn__3a1TQ {\n color: #86909C;\n}\n.index-module_imageBox__1rpoB .
|
|
1177
|
-
var styles$2 = {"imageBox":"index-module_imageBox__1rpoB","inputImage":"index-module_inputImage__MyiR1","imageShow":"index-module_imageShow__3BNqT","imageWrap":"index-module_imageWrap__LyKfP","-webkit-mask":"index-module_mask__uy8r2","mask":"index-module_mask__uy8r2","delete":"index-module_delete__28zCp","actions":"index-module_actions__1-6f4","icon":"index-module_icon__3yEcS","imagePaste":"index-module_imagePaste__Ac77C","fakeBox":"index-module_fakeBox__3W1d-","addBtn":"index-module_addBtn__3a1TQ","
|
|
1176
|
+
var css_248z$2 = ".index-module_imageBox__1rpoB {\n display: flex;\n flex-wrap: wrap;\n}\n.index-module_imageBox__1rpoB .ant-upload-picture-card-wrapper {\n width: auto;\n}\n.index-module_imageBox__1rpoB .index-module_inputImage__MyiR1 {\n width: 80px;\n height: 80px;\n border: 1px dashed #ccc;\n outline: none;\n background-color: rgba(0, 0, 0, 0);\n text-indent: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imageShow__3BNqT {\n padding: 8px;\n border: 1px solid #d9d9d9;\n border-radius: 2px;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP {\n width: 100px;\n height: 80px;\n position: relative;\n border-radius: 2px;\n margin-right: 8px;\n margin-bottom: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP:hover {\n background: transparent;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP:hover .index-module_mask__uy8r2:before {\n opacity: 1;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP img {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP .index-module_delete__28zCp {\n position: absolute;\n right: 0px;\n top: 0px;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2::before {\n position: absolute;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n transition: all 0.3s;\n content: ' ';\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2:hover .index-module_actions__1-6f4 {\n opacity: 1;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 .index-module_actions__1-6f4 {\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: 10;\n white-space: nowrap;\n transform: translate(-50%, -50%);\n opacity: 0;\n transition: all 0.3s;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 .index-module_actions__1-6f4 .index-module_icon__3yEcS {\n font-size: 16px;\n color: #fff;\n padding: 0 4px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C {\n display: inline-block;\n margin-right: 8px;\n margin-bottom: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C .index-module_fakeBox__3W1d- {\n width: 80px;\n height: 80px;\n border-radius: 2px;\n background: #F2F3F5;\n text-align: center;\n color: #86909C;\n padding-top: 16px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C .index-module_fakeBox__3W1d- .index-module_addBtn__3a1TQ {\n color: #86909C;\n}\n.index-module_imageBox__1rpoB .ant-upload {\n padding: 0;\n height: 80px;\n width: 80px;\n border: none;\n border-radius: 2px;\n background: #F2F3F5;\n text-align: center;\n color: #86909C;\n font-size: 14px;\n}\n.index-module_imageBox__1rpoB .ant-upload .index-module_addBtn__3a1TQ {\n color: #86909C;\n}\n.index-module_tips__168Vy {\n color: #4E5969;\n font-size: 12px;\n}\n";
|
|
1177
|
+
var styles$2 = {"imageBox":"index-module_imageBox__1rpoB","inputImage":"index-module_inputImage__MyiR1","imageShow":"index-module_imageShow__3BNqT","imageWrap":"index-module_imageWrap__LyKfP","-webkit-mask":"index-module_mask__uy8r2","mask":"index-module_mask__uy8r2","delete":"index-module_delete__28zCp","actions":"index-module_actions__1-6f4","icon":"index-module_icon__3yEcS","imagePaste":"index-module_imagePaste__Ac77C","fakeBox":"index-module_fakeBox__3W1d-","addBtn":"index-module_addBtn__3a1TQ","tips":"index-module_tips__168Vy"};
|
|
1178
1178
|
styleInject(css_248z$2);
|
|
1179
1179
|
|
|
1180
1180
|
//! moment.js
|
|
@@ -6877,6 +6877,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
6877
6877
|
_ref$actionUrl = _ref.actionUrl,
|
|
6878
6878
|
actionUrl = _ref$actionUrl === void 0 ? '/qy/common/uploadWorkOrderImg' : _ref$actionUrl,
|
|
6879
6879
|
resetProps = _objectWithoutProperties(_ref, _excluded$7);
|
|
6880
|
+
var inputRef = useRef(null);
|
|
6880
6881
|
var _useState = useState(false),
|
|
6881
6882
|
_useState2 = _slicedToArray(_useState, 2),
|
|
6882
6883
|
visible = _useState2[0],
|
|
@@ -6898,6 +6899,10 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
6898
6899
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
6899
6900
|
uploading = _useState10[0],
|
|
6900
6901
|
setUploading = _useState10[1];
|
|
6902
|
+
var _useState11 = useState(true),
|
|
6903
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
6904
|
+
pasteDefaultStates = _useState12[0],
|
|
6905
|
+
setPasteDefaultStates = _useState12[1];
|
|
6901
6906
|
var fileList = useMemo(function () {
|
|
6902
6907
|
return value.map(function (t, i) {
|
|
6903
6908
|
return _objectSpread2(_objectSpread2({}, t), {}, {
|
|
@@ -6911,25 +6916,40 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
6911
6916
|
useEffect(function () {
|
|
6912
6917
|
valueRef.current = value;
|
|
6913
6918
|
}, [value]);
|
|
6919
|
+
useEffect(function () {
|
|
6920
|
+
var _inputRef$current2;
|
|
6921
|
+
if (!pasteDefaultStates) {
|
|
6922
|
+
var _inputRef$current;
|
|
6923
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
6924
|
+
}
|
|
6925
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.addEventListener('paste', function (e) {
|
|
6926
|
+
return clipboardDataChange(e);
|
|
6927
|
+
});
|
|
6928
|
+
return function () {
|
|
6929
|
+
var _inputRef$current3;
|
|
6930
|
+
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.removeEventListener('paste', function (e) {
|
|
6931
|
+
return clipboardDataChange(e);
|
|
6932
|
+
});
|
|
6933
|
+
};
|
|
6934
|
+
}, [pasteDefaultStates]);
|
|
6914
6935
|
var asyncUpload = /*#__PURE__*/function () {
|
|
6915
6936
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
|
6916
6937
|
var formData, fileName, _yield$request, success, data;
|
|
6917
6938
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6918
6939
|
while (1) switch (_context.prev = _context.next) {
|
|
6919
6940
|
case 0:
|
|
6920
|
-
console.log('asyncUpload', file);
|
|
6921
6941
|
setUploading(true);
|
|
6922
6942
|
formData = new FormData();
|
|
6923
6943
|
formData.append('file', file);
|
|
6924
6944
|
fileName = "".concat(hooks(new Date().getTime()).format('YYYY-MM-DD hh:mm:ss'), "_").concat(file.name);
|
|
6925
6945
|
formData.append('fileName', fileName);
|
|
6926
|
-
_context.prev =
|
|
6927
|
-
_context.next =
|
|
6946
|
+
_context.prev = 5;
|
|
6947
|
+
_context.next = 8;
|
|
6928
6948
|
return request(actionUrl, {
|
|
6929
6949
|
method: 'post',
|
|
6930
6950
|
body: formData
|
|
6931
6951
|
});
|
|
6932
|
-
case
|
|
6952
|
+
case 8:
|
|
6933
6953
|
_yield$request = _context.sent;
|
|
6934
6954
|
success = _yield$request.success;
|
|
6935
6955
|
data = _yield$request.data;
|
|
@@ -6939,21 +6959,21 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
6939
6959
|
url: "".concat(hostUrl, "/").concat(data)
|
|
6940
6960
|
}]));
|
|
6941
6961
|
}
|
|
6942
|
-
_context.next =
|
|
6962
|
+
_context.next = 17;
|
|
6943
6963
|
break;
|
|
6944
|
-
case
|
|
6945
|
-
_context.prev =
|
|
6946
|
-
_context.t0 = _context["catch"](
|
|
6964
|
+
case 14:
|
|
6965
|
+
_context.prev = 14;
|
|
6966
|
+
_context.t0 = _context["catch"](5);
|
|
6947
6967
|
message.error('文件上传失败');
|
|
6948
|
-
case
|
|
6949
|
-
_context.prev =
|
|
6968
|
+
case 17:
|
|
6969
|
+
_context.prev = 17;
|
|
6950
6970
|
setUploading(false);
|
|
6951
|
-
return _context.finish(
|
|
6952
|
-
case
|
|
6971
|
+
return _context.finish(17);
|
|
6972
|
+
case 20:
|
|
6953
6973
|
case "end":
|
|
6954
6974
|
return _context.stop();
|
|
6955
6975
|
}
|
|
6956
|
-
}, _callee, null, [[
|
|
6976
|
+
}, _callee, null, [[5, 14, 17, 20]]);
|
|
6957
6977
|
}));
|
|
6958
6978
|
return function asyncUpload(_x) {
|
|
6959
6979
|
return _ref2.apply(this, arguments);
|
|
@@ -7002,6 +7022,62 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
7002
7022
|
window.open(file === null || file === void 0 ? void 0 : file.url);
|
|
7003
7023
|
}
|
|
7004
7024
|
};
|
|
7025
|
+
var clipboardDataChange = function clipboardDataChange(e) {
|
|
7026
|
+
var clipboardData = e.clipboardData || window.clipboardData;
|
|
7027
|
+
var i = 0,
|
|
7028
|
+
items,
|
|
7029
|
+
item,
|
|
7030
|
+
types;
|
|
7031
|
+
if (clipboardData) {
|
|
7032
|
+
items = clipboardData.items;
|
|
7033
|
+
if (!items) return;
|
|
7034
|
+
item = items[0];
|
|
7035
|
+
types = clipboardData.types || [];
|
|
7036
|
+
for (; i < types.length; i++) {
|
|
7037
|
+
if (types[i] === 'Files') {
|
|
7038
|
+
item = items[i];
|
|
7039
|
+
break;
|
|
7040
|
+
}
|
|
7041
|
+
}
|
|
7042
|
+
if (item && item.kind === 'file') {
|
|
7043
|
+
imgReader(item);
|
|
7044
|
+
}
|
|
7045
|
+
}
|
|
7046
|
+
};
|
|
7047
|
+
var imgReader = function imgReader(item) {
|
|
7048
|
+
var blob = item.getAsFile(),
|
|
7049
|
+
reader = new FileReader();
|
|
7050
|
+
if (blob.size > maxSize * 1024 * 1024) {
|
|
7051
|
+
message.error("\u6587\u4EF6\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "MB"));
|
|
7052
|
+
return;
|
|
7053
|
+
}
|
|
7054
|
+
if (valueRef.current.length >= maxCount) {
|
|
7055
|
+
message.error("\u53EA\u80FD\u4E0A\u4F20".concat(maxCount, "\u4E2A\u6587\u4EF6"));
|
|
7056
|
+
return;
|
|
7057
|
+
}
|
|
7058
|
+
reader.onload = /*#__PURE__*/function () {
|
|
7059
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
|
|
7060
|
+
var _e$target;
|
|
7061
|
+
var result, fileName, file;
|
|
7062
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7063
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7064
|
+
case 0:
|
|
7065
|
+
result = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result;
|
|
7066
|
+
fileName = blob.name;
|
|
7067
|
+
file = dataURLtoFile(result, fileName);
|
|
7068
|
+
asyncUpload(file);
|
|
7069
|
+
case 4:
|
|
7070
|
+
case "end":
|
|
7071
|
+
return _context2.stop();
|
|
7072
|
+
}
|
|
7073
|
+
}, _callee2);
|
|
7074
|
+
}));
|
|
7075
|
+
return function (_x2) {
|
|
7076
|
+
return _ref3.apply(this, arguments);
|
|
7077
|
+
};
|
|
7078
|
+
}();
|
|
7079
|
+
reader.readAsDataURL(blob);
|
|
7080
|
+
};
|
|
7005
7081
|
var handleCancel = function handleCancel() {
|
|
7006
7082
|
setFileUrl('');
|
|
7007
7083
|
setFileName('');
|
|
@@ -7011,7 +7087,28 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
7011
7087
|
spinning: uploading
|
|
7012
7088
|
}, /*#__PURE__*/React.createElement("p", {
|
|
7013
7089
|
className: styles$2.tips
|
|
7014
|
-
}, "\u5141\u8BB8\u4E0A\u4F20", maxCount, "\u4E2A\u6587\u4EF6"), /*#__PURE__*/React.createElement(
|
|
7090
|
+
}, "\u5141\u8BB8\u4E0A\u4F20", maxCount, "\u4E2A\u6587\u4EF6"), /*#__PURE__*/React.createElement("div", {
|
|
7091
|
+
className: styles$2.imageBox
|
|
7092
|
+
}, !disabled && /*#__PURE__*/React.createElement("div", {
|
|
7093
|
+
className: styles$2.imagePaste
|
|
7094
|
+
}, pasteDefaultStates ? /*#__PURE__*/React.createElement("div", {
|
|
7095
|
+
className: styles$2.fakeBox,
|
|
7096
|
+
onClick: function onClick() {
|
|
7097
|
+
setPasteDefaultStates(false);
|
|
7098
|
+
}
|
|
7099
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
7100
|
+
className: styles$2.addBtn
|
|
7101
|
+
}, "+"), /*#__PURE__*/React.createElement("p", {
|
|
7102
|
+
className: styles$2.text
|
|
7103
|
+
}, "\u590D\u5236\u7C98\u8D34")) : /*#__PURE__*/React.createElement("input", {
|
|
7104
|
+
ref: inputRef,
|
|
7105
|
+
type: "text",
|
|
7106
|
+
placeholder: "\u590D\u5236\u7C98\u8D34",
|
|
7107
|
+
onBlur: function onBlur() {
|
|
7108
|
+
setPasteDefaultStates(true);
|
|
7109
|
+
},
|
|
7110
|
+
value: ""
|
|
7111
|
+
})), /*#__PURE__*/React.createElement(Dragger, _objectSpread2({
|
|
7015
7112
|
disabled: disabled,
|
|
7016
7113
|
multiple: false,
|
|
7017
7114
|
accept: accept,
|
|
@@ -7021,11 +7118,11 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
7021
7118
|
onPreview: onPreview,
|
|
7022
7119
|
fileList: fileList,
|
|
7023
7120
|
onRemove: onRemove
|
|
7024
|
-
}, resetProps), /*#__PURE__*/React.createElement("
|
|
7025
|
-
className:
|
|
7026
|
-
},
|
|
7121
|
+
}, resetProps), /*#__PURE__*/React.createElement("span", {
|
|
7122
|
+
className: styles$2.addBtn
|
|
7123
|
+
}, "+"), /*#__PURE__*/React.createElement("p", {
|
|
7027
7124
|
className: "ant-upload-text"
|
|
7028
|
-
}, "\
|
|
7125
|
+
}, "\u9009\u62E9\u6587\u4EF6")), /*#__PURE__*/React.createElement(Modal, {
|
|
7029
7126
|
visible: visible,
|
|
7030
7127
|
title: fileName,
|
|
7031
7128
|
footer: null,
|
|
@@ -7051,7 +7148,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
7051
7148
|
autoPlay: true,
|
|
7052
7149
|
controls: true,
|
|
7053
7150
|
src: fileUrl
|
|
7054
|
-
})));
|
|
7151
|
+
}))));
|
|
7055
7152
|
};
|
|
7056
7153
|
|
|
7057
7154
|
var _excluded$8 = ["showOther", "horizontal", "options", "value", "onChange", "disabled"];
|
package/dist/index.js
CHANGED
|
@@ -1184,8 +1184,8 @@ var ApaasUploadAsync = function ApaasUploadAsync(_ref) {
|
|
|
1184
1184
|
})));
|
|
1185
1185
|
};
|
|
1186
1186
|
|
|
1187
|
-
var css_248z$2 = ".index-module_imageBox__1rpoB {\n display: flex;\n flex-wrap: wrap;\n}\n.index-module_imageBox__1rpoB .ant-upload-picture-card-wrapper {\n width: auto;\n}\n.index-module_imageBox__1rpoB .index-module_inputImage__MyiR1 {\n width: 80px;\n height: 80px;\n border: 1px dashed #ccc;\n outline: none;\n background-color: rgba(0, 0, 0, 0);\n text-indent: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imageShow__3BNqT {\n padding: 8px;\n border: 1px solid #d9d9d9;\n border-radius: 2px;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP {\n width: 100px;\n height: 80px;\n position: relative;\n border-radius: 2px;\n margin-right: 8px;\n margin-bottom: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP:hover {\n background: transparent;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP:hover .index-module_mask__uy8r2:before {\n opacity: 1;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP img {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP .index-module_delete__28zCp {\n position: absolute;\n right: 0px;\n top: 0px;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2::before {\n position: absolute;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n transition: all 0.3s;\n content: ' ';\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2:hover .index-module_actions__1-6f4 {\n opacity: 1;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 .index-module_actions__1-6f4 {\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: 10;\n white-space: nowrap;\n transform: translate(-50%, -50%);\n opacity: 0;\n transition: all 0.3s;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 .index-module_actions__1-6f4 .index-module_icon__3yEcS {\n font-size: 16px;\n color: #fff;\n padding: 0 4px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C {\n display: inline-block;\n margin-right: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C .index-module_fakeBox__3W1d- {\n width: 80px;\n height: 80px;\n border-radius: 2px;\n background: #F2F3F5;\n text-align: center;\n color: #86909C;\n padding-top: 16px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C .index-module_fakeBox__3W1d- .index-module_addBtn__3a1TQ {\n color: #86909C;\n}\n.index-module_imageBox__1rpoB .
|
|
1188
|
-
var styles$2 = {"imageBox":"index-module_imageBox__1rpoB","inputImage":"index-module_inputImage__MyiR1","imageShow":"index-module_imageShow__3BNqT","imageWrap":"index-module_imageWrap__LyKfP","-webkit-mask":"index-module_mask__uy8r2","mask":"index-module_mask__uy8r2","delete":"index-module_delete__28zCp","actions":"index-module_actions__1-6f4","icon":"index-module_icon__3yEcS","imagePaste":"index-module_imagePaste__Ac77C","fakeBox":"index-module_fakeBox__3W1d-","addBtn":"index-module_addBtn__3a1TQ","
|
|
1187
|
+
var css_248z$2 = ".index-module_imageBox__1rpoB {\n display: flex;\n flex-wrap: wrap;\n}\n.index-module_imageBox__1rpoB .ant-upload-picture-card-wrapper {\n width: auto;\n}\n.index-module_imageBox__1rpoB .index-module_inputImage__MyiR1 {\n width: 80px;\n height: 80px;\n border: 1px dashed #ccc;\n outline: none;\n background-color: rgba(0, 0, 0, 0);\n text-indent: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imageShow__3BNqT {\n padding: 8px;\n border: 1px solid #d9d9d9;\n border-radius: 2px;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP {\n width: 100px;\n height: 80px;\n position: relative;\n border-radius: 2px;\n margin-right: 8px;\n margin-bottom: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP:hover {\n background: transparent;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP:hover .index-module_mask__uy8r2:before {\n opacity: 1;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP img {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n}\n.index-module_imageBox__1rpoB .index-module_imageWrap__LyKfP .index-module_delete__28zCp {\n position: absolute;\n right: 0px;\n top: 0px;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2::before {\n position: absolute;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n transition: all 0.3s;\n content: ' ';\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2:hover .index-module_actions__1-6f4 {\n opacity: 1;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 .index-module_actions__1-6f4 {\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: 10;\n white-space: nowrap;\n transform: translate(-50%, -50%);\n opacity: 0;\n transition: all 0.3s;\n}\n.index-module_imageBox__1rpoB .index-module_mask__uy8r2 .index-module_actions__1-6f4 .index-module_icon__3yEcS {\n font-size: 16px;\n color: #fff;\n padding: 0 4px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C {\n display: inline-block;\n margin-right: 8px;\n margin-bottom: 8px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C .index-module_fakeBox__3W1d- {\n width: 80px;\n height: 80px;\n border-radius: 2px;\n background: #F2F3F5;\n text-align: center;\n color: #86909C;\n padding-top: 16px;\n}\n.index-module_imageBox__1rpoB .index-module_imagePaste__Ac77C .index-module_fakeBox__3W1d- .index-module_addBtn__3a1TQ {\n color: #86909C;\n}\n.index-module_imageBox__1rpoB .ant-upload {\n padding: 0;\n height: 80px;\n width: 80px;\n border: none;\n border-radius: 2px;\n background: #F2F3F5;\n text-align: center;\n color: #86909C;\n font-size: 14px;\n}\n.index-module_imageBox__1rpoB .ant-upload .index-module_addBtn__3a1TQ {\n color: #86909C;\n}\n.index-module_tips__168Vy {\n color: #4E5969;\n font-size: 12px;\n}\n";
|
|
1188
|
+
var styles$2 = {"imageBox":"index-module_imageBox__1rpoB","inputImage":"index-module_inputImage__MyiR1","imageShow":"index-module_imageShow__3BNqT","imageWrap":"index-module_imageWrap__LyKfP","-webkit-mask":"index-module_mask__uy8r2","mask":"index-module_mask__uy8r2","delete":"index-module_delete__28zCp","actions":"index-module_actions__1-6f4","icon":"index-module_icon__3yEcS","imagePaste":"index-module_imagePaste__Ac77C","fakeBox":"index-module_fakeBox__3W1d-","addBtn":"index-module_addBtn__3a1TQ","tips":"index-module_tips__168Vy"};
|
|
1189
1189
|
styleInject(css_248z$2);
|
|
1190
1190
|
|
|
1191
1191
|
//! moment.js
|
|
@@ -6888,6 +6888,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
6888
6888
|
_ref$actionUrl = _ref.actionUrl,
|
|
6889
6889
|
actionUrl = _ref$actionUrl === void 0 ? '/qy/common/uploadWorkOrderImg' : _ref$actionUrl,
|
|
6890
6890
|
resetProps = _objectWithoutProperties(_ref, _excluded$7);
|
|
6891
|
+
var inputRef = React.useRef(null);
|
|
6891
6892
|
var _useState = React.useState(false),
|
|
6892
6893
|
_useState2 = _slicedToArray(_useState, 2),
|
|
6893
6894
|
visible = _useState2[0],
|
|
@@ -6909,6 +6910,10 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
6909
6910
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
6910
6911
|
uploading = _useState10[0],
|
|
6911
6912
|
setUploading = _useState10[1];
|
|
6913
|
+
var _useState11 = React.useState(true),
|
|
6914
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
6915
|
+
pasteDefaultStates = _useState12[0],
|
|
6916
|
+
setPasteDefaultStates = _useState12[1];
|
|
6912
6917
|
var fileList = React.useMemo(function () {
|
|
6913
6918
|
return value.map(function (t, i) {
|
|
6914
6919
|
return _objectSpread2(_objectSpread2({}, t), {}, {
|
|
@@ -6922,25 +6927,40 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
6922
6927
|
React.useEffect(function () {
|
|
6923
6928
|
valueRef.current = value;
|
|
6924
6929
|
}, [value]);
|
|
6930
|
+
React.useEffect(function () {
|
|
6931
|
+
var _inputRef$current2;
|
|
6932
|
+
if (!pasteDefaultStates) {
|
|
6933
|
+
var _inputRef$current;
|
|
6934
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
6935
|
+
}
|
|
6936
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.addEventListener('paste', function (e) {
|
|
6937
|
+
return clipboardDataChange(e);
|
|
6938
|
+
});
|
|
6939
|
+
return function () {
|
|
6940
|
+
var _inputRef$current3;
|
|
6941
|
+
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.removeEventListener('paste', function (e) {
|
|
6942
|
+
return clipboardDataChange(e);
|
|
6943
|
+
});
|
|
6944
|
+
};
|
|
6945
|
+
}, [pasteDefaultStates]);
|
|
6925
6946
|
var asyncUpload = /*#__PURE__*/function () {
|
|
6926
6947
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
|
6927
6948
|
var formData, fileName, _yield$request, success, data;
|
|
6928
6949
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6929
6950
|
while (1) switch (_context.prev = _context.next) {
|
|
6930
6951
|
case 0:
|
|
6931
|
-
console.log('asyncUpload', file);
|
|
6932
6952
|
setUploading(true);
|
|
6933
6953
|
formData = new FormData();
|
|
6934
6954
|
formData.append('file', file);
|
|
6935
6955
|
fileName = "".concat(hooks(new Date().getTime()).format('YYYY-MM-DD hh:mm:ss'), "_").concat(file.name);
|
|
6936
6956
|
formData.append('fileName', fileName);
|
|
6937
|
-
_context.prev =
|
|
6938
|
-
_context.next =
|
|
6957
|
+
_context.prev = 5;
|
|
6958
|
+
_context.next = 8;
|
|
6939
6959
|
return request__default['default'](actionUrl, {
|
|
6940
6960
|
method: 'post',
|
|
6941
6961
|
body: formData
|
|
6942
6962
|
});
|
|
6943
|
-
case
|
|
6963
|
+
case 8:
|
|
6944
6964
|
_yield$request = _context.sent;
|
|
6945
6965
|
success = _yield$request.success;
|
|
6946
6966
|
data = _yield$request.data;
|
|
@@ -6950,21 +6970,21 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
6950
6970
|
url: "".concat(hostUrl, "/").concat(data)
|
|
6951
6971
|
}]));
|
|
6952
6972
|
}
|
|
6953
|
-
_context.next =
|
|
6973
|
+
_context.next = 17;
|
|
6954
6974
|
break;
|
|
6955
|
-
case
|
|
6956
|
-
_context.prev =
|
|
6957
|
-
_context.t0 = _context["catch"](
|
|
6975
|
+
case 14:
|
|
6976
|
+
_context.prev = 14;
|
|
6977
|
+
_context.t0 = _context["catch"](5);
|
|
6958
6978
|
antd.message.error('文件上传失败');
|
|
6959
|
-
case
|
|
6960
|
-
_context.prev =
|
|
6979
|
+
case 17:
|
|
6980
|
+
_context.prev = 17;
|
|
6961
6981
|
setUploading(false);
|
|
6962
|
-
return _context.finish(
|
|
6963
|
-
case
|
|
6982
|
+
return _context.finish(17);
|
|
6983
|
+
case 20:
|
|
6964
6984
|
case "end":
|
|
6965
6985
|
return _context.stop();
|
|
6966
6986
|
}
|
|
6967
|
-
}, _callee, null, [[
|
|
6987
|
+
}, _callee, null, [[5, 14, 17, 20]]);
|
|
6968
6988
|
}));
|
|
6969
6989
|
return function asyncUpload(_x) {
|
|
6970
6990
|
return _ref2.apply(this, arguments);
|
|
@@ -7013,6 +7033,62 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
7013
7033
|
window.open(file === null || file === void 0 ? void 0 : file.url);
|
|
7014
7034
|
}
|
|
7015
7035
|
};
|
|
7036
|
+
var clipboardDataChange = function clipboardDataChange(e) {
|
|
7037
|
+
var clipboardData = e.clipboardData || window.clipboardData;
|
|
7038
|
+
var i = 0,
|
|
7039
|
+
items,
|
|
7040
|
+
item,
|
|
7041
|
+
types;
|
|
7042
|
+
if (clipboardData) {
|
|
7043
|
+
items = clipboardData.items;
|
|
7044
|
+
if (!items) return;
|
|
7045
|
+
item = items[0];
|
|
7046
|
+
types = clipboardData.types || [];
|
|
7047
|
+
for (; i < types.length; i++) {
|
|
7048
|
+
if (types[i] === 'Files') {
|
|
7049
|
+
item = items[i];
|
|
7050
|
+
break;
|
|
7051
|
+
}
|
|
7052
|
+
}
|
|
7053
|
+
if (item && item.kind === 'file') {
|
|
7054
|
+
imgReader(item);
|
|
7055
|
+
}
|
|
7056
|
+
}
|
|
7057
|
+
};
|
|
7058
|
+
var imgReader = function imgReader(item) {
|
|
7059
|
+
var blob = item.getAsFile(),
|
|
7060
|
+
reader = new FileReader();
|
|
7061
|
+
if (blob.size > maxSize * 1024 * 1024) {
|
|
7062
|
+
antd.message.error("\u6587\u4EF6\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "MB"));
|
|
7063
|
+
return;
|
|
7064
|
+
}
|
|
7065
|
+
if (valueRef.current.length >= maxCount) {
|
|
7066
|
+
antd.message.error("\u53EA\u80FD\u4E0A\u4F20".concat(maxCount, "\u4E2A\u6587\u4EF6"));
|
|
7067
|
+
return;
|
|
7068
|
+
}
|
|
7069
|
+
reader.onload = /*#__PURE__*/function () {
|
|
7070
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
|
|
7071
|
+
var _e$target;
|
|
7072
|
+
var result, fileName, file;
|
|
7073
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7074
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7075
|
+
case 0:
|
|
7076
|
+
result = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result;
|
|
7077
|
+
fileName = blob.name;
|
|
7078
|
+
file = dataURLtoFile(result, fileName);
|
|
7079
|
+
asyncUpload(file);
|
|
7080
|
+
case 4:
|
|
7081
|
+
case "end":
|
|
7082
|
+
return _context2.stop();
|
|
7083
|
+
}
|
|
7084
|
+
}, _callee2);
|
|
7085
|
+
}));
|
|
7086
|
+
return function (_x2) {
|
|
7087
|
+
return _ref3.apply(this, arguments);
|
|
7088
|
+
};
|
|
7089
|
+
}();
|
|
7090
|
+
reader.readAsDataURL(blob);
|
|
7091
|
+
};
|
|
7016
7092
|
var handleCancel = function handleCancel() {
|
|
7017
7093
|
setFileUrl('');
|
|
7018
7094
|
setFileName('');
|
|
@@ -7022,7 +7098,28 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
7022
7098
|
spinning: uploading
|
|
7023
7099
|
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
7024
7100
|
className: styles$2.tips
|
|
7025
|
-
}, "\u5141\u8BB8\u4E0A\u4F20", maxCount, "\u4E2A\u6587\u4EF6"), /*#__PURE__*/React__default['default'].createElement(
|
|
7101
|
+
}, "\u5141\u8BB8\u4E0A\u4F20", maxCount, "\u4E2A\u6587\u4EF6"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7102
|
+
className: styles$2.imageBox
|
|
7103
|
+
}, !disabled && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7104
|
+
className: styles$2.imagePaste
|
|
7105
|
+
}, pasteDefaultStates ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7106
|
+
className: styles$2.fakeBox,
|
|
7107
|
+
onClick: function onClick() {
|
|
7108
|
+
setPasteDefaultStates(false);
|
|
7109
|
+
}
|
|
7110
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
7111
|
+
className: styles$2.addBtn
|
|
7112
|
+
}, "+"), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
7113
|
+
className: styles$2.text
|
|
7114
|
+
}, "\u590D\u5236\u7C98\u8D34")) : /*#__PURE__*/React__default['default'].createElement("input", {
|
|
7115
|
+
ref: inputRef,
|
|
7116
|
+
type: "text",
|
|
7117
|
+
placeholder: "\u590D\u5236\u7C98\u8D34",
|
|
7118
|
+
onBlur: function onBlur() {
|
|
7119
|
+
setPasteDefaultStates(true);
|
|
7120
|
+
},
|
|
7121
|
+
value: ""
|
|
7122
|
+
})), /*#__PURE__*/React__default['default'].createElement(Dragger, _objectSpread2({
|
|
7026
7123
|
disabled: disabled,
|
|
7027
7124
|
multiple: false,
|
|
7028
7125
|
accept: accept,
|
|
@@ -7032,11 +7129,11 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
7032
7129
|
onPreview: onPreview,
|
|
7033
7130
|
fileList: fileList,
|
|
7034
7131
|
onRemove: onRemove
|
|
7035
|
-
}, resetProps), /*#__PURE__*/React__default['default'].createElement("
|
|
7036
|
-
className:
|
|
7037
|
-
},
|
|
7132
|
+
}, resetProps), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
7133
|
+
className: styles$2.addBtn
|
|
7134
|
+
}, "+"), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
7038
7135
|
className: "ant-upload-text"
|
|
7039
|
-
}, "\
|
|
7136
|
+
}, "\u9009\u62E9\u6587\u4EF6")), /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
|
|
7040
7137
|
visible: visible,
|
|
7041
7138
|
title: fileName,
|
|
7042
7139
|
footer: null,
|
|
@@ -7062,7 +7159,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
|
|
|
7062
7159
|
autoPlay: true,
|
|
7063
7160
|
controls: true,
|
|
7064
7161
|
src: fileUrl
|
|
7065
|
-
})));
|
|
7162
|
+
}))));
|
|
7066
7163
|
};
|
|
7067
7164
|
|
|
7068
7165
|
var _excluded$8 = ["showOther", "horizontal", "options", "value", "onChange", "disabled"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/basic-components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.19-alpha.2",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@kmkf-fe-packages/kmkf-utils": "^0.8.
|
|
23
|
+
"@kmkf-fe-packages/kmkf-utils": "^0.8.19-alpha.0",
|
|
24
24
|
"lodash": "^4.17.21",
|
|
25
25
|
"pubsub-js": "^1.9.4",
|
|
26
26
|
"react-copy-to-clipboard": "^5.1.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "76df2a097b11436a61008de980d5b4626ad93f90"
|
|
64
64
|
}
|