@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
|
@@ -6,17 +6,6 @@ import _isUndefined from "lodash/isUndefined";
|
|
|
6
6
|
import _get from "lodash/get";
|
|
7
7
|
import _isFunction from "lodash/isFunction";
|
|
8
8
|
import _isNumber from "lodash/isNumber";
|
|
9
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
10
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
11
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
12
|
-
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
13
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
14
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
15
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
16
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
17
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
18
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
19
|
-
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
20
9
|
import { strings } from '../treeSelect/constants';
|
|
21
10
|
import BaseFoundation from '../base/foundation';
|
|
22
11
|
import { flattenTreeData, findDescendantKeys, findAncestorKeys, filter, normalizedArr, normalizeKeyList, getMotionKeys, calcCheckedKeysForChecked, calcCheckedKeys, calcCheckedKeysForUnchecked, getValueOrKey } from '../tree/treeUtil';
|
|
@@ -24,7 +13,7 @@ import isEnterPress from '../utils/isEnterPress'; // eslint-disable-next-line ma
|
|
|
24
13
|
|
|
25
14
|
export default class TreeSelectFoundation extends BaseFoundation {
|
|
26
15
|
constructor(adapter) {
|
|
27
|
-
super(
|
|
16
|
+
super(Object.assign({}, adapter));
|
|
28
17
|
}
|
|
29
18
|
|
|
30
19
|
init() {
|
|
@@ -58,11 +47,9 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
58
47
|
let width;
|
|
59
48
|
|
|
60
49
|
if (dropdownMatchSelectWidth) {
|
|
61
|
-
var _context;
|
|
62
|
-
|
|
63
50
|
if (style && _isNumber(style.width)) {
|
|
64
51
|
width = style.width;
|
|
65
|
-
} else if (style && _isString(style.width) && !
|
|
52
|
+
} else if (style && _isString(style.width) && !style.width.includes('%')) {
|
|
66
53
|
width = style.width;
|
|
67
54
|
} else {
|
|
68
55
|
width = this._adapter.getTriggerWidth();
|
|
@@ -108,31 +95,27 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
108
95
|
}
|
|
109
96
|
|
|
110
97
|
getCopyFromState(items) {
|
|
111
|
-
var _context2;
|
|
112
|
-
|
|
113
98
|
const res = {};
|
|
114
|
-
|
|
115
|
-
_forEachInstanceProperty(_context2 = normalizedArr(items)).call(_context2, key => {
|
|
99
|
+
normalizedArr(items).forEach(key => {
|
|
116
100
|
res[key] = _cloneDeep(this.getState(key));
|
|
117
101
|
});
|
|
118
|
-
|
|
119
102
|
return res;
|
|
120
103
|
}
|
|
121
104
|
|
|
122
105
|
getTreeNodeProps(key) {
|
|
123
106
|
const {
|
|
124
|
-
expandedKeys = new
|
|
107
|
+
expandedKeys = new Set([]),
|
|
125
108
|
selectedKeys = [],
|
|
126
|
-
checkedKeys = new
|
|
127
|
-
halfCheckedKeys = new
|
|
128
|
-
realCheckedKeys = new
|
|
109
|
+
checkedKeys = new Set([]),
|
|
110
|
+
halfCheckedKeys = new Set([]),
|
|
111
|
+
realCheckedKeys = new Set([]),
|
|
129
112
|
keyEntities = {},
|
|
130
|
-
filteredKeys = new
|
|
113
|
+
filteredKeys = new Set([]),
|
|
131
114
|
inputValue = '',
|
|
132
115
|
loadedKeys,
|
|
133
116
|
loadingKeys,
|
|
134
|
-
filteredExpandedKeys = new
|
|
135
|
-
disabledKeys = new
|
|
117
|
+
filteredExpandedKeys = new Set([]),
|
|
118
|
+
disabledKeys = new Set([])
|
|
136
119
|
} = this.getStates();
|
|
137
120
|
const {
|
|
138
121
|
treeNodeFilterProp,
|
|
@@ -161,7 +144,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
161
144
|
const treeNodeProps = {
|
|
162
145
|
eventKey: key,
|
|
163
146
|
expanded: isSearching && !this._isExpandControlled() ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
164
|
-
selected:
|
|
147
|
+
selected: selectedKeys.includes(key),
|
|
165
148
|
checked: realChecked,
|
|
166
149
|
halfChecked: realHalfChecked,
|
|
167
150
|
pos: String(entity ? entity.pos : ''),
|
|
@@ -198,7 +181,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
198
181
|
loadingKeys: prevLoadingKeys
|
|
199
182
|
} = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
|
|
200
183
|
const newLoadedKeys = prevLoadedKeys.add(key);
|
|
201
|
-
const newLoadingKeys = new
|
|
184
|
+
const newLoadingKeys = new Set([...prevLoadingKeys]);
|
|
202
185
|
newLoadingKeys.delete(key);
|
|
203
186
|
|
|
204
187
|
this._adapter.notifyLoad(newLoadedKeys, data);
|
|
@@ -242,7 +225,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
242
225
|
keyList = key;
|
|
243
226
|
}
|
|
244
227
|
|
|
245
|
-
const nodes =
|
|
228
|
+
const nodes = keyList.map(i => keyEntities[i].data);
|
|
246
229
|
|
|
247
230
|
if (this.getProp('onChangeWithObject')) {
|
|
248
231
|
this._adapter.notifyChangeWithObject(nodes, e);
|
|
@@ -258,7 +241,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
258
241
|
keyEntities
|
|
259
242
|
} = this.getStates();
|
|
260
243
|
|
|
261
|
-
if (this._isMultiple() &&
|
|
244
|
+
if (this._isMultiple() && Array.isArray(key)) {
|
|
262
245
|
this._notifyMultipleChange(key, e);
|
|
263
246
|
} else {
|
|
264
247
|
const nodes = _isUndefined(key) ? key : keyEntities[key].data;
|
|
@@ -309,7 +292,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
309
292
|
|
|
310
293
|
if (this.getProp('motionExpand')) {
|
|
311
294
|
this._adapter.updateState({
|
|
312
|
-
motionKeys: new
|
|
295
|
+
motionKeys: new Set([])
|
|
313
296
|
});
|
|
314
297
|
}
|
|
315
298
|
}
|
|
@@ -376,9 +359,9 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
376
359
|
|
|
377
360
|
this._adapter.updateState({
|
|
378
361
|
selectedKeys: [],
|
|
379
|
-
checkedKeys: new
|
|
380
|
-
halfCheckedKeys: new
|
|
381
|
-
realCheckedKeys: new
|
|
362
|
+
checkedKeys: new Set(),
|
|
363
|
+
halfCheckedKeys: new Set(),
|
|
364
|
+
realCheckedKeys: new Set([])
|
|
382
365
|
});
|
|
383
366
|
} // When triggerSearch, clicking the clear button will trigger to clear Input
|
|
384
367
|
|
|
@@ -423,7 +406,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
423
406
|
}
|
|
424
407
|
|
|
425
408
|
if (checkRelation === 'unRelated') {
|
|
426
|
-
const newRealCheckedKeys = new
|
|
409
|
+
const newRealCheckedKeys = new Set(realCheckedKeys);
|
|
427
410
|
newRealCheckedKeys.delete(eventKey);
|
|
428
411
|
|
|
429
412
|
this._notifyChange([...newRealCheckedKeys], null);
|
|
@@ -467,24 +450,22 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
467
450
|
keyEntities,
|
|
468
451
|
treeData
|
|
469
452
|
} = this.getStates();
|
|
470
|
-
const newExpandedKeys = new
|
|
453
|
+
const newExpandedKeys = new Set(expandedKeys);
|
|
471
454
|
|
|
472
455
|
const isExpandControlled = this._isExpandControlled();
|
|
473
456
|
|
|
474
457
|
const expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
|
|
475
|
-
|
|
476
|
-
_forEachInstanceProperty(expandedOptsKeys).call(expandedOptsKeys, item => newExpandedKeys.add(item));
|
|
477
|
-
|
|
458
|
+
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
478
459
|
const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys);
|
|
479
460
|
|
|
480
461
|
this._adapter.updateState({
|
|
481
462
|
expandedKeys: isExpandControlled ? expandedKeys : newExpandedKeys,
|
|
482
463
|
flattenNodes: isExpandControlled ? flattenNodes : newFlattenNodes,
|
|
483
464
|
inputValue: '',
|
|
484
|
-
motionKeys: new
|
|
485
|
-
filteredKeys: new
|
|
486
|
-
filteredExpandedKeys: new
|
|
487
|
-
filteredShownKeys: new
|
|
465
|
+
motionKeys: new Set([]),
|
|
466
|
+
filteredKeys: new Set([]),
|
|
467
|
+
filteredExpandedKeys: new Set(expandedOptsKeys),
|
|
468
|
+
filteredShownKeys: new Set([])
|
|
488
469
|
});
|
|
489
470
|
}
|
|
490
471
|
|
|
@@ -504,42 +485,38 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
504
485
|
filterTreeNode,
|
|
505
486
|
treeNodeFilterProp
|
|
506
487
|
} = this.getProps();
|
|
507
|
-
const newExpandedKeys = new
|
|
488
|
+
const newExpandedKeys = new Set(expandedKeys);
|
|
508
489
|
let filteredOptsKeys = [];
|
|
509
490
|
let expandedOptsKeys = [];
|
|
510
491
|
let newFlattenNodes = [];
|
|
511
|
-
let filteredShownKeys = new
|
|
492
|
+
let filteredShownKeys = new Set([]);
|
|
512
493
|
|
|
513
494
|
if (!sugInput) {
|
|
514
495
|
expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
|
|
515
|
-
|
|
516
|
-
_forEachInstanceProperty(expandedOptsKeys).call(expandedOptsKeys, item => newExpandedKeys.add(item));
|
|
517
|
-
|
|
496
|
+
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
518
497
|
newFlattenNodes = flattenTreeData(treeData, newExpandedKeys);
|
|
519
498
|
} else {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
filteredOptsKeys = _mapInstanceProperty(_context3 = _filterInstanceProperty(_context4 = _Object$values(keyEntities)).call(_context4, item => {
|
|
499
|
+
filteredOptsKeys = Object.values(keyEntities).filter(item => {
|
|
523
500
|
const {
|
|
524
501
|
data
|
|
525
502
|
} = item;
|
|
526
503
|
return filter(sugInput, data, filterTreeNode, treeNodeFilterProp);
|
|
527
|
-
})
|
|
504
|
+
}).map(item => item.key);
|
|
528
505
|
expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
|
|
529
506
|
const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
|
|
530
|
-
filteredShownKeys = new
|
|
531
|
-
newFlattenNodes = flattenTreeData(treeData, new
|
|
507
|
+
filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
508
|
+
newFlattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
|
|
532
509
|
}
|
|
533
510
|
|
|
534
|
-
const newFilteredExpandedKeys = new
|
|
511
|
+
const newFilteredExpandedKeys = new Set(expandedOptsKeys);
|
|
535
512
|
|
|
536
|
-
this._adapter.notifySearch(sugInput,
|
|
513
|
+
this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
|
|
537
514
|
|
|
538
515
|
this._adapter.updateState({
|
|
539
516
|
expandedKeys: this._isExpandControlled() ? expandedKeys : newExpandedKeys,
|
|
540
517
|
flattenNodes: this._isExpandControlled() ? flattenNodes : newFlattenNodes,
|
|
541
|
-
motionKeys: new
|
|
542
|
-
filteredKeys: new
|
|
518
|
+
motionKeys: new Set([]),
|
|
519
|
+
filteredKeys: new Set(filteredOptsKeys),
|
|
543
520
|
filteredExpandedKeys: newFilteredExpandedKeys,
|
|
544
521
|
filteredShownKeys
|
|
545
522
|
});
|
|
@@ -574,7 +551,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
574
551
|
|
|
575
552
|
this._adapter.notifySelect(eventKey, true, data);
|
|
576
553
|
|
|
577
|
-
if (!
|
|
554
|
+
if (!selectedKeys.includes(eventKey) && !selected) {
|
|
578
555
|
selectedKeys = [eventKey];
|
|
579
556
|
|
|
580
557
|
this._notifyChange(eventKey, e);
|
|
@@ -643,7 +620,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
643
620
|
this._adapter.rePositionDropdown();
|
|
644
621
|
}
|
|
645
622
|
} else if (checkRelation === 'unRelated') {
|
|
646
|
-
const newRealCheckedKeys = new
|
|
623
|
+
const newRealCheckedKeys = new Set(realCheckedKeys);
|
|
647
624
|
let targetStatus;
|
|
648
625
|
|
|
649
626
|
if (realCheckedKeys.has(eventKey)) {
|
|
@@ -683,15 +660,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
683
660
|
checkedKeys
|
|
684
661
|
} = this.getCopyFromState(['checkedKeys']);
|
|
685
662
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
686
|
-
|
|
687
|
-
const hasDisabled = _someInstanceProperty(descendantKeys).call(descendantKeys, key => disabledKeys.has(key));
|
|
663
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
688
664
|
|
|
689
665
|
if (!hasDisabled) {
|
|
690
666
|
return this.calcCheckedKeys(eventKey, targetStatus);
|
|
691
667
|
}
|
|
692
668
|
|
|
693
|
-
const nonDisabled =
|
|
694
|
-
|
|
669
|
+
const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
695
670
|
const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : _difference(normalizeKeyList([...checkedKeys], keyEntities, true), nonDisabled);
|
|
696
671
|
return calcCheckedKeys(newCheckedKeys, keyEntities);
|
|
697
672
|
}
|
|
@@ -707,17 +682,14 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
707
682
|
disabledKeys
|
|
708
683
|
} = this.getStates();
|
|
709
684
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
710
|
-
|
|
711
|
-
const hasDisabled = _someInstanceProperty(descendantKeys).call(descendantKeys, key => disabledKeys.has(key));
|
|
685
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
712
686
|
|
|
713
687
|
if (!hasDisabled) {
|
|
714
688
|
return targetStatus;
|
|
715
689
|
}
|
|
716
690
|
|
|
717
|
-
const nonDisabledKeys =
|
|
718
|
-
|
|
719
|
-
const allChecked = _everyInstanceProperty(nonDisabledKeys).call(nonDisabledKeys, key => checkedKeys.has(key));
|
|
720
|
-
|
|
691
|
+
const nonDisabledKeys = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
692
|
+
const allChecked = nonDisabledKeys.every(key => checkedKeys.has(key));
|
|
721
693
|
return !allChecked;
|
|
722
694
|
}
|
|
723
695
|
|
|
@@ -758,7 +730,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
758
730
|
const newState = {
|
|
759
731
|
filteredExpandedKeys,
|
|
760
732
|
flattenNodes,
|
|
761
|
-
motionKeys: new
|
|
733
|
+
motionKeys: new Set(motionKeys),
|
|
762
734
|
motionType
|
|
763
735
|
};
|
|
764
736
|
|
|
@@ -823,7 +795,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
823
795
|
const newState = {
|
|
824
796
|
expandedKeys,
|
|
825
797
|
flattenNodes,
|
|
826
|
-
motionKeys: new
|
|
798
|
+
motionKeys: new Set(motionKeys),
|
|
827
799
|
motionType
|
|
828
800
|
};
|
|
829
801
|
|