@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,31 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
14
|
-
|
|
15
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
16
|
-
|
|
17
|
-
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
18
|
-
|
|
19
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
20
|
-
|
|
21
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
22
|
-
|
|
23
|
-
var _map2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/map"));
|
|
24
|
-
|
|
25
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
26
|
-
|
|
27
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/values"));
|
|
28
|
-
|
|
29
8
|
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
30
9
|
|
|
31
10
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
@@ -36,10 +15,12 @@ var _transferUtils = require("./transferUtils");
|
|
|
36
15
|
|
|
37
16
|
var _arrayMove = _interopRequireDefault(require("../utils/arrayMove"));
|
|
38
17
|
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
39
20
|
// eslint-disable-next-line max-len
|
|
40
21
|
class TransferFoundation extends _foundation.default {
|
|
41
22
|
constructor(adapter) {
|
|
42
|
-
super(
|
|
23
|
+
super(Object.assign({}, adapter));
|
|
43
24
|
}
|
|
44
25
|
|
|
45
26
|
_generateGroupedData(dataSource) {
|
|
@@ -54,7 +35,7 @@ class TransferFoundation extends _foundation.default {
|
|
|
54
35
|
const {
|
|
55
36
|
path = []
|
|
56
37
|
} = item;
|
|
57
|
-
return
|
|
38
|
+
return path.map(p => p.label).join(' > ');
|
|
58
39
|
}
|
|
59
40
|
|
|
60
41
|
handleInputChange(inputVal) {
|
|
@@ -67,7 +48,7 @@ class TransferFoundation extends _foundation.default {
|
|
|
67
48
|
} = this.getProps();
|
|
68
49
|
|
|
69
50
|
if (type === _constants.strings.TYPE_TREE_TO_LIST) {
|
|
70
|
-
const searchResult = new
|
|
51
|
+
const searchResult = new Set(data.map(item => item.key));
|
|
71
52
|
|
|
72
53
|
this._adapter.searchTree(inputVal);
|
|
73
54
|
|
|
@@ -80,13 +61,9 @@ class TransferFoundation extends _foundation.default {
|
|
|
80
61
|
return;
|
|
81
62
|
}
|
|
82
63
|
|
|
83
|
-
const filterFunc = typeof filter === 'function' ? item => filter(inputVal, item) : item =>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return typeof item.label === 'string' && (0, _includes.default)(_context = item.label).call(_context, inputVal);
|
|
87
|
-
};
|
|
88
|
-
const searchData = (0, _filter.default)(data).call(data, filterFunc);
|
|
89
|
-
const searchResult = new _set.default((0, _map.default)(searchData).call(searchData, item => item.key));
|
|
64
|
+
const filterFunc = typeof filter === 'function' ? item => filter(inputVal, item) : item => typeof item.label === 'string' && item.label.includes(inputVal);
|
|
65
|
+
const searchData = data.filter(filterFunc);
|
|
66
|
+
const searchResult = new Set(searchData.map(item => item.key));
|
|
90
67
|
|
|
91
68
|
this._adapter.notifySearch(inputVal);
|
|
92
69
|
|
|
@@ -114,14 +91,14 @@ class TransferFoundation extends _foundation.default {
|
|
|
114
91
|
|
|
115
92
|
const inSearchMode = inputValue !== '';
|
|
116
93
|
let operateData = [];
|
|
117
|
-
operateData = inSearchMode ?
|
|
94
|
+
operateData = inSearchMode ? data.filter(item => searchResult.has(item.key)) : data;
|
|
118
95
|
operateData = type === _constants.strings.TYPE_TREE_TO_LIST ? data : operateData;
|
|
119
|
-
let newSelectedItems = new
|
|
96
|
+
let newSelectedItems = new Map();
|
|
120
97
|
|
|
121
98
|
switch (true) {
|
|
122
99
|
case !wantAllChecked:
|
|
123
|
-
newSelectedItems = new
|
|
124
|
-
|
|
100
|
+
newSelectedItems = new Map(selectedItems);
|
|
101
|
+
operateData.forEach(item => {
|
|
125
102
|
// If the item is disabled, keep it
|
|
126
103
|
if (!item.disabled) {
|
|
127
104
|
newSelectedItems.delete(item.key);
|
|
@@ -130,8 +107,8 @@ class TransferFoundation extends _foundation.default {
|
|
|
130
107
|
break;
|
|
131
108
|
|
|
132
109
|
case wantAllChecked:
|
|
133
|
-
newSelectedItems = new
|
|
134
|
-
|
|
110
|
+
newSelectedItems = new Map(selectedItems);
|
|
111
|
+
operateData.forEach(item => {
|
|
135
112
|
if (item.disabled) {
|
|
136
113
|
// The disabled item, judge whether it is selected, if it is selected, still need to add the selection
|
|
137
114
|
if (selectedItems.has(item.key)) {
|
|
@@ -169,8 +146,8 @@ class TransferFoundation extends _foundation.default {
|
|
|
169
146
|
return;
|
|
170
147
|
}
|
|
171
148
|
|
|
172
|
-
const newSelectedItems = new
|
|
173
|
-
|
|
149
|
+
const newSelectedItems = new Map(selectedItems);
|
|
150
|
+
data.forEach(item => {
|
|
174
151
|
// If the item is disabled, keep it
|
|
175
152
|
if (!item.disabled) {
|
|
176
153
|
newSelectedItems.delete(item.key);
|
|
@@ -222,15 +199,15 @@ class TransferFoundation extends _foundation.default {
|
|
|
222
199
|
const {
|
|
223
200
|
data
|
|
224
201
|
} = this.getStates();
|
|
225
|
-
const dataItems =
|
|
226
|
-
const allItemsMap = new
|
|
227
|
-
const nextSelectedItemsMap = new
|
|
202
|
+
const dataItems = data.map(d => [d.value, d]);
|
|
203
|
+
const allItemsMap = new Map(dataItems);
|
|
204
|
+
const nextSelectedItemsMap = new Map();
|
|
228
205
|
|
|
229
206
|
if (disabled) {
|
|
230
207
|
return;
|
|
231
208
|
}
|
|
232
209
|
|
|
233
|
-
|
|
210
|
+
values.forEach(value => {
|
|
234
211
|
const node = allItemsMap.get(value); // The value passed in is an array of the value used, but the internal selectedItems stores a map of keys
|
|
235
212
|
|
|
236
213
|
if (selectedItems.has(node.key)) {
|
|
@@ -289,10 +266,10 @@ class TransferFoundation extends _foundation.default {
|
|
|
289
266
|
|
|
290
267
|
const selectedItems = this._adapter.getSelected();
|
|
291
268
|
|
|
292
|
-
let selectedArr = [...
|
|
269
|
+
let selectedArr = [...selectedItems.values()];
|
|
293
270
|
selectedArr = (0, _arrayMove.default)(selectedArr, oldIndex, newIndex);
|
|
294
|
-
let newSelectedItems = new
|
|
295
|
-
|
|
271
|
+
let newSelectedItems = new Map();
|
|
272
|
+
selectedArr.forEach(option => {
|
|
296
273
|
newSelectedItems = newSelectedItems.set(option.key, option);
|
|
297
274
|
});
|
|
298
275
|
|
|
@@ -1,49 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports._generateDataByType = _generateDataByType;
|
|
12
7
|
exports._generateGroupedData = _generateGroupedData;
|
|
13
8
|
exports._generateSelectedItems = _generateSelectedItems;
|
|
14
9
|
exports._generateTreeData = _generateTreeData;
|
|
15
10
|
|
|
16
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
17
|
-
|
|
18
|
-
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
19
|
-
|
|
20
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
21
|
-
|
|
22
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
23
|
-
|
|
24
|
-
var _reverse = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reverse"));
|
|
25
|
-
|
|
26
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
27
|
-
|
|
28
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
29
|
-
|
|
30
|
-
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
31
|
-
|
|
32
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/map"));
|
|
33
|
-
|
|
34
|
-
var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
|
|
35
|
-
|
|
36
11
|
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
37
12
|
|
|
38
13
|
var _constants = require("./constants");
|
|
39
14
|
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
40
17
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
41
18
|
var t = {};
|
|
42
19
|
|
|
43
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
44
21
|
|
|
45
|
-
if (s != null && typeof
|
|
46
|
-
if (
|
|
22
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
47
24
|
}
|
|
48
25
|
return t;
|
|
49
26
|
};
|
|
@@ -52,15 +29,13 @@ function _generateGroupedData(dataSource) {
|
|
|
52
29
|
const newData = [];
|
|
53
30
|
|
|
54
31
|
for (const group of dataSource) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(0, _forEach.default)(_context = group.children).call(_context, item => {
|
|
32
|
+
group.children.forEach(item => {
|
|
58
33
|
const {
|
|
59
34
|
children
|
|
60
35
|
} = group,
|
|
61
36
|
rest = __rest(group, ["children"]);
|
|
62
37
|
|
|
63
|
-
newData.push(
|
|
38
|
+
newData.push(Object.assign(Object.assign({}, item), {
|
|
64
39
|
_parent: rest
|
|
65
40
|
}));
|
|
66
41
|
});
|
|
@@ -71,23 +46,19 @@ function _generateGroupedData(dataSource) {
|
|
|
71
46
|
|
|
72
47
|
|
|
73
48
|
function _generateTreeData(dataSource) {
|
|
74
|
-
var _context2;
|
|
75
|
-
|
|
76
49
|
const newData = [];
|
|
77
|
-
const stack =
|
|
50
|
+
const stack = [...dataSource].reverse();
|
|
78
51
|
|
|
79
52
|
while (stack.length) {
|
|
80
53
|
const current = stack.pop();
|
|
81
54
|
current.path = current.path || [(0, _omit2.default)(current, ['children'])];
|
|
82
55
|
|
|
83
|
-
if (current.children &&
|
|
56
|
+
if (current.children && Array.isArray(current.children)) {
|
|
84
57
|
const nodes = current.children;
|
|
85
58
|
|
|
86
59
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const child = (0, _assign.default)({}, nodes[i]);
|
|
90
|
-
child.path = (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = []).call(_context4, current.path)).call(_context3, (0, _omit2.default)(child, ['children']));
|
|
60
|
+
const child = Object.assign({}, nodes[i]);
|
|
61
|
+
child.path = [].concat(current.path).concat((0, _omit2.default)(child, ['children']));
|
|
91
62
|
stack.push(child);
|
|
92
63
|
}
|
|
93
64
|
} else {
|
|
@@ -101,7 +72,7 @@ function _generateTreeData(dataSource) {
|
|
|
101
72
|
}
|
|
102
73
|
|
|
103
74
|
function _generateDataByType(dataSource, type) {
|
|
104
|
-
const newData =
|
|
75
|
+
const newData = dataSource.slice() || [];
|
|
105
76
|
|
|
106
77
|
if (type === _constants.strings.TYPE_GROUP_LIST) {
|
|
107
78
|
return _generateGroupedData(newData);
|
|
@@ -115,9 +86,9 @@ function _generateDataByType(dataSource, type) {
|
|
|
115
86
|
}
|
|
116
87
|
|
|
117
88
|
function _generateSelectedItems(value, data) {
|
|
118
|
-
const selectedItems = new
|
|
119
|
-
|
|
120
|
-
const index =
|
|
89
|
+
const selectedItems = new Map();
|
|
90
|
+
value.forEach(val => {
|
|
91
|
+
const index = data.findIndex(option => option.value === val);
|
|
121
92
|
|
|
122
93
|
if (index !== -1) {
|
|
123
94
|
const option = data[index];
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
|
|
9
6
|
exports.strings = exports.numbers = exports.cssClasses = void 0;
|
|
10
7
|
|
|
11
8
|
var _constants = require("../base/constants");
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
7
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
8
|
-
|
|
9
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
4
|
value: true
|
|
11
5
|
});
|
|
12
|
-
|
|
13
6
|
exports.default = void 0;
|
|
14
7
|
|
|
15
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
16
|
-
|
|
17
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
18
|
-
|
|
19
|
-
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
20
|
-
|
|
21
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
22
|
-
|
|
23
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
24
|
-
|
|
25
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
26
|
-
|
|
27
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
|
28
|
-
|
|
29
|
-
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
30
|
-
|
|
31
|
-
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
|
32
|
-
|
|
33
|
-
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
|
34
|
-
|
|
35
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
36
|
-
|
|
37
8
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
38
9
|
|
|
39
10
|
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
@@ -48,9 +19,11 @@ var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
|
48
19
|
|
|
49
20
|
var _treeUtil = require("./treeUtil");
|
|
50
21
|
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
51
24
|
class TreeFoundation extends _foundation.default {
|
|
52
25
|
constructor(adapter) {
|
|
53
|
-
super(
|
|
26
|
+
super(Object.assign({}, adapter));
|
|
54
27
|
|
|
55
28
|
this.clearDragState = () => {
|
|
56
29
|
this._adapter.updateState({
|
|
@@ -97,10 +70,8 @@ class TreeFoundation extends _foundation.default {
|
|
|
97
70
|
}
|
|
98
71
|
|
|
99
72
|
getCopyFromState(items) {
|
|
100
|
-
var _context;
|
|
101
|
-
|
|
102
73
|
const res = {};
|
|
103
|
-
(0,
|
|
74
|
+
(0, _treeUtil.normalizedArr)(items).forEach(key => {
|
|
104
75
|
res[key] = (0, _cloneDeep2.default)(this.getState(key));
|
|
105
76
|
});
|
|
106
77
|
return res;
|
|
@@ -108,18 +79,18 @@ class TreeFoundation extends _foundation.default {
|
|
|
108
79
|
|
|
109
80
|
getTreeNodeProps(key) {
|
|
110
81
|
const {
|
|
111
|
-
expandedKeys = new
|
|
82
|
+
expandedKeys = new Set([]),
|
|
112
83
|
selectedKeys = [],
|
|
113
|
-
checkedKeys = new
|
|
114
|
-
halfCheckedKeys = new
|
|
115
|
-
realCheckedKeys = new
|
|
84
|
+
checkedKeys = new Set([]),
|
|
85
|
+
halfCheckedKeys = new Set([]),
|
|
86
|
+
realCheckedKeys = new Set([]),
|
|
116
87
|
keyEntities = {},
|
|
117
|
-
filteredKeys = new
|
|
88
|
+
filteredKeys = new Set([]),
|
|
118
89
|
inputValue = '',
|
|
119
|
-
loadedKeys = new
|
|
120
|
-
loadingKeys = new
|
|
121
|
-
filteredExpandedKeys = new
|
|
122
|
-
disabledKeys = new
|
|
90
|
+
loadedKeys = new Set([]),
|
|
91
|
+
loadingKeys = new Set([]),
|
|
92
|
+
filteredExpandedKeys = new Set([]),
|
|
93
|
+
disabledKeys = new Set([])
|
|
123
94
|
} = this.getStates();
|
|
124
95
|
const {
|
|
125
96
|
treeNodeFilterProp,
|
|
@@ -148,7 +119,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
148
119
|
const treeNodeProps = {
|
|
149
120
|
eventKey: key,
|
|
150
121
|
expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
151
|
-
selected:
|
|
122
|
+
selected: selectedKeys.includes(key),
|
|
152
123
|
checked: realChecked,
|
|
153
124
|
halfChecked: realHalfChecked,
|
|
154
125
|
pos: String(entity ? entity.pos : ''),
|
|
@@ -168,10 +139,8 @@ class TreeFoundation extends _foundation.default {
|
|
|
168
139
|
}
|
|
169
140
|
|
|
170
141
|
notifyJsonChange(key, e) {
|
|
171
|
-
var _context2;
|
|
172
|
-
|
|
173
142
|
const data = this.getProp('treeDataSimpleJson');
|
|
174
|
-
const selectedPath = (0,
|
|
143
|
+
const selectedPath = (0, _treeUtil.normalizedArr)(key).map(i => i.replace('-', '.'));
|
|
175
144
|
const value = (0, _pick2.default)(data, selectedPath);
|
|
176
145
|
|
|
177
146
|
this._adapter.notifyChange(value);
|
|
@@ -195,9 +164,9 @@ class TreeFoundation extends _foundation.default {
|
|
|
195
164
|
}
|
|
196
165
|
|
|
197
166
|
if (this.getProp('onChangeWithObject')) {
|
|
198
|
-
value =
|
|
167
|
+
value = keyList.map(itemKey => keyEntities[itemKey].data);
|
|
199
168
|
} else {
|
|
200
|
-
value = (0, _treeUtil.getValueOrKey)(
|
|
169
|
+
value = (0, _treeUtil.getValueOrKey)(keyList.map(itemKey => keyEntities[itemKey].data));
|
|
201
170
|
}
|
|
202
171
|
|
|
203
172
|
this._adapter.notifyChange(value);
|
|
@@ -248,20 +217,18 @@ class TreeFoundation extends _foundation.default {
|
|
|
248
217
|
let filteredOptsKeys = [];
|
|
249
218
|
let expandedOptsKeys = [];
|
|
250
219
|
let flattenNodes = [];
|
|
251
|
-
let filteredShownKeys = new
|
|
220
|
+
let filteredShownKeys = new Set([]);
|
|
252
221
|
|
|
253
222
|
if (!sugInput) {
|
|
254
223
|
expandedOptsKeys = (0, _treeUtil.findAncestorKeys)(selectedKeys, keyEntities);
|
|
255
|
-
|
|
224
|
+
expandedOptsKeys.forEach(item => expandedKeys.add(item));
|
|
256
225
|
flattenNodes = (0, _treeUtil.flattenTreeData)(treeData, expandedKeys);
|
|
257
226
|
} else {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
filteredOptsKeys = (0, _map.default)(_context3 = (0, _filter.default)(_context4 = (0, _values.default)(keyEntities)).call(_context4, item => (0, _filterInstanceProperty2(_treeUtil))(sugInput, item.data, filterTreeNode, treeNodeFilterProp))).call(_context3, item => item.key);
|
|
227
|
+
filteredOptsKeys = Object.values(keyEntities).filter(item => (0, _treeUtil.filter)(sugInput, item.data, filterTreeNode, treeNodeFilterProp)).map(item => item.key);
|
|
261
228
|
expandedOptsKeys = (0, _treeUtil.findAncestorKeys)(filteredOptsKeys, keyEntities, false);
|
|
262
229
|
const shownChildKeys = (0, _treeUtil.findDescendantKeys)(filteredOptsKeys, keyEntities, true);
|
|
263
|
-
filteredShownKeys = new
|
|
264
|
-
flattenNodes = (0, _treeUtil.flattenTreeData)(treeData, new
|
|
230
|
+
filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
231
|
+
flattenNodes = (0, _treeUtil.flattenTreeData)(treeData, new Set(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
|
|
265
232
|
}
|
|
266
233
|
|
|
267
234
|
this._adapter.notifySearch(sugInput);
|
|
@@ -269,9 +236,9 @@ class TreeFoundation extends _foundation.default {
|
|
|
269
236
|
this._adapter.updateState({
|
|
270
237
|
expandedKeys,
|
|
271
238
|
flattenNodes,
|
|
272
|
-
motionKeys: new
|
|
273
|
-
filteredKeys: new
|
|
274
|
-
filteredExpandedKeys: new
|
|
239
|
+
motionKeys: new Set([]),
|
|
240
|
+
filteredKeys: new Set(filteredOptsKeys),
|
|
241
|
+
filteredExpandedKeys: new Set(expandedOptsKeys),
|
|
275
242
|
filteredShownKeys
|
|
276
243
|
});
|
|
277
244
|
}
|
|
@@ -315,7 +282,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
315
282
|
return;
|
|
316
283
|
}
|
|
317
284
|
|
|
318
|
-
if (!
|
|
285
|
+
if (!selectedKeys.includes(eventKey)) {
|
|
319
286
|
selectedKeys = [eventKey];
|
|
320
287
|
this.notifyChange(eventKey, e);
|
|
321
288
|
|
|
@@ -355,15 +322,15 @@ class TreeFoundation extends _foundation.default {
|
|
|
355
322
|
disabledKeys
|
|
356
323
|
} = this.getStates();
|
|
357
324
|
const descendantKeys = (0, _treeUtil.normalizeKeyList)((0, _treeUtil.findDescendantKeys)([eventKey], keyEntities, false), keyEntities, true);
|
|
358
|
-
const hasDisabled =
|
|
325
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key)); // If the descendant nodes are not disabled, they will be directly changed to checked
|
|
359
326
|
|
|
360
327
|
if (!hasDisabled) {
|
|
361
328
|
return targetStatus;
|
|
362
329
|
} // If all descendant nodes that are not disabled are selected, return unchecked, otherwise, return checked
|
|
363
330
|
|
|
364
331
|
|
|
365
|
-
const nonDisabledKeys =
|
|
366
|
-
const allChecked =
|
|
332
|
+
const nonDisabledKeys = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
333
|
+
const allChecked = nonDisabledKeys.every(key => checkedKeys.has(key));
|
|
367
334
|
return !allChecked;
|
|
368
335
|
}
|
|
369
336
|
/*
|
|
@@ -380,13 +347,13 @@ class TreeFoundation extends _foundation.default {
|
|
|
380
347
|
checkedKeys
|
|
381
348
|
} = this.getCopyFromState(['checkedKeys']);
|
|
382
349
|
const descendantKeys = (0, _treeUtil.normalizeKeyList)((0, _treeUtil.findDescendantKeys)([eventKey], keyEntities, false), keyEntities, true);
|
|
383
|
-
const hasDisabled =
|
|
350
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key)); // If none of the descendant nodes are disabled, follow the normal logic
|
|
384
351
|
|
|
385
352
|
if (!hasDisabled) {
|
|
386
353
|
return this.calcCheckedKeys(eventKey, targetStatus);
|
|
387
354
|
}
|
|
388
355
|
|
|
389
|
-
const nonDisabled =
|
|
356
|
+
const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
390
357
|
const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : (0, _difference2.default)((0, _treeUtil.normalizeKeyList)([...checkedKeys], keyEntities, true), nonDisabled);
|
|
391
358
|
return (0, _treeUtil.calcCheckedKeys)(newCheckedKeys, keyEntities);
|
|
392
359
|
}
|
|
@@ -429,7 +396,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
429
396
|
});
|
|
430
397
|
}
|
|
431
398
|
} else if (checkRelation === 'unRelated') {
|
|
432
|
-
const newRealCheckedKeys = new
|
|
399
|
+
const newRealCheckedKeys = new Set(realCheckedKeys);
|
|
433
400
|
let targetStatus;
|
|
434
401
|
|
|
435
402
|
if (realCheckedKeys.has(eventKey)) {
|
|
@@ -487,7 +454,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
487
454
|
const newState = {
|
|
488
455
|
[expandedStateKey]: expandedKeys,
|
|
489
456
|
flattenNodes,
|
|
490
|
-
motionKeys: new
|
|
457
|
+
motionKeys: new Set(motionKeys),
|
|
491
458
|
motionType
|
|
492
459
|
};
|
|
493
460
|
|
|
@@ -543,7 +510,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
543
510
|
loadingKeys: prevLoadingKeys
|
|
544
511
|
} = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
|
|
545
512
|
const newLoadedKeys = prevLoadedKeys.add(key);
|
|
546
|
-
const newLoadingKeys = new
|
|
513
|
+
const newLoadingKeys = new Set([...prevLoadingKeys]);
|
|
547
514
|
newLoadingKeys.delete(key); // onLoad should be triggered before internal setState to avoid `loadData` being triggered twice
|
|
548
515
|
|
|
549
516
|
onLoad && onLoad(newLoadedKeys, data);
|
|
@@ -567,13 +534,13 @@ class TreeFoundation extends _foundation.default {
|
|
|
567
534
|
|
|
568
535
|
|
|
569
536
|
getDragEventNodeData(node) {
|
|
570
|
-
return
|
|
537
|
+
return Object.assign(Object.assign({}, node.data), (0, _pick2.default)(node, ['expanded', 'pos', 'children']));
|
|
571
538
|
}
|
|
572
539
|
|
|
573
540
|
triggerDragEvent(name, event, node) {
|
|
574
541
|
let extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
575
542
|
const callEvent = this.getProp(name);
|
|
576
|
-
callEvent && callEvent(
|
|
543
|
+
callEvent && callEvent(Object.assign({
|
|
577
544
|
event,
|
|
578
545
|
node: this.getDragEventNodeData(node)
|
|
579
546
|
}, extra));
|
|
@@ -611,7 +578,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
611
578
|
|
|
612
579
|
this._adapter.updateState({
|
|
613
580
|
dragging: true,
|
|
614
|
-
dragNodesKeys: new
|
|
581
|
+
dragNodesKeys: new Set((0, _treeUtil.getDragNodesKeys)(eventKey, keyEntities))
|
|
615
582
|
});
|
|
616
583
|
|
|
617
584
|
this.triggerDragEvent('onDragStart', e, treeNode);
|
|
@@ -647,9 +614,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
647
614
|
} // Trigger dragenter after clearing the prev state in dragleave
|
|
648
615
|
|
|
649
616
|
|
|
650
|
-
(
|
|
651
|
-
var _context5;
|
|
652
|
-
|
|
617
|
+
setTimeout(() => {
|
|
653
618
|
this._adapter.updateState({
|
|
654
619
|
dragOverNodeKey: eventKey,
|
|
655
620
|
dropPosition
|
|
@@ -666,10 +631,10 @@ class TreeFoundation extends _foundation.default {
|
|
|
666
631
|
this.delayedDragEnterLogic = {};
|
|
667
632
|
}
|
|
668
633
|
|
|
669
|
-
|
|
634
|
+
Object.keys(this.delayedDragEnterLogic).forEach(key => {
|
|
670
635
|
clearTimeout(this.delayedDragEnterLogic[key]);
|
|
671
636
|
});
|
|
672
|
-
this.delayedDragEnterLogic[pos] =
|
|
637
|
+
this.delayedDragEnterLogic[pos] = window.setTimeout(() => {
|
|
673
638
|
if (!dragging) {
|
|
674
639
|
return;
|
|
675
640
|
}
|