@para-ui/core 3.0.19 → 3.0.21
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/CheckboxGroup/index.d.ts +2 -0
- package/CheckboxGroup/index.js +17 -0
- package/DatePicker/generatePicker/index.d.ts +2 -0
- package/DatePicker/index.js +91 -8
- package/DatePicker/util.d.ts +2 -0
- package/Form/index.js +1 -1
- package/FormItem/index.js +1 -1
- package/HelperText/index.d.ts +6 -2
- package/HelperText/index.js +2 -1
- package/InputLang/index.js +2 -1
- package/Menu/index.js +1 -1
- package/MultiBox/index.d.ts +7 -0
- package/MultiBox/index.js +111 -48
- package/MultiBox/lang/en_US.d.ts +4 -0
- package/MultiBox/lang/index.d.ts +9 -0
- package/MultiBox/lang/zh_CN.d.ts +4 -0
- package/PageHeader/index.js +1 -1
- package/README.md +21 -1
- package/RadioGroup/index.d.ts +2 -0
- package/RadioGroup/index.js +17 -0
- package/Search/index.js +1 -1
- package/Select/index.js +3 -2
- package/SelectInput/index.d.ts +2 -1
- package/SelectInput/index.js +1 -0
- package/SingleBox/index.d.ts +5 -0
- package/SingleBox/index.js +70 -23
- package/SingleBox/lang/en_US.d.ts +4 -0
- package/SingleBox/lang/index.d.ts +9 -0
- package/SingleBox/lang/zh_CN.d.ts +4 -0
- package/TimePicker/index.js +1 -0
- package/Transfer/box.d.ts +6 -1
- package/Transfer/index.d.ts +10 -4
- package/Transfer/index.js +107 -64
- package/Upload/index.js +92 -31
- package/_verture/{index-733c62a0.js → index-b4f57a63.js} +7 -7
- package/index.js +3 -2
- package/package.json +1 -1
package/Upload/index.js
CHANGED
|
@@ -908,7 +908,11 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
908
908
|
onUploadFail = props.onUploadFail,
|
|
909
909
|
cropperProps = props.cropperProps,
|
|
910
910
|
children = props.children,
|
|
911
|
-
fixedCropSize = props.fixedCropSize
|
|
911
|
+
_props$fixedCropSize = props.fixedCropSize,
|
|
912
|
+
fixedCropSize = _props$fixedCropSize === void 0 ? {
|
|
913
|
+
width: 120,
|
|
914
|
+
height: 120
|
|
915
|
+
} : _props$fixedCropSize;
|
|
912
916
|
var intl = useFormatMessage('Upload', localeJson);
|
|
913
917
|
|
|
914
918
|
var _useState = useState(''),
|
|
@@ -1028,7 +1032,7 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1028
1032
|
|
|
1029
1033
|
var onOk = useCallback(function () {
|
|
1030
1034
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
|
|
1031
|
-
var canvas, ctx, imgSource, _easyCropRef$current$, cropWidth, cropHeight, cropX, cropY, imgWidth, imgHeight, angle, sine, cosine, squareWidth, squareHeight, squareHalfWidth, squareHalfHeight, imgX, imgY, imgData, _fileRef$current, type, name, uid, onBlob;
|
|
1035
|
+
var canvas, ctx, imgSource, _easyCropRef$current$, cropWidth, cropHeight, cropX, cropY, imgWidth, imgHeight, angle, sine, cosine, squareWidth, squareHeight, squareHalfWidth, squareHalfHeight, imgX, imgY, imgData, changeImageSizeAfterCrop, _fileRef$current, type, name, uid, idx, onBlob;
|
|
1032
1036
|
|
|
1033
1037
|
return regenerator.wrap(function _callee3$(_context3) {
|
|
1034
1038
|
while (1) {
|
|
@@ -1036,7 +1040,6 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1036
1040
|
case 0:
|
|
1037
1041
|
onClose();
|
|
1038
1042
|
canvas = document.createElement('canvas');
|
|
1039
|
-
canvas.getContext('2d');
|
|
1040
1043
|
ctx = canvas.getContext('2d');
|
|
1041
1044
|
imgSource = document.querySelector(".".concat(PREFIX, "-media"));
|
|
1042
1045
|
_easyCropRef$current$ = easyCropRef.current.cropPixelsRef.current, cropWidth = _easyCropRef$current$.width, cropHeight = _easyCropRef$current$.height, cropX = _easyCropRef$current$.x, cropY = _easyCropRef$current$.y;
|
|
@@ -1074,14 +1077,67 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1074
1077
|
ctx.fillStyle = fillColor;
|
|
1075
1078
|
ctx.fillRect(0, 0, cropWidth, cropHeight);
|
|
1076
1079
|
ctx.drawImage(imgSource, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
|
|
1077
|
-
}
|
|
1080
|
+
} //裁剪之后改变图片大小
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
changeImageSizeAfterCrop = function changeImageSizeAfterCrop(newFile) {
|
|
1084
|
+
return new Promise(function (resolve) {
|
|
1085
|
+
var name = newFile.name,
|
|
1086
|
+
type = newFile.type,
|
|
1087
|
+
uid = newFile.uid;
|
|
1088
|
+
var width = fixedCropSize.width,
|
|
1089
|
+
height = fixedCropSize.height; //固定裁剪大小
|
|
1090
|
+
|
|
1091
|
+
var changeCanvas = document.createElement('canvas');
|
|
1092
|
+
var changeCtx = changeCanvas.getContext('2d');
|
|
1093
|
+
var img = new Image();
|
|
1094
|
+
|
|
1095
|
+
img.onload = function () {
|
|
1096
|
+
changeCanvas.width = width;
|
|
1097
|
+
changeCanvas.height = height;
|
|
1098
|
+
changeCtx.drawImage(img, 0, 0, width, height);
|
|
1099
|
+
changeCanvas.toBlob(function (cBlob) {
|
|
1100
|
+
var changeFile = Object.assign(new File([cBlob], name, {
|
|
1101
|
+
type: type
|
|
1102
|
+
}), {
|
|
1103
|
+
uid: uid
|
|
1104
|
+
});
|
|
1105
|
+
resolve(changeFile);
|
|
1106
|
+
}, type, quality);
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
img.onerror = function () {
|
|
1110
|
+
resolve(newFile);
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
var fileReader = new FileReader();
|
|
1114
|
+
|
|
1115
|
+
fileReader.onload = function () {
|
|
1116
|
+
img.src = fileReader.result;
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
fileReader.onerror = function () {
|
|
1120
|
+
resolve(newFile);
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
fileReader.readAsDataURL(newFile);
|
|
1124
|
+
});
|
|
1125
|
+
}; // get the new image
|
|
1078
1126
|
|
|
1079
1127
|
|
|
1080
1128
|
_fileRef$current = fileRef.current, type = _fileRef$current.type, name = _fileRef$current.name, uid = _fileRef$current.uid;
|
|
1081
1129
|
|
|
1130
|
+
if (/svg/ig.test(type)) {
|
|
1131
|
+
//svg 转为 png
|
|
1132
|
+
type = 'image/png';
|
|
1133
|
+
idx = name.lastIndexOf('.');
|
|
1134
|
+
if (idx > -1) name = name.substring(0, idx) + '.png';
|
|
1135
|
+
} //转为blob
|
|
1136
|
+
|
|
1137
|
+
|
|
1082
1138
|
onBlob = function onBlob(blob) {
|
|
1083
1139
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
|
|
1084
|
-
var _a, _b, _c, _d, _e, _f, newFile, res, passedFile;
|
|
1140
|
+
var _a, _b, _c, _d, _e, _f, newFile, changeFile, res, passedFile;
|
|
1085
1141
|
|
|
1086
1142
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
1087
1143
|
while (1) {
|
|
@@ -1092,83 +1148,88 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1092
1148
|
}), {
|
|
1093
1149
|
uid: uid
|
|
1094
1150
|
});
|
|
1151
|
+
_context2.next = 3;
|
|
1152
|
+
return changeImageSizeAfterCrop(newFile);
|
|
1153
|
+
|
|
1154
|
+
case 3:
|
|
1155
|
+
changeFile = _context2.sent;
|
|
1095
1156
|
|
|
1096
1157
|
if (!(typeof beforeUploadRef.current !== 'function')) {
|
|
1097
|
-
_context2.next =
|
|
1158
|
+
_context2.next = 6;
|
|
1098
1159
|
break;
|
|
1099
1160
|
}
|
|
1100
1161
|
|
|
1101
|
-
return _context2.abrupt("return", (_a = resolveRef.current) === null || _a === void 0 ? void 0 : _a.call(resolveRef,
|
|
1162
|
+
return _context2.abrupt("return", (_a = resolveRef.current) === null || _a === void 0 ? void 0 : _a.call(resolveRef, changeFile));
|
|
1102
1163
|
|
|
1103
|
-
case
|
|
1104
|
-
res = beforeUploadRef.current(
|
|
1164
|
+
case 6:
|
|
1165
|
+
res = beforeUploadRef.current(changeFile, [changeFile]);
|
|
1105
1166
|
|
|
1106
1167
|
if (!(typeof res !== 'boolean' && !res)) {
|
|
1107
|
-
_context2.next =
|
|
1168
|
+
_context2.next = 10;
|
|
1108
1169
|
break;
|
|
1109
1170
|
}
|
|
1110
1171
|
|
|
1111
1172
|
console.error('beforeUpload must return a boolean or Promise');
|
|
1112
1173
|
return _context2.abrupt("return");
|
|
1113
1174
|
|
|
1114
|
-
case
|
|
1175
|
+
case 10:
|
|
1115
1176
|
if (!(res === true)) {
|
|
1116
|
-
_context2.next =
|
|
1177
|
+
_context2.next = 12;
|
|
1117
1178
|
break;
|
|
1118
1179
|
}
|
|
1119
1180
|
|
|
1120
|
-
return _context2.abrupt("return", (_b = resolveRef.current) === null || _b === void 0 ? void 0 : _b.call(resolveRef,
|
|
1181
|
+
return _context2.abrupt("return", (_b = resolveRef.current) === null || _b === void 0 ? void 0 : _b.call(resolveRef, changeFile));
|
|
1121
1182
|
|
|
1122
|
-
case
|
|
1183
|
+
case 12:
|
|
1123
1184
|
if (!(res === false)) {
|
|
1124
|
-
_context2.next =
|
|
1185
|
+
_context2.next = 14;
|
|
1125
1186
|
break;
|
|
1126
1187
|
}
|
|
1127
1188
|
|
|
1128
|
-
return _context2.abrupt("return", (_c = resolveRef.current) === null || _c === void 0 ? void 0 : _c.call(resolveRef,
|
|
1189
|
+
return _context2.abrupt("return", (_c = resolveRef.current) === null || _c === void 0 ? void 0 : _c.call(resolveRef, changeFile, false));
|
|
1129
1190
|
|
|
1130
|
-
case
|
|
1191
|
+
case 14:
|
|
1131
1192
|
if (!(res && res instanceof Promise)) {
|
|
1132
|
-
_context2.next =
|
|
1193
|
+
_context2.next = 27;
|
|
1133
1194
|
break;
|
|
1134
1195
|
}
|
|
1135
1196
|
|
|
1136
|
-
_context2.prev =
|
|
1137
|
-
_context2.next =
|
|
1197
|
+
_context2.prev = 15;
|
|
1198
|
+
_context2.next = 18;
|
|
1138
1199
|
return res;
|
|
1139
1200
|
|
|
1140
|
-
case
|
|
1201
|
+
case 18:
|
|
1141
1202
|
passedFile = _context2.sent;
|
|
1142
1203
|
|
|
1143
1204
|
if (!(passedFile instanceof File || passedFile instanceof Blob)) {
|
|
1144
|
-
_context2.next =
|
|
1205
|
+
_context2.next = 21;
|
|
1145
1206
|
break;
|
|
1146
1207
|
}
|
|
1147
1208
|
|
|
1148
1209
|
return _context2.abrupt("return", (_d = resolveRef.current) === null || _d === void 0 ? void 0 : _d.call(resolveRef, passedFile));
|
|
1149
1210
|
|
|
1150
|
-
case
|
|
1151
|
-
(_e = resolveRef.current) === null || _e === void 0 ? void 0 : _e.call(resolveRef,
|
|
1152
|
-
_context2.next =
|
|
1211
|
+
case 21:
|
|
1212
|
+
(_e = resolveRef.current) === null || _e === void 0 ? void 0 : _e.call(resolveRef, changeFile, passedFile);
|
|
1213
|
+
_context2.next = 27;
|
|
1153
1214
|
break;
|
|
1154
1215
|
|
|
1155
|
-
case
|
|
1156
|
-
_context2.prev =
|
|
1157
|
-
_context2.t0 = _context2["catch"](
|
|
1216
|
+
case 24:
|
|
1217
|
+
_context2.prev = 24;
|
|
1218
|
+
_context2.t0 = _context2["catch"](15);
|
|
1158
1219
|
(_f = rejectRef.current) === null || _f === void 0 ? void 0 : _f.call(rejectRef, _context2.t0);
|
|
1159
1220
|
|
|
1160
|
-
case
|
|
1221
|
+
case 27:
|
|
1161
1222
|
case "end":
|
|
1162
1223
|
return _context2.stop();
|
|
1163
1224
|
}
|
|
1164
1225
|
}
|
|
1165
|
-
}, _callee2, null, [[
|
|
1226
|
+
}, _callee2, null, [[15, 24]]);
|
|
1166
1227
|
}));
|
|
1167
1228
|
};
|
|
1168
1229
|
|
|
1169
1230
|
canvas.toBlob(onBlob, type, quality);
|
|
1170
1231
|
|
|
1171
|
-
case
|
|
1232
|
+
case 11:
|
|
1172
1233
|
case "end":
|
|
1173
1234
|
return _context3.stop();
|
|
1174
1235
|
}
|
|
@@ -43,7 +43,7 @@ var FormRadioGroup = function FormRadioGroup(props) {
|
|
|
43
43
|
return jsx(RadioGroup, Object.assign({
|
|
44
44
|
value: selectValue,
|
|
45
45
|
onChange: changeValue,
|
|
46
|
-
hideErrorDom:
|
|
46
|
+
hideErrorDom: null
|
|
47
47
|
}, props));
|
|
48
48
|
};
|
|
49
49
|
|
|
@@ -76,7 +76,7 @@ var FormSelect = function FormSelect(props) {
|
|
|
76
76
|
return jsx(Select, Object.assign({
|
|
77
77
|
labelMode: "inside",
|
|
78
78
|
onChange: changeValue,
|
|
79
|
-
hideErrorDom:
|
|
79
|
+
hideErrorDom: null
|
|
80
80
|
}, props, {
|
|
81
81
|
value: selectValue
|
|
82
82
|
}));
|
|
@@ -106,7 +106,7 @@ var FormCheckboxGroup = function FormCheckboxGroup(props) {
|
|
|
106
106
|
return jsx(CheckboxGroup, Object.assign({
|
|
107
107
|
value: selectValue,
|
|
108
108
|
onChange: changeValue,
|
|
109
|
-
hideErrorDom:
|
|
109
|
+
hideErrorDom: null
|
|
110
110
|
}, props));
|
|
111
111
|
};
|
|
112
112
|
|
|
@@ -402,7 +402,7 @@ var DefaultCompoments = function DefaultCompoments(props) {
|
|
|
402
402
|
placeholder: placeholder,
|
|
403
403
|
value: dValue,
|
|
404
404
|
disabled: disabled,
|
|
405
|
-
hideErrorDom:
|
|
405
|
+
hideErrorDom: null
|
|
406
406
|
}, inputProps), {
|
|
407
407
|
onChange: function onChange(e) {
|
|
408
408
|
var _a;
|
|
@@ -566,7 +566,7 @@ var ItemType = function ItemType(props) {
|
|
|
566
566
|
multiline: true,
|
|
567
567
|
rows: 3,
|
|
568
568
|
name: name,
|
|
569
|
-
hideErrorDom:
|
|
569
|
+
hideErrorDom: null,
|
|
570
570
|
onChange: function onChange(e) {
|
|
571
571
|
validateFunction(e.target.value);
|
|
572
572
|
}
|
|
@@ -579,7 +579,7 @@ var ItemType = function ItemType(props) {
|
|
|
579
579
|
defaultValue: backData[name],
|
|
580
580
|
disabled: disabled,
|
|
581
581
|
name: name,
|
|
582
|
-
hideErrorDom:
|
|
582
|
+
hideErrorDom: null,
|
|
583
583
|
onChange: function onChange(val) {
|
|
584
584
|
validateFunction(val);
|
|
585
585
|
}
|
|
@@ -619,7 +619,7 @@ var ItemType = function ItemType(props) {
|
|
|
619
619
|
validateFunction(e.target.value);
|
|
620
620
|
},
|
|
621
621
|
name: name,
|
|
622
|
-
hideErrorDom:
|
|
622
|
+
hideErrorDom: null,
|
|
623
623
|
disabled: disabled
|
|
624
624
|
}, inputProps));
|
|
625
625
|
}
|
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export { Drawer } from './Drawer/index.js';
|
|
|
20
20
|
export { Dropdown } from './Dropdown/index.js';
|
|
21
21
|
export { default as Empty } from './Empty/index.js';
|
|
22
22
|
export { default as Form } from './Form/index.js';
|
|
23
|
-
export { F as FormItem } from './_verture/index-
|
|
23
|
+
export { F as FormItem } from './_verture/index-b4f57a63.js';
|
|
24
24
|
export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-8522aa7e.js';
|
|
25
25
|
export { default as GlobalContext, changeConfirmLocale, getConfirmLocale } from './GlobalContext/index.js';
|
|
26
26
|
export { default as Help } from './Help/index.js';
|
|
@@ -65,7 +65,7 @@ export { Timeline } from './Timeline/index.js';
|
|
|
65
65
|
export { Title } from './Title/index.js';
|
|
66
66
|
export { ToggleButton, ToggleButtonGroup } from './ToggleButton/index.js';
|
|
67
67
|
export { Tooltip } from './Tooltip/index.js';
|
|
68
|
-
export { Transfer } from './Transfer/index.js';
|
|
68
|
+
export { SSortablejs, Transfer } from './Transfer/index.js';
|
|
69
69
|
export { T as Tree } from './_verture/index-6807c0e0.js';
|
|
70
70
|
export { default as Upload } from './Upload/index.js';
|
|
71
71
|
import './_verture/slicedToArray-d7722f4b.js';
|
|
@@ -130,6 +130,7 @@ import '@para-ui/icons/CheckCircleF';
|
|
|
130
130
|
import '@para-ui/icons/CloseCircleF';
|
|
131
131
|
import 'rc-dialog';
|
|
132
132
|
import '@para-ui/icons/WarningCircle';
|
|
133
|
+
import '@para-ui/icons/PlusCircleF';
|
|
133
134
|
import 'rc-notification';
|
|
134
135
|
import 'rc-pagination';
|
|
135
136
|
import '@para-ui/icons/Left';
|