@douyinfe/semi-foundation 2.19.0-beta.0 → 2.19.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/anchor/anchor.scss +1 -8
- package/anchor/rtl.scss +0 -1
- package/anchor/variables.scss +1 -0
- package/calendar/eventUtil.ts +8 -7
- package/calendar/foundation.ts +14 -14
- package/datePicker/monthsGridFoundation.ts +10 -3
- package/dropdown/foundation.ts +2 -1
- package/dropdown/menuFoundation.ts +2 -1
- package/getBabelConfig.js +0 -12
- package/lib/cjs/anchor/anchor.css +1 -10
- package/lib/cjs/anchor/anchor.scss +1 -8
- package/lib/cjs/anchor/constants.js +1 -4
- package/lib/cjs/anchor/foundation.js +5 -12
- package/lib/cjs/anchor/linkFoundation.js +4 -9
- package/lib/cjs/anchor/rtl.scss +0 -1
- package/lib/cjs/anchor/variables.scss +1 -0
- package/lib/cjs/autoComplete/constants.js +1 -4
- package/lib/cjs/autoComplete/foundation.js +14 -33
- package/lib/cjs/autoComplete/optionFoundation.js +4 -9
- package/lib/cjs/avatar/constants.js +1 -4
- package/lib/cjs/avatar/foundation.js +4 -9
- package/lib/cjs/backtop/constants.js +1 -4
- package/lib/cjs/backtop/foundation.js +4 -9
- package/lib/cjs/badge/constants.js +1 -4
- package/lib/cjs/banner/constants.js +1 -4
- package/lib/cjs/banner/foundation.js +4 -9
- package/lib/cjs/base/constants.js +2 -6
- package/lib/cjs/base/env.js +1 -4
- package/lib/cjs/base/foundation.js +5 -10
- package/lib/cjs/base/index.js +3 -6
- package/lib/cjs/breadcrumb/constants.js +1 -4
- package/lib/cjs/breadcrumb/foundation.js +6 -13
- package/lib/cjs/breadcrumb/itemFoundation.js +4 -9
- package/lib/cjs/button/constants.js +1 -4
- package/lib/cjs/calendar/constants.js +1 -4
- package/lib/cjs/calendar/eventUtil.d.ts +3 -3
- package/lib/cjs/calendar/eventUtil.js +28 -53
- package/lib/cjs/calendar/foundation.js +63 -85
- package/lib/cjs/card/constants.js +1 -4
- package/lib/cjs/carousel/constants.js +1 -4
- package/lib/cjs/carousel/foundation.js +5 -12
- package/lib/cjs/cascader/constants.js +1 -4
- package/lib/cjs/cascader/foundation.js +55 -100
- package/lib/cjs/cascader/util.js +9 -30
- package/lib/cjs/checkbox/checkboxFoundation.js +6 -13
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +9 -18
- package/lib/cjs/checkbox/constants.js +1 -4
- package/lib/cjs/collapse/constants.js +1 -4
- package/lib/cjs/collapse/foundation.js +9 -20
- package/lib/cjs/collapsible/constants.js +1 -4
- package/lib/cjs/datePicker/_utils/formatter.js +3 -12
- package/lib/cjs/datePicker/_utils/getDayOfWeek.js +1 -4
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +1 -4
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +5 -10
- package/lib/cjs/datePicker/_utils/getFullDateOffset.js +3 -6
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +2 -11
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +1 -4
- package/lib/cjs/datePicker/_utils/getMonthTable.js +2 -11
- package/lib/cjs/datePicker/_utils/getMonthsInYear.js +3 -16
- package/lib/cjs/datePicker/_utils/getYears.js +2 -9
- package/lib/cjs/datePicker/_utils/index.js +16 -30
- package/lib/cjs/datePicker/_utils/isAfter.js +3 -6
- package/lib/cjs/datePicker/_utils/isBefore.js +3 -6
- package/lib/cjs/datePicker/_utils/isBetween.js +3 -6
- package/lib/cjs/datePicker/_utils/isDate.js +1 -4
- package/lib/cjs/datePicker/_utils/isSameDay.js +3 -6
- package/lib/cjs/datePicker/_utils/isTimestamp.js +3 -6
- package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +3 -6
- package/lib/cjs/datePicker/_utils/isValidDate.js +1 -4
- package/lib/cjs/datePicker/_utils/isWithinInterval.js +3 -6
- package/lib/cjs/datePicker/_utils/parser.js +1 -4
- package/lib/cjs/datePicker/constants.js +3 -10
- package/lib/cjs/datePicker/foundation.js +42 -85
- package/lib/cjs/datePicker/inputFoundation.js +7 -20
- package/lib/cjs/datePicker/monthFoundation.js +5 -12
- package/lib/cjs/datePicker/monthsGridFoundation.js +47 -68
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +4 -9
- package/lib/cjs/descriptions/constants.js +1 -4
- package/lib/cjs/divider/constants.js +1 -4
- package/lib/cjs/dropdown/constants.js +1 -4
- package/lib/cjs/dropdown/foundation.js +7 -15
- package/lib/cjs/dropdown/menuFoundation.js +11 -31
- package/lib/cjs/empty/constants.js +1 -4
- package/lib/cjs/form/constants.js +1 -4
- package/lib/cjs/form/foundation.js +64 -104
- package/lib/cjs/form/interface.js +1 -3
- package/lib/cjs/form/utils.js +14 -29
- package/lib/cjs/grid/constants.js +1 -4
- package/lib/cjs/icons/constants.js +1 -4
- package/lib/cjs/input/constants.js +1 -4
- package/lib/cjs/input/foundation.js +7 -18
- package/lib/cjs/input/textareaFoundation.js +6 -13
- package/lib/cjs/input/util/calculateNodeHeight.js +3 -17
- package/lib/cjs/input/util/getSizingData.js +5 -10
- package/lib/cjs/inputNumber/constants.js +4 -11
- package/lib/cjs/inputNumber/foundation.js +11 -30
- package/lib/cjs/layout/constants.js +1 -4
- package/lib/cjs/list/constants.js +1 -4
- package/lib/cjs/modal/constants.js +1 -4
- package/lib/cjs/modal/modalContentFoundation.js +4 -9
- package/lib/cjs/modal/modalFoundation.js +4 -9
- package/lib/cjs/navigation/NavItem.js +6 -21
- package/lib/cjs/navigation/constants.js +1 -4
- package/lib/cjs/navigation/foundation.js +22 -37
- package/lib/cjs/navigation/itemFoundation.js +4 -9
- package/lib/cjs/navigation/subNavFoundation.js +10 -21
- package/lib/cjs/notification/constants.js +1 -4
- package/lib/cjs/notification/notificationFoundation.js +5 -12
- package/lib/cjs/notification/notificationListFoundation.js +4 -9
- package/lib/cjs/overflowList/constants.js +3 -10
- package/lib/cjs/overflowList/foundation.js +12 -29
- package/lib/cjs/pagination/constants.js +1 -4
- package/lib/cjs/pagination/foundation.js +18 -37
- package/lib/cjs/popconfirm/constants.js +1 -4
- package/lib/cjs/popconfirm/popconfirmFoundation.js +3 -6
- package/lib/cjs/popover/constants.js +2 -9
- package/lib/cjs/progress/constants.js +1 -4
- package/lib/cjs/radio/constants.js +1 -4
- package/lib/cjs/radio/radioFoundation.js +3 -6
- package/lib/cjs/radio/radioGroupFoundation.js +6 -11
- package/lib/cjs/radio/radioInnerFoundation.js +5 -10
- package/lib/cjs/rating/constants.js +1 -4
- package/lib/cjs/rating/foundation.js +7 -20
- package/lib/cjs/scrollList/constants.js +1 -4
- package/lib/cjs/scrollList/foundation.js +3 -6
- package/lib/cjs/scrollList/itemFoundation.js +8 -21
- package/lib/cjs/scrollList/scrollTo.js +1 -4
- package/lib/cjs/select/constants.js +1 -4
- package/lib/cjs/select/foundation.js +56 -98
- package/lib/cjs/select/optionFoundation.js +4 -9
- package/lib/cjs/sideSheet/constants.js +1 -4
- package/lib/cjs/sideSheet/sideSheetFoundation.js +6 -15
- package/lib/cjs/skeleton/constants.js +1 -4
- package/lib/cjs/slider/constants.js +1 -4
- package/lib/cjs/slider/foundation.js +13 -24
- package/lib/cjs/space/constants.js +1 -4
- package/lib/cjs/spin/constants.js +1 -4
- package/lib/cjs/spin/foundation.js +5 -12
- package/lib/cjs/steps/constants.js +1 -4
- package/lib/cjs/switch/constants.js +1 -4
- package/lib/cjs/switch/foundation.js +4 -9
- package/lib/cjs/table/bodyFoundation.js +9 -22
- package/lib/cjs/table/cellFoundation.js +3 -6
- package/lib/cjs/table/constants.js +1 -4
- package/lib/cjs/table/foundation.js +76 -117
- package/lib/cjs/table/tableRowFoundation.js +3 -6
- package/lib/cjs/table/tableSelectionCellFoundation.js +3 -6
- package/lib/cjs/table/utils.js +42 -71
- package/lib/cjs/tabs/constants.js +1 -4
- package/lib/cjs/tabs/foundation.js +8 -23
- package/lib/cjs/tag/constants.js +1 -4
- package/lib/cjs/tagInput/constants.js +1 -4
- package/lib/cjs/tagInput/foundation.js +12 -31
- package/lib/cjs/tagInput/utils/getSplitedArray.js +3 -6
- package/lib/cjs/timePicker/ComboxFoundation.js +10 -29
- package/lib/cjs/timePicker/constants.js +1 -4
- package/lib/cjs/timePicker/foundation.js +26 -45
- package/lib/cjs/timePicker/inputFoundation.js +4 -9
- package/lib/cjs/timePicker/utils/index.js +7 -14
- package/lib/cjs/timePicker/utils/localeDate.js +2 -9
- package/lib/cjs/timeline/constants.js +1 -4
- package/lib/cjs/toast/constants.js +1 -4
- package/lib/cjs/toast/toastFoundation.js +5 -12
- package/lib/cjs/toast/toastListFoundation.js +5 -12
- package/lib/cjs/tooltip/constants.js +1 -4
- package/lib/cjs/tooltip/foundation.js +29 -56
- package/lib/cjs/transfer/constants.js +1 -4
- package/lib/cjs/transfer/foundation.js +24 -47
- package/lib/cjs/transfer/transferUtils.js +16 -45
- package/lib/cjs/tree/constants.js +1 -4
- package/lib/cjs/tree/foundation.js +41 -76
- package/lib/cjs/tree/treeUtil.js +60 -107
- package/lib/cjs/treeSelect/constants.js +1 -4
- package/lib/cjs/treeSelect/foundation.js +49 -82
- package/lib/cjs/typography/constants.js +1 -4
- package/lib/cjs/upload/constants.js +1 -4
- package/lib/cjs/upload/foundation.js +56 -112
- package/lib/cjs/upload/utils.js +13 -32
- package/lib/cjs/utils/Event.js +9 -23
- package/lib/cjs/utils/FocusHandle.js +6 -15
- package/lib/cjs/utils/Logger.js +1 -4
- package/lib/cjs/utils/Store.js +5 -20
- package/lib/cjs/utils/a11y.js +8 -13
- package/lib/cjs/utils/array.js +6 -15
- package/lib/cjs/utils/arrayMove.js +3 -12
- package/lib/cjs/utils/classnames.js +6 -15
- package/lib/cjs/utils/date-fns-extra.js +7 -18
- package/lib/cjs/utils/dom.js +5 -12
- package/lib/cjs/utils/function.js +1 -4
- package/lib/cjs/utils/getDataAttr.js +2 -13
- package/lib/cjs/utils/getHighlight.js +7 -22
- package/lib/cjs/utils/getMotionObjFromProps.js +4 -9
- package/lib/cjs/utils/index.js +5 -15
- package/lib/cjs/utils/isBothNaN.js +1 -4
- package/lib/cjs/utils/isElement.js +1 -4
- package/lib/cjs/utils/isEnterPress.js +3 -6
- package/lib/cjs/utils/isEscPress.js +3 -6
- package/lib/cjs/utils/isNullOrUndefined.js +1 -4
- package/lib/cjs/utils/isNumber.js +1 -4
- package/lib/cjs/utils/isObject.js +1 -4
- package/lib/cjs/utils/isPromise.js +3 -6
- package/lib/cjs/utils/isString.js +1 -4
- package/lib/cjs/utils/keyCode.js +1 -4
- package/lib/cjs/utils/log.js +3 -6
- package/lib/cjs/utils/number.js +1 -4
- package/lib/cjs/utils/object.js +10 -27
- package/lib/cjs/utils/set.js +4 -9
- package/lib/cjs/utils/shallowEqualObjects.js +3 -10
- package/lib/cjs/utils/touchPolyfill.js +5 -12
- package/lib/cjs/utils/type.js +1 -3
- package/lib/cjs/utils/uuid.js +3 -14
- package/lib/cjs/utils/warning.js +1 -4
- package/lib/es/anchor/anchor.css +1 -10
- package/lib/es/anchor/anchor.scss +1 -8
- package/lib/es/anchor/foundation.js +2 -4
- package/lib/es/anchor/linkFoundation.js +1 -2
- package/lib/es/anchor/rtl.scss +0 -1
- package/lib/es/anchor/variables.scss +1 -0
- package/lib/es/autoComplete/foundation.js +11 -26
- package/lib/es/autoComplete/optionFoundation.js +1 -2
- package/lib/es/avatar/foundation.js +1 -2
- package/lib/es/backtop/foundation.js +1 -2
- package/lib/es/banner/foundation.js +1 -2
- package/lib/es/base/foundation.js +2 -3
- package/lib/es/breadcrumb/foundation.js +3 -6
- package/lib/es/breadcrumb/itemFoundation.js +1 -2
- package/lib/es/calendar/eventUtil.d.ts +3 -3
- package/lib/es/calendar/eventUtil.js +27 -56
- package/lib/es/calendar/foundation.js +60 -90
- package/lib/es/carousel/foundation.js +2 -4
- package/lib/es/cascader/foundation.js +49 -94
- package/lib/es/cascader/util.js +6 -21
- package/lib/es/checkbox/checkboxFoundation.js +3 -6
- package/lib/es/checkbox/checkboxGroupFoundation.js +6 -9
- package/lib/es/collapse/foundation.js +6 -10
- package/lib/es/datePicker/_utils/formatter.js +2 -5
- package/lib/es/datePicker/_utils/getDefaultPickerDate.js +2 -3
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +1 -4
- package/lib/es/datePicker/_utils/getMonthTable.js +1 -5
- package/lib/es/datePicker/_utils/getMonthsInYear.js +2 -9
- package/lib/es/datePicker/_utils/getYears.js +1 -3
- package/lib/es/datePicker/constants.js +2 -7
- package/lib/es/datePicker/foundation.js +39 -70
- package/lib/es/datePicker/inputFoundation.js +4 -11
- package/lib/es/datePicker/monthFoundation.js +2 -4
- package/lib/es/datePicker/monthsGridFoundation.js +40 -55
- package/lib/es/datePicker/yearAndMonthFoundation.js +1 -2
- package/lib/es/dropdown/foundation.js +4 -7
- package/lib/es/dropdown/menuFoundation.js +8 -21
- package/lib/es/form/foundation.js +59 -91
- package/lib/es/form/utils.js +11 -19
- package/lib/es/input/foundation.js +4 -9
- package/lib/es/input/textareaFoundation.js +3 -5
- package/lib/es/input/util/calculateNodeHeight.js +2 -10
- package/lib/es/input/util/getSizingData.js +2 -5
- package/lib/es/inputNumber/constants.js +3 -8
- package/lib/es/inputNumber/foundation.js +8 -18
- package/lib/es/modal/modalContentFoundation.js +1 -2
- package/lib/es/modal/modalFoundation.js +1 -2
- package/lib/es/navigation/NavItem.js +5 -11
- package/lib/es/navigation/foundation.js +19 -25
- package/lib/es/navigation/itemFoundation.js +1 -3
- package/lib/es/navigation/subNavFoundation.js +7 -13
- package/lib/es/notification/notificationFoundation.js +2 -4
- package/lib/es/notification/notificationListFoundation.js +1 -3
- package/lib/es/overflowList/constants.js +2 -3
- package/lib/es/overflowList/foundation.js +9 -23
- package/lib/es/pagination/foundation.js +15 -28
- package/lib/es/popover/constants.js +1 -2
- package/lib/es/radio/radioGroupFoundation.js +3 -4
- package/lib/es/radio/radioInnerFoundation.js +2 -3
- package/lib/es/rating/foundation.js +4 -13
- package/lib/es/scrollList/itemFoundation.js +5 -13
- package/lib/es/select/foundation.js +50 -88
- package/lib/es/select/optionFoundation.js +1 -2
- package/lib/es/sideSheet/sideSheetFoundation.js +3 -7
- package/lib/es/slider/foundation.js +10 -16
- package/lib/es/spin/foundation.js +2 -4
- package/lib/es/switch/foundation.js +1 -2
- package/lib/es/table/bodyFoundation.js +6 -11
- package/lib/es/table/foundation.js +67 -93
- package/lib/es/table/utils.js +33 -51
- package/lib/es/tabs/foundation.js +5 -18
- package/lib/es/tagInput/foundation.js +9 -21
- package/lib/es/timePicker/ComboxFoundation.js +7 -16
- package/lib/es/timePicker/foundation.js +23 -37
- package/lib/es/timePicker/inputFoundation.js +1 -2
- package/lib/es/timePicker/utils/index.js +4 -6
- package/lib/es/timePicker/utils/localeDate.js +1 -2
- package/lib/es/toast/toastFoundation.js +2 -4
- package/lib/es/toast/toastListFoundation.js +2 -4
- package/lib/es/tooltip/foundation.js +26 -46
- package/lib/es/transfer/foundation.js +21 -43
- package/lib/es/transfer/transferUtils.js +13 -33
- package/lib/es/tree/foundation.js +38 -70
- package/lib/es/tree/treeUtil.js +57 -109
- package/lib/es/treeSelect/foundation.js +45 -73
- package/lib/es/upload/foundation.js +52 -118
- package/lib/es/upload/utils.js +12 -25
- package/lib/es/utils/Event.js +5 -12
- package/lib/es/utils/FocusHandle.js +3 -7
- package/lib/es/utils/Store.js +4 -12
- package/lib/es/utils/a11y.js +5 -6
- package/lib/es/utils/array.js +3 -5
- package/lib/es/utils/arrayMove.js +2 -6
- package/lib/es/utils/classnames.js +3 -6
- package/lib/es/utils/date-fns-extra.js +6 -14
- package/lib/es/utils/dom.js +1 -2
- package/lib/es/utils/getDataAttr.js +1 -5
- package/lib/es/utils/getHighlight.js +4 -14
- package/lib/es/utils/getMotionObjFromProps.js +1 -2
- package/lib/es/utils/object.js +7 -15
- package/lib/es/utils/set.js +1 -2
- package/lib/es/utils/shallowEqualObjects.js +2 -5
- package/lib/es/utils/touchPolyfill.js +2 -6
- package/lib/es/utils/uuid.js +2 -7
- package/package.json +2 -4
- package/select/foundation.ts +2 -2
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
2
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
4
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
5
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
6
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
7
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
8
|
-
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
9
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
10
|
-
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
11
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
12
|
-
import _URL from "@babel/runtime-corejs3/core-js-stable/url";
|
|
13
|
-
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
|
|
14
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
15
|
-
|
|
16
1
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
17
2
|
function adopt(value) {
|
|
18
3
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -20,7 +5,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
20
5
|
});
|
|
21
6
|
}
|
|
22
7
|
|
|
23
|
-
return new (P || (P =
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
9
|
function fulfilled(value) {
|
|
25
10
|
try {
|
|
26
11
|
step(generator.next(value));
|
|
@@ -63,7 +48,7 @@ const {
|
|
|
63
48
|
|
|
64
49
|
class UploadFoundation extends BaseFoundation {
|
|
65
50
|
constructor(adapter) {
|
|
66
|
-
super(
|
|
51
|
+
super(Object.assign({}, adapter));
|
|
67
52
|
}
|
|
68
53
|
|
|
69
54
|
destroy() {
|
|
@@ -71,8 +56,6 @@ class UploadFoundation extends BaseFoundation {
|
|
|
71
56
|
}
|
|
72
57
|
|
|
73
58
|
getError(_ref) {
|
|
74
|
-
var _context, _context2;
|
|
75
|
-
|
|
76
59
|
let {
|
|
77
60
|
action,
|
|
78
61
|
xhr,
|
|
@@ -80,9 +63,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
80
63
|
fileName
|
|
81
64
|
} = _ref;
|
|
82
65
|
const status = xhr ? xhr.status : 0;
|
|
83
|
-
|
|
84
|
-
const msg = message || _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "cannot post ".concat(fileName, " to ")).call(_context2, action, ", xhr status: ")).call(_context, status, "'");
|
|
85
|
-
|
|
66
|
+
const msg = message || "cannot post ".concat(fileName, " to ").concat(action, ", xhr status: ").concat(status, "'");
|
|
86
67
|
const err = new Error(msg);
|
|
87
68
|
err.status = status;
|
|
88
69
|
err.method = 'post';
|
|
@@ -165,12 +146,10 @@ class UploadFoundation extends BaseFoundation {
|
|
|
165
146
|
const {
|
|
166
147
|
fileList
|
|
167
148
|
} = this.getStates();
|
|
168
|
-
|
|
169
|
-
let files = _Array$from(currentFileList); // When the selected file
|
|
170
|
-
|
|
149
|
+
let files = Array.from(currentFileList); // When the selected file
|
|
171
150
|
|
|
172
151
|
if (typeof accept !== 'undefined') {
|
|
173
|
-
files =
|
|
152
|
+
files = files.filter(item => {
|
|
174
153
|
const isValid = this.checkFileFormat(accept, item);
|
|
175
154
|
|
|
176
155
|
if (!isValid) {
|
|
@@ -189,7 +168,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
189
168
|
}
|
|
190
169
|
}
|
|
191
170
|
|
|
192
|
-
files =
|
|
171
|
+
files = files.map(file => {
|
|
193
172
|
if (transformFile) {
|
|
194
173
|
file = transformFile(file);
|
|
195
174
|
}
|
|
@@ -216,7 +195,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
216
195
|
|
|
217
196
|
if (limit === 1) {
|
|
218
197
|
// Replace the current file with the last file
|
|
219
|
-
files =
|
|
198
|
+
files = files.slice(-1);
|
|
220
199
|
|
|
221
200
|
this._adapter.notifyFileSelect(files);
|
|
222
201
|
|
|
@@ -228,7 +207,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
228
207
|
|
|
229
208
|
|
|
230
209
|
const restNum = limit - fileList.length;
|
|
231
|
-
files =
|
|
210
|
+
files = files.slice(0, restNum);
|
|
232
211
|
}
|
|
233
212
|
}
|
|
234
213
|
|
|
@@ -254,8 +233,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
254
233
|
replaceIdx,
|
|
255
234
|
fileList
|
|
256
235
|
} = this.getStates();
|
|
257
|
-
|
|
258
|
-
let newFile = _Array$from(currentFileList).pop();
|
|
236
|
+
let newFile = Array.from(currentFileList).pop();
|
|
259
237
|
|
|
260
238
|
if (typeof accept !== 'undefined') {
|
|
261
239
|
if (!this.checkFileFormat(accept, newFile)) {
|
|
@@ -284,8 +262,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
284
262
|
|
|
285
263
|
const newFileItem = this.buildFileItem(newFile, uploadTrigger);
|
|
286
264
|
const newFileList = [...fileList];
|
|
287
|
-
|
|
288
|
-
_spliceInstanceProperty(newFileList).call(newFileList, replaceIdx, 1, newFileItem);
|
|
265
|
+
newFileList.splice(replaceIdx, 1, newFileItem);
|
|
289
266
|
|
|
290
267
|
this._adapter.notifyChange({
|
|
291
268
|
currentFile: newFileItem,
|
|
@@ -337,8 +314,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
337
314
|
const {
|
|
338
315
|
uploadTrigger
|
|
339
316
|
} = this.getProps();
|
|
340
|
-
|
|
341
|
-
const currentFiles = _mapInstanceProperty(files).call(files, item => this.buildFileItem(item, uploadTrigger));
|
|
317
|
+
const currentFiles = files.map(item => this.buildFileItem(item, uploadTrigger));
|
|
342
318
|
|
|
343
319
|
this._adapter.notifyChange({
|
|
344
320
|
fileList: currentFiles,
|
|
@@ -353,18 +329,13 @@ class UploadFoundation extends BaseFoundation {
|
|
|
353
329
|
}
|
|
354
330
|
|
|
355
331
|
addFilesToList(files) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
const fileList = _sliceInstanceProperty(_context3 = this.getState('fileList')).call(_context3);
|
|
359
|
-
|
|
332
|
+
const fileList = this.getState('fileList').slice();
|
|
360
333
|
const {
|
|
361
334
|
uploadTrigger
|
|
362
335
|
} = this.getProps();
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
_forEachInstanceProperty(currentFiles).call(currentFiles, file => {
|
|
367
|
-
const index = _findIndexInstanceProperty(fileList).call(fileList, item => item.uid === file.uid);
|
|
336
|
+
const currentFiles = files.map(item => this.buildFileItem(item, uploadTrigger));
|
|
337
|
+
currentFiles.forEach(file => {
|
|
338
|
+
const index = fileList.findIndex(item => item.uid === file.uid);
|
|
368
339
|
|
|
369
340
|
if (index !== -1) {
|
|
370
341
|
fileList[index] = file;
|
|
@@ -400,10 +371,10 @@ class UploadFoundation extends BaseFoundation {
|
|
|
400
371
|
const unAcceptFileList = []; // 当次选中的文件
|
|
401
372
|
// current selected file
|
|
402
373
|
|
|
403
|
-
let currentFileList =
|
|
374
|
+
let currentFileList = Array.from(files);
|
|
404
375
|
|
|
405
376
|
if (typeof accept !== 'undefined') {
|
|
406
|
-
currentFileList =
|
|
377
|
+
currentFileList = currentFileList.filter(item => {
|
|
407
378
|
const isValid = this.checkFileFormat(accept, item);
|
|
408
379
|
|
|
409
380
|
if (!isValid) {
|
|
@@ -422,7 +393,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
422
393
|
}
|
|
423
394
|
}
|
|
424
395
|
|
|
425
|
-
currentFileList =
|
|
396
|
+
currentFileList = currentFileList.map(file => {
|
|
426
397
|
if (!file.uid) {
|
|
427
398
|
file.uid = getUuidv4();
|
|
428
399
|
}
|
|
@@ -449,7 +420,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
449
420
|
if (limit === 1) {
|
|
450
421
|
// 使用最后面的文件对当前文件进行替换
|
|
451
422
|
// Use the last file to replace the current file
|
|
452
|
-
currentFileList =
|
|
423
|
+
currentFileList = currentFileList.slice(-1);
|
|
453
424
|
|
|
454
425
|
this._adapter.notifyFileSelect(currentFileList);
|
|
455
426
|
|
|
@@ -462,18 +433,17 @@ class UploadFoundation extends BaseFoundation {
|
|
|
462
433
|
|
|
463
434
|
|
|
464
435
|
const restNum = limit - fileList.length;
|
|
465
|
-
currentFileList =
|
|
436
|
+
currentFileList = currentFileList.slice(0, restNum);
|
|
466
437
|
|
|
467
438
|
this._adapter.notifyExceed(currentFileList);
|
|
468
439
|
}
|
|
469
440
|
}
|
|
470
441
|
|
|
471
|
-
const fileItemList =
|
|
472
|
-
|
|
473
|
-
const newFileList = _sliceInstanceProperty(fileList).call(fileList);
|
|
442
|
+
const fileItemList = currentFileList.map(file => this.buildFileItem(file, uploadTrigger));
|
|
443
|
+
const newFileList = fileList.slice();
|
|
474
444
|
|
|
475
445
|
if (typeof index !== 'undefined') {
|
|
476
|
-
|
|
446
|
+
newFileList.splice(index, 0, ...fileItemList);
|
|
477
447
|
} else {
|
|
478
448
|
newFileList.push(...fileItemList);
|
|
479
449
|
}
|
|
@@ -495,16 +465,13 @@ class UploadFoundation extends BaseFoundation {
|
|
|
495
465
|
|
|
496
466
|
|
|
497
467
|
manualUpload() {
|
|
498
|
-
var _context4;
|
|
499
|
-
|
|
500
468
|
// find the list of files that have not been uploaded
|
|
501
|
-
const waitToUploadFileList =
|
|
502
|
-
|
|
469
|
+
const waitToUploadFileList = this.getState('fileList').filter(item => item.status === FILE_STATUS_WAIT_UPLOAD);
|
|
503
470
|
this.startUpload(waitToUploadFileList);
|
|
504
471
|
}
|
|
505
472
|
|
|
506
473
|
startUpload(fileList) {
|
|
507
|
-
|
|
474
|
+
fileList.forEach(file => {
|
|
508
475
|
if (!file._sizeInvalid) {
|
|
509
476
|
this.upload(file);
|
|
510
477
|
}
|
|
@@ -552,37 +519,30 @@ class UploadFoundation extends BaseFoundation {
|
|
|
552
519
|
|
|
553
520
|
case buResult && isPromise(buResult):
|
|
554
521
|
{
|
|
555
|
-
|
|
556
|
-
var _context5;
|
|
557
|
-
|
|
522
|
+
Promise.resolve(buResult).then(resolveData => {
|
|
558
523
|
let newResult = {
|
|
559
524
|
shouldUpload: true
|
|
560
525
|
};
|
|
561
|
-
|
|
562
|
-
const typeOfResolveData = _sliceInstanceProperty(_context5 = Object.prototype.toString.call(resolveData)).call(_context5, 8, -1);
|
|
526
|
+
const typeOfResolveData = Object.prototype.toString.call(resolveData).slice(8, -1);
|
|
563
527
|
|
|
564
528
|
if (typeOfResolveData === 'Object') {
|
|
565
|
-
newResult =
|
|
529
|
+
newResult = Object.assign(Object.assign({}, newResult), resolveData);
|
|
566
530
|
}
|
|
567
531
|
|
|
568
532
|
this.handleBeforeUploadResultInObject(newResult, file);
|
|
569
533
|
}, rejectVal => {
|
|
570
|
-
var _context6;
|
|
571
|
-
|
|
572
534
|
let newResult = {
|
|
573
535
|
shouldUpload: false,
|
|
574
536
|
status: strings.FILE_STATUS_VALID_FAIL
|
|
575
537
|
};
|
|
576
|
-
|
|
577
|
-
const typeOfRejectData = _sliceInstanceProperty(_context6 = Object.prototype.toString.call(rejectVal)).call(_context6, 8, -1);
|
|
538
|
+
const typeOfRejectData = Object.prototype.toString.call(rejectVal).slice(8, -1);
|
|
578
539
|
|
|
579
540
|
if (typeOfRejectData === 'Object') {
|
|
580
|
-
newResult =
|
|
541
|
+
newResult = Object.assign(Object.assign({}, newResult), rejectVal);
|
|
581
542
|
}
|
|
582
543
|
|
|
583
544
|
this.handleBeforeUploadResultInObject(newResult, file);
|
|
584
545
|
});
|
|
585
|
-
|
|
586
546
|
break;
|
|
587
547
|
}
|
|
588
548
|
// sync validate - object
|
|
@@ -600,8 +560,6 @@ class UploadFoundation extends BaseFoundation {
|
|
|
600
560
|
|
|
601
561
|
|
|
602
562
|
handleBeforeUploadResultInObject(buResult, file) {
|
|
603
|
-
var _context7;
|
|
604
|
-
|
|
605
563
|
const {
|
|
606
564
|
shouldUpload,
|
|
607
565
|
status,
|
|
@@ -609,11 +567,10 @@ class UploadFoundation extends BaseFoundation {
|
|
|
609
567
|
validateMessage,
|
|
610
568
|
fileInstance
|
|
611
569
|
} = buResult;
|
|
612
|
-
|
|
613
|
-
let newFileList = _sliceInstanceProperty(_context7 = this.getState('fileList')).call(_context7);
|
|
570
|
+
let newFileList = this.getState('fileList').slice();
|
|
614
571
|
|
|
615
572
|
if (autoRemove) {
|
|
616
|
-
newFileList =
|
|
573
|
+
newFileList = newFileList.filter(item => item.uid !== file.uid);
|
|
617
574
|
} else {
|
|
618
575
|
const index = this._getFileIndex(file, newFileList);
|
|
619
576
|
|
|
@@ -668,13 +625,11 @@ class UploadFoundation extends BaseFoundation {
|
|
|
668
625
|
} = option;
|
|
669
626
|
|
|
670
627
|
if (data) {
|
|
671
|
-
var _context8;
|
|
672
|
-
|
|
673
628
|
if (typeof data === 'function') {
|
|
674
629
|
data = data(fileInstance);
|
|
675
630
|
}
|
|
676
631
|
|
|
677
|
-
|
|
632
|
+
Object.keys(data).forEach(key => {
|
|
678
633
|
formData.append(key, data[key]);
|
|
679
634
|
});
|
|
680
635
|
} // add file
|
|
@@ -759,9 +714,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
759
714
|
const {
|
|
760
715
|
fileList
|
|
761
716
|
} = this.getStates();
|
|
762
|
-
|
|
763
|
-
const newFileList = _sliceInstanceProperty(fileList).call(fileList);
|
|
764
|
-
|
|
717
|
+
const newFileList = fileList.slice();
|
|
765
718
|
let percent = 0;
|
|
766
719
|
|
|
767
720
|
if (e.total > 0) {
|
|
@@ -845,8 +798,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
845
798
|
body = this.getBody(xhr);
|
|
846
799
|
}
|
|
847
800
|
|
|
848
|
-
const newFileList =
|
|
849
|
-
|
|
801
|
+
const newFileList = fileList.slice();
|
|
850
802
|
const {
|
|
851
803
|
afterUpload
|
|
852
804
|
} = this.getProps();
|
|
@@ -872,7 +824,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
872
824
|
status ? newFileList[index].status = status : null;
|
|
873
825
|
validateMessage ? newFileList[index].validateMessage = validateMessage : null;
|
|
874
826
|
name ? newFileList[index].name = name : null;
|
|
875
|
-
autoRemove ?
|
|
827
|
+
autoRemove ? newFileList.splice(index, 1) : null;
|
|
876
828
|
}
|
|
877
829
|
|
|
878
830
|
this._adapter.notifySuccess(body, fileInstance, newFileList);
|
|
@@ -886,7 +838,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
886
838
|
}
|
|
887
839
|
|
|
888
840
|
_getFileIndex(file, fileList) {
|
|
889
|
-
return
|
|
841
|
+
return fileList.findIndex(item => item.uid === file.uid);
|
|
890
842
|
}
|
|
891
843
|
|
|
892
844
|
handleRemove(file) {
|
|
@@ -901,14 +853,13 @@ class UploadFoundation extends BaseFoundation {
|
|
|
901
853
|
const {
|
|
902
854
|
fileList
|
|
903
855
|
} = this.getStates();
|
|
904
|
-
|
|
905
|
-
_Promise.resolve(this._adapter.notifyBeforeRemove(file, fileList)).then(res => {
|
|
856
|
+
Promise.resolve(this._adapter.notifyBeforeRemove(file, fileList)).then(res => {
|
|
906
857
|
// prevent remove while user return false
|
|
907
858
|
if (res === false) {
|
|
908
859
|
return;
|
|
909
860
|
}
|
|
910
861
|
|
|
911
|
-
const newFileList =
|
|
862
|
+
const newFileList = fileList.slice();
|
|
912
863
|
|
|
913
864
|
const index = this._getFileIndex(file, fileList);
|
|
914
865
|
|
|
@@ -916,7 +867,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
916
867
|
return;
|
|
917
868
|
}
|
|
918
869
|
|
|
919
|
-
|
|
870
|
+
newFileList.splice(index, 1);
|
|
920
871
|
|
|
921
872
|
this._adapter.notifyRemove(file.fileInstance, newFileList, file);
|
|
922
873
|
|
|
@@ -948,9 +899,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
948
899
|
const {
|
|
949
900
|
action
|
|
950
901
|
} = this.getProps();
|
|
951
|
-
|
|
952
|
-
const newFileList = _sliceInstanceProperty(fileList).call(fileList);
|
|
953
|
-
|
|
902
|
+
const newFileList = fileList.slice();
|
|
954
903
|
const error = this.getError({
|
|
955
904
|
action,
|
|
956
905
|
xhr,
|
|
@@ -982,7 +931,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
982
931
|
return;
|
|
983
932
|
}
|
|
984
933
|
|
|
985
|
-
|
|
934
|
+
Promise.resolve(this._adapter.notifyBeforeClear(fileList)).then(res => {
|
|
986
935
|
if (res === false) {
|
|
987
936
|
return;
|
|
988
937
|
}
|
|
@@ -999,14 +948,11 @@ class UploadFoundation extends BaseFoundation {
|
|
|
999
948
|
|
|
1000
949
|
_createURL(fileInstance) {
|
|
1001
950
|
// https://stackoverflow.com/questions/31742072/filereader-vs-window-url-createobjecturl
|
|
1002
|
-
const url =
|
|
1003
|
-
|
|
951
|
+
const url = URL.createObjectURL(fileInstance);
|
|
1004
952
|
const {
|
|
1005
953
|
localUrls
|
|
1006
954
|
} = this.getStates();
|
|
1007
|
-
|
|
1008
|
-
const newUrls = _sliceInstanceProperty(localUrls).call(localUrls);
|
|
1009
|
-
|
|
955
|
+
const newUrls = localUrls.slice();
|
|
1010
956
|
newUrls.push(url);
|
|
1011
957
|
|
|
1012
958
|
this._adapter.updateLocalUrls(newUrls);
|
|
@@ -1020,15 +966,14 @@ class UploadFoundation extends BaseFoundation {
|
|
|
1020
966
|
const {
|
|
1021
967
|
localUrls
|
|
1022
968
|
} = this.getStates();
|
|
1023
|
-
|
|
1024
|
-
_forEachInstanceProperty(localUrls).call(localUrls, url => {
|
|
969
|
+
localUrls.forEach(url => {
|
|
1025
970
|
this._releaseBlob(url);
|
|
1026
971
|
});
|
|
1027
972
|
}
|
|
1028
973
|
|
|
1029
974
|
_releaseBlob(url) {
|
|
1030
975
|
try {
|
|
1031
|
-
|
|
976
|
+
URL.revokeObjectURL(url);
|
|
1032
977
|
} catch (error) {
|
|
1033
978
|
console.log(error);
|
|
1034
979
|
}
|
|
@@ -1059,12 +1004,8 @@ class UploadFoundation extends BaseFoundation {
|
|
|
1059
1004
|
|
|
1060
1005
|
handleDirectoryDrop(e) {
|
|
1061
1006
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
const fileList = _sliceInstanceProperty(_context9 = this.getState('fileList')).call(_context9);
|
|
1065
|
-
|
|
1066
|
-
const items = _sliceInstanceProperty([]).call(e.dataTransfer.items);
|
|
1067
|
-
|
|
1007
|
+
const fileList = this.getState('fileList').slice();
|
|
1008
|
+
const items = [].slice.call(e.dataTransfer.items);
|
|
1068
1009
|
const files = yield mapFileTree(items);
|
|
1069
1010
|
this.handleChange(files);
|
|
1070
1011
|
|
|
@@ -1075,8 +1016,6 @@ class UploadFoundation extends BaseFoundation {
|
|
|
1075
1016
|
}
|
|
1076
1017
|
|
|
1077
1018
|
handleDrop(e) {
|
|
1078
|
-
var _context10;
|
|
1079
|
-
|
|
1080
1019
|
// Block file opening in browser
|
|
1081
1020
|
e.preventDefault();
|
|
1082
1021
|
e.stopPropagation();
|
|
@@ -1084,8 +1023,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
1084
1023
|
disabled,
|
|
1085
1024
|
directory
|
|
1086
1025
|
} = this.getProps();
|
|
1087
|
-
|
|
1088
|
-
const fileList = _sliceInstanceProperty(_context10 = this.getState('fileList')).call(_context10);
|
|
1026
|
+
const fileList = this.getState('fileList').slice();
|
|
1089
1027
|
|
|
1090
1028
|
if (!disabled) {
|
|
1091
1029
|
if (directory) {
|
|
@@ -1093,8 +1031,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
1093
1031
|
return;
|
|
1094
1032
|
}
|
|
1095
1033
|
|
|
1096
|
-
const files =
|
|
1097
|
-
|
|
1034
|
+
const files = Array.from(e.dataTransfer.files);
|
|
1098
1035
|
this.handleChange(files);
|
|
1099
1036
|
|
|
1100
1037
|
this._adapter.updateDragAreaStatus(DRAG_AREA_DEFAULT);
|
|
@@ -1122,14 +1059,11 @@ class UploadFoundation extends BaseFoundation {
|
|
|
1122
1059
|
|
|
1123
1060
|
|
|
1124
1061
|
checkFileFormat(accept, file) {
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
const acceptTypes = _filterInstanceProperty(_context11 = _mapInstanceProperty(_context12 = accept.split(',')).call(_context12, type => _trimInstanceProperty(type).call(type))).call(_context11, type => type);
|
|
1128
|
-
|
|
1062
|
+
const acceptTypes = accept.split(',').map(type => type.trim()).filter(type => type);
|
|
1129
1063
|
const mimeType = file.type || ''; // Get the large class to which MIMEtype belongs, eg: image/jpeg = > image, application/= > application
|
|
1130
1064
|
|
|
1131
1065
|
const baseMimeType = mimeType.replace(/\/.*$/, '');
|
|
1132
|
-
return
|
|
1066
|
+
return acceptTypes.some(type => {
|
|
1133
1067
|
// When accepted as a suffix filename such as [.jpeg]
|
|
1134
1068
|
if (type.charAt(0) === '.') {
|
|
1135
1069
|
const fileName = file.name || '';
|
package/lib/es/upload/utils.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
2
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
3
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
4
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
5
|
-
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
6
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
7
|
-
|
|
8
1
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
9
2
|
function adopt(value) {
|
|
10
3
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -12,7 +5,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
12
5
|
});
|
|
13
6
|
}
|
|
14
7
|
|
|
15
|
-
return new (P || (P =
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
9
|
function fulfilled(value) {
|
|
17
10
|
try {
|
|
18
11
|
step(generator.next(value));
|
|
@@ -51,19 +44,18 @@ export function getFileSize(number) {
|
|
|
51
44
|
return undefined;
|
|
52
45
|
}
|
|
53
46
|
export function endsWith(str, suffix) {
|
|
54
|
-
return
|
|
47
|
+
return str.indexOf(suffix, str.length - suffix.length) !== -1;
|
|
55
48
|
}
|
|
56
49
|
export function loopFiles(item) {
|
|
57
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
return new
|
|
51
|
+
return new Promise((res, rej) => {
|
|
59
52
|
const dirReader = item.createReader();
|
|
60
53
|
let fileList = [];
|
|
61
54
|
|
|
62
55
|
function sequence() {
|
|
63
56
|
dirReader.readEntries(entries => {
|
|
64
|
-
const entryList =
|
|
65
|
-
|
|
66
|
-
fileList = _concatInstanceProperty(fileList).call(fileList, entryList); // Check if all the file has been viewed
|
|
57
|
+
const entryList = Array.prototype.slice.apply(entries);
|
|
58
|
+
fileList = fileList.concat(entryList); // Check if all the file has been viewed
|
|
67
59
|
|
|
68
60
|
const isFinished = !entryList.length;
|
|
69
61
|
|
|
@@ -89,21 +81,19 @@ export function mapFileTree(items) {
|
|
|
89
81
|
item.path = path;
|
|
90
82
|
|
|
91
83
|
if (item.isFile) {
|
|
92
|
-
promises.push(new
|
|
84
|
+
promises.push(new Promise((res, rej) => {
|
|
93
85
|
item.file(file => {
|
|
94
86
|
if (item.fullPath && !file.webkitRelativePath) {
|
|
95
87
|
// This file is provided to the user based on the relative path of the drag and drop folder
|
|
96
88
|
// If you drag the Upload folder, the path of the internal file may be Upload/File/a.png, etc
|
|
97
|
-
|
|
89
|
+
Object.defineProperties(file, {
|
|
98
90
|
webkitRelativePath: {
|
|
99
91
|
writable: true
|
|
100
92
|
}
|
|
101
93
|
}); //@ts-ignore add webkitRelativePath property into file
|
|
102
94
|
|
|
103
|
-
|
|
104
95
|
file.webkitRelativePath = item.fullPath.replace(/^\//, '');
|
|
105
|
-
|
|
106
|
-
_Object$defineProperties(file, {
|
|
96
|
+
Object.defineProperties(file, {
|
|
107
97
|
webkitRelativePath: {
|
|
108
98
|
writable: false
|
|
109
99
|
}
|
|
@@ -117,21 +107,18 @@ export function mapFileTree(items) {
|
|
|
117
107
|
const entries = yield loopFiles(item);
|
|
118
108
|
|
|
119
109
|
for (let index = 0; index < entries.length; index++) {
|
|
120
|
-
var _context;
|
|
121
|
-
|
|
122
110
|
const entry = entries[index];
|
|
123
|
-
yield _traverseFileTree(entry,
|
|
111
|
+
yield _traverseFileTree(entry, "".concat(path).concat(item.name, "/"));
|
|
124
112
|
}
|
|
125
113
|
}
|
|
126
114
|
});
|
|
127
115
|
|
|
128
116
|
try {
|
|
129
|
-
const batches =
|
|
130
|
-
|
|
117
|
+
const batches = items.map(i => _traverseFileTree(i.webkitGetAsEntry())); // Perform asynchronous operations to add the required promises to the queue
|
|
131
118
|
|
|
132
|
-
yield
|
|
119
|
+
yield Promise.all(batches); // Execution queue
|
|
133
120
|
|
|
134
|
-
const result = yield
|
|
121
|
+
const result = yield Promise.all(promises);
|
|
135
122
|
return result;
|
|
136
123
|
} catch (error) {
|
|
137
124
|
console.warn('Captured error while loop directory.');
|
package/lib/es/utils/Event.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
2
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
3
|
-
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
4
|
-
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
5
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
1
|
import isNullOrUndefined from "./isNullOrUndefined";
|
|
7
2
|
export default class Event {
|
|
8
3
|
constructor() {
|
|
9
|
-
this._eventMap = new
|
|
4
|
+
this._eventMap = new Map();
|
|
10
5
|
}
|
|
11
6
|
|
|
12
7
|
on(event, callback) {
|
|
@@ -38,11 +33,11 @@ export default class Event {
|
|
|
38
33
|
if (typeof callback === 'function') {
|
|
39
34
|
const callbacks = this._eventMap.get(event);
|
|
40
35
|
|
|
41
|
-
if (
|
|
36
|
+
if (Array.isArray(callbacks) && callbacks.length) {
|
|
42
37
|
let index = -1; // eslint-disable-next-line max-depth
|
|
43
38
|
|
|
44
|
-
while ((index =
|
|
45
|
-
|
|
39
|
+
while ((index = callbacks.findIndex(cb => cb === callback)) > -1) {
|
|
40
|
+
callbacks.splice(index, 1);
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
43
|
} else if (isNullOrUndefined(callback)) {
|
|
@@ -54,8 +49,6 @@ export default class Event {
|
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
emit(event) {
|
|
57
|
-
var _context;
|
|
58
|
-
|
|
59
52
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
60
53
|
args[_key - 1] = arguments[_key];
|
|
61
54
|
}
|
|
@@ -64,7 +57,7 @@ export default class Event {
|
|
|
64
57
|
return false;
|
|
65
58
|
}
|
|
66
59
|
|
|
67
|
-
|
|
60
|
+
this._eventMap.get(event).forEach(callback => callback(...args));
|
|
68
61
|
|
|
69
62
|
return true;
|
|
70
63
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import _without from "lodash/without";
|
|
2
|
-
import _Object$freeze from "@babel/runtime-corejs3/core-js-stable/object/freeze";
|
|
3
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
4
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
5
2
|
import { isHTMLElement } from "./dom";
|
|
6
3
|
|
|
7
4
|
/*
|
|
@@ -103,8 +100,7 @@ class FocusTrapHandle {
|
|
|
103
100
|
}
|
|
104
101
|
};
|
|
105
102
|
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
Object.freeze(options); // prevent user to change options after init;
|
|
108
104
|
|
|
109
105
|
this.container = container;
|
|
110
106
|
this.options = options;
|
|
@@ -112,7 +108,7 @@ class FocusTrapHandle {
|
|
|
112
108
|
|
|
113
109
|
this.focusRedirectListenerList = (() => {
|
|
114
110
|
if (options === null || options === void 0 ? void 0 : options.onFocusRedirectListener) {
|
|
115
|
-
return
|
|
111
|
+
return Array.isArray(options.onFocusRedirectListener) ? [...options.onFocusRedirectListener] : [options.onFocusRedirectListener];
|
|
116
112
|
} else {
|
|
117
113
|
return [];
|
|
118
114
|
}
|
|
@@ -138,7 +134,7 @@ class FocusTrapHandle {
|
|
|
138
134
|
const focusableSelectorsList = ["input:not([disabled]):not([tabindex='-1'])", "textarea:not([disabled]):not([tabindex='-1'])", "button:not([disabled]):not([tabindex='-1'])", "a[href]:not([tabindex='-1'])", "select:not([disabled]):not([tabindex='-1'])", "area[href]:not([tabindex='-1'])", "iframe:not([tabindex='-1'])", "object:not([tabindex='-1'])", "*[tabindex]:not([tabindex='-1'])", "*[contenteditable]:not([tabindex='-1'])"];
|
|
139
135
|
const focusableSelectorsStr = focusableSelectorsList.join(','); // we are not filtered elements which are invisible
|
|
140
136
|
|
|
141
|
-
return
|
|
137
|
+
return Array.from(node.querySelectorAll(focusableSelectorsStr));
|
|
142
138
|
}
|
|
143
139
|
|
|
144
140
|
static getActiveElement() {
|