@douyinfe/semi-foundation 2.19.0-beta.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/anchor/anchor.scss +1 -8
- package/anchor/rtl.scss +0 -1
- package/anchor/variables.scss +1 -0
- package/calendar/eventUtil.ts +8 -7
- package/calendar/foundation.ts +14 -14
- package/datePicker/monthsGridFoundation.ts +10 -3
- package/dropdown/foundation.ts +2 -1
- package/dropdown/menuFoundation.ts +2 -1
- package/getBabelConfig.js +0 -12
- package/lib/cjs/anchor/anchor.css +1 -10
- package/lib/cjs/anchor/anchor.scss +1 -8
- package/lib/cjs/anchor/constants.js +1 -4
- package/lib/cjs/anchor/foundation.js +5 -12
- package/lib/cjs/anchor/linkFoundation.js +4 -9
- package/lib/cjs/anchor/rtl.scss +0 -1
- package/lib/cjs/anchor/variables.scss +1 -0
- package/lib/cjs/autoComplete/constants.js +1 -4
- package/lib/cjs/autoComplete/foundation.js +14 -33
- package/lib/cjs/autoComplete/optionFoundation.js +4 -9
- package/lib/cjs/avatar/constants.js +1 -4
- package/lib/cjs/avatar/foundation.js +4 -9
- package/lib/cjs/backtop/constants.js +1 -4
- package/lib/cjs/backtop/foundation.js +4 -9
- package/lib/cjs/badge/constants.js +1 -4
- package/lib/cjs/banner/constants.js +1 -4
- package/lib/cjs/banner/foundation.js +4 -9
- package/lib/cjs/base/constants.js +2 -6
- package/lib/cjs/base/env.js +1 -4
- package/lib/cjs/base/foundation.js +5 -10
- package/lib/cjs/base/index.js +3 -6
- package/lib/cjs/breadcrumb/constants.js +1 -4
- package/lib/cjs/breadcrumb/foundation.js +6 -13
- package/lib/cjs/breadcrumb/itemFoundation.js +4 -9
- package/lib/cjs/button/constants.js +1 -4
- package/lib/cjs/calendar/constants.js +1 -4
- package/lib/cjs/calendar/eventUtil.d.ts +3 -3
- package/lib/cjs/calendar/eventUtil.js +28 -53
- package/lib/cjs/calendar/foundation.js +63 -85
- package/lib/cjs/card/constants.js +1 -4
- package/lib/cjs/carousel/constants.js +1 -4
- package/lib/cjs/carousel/foundation.js +5 -12
- package/lib/cjs/cascader/constants.js +1 -4
- package/lib/cjs/cascader/foundation.js +55 -100
- package/lib/cjs/cascader/util.js +9 -30
- package/lib/cjs/checkbox/checkboxFoundation.js +6 -13
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +9 -18
- package/lib/cjs/checkbox/constants.js +1 -4
- package/lib/cjs/collapse/constants.js +1 -4
- package/lib/cjs/collapse/foundation.js +9 -20
- package/lib/cjs/collapsible/constants.js +1 -4
- package/lib/cjs/datePicker/_utils/formatter.js +3 -12
- package/lib/cjs/datePicker/_utils/getDayOfWeek.js +1 -4
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +1 -4
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +5 -10
- package/lib/cjs/datePicker/_utils/getFullDateOffset.js +3 -6
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +2 -11
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +1 -4
- package/lib/cjs/datePicker/_utils/getMonthTable.js +2 -11
- package/lib/cjs/datePicker/_utils/getMonthsInYear.js +3 -16
- package/lib/cjs/datePicker/_utils/getYears.js +2 -9
- package/lib/cjs/datePicker/_utils/index.js +16 -30
- package/lib/cjs/datePicker/_utils/isAfter.js +3 -6
- package/lib/cjs/datePicker/_utils/isBefore.js +3 -6
- package/lib/cjs/datePicker/_utils/isBetween.js +3 -6
- package/lib/cjs/datePicker/_utils/isDate.js +1 -4
- package/lib/cjs/datePicker/_utils/isSameDay.js +3 -6
- package/lib/cjs/datePicker/_utils/isTimestamp.js +3 -6
- package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +3 -6
- package/lib/cjs/datePicker/_utils/isValidDate.js +1 -4
- package/lib/cjs/datePicker/_utils/isWithinInterval.js +3 -6
- package/lib/cjs/datePicker/_utils/parser.js +1 -4
- package/lib/cjs/datePicker/constants.js +3 -10
- package/lib/cjs/datePicker/foundation.js +42 -85
- package/lib/cjs/datePicker/inputFoundation.js +7 -20
- package/lib/cjs/datePicker/monthFoundation.js +5 -12
- package/lib/cjs/datePicker/monthsGridFoundation.js +47 -68
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +4 -9
- package/lib/cjs/descriptions/constants.js +1 -4
- package/lib/cjs/divider/constants.js +1 -4
- package/lib/cjs/dropdown/constants.js +1 -4
- package/lib/cjs/dropdown/foundation.js +7 -15
- package/lib/cjs/dropdown/menuFoundation.js +11 -31
- package/lib/cjs/empty/constants.js +1 -4
- package/lib/cjs/form/constants.js +1 -4
- package/lib/cjs/form/foundation.js +64 -104
- package/lib/cjs/form/interface.js +1 -3
- package/lib/cjs/form/utils.js +14 -29
- package/lib/cjs/grid/constants.js +1 -4
- package/lib/cjs/icons/constants.js +1 -4
- package/lib/cjs/input/constants.js +1 -4
- package/lib/cjs/input/foundation.js +7 -18
- package/lib/cjs/input/textareaFoundation.js +6 -13
- package/lib/cjs/input/util/calculateNodeHeight.js +3 -17
- package/lib/cjs/input/util/getSizingData.js +5 -10
- package/lib/cjs/inputNumber/constants.js +4 -11
- package/lib/cjs/inputNumber/foundation.js +11 -30
- package/lib/cjs/layout/constants.js +1 -4
- package/lib/cjs/list/constants.js +1 -4
- package/lib/cjs/modal/constants.js +1 -4
- package/lib/cjs/modal/modalContentFoundation.js +4 -9
- package/lib/cjs/modal/modalFoundation.js +4 -9
- package/lib/cjs/navigation/NavItem.js +6 -21
- package/lib/cjs/navigation/constants.js +1 -4
- package/lib/cjs/navigation/foundation.js +22 -37
- package/lib/cjs/navigation/itemFoundation.js +4 -9
- package/lib/cjs/navigation/subNavFoundation.js +10 -21
- package/lib/cjs/notification/constants.js +1 -4
- package/lib/cjs/notification/notificationFoundation.js +5 -12
- package/lib/cjs/notification/notificationListFoundation.js +4 -9
- package/lib/cjs/overflowList/constants.js +3 -10
- package/lib/cjs/overflowList/foundation.js +12 -29
- package/lib/cjs/pagination/constants.js +1 -4
- package/lib/cjs/pagination/foundation.js +18 -37
- package/lib/cjs/popconfirm/constants.js +1 -4
- package/lib/cjs/popconfirm/popconfirmFoundation.js +3 -6
- package/lib/cjs/popover/constants.js +2 -9
- package/lib/cjs/progress/constants.js +1 -4
- package/lib/cjs/radio/constants.js +1 -4
- package/lib/cjs/radio/radioFoundation.js +3 -6
- package/lib/cjs/radio/radioGroupFoundation.js +6 -11
- package/lib/cjs/radio/radioInnerFoundation.js +5 -10
- package/lib/cjs/rating/constants.js +1 -4
- package/lib/cjs/rating/foundation.js +7 -20
- package/lib/cjs/scrollList/constants.js +1 -4
- package/lib/cjs/scrollList/foundation.js +3 -6
- package/lib/cjs/scrollList/itemFoundation.js +8 -21
- package/lib/cjs/scrollList/scrollTo.js +1 -4
- package/lib/cjs/select/constants.js +1 -4
- package/lib/cjs/select/foundation.js +56 -98
- package/lib/cjs/select/optionFoundation.js +4 -9
- package/lib/cjs/sideSheet/constants.js +1 -4
- package/lib/cjs/sideSheet/sideSheetFoundation.js +6 -15
- package/lib/cjs/skeleton/constants.js +1 -4
- package/lib/cjs/slider/constants.js +1 -4
- package/lib/cjs/slider/foundation.js +13 -24
- package/lib/cjs/space/constants.js +1 -4
- package/lib/cjs/spin/constants.js +1 -4
- package/lib/cjs/spin/foundation.js +5 -12
- package/lib/cjs/steps/constants.js +1 -4
- package/lib/cjs/switch/constants.js +1 -4
- package/lib/cjs/switch/foundation.js +4 -9
- package/lib/cjs/table/bodyFoundation.js +9 -22
- package/lib/cjs/table/cellFoundation.js +3 -6
- package/lib/cjs/table/constants.js +1 -4
- package/lib/cjs/table/foundation.js +76 -117
- package/lib/cjs/table/tableRowFoundation.js +3 -6
- package/lib/cjs/table/tableSelectionCellFoundation.js +3 -6
- package/lib/cjs/table/utils.js +42 -71
- package/lib/cjs/tabs/constants.js +1 -4
- package/lib/cjs/tabs/foundation.js +8 -23
- package/lib/cjs/tag/constants.js +1 -4
- package/lib/cjs/tagInput/constants.js +1 -4
- package/lib/cjs/tagInput/foundation.js +12 -31
- package/lib/cjs/tagInput/utils/getSplitedArray.js +3 -6
- package/lib/cjs/timePicker/ComboxFoundation.js +10 -29
- package/lib/cjs/timePicker/constants.js +1 -4
- package/lib/cjs/timePicker/foundation.js +26 -45
- package/lib/cjs/timePicker/inputFoundation.js +4 -9
- package/lib/cjs/timePicker/utils/index.js +7 -14
- package/lib/cjs/timePicker/utils/localeDate.js +2 -9
- package/lib/cjs/timeline/constants.js +1 -4
- package/lib/cjs/toast/constants.js +1 -4
- package/lib/cjs/toast/toastFoundation.js +5 -12
- package/lib/cjs/toast/toastListFoundation.js +5 -12
- package/lib/cjs/tooltip/constants.js +1 -4
- package/lib/cjs/tooltip/foundation.js +29 -56
- package/lib/cjs/transfer/constants.js +1 -4
- package/lib/cjs/transfer/foundation.js +24 -47
- package/lib/cjs/transfer/transferUtils.js +16 -45
- package/lib/cjs/tree/constants.js +1 -4
- package/lib/cjs/tree/foundation.js +41 -76
- package/lib/cjs/tree/treeUtil.js +60 -107
- package/lib/cjs/treeSelect/constants.js +1 -4
- package/lib/cjs/treeSelect/foundation.js +49 -82
- package/lib/cjs/typography/constants.js +1 -4
- package/lib/cjs/upload/constants.js +1 -4
- package/lib/cjs/upload/foundation.js +56 -112
- package/lib/cjs/upload/utils.js +13 -32
- package/lib/cjs/utils/Event.js +9 -23
- package/lib/cjs/utils/FocusHandle.js +6 -15
- package/lib/cjs/utils/Logger.js +1 -4
- package/lib/cjs/utils/Store.js +5 -20
- package/lib/cjs/utils/a11y.js +8 -13
- package/lib/cjs/utils/array.js +6 -15
- package/lib/cjs/utils/arrayMove.js +3 -12
- package/lib/cjs/utils/classnames.js +6 -15
- package/lib/cjs/utils/date-fns-extra.js +7 -18
- package/lib/cjs/utils/dom.js +5 -12
- package/lib/cjs/utils/function.js +1 -4
- package/lib/cjs/utils/getDataAttr.js +2 -13
- package/lib/cjs/utils/getHighlight.js +7 -22
- package/lib/cjs/utils/getMotionObjFromProps.js +4 -9
- package/lib/cjs/utils/index.js +5 -15
- package/lib/cjs/utils/isBothNaN.js +1 -4
- package/lib/cjs/utils/isElement.js +1 -4
- package/lib/cjs/utils/isEnterPress.js +3 -6
- package/lib/cjs/utils/isEscPress.js +3 -6
- package/lib/cjs/utils/isNullOrUndefined.js +1 -4
- package/lib/cjs/utils/isNumber.js +1 -4
- package/lib/cjs/utils/isObject.js +1 -4
- package/lib/cjs/utils/isPromise.js +3 -6
- package/lib/cjs/utils/isString.js +1 -4
- package/lib/cjs/utils/keyCode.js +1 -4
- package/lib/cjs/utils/log.js +3 -6
- package/lib/cjs/utils/number.js +1 -4
- package/lib/cjs/utils/object.js +10 -27
- package/lib/cjs/utils/set.js +4 -9
- package/lib/cjs/utils/shallowEqualObjects.js +3 -10
- package/lib/cjs/utils/touchPolyfill.js +5 -12
- package/lib/cjs/utils/type.js +1 -3
- package/lib/cjs/utils/uuid.js +3 -14
- package/lib/cjs/utils/warning.js +1 -4
- package/lib/es/anchor/anchor.css +1 -10
- package/lib/es/anchor/anchor.scss +1 -8
- package/lib/es/anchor/foundation.js +2 -4
- package/lib/es/anchor/linkFoundation.js +1 -2
- package/lib/es/anchor/rtl.scss +0 -1
- package/lib/es/anchor/variables.scss +1 -0
- package/lib/es/autoComplete/foundation.js +11 -26
- package/lib/es/autoComplete/optionFoundation.js +1 -2
- package/lib/es/avatar/foundation.js +1 -2
- package/lib/es/backtop/foundation.js +1 -2
- package/lib/es/banner/foundation.js +1 -2
- package/lib/es/base/foundation.js +2 -3
- package/lib/es/breadcrumb/foundation.js +3 -6
- package/lib/es/breadcrumb/itemFoundation.js +1 -2
- package/lib/es/calendar/eventUtil.d.ts +3 -3
- package/lib/es/calendar/eventUtil.js +27 -56
- package/lib/es/calendar/foundation.js +60 -90
- package/lib/es/carousel/foundation.js +2 -4
- package/lib/es/cascader/foundation.js +49 -94
- package/lib/es/cascader/util.js +6 -21
- package/lib/es/checkbox/checkboxFoundation.js +3 -6
- package/lib/es/checkbox/checkboxGroupFoundation.js +6 -9
- package/lib/es/collapse/foundation.js +6 -10
- package/lib/es/datePicker/_utils/formatter.js +2 -5
- package/lib/es/datePicker/_utils/getDefaultPickerDate.js +2 -3
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +1 -4
- package/lib/es/datePicker/_utils/getMonthTable.js +1 -5
- package/lib/es/datePicker/_utils/getMonthsInYear.js +2 -9
- package/lib/es/datePicker/_utils/getYears.js +1 -3
- package/lib/es/datePicker/constants.js +2 -7
- package/lib/es/datePicker/foundation.js +39 -70
- package/lib/es/datePicker/inputFoundation.js +4 -11
- package/lib/es/datePicker/monthFoundation.js +2 -4
- package/lib/es/datePicker/monthsGridFoundation.js +40 -55
- package/lib/es/datePicker/yearAndMonthFoundation.js +1 -2
- package/lib/es/dropdown/foundation.js +4 -7
- package/lib/es/dropdown/menuFoundation.js +8 -21
- package/lib/es/form/foundation.js +59 -91
- package/lib/es/form/utils.js +11 -19
- package/lib/es/input/foundation.js +4 -9
- package/lib/es/input/textareaFoundation.js +3 -5
- package/lib/es/input/util/calculateNodeHeight.js +2 -10
- package/lib/es/input/util/getSizingData.js +2 -5
- package/lib/es/inputNumber/constants.js +3 -8
- package/lib/es/inputNumber/foundation.js +8 -18
- package/lib/es/modal/modalContentFoundation.js +1 -2
- package/lib/es/modal/modalFoundation.js +1 -2
- package/lib/es/navigation/NavItem.js +5 -11
- package/lib/es/navigation/foundation.js +19 -25
- package/lib/es/navigation/itemFoundation.js +1 -3
- package/lib/es/navigation/subNavFoundation.js +7 -13
- package/lib/es/notification/notificationFoundation.js +2 -4
- package/lib/es/notification/notificationListFoundation.js +1 -3
- package/lib/es/overflowList/constants.js +2 -3
- package/lib/es/overflowList/foundation.js +9 -23
- package/lib/es/pagination/foundation.js +15 -28
- package/lib/es/popover/constants.js +1 -2
- package/lib/es/radio/radioGroupFoundation.js +3 -4
- package/lib/es/radio/radioInnerFoundation.js +2 -3
- package/lib/es/rating/foundation.js +4 -13
- package/lib/es/scrollList/itemFoundation.js +5 -13
- package/lib/es/select/foundation.js +50 -88
- package/lib/es/select/optionFoundation.js +1 -2
- package/lib/es/sideSheet/sideSheetFoundation.js +3 -7
- package/lib/es/slider/foundation.js +10 -16
- package/lib/es/spin/foundation.js +2 -4
- package/lib/es/switch/foundation.js +1 -2
- package/lib/es/table/bodyFoundation.js +6 -11
- package/lib/es/table/foundation.js +67 -93
- package/lib/es/table/utils.js +33 -51
- package/lib/es/tabs/foundation.js +5 -18
- package/lib/es/tagInput/foundation.js +9 -21
- package/lib/es/timePicker/ComboxFoundation.js +7 -16
- package/lib/es/timePicker/foundation.js +23 -37
- package/lib/es/timePicker/inputFoundation.js +1 -2
- package/lib/es/timePicker/utils/index.js +4 -6
- package/lib/es/timePicker/utils/localeDate.js +1 -2
- package/lib/es/toast/toastFoundation.js +2 -4
- package/lib/es/toast/toastListFoundation.js +2 -4
- package/lib/es/tooltip/foundation.js +26 -46
- package/lib/es/transfer/foundation.js +21 -43
- package/lib/es/transfer/transferUtils.js +13 -33
- package/lib/es/tree/foundation.js +38 -70
- package/lib/es/tree/treeUtil.js +57 -109
- package/lib/es/treeSelect/foundation.js +45 -73
- package/lib/es/upload/foundation.js +52 -118
- package/lib/es/upload/utils.js +12 -25
- package/lib/es/utils/Event.js +5 -12
- package/lib/es/utils/FocusHandle.js +3 -7
- package/lib/es/utils/Store.js +4 -12
- package/lib/es/utils/a11y.js +5 -6
- package/lib/es/utils/array.js +3 -5
- package/lib/es/utils/arrayMove.js +2 -6
- package/lib/es/utils/classnames.js +3 -6
- package/lib/es/utils/date-fns-extra.js +6 -14
- package/lib/es/utils/dom.js +1 -2
- package/lib/es/utils/getDataAttr.js +1 -5
- package/lib/es/utils/getHighlight.js +4 -14
- package/lib/es/utils/getMotionObjFromProps.js +1 -2
- package/lib/es/utils/object.js +7 -15
- package/lib/es/utils/set.js +1 -2
- package/lib/es/utils/shallowEqualObjects.js +2 -5
- package/lib/es/utils/touchPolyfill.js +2 -6
- package/lib/es/utils/uuid.js +2 -7
- package/package.json +2 -4
- package/select/foundation.ts +2 -2
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
7
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
8
|
-
|
|
9
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
4
|
value: true
|
|
11
5
|
});
|
|
12
|
-
|
|
13
6
|
exports.default = void 0;
|
|
14
7
|
|
|
15
|
-
var _assign2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
16
|
-
|
|
17
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
18
|
-
|
|
19
|
-
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
20
|
-
|
|
21
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
22
|
-
|
|
23
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
24
|
-
|
|
25
|
-
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
26
|
-
|
|
27
|
-
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
28
|
-
|
|
29
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
30
|
-
|
|
31
|
-
var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
|
|
32
|
-
|
|
33
|
-
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
|
34
|
-
|
|
35
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
|
36
|
-
|
|
37
|
-
var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
|
|
38
|
-
|
|
39
|
-
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-int"));
|
|
40
|
-
|
|
41
8
|
var _includes2 = _interopRequireDefault(require("lodash/includes"));
|
|
42
9
|
|
|
43
10
|
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
|
@@ -46,7 +13,7 @@ var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
|
|
|
46
13
|
|
|
47
14
|
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
48
15
|
|
|
49
|
-
var
|
|
16
|
+
var _assign2 = _interopRequireDefault(require("lodash/assign"));
|
|
50
17
|
|
|
51
18
|
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
52
19
|
|
|
@@ -66,12 +33,14 @@ var _constants = require("./constants");
|
|
|
66
33
|
|
|
67
34
|
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
68
35
|
|
|
36
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
+
|
|
69
38
|
// eslint-disable-next-line max-len
|
|
70
39
|
class CascaderFoundation extends _foundation.default {
|
|
71
40
|
constructor(adapter) {
|
|
72
41
|
var _this;
|
|
73
42
|
|
|
74
|
-
super(
|
|
43
|
+
super(Object.assign({}, adapter));
|
|
75
44
|
_this = this;
|
|
76
45
|
|
|
77
46
|
this.getMergedMotion = () => {
|
|
@@ -83,7 +52,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
83
52
|
} = this.getStates();
|
|
84
53
|
|
|
85
54
|
if (isSearching) {
|
|
86
|
-
const mergedMotion = typeof motion === 'undefined' || motion ?
|
|
55
|
+
const mergedMotion = typeof motion === 'undefined' || motion ? Object.assign(Object.assign({}, motion), {
|
|
87
56
|
didLeave: function () {
|
|
88
57
|
const didLeave = (0, _get2.default)(motion, 'didLeave');
|
|
89
58
|
|
|
@@ -135,7 +104,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
135
104
|
const valuePath = []; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
136
105
|
// @ts-ignore
|
|
137
106
|
|
|
138
|
-
|
|
107
|
+
item.forEach(checkedKey => {
|
|
139
108
|
const valuePathItem = this.getItemPropPath(checkedKey, valueProp);
|
|
140
109
|
valuePath.push(valuePathItem);
|
|
141
110
|
});
|
|
@@ -173,17 +142,13 @@ class CascaderFoundation extends _foundation.default {
|
|
|
173
142
|
}
|
|
174
143
|
|
|
175
144
|
_isOptionDisabled(key, keyEntities) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const isDisabled = (0, _some.default)(_context = (0, _treeUtil.findAncestorKeys)([key], keyEntities, true)).call(_context, item => keyEntities[item].data.disabled);
|
|
145
|
+
const isDisabled = (0, _treeUtil.findAncestorKeys)([key], keyEntities, true).some(item => keyEntities[item].data.disabled);
|
|
179
146
|
return isDisabled;
|
|
180
147
|
}
|
|
181
148
|
|
|
182
149
|
getCopyFromState(items) {
|
|
183
|
-
var _context2;
|
|
184
|
-
|
|
185
150
|
const res = {};
|
|
186
|
-
(0,
|
|
151
|
+
(0, _util.normalizedArr)(items).forEach(key => {
|
|
187
152
|
res[key] = (0, _cloneDeep2.default)(this.getState(key));
|
|
188
153
|
});
|
|
189
154
|
return res;
|
|
@@ -200,7 +165,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
200
165
|
path = selectedItem.path;
|
|
201
166
|
} else {
|
|
202
167
|
const keyPath = selectedItem.path;
|
|
203
|
-
path =
|
|
168
|
+
path = Array.isArray(prop) ? keyPath.map(key => searchMap[key].data) : keyPath.map(key => searchMap[key].data[prop]);
|
|
204
169
|
}
|
|
205
170
|
|
|
206
171
|
return path;
|
|
@@ -210,7 +175,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
210
175
|
const {
|
|
211
176
|
selectedKeys
|
|
212
177
|
} = this.getStates();
|
|
213
|
-
const selectedKey =
|
|
178
|
+
const selectedKey = Array.from(selectedKeys)[0];
|
|
214
179
|
let cacheValue;
|
|
215
180
|
/* selectedKeys does not match keyEntities */
|
|
216
181
|
|
|
@@ -312,9 +277,9 @@ class CascaderFoundation extends _foundation.default {
|
|
|
312
277
|
placeholder,
|
|
313
278
|
multiple
|
|
314
279
|
} = this.getProps();
|
|
315
|
-
updateStates.selectedKeys = new
|
|
316
|
-
updateStates.activeKeys = new
|
|
317
|
-
updateStates.filteredKeys = new
|
|
280
|
+
updateStates.selectedKeys = new Set([]);
|
|
281
|
+
updateStates.activeKeys = new Set([]);
|
|
282
|
+
updateStates.filteredKeys = new Set([]);
|
|
318
283
|
|
|
319
284
|
if (filterable && !multiple) {
|
|
320
285
|
updateStates.inputPlaceHolder = searchPlaceholder || placeholder || '';
|
|
@@ -325,8 +290,6 @@ class CascaderFoundation extends _foundation.default {
|
|
|
325
290
|
}
|
|
326
291
|
|
|
327
292
|
updateSelectedKey(value, keyEntities) {
|
|
328
|
-
var _context3, _context4;
|
|
329
|
-
|
|
330
293
|
const {
|
|
331
294
|
changeOnSelect,
|
|
332
295
|
onChangeWithObject,
|
|
@@ -342,8 +305,8 @@ class CascaderFoundation extends _foundation.default {
|
|
|
342
305
|
|
|
343
306
|
const filterable = this._isFilterable();
|
|
344
307
|
|
|
345
|
-
const loadingActive =
|
|
346
|
-
const valuePath = onChangeWithObject ? (0,
|
|
308
|
+
const loadingActive = [...activeKeys].filter(i => loadingKeys.has(i));
|
|
309
|
+
const valuePath = onChangeWithObject ? (0, _util.normalizedArr)(value).map(i => i.value) : (0, _util.normalizedArr)(value);
|
|
347
310
|
const selectedKeys = (0, _util.findKeysForValues)(valuePath, keyEntities);
|
|
348
311
|
let updateStates = {};
|
|
349
312
|
|
|
@@ -356,10 +319,10 @@ class CascaderFoundation extends _foundation.default {
|
|
|
356
319
|
*/
|
|
357
320
|
|
|
358
321
|
if (changeOnSelect || this._isLeaf(selectedItem.data)) {
|
|
359
|
-
updateStates.selectedKeys = new
|
|
322
|
+
updateStates.selectedKeys = new Set([selectedKey]);
|
|
360
323
|
|
|
361
324
|
if (!loadingActive.length) {
|
|
362
|
-
updateStates.activeKeys = new
|
|
325
|
+
updateStates.activeKeys = new Set(selectedItem.path);
|
|
363
326
|
}
|
|
364
327
|
|
|
365
328
|
if (filterable && !multiple) {
|
|
@@ -378,7 +341,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
378
341
|
* be cleared.
|
|
379
342
|
*/
|
|
380
343
|
|
|
381
|
-
} else if ((0, _isEqual2.default)(selectedKeys,
|
|
344
|
+
} else if ((0, _isEqual2.default)(selectedKeys, Array.from(selectedKeysState))) {
|
|
382
345
|
updateStates = this._getClearSelectedKey(filterable);
|
|
383
346
|
}
|
|
384
347
|
} else if (value && value.length) {
|
|
@@ -393,7 +356,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
393
356
|
path: valuePath,
|
|
394
357
|
_notExist: true
|
|
395
358
|
};
|
|
396
|
-
updateStates.selectedKeys = new
|
|
359
|
+
updateStates.selectedKeys = new Set([key]);
|
|
397
360
|
|
|
398
361
|
if (filterable && !multiple) {
|
|
399
362
|
const displayText = this._defaultRenderText(valuePath);
|
|
@@ -406,7 +369,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
406
369
|
} else if (loading) {
|
|
407
370
|
// Use assign to avoid overwriting the'not-exist- * 'property of keyEntities after asynchronous loading
|
|
408
371
|
// Overwriting'not-exist- * 'will cause selectionContent to be emptied unexpectedly when clicking on a dropDown item
|
|
409
|
-
updateStates.keyEntities = (0,
|
|
372
|
+
updateStates.keyEntities = (0, _assign2.default)(keyEntityState, keyEntities);
|
|
410
373
|
|
|
411
374
|
this._adapter.updateStates(updateStates);
|
|
412
375
|
|
|
@@ -457,7 +420,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
457
420
|
return;
|
|
458
421
|
}
|
|
459
422
|
|
|
460
|
-
const newActiveKeys = new
|
|
423
|
+
const newActiveKeys = new Set(selectedItem.path);
|
|
461
424
|
|
|
462
425
|
if (!(0, _isEqual2.default)(newActiveKeys, activeKeys)) {
|
|
463
426
|
this._adapter.updateStates({
|
|
@@ -550,7 +513,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
550
513
|
const activeKeys = keyEntities[key].path;
|
|
551
514
|
|
|
552
515
|
this._adapter.updateStates({
|
|
553
|
-
activeKeys: new
|
|
516
|
+
activeKeys: new Set(activeKeys)
|
|
554
517
|
});
|
|
555
518
|
|
|
556
519
|
if (!isLeaf) {
|
|
@@ -633,7 +596,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
633
596
|
loadingKeys: prevLoadingKeys
|
|
634
597
|
} = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
|
|
635
598
|
const newLoadedKeys = prevLoadedKeys.add(key);
|
|
636
|
-
const newLoadingKeys = new
|
|
599
|
+
const newLoadingKeys = new Set([...prevLoadingKeys]);
|
|
637
600
|
newLoadingKeys.delete(key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice.
|
|
638
601
|
|
|
639
602
|
this._adapter.notifyOnLoad(newLoadedKeys, data);
|
|
@@ -654,8 +617,6 @@ class CascaderFoundation extends _foundation.default {
|
|
|
654
617
|
});
|
|
655
618
|
|
|
656
619
|
if (!data.isLeaf && !data.children && this.getProp('loadData')) {
|
|
657
|
-
var _context5;
|
|
658
|
-
|
|
659
620
|
const {
|
|
660
621
|
loadedKeys,
|
|
661
622
|
loadingKeys
|
|
@@ -678,7 +639,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
678
639
|
loadingKeys: loadingKeys.add(key)
|
|
679
640
|
});
|
|
680
641
|
|
|
681
|
-
this._adapter.notifyLoadData(optionPath,
|
|
642
|
+
this._adapter.notifyLoadData(optionPath, this.handleNodeLoad.bind(this, item));
|
|
682
643
|
}
|
|
683
644
|
}
|
|
684
645
|
|
|
@@ -710,7 +671,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
710
671
|
|
|
711
672
|
if (!isLeaf && !allowChange && !isSearching) {
|
|
712
673
|
this._adapter.updateStates({
|
|
713
|
-
activeKeys: new
|
|
674
|
+
activeKeys: new Set(activeKeys)
|
|
714
675
|
});
|
|
715
676
|
|
|
716
677
|
this.notifyIfLoadData(item);
|
|
@@ -719,7 +680,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
719
680
|
|
|
720
681
|
if (multiple) {
|
|
721
682
|
this._adapter.updateStates({
|
|
722
|
-
activeKeys: new
|
|
683
|
+
activeKeys: new Set(activeKeys)
|
|
723
684
|
});
|
|
724
685
|
|
|
725
686
|
if (isLeaf && enableLeafClick) {
|
|
@@ -735,7 +696,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
735
696
|
|
|
736
697
|
if (this._isControlledComponent()) {
|
|
737
698
|
this._adapter.updateStates({
|
|
738
|
-
activeKeys: new
|
|
699
|
+
activeKeys: new Set(activeKeys)
|
|
739
700
|
});
|
|
740
701
|
|
|
741
702
|
if (isLeaf) {
|
|
@@ -746,8 +707,8 @@ class CascaderFoundation extends _foundation.default {
|
|
|
746
707
|
}
|
|
747
708
|
|
|
748
709
|
this._adapter.updateStates({
|
|
749
|
-
activeKeys: new
|
|
750
|
-
selectedKeys: new
|
|
710
|
+
activeKeys: new Set(activeKeys),
|
|
711
|
+
selectedKeys: new Set(selectedKey)
|
|
751
712
|
});
|
|
752
713
|
|
|
753
714
|
const displayText = this.renderDisplayText(key);
|
|
@@ -794,7 +755,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
794
755
|
const mergeType = (0, _util.calcMergeType)(autoMergeValue, leafOnly);
|
|
795
756
|
const isLeafOnlyMerge = mergeType === _constants.strings.LEAF_ONLY_MERGE_TYPE;
|
|
796
757
|
const isNoneMerge = mergeType === _constants.strings.NONE_MERGE_TYPE;
|
|
797
|
-
const curResolvedCheckedKeys = new
|
|
758
|
+
const curResolvedCheckedKeys = new Set((0, _treeUtil.normalizeKeyList)(curCheckedKeys, keyEntities, isLeafOnlyMerge));
|
|
798
759
|
const curRealCheckedKeys = isNoneMerge ? curCheckedKeys : curResolvedCheckedKeys;
|
|
799
760
|
|
|
800
761
|
if ((0, _isNumber2.default)(max)) {
|
|
@@ -802,7 +763,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
802
763
|
// When it exceeds max, the quantity is allowed to be reduced, and no further increase is allowed
|
|
803
764
|
if (resolvedCheckedKeys.size < curResolvedCheckedKeys.size && curResolvedCheckedKeys.size > max) {
|
|
804
765
|
const checkedEntities = [];
|
|
805
|
-
|
|
766
|
+
curResolvedCheckedKeys.forEach(itemKey => {
|
|
806
767
|
checkedEntities.push(keyEntities[itemKey]);
|
|
807
768
|
});
|
|
808
769
|
|
|
@@ -814,7 +775,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
814
775
|
// When it exceeds max, the quantity is allowed to be reduced, and no further increase is allowed
|
|
815
776
|
if (checkedKeys.size < curCheckedKeys.size && curCheckedKeys.size > max) {
|
|
816
777
|
const checkedEntities = [];
|
|
817
|
-
|
|
778
|
+
curCheckedKeys.forEach(itemKey => {
|
|
818
779
|
checkedEntities.push(keyEntities[itemKey]);
|
|
819
780
|
});
|
|
820
781
|
|
|
@@ -855,13 +816,13 @@ class CascaderFoundation extends _foundation.default {
|
|
|
855
816
|
checkedKeys
|
|
856
817
|
} = this.getCopyFromState(['checkedKeys']);
|
|
857
818
|
const descendantKeys = (0, _treeUtil.normalizeKeyList)((0, _treeUtil.findDescendantKeys)([eventKey], keyEntities, false), keyEntities, true);
|
|
858
|
-
const hasDisabled =
|
|
819
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
859
820
|
|
|
860
821
|
if (!hasDisabled) {
|
|
861
822
|
return this.calcCheckedKeys(eventKey, targetStatus);
|
|
862
823
|
}
|
|
863
824
|
|
|
864
|
-
const nonDisabled =
|
|
825
|
+
const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
865
826
|
const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : (0, _difference2.default)((0, _treeUtil.normalizeKeyList)([...checkedKeys], keyEntities, true), nonDisabled);
|
|
866
827
|
return (0, _treeUtil.calcCheckedKeys)(newCheckedKeys, keyEntities);
|
|
867
828
|
}
|
|
@@ -877,14 +838,14 @@ class CascaderFoundation extends _foundation.default {
|
|
|
877
838
|
disabledKeys
|
|
878
839
|
} = this.getStates();
|
|
879
840
|
const descendantKeys = (0, _treeUtil.normalizeKeyList)((0, _treeUtil.findDescendantKeys)([eventKey], keyEntities, false), keyEntities, true);
|
|
880
|
-
const hasDisabled =
|
|
841
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
881
842
|
|
|
882
843
|
if (!hasDisabled) {
|
|
883
844
|
return targetStatus;
|
|
884
845
|
}
|
|
885
846
|
|
|
886
|
-
const nonDisabledKeys =
|
|
887
|
-
const allChecked =
|
|
847
|
+
const nonDisabledKeys = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
848
|
+
const allChecked = nonDisabledKeys.every(key => checkedKeys.has(key));
|
|
888
849
|
return !allChecked;
|
|
889
850
|
}
|
|
890
851
|
|
|
@@ -893,7 +854,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
893
854
|
keyEntities
|
|
894
855
|
} = this.getStates();
|
|
895
856
|
const values = [];
|
|
896
|
-
|
|
857
|
+
keys.forEach(key => {
|
|
897
858
|
if (!(0, _isEmpty2.default)(keyEntities) && !(0, _isEmpty2.default)(keyEntities[key])) {
|
|
898
859
|
const valueItem = keyEntities[key].data.value;
|
|
899
860
|
values.push(valueItem);
|
|
@@ -935,9 +896,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
935
896
|
let filteredKeys = [];
|
|
936
897
|
|
|
937
898
|
if (sugInput) {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
filteredKeys = (0, _map.default)(_context6 = (0, _filter.default)(_context7 = (0, _filter.default)(_context8 = (0, _values.default)(keyEntities)).call(_context8, item => {
|
|
899
|
+
filteredKeys = Object.values(keyEntities).filter(item => {
|
|
941
900
|
const {
|
|
942
901
|
key,
|
|
943
902
|
_notExist
|
|
@@ -948,13 +907,13 @@ class CascaderFoundation extends _foundation.default {
|
|
|
948
907
|
}
|
|
949
908
|
|
|
950
909
|
const filteredPath = this.getItemPropPath(key, treeNodeFilterProp).join();
|
|
951
|
-
return (0,
|
|
952
|
-
})
|
|
910
|
+
return (0, _treeUtil.filter)(sugInput, filteredPath, filterTreeNode, false);
|
|
911
|
+
}).filter(item => filterTreeNode && !filterLeafOnly || this._isLeaf(item)).map(item => item.key);
|
|
953
912
|
}
|
|
954
913
|
|
|
955
914
|
this._adapter.updateStates({
|
|
956
915
|
isSearching: Boolean(sugInput),
|
|
957
|
-
filteredKeys: new
|
|
916
|
+
filteredKeys: new Set(filteredKeys)
|
|
958
917
|
});
|
|
959
918
|
|
|
960
919
|
this._adapter.notifyOnSearch(sugInput);
|
|
@@ -981,11 +940,11 @@ class CascaderFoundation extends _foundation.default {
|
|
|
981
940
|
|
|
982
941
|
this._adapter.notifyOnSearch('');
|
|
983
942
|
|
|
984
|
-
newState.checkedKeys = new
|
|
985
|
-
newState.halfCheckedKeys = new
|
|
986
|
-
newState.selectedKeys = new
|
|
987
|
-
newState.activeKeys = new
|
|
988
|
-
newState.resolvedCheckedKeys = new
|
|
943
|
+
newState.checkedKeys = new Set([]);
|
|
944
|
+
newState.halfCheckedKeys = new Set([]);
|
|
945
|
+
newState.selectedKeys = new Set([]);
|
|
946
|
+
newState.activeKeys = new Set([]);
|
|
947
|
+
newState.resolvedCheckedKeys = new Set([]);
|
|
989
948
|
|
|
990
949
|
this._adapter.notifyChange([]);
|
|
991
950
|
} else {
|
|
@@ -1007,11 +966,11 @@ class CascaderFoundation extends _foundation.default {
|
|
|
1007
966
|
}
|
|
1008
967
|
|
|
1009
968
|
if (!isControlled) {
|
|
1010
|
-
newState.selectedKeys = new
|
|
969
|
+
newState.selectedKeys = new Set([]);
|
|
1011
970
|
}
|
|
1012
971
|
|
|
1013
|
-
newState.activeKeys = new
|
|
1014
|
-
newState.filteredKeys = new
|
|
972
|
+
newState.activeKeys = new Set([]);
|
|
973
|
+
newState.filteredKeys = new Set([]);
|
|
1015
974
|
|
|
1016
975
|
this._adapter.notifyChange([]);
|
|
1017
976
|
}
|
|
@@ -1037,8 +996,6 @@ class CascaderFoundation extends _foundation.default {
|
|
|
1037
996
|
}
|
|
1038
997
|
|
|
1039
998
|
getRenderData() {
|
|
1040
|
-
var _context9, _context10;
|
|
1041
|
-
|
|
1042
999
|
const {
|
|
1043
1000
|
keyEntities,
|
|
1044
1001
|
isSearching
|
|
@@ -1050,9 +1007,9 @@ class CascaderFoundation extends _foundation.default {
|
|
|
1050
1007
|
return this.getFilteredData();
|
|
1051
1008
|
}
|
|
1052
1009
|
|
|
1053
|
-
return
|
|
1010
|
+
return Object.values(keyEntities).filter(item => item.parentKey === null && !item._notExist) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1054
1011
|
// @ts-ignore
|
|
1055
|
-
|
|
1012
|
+
.sort((a, b) => parseInt(a.ind, 10) - parseInt(b.ind, 10));
|
|
1056
1013
|
}
|
|
1057
1014
|
|
|
1058
1015
|
getFilteredData() {
|
|
@@ -1065,7 +1022,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
1065
1022
|
} = this.getStates();
|
|
1066
1023
|
const filteredList = [];
|
|
1067
1024
|
const filteredKeyArr = [...filteredKeys];
|
|
1068
|
-
|
|
1025
|
+
filteredKeyArr.forEach(key => {
|
|
1069
1026
|
const item = keyEntities[key];
|
|
1070
1027
|
|
|
1071
1028
|
if (!item) {
|
|
@@ -1101,8 +1058,6 @@ class CascaderFoundation extends _foundation.default {
|
|
|
1101
1058
|
}
|
|
1102
1059
|
|
|
1103
1060
|
handleTagRemove(e, tagValuePath) {
|
|
1104
|
-
var _context11;
|
|
1105
|
-
|
|
1106
1061
|
const {
|
|
1107
1062
|
keyEntities
|
|
1108
1063
|
} = this.getStates();
|
|
@@ -1115,7 +1070,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
1115
1070
|
return;
|
|
1116
1071
|
}
|
|
1117
1072
|
|
|
1118
|
-
const removedItem =
|
|
1073
|
+
const removedItem = Object.values(keyEntities).filter(item => (0, _isEqual2.default)(item.valuePath, tagValuePath))[0];
|
|
1119
1074
|
!(0, _isEmpty2.default)(removedItem) && !removedItem.data.disabled && this._handleMultipleSelect(removedItem);
|
|
1120
1075
|
}
|
|
1121
1076
|
|
package/lib/cjs/cascader/util.js
CHANGED
|
@@ -1,33 +1,14 @@
|
|
|
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.calcMergeType = calcMergeType;
|
|
12
7
|
exports.convertDataToEntities = convertDataToEntities;
|
|
13
8
|
exports.findKeysForValues = findKeysForValues;
|
|
14
9
|
exports.isValid = isValid;
|
|
15
10
|
exports.normalizedArr = normalizedArr;
|
|
16
11
|
|
|
17
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
18
|
-
|
|
19
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
20
|
-
|
|
21
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
22
|
-
|
|
23
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
24
|
-
|
|
25
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
26
|
-
|
|
27
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
28
|
-
|
|
29
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
|
30
|
-
|
|
31
12
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
32
13
|
|
|
33
14
|
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
@@ -36,10 +17,10 @@ var _isNull2 = _interopRequireDefault(require("lodash/isNull"));
|
|
|
36
17
|
|
|
37
18
|
var _constants = require("./constants");
|
|
38
19
|
|
|
39
|
-
function
|
|
40
|
-
var _context;
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
21
|
|
|
42
|
-
|
|
22
|
+
function getPosition(level, index) {
|
|
23
|
+
return "".concat(level, "-").concat(index);
|
|
43
24
|
}
|
|
44
25
|
|
|
45
26
|
function isValid(val) {
|
|
@@ -47,7 +28,7 @@ function isValid(val) {
|
|
|
47
28
|
}
|
|
48
29
|
|
|
49
30
|
function normalizedArr(val) {
|
|
50
|
-
if (!
|
|
31
|
+
if (!Array.isArray(val)) {
|
|
51
32
|
return [val];
|
|
52
33
|
} else {
|
|
53
34
|
return val;
|
|
@@ -66,7 +47,7 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
66
47
|
if (node) {
|
|
67
48
|
const key = parent ? getPosition(parent.key, ind) : "".concat(ind);
|
|
68
49
|
item = {
|
|
69
|
-
data:
|
|
50
|
+
data: Object.assign({}, node),
|
|
70
51
|
ind,
|
|
71
52
|
key,
|
|
72
53
|
level: parent ? parent.level + 1 : 0,
|
|
@@ -79,7 +60,7 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
79
60
|
|
|
80
61
|
|
|
81
62
|
if (children) {
|
|
82
|
-
|
|
63
|
+
children.forEach((subNode, subIndex) => {
|
|
83
64
|
processNode(subNode, subIndex, item);
|
|
84
65
|
});
|
|
85
66
|
}
|
|
@@ -95,7 +76,7 @@ function convertDataToEntities(dataNodes) {
|
|
|
95
76
|
key,
|
|
96
77
|
parentKey
|
|
97
78
|
} = data;
|
|
98
|
-
const entity =
|
|
79
|
+
const entity = Object.assign({}, data);
|
|
99
80
|
keyEntities[key] = entity; // Fill children
|
|
100
81
|
|
|
101
82
|
entity.parent = keyEntities[parentKey];
|
|
@@ -109,10 +90,8 @@ function convertDataToEntities(dataNodes) {
|
|
|
109
90
|
}
|
|
110
91
|
|
|
111
92
|
function findKeysForValues(value, keyEntities) {
|
|
112
|
-
var _context2, _context3;
|
|
113
|
-
|
|
114
93
|
const valuePath = normalizedArr(value);
|
|
115
|
-
const res =
|
|
94
|
+
const res = Object.values(keyEntities).filter(item => (0, _isEqual2.default)(item.valuePath, valuePath)).map(item => item.key);
|
|
116
95
|
return res;
|
|
117
96
|
}
|
|
118
97
|
|
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
14
|
-
|
|
15
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
16
|
-
|
|
17
8
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
18
9
|
|
|
19
10
|
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
20
11
|
|
|
21
12
|
var _warning = _interopRequireDefault(require("../utils/warning"));
|
|
22
13
|
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
23
16
|
class CheckboxFoundation extends _foundation.default {
|
|
24
17
|
constructor(adapter) {
|
|
25
|
-
super(
|
|
18
|
+
super(Object.assign({}, adapter));
|
|
26
19
|
this.clickState = false;
|
|
27
20
|
|
|
28
21
|
this.handleFocusVisible = event => {
|
|
@@ -71,7 +64,7 @@ class CheckboxFoundation extends _foundation.default {
|
|
|
71
64
|
getEvent(checked, e) {
|
|
72
65
|
const props = this.getProps();
|
|
73
66
|
const cbValue = {
|
|
74
|
-
target:
|
|
67
|
+
target: Object.assign(Object.assign({}, props), {
|
|
75
68
|
checked
|
|
76
69
|
}),
|
|
77
70
|
stopPropagation: () => {
|
|
@@ -140,7 +133,7 @@ class CheckboxFoundation extends _foundation.default {
|
|
|
140
133
|
|
|
141
134
|
const groupValue = this._adapter.getGroupValue();
|
|
142
135
|
|
|
143
|
-
const checked =
|
|
136
|
+
const checked = groupValue.includes(value);
|
|
144
137
|
const newChecked = !checked;
|
|
145
138
|
const event = this.getEvent(newChecked, e);
|
|
146
139
|
|
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
14
|
-
|
|
15
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
16
|
-
|
|
17
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
18
|
-
|
|
19
8
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
20
9
|
|
|
21
10
|
var _warning = _interopRequireDefault(require("../utils/warning"));
|
|
22
11
|
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
23
14
|
class CheckboxGroupFoundation extends _foundation.default {
|
|
24
15
|
static get checkboxGroupDefaultAdapter() {
|
|
25
16
|
return {};
|
|
26
17
|
}
|
|
27
18
|
|
|
28
19
|
constructor(adapter) {
|
|
29
|
-
super(
|
|
20
|
+
super(Object.assign(Object.assign({}, CheckboxGroupFoundation.checkboxGroupDefaultAdapter), adapter));
|
|
30
21
|
}
|
|
31
22
|
|
|
32
23
|
init() {
|
|
@@ -35,11 +26,11 @@ class CheckboxGroupFoundation extends _foundation.default {
|
|
|
35
26
|
value
|
|
36
27
|
} = this.getProps();
|
|
37
28
|
|
|
38
|
-
if (typeof defaultValue !== 'undefined' && !
|
|
29
|
+
if (typeof defaultValue !== 'undefined' && !Array.isArray(defaultValue)) {
|
|
39
30
|
(0, _warning.default)(true, 'Warning: [Semi CheckboxGroup] defaultValue should be an Array');
|
|
40
31
|
}
|
|
41
32
|
|
|
42
|
-
if (typeof value !== 'undefined' && !
|
|
33
|
+
if (typeof value !== 'undefined' && !Array.isArray(value)) {
|
|
43
34
|
(0, _warning.default)(true, 'Warning: [Semi CheckboxGroup] value should be an Array');
|
|
44
35
|
}
|
|
45
36
|
}
|
|
@@ -52,14 +43,14 @@ class CheckboxGroupFoundation extends _foundation.default {
|
|
|
52
43
|
const prevValue = this.getState('value');
|
|
53
44
|
let newValue = [];
|
|
54
45
|
|
|
55
|
-
if (!
|
|
46
|
+
if (!Array.isArray(prevValue)) {
|
|
56
47
|
newValue = [prevValue];
|
|
57
48
|
}
|
|
58
49
|
|
|
59
50
|
if (evt.target.checked) {
|
|
60
51
|
newValue = [...prevValue, evt.target.value];
|
|
61
52
|
} else {
|
|
62
|
-
newValue =
|
|
53
|
+
newValue = prevValue.filter((itm, idx) => itm !== evt.target.value);
|
|
63
54
|
}
|
|
64
55
|
|
|
65
56
|
const isControlledMode = ('value' in this.getProps());
|
|
@@ -82,7 +73,7 @@ class CheckboxGroupFoundation extends _foundation.default {
|
|
|
82
73
|
}
|
|
83
74
|
|
|
84
75
|
handlePropValueChange(newPropValue) {
|
|
85
|
-
if (
|
|
76
|
+
if (Array.isArray(newPropValue)) {
|
|
86
77
|
this._adapter.updateGroupValue(newPropValue);
|
|
87
78
|
} else {
|
|
88
79
|
// to adjust reset in Form.CheckboxGroup
|