@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
package/lib/cjs/tree/treeUtil.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
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.calcCheckedKeys = calcCheckedKeys;
|
|
12
7
|
exports.calcCheckedKeysForChecked = calcCheckedKeysForChecked;
|
|
13
8
|
exports.calcCheckedKeysForUnchecked = calcCheckedKeysForUnchecked;
|
|
@@ -37,32 +32,6 @@ exports.normalizedArr = normalizedArr;
|
|
|
37
32
|
exports.traverseDataNodes = traverseDataNodes;
|
|
38
33
|
exports.updateKeys = updateKeys;
|
|
39
34
|
|
|
40
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
41
|
-
|
|
42
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
43
|
-
|
|
44
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
45
|
-
|
|
46
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
47
|
-
|
|
48
|
-
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
49
|
-
|
|
50
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
51
|
-
|
|
52
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
53
|
-
|
|
54
|
-
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
55
|
-
|
|
56
|
-
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
|
57
|
-
|
|
58
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
59
|
-
|
|
60
|
-
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
61
|
-
|
|
62
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
63
|
-
|
|
64
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
|
65
|
-
|
|
66
35
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
67
36
|
|
|
68
37
|
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
@@ -81,12 +50,12 @@ var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
|
|
|
81
50
|
|
|
82
51
|
var _difference2 = _interopRequireDefault(require("lodash/difference"));
|
|
83
52
|
|
|
53
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
54
|
+
|
|
84
55
|
const DRAG_OFFSET = 0.45;
|
|
85
56
|
|
|
86
57
|
function getPosition(level, index) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return (0, _concat.default)(_context = "".concat(level, "-")).call(_context, index);
|
|
58
|
+
return "".concat(level, "-").concat(index);
|
|
90
59
|
}
|
|
91
60
|
|
|
92
61
|
function isValid(val) {
|
|
@@ -109,11 +78,11 @@ function flattenTreeData(treeNodeList, expandedKeys) {
|
|
|
109
78
|
|
|
110
79
|
function flatten(list) {
|
|
111
80
|
let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
112
|
-
return
|
|
81
|
+
return list.map((treeNode, index) => {
|
|
113
82
|
const pos = getPosition(parent ? parent.pos : '0', index);
|
|
114
83
|
const mergedKey = treeNode.key; // Add FlattenDataNode into list
|
|
115
84
|
|
|
116
|
-
const flattenNode =
|
|
85
|
+
const flattenNode = Object.assign(Object.assign({}, (0, _pick2.default)(treeNode, ['key', 'label', 'value', 'icon', 'disabled', 'isLeaf'])), {
|
|
117
86
|
parent,
|
|
118
87
|
pos,
|
|
119
88
|
children: null,
|
|
@@ -143,8 +112,6 @@ function flattenTreeData(treeNodeList, expandedKeys) {
|
|
|
143
112
|
}
|
|
144
113
|
|
|
145
114
|
function convertJsonToData(treeJson) {
|
|
146
|
-
var _context3;
|
|
147
|
-
|
|
148
115
|
const treeData = [];
|
|
149
116
|
|
|
150
117
|
const traverseNode = (key, children, path, res) => {
|
|
@@ -157,10 +124,8 @@ function convertJsonToData(treeJson) {
|
|
|
157
124
|
};
|
|
158
125
|
|
|
159
126
|
if ((0, _isObject2.default)(children)) {
|
|
160
|
-
var _context2;
|
|
161
|
-
|
|
162
127
|
const newChildren = [];
|
|
163
|
-
|
|
128
|
+
Object.entries(children).forEach(c => {
|
|
164
129
|
traverseNode(c[0], c[1], currPath, newChildren);
|
|
165
130
|
});
|
|
166
131
|
newNode.children = newChildren;
|
|
@@ -169,7 +134,7 @@ function convertJsonToData(treeJson) {
|
|
|
169
134
|
res.push(newNode);
|
|
170
135
|
};
|
|
171
136
|
|
|
172
|
-
|
|
137
|
+
Object.entries(treeJson).forEach(item => traverseNode(item[0], item[1], [], treeData));
|
|
173
138
|
return treeData;
|
|
174
139
|
}
|
|
175
140
|
/**
|
|
@@ -184,7 +149,7 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
184
149
|
|
|
185
150
|
if (node) {
|
|
186
151
|
const data = {
|
|
187
|
-
data:
|
|
152
|
+
data: Object.assign({}, node),
|
|
188
153
|
ind,
|
|
189
154
|
pos,
|
|
190
155
|
key: node.key !== null ? node.key : pos,
|
|
@@ -196,7 +161,7 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
196
161
|
|
|
197
162
|
|
|
198
163
|
if (children) {
|
|
199
|
-
|
|
164
|
+
children.forEach((subNode, subIndex) => {
|
|
200
165
|
processNode(subNode, subIndex, {
|
|
201
166
|
node,
|
|
202
167
|
pos,
|
|
@@ -226,7 +191,7 @@ function convertDataToEntities(dataNodes) {
|
|
|
226
191
|
key,
|
|
227
192
|
parentPos
|
|
228
193
|
} = data;
|
|
229
|
-
const entity =
|
|
194
|
+
const entity = Object.assign({}, data);
|
|
230
195
|
const value = (0, _get2.default)(entity, 'data.value', null);
|
|
231
196
|
|
|
232
197
|
if (value !== null) {
|
|
@@ -255,9 +220,9 @@ function findKeysForValues(valueList, valueEntities) {
|
|
|
255
220
|
return [];
|
|
256
221
|
}
|
|
257
222
|
|
|
258
|
-
if (!isMultiple &&
|
|
223
|
+
if (!isMultiple && Array.isArray(valueList)) {
|
|
259
224
|
valueList = valueList.length ? [valueList[0]] : [];
|
|
260
|
-
} else if (!
|
|
225
|
+
} else if (!Array.isArray(valueList)) {
|
|
261
226
|
valueList = [valueList];
|
|
262
227
|
}
|
|
263
228
|
|
|
@@ -266,7 +231,7 @@ function findKeysForValues(valueList, valueEntities) {
|
|
|
266
231
|
}
|
|
267
232
|
|
|
268
233
|
const res = [];
|
|
269
|
-
|
|
234
|
+
valueList.forEach(val => {
|
|
270
235
|
if (val in valueEntities) {
|
|
271
236
|
res.push(valueEntities[val]);
|
|
272
237
|
}
|
|
@@ -289,14 +254,14 @@ function findDescendantKeys(selectedKeys, options) {
|
|
|
289
254
|
const hasChildren = isValid(children);
|
|
290
255
|
|
|
291
256
|
if (hasChildren) {
|
|
292
|
-
|
|
257
|
+
children.forEach(child => {
|
|
293
258
|
res.push(child.key);
|
|
294
259
|
findChild(options[child.key]);
|
|
295
260
|
});
|
|
296
261
|
}
|
|
297
262
|
};
|
|
298
263
|
|
|
299
|
-
|
|
264
|
+
selectedKeys.forEach(item => {
|
|
300
265
|
if (self) {
|
|
301
266
|
res.push(item);
|
|
302
267
|
}
|
|
@@ -309,12 +274,10 @@ function findDescendantKeys(selectedKeys, options) {
|
|
|
309
274
|
function findChildKeys(keys, options) {
|
|
310
275
|
let omitKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
311
276
|
const res = [];
|
|
312
|
-
keys &&
|
|
313
|
-
var _context4;
|
|
314
|
-
|
|
277
|
+
keys && keys.forEach(key => {
|
|
315
278
|
const opts = options[key];
|
|
316
|
-
opts && opts.children &&
|
|
317
|
-
if (!omitKeys.length || !
|
|
279
|
+
opts && opts.children && opts.children.forEach(child => {
|
|
280
|
+
if (!omitKeys.length || !omitKeys.includes(child.key)) {
|
|
318
281
|
res.push(child.key);
|
|
319
282
|
}
|
|
320
283
|
});
|
|
@@ -340,13 +303,13 @@ function findLeafKeys(keys, options) {
|
|
|
340
303
|
if (isLeaf) {
|
|
341
304
|
res.push(item.key);
|
|
342
305
|
} else {
|
|
343
|
-
|
|
306
|
+
children.forEach(child => {
|
|
344
307
|
findChild(options[child.key]);
|
|
345
308
|
});
|
|
346
309
|
}
|
|
347
310
|
};
|
|
348
311
|
|
|
349
|
-
|
|
312
|
+
keys.forEach(item => {
|
|
350
313
|
findChild(options[item]);
|
|
351
314
|
});
|
|
352
315
|
return res;
|
|
@@ -355,7 +318,7 @@ function findLeafKeys(keys, options) {
|
|
|
355
318
|
function findSiblingKeys(selectedKeys, options) {
|
|
356
319
|
let self = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
357
320
|
const par = [];
|
|
358
|
-
|
|
321
|
+
selectedKeys.forEach(item => {
|
|
359
322
|
if (options[item] && options[item].parent) {
|
|
360
323
|
par.push(options[item].parent.key);
|
|
361
324
|
}
|
|
@@ -375,7 +338,7 @@ function findAncestorKeys(selectedKeys, options) {
|
|
|
375
338
|
}
|
|
376
339
|
};
|
|
377
340
|
|
|
378
|
-
|
|
341
|
+
selectedKeys.forEach(item => {
|
|
379
342
|
options[item] && findPar(options[item]);
|
|
380
343
|
|
|
381
344
|
if (self) {
|
|
@@ -387,7 +350,7 @@ function findAncestorKeys(selectedKeys, options) {
|
|
|
387
350
|
|
|
388
351
|
function getSortedKeyList(keyList, keyEntities) {
|
|
389
352
|
const levelMap = {};
|
|
390
|
-
|
|
353
|
+
keyList.forEach(key => {
|
|
391
354
|
if (!keyEntities[key]) {
|
|
392
355
|
return;
|
|
393
356
|
}
|
|
@@ -406,7 +369,7 @@ function getSortedKeyList(keyList, keyEntities) {
|
|
|
406
369
|
}
|
|
407
370
|
|
|
408
371
|
function calcCheckedKeys(values, keyEntities) {
|
|
409
|
-
const keyList =
|
|
372
|
+
const keyList = Array.isArray(values) ? values : [values];
|
|
410
373
|
const descendantKeys = findDescendantKeys(keyList, keyEntities, true);
|
|
411
374
|
/**
|
|
412
375
|
* Recursively find the parent element. Because the incoming nodes are all checked,
|
|
@@ -414,8 +377,8 @@ function calcCheckedKeys(values, keyEntities) {
|
|
|
414
377
|
* disabled+unchecked nodes, their ancestor nodes will definitely not be checked
|
|
415
378
|
*/
|
|
416
379
|
|
|
417
|
-
const checkedKeys = new
|
|
418
|
-
let halfCheckedKeys = new
|
|
380
|
+
const checkedKeys = new Set([...descendantKeys]);
|
|
381
|
+
let halfCheckedKeys = new Set([]);
|
|
419
382
|
let visited = [];
|
|
420
383
|
const levelMap = getSortedKeyList(keyList, keyEntities);
|
|
421
384
|
|
|
@@ -426,18 +389,18 @@ function calcCheckedKeys(values, keyEntities) {
|
|
|
426
389
|
level
|
|
427
390
|
} = node; // If the node does not have a parent node, or the node has been processed just now, no processing is done
|
|
428
391
|
|
|
429
|
-
if (!parent ||
|
|
392
|
+
if (!parent || visited.includes(key)) {
|
|
430
393
|
return;
|
|
431
394
|
}
|
|
432
395
|
|
|
433
396
|
const siblingKeys = findSiblingKeys([key], keyEntities); // visited for caching to avoid double counting
|
|
434
397
|
|
|
435
398
|
visited = [...visited, ...siblingKeys];
|
|
436
|
-
const allChecked =
|
|
399
|
+
const allChecked = siblingKeys.every(siblingKey => checkedKeys.has(siblingKey));
|
|
437
400
|
|
|
438
401
|
if (!allChecked) {
|
|
439
402
|
const ancestorKeys = findAncestorKeys([key], keyEntities, false);
|
|
440
|
-
halfCheckedKeys = new
|
|
403
|
+
halfCheckedKeys = new Set([...halfCheckedKeys, ...ancestorKeys]);
|
|
441
404
|
} else {
|
|
442
405
|
checkedKeys.add(parent.key); // IMPORTANT! parent level may not exist in original level map; if add to the end directly may destroy the hierarchical order
|
|
443
406
|
|
|
@@ -451,10 +414,8 @@ function calcCheckedKeys(values, keyEntities) {
|
|
|
451
414
|
|
|
452
415
|
|
|
453
416
|
while (!(0, _isEmpty2.default)(levelMap)) {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const maxLevel = (0, _max2.default)((0, _map.default)(_context5 = (0, _keys.default)(levelMap)).call(_context5, key => Number(key)));
|
|
457
|
-
(0, _forEach.default)(_context6 = levelMap[maxLevel]).call(_context6, key => calcCurrLevel(keyEntities[key]));
|
|
417
|
+
const maxLevel = (0, _max2.default)(Object.keys(levelMap).map(key => Number(key)));
|
|
418
|
+
levelMap[maxLevel].forEach(key => calcCurrLevel(keyEntities[key]));
|
|
458
419
|
delete levelMap[maxLevel];
|
|
459
420
|
}
|
|
460
421
|
|
|
@@ -471,16 +432,16 @@ function calcExpandedKeys() {
|
|
|
471
432
|
let keyEntities = arguments.length > 1 ? arguments[1] : undefined;
|
|
472
433
|
let autoExpandParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
473
434
|
|
|
474
|
-
if (!
|
|
435
|
+
if (!Array.isArray(keyList)) {
|
|
475
436
|
keyList = [keyList];
|
|
476
437
|
}
|
|
477
438
|
|
|
478
439
|
if (autoExpandParent) {
|
|
479
440
|
const ancestorKeys = findAncestorKeys(keyList, keyEntities, true);
|
|
480
|
-
return new
|
|
441
|
+
return new Set(ancestorKeys);
|
|
481
442
|
}
|
|
482
443
|
|
|
483
|
-
return new
|
|
444
|
+
return new Set(keyList);
|
|
484
445
|
}
|
|
485
446
|
/* Calculate the expanded node by value */
|
|
486
447
|
// eslint-disable-next-line max-len
|
|
@@ -488,7 +449,7 @@ function calcExpandedKeys() {
|
|
|
488
449
|
|
|
489
450
|
function calcExpandedKeysForValues(value, keyEntities, isMultiple, valueEntities) {
|
|
490
451
|
const keys = findKeysForValues(value, valueEntities, isMultiple);
|
|
491
|
-
return new
|
|
452
|
+
return new Set(findAncestorKeys(keys, keyEntities, false));
|
|
492
453
|
}
|
|
493
454
|
|
|
494
455
|
function calcMotionKeys(oldKeySet, newKeySet, keyEntities) {
|
|
@@ -533,10 +494,8 @@ function filter(sugInput, option, filterTreeNode, filterProps) {
|
|
|
533
494
|
|
|
534
495
|
if (typeof filterTreeNode === 'boolean') {
|
|
535
496
|
filterFn = (targetVal, val) => {
|
|
536
|
-
var _context7;
|
|
537
|
-
|
|
538
497
|
const input = targetVal.toLowerCase();
|
|
539
|
-
return
|
|
498
|
+
return val.toString().toLowerCase().includes(input);
|
|
540
499
|
};
|
|
541
500
|
}
|
|
542
501
|
|
|
@@ -548,7 +507,7 @@ function filter(sugInput, option, filterTreeNode, filterProps) {
|
|
|
548
507
|
}
|
|
549
508
|
|
|
550
509
|
function normalizedArr(val) {
|
|
551
|
-
if (!
|
|
510
|
+
if (!Array.isArray(val)) {
|
|
552
511
|
return [val];
|
|
553
512
|
} else {
|
|
554
513
|
return val;
|
|
@@ -558,10 +517,10 @@ function normalizedArr(val) {
|
|
|
558
517
|
function normalizeKeyList(keyList, keyEntities) {
|
|
559
518
|
let leafOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
560
519
|
const res = [];
|
|
561
|
-
const keyListSet = new
|
|
520
|
+
const keyListSet = new Set(keyList);
|
|
562
521
|
|
|
563
522
|
if (!leafOnly) {
|
|
564
|
-
|
|
523
|
+
keyList.forEach(key => {
|
|
565
524
|
if (!keyEntities[key]) {
|
|
566
525
|
return;
|
|
567
526
|
}
|
|
@@ -577,7 +536,7 @@ function normalizeKeyList(keyList, keyEntities) {
|
|
|
577
536
|
res.push(key);
|
|
578
537
|
});
|
|
579
538
|
} else {
|
|
580
|
-
|
|
539
|
+
keyList.forEach(key => {
|
|
581
540
|
if (keyEntities[key] && !isValid(keyEntities[key].children)) {
|
|
582
541
|
res.push(key);
|
|
583
542
|
}
|
|
@@ -591,9 +550,7 @@ function getMotionKeys(eventKey, expandedKeys, keyEntities) {
|
|
|
591
550
|
const res = [];
|
|
592
551
|
|
|
593
552
|
const getChild = itemKey => {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
keyEntities[itemKey].children && (0, _forEach.default)(_context8 = keyEntities[itemKey].children).call(_context8, item => {
|
|
553
|
+
keyEntities[itemKey].children && keyEntities[itemKey].children.forEach(item => {
|
|
597
554
|
const {
|
|
598
555
|
key
|
|
599
556
|
} = item;
|
|
@@ -613,7 +570,7 @@ function getMotionKeys(eventKey, expandedKeys, keyEntities) {
|
|
|
613
570
|
function calcCheckedKeysForChecked(key, keyEntities, checkedKeys, halfCheckedKeys) {
|
|
614
571
|
const descendantKeys = findDescendantKeys([key], keyEntities, true);
|
|
615
572
|
const nodeItem = keyEntities[key];
|
|
616
|
-
checkedKeys = new
|
|
573
|
+
checkedKeys = new Set([...checkedKeys, key]);
|
|
617
574
|
|
|
618
575
|
const calcCurrLevel = node => {
|
|
619
576
|
if (!node.parent) {
|
|
@@ -626,11 +583,11 @@ function calcCheckedKeysForChecked(key, keyEntities, checkedKeys, halfCheckedKey
|
|
|
626
583
|
} = node;
|
|
627
584
|
const siblingKeys = findSiblingKeys([key], keyEntities); // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
628
585
|
|
|
629
|
-
const allChecked =
|
|
586
|
+
const allChecked = siblingKeys.every(key => checkedKeys.has(key));
|
|
630
587
|
|
|
631
588
|
if (!allChecked) {
|
|
632
589
|
const ancestorKeys = findAncestorKeys([key], keyEntities, false);
|
|
633
|
-
halfCheckedKeys = new
|
|
590
|
+
halfCheckedKeys = new Set([...halfCheckedKeys, ...ancestorKeys]);
|
|
634
591
|
} else {
|
|
635
592
|
const par = node.parent;
|
|
636
593
|
checkedKeys.add(par.key);
|
|
@@ -640,7 +597,7 @@ function calcCheckedKeysForChecked(key, keyEntities, checkedKeys, halfCheckedKey
|
|
|
640
597
|
|
|
641
598
|
calcCurrLevel(nodeItem);
|
|
642
599
|
return {
|
|
643
|
-
checkedKeys: new
|
|
600
|
+
checkedKeys: new Set([...checkedKeys, ...descendantKeys]),
|
|
644
601
|
halfCheckedKeys
|
|
645
602
|
};
|
|
646
603
|
} // eslint-disable-next-line max-len
|
|
@@ -649,7 +606,7 @@ function calcCheckedKeysForChecked(key, keyEntities, checkedKeys, halfCheckedKey
|
|
|
649
606
|
function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedKeys) {
|
|
650
607
|
const descendantKeys = findDescendantKeys([key], keyEntities, true);
|
|
651
608
|
const nodeItem = keyEntities[key];
|
|
652
|
-
|
|
609
|
+
descendantKeys.forEach(descendantKey => {
|
|
653
610
|
if (checkedKeys.has(descendantKey)) {
|
|
654
611
|
checkedKeys.delete(descendantKey);
|
|
655
612
|
}
|
|
@@ -678,11 +635,11 @@ function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedK
|
|
|
678
635
|
} = node;
|
|
679
636
|
const siblingKeys = findSiblingKeys([key], keyEntities); // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
680
637
|
|
|
681
|
-
const anyChecked =
|
|
638
|
+
const anyChecked = siblingKeys.some(key => checkedKeys.has(key) || halfCheckedKeys.has(key));
|
|
682
639
|
const ancestorKeys = findAncestorKeys([key], keyEntities, false); // If there is checked or halfChecked in the sibling node, you need to change the parent node to halfChecked
|
|
683
640
|
|
|
684
641
|
if (anyChecked) {
|
|
685
|
-
|
|
642
|
+
ancestorKeys.forEach(itemKey => {
|
|
686
643
|
if (checkedKeys.has(itemKey)) {
|
|
687
644
|
checkedKeys.delete(itemKey);
|
|
688
645
|
halfCheckedKeys.add(itemKey);
|
|
@@ -709,8 +666,6 @@ function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedK
|
|
|
709
666
|
}
|
|
710
667
|
|
|
711
668
|
function filterTreeData(info) {
|
|
712
|
-
var _context9, _context10;
|
|
713
|
-
|
|
714
669
|
const {
|
|
715
670
|
showFilteredOnly,
|
|
716
671
|
keyEntities,
|
|
@@ -721,29 +676,29 @@ function filterTreeData(info) {
|
|
|
721
676
|
prevExpandedKeys
|
|
722
677
|
} = info;
|
|
723
678
|
let filteredOptsKeys = [];
|
|
724
|
-
filteredOptsKeys =
|
|
679
|
+
filteredOptsKeys = Object.values(keyEntities).filter(item => filter(inputValue, item.data, filterTreeNode, filterProps)).map(item => item.key);
|
|
725
680
|
let expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
|
|
726
681
|
|
|
727
682
|
if (prevExpandedKeys.length) {
|
|
728
|
-
const prevExpandedValidKeys =
|
|
729
|
-
expandedOptsKeys =
|
|
683
|
+
const prevExpandedValidKeys = prevExpandedKeys.filter(key => Boolean(keyEntities[key]));
|
|
684
|
+
expandedOptsKeys = expandedOptsKeys.concat(prevExpandedValidKeys);
|
|
730
685
|
}
|
|
731
686
|
|
|
732
687
|
const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
|
|
733
|
-
const filteredShownKeys = new
|
|
734
|
-
const flattenNodes = flattenTreeData(treeData, new
|
|
688
|
+
const filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
689
|
+
const flattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
|
|
735
690
|
return {
|
|
736
691
|
flattenNodes,
|
|
737
|
-
filteredKeys: new
|
|
738
|
-
filteredExpandedKeys: new
|
|
692
|
+
filteredKeys: new Set(filteredOptsKeys),
|
|
693
|
+
filteredExpandedKeys: new Set(expandedOptsKeys),
|
|
739
694
|
filteredShownKeys
|
|
740
695
|
};
|
|
741
696
|
} // return data.value if data.value exist else fall back to key
|
|
742
697
|
|
|
743
698
|
|
|
744
699
|
function getValueOrKey(data) {
|
|
745
|
-
if (
|
|
746
|
-
return
|
|
700
|
+
if (Array.isArray(data)) {
|
|
701
|
+
return data.map(item => (0, _get2.default)(item, 'value', item.key));
|
|
747
702
|
}
|
|
748
703
|
|
|
749
704
|
return (0, _get2.default)(data, 'value', data.key);
|
|
@@ -761,13 +716,11 @@ function normalizeValue(value, withObject) {
|
|
|
761
716
|
|
|
762
717
|
function updateKeys(keySet, keyEntities) {
|
|
763
718
|
const keyArr = [...keySet];
|
|
764
|
-
return
|
|
719
|
+
return keyArr.filter(key => key in keyEntities);
|
|
765
720
|
}
|
|
766
721
|
|
|
767
722
|
function calcDisabledKeys(keyEntities) {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
const disabledKeys = (0, _filter.default)(_context11 = (0, _keys.default)(keyEntities)).call(_context11, key => keyEntities[key].data.disabled);
|
|
723
|
+
const disabledKeys = Object.keys(keyEntities).filter(key => keyEntities[key].data.disabled);
|
|
771
724
|
const {
|
|
772
725
|
checkedKeys
|
|
773
726
|
} = calcCheckedKeys(disabledKeys, keyEntities);
|
|
@@ -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");
|