assui 2.3.9 → 3.0.0-alpha.0
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/a-select/index.js +7 -22
- package/es/a-select/style/index.css +195 -743
- package/es/area-text/index.js +1 -3
- package/es/button-drawer/index.js +12 -30
- package/es/button-modal/index.js +12 -33
- package/es/color-select/index.js +10 -23
- package/es/color-select/style/index.css +195 -743
- package/es/condition-input/index.js +8 -26
- package/es/condition-input/parse2RegexOption.js +0 -11
- package/es/config-provider/index.js +1 -3
- package/es/copy-to-clipboard/index.js +11 -27
- package/es/copy-to-clipboard/style/index.css +0 -1
- package/es/highlight-textarea/HighlighedContents.js +1 -3
- package/es/highlight-textarea/extractSpansOfClasses.d.ts +1 -0
- package/es/highlight-textarea/extractSpansOfClasses.js +7 -29
- package/es/highlight-textarea/getRanges.js +3 -35
- package/es/highlight-textarea/getType.js +0 -6
- package/es/highlight-textarea/index.js +11 -30
- package/es/highlight-textarea/style/index.css +7 -21
- package/es/img-crop/EasyCrop.js +18 -34
- package/es/img-crop/getCroppedImg.js +15 -50
- package/es/img-crop/index.js +56 -145
- package/es/img-crop/style/index.css +195 -743
- package/es/json-editor/index.js +6 -20
- package/es/keep-tab/index.d.ts +7 -2
- package/es/keep-tab/index.js +34 -59
- package/es/keep-tab/style/index.css +39 -99
- package/es/label-auto-complete/index.js +14 -32
- package/es/label-auto-complete/style/index.css +195 -743
- package/es/label-condition-input/index.js +13 -29
- package/es/label-customize-range-picker/defaultRadioList.js +0 -3
- package/es/label-customize-range-picker/index.js +36 -78
- package/es/label-customize-range-picker/style/index.css +195 -743
- package/es/label-customize-range-picker/utils/index.js +5 -14
- package/es/label-date-picker/index.js +11 -28
- package/es/label-date-picker/style/index.css +195 -743
- package/es/label-input/index.js +23 -37
- package/es/label-number-input/index.js +13 -28
- package/es/label-range-picker/index.js +11 -28
- package/es/label-range-picker/style/index.css +195 -743
- package/es/label-select/index.js +11 -27
- package/es/label-select/style/index.css +195 -743
- package/es/label-text-area/index.js +13 -35
- package/es/label-tree-select/index.js +15 -32
- package/es/label-tree-select/style/index.css +195 -743
- package/es/number-format-input/index.js +1 -11
- package/es/number-input/index.js +18 -37
- package/es/number-input/utils.js +7 -15
- package/es/rc-echart/core.js +15 -27
- package/es/rc-echart/index.js +0 -6
- package/es/rc-qrcode/index.js +2 -12
- package/es/rc-qrcode/useQrcode.js +5 -12
- package/es/rich-text-editor/index.js +5 -16
- package/es/rich-text-editor/plugins/code/index.js +0 -8
- package/es/rich-text-editor/style/index.css +195 -743
- package/es/single-img-upload/index.js +36 -110
- package/es/single-img-upload/style/index.css +195 -743
- package/es/split-pane/index.js +0 -4
- package/es/step-number-input/index.js +14 -39
- package/es/step-number-input/style/index.css +195 -743
- package/es/table-col/index.js +2 -4
- package/es/text-area/index.js +8 -27
- package/es/text-input/index.js +4 -18
- package/es/text-input/style/index.css +7 -21
- package/lib/a-select/index.js +7 -27
- package/lib/a-select/style/index.css +195 -743
- package/lib/a-select/style/index.js +0 -2
- package/lib/area-text/index.js +1 -6
- package/lib/area-text/style/index.js +0 -1
- package/lib/beautiful-dnd/index.js +0 -9
- package/lib/button-drawer/index.js +12 -42
- package/lib/button-drawer/style/index.js +0 -1
- package/lib/button-modal/index.js +12 -44
- package/lib/button-modal/style/index.js +0 -1
- package/lib/color-select/index.js +10 -39
- package/lib/color-select/style/index.css +195 -743
- package/lib/color-select/style/index.js +0 -2
- package/lib/condition-input/index.js +8 -41
- package/lib/condition-input/parse2RegexOption.js +0 -16
- package/lib/condition-input/style/index.js +0 -1
- package/lib/config-provider/context.js +0 -4
- package/lib/config-provider/index.js +1 -28
- package/lib/copy-to-clipboard/index.js +11 -38
- package/lib/copy-to-clipboard/style/index.css +0 -1
- package/lib/copy-to-clipboard/style/index.js +0 -1
- package/lib/highlight-textarea/HighlighedContents.js +1 -7
- package/lib/highlight-textarea/extractSpansOfClasses.d.ts +1 -0
- package/lib/highlight-textarea/extractSpansOfClasses.js +7 -31
- package/lib/highlight-textarea/getRanges.js +3 -38
- package/lib/highlight-textarea/getType.js +0 -8
- package/lib/highlight-textarea/index.js +11 -44
- package/lib/highlight-textarea/style/index.css +7 -21
- package/lib/highlight-textarea/style/index.js +0 -1
- package/lib/highlight-words/index.js +0 -3
- package/lib/img-crop/EasyCrop.js +18 -44
- package/lib/img-crop/getCroppedImg.js +15 -51
- package/lib/img-crop/index.js +56 -159
- package/lib/img-crop/style/index.css +195 -743
- package/lib/img-crop/style/index.js +0 -3
- package/lib/index.js +0 -77
- package/lib/json-editor/index.js +6 -35
- package/lib/json-editor/style/index.js +0 -2
- package/lib/keep-tab/index.d.ts +7 -2
- package/lib/keep-tab/index.js +34 -76
- package/lib/keep-tab/style/index.css +39 -99
- package/lib/keep-tab/style/index.js +0 -2
- package/lib/label-auto-complete/index.js +14 -39
- package/lib/label-auto-complete/style/index.css +195 -743
- package/lib/label-auto-complete/style/index.js +0 -2
- package/lib/label-condition-input/index.js +13 -36
- package/lib/label-condition-input/style/index.js +0 -1
- package/lib/label-customize-range-picker/defaultRadioList.js +0 -7
- package/lib/label-customize-range-picker/index.js +36 -99
- package/lib/label-customize-range-picker/style/index.css +195 -743
- package/lib/label-customize-range-picker/style/index.js +0 -5
- package/lib/label-customize-range-picker/utils/index.js +5 -19
- package/lib/label-date-picker/index.js +11 -34
- package/lib/label-date-picker/style/index.css +195 -743
- package/lib/label-date-picker/style/index.js +0 -2
- package/lib/label-input/index.js +23 -46
- package/lib/label-input/style/index.js +0 -1
- package/lib/label-number-input/index.js +13 -36
- package/lib/label-number-input/style/index.js +0 -1
- package/lib/label-range-picker/index.js +11 -36
- package/lib/label-range-picker/style/index.css +195 -743
- package/lib/label-range-picker/style/index.js +0 -2
- package/lib/label-select/index.js +11 -36
- package/lib/label-select/style/index.css +195 -743
- package/lib/label-select/style/index.js +0 -2
- package/lib/label-text-area/index.js +13 -40
- package/lib/label-text-area/style/index.js +0 -1
- package/lib/label-tree-select/index.js +15 -38
- package/lib/label-tree-select/style/index.css +195 -743
- package/lib/label-tree-select/style/index.js +0 -2
- package/lib/messages/index.js +0 -2
- package/lib/number-format-input/index.js +1 -15
- package/lib/number-format-input/style/index.js +0 -1
- package/lib/number-input/index.js +18 -55
- package/lib/number-input/style/index.js +0 -1
- package/lib/number-input/utils.js +8 -20
- package/lib/rc-echart/core.js +15 -40
- package/lib/rc-echart/index.js +0 -17
- package/lib/rc-motion/index.js +0 -3
- package/lib/rc-qrcode/index.js +2 -25
- package/lib/rc-qrcode/useQrcode.js +5 -17
- package/lib/rc-transition-group/index.js +0 -9
- package/lib/resizable/index.js +0 -2
- package/lib/resizable/style/index.js +0 -1
- package/lib/rich-text-editor/index.js +5 -53
- package/lib/rich-text-editor/plugins/code/index.js +2 -12
- package/lib/rich-text-editor/style/index.css +195 -743
- package/lib/rich-text-editor/style/index.js +0 -1
- package/lib/single-img-upload/index.js +36 -125
- package/lib/single-img-upload/style/index.css +195 -743
- package/lib/single-img-upload/style/index.js +0 -3
- package/lib/sortable-hoc/index.js +0 -9
- package/lib/split-pane/index.js +0 -15
- package/lib/split-pane/style/index.js +0 -1
- package/lib/step-number-input/index.js +14 -55
- package/lib/step-number-input/style/index.css +195 -743
- package/lib/step-number-input/style/index.js +0 -2
- package/lib/table-col/index.js +2 -6
- package/lib/text-area/index.js +8 -38
- package/lib/text-area/style/index.js +0 -1
- package/lib/text-input/index.js +4 -23
- package/lib/text-input/style/index.css +7 -21
- package/lib/text-input/style/index.js +0 -1
- package/package.json +6 -6
|
@@ -2,25 +2,20 @@ var __assign = this && this.__assign || function () {
|
|
|
2
2
|
__assign = Object.assign || function (t) {
|
|
3
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
4
|
s = arguments[i];
|
|
5
|
-
|
|
6
5
|
for (var p in s) {
|
|
7
6
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
return __assign.apply(this, arguments);
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
18
14
|
function adopt(value) {
|
|
19
15
|
return value instanceof P ? value : new P(function (resolve) {
|
|
20
16
|
resolve(value);
|
|
21
17
|
});
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
25
20
|
function fulfilled(value) {
|
|
26
21
|
try {
|
|
@@ -29,7 +24,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
29
24
|
reject(e);
|
|
30
25
|
}
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
function rejected(value) {
|
|
34
28
|
try {
|
|
35
29
|
step(generator["throw"](value));
|
|
@@ -37,29 +31,26 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
37
31
|
reject(e);
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
function step(result) {
|
|
42
35
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
43
36
|
}
|
|
44
|
-
|
|
45
37
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
46
38
|
});
|
|
47
39
|
};
|
|
48
|
-
|
|
49
40
|
var __generator = this && this.__generator || function (thisArg, body) {
|
|
50
41
|
var _ = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
label: 0,
|
|
43
|
+
sent: function sent() {
|
|
44
|
+
if (t[0] & 1) throw t[1];
|
|
45
|
+
return t[1];
|
|
46
|
+
},
|
|
47
|
+
trys: [],
|
|
48
|
+
ops: []
|
|
55
49
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
y,
|
|
61
|
-
t,
|
|
62
|
-
g;
|
|
50
|
+
f,
|
|
51
|
+
y,
|
|
52
|
+
t,
|
|
53
|
+
g;
|
|
63
54
|
return g = {
|
|
64
55
|
next: verb(0),
|
|
65
56
|
"throw": verb(1),
|
|
@@ -67,79 +58,60 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
67
58
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
68
59
|
return this;
|
|
69
60
|
}), g;
|
|
70
|
-
|
|
71
61
|
function verb(n) {
|
|
72
62
|
return function (v) {
|
|
73
63
|
return step([n, v]);
|
|
74
64
|
};
|
|
75
65
|
}
|
|
76
|
-
|
|
77
66
|
function step(op) {
|
|
78
67
|
if (f) throw new TypeError("Generator is already executing.");
|
|
79
|
-
|
|
80
68
|
while (_) {
|
|
81
69
|
try {
|
|
82
70
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
83
71
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
84
|
-
|
|
85
72
|
switch (op[0]) {
|
|
86
73
|
case 0:
|
|
87
74
|
case 1:
|
|
88
75
|
t = op;
|
|
89
76
|
break;
|
|
90
|
-
|
|
91
77
|
case 4:
|
|
92
78
|
_.label++;
|
|
93
79
|
return {
|
|
94
80
|
value: op[1],
|
|
95
81
|
done: false
|
|
96
82
|
};
|
|
97
|
-
|
|
98
83
|
case 5:
|
|
99
84
|
_.label++;
|
|
100
85
|
y = op[1];
|
|
101
86
|
op = [0];
|
|
102
87
|
continue;
|
|
103
|
-
|
|
104
88
|
case 7:
|
|
105
89
|
op = _.ops.pop();
|
|
106
|
-
|
|
107
90
|
_.trys.pop();
|
|
108
|
-
|
|
109
91
|
continue;
|
|
110
|
-
|
|
111
92
|
default:
|
|
112
93
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
113
94
|
_ = 0;
|
|
114
95
|
continue;
|
|
115
96
|
}
|
|
116
|
-
|
|
117
97
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
118
98
|
_.label = op[1];
|
|
119
99
|
break;
|
|
120
100
|
}
|
|
121
|
-
|
|
122
101
|
if (op[0] === 6 && _.label < t[1]) {
|
|
123
102
|
_.label = t[1];
|
|
124
103
|
t = op;
|
|
125
104
|
break;
|
|
126
105
|
}
|
|
127
|
-
|
|
128
106
|
if (t && _.label < t[2]) {
|
|
129
107
|
_.label = t[2];
|
|
130
|
-
|
|
131
108
|
_.ops.push(op);
|
|
132
|
-
|
|
133
109
|
break;
|
|
134
110
|
}
|
|
135
|
-
|
|
136
111
|
if (t[2]) _.ops.pop();
|
|
137
|
-
|
|
138
112
|
_.trys.pop();
|
|
139
|
-
|
|
140
113
|
continue;
|
|
141
114
|
}
|
|
142
|
-
|
|
143
115
|
op = body.call(thisArg, _);
|
|
144
116
|
} catch (e) {
|
|
145
117
|
op = [6, e];
|
|
@@ -148,7 +120,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
148
120
|
f = t = 0;
|
|
149
121
|
}
|
|
150
122
|
}
|
|
151
|
-
|
|
152
123
|
if (op[0] & 5) throw op[1];
|
|
153
124
|
return {
|
|
154
125
|
value: op[0] ? op[1] : void 0,
|
|
@@ -156,28 +127,23 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
156
127
|
};
|
|
157
128
|
}
|
|
158
129
|
};
|
|
159
|
-
|
|
160
130
|
var __rest = this && this.__rest || function (s, e) {
|
|
161
131
|
var t = {};
|
|
162
|
-
|
|
163
132
|
for (var p in s) {
|
|
164
133
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
165
134
|
}
|
|
166
|
-
|
|
167
135
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
168
136
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
169
137
|
}
|
|
170
138
|
return t;
|
|
171
139
|
};
|
|
172
|
-
|
|
173
140
|
var __read = this && this.__read || function (o, n) {
|
|
174
141
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
175
142
|
if (!m) return o;
|
|
176
143
|
var i = m.call(o),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
144
|
+
r,
|
|
145
|
+
ar = [],
|
|
146
|
+
e;
|
|
181
147
|
try {
|
|
182
148
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
183
149
|
ar.push(r.value);
|
|
@@ -193,10 +159,8 @@ var __read = this && this.__read || function (o, n) {
|
|
|
193
159
|
if (e) throw e.error;
|
|
194
160
|
}
|
|
195
161
|
}
|
|
196
|
-
|
|
197
162
|
return ar;
|
|
198
163
|
};
|
|
199
|
-
|
|
200
164
|
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
201
165
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
202
166
|
if (ar || !(i in from)) {
|
|
@@ -207,8 +171,6 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
207
171
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
208
172
|
};
|
|
209
173
|
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
210
|
-
|
|
211
|
-
|
|
212
174
|
import * as React from 'react';
|
|
213
175
|
import Upload from 'rc-upload';
|
|
214
176
|
import Progress from "antd/es/progress";
|
|
@@ -217,141 +179,106 @@ import classNames from 'classnames';
|
|
|
217
179
|
import useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
218
180
|
import CloseOutlined from "a-icons/es/CloseOutlined";
|
|
219
181
|
import isObject from 'lodash/isObject';
|
|
220
|
-
|
|
221
182
|
var getLocalImgURL = function getLocalImgURL(file) {
|
|
222
183
|
var URL = window.URL || window.webkitURL;
|
|
223
184
|
var imgURL = URL.createObjectURL(file);
|
|
224
185
|
return imgURL;
|
|
225
186
|
};
|
|
226
|
-
|
|
227
187
|
var SingleImgUpload = function SingleImgUpload(props) {
|
|
228
188
|
var className = props.className,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
189
|
+
wrapperClassName = props.wrapperClassName,
|
|
190
|
+
children = props.children,
|
|
191
|
+
value = props.value,
|
|
192
|
+
onStart = props.onStart,
|
|
193
|
+
onDeleteUpload = props.onDeleteUpload,
|
|
194
|
+
onFormatResData = props.onFormatResData,
|
|
195
|
+
onSuccess = props.onSuccess,
|
|
196
|
+
onCancel = props.onCancel,
|
|
197
|
+
beforeUpload = props.beforeUpload,
|
|
198
|
+
onError = props.onError,
|
|
199
|
+
disabled = props.disabled,
|
|
200
|
+
restProps = __rest(props, ["className", "wrapperClassName", "children", "value", "onStart", "onDeleteUpload", "onFormatResData", "onSuccess", "onCancel", "beforeUpload", "onError", "disabled"]);
|
|
242
201
|
var uploadInstanceRef = React.useRef();
|
|
243
202
|
var fileRef = React.useRef();
|
|
244
|
-
|
|
245
203
|
var _a = __read(React.useState(value ? 'done' : 'init'), 2),
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
204
|
+
uploadStatus = _a[0],
|
|
205
|
+
setUploadStatus = _a[1];
|
|
249
206
|
var _b = __read(React.useState(value), 2),
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
207
|
+
fileUrl = _b[0],
|
|
208
|
+
setFileUrl = _b[1];
|
|
253
209
|
var _c = __read(React.useState(0), 2),
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
210
|
+
uploadPercent = _c[0],
|
|
211
|
+
setUploadPercent = _c[1];
|
|
257
212
|
useUpdateEffect(function () {
|
|
258
213
|
setFileUrl(value);
|
|
259
|
-
|
|
260
214
|
if (value) {
|
|
261
215
|
setUploadStatus('done');
|
|
262
216
|
} else {
|
|
263
217
|
setUploadStatus('init');
|
|
264
218
|
}
|
|
265
219
|
}, [value]);
|
|
266
|
-
|
|
267
220
|
var onBeforeUpload = function onBeforeUpload() {
|
|
268
221
|
var rest = [];
|
|
269
|
-
|
|
270
222
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
271
223
|
rest[_i] = arguments[_i];
|
|
272
224
|
}
|
|
273
|
-
|
|
274
225
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
275
226
|
var resultBefore;
|
|
276
227
|
return __generator(this, function (_a) {
|
|
277
228
|
switch (_a.label) {
|
|
278
229
|
case 0:
|
|
279
230
|
setFileUrl('');
|
|
280
|
-
if (!beforeUpload) return [3
|
|
281
|
-
/*
|
|
282
|
-
, 2];
|
|
283
|
-
return [4
|
|
284
|
-
/*yield*/
|
|
285
|
-
, beforeUpload.apply(void 0, __spreadArray([], __read(rest), false))];
|
|
286
|
-
|
|
231
|
+
if (!beforeUpload) return [3 /*break*/, 2];
|
|
232
|
+
return [4 /*yield*/, beforeUpload.apply(void 0, __spreadArray([], __read(rest), false))];
|
|
287
233
|
case 1:
|
|
288
234
|
resultBefore = _a.sent();
|
|
289
|
-
|
|
290
235
|
if (isObject(resultBefore)) {
|
|
291
236
|
setFileUrl(getLocalImgURL(resultBefore));
|
|
292
237
|
}
|
|
293
|
-
|
|
294
|
-
return [2
|
|
295
|
-
/*return*/
|
|
296
|
-
, resultBefore];
|
|
297
|
-
|
|
238
|
+
return [2 /*return*/, resultBefore];
|
|
298
239
|
case 2:
|
|
299
|
-
return [2
|
|
300
|
-
/*return*/
|
|
301
|
-
, true];
|
|
240
|
+
return [2 /*return*/, true];
|
|
302
241
|
}
|
|
303
242
|
});
|
|
304
243
|
});
|
|
305
244
|
};
|
|
306
|
-
|
|
307
245
|
var handleStart = function handleStart(file) {
|
|
308
246
|
fileRef.current = file;
|
|
309
247
|
setUploadPercent(0);
|
|
310
|
-
|
|
311
248
|
if (!fileUrl) {
|
|
312
249
|
setFileUrl(getLocalImgURL(file));
|
|
313
250
|
}
|
|
314
|
-
|
|
315
251
|
setUploadStatus('uploading');
|
|
316
252
|
onStart && onStart(file);
|
|
317
253
|
};
|
|
318
|
-
|
|
319
254
|
var handleProgress = function handleProgress(e) {
|
|
320
255
|
var percent = e.percent;
|
|
321
256
|
setUploadPercent(parseInt("".concat(percent), 10));
|
|
322
257
|
};
|
|
323
|
-
|
|
324
258
|
var handleError = function handleError(error, ret, file) {
|
|
325
259
|
setUploadStatus('init');
|
|
326
260
|
onError && onError(error, ret, file);
|
|
327
261
|
};
|
|
328
|
-
|
|
329
262
|
var handleSuccess = function handleSuccess(res, file, xhr) {
|
|
330
263
|
var result = onFormatResData ? onFormatResData(res) : res;
|
|
331
264
|
onSuccess && onSuccess(result, file, xhr);
|
|
332
265
|
setUploadStatus('done');
|
|
333
266
|
};
|
|
334
|
-
|
|
335
267
|
var uploadCls = classNames(className, {
|
|
336
268
|
'not-upload-init': uploadStatus !== 'init'
|
|
337
269
|
});
|
|
338
|
-
|
|
339
270
|
var handleDeleteUpload = function handleDeleteUpload() {
|
|
340
271
|
setUploadStatus('init');
|
|
341
272
|
onDeleteUpload && onDeleteUpload();
|
|
342
273
|
};
|
|
343
|
-
|
|
344
274
|
var cancelUpload = function cancelUpload() {
|
|
345
275
|
var _a;
|
|
346
|
-
|
|
347
276
|
if (fileRef.current) {
|
|
348
277
|
(_a = uploadInstanceRef.current) === null || _a === void 0 ? void 0 : _a.abort(fileRef.current);
|
|
349
278
|
}
|
|
350
|
-
|
|
351
279
|
setUploadStatus('init');
|
|
352
280
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
353
281
|
};
|
|
354
|
-
|
|
355
282
|
var cls = classNames('as-img-upload', wrapperClassName);
|
|
356
283
|
return /*#__PURE__*/React.createElement("div", {
|
|
357
284
|
className: cls
|
|
@@ -398,7 +325,6 @@ var SingleImgUpload = function SingleImgUpload(props) {
|
|
|
398
325
|
})
|
|
399
326
|
}, children)));
|
|
400
327
|
};
|
|
401
|
-
|
|
402
328
|
SingleImgUpload.defaultProps = {
|
|
403
329
|
beforeUpload: function beforeUpload() {
|
|
404
330
|
return true;
|