@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
|
@@ -3,22 +3,11 @@ import _cloneDeep from "lodash/cloneDeep";
|
|
|
3
3
|
import _pick from "lodash/pick";
|
|
4
4
|
import _difference from "lodash/difference";
|
|
5
5
|
import _isUndefined from "lodash/isUndefined";
|
|
6
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
7
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
8
|
-
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
9
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
10
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
11
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
12
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
13
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
14
|
-
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
15
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
16
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
17
6
|
import BaseFoundation from '../base/foundation';
|
|
18
7
|
import { flattenTreeData, findDescendantKeys, findAncestorKeys, filter, normalizedArr, normalizeKeyList, getMotionKeys, calcCheckedKeysForChecked, calcCheckedKeysForUnchecked, calcCheckedKeys, getValueOrKey, getDragNodesKeys, calcDropRelativePosition, calcDropActualPosition } from './treeUtil';
|
|
19
8
|
export default class TreeFoundation extends BaseFoundation {
|
|
20
9
|
constructor(adapter) {
|
|
21
|
-
super(
|
|
10
|
+
super(Object.assign({}, adapter));
|
|
22
11
|
|
|
23
12
|
this.clearDragState = () => {
|
|
24
13
|
this._adapter.updateState({
|
|
@@ -65,31 +54,27 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
65
54
|
}
|
|
66
55
|
|
|
67
56
|
getCopyFromState(items) {
|
|
68
|
-
var _context;
|
|
69
|
-
|
|
70
57
|
const res = {};
|
|
71
|
-
|
|
72
|
-
_forEachInstanceProperty(_context = normalizedArr(items)).call(_context, key => {
|
|
58
|
+
normalizedArr(items).forEach(key => {
|
|
73
59
|
res[key] = _cloneDeep(this.getState(key));
|
|
74
60
|
});
|
|
75
|
-
|
|
76
61
|
return res;
|
|
77
62
|
}
|
|
78
63
|
|
|
79
64
|
getTreeNodeProps(key) {
|
|
80
65
|
const {
|
|
81
|
-
expandedKeys = new
|
|
66
|
+
expandedKeys = new Set([]),
|
|
82
67
|
selectedKeys = [],
|
|
83
|
-
checkedKeys = new
|
|
84
|
-
halfCheckedKeys = new
|
|
85
|
-
realCheckedKeys = new
|
|
68
|
+
checkedKeys = new Set([]),
|
|
69
|
+
halfCheckedKeys = new Set([]),
|
|
70
|
+
realCheckedKeys = new Set([]),
|
|
86
71
|
keyEntities = {},
|
|
87
|
-
filteredKeys = new
|
|
72
|
+
filteredKeys = new Set([]),
|
|
88
73
|
inputValue = '',
|
|
89
|
-
loadedKeys = new
|
|
90
|
-
loadingKeys = new
|
|
91
|
-
filteredExpandedKeys = new
|
|
92
|
-
disabledKeys = new
|
|
74
|
+
loadedKeys = new Set([]),
|
|
75
|
+
loadingKeys = new Set([]),
|
|
76
|
+
filteredExpandedKeys = new Set([]),
|
|
77
|
+
disabledKeys = new Set([])
|
|
93
78
|
} = this.getStates();
|
|
94
79
|
const {
|
|
95
80
|
treeNodeFilterProp,
|
|
@@ -118,7 +103,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
118
103
|
const treeNodeProps = {
|
|
119
104
|
eventKey: key,
|
|
120
105
|
expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
121
|
-
selected:
|
|
106
|
+
selected: selectedKeys.includes(key),
|
|
122
107
|
checked: realChecked,
|
|
123
108
|
halfChecked: realHalfChecked,
|
|
124
109
|
pos: String(entity ? entity.pos : ''),
|
|
@@ -138,11 +123,8 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
138
123
|
}
|
|
139
124
|
|
|
140
125
|
notifyJsonChange(key, e) {
|
|
141
|
-
var _context2;
|
|
142
|
-
|
|
143
126
|
const data = this.getProp('treeDataSimpleJson');
|
|
144
|
-
|
|
145
|
-
const selectedPath = _mapInstanceProperty(_context2 = normalizedArr(key)).call(_context2, i => i.replace('-', '.'));
|
|
127
|
+
const selectedPath = normalizedArr(key).map(i => i.replace('-', '.'));
|
|
146
128
|
|
|
147
129
|
const value = _pick(data, selectedPath);
|
|
148
130
|
|
|
@@ -167,9 +149,9 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
167
149
|
}
|
|
168
150
|
|
|
169
151
|
if (this.getProp('onChangeWithObject')) {
|
|
170
|
-
value =
|
|
152
|
+
value = keyList.map(itemKey => keyEntities[itemKey].data);
|
|
171
153
|
} else {
|
|
172
|
-
value = getValueOrKey(
|
|
154
|
+
value = getValueOrKey(keyList.map(itemKey => keyEntities[itemKey].data));
|
|
173
155
|
}
|
|
174
156
|
|
|
175
157
|
this._adapter.notifyChange(value);
|
|
@@ -221,22 +203,18 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
221
203
|
let filteredOptsKeys = [];
|
|
222
204
|
let expandedOptsKeys = [];
|
|
223
205
|
let flattenNodes = [];
|
|
224
|
-
let filteredShownKeys = new
|
|
206
|
+
let filteredShownKeys = new Set([]);
|
|
225
207
|
|
|
226
208
|
if (!sugInput) {
|
|
227
209
|
expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
|
|
228
|
-
|
|
229
|
-
_forEachInstanceProperty(expandedOptsKeys).call(expandedOptsKeys, item => expandedKeys.add(item));
|
|
230
|
-
|
|
210
|
+
expandedOptsKeys.forEach(item => expandedKeys.add(item));
|
|
231
211
|
flattenNodes = flattenTreeData(treeData, expandedKeys);
|
|
232
212
|
} else {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
filteredOptsKeys = _mapInstanceProperty(_context3 = _filterInstanceProperty(_context4 = _Object$values(keyEntities)).call(_context4, item => filter(sugInput, item.data, filterTreeNode, treeNodeFilterProp))).call(_context3, item => item.key);
|
|
213
|
+
filteredOptsKeys = Object.values(keyEntities).filter(item => filter(sugInput, item.data, filterTreeNode, treeNodeFilterProp)).map(item => item.key);
|
|
236
214
|
expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
|
|
237
215
|
const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
|
|
238
|
-
filteredShownKeys = new
|
|
239
|
-
flattenNodes = flattenTreeData(treeData, new
|
|
216
|
+
filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
217
|
+
flattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
|
|
240
218
|
}
|
|
241
219
|
|
|
242
220
|
this._adapter.notifySearch(sugInput);
|
|
@@ -244,9 +222,9 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
244
222
|
this._adapter.updateState({
|
|
245
223
|
expandedKeys,
|
|
246
224
|
flattenNodes,
|
|
247
|
-
motionKeys: new
|
|
248
|
-
filteredKeys: new
|
|
249
|
-
filteredExpandedKeys: new
|
|
225
|
+
motionKeys: new Set([]),
|
|
226
|
+
filteredKeys: new Set(filteredOptsKeys),
|
|
227
|
+
filteredExpandedKeys: new Set(expandedOptsKeys),
|
|
250
228
|
filteredShownKeys
|
|
251
229
|
});
|
|
252
230
|
}
|
|
@@ -290,7 +268,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
290
268
|
return;
|
|
291
269
|
}
|
|
292
270
|
|
|
293
|
-
if (!
|
|
271
|
+
if (!selectedKeys.includes(eventKey)) {
|
|
294
272
|
selectedKeys = [eventKey];
|
|
295
273
|
this.notifyChange(eventKey, e);
|
|
296
274
|
|
|
@@ -330,19 +308,15 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
330
308
|
disabledKeys
|
|
331
309
|
} = this.getStates();
|
|
332
310
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
333
|
-
|
|
334
|
-
const hasDisabled = _someInstanceProperty(descendantKeys).call(descendantKeys, key => disabledKeys.has(key)); // If the descendant nodes are not disabled, they will be directly changed to checked
|
|
335
|
-
|
|
311
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key)); // If the descendant nodes are not disabled, they will be directly changed to checked
|
|
336
312
|
|
|
337
313
|
if (!hasDisabled) {
|
|
338
314
|
return targetStatus;
|
|
339
315
|
} // If all descendant nodes that are not disabled are selected, return unchecked, otherwise, return checked
|
|
340
316
|
|
|
341
317
|
|
|
342
|
-
const nonDisabledKeys =
|
|
343
|
-
|
|
344
|
-
const allChecked = _everyInstanceProperty(nonDisabledKeys).call(nonDisabledKeys, key => checkedKeys.has(key));
|
|
345
|
-
|
|
318
|
+
const nonDisabledKeys = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
319
|
+
const allChecked = nonDisabledKeys.every(key => checkedKeys.has(key));
|
|
346
320
|
return !allChecked;
|
|
347
321
|
}
|
|
348
322
|
/*
|
|
@@ -359,16 +333,13 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
359
333
|
checkedKeys
|
|
360
334
|
} = this.getCopyFromState(['checkedKeys']);
|
|
361
335
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
362
|
-
|
|
363
|
-
const hasDisabled = _someInstanceProperty(descendantKeys).call(descendantKeys, key => disabledKeys.has(key)); // If none of the descendant nodes are disabled, follow the normal logic
|
|
364
|
-
|
|
336
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key)); // If none of the descendant nodes are disabled, follow the normal logic
|
|
365
337
|
|
|
366
338
|
if (!hasDisabled) {
|
|
367
339
|
return this.calcCheckedKeys(eventKey, targetStatus);
|
|
368
340
|
}
|
|
369
341
|
|
|
370
|
-
const nonDisabled =
|
|
371
|
-
|
|
342
|
+
const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
372
343
|
const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : _difference(normalizeKeyList([...checkedKeys], keyEntities, true), nonDisabled);
|
|
373
344
|
return calcCheckedKeys(newCheckedKeys, keyEntities);
|
|
374
345
|
}
|
|
@@ -411,7 +382,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
411
382
|
});
|
|
412
383
|
}
|
|
413
384
|
} else if (checkRelation === 'unRelated') {
|
|
414
|
-
const newRealCheckedKeys = new
|
|
385
|
+
const newRealCheckedKeys = new Set(realCheckedKeys);
|
|
415
386
|
let targetStatus;
|
|
416
387
|
|
|
417
388
|
if (realCheckedKeys.has(eventKey)) {
|
|
@@ -469,7 +440,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
469
440
|
const newState = {
|
|
470
441
|
[expandedStateKey]: expandedKeys,
|
|
471
442
|
flattenNodes,
|
|
472
|
-
motionKeys: new
|
|
443
|
+
motionKeys: new Set(motionKeys),
|
|
473
444
|
motionType
|
|
474
445
|
};
|
|
475
446
|
|
|
@@ -525,7 +496,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
525
496
|
loadingKeys: prevLoadingKeys
|
|
526
497
|
} = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
|
|
527
498
|
const newLoadedKeys = prevLoadedKeys.add(key);
|
|
528
|
-
const newLoadingKeys = new
|
|
499
|
+
const newLoadingKeys = new Set([...prevLoadingKeys]);
|
|
529
500
|
newLoadingKeys.delete(key); // onLoad should be triggered before internal setState to avoid `loadData` being triggered twice
|
|
530
501
|
|
|
531
502
|
onLoad && onLoad(newLoadedKeys, data);
|
|
@@ -549,13 +520,13 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
549
520
|
|
|
550
521
|
|
|
551
522
|
getDragEventNodeData(node) {
|
|
552
|
-
return
|
|
523
|
+
return Object.assign(Object.assign({}, node.data), _pick(node, ['expanded', 'pos', 'children']));
|
|
553
524
|
}
|
|
554
525
|
|
|
555
526
|
triggerDragEvent(name, event, node) {
|
|
556
527
|
let extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
557
528
|
const callEvent = this.getProp(name);
|
|
558
|
-
callEvent && callEvent(
|
|
529
|
+
callEvent && callEvent(Object.assign({
|
|
559
530
|
event,
|
|
560
531
|
node: this.getDragEventNodeData(node)
|
|
561
532
|
}, extra));
|
|
@@ -593,7 +564,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
593
564
|
|
|
594
565
|
this._adapter.updateState({
|
|
595
566
|
dragging: true,
|
|
596
|
-
dragNodesKeys: new
|
|
567
|
+
dragNodesKeys: new Set(getDragNodesKeys(eventKey, keyEntities))
|
|
597
568
|
});
|
|
598
569
|
|
|
599
570
|
this.triggerDragEvent('onDragStart', e, treeNode);
|
|
@@ -629,9 +600,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
629
600
|
} // Trigger dragenter after clearing the prev state in dragleave
|
|
630
601
|
|
|
631
602
|
|
|
632
|
-
|
|
633
|
-
var _context5;
|
|
634
|
-
|
|
603
|
+
setTimeout(() => {
|
|
635
604
|
this._adapter.updateState({
|
|
636
605
|
dragOverNodeKey: eventKey,
|
|
637
606
|
dropPosition
|
|
@@ -648,11 +617,10 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
648
617
|
this.delayedDragEnterLogic = {};
|
|
649
618
|
}
|
|
650
619
|
|
|
651
|
-
|
|
620
|
+
Object.keys(this.delayedDragEnterLogic).forEach(key => {
|
|
652
621
|
clearTimeout(this.delayedDragEnterLogic[key]);
|
|
653
622
|
});
|
|
654
|
-
|
|
655
|
-
this.delayedDragEnterLogic[pos] = _setTimeout(() => {
|
|
623
|
+
this.delayedDragEnterLogic[pos] = window.setTimeout(() => {
|
|
656
624
|
if (!dragging) {
|
|
657
625
|
return;
|
|
658
626
|
}
|