@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
|
@@ -7,19 +7,6 @@ import _isUndefined from "lodash/isUndefined";
|
|
|
7
7
|
import _difference from "lodash/difference";
|
|
8
8
|
import _get from "lodash/get";
|
|
9
9
|
import _isEqual from "lodash/isEqual";
|
|
10
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
11
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
12
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
13
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
14
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
15
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
16
|
-
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
17
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
18
|
-
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
19
|
-
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
20
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
21
|
-
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/sort";
|
|
22
|
-
import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
|
23
10
|
import BaseFoundation from '../base/foundation';
|
|
24
11
|
import { filter, findAncestorKeys, calcCheckedKeysForUnchecked, calcCheckedKeysForChecked, calcCheckedKeys, findDescendantKeys, normalizeKeyList } from '../tree/treeUtil';
|
|
25
12
|
import { convertDataToEntities, findKeysForValues, normalizedArr, isValid, calcMergeType } from './util';
|
|
@@ -30,7 +17,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
30
17
|
constructor(adapter) {
|
|
31
18
|
var _this;
|
|
32
19
|
|
|
33
|
-
super(
|
|
20
|
+
super(Object.assign({}, adapter));
|
|
34
21
|
_this = this;
|
|
35
22
|
|
|
36
23
|
this.getMergedMotion = () => {
|
|
@@ -42,7 +29,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
42
29
|
} = this.getStates();
|
|
43
30
|
|
|
44
31
|
if (isSearching) {
|
|
45
|
-
const mergedMotion = typeof motion === 'undefined' || motion ?
|
|
32
|
+
const mergedMotion = typeof motion === 'undefined' || motion ? Object.assign(Object.assign({}, motion), {
|
|
46
33
|
didLeave: function () {
|
|
47
34
|
const didLeave = _get(motion, 'didLeave');
|
|
48
35
|
|
|
@@ -94,7 +81,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
94
81
|
const valuePath = []; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
95
82
|
// @ts-ignore
|
|
96
83
|
|
|
97
|
-
|
|
84
|
+
item.forEach(checkedKey => {
|
|
98
85
|
const valuePathItem = this.getItemPropPath(checkedKey, valueProp);
|
|
99
86
|
valuePath.push(valuePathItem);
|
|
100
87
|
});
|
|
@@ -132,22 +119,15 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
132
119
|
}
|
|
133
120
|
|
|
134
121
|
_isOptionDisabled(key, keyEntities) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const isDisabled = _someInstanceProperty(_context = findAncestorKeys([key], keyEntities, true)).call(_context, item => keyEntities[item].data.disabled);
|
|
138
|
-
|
|
122
|
+
const isDisabled = findAncestorKeys([key], keyEntities, true).some(item => keyEntities[item].data.disabled);
|
|
139
123
|
return isDisabled;
|
|
140
124
|
}
|
|
141
125
|
|
|
142
126
|
getCopyFromState(items) {
|
|
143
|
-
var _context2;
|
|
144
|
-
|
|
145
127
|
const res = {};
|
|
146
|
-
|
|
147
|
-
_forEachInstanceProperty(_context2 = normalizedArr(items)).call(_context2, key => {
|
|
128
|
+
normalizedArr(items).forEach(key => {
|
|
148
129
|
res[key] = _cloneDeep(this.getState(key));
|
|
149
130
|
});
|
|
150
|
-
|
|
151
131
|
return res;
|
|
152
132
|
} // prop: is array, return all data
|
|
153
133
|
|
|
@@ -162,7 +142,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
162
142
|
path = selectedItem.path;
|
|
163
143
|
} else {
|
|
164
144
|
const keyPath = selectedItem.path;
|
|
165
|
-
path =
|
|
145
|
+
path = Array.isArray(prop) ? keyPath.map(key => searchMap[key].data) : keyPath.map(key => searchMap[key].data[prop]);
|
|
166
146
|
}
|
|
167
147
|
|
|
168
148
|
return path;
|
|
@@ -172,9 +152,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
172
152
|
const {
|
|
173
153
|
selectedKeys
|
|
174
154
|
} = this.getStates();
|
|
175
|
-
|
|
176
|
-
const selectedKey = _Array$from(selectedKeys)[0];
|
|
177
|
-
|
|
155
|
+
const selectedKey = Array.from(selectedKeys)[0];
|
|
178
156
|
let cacheValue;
|
|
179
157
|
/* selectedKeys does not match keyEntities */
|
|
180
158
|
|
|
@@ -276,9 +254,9 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
276
254
|
placeholder,
|
|
277
255
|
multiple
|
|
278
256
|
} = this.getProps();
|
|
279
|
-
updateStates.selectedKeys = new
|
|
280
|
-
updateStates.activeKeys = new
|
|
281
|
-
updateStates.filteredKeys = new
|
|
257
|
+
updateStates.selectedKeys = new Set([]);
|
|
258
|
+
updateStates.activeKeys = new Set([]);
|
|
259
|
+
updateStates.filteredKeys = new Set([]);
|
|
282
260
|
|
|
283
261
|
if (filterable && !multiple) {
|
|
284
262
|
updateStates.inputPlaceHolder = searchPlaceholder || placeholder || '';
|
|
@@ -289,8 +267,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
289
267
|
}
|
|
290
268
|
|
|
291
269
|
updateSelectedKey(value, keyEntities) {
|
|
292
|
-
var _context3, _context4;
|
|
293
|
-
|
|
294
270
|
const {
|
|
295
271
|
changeOnSelect,
|
|
296
272
|
onChangeWithObject,
|
|
@@ -306,9 +282,8 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
306
282
|
|
|
307
283
|
const filterable = this._isFilterable();
|
|
308
284
|
|
|
309
|
-
const loadingActive =
|
|
310
|
-
|
|
311
|
-
const valuePath = onChangeWithObject ? _mapInstanceProperty(_context4 = normalizedArr(value)).call(_context4, i => i.value) : normalizedArr(value);
|
|
285
|
+
const loadingActive = [...activeKeys].filter(i => loadingKeys.has(i));
|
|
286
|
+
const valuePath = onChangeWithObject ? normalizedArr(value).map(i => i.value) : normalizedArr(value);
|
|
312
287
|
const selectedKeys = findKeysForValues(valuePath, keyEntities);
|
|
313
288
|
let updateStates = {};
|
|
314
289
|
|
|
@@ -321,10 +296,10 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
321
296
|
*/
|
|
322
297
|
|
|
323
298
|
if (changeOnSelect || this._isLeaf(selectedItem.data)) {
|
|
324
|
-
updateStates.selectedKeys = new
|
|
299
|
+
updateStates.selectedKeys = new Set([selectedKey]);
|
|
325
300
|
|
|
326
301
|
if (!loadingActive.length) {
|
|
327
|
-
updateStates.activeKeys = new
|
|
302
|
+
updateStates.activeKeys = new Set(selectedItem.path);
|
|
328
303
|
}
|
|
329
304
|
|
|
330
305
|
if (filterable && !multiple) {
|
|
@@ -343,7 +318,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
343
318
|
* be cleared.
|
|
344
319
|
*/
|
|
345
320
|
|
|
346
|
-
} else if (_isEqual(selectedKeys,
|
|
321
|
+
} else if (_isEqual(selectedKeys, Array.from(selectedKeysState))) {
|
|
347
322
|
updateStates = this._getClearSelectedKey(filterable);
|
|
348
323
|
}
|
|
349
324
|
} else if (value && value.length) {
|
|
@@ -358,7 +333,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
358
333
|
path: valuePath,
|
|
359
334
|
_notExist: true
|
|
360
335
|
};
|
|
361
|
-
updateStates.selectedKeys = new
|
|
336
|
+
updateStates.selectedKeys = new Set([key]);
|
|
362
337
|
|
|
363
338
|
if (filterable && !multiple) {
|
|
364
339
|
const displayText = this._defaultRenderText(valuePath);
|
|
@@ -422,7 +397,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
422
397
|
return;
|
|
423
398
|
}
|
|
424
399
|
|
|
425
|
-
const newActiveKeys = new
|
|
400
|
+
const newActiveKeys = new Set(selectedItem.path);
|
|
426
401
|
|
|
427
402
|
if (!_isEqual(newActiveKeys, activeKeys)) {
|
|
428
403
|
this._adapter.updateStates({
|
|
@@ -515,7 +490,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
515
490
|
const activeKeys = keyEntities[key].path;
|
|
516
491
|
|
|
517
492
|
this._adapter.updateStates({
|
|
518
|
-
activeKeys: new
|
|
493
|
+
activeKeys: new Set(activeKeys)
|
|
519
494
|
});
|
|
520
495
|
|
|
521
496
|
if (!isLeaf) {
|
|
@@ -598,7 +573,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
598
573
|
loadingKeys: prevLoadingKeys
|
|
599
574
|
} = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
|
|
600
575
|
const newLoadedKeys = prevLoadedKeys.add(key);
|
|
601
|
-
const newLoadingKeys = new
|
|
576
|
+
const newLoadingKeys = new Set([...prevLoadingKeys]);
|
|
602
577
|
newLoadingKeys.delete(key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice.
|
|
603
578
|
|
|
604
579
|
this._adapter.notifyOnLoad(newLoadedKeys, data);
|
|
@@ -619,8 +594,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
619
594
|
});
|
|
620
595
|
|
|
621
596
|
if (!data.isLeaf && !data.children && this.getProp('loadData')) {
|
|
622
|
-
var _context5;
|
|
623
|
-
|
|
624
597
|
const {
|
|
625
598
|
loadedKeys,
|
|
626
599
|
loadingKeys
|
|
@@ -643,7 +616,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
643
616
|
loadingKeys: loadingKeys.add(key)
|
|
644
617
|
});
|
|
645
618
|
|
|
646
|
-
this._adapter.notifyLoadData(optionPath,
|
|
619
|
+
this._adapter.notifyLoadData(optionPath, this.handleNodeLoad.bind(this, item));
|
|
647
620
|
}
|
|
648
621
|
}
|
|
649
622
|
|
|
@@ -675,7 +648,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
675
648
|
|
|
676
649
|
if (!isLeaf && !allowChange && !isSearching) {
|
|
677
650
|
this._adapter.updateStates({
|
|
678
|
-
activeKeys: new
|
|
651
|
+
activeKeys: new Set(activeKeys)
|
|
679
652
|
});
|
|
680
653
|
|
|
681
654
|
this.notifyIfLoadData(item);
|
|
@@ -684,7 +657,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
684
657
|
|
|
685
658
|
if (multiple) {
|
|
686
659
|
this._adapter.updateStates({
|
|
687
|
-
activeKeys: new
|
|
660
|
+
activeKeys: new Set(activeKeys)
|
|
688
661
|
});
|
|
689
662
|
|
|
690
663
|
if (isLeaf && enableLeafClick) {
|
|
@@ -700,7 +673,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
700
673
|
|
|
701
674
|
if (this._isControlledComponent()) {
|
|
702
675
|
this._adapter.updateStates({
|
|
703
|
-
activeKeys: new
|
|
676
|
+
activeKeys: new Set(activeKeys)
|
|
704
677
|
});
|
|
705
678
|
|
|
706
679
|
if (isLeaf) {
|
|
@@ -711,8 +684,8 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
711
684
|
}
|
|
712
685
|
|
|
713
686
|
this._adapter.updateStates({
|
|
714
|
-
activeKeys: new
|
|
715
|
-
selectedKeys: new
|
|
687
|
+
activeKeys: new Set(activeKeys),
|
|
688
|
+
selectedKeys: new Set(selectedKey)
|
|
716
689
|
});
|
|
717
690
|
|
|
718
691
|
const displayText = this.renderDisplayText(key);
|
|
@@ -759,7 +732,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
759
732
|
const mergeType = calcMergeType(autoMergeValue, leafOnly);
|
|
760
733
|
const isLeafOnlyMerge = mergeType === strings.LEAF_ONLY_MERGE_TYPE;
|
|
761
734
|
const isNoneMerge = mergeType === strings.NONE_MERGE_TYPE;
|
|
762
|
-
const curResolvedCheckedKeys = new
|
|
735
|
+
const curResolvedCheckedKeys = new Set(normalizeKeyList(curCheckedKeys, keyEntities, isLeafOnlyMerge));
|
|
763
736
|
const curRealCheckedKeys = isNoneMerge ? curCheckedKeys : curResolvedCheckedKeys;
|
|
764
737
|
|
|
765
738
|
if (_isNumber(max)) {
|
|
@@ -767,8 +740,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
767
740
|
// When it exceeds max, the quantity is allowed to be reduced, and no further increase is allowed
|
|
768
741
|
if (resolvedCheckedKeys.size < curResolvedCheckedKeys.size && curResolvedCheckedKeys.size > max) {
|
|
769
742
|
const checkedEntities = [];
|
|
770
|
-
|
|
771
|
-
_forEachInstanceProperty(curResolvedCheckedKeys).call(curResolvedCheckedKeys, itemKey => {
|
|
743
|
+
curResolvedCheckedKeys.forEach(itemKey => {
|
|
772
744
|
checkedEntities.push(keyEntities[itemKey]);
|
|
773
745
|
});
|
|
774
746
|
|
|
@@ -780,8 +752,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
780
752
|
// When it exceeds max, the quantity is allowed to be reduced, and no further increase is allowed
|
|
781
753
|
if (checkedKeys.size < curCheckedKeys.size && curCheckedKeys.size > max) {
|
|
782
754
|
const checkedEntities = [];
|
|
783
|
-
|
|
784
|
-
_forEachInstanceProperty(curCheckedKeys).call(curCheckedKeys, itemKey => {
|
|
755
|
+
curCheckedKeys.forEach(itemKey => {
|
|
785
756
|
checkedEntities.push(keyEntities[itemKey]);
|
|
786
757
|
});
|
|
787
758
|
|
|
@@ -822,15 +793,13 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
822
793
|
checkedKeys
|
|
823
794
|
} = this.getCopyFromState(['checkedKeys']);
|
|
824
795
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
825
|
-
|
|
826
|
-
const hasDisabled = _someInstanceProperty(descendantKeys).call(descendantKeys, key => disabledKeys.has(key));
|
|
796
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
827
797
|
|
|
828
798
|
if (!hasDisabled) {
|
|
829
799
|
return this.calcCheckedKeys(eventKey, targetStatus);
|
|
830
800
|
}
|
|
831
801
|
|
|
832
|
-
const nonDisabled =
|
|
833
|
-
|
|
802
|
+
const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
834
803
|
const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : _difference(normalizeKeyList([...checkedKeys], keyEntities, true), nonDisabled);
|
|
835
804
|
return calcCheckedKeys(newCheckedKeys, keyEntities);
|
|
836
805
|
}
|
|
@@ -846,17 +815,14 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
846
815
|
disabledKeys
|
|
847
816
|
} = this.getStates();
|
|
848
817
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
849
|
-
|
|
850
|
-
const hasDisabled = _someInstanceProperty(descendantKeys).call(descendantKeys, key => disabledKeys.has(key));
|
|
818
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
851
819
|
|
|
852
820
|
if (!hasDisabled) {
|
|
853
821
|
return targetStatus;
|
|
854
822
|
}
|
|
855
823
|
|
|
856
|
-
const nonDisabledKeys =
|
|
857
|
-
|
|
858
|
-
const allChecked = _everyInstanceProperty(nonDisabledKeys).call(nonDisabledKeys, key => checkedKeys.has(key));
|
|
859
|
-
|
|
824
|
+
const nonDisabledKeys = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
825
|
+
const allChecked = nonDisabledKeys.every(key => checkedKeys.has(key));
|
|
860
826
|
return !allChecked;
|
|
861
827
|
}
|
|
862
828
|
|
|
@@ -865,14 +831,12 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
865
831
|
keyEntities
|
|
866
832
|
} = this.getStates();
|
|
867
833
|
const values = [];
|
|
868
|
-
|
|
869
|
-
_forEachInstanceProperty(keys).call(keys, key => {
|
|
834
|
+
keys.forEach(key => {
|
|
870
835
|
if (!_isEmpty(keyEntities) && !_isEmpty(keyEntities[key])) {
|
|
871
836
|
const valueItem = keyEntities[key].data.value;
|
|
872
837
|
values.push(valueItem);
|
|
873
838
|
}
|
|
874
839
|
});
|
|
875
|
-
|
|
876
840
|
const formatValue = values.length === 1 ? values[0] : values;
|
|
877
841
|
|
|
878
842
|
this._adapter.notifySelect(formatValue);
|
|
@@ -909,9 +873,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
909
873
|
let filteredKeys = [];
|
|
910
874
|
|
|
911
875
|
if (sugInput) {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
filteredKeys = _mapInstanceProperty(_context6 = _filterInstanceProperty(_context7 = _filterInstanceProperty(_context8 = _Object$values(keyEntities)).call(_context8, item => {
|
|
876
|
+
filteredKeys = Object.values(keyEntities).filter(item => {
|
|
915
877
|
const {
|
|
916
878
|
key,
|
|
917
879
|
_notExist
|
|
@@ -923,12 +885,12 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
923
885
|
|
|
924
886
|
const filteredPath = this.getItemPropPath(key, treeNodeFilterProp).join();
|
|
925
887
|
return filter(sugInput, filteredPath, filterTreeNode, false);
|
|
926
|
-
})
|
|
888
|
+
}).filter(item => filterTreeNode && !filterLeafOnly || this._isLeaf(item)).map(item => item.key);
|
|
927
889
|
}
|
|
928
890
|
|
|
929
891
|
this._adapter.updateStates({
|
|
930
892
|
isSearching: Boolean(sugInput),
|
|
931
|
-
filteredKeys: new
|
|
893
|
+
filteredKeys: new Set(filteredKeys)
|
|
932
894
|
});
|
|
933
895
|
|
|
934
896
|
this._adapter.notifyOnSearch(sugInput);
|
|
@@ -955,11 +917,11 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
955
917
|
|
|
956
918
|
this._adapter.notifyOnSearch('');
|
|
957
919
|
|
|
958
|
-
newState.checkedKeys = new
|
|
959
|
-
newState.halfCheckedKeys = new
|
|
960
|
-
newState.selectedKeys = new
|
|
961
|
-
newState.activeKeys = new
|
|
962
|
-
newState.resolvedCheckedKeys = new
|
|
920
|
+
newState.checkedKeys = new Set([]);
|
|
921
|
+
newState.halfCheckedKeys = new Set([]);
|
|
922
|
+
newState.selectedKeys = new Set([]);
|
|
923
|
+
newState.activeKeys = new Set([]);
|
|
924
|
+
newState.resolvedCheckedKeys = new Set([]);
|
|
963
925
|
|
|
964
926
|
this._adapter.notifyChange([]);
|
|
965
927
|
} else {
|
|
@@ -981,11 +943,11 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
981
943
|
}
|
|
982
944
|
|
|
983
945
|
if (!isControlled) {
|
|
984
|
-
newState.selectedKeys = new
|
|
946
|
+
newState.selectedKeys = new Set([]);
|
|
985
947
|
}
|
|
986
948
|
|
|
987
|
-
newState.activeKeys = new
|
|
988
|
-
newState.filteredKeys = new
|
|
949
|
+
newState.activeKeys = new Set([]);
|
|
950
|
+
newState.filteredKeys = new Set([]);
|
|
989
951
|
|
|
990
952
|
this._adapter.notifyChange([]);
|
|
991
953
|
}
|
|
@@ -1011,8 +973,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1011
973
|
}
|
|
1012
974
|
|
|
1013
975
|
getRenderData() {
|
|
1014
|
-
var _context9, _context10;
|
|
1015
|
-
|
|
1016
976
|
const {
|
|
1017
977
|
keyEntities,
|
|
1018
978
|
isSearching
|
|
@@ -1024,9 +984,9 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1024
984
|
return this.getFilteredData();
|
|
1025
985
|
}
|
|
1026
986
|
|
|
1027
|
-
return
|
|
987
|
+
return Object.values(keyEntities).filter(item => item.parentKey === null && !item._notExist) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1028
988
|
// @ts-ignore
|
|
1029
|
-
|
|
989
|
+
.sort((a, b) => parseInt(a.ind, 10) - parseInt(b.ind, 10));
|
|
1030
990
|
}
|
|
1031
991
|
|
|
1032
992
|
getFilteredData() {
|
|
@@ -1039,8 +999,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1039
999
|
} = this.getStates();
|
|
1040
1000
|
const filteredList = [];
|
|
1041
1001
|
const filteredKeyArr = [...filteredKeys];
|
|
1042
|
-
|
|
1043
|
-
_forEachInstanceProperty(filteredKeyArr).call(filteredKeyArr, key => {
|
|
1002
|
+
filteredKeyArr.forEach(key => {
|
|
1044
1003
|
const item = keyEntities[key];
|
|
1045
1004
|
|
|
1046
1005
|
if (!item) {
|
|
@@ -1058,7 +1017,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1058
1017
|
searchText: itemSearchPath
|
|
1059
1018
|
});
|
|
1060
1019
|
});
|
|
1061
|
-
|
|
1062
1020
|
return filteredList;
|
|
1063
1021
|
}
|
|
1064
1022
|
|
|
@@ -1077,8 +1035,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1077
1035
|
}
|
|
1078
1036
|
|
|
1079
1037
|
handleTagRemove(e, tagValuePath) {
|
|
1080
|
-
var _context11;
|
|
1081
|
-
|
|
1082
1038
|
const {
|
|
1083
1039
|
keyEntities
|
|
1084
1040
|
} = this.getStates();
|
|
@@ -1091,8 +1047,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1091
1047
|
return;
|
|
1092
1048
|
}
|
|
1093
1049
|
|
|
1094
|
-
const removedItem =
|
|
1095
|
-
|
|
1050
|
+
const removedItem = Object.values(keyEntities).filter(item => _isEqual(item.valuePath, tagValuePath))[0];
|
|
1096
1051
|
!_isEmpty(removedItem) && !removedItem.data.disabled && this._handleMultipleSelect(removedItem);
|
|
1097
1052
|
}
|
|
1098
1053
|
|
package/lib/es/cascader/util.js
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
import _isEqual from "lodash/isEqual";
|
|
2
2
|
import _isUndefined from "lodash/isUndefined";
|
|
3
3
|
import _isNull from "lodash/isNull";
|
|
4
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
5
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
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 _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
9
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
10
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
11
4
|
import { strings } from './constants';
|
|
12
5
|
|
|
13
6
|
function getPosition(level, index) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return _concatInstanceProperty(_context = "".concat(level, "-")).call(_context, index);
|
|
7
|
+
return "".concat(level, "-").concat(index);
|
|
17
8
|
}
|
|
18
9
|
|
|
19
10
|
export function isValid(val) {
|
|
20
11
|
return !_isNull(val) && !_isUndefined(val);
|
|
21
12
|
}
|
|
22
13
|
export function normalizedArr(val) {
|
|
23
|
-
if (!
|
|
14
|
+
if (!Array.isArray(val)) {
|
|
24
15
|
return [val];
|
|
25
16
|
} else {
|
|
26
17
|
return val;
|
|
@@ -38,7 +29,7 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
38
29
|
if (node) {
|
|
39
30
|
const key = parent ? getPosition(parent.key, ind) : "".concat(ind);
|
|
40
31
|
item = {
|
|
41
|
-
data:
|
|
32
|
+
data: Object.assign({}, node),
|
|
42
33
|
ind,
|
|
43
34
|
key,
|
|
44
35
|
level: parent ? parent.level + 1 : 0,
|
|
@@ -51,7 +42,7 @@ function traverseDataNodes(treeNodes, callback) {
|
|
|
51
42
|
|
|
52
43
|
|
|
53
44
|
if (children) {
|
|
54
|
-
|
|
45
|
+
children.forEach((subNode, subIndex) => {
|
|
55
46
|
processNode(subNode, subIndex, item);
|
|
56
47
|
});
|
|
57
48
|
}
|
|
@@ -67,9 +58,7 @@ export function convertDataToEntities(dataNodes) {
|
|
|
67
58
|
key,
|
|
68
59
|
parentKey
|
|
69
60
|
} = data;
|
|
70
|
-
|
|
71
|
-
const entity = _Object$assign({}, data);
|
|
72
|
-
|
|
61
|
+
const entity = Object.assign({}, data);
|
|
73
62
|
keyEntities[key] = entity; // Fill children
|
|
74
63
|
|
|
75
64
|
entity.parent = keyEntities[parentKey];
|
|
@@ -82,12 +71,8 @@ export function convertDataToEntities(dataNodes) {
|
|
|
82
71
|
return keyEntities;
|
|
83
72
|
}
|
|
84
73
|
export function findKeysForValues(value, keyEntities) {
|
|
85
|
-
var _context2, _context3;
|
|
86
|
-
|
|
87
74
|
const valuePath = normalizedArr(value);
|
|
88
|
-
|
|
89
|
-
const res = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = _Object$values(keyEntities)).call(_context3, item => _isEqual(item.valuePath, valuePath))).call(_context2, item => item.key);
|
|
90
|
-
|
|
75
|
+
const res = Object.values(keyEntities).filter(item => _isEqual(item.valuePath, valuePath)).map(item => item.key);
|
|
91
76
|
return res;
|
|
92
77
|
}
|
|
93
78
|
export function calcMergeType(autoMergeValue, leafOnly) {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
3
1
|
import BaseFoundation from '../base/foundation';
|
|
4
2
|
import isEnterPress from '../utils/isEnterPress';
|
|
5
3
|
import warning from '../utils/warning';
|
|
6
4
|
|
|
7
5
|
class CheckboxFoundation extends BaseFoundation {
|
|
8
6
|
constructor(adapter) {
|
|
9
|
-
super(
|
|
7
|
+
super(Object.assign({}, adapter));
|
|
10
8
|
this.clickState = false;
|
|
11
9
|
|
|
12
10
|
this.handleFocusVisible = event => {
|
|
@@ -55,7 +53,7 @@ class CheckboxFoundation extends BaseFoundation {
|
|
|
55
53
|
getEvent(checked, e) {
|
|
56
54
|
const props = this.getProps();
|
|
57
55
|
const cbValue = {
|
|
58
|
-
target:
|
|
56
|
+
target: Object.assign(Object.assign({}, props), {
|
|
59
57
|
checked
|
|
60
58
|
}),
|
|
61
59
|
stopPropagation: () => {
|
|
@@ -124,8 +122,7 @@ class CheckboxFoundation extends BaseFoundation {
|
|
|
124
122
|
|
|
125
123
|
const groupValue = this._adapter.getGroupValue();
|
|
126
124
|
|
|
127
|
-
const checked =
|
|
128
|
-
|
|
125
|
+
const checked = groupValue.includes(value);
|
|
129
126
|
const newChecked = !checked;
|
|
130
127
|
const event = this.getEvent(newChecked, e);
|
|
131
128
|
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
3
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
1
|
import BaseFoundation from '../base/foundation';
|
|
5
2
|
import warning from '../utils/warning';
|
|
6
3
|
|
|
@@ -10,7 +7,7 @@ class CheckboxGroupFoundation extends BaseFoundation {
|
|
|
10
7
|
}
|
|
11
8
|
|
|
12
9
|
constructor(adapter) {
|
|
13
|
-
super(
|
|
10
|
+
super(Object.assign(Object.assign({}, CheckboxGroupFoundation.checkboxGroupDefaultAdapter), adapter));
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
init() {
|
|
@@ -19,11 +16,11 @@ class CheckboxGroupFoundation extends BaseFoundation {
|
|
|
19
16
|
value
|
|
20
17
|
} = this.getProps();
|
|
21
18
|
|
|
22
|
-
if (typeof defaultValue !== 'undefined' && !
|
|
19
|
+
if (typeof defaultValue !== 'undefined' && !Array.isArray(defaultValue)) {
|
|
23
20
|
warning(true, 'Warning: [Semi CheckboxGroup] defaultValue should be an Array');
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
if (typeof value !== 'undefined' && !
|
|
23
|
+
if (typeof value !== 'undefined' && !Array.isArray(value)) {
|
|
27
24
|
warning(true, 'Warning: [Semi CheckboxGroup] value should be an Array');
|
|
28
25
|
}
|
|
29
26
|
}
|
|
@@ -36,14 +33,14 @@ class CheckboxGroupFoundation extends BaseFoundation {
|
|
|
36
33
|
const prevValue = this.getState('value');
|
|
37
34
|
let newValue = [];
|
|
38
35
|
|
|
39
|
-
if (!
|
|
36
|
+
if (!Array.isArray(prevValue)) {
|
|
40
37
|
newValue = [prevValue];
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
if (evt.target.checked) {
|
|
44
41
|
newValue = [...prevValue, evt.target.value];
|
|
45
42
|
} else {
|
|
46
|
-
newValue =
|
|
43
|
+
newValue = prevValue.filter((itm, idx) => itm !== evt.target.value);
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
const isControlledMode = ('value' in this.getProps());
|
|
@@ -66,7 +63,7 @@ class CheckboxGroupFoundation extends BaseFoundation {
|
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
handlePropValueChange(newPropValue) {
|
|
69
|
-
if (
|
|
66
|
+
if (Array.isArray(newPropValue)) {
|
|
70
67
|
this._adapter.updateGroupValue(newPropValue);
|
|
71
68
|
} else {
|
|
72
69
|
// to adjust reset in Form.CheckboxGroup
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
3
|
-
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
4
|
-
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
|
|
5
1
|
import BaseFoundation from '../base/foundation';
|
|
6
2
|
export default class CollapseFoundation extends BaseFoundation {
|
|
7
3
|
constructor(adapter) {
|
|
8
|
-
super(
|
|
4
|
+
super(Object.assign({}, adapter));
|
|
9
5
|
}
|
|
10
6
|
|
|
11
7
|
initActiveKey() {
|
|
@@ -17,11 +13,11 @@ export default class CollapseFoundation extends BaseFoundation {
|
|
|
17
13
|
let activeKeyList = activeKey ? activeKey : defaultActiveKey;
|
|
18
14
|
|
|
19
15
|
if (accordion) {
|
|
20
|
-
activeKeyList =
|
|
16
|
+
activeKeyList = Array.isArray(activeKeyList) ? activeKeyList[0] : activeKeyList;
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
if (activeKeyList && activeKeyList.length) {
|
|
24
|
-
activeKeyList =
|
|
20
|
+
activeKeyList = Array.isArray(activeKeyList) ? activeKeyList : [activeKeyList];
|
|
25
21
|
return activeKeyList;
|
|
26
22
|
}
|
|
27
23
|
|
|
@@ -36,19 +32,19 @@ export default class CollapseFoundation extends BaseFoundation {
|
|
|
36
32
|
const {
|
|
37
33
|
activeSet
|
|
38
34
|
} = this.getStates();
|
|
39
|
-
let newSet = new
|
|
35
|
+
let newSet = new Set(activeSet);
|
|
40
36
|
|
|
41
37
|
if (newSet.has(newKey)) {
|
|
42
38
|
newSet.delete(newKey);
|
|
43
39
|
} else {
|
|
44
40
|
if (accordion) {
|
|
45
|
-
newSet = new
|
|
41
|
+
newSet = new Set([newKey]);
|
|
46
42
|
} else {
|
|
47
43
|
newSet.add(newKey);
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
this._adapter.handleChange([...
|
|
47
|
+
this._adapter.handleChange([...newSet.values()], e);
|
|
52
48
|
|
|
53
49
|
if (typeof activeKey === 'undefined') {
|
|
54
50
|
this._adapter.addActiveKey(newSet);
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
2
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* @file
|
|
6
3
|
* Date-related formatting display method
|
|
@@ -26,7 +23,7 @@ export function formatDateValues(values, formatToken) {
|
|
|
26
23
|
let text = '';
|
|
27
24
|
(groupSize <= 0 || typeof groupSize !== 'number') && (groupSize = 1); // console.log(values, formatToken, groupInnerSeparator, groupSize, groupSeparator);
|
|
28
25
|
|
|
29
|
-
if (
|
|
26
|
+
if (Array.isArray(values) && values.length) {
|
|
30
27
|
const groups = [];
|
|
31
28
|
const {
|
|
32
29
|
length
|
|
@@ -41,7 +38,7 @@ export function formatDateValues(values, formatToken) {
|
|
|
41
38
|
groups[curArrIdx].push(values[i]);
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
text =
|
|
41
|
+
text = groups.map(arr => arr.map(v => {
|
|
45
42
|
if (v) {
|
|
46
43
|
// console.log(`formatDateValues() -> formatDateValues: ${v}`);
|
|
47
44
|
return format(v, formatToken, {
|