@nutui/nutui-react 2.0.19-beta.1 → 2.0.20-beta.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/CHANGELOG.md +25 -0
- package/dist/esm/Button.js +84 -5
- package/dist/esm/Image.js +1 -1
- package/dist/esm/Uploader.js +191 -191
- package/dist/esm/formitem2.js +184 -78
- package/dist/esm/types/src/packages/uploader/demo.taro.d.ts +0 -15
- package/dist/esm/types/src/packages/uploader/file-item.d.ts +19 -0
- package/dist/esm/types/src/packages/uploader/index.d.ts +2 -1
- package/dist/esm/types/src/packages/uploader/index.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/uploader/preview.d.ts +2 -0
- package/dist/esm/types/src/packages/uploader/preview.taro.d.ts +2 -0
- package/dist/esm/types/src/packages/uploader/upload.d.ts +3 -0
- package/dist/esm/types/src/packages/uploader/uploader.d.ts +5 -23
- package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +10 -26
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +281 -300
- package/dist/nutui.react.umd.js +281 -300
- package/dist/style.mjs +1 -1
- package/dist/types/packages/calendar/calendar.d.ts +4 -4
- package/dist/types/packages/uploader/file-item.d.ts +19 -0
- package/dist/types/packages/uploader/index.d.ts +2 -1
- package/dist/types/packages/uploader/preview.d.ts +2 -0
- package/dist/types/packages/uploader/upload.d.ts +3 -0
- package/dist/types/packages/uploader/uploader.d.ts +5 -23
- package/package.json +1 -1
- package/dist/esm/button2.js +0 -87
package/dist/esm/formitem2.js
CHANGED
|
@@ -3,6 +3,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
3
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
4
|
import _getPrototypeOf2 from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
5
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
6
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
6
7
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
7
8
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
8
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
@@ -35,6 +36,66 @@ function _isNativeReflectConstruct2() {
|
|
|
35
36
|
return false;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
39
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
40
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
41
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
42
|
+
if (!it) {
|
|
43
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
44
|
+
if (it)
|
|
45
|
+
o = it;
|
|
46
|
+
var i = 0;
|
|
47
|
+
var F = function F2() {
|
|
48
|
+
};
|
|
49
|
+
return { s: F, n: function n() {
|
|
50
|
+
if (i >= o.length)
|
|
51
|
+
return { done: true };
|
|
52
|
+
return { done: false, value: o[i++] };
|
|
53
|
+
}, e: function e(_e) {
|
|
54
|
+
throw _e;
|
|
55
|
+
}, f: F };
|
|
56
|
+
}
|
|
57
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
58
|
+
}
|
|
59
|
+
var normalCompletion = true, didErr = false, err;
|
|
60
|
+
return { s: function s() {
|
|
61
|
+
it = it.call(o);
|
|
62
|
+
}, n: function n() {
|
|
63
|
+
var step = it.next();
|
|
64
|
+
normalCompletion = step.done;
|
|
65
|
+
return step;
|
|
66
|
+
}, e: function e(_e2) {
|
|
67
|
+
didErr = true;
|
|
68
|
+
err = _e2;
|
|
69
|
+
}, f: function f() {
|
|
70
|
+
try {
|
|
71
|
+
if (!normalCompletion && it["return"] != null)
|
|
72
|
+
it["return"]();
|
|
73
|
+
} finally {
|
|
74
|
+
if (didErr)
|
|
75
|
+
throw err;
|
|
76
|
+
}
|
|
77
|
+
} };
|
|
78
|
+
}
|
|
79
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
80
|
+
if (!o)
|
|
81
|
+
return;
|
|
82
|
+
if (typeof o === "string")
|
|
83
|
+
return _arrayLikeToArray(o, minLen);
|
|
84
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
85
|
+
if (n === "Object" && o.constructor)
|
|
86
|
+
n = o.constructor.name;
|
|
87
|
+
if (n === "Map" || n === "Set")
|
|
88
|
+
return Array.from(o);
|
|
89
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
90
|
+
return _arrayLikeToArray(o, minLen);
|
|
91
|
+
}
|
|
92
|
+
function _arrayLikeToArray(arr, len) {
|
|
93
|
+
if (len == null || len > arr.length)
|
|
94
|
+
len = arr.length;
|
|
95
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
96
|
+
arr2[i] = arr[i];
|
|
97
|
+
return arr2;
|
|
98
|
+
}
|
|
38
99
|
function ownKeys(object4, enumerableOnly) {
|
|
39
100
|
var keys = Object.keys(object4);
|
|
40
101
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1155,11 +1216,11 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1155
1216
|
});
|
|
1156
1217
|
_defineProperty(this, "setFieldsValue", function(newStore) {
|
|
1157
1218
|
_this3.store = _objectSpread(_objectSpread({}, _this3.store), newStore);
|
|
1158
|
-
_this3.fieldEntities.forEach(function(
|
|
1159
|
-
var name =
|
|
1219
|
+
_this3.fieldEntities.forEach(function(entity) {
|
|
1220
|
+
var name = entity.props.name;
|
|
1160
1221
|
Object.keys(newStore).forEach(function(key) {
|
|
1161
1222
|
if (key === name) {
|
|
1162
|
-
|
|
1223
|
+
entity.onStoreChange("update");
|
|
1163
1224
|
}
|
|
1164
1225
|
});
|
|
1165
1226
|
});
|
|
@@ -1167,78 +1228,123 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1167
1228
|
_defineProperty(this, "setCallback", function(callback) {
|
|
1168
1229
|
_this3.callbacks = _objectSpread(_objectSpread({}, _this3.callbacks), callback);
|
|
1169
1230
|
});
|
|
1170
|
-
_defineProperty(this, "
|
|
1171
|
-
var
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1231
|
+
_defineProperty(this, "validateFields", /* @__PURE__ */ function() {
|
|
1232
|
+
var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee(nameList) {
|
|
1233
|
+
var filterEntitys, errs, _iterator, _step, _loop;
|
|
1234
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
1235
|
+
while (1)
|
|
1236
|
+
switch (_context2.prev = _context2.next) {
|
|
1237
|
+
case 0:
|
|
1238
|
+
filterEntitys = [];
|
|
1239
|
+
errs = [];
|
|
1240
|
+
_this3.errors.length = 0;
|
|
1241
|
+
if (!nameList || nameList.length === 0) {
|
|
1242
|
+
filterEntitys = _this3.fieldEntities;
|
|
1243
|
+
} else {
|
|
1244
|
+
filterEntitys = _this3.fieldEntities.filter(function(_ref2) {
|
|
1245
|
+
var name = _ref2.props.name;
|
|
1246
|
+
return nameList.includes(name);
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
_iterator = _createForOfIteratorHelper(filterEntitys);
|
|
1250
|
+
_context2.prev = 5;
|
|
1251
|
+
_loop = /* @__PURE__ */ _regeneratorRuntime.mark(function _loop2() {
|
|
1252
|
+
var entity, _entity$props, name, _entity$props$rules, rules2, descriptor, validator, _this3$store2, errors;
|
|
1253
|
+
return _regeneratorRuntime.wrap(function _loop$(_context) {
|
|
1254
|
+
while (1)
|
|
1255
|
+
switch (_context.prev = _context.next) {
|
|
1256
|
+
case 0:
|
|
1257
|
+
entity = _step.value;
|
|
1258
|
+
_entity$props = entity.props, name = _entity$props.name, _entity$props$rules = _entity$props.rules, rules2 = _entity$props$rules === void 0 ? [] : _entity$props$rules;
|
|
1259
|
+
descriptor = {};
|
|
1260
|
+
if (rules2.length) {
|
|
1261
|
+
if (rules2.length > 1) {
|
|
1262
|
+
descriptor[name] = [];
|
|
1263
|
+
rules2.forEach(function(v) {
|
|
1264
|
+
descriptor[name].push(v);
|
|
1265
|
+
});
|
|
1266
|
+
} else {
|
|
1267
|
+
descriptor[name] = rules2[0];
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
validator = new Schema(descriptor);
|
|
1271
|
+
_context.prev = 5;
|
|
1272
|
+
_this3.errors[name] = [];
|
|
1273
|
+
_context.next = 9;
|
|
1274
|
+
return validator.validate(_defineProperty({}, name, (_this3$store2 = _this3.store) === null || _this3$store2 === void 0 ? void 0 : _this3$store2[name]));
|
|
1275
|
+
case 9:
|
|
1276
|
+
_context.next = 15;
|
|
1277
|
+
break;
|
|
1278
|
+
case 11:
|
|
1279
|
+
_context.prev = 11;
|
|
1280
|
+
_context.t0 = _context["catch"](5);
|
|
1281
|
+
errors = _context.t0.errors;
|
|
1282
|
+
if (errors) {
|
|
1283
|
+
errs.push.apply(errs, _toConsumableArray(errors));
|
|
1284
|
+
_this3.errors[name] = errors;
|
|
1285
|
+
}
|
|
1286
|
+
case 15:
|
|
1287
|
+
entity.onStoreChange("validate");
|
|
1288
|
+
case 16:
|
|
1289
|
+
case "end":
|
|
1290
|
+
return _context.stop();
|
|
1291
|
+
}
|
|
1292
|
+
}, _loop2, null, [[5, 11]]);
|
|
1293
|
+
});
|
|
1294
|
+
_iterator.s();
|
|
1295
|
+
case 8:
|
|
1296
|
+
if ((_step = _iterator.n()).done) {
|
|
1297
|
+
_context2.next = 12;
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
return _context2.delegateYield(_loop(), "t0", 10);
|
|
1301
|
+
case 10:
|
|
1302
|
+
_context2.next = 8;
|
|
1303
|
+
break;
|
|
1304
|
+
case 12:
|
|
1305
|
+
_context2.next = 17;
|
|
1306
|
+
break;
|
|
1307
|
+
case 14:
|
|
1308
|
+
_context2.prev = 14;
|
|
1309
|
+
_context2.t1 = _context2["catch"](5);
|
|
1310
|
+
_iterator.e(_context2.t1);
|
|
1311
|
+
case 17:
|
|
1312
|
+
_context2.prev = 17;
|
|
1313
|
+
_iterator.f();
|
|
1314
|
+
return _context2.finish(17);
|
|
1315
|
+
case 20:
|
|
1316
|
+
return _context2.abrupt("return", errs);
|
|
1317
|
+
case 21:
|
|
1318
|
+
case "end":
|
|
1319
|
+
return _context2.stop();
|
|
1320
|
+
}
|
|
1321
|
+
}, _callee, null, [[5, 14, 17, 20]]);
|
|
1322
|
+
}));
|
|
1323
|
+
return function(_x) {
|
|
1324
|
+
return _ref.apply(this, arguments);
|
|
1325
|
+
};
|
|
1326
|
+
}());
|
|
1327
|
+
_defineProperty(this, "submit", /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee2() {
|
|
1328
|
+
var errors, _this3$callbacks$onFi, _this3$callbacks, _this3$callbacks$onFi2, _this3$callbacks2;
|
|
1329
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context3) {
|
|
1330
|
+
while (1)
|
|
1331
|
+
switch (_context3.prev = _context3.next) {
|
|
1332
|
+
case 0:
|
|
1333
|
+
_context3.next = 2;
|
|
1334
|
+
return _this3.validateFields();
|
|
1335
|
+
case 2:
|
|
1336
|
+
errors = _context3.sent;
|
|
1337
|
+
if (errors.length === 0) {
|
|
1338
|
+
(_this3$callbacks$onFi = (_this3$callbacks = _this3.callbacks).onFinish) === null || _this3$callbacks$onFi === void 0 ? void 0 : _this3$callbacks$onFi.call(_this3$callbacks, _this3.store);
|
|
1339
|
+
} else if (errors.length > 0) {
|
|
1340
|
+
(_this3$callbacks$onFi2 = (_this3$callbacks2 = _this3.callbacks).onFinishFailed) === null || _this3$callbacks$onFi2 === void 0 ? void 0 : _this3$callbacks$onFi2.call(_this3$callbacks2, _this3.store, errors);
|
|
1341
|
+
}
|
|
1342
|
+
case 4:
|
|
1343
|
+
case "end":
|
|
1344
|
+
return _context3.stop();
|
|
1227
1345
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
});
|
|
1231
|
-
});
|
|
1232
|
-
_defineProperty(this, "submit", function() {
|
|
1233
|
-
var errors = _this3.validate();
|
|
1234
|
-
if (errors.length === 0) {
|
|
1235
|
-
var _this3$callbacks$onFi, _this3$callbacks;
|
|
1236
|
-
(_this3$callbacks$onFi = (_this3$callbacks = _this3.callbacks).onFinish) === null || _this3$callbacks$onFi === void 0 ? void 0 : _this3$callbacks$onFi.call(_this3$callbacks, _this3.store);
|
|
1237
|
-
} else if (errors.length > 0) {
|
|
1238
|
-
var _this3$callbacks$onFi2, _this3$callbacks2;
|
|
1239
|
-
(_this3$callbacks$onFi2 = (_this3$callbacks2 = _this3.callbacks).onFinishFailed) === null || _this3$callbacks$onFi2 === void 0 ? void 0 : _this3$callbacks$onFi2.call(_this3$callbacks2, _this3.store, errors);
|
|
1240
|
-
}
|
|
1241
|
-
});
|
|
1346
|
+
}, _callee2);
|
|
1347
|
+
})));
|
|
1242
1348
|
_defineProperty(this, "resetFields", function() {
|
|
1243
1349
|
_this3.errors.length = 0;
|
|
1244
1350
|
_this3.store = _this3.initialValues;
|
|
@@ -1246,8 +1352,8 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1246
1352
|
entity.onStoreChange("reset");
|
|
1247
1353
|
});
|
|
1248
1354
|
});
|
|
1249
|
-
_defineProperty(this, "dispatch", function(
|
|
1250
|
-
var name =
|
|
1355
|
+
_defineProperty(this, "dispatch", function(_ref5) {
|
|
1356
|
+
var name = _ref5.name;
|
|
1251
1357
|
_this3.validateFields([name]);
|
|
1252
1358
|
});
|
|
1253
1359
|
_defineProperty(this, "getInternal", function(key) {
|
|
@@ -1380,8 +1486,8 @@ var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
|
|
|
1380
1486
|
return controlled;
|
|
1381
1487
|
});
|
|
1382
1488
|
_defineProperty(_assertThisInitialized(_this4), "refresh", function() {
|
|
1383
|
-
_this4.setState(function(
|
|
1384
|
-
var resetCount =
|
|
1489
|
+
_this4.setState(function(_ref6) {
|
|
1490
|
+
var resetCount = _ref6.resetCount;
|
|
1385
1491
|
return {
|
|
1386
1492
|
resetCount: resetCount + 1
|
|
1387
1493
|
};
|
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import '@/packages/uploader/demo.scss';
|
|
3
|
-
export type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error' | 'removed';
|
|
4
|
-
export type FileType<T> = {
|
|
5
|
-
[key: string]: T;
|
|
6
|
-
};
|
|
7
|
-
export declare class FileItem {
|
|
8
|
-
status: FileItemStatus;
|
|
9
|
-
message: string;
|
|
10
|
-
uid: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
url?: string;
|
|
13
|
-
path?: string;
|
|
14
|
-
type?: string;
|
|
15
|
-
percentage: string | number;
|
|
16
|
-
formData: FormData;
|
|
17
|
-
}
|
|
18
3
|
declare const UploaderDemo: () => JSX.Element;
|
|
19
4
|
export default UploaderDemo;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare class FileItem {
|
|
3
|
+
status: FileItemStatus;
|
|
4
|
+
message: string;
|
|
5
|
+
uid: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
percentage?: string | number;
|
|
11
|
+
formData?: FormData;
|
|
12
|
+
responseText?: string;
|
|
13
|
+
loadingIcon?: ReactNode;
|
|
14
|
+
failIcon?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error' | 'removed';
|
|
17
|
+
export type FileType<T> = {
|
|
18
|
+
[key: string]: T;
|
|
19
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Uploader } from './uploader';
|
|
2
|
-
export type {
|
|
2
|
+
export type { UploaderProps } from './uploader';
|
|
3
|
+
export type { FileType, FileItem, FileItemStatus } from './file-item';
|
|
3
4
|
export default Uploader;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Uploader } from './uploader.taro';
|
|
2
|
-
export type {
|
|
2
|
+
export type { UploaderProps } from './uploader.taro';
|
|
3
|
+
export type { FileType, FileItem, FileItemStatus } from './file-item';
|
|
3
4
|
export default Uploader;
|
|
@@ -16,6 +16,9 @@ export declare class UploadOptions {
|
|
|
16
16
|
onFailure?: any;
|
|
17
17
|
beforeXhrUpload?: any;
|
|
18
18
|
}
|
|
19
|
+
export declare const UPLOADING = "uploading";
|
|
20
|
+
export declare const SUCCESS = "success";
|
|
21
|
+
export declare const ERROR = "error";
|
|
19
22
|
export declare class Upload {
|
|
20
23
|
options: UploadOptions;
|
|
21
24
|
constructor(options: UploadOptions);
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UploadOptions } from './upload';
|
|
3
3
|
import { BasicComponent } from '@/utils/typings';
|
|
4
|
-
|
|
5
|
-
[key: string]: T;
|
|
6
|
-
};
|
|
7
|
-
export type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error' | 'removed';
|
|
4
|
+
import { FileItem } from './file-item';
|
|
8
5
|
export interface UploaderProps extends BasicComponent {
|
|
9
6
|
url: string;
|
|
10
7
|
maxCount: string | number;
|
|
11
8
|
maxFileSize: number;
|
|
12
|
-
defaultValue?:
|
|
13
|
-
value?:
|
|
9
|
+
defaultValue?: FileItem[];
|
|
10
|
+
value?: FileItem[];
|
|
14
11
|
previewType: 'picture' | 'list';
|
|
15
12
|
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
16
13
|
uploadIcon?: React.ReactNode;
|
|
@@ -29,7 +26,7 @@ export interface UploaderProps extends BasicComponent {
|
|
|
29
26
|
clearInput: boolean;
|
|
30
27
|
preview: boolean;
|
|
31
28
|
deletable: boolean;
|
|
32
|
-
capture: boolean;
|
|
29
|
+
capture: boolean | 'user' | 'environment';
|
|
33
30
|
className: string;
|
|
34
31
|
previewUrl?: string;
|
|
35
32
|
style: React.CSSProperties;
|
|
@@ -52,27 +49,12 @@ export interface UploaderProps extends BasicComponent {
|
|
|
52
49
|
}) => void;
|
|
53
50
|
onUpdate?: (fileList: FileItem[]) => void;
|
|
54
51
|
onOversize?: (file: File[]) => void;
|
|
55
|
-
onChange?: (
|
|
56
|
-
fileList: FileItem[];
|
|
57
|
-
event: React.ChangeEvent<HTMLInputElement>;
|
|
58
|
-
}) => void;
|
|
52
|
+
onChange?: (p: FileItem[]) => void;
|
|
59
53
|
beforeUpload?: (file: File[]) => Promise<File[] | boolean>;
|
|
60
54
|
beforeXhrUpload?: (xhr: XMLHttpRequest, options: any) => void;
|
|
61
55
|
beforeDelete?: (file: FileItem, files: FileItem[]) => boolean;
|
|
62
56
|
onFileItemClick?: (file: FileItem) => void;
|
|
63
57
|
}
|
|
64
|
-
export declare class FileItem {
|
|
65
|
-
status: FileItemStatus;
|
|
66
|
-
message: string;
|
|
67
|
-
uid: string;
|
|
68
|
-
name?: string;
|
|
69
|
-
url?: string;
|
|
70
|
-
type?: string;
|
|
71
|
-
path?: string;
|
|
72
|
-
percentage: string | number;
|
|
73
|
-
formData: FormData;
|
|
74
|
-
responseText?: string;
|
|
75
|
-
}
|
|
76
58
|
export declare const Uploader: React.ForwardRefExoticComponent<Partial<UploaderProps> & {
|
|
77
59
|
children?: React.ReactNode;
|
|
78
60
|
} & React.RefAttributes<unknown>>;
|
|
@@ -2,10 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import Taro from '@tarojs/taro';
|
|
3
3
|
import { UploadOptions } from './upload';
|
|
4
4
|
import { BasicComponent } from '@/utils/typings';
|
|
5
|
-
|
|
6
|
-
[key: string]: T;
|
|
7
|
-
};
|
|
8
|
-
export type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error' | 'removed';
|
|
5
|
+
import { FileItem } from './file-item';
|
|
9
6
|
/** 图片的尺寸 */
|
|
10
7
|
interface sizeType {
|
|
11
8
|
/** 原图 */
|
|
@@ -35,8 +32,8 @@ export interface UploaderProps extends BasicComponent {
|
|
|
35
32
|
mediaType: (keyof mediaType)[];
|
|
36
33
|
camera: string;
|
|
37
34
|
maxFileSize: number;
|
|
38
|
-
defaultValue?:
|
|
39
|
-
value?:
|
|
35
|
+
defaultValue?: FileItem[];
|
|
36
|
+
value?: FileItem[];
|
|
40
37
|
previewType: 'picture' | 'list';
|
|
41
38
|
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
42
39
|
uploadIcon?: React.ReactNode;
|
|
@@ -58,42 +55,29 @@ export interface UploaderProps extends BasicComponent {
|
|
|
58
55
|
maxDuration: number;
|
|
59
56
|
style: React.CSSProperties;
|
|
60
57
|
onStart?: (option: UploadOptions) => void;
|
|
61
|
-
onDelete?: (file: FileItem, fileList:
|
|
58
|
+
onDelete?: (file: FileItem, fileList: FileItem[]) => void;
|
|
62
59
|
onSuccess?: (param: {
|
|
63
60
|
responseText: XMLHttpRequest['responseText'];
|
|
64
61
|
option: UploadOptions;
|
|
65
|
-
fileList:
|
|
62
|
+
fileList: FileItem[];
|
|
66
63
|
}) => void;
|
|
67
64
|
onProgress?: (param: {
|
|
68
65
|
e: ProgressEvent<XMLHttpRequestEventTarget>;
|
|
69
66
|
option: UploadOptions;
|
|
70
|
-
percentage:
|
|
67
|
+
percentage: number | string;
|
|
71
68
|
}) => void;
|
|
72
69
|
onFailure?: (param: {
|
|
73
70
|
responseText: XMLHttpRequest['responseText'];
|
|
74
71
|
option: UploadOptions;
|
|
75
|
-
fileList:
|
|
72
|
+
fileList: FileItem[];
|
|
76
73
|
}) => void;
|
|
77
|
-
onUpdate?: (fileList:
|
|
74
|
+
onUpdate?: (fileList: FileItem[]) => void;
|
|
78
75
|
onOversize?: (files: Taro.chooseImage.ImageFile[] | Taro.chooseMedia.ChooseMedia[] | any) => void;
|
|
79
|
-
onChange?: (
|
|
80
|
-
fileList: FileType<React.ReactNode>[];
|
|
81
|
-
}) => void;
|
|
76
|
+
onChange?: (p: FileItem[]) => void;
|
|
82
77
|
beforeXhrUpload?: (xhr: XMLHttpRequest, options: any) => void;
|
|
83
|
-
beforeDelete?: (file: FileItem, files:
|
|
78
|
+
beforeDelete?: (file: FileItem, files: FileItem[]) => boolean;
|
|
84
79
|
onFileItemClick?: (file: FileItem) => void;
|
|
85
80
|
}
|
|
86
|
-
export declare class FileItem {
|
|
87
|
-
status: FileItemStatus;
|
|
88
|
-
message: string;
|
|
89
|
-
uid: string;
|
|
90
|
-
name?: string;
|
|
91
|
-
url?: string;
|
|
92
|
-
type?: string;
|
|
93
|
-
path?: string;
|
|
94
|
-
percentage: string | number;
|
|
95
|
-
formData: any;
|
|
96
|
-
}
|
|
97
81
|
export declare const Uploader: React.ForwardRefExoticComponent<Partial<UploaderProps> & {
|
|
98
82
|
children?: React.ReactNode;
|
|
99
83
|
} & React.RefAttributes<unknown>>;
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/tr-TR.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED