@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,29 +1,20 @@
|
|
|
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 = exports.RatingItemFoundation = 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
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
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
|
/* eslint-disable no-param-reassign */
|
|
24
15
|
class RatingFoundation extends _foundation.default {
|
|
25
16
|
constructor(adapter) {
|
|
26
|
-
super(
|
|
17
|
+
super(Object.assign(Object.assign({}, RatingFoundation.defaultAdapter), adapter));
|
|
27
18
|
|
|
28
19
|
this.handleStarFocusVisible = event => {
|
|
29
20
|
const {
|
|
@@ -180,8 +171,6 @@ class RatingFoundation extends _foundation.default {
|
|
|
180
171
|
}
|
|
181
172
|
|
|
182
173
|
handleKeyDown(event, value) {
|
|
183
|
-
var _context;
|
|
184
|
-
|
|
185
174
|
const {
|
|
186
175
|
key
|
|
187
176
|
} = event;
|
|
@@ -211,7 +200,7 @@ class RatingFoundation extends _foundation.default {
|
|
|
211
200
|
newValue = tempValue;
|
|
212
201
|
}
|
|
213
202
|
|
|
214
|
-
if (
|
|
203
|
+
if (['ArrowRight', 'ArrowUp', 'ArrowLeft', 'ArrowDown'].includes(key)) {
|
|
215
204
|
this._adapter.notifyKeyDown(event);
|
|
216
205
|
|
|
217
206
|
this._adapter.updateValue(newValue);
|
|
@@ -224,15 +213,13 @@ class RatingFoundation extends _foundation.default {
|
|
|
224
213
|
}
|
|
225
214
|
|
|
226
215
|
changeFocusStar(value, event) {
|
|
227
|
-
var _context2;
|
|
228
|
-
|
|
229
216
|
const {
|
|
230
217
|
count,
|
|
231
218
|
allowHalf,
|
|
232
219
|
preventScroll
|
|
233
220
|
} = this.getProps();
|
|
234
221
|
const index = Math.ceil(value) - 1;
|
|
235
|
-
const starElement =
|
|
222
|
+
const starElement = [...event.currentTarget.childNodes].map(item => item.childNodes[0].childNodes);
|
|
236
223
|
|
|
237
224
|
if (index < 0) {
|
|
238
225
|
starElement[count][0].focus({
|
|
@@ -251,7 +238,7 @@ exports.default = RatingFoundation;
|
|
|
251
238
|
|
|
252
239
|
class RatingItemFoundation extends _foundation.default {
|
|
253
240
|
constructor(adapter) {
|
|
254
|
-
super(
|
|
241
|
+
super(Object.assign(Object.assign({}, RatingItemFoundation.defaultAdapter), adapter));
|
|
255
242
|
|
|
256
243
|
this.handleFocusVisible = (event, star) => {
|
|
257
244
|
const {
|
|
@@ -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");
|
|
@@ -1,17 +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.default = void 0;
|
|
12
7
|
|
|
13
8
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
14
9
|
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
15
12
|
class ScrollListFoundation extends _foundation.default {}
|
|
16
13
|
|
|
17
14
|
exports.default = ScrollListFoundation;
|
|
@@ -1,23 +1,10 @@
|
|
|
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 _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
14
|
-
|
|
15
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
16
|
-
|
|
17
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
18
|
-
|
|
19
|
-
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
20
|
-
|
|
21
8
|
var _findIndex2 = _interopRequireDefault(require("lodash/findIndex"));
|
|
22
9
|
|
|
23
10
|
var _find2 = _interopRequireDefault(require("lodash/find"));
|
|
@@ -30,6 +17,8 @@ var _isElement = _interopRequireDefault(require("../utils/isElement"));
|
|
|
30
17
|
|
|
31
18
|
var _dom = require("../utils/dom");
|
|
32
19
|
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
33
22
|
class ItemFoundation extends _foundation.default {
|
|
34
23
|
constructor() {
|
|
35
24
|
super(...arguments);
|
|
@@ -42,14 +31,14 @@ class ItemFoundation extends _foundation.default {
|
|
|
42
31
|
list
|
|
43
32
|
} = this.getProps();
|
|
44
33
|
|
|
45
|
-
if (index > -1 &&
|
|
34
|
+
if (index > -1 && Array.isArray(list) && list.length && (0, _isElement.default)(listWrapper)) {
|
|
46
35
|
const indexInData = index % list.length;
|
|
47
36
|
const item = list[indexInData];
|
|
48
37
|
const node = listWrapper.children[index];
|
|
49
38
|
|
|
50
39
|
this._adapter.setSelectedNode(node);
|
|
51
40
|
|
|
52
|
-
this._adapter.notifySelectItem(
|
|
41
|
+
this._adapter.notifySelectItem(Object.assign(Object.assign({}, item), {
|
|
53
42
|
value: item.value,
|
|
54
43
|
type,
|
|
55
44
|
index: indexInData
|
|
@@ -81,7 +70,7 @@ class ItemFoundation extends _foundation.default {
|
|
|
81
70
|
this._cachedSelectedNode = node;
|
|
82
71
|
|
|
83
72
|
if (cachedIndexData !== indexInData) {
|
|
84
|
-
this._adapter.notifySelectItem(
|
|
73
|
+
this._adapter.notifySelectItem(Object.assign(Object.assign({}, item), {
|
|
85
74
|
value: item.value,
|
|
86
75
|
type,
|
|
87
76
|
index: indexInData
|
|
@@ -241,15 +230,13 @@ class ItemFoundation extends _foundation.default {
|
|
|
241
230
|
|
|
242
231
|
getNearestNodeInfo(listWrapper, selector) {
|
|
243
232
|
if ((0, _isElement.default)(listWrapper) && (0, _isElement.default)(selector)) {
|
|
244
|
-
var _context;
|
|
245
|
-
|
|
246
233
|
const selectorRect = selector.getBoundingClientRect();
|
|
247
234
|
const selectorTop = selectorRect.top;
|
|
248
235
|
const itemNodes = listWrapper.querySelectorAll('li');
|
|
249
236
|
let nearestNode = null;
|
|
250
237
|
let nearestIndex = -1;
|
|
251
238
|
let nearestDistance = Infinity;
|
|
252
|
-
|
|
239
|
+
Array.from(itemNodes).map((node, index) => {
|
|
253
240
|
const rect = node.getBoundingClientRect();
|
|
254
241
|
const rectTop = rect.top;
|
|
255
242
|
const absDistance = Math.abs(rectTop - selectorTop);
|
|
@@ -282,7 +269,7 @@ class ItemFoundation extends _foundation.default {
|
|
|
282
269
|
const currentTarget = e.target;
|
|
283
270
|
const itemNodes = listWrapper.querySelectorAll(targetTagName);
|
|
284
271
|
const list = this.getProp('list');
|
|
285
|
-
const length =
|
|
272
|
+
const length = Array.isArray(list) ? list.length : 0;
|
|
286
273
|
let targetIndex = -1;
|
|
287
274
|
let indexInList = -1;
|
|
288
275
|
let infoInList = null;
|
|
@@ -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.default = void 0;
|
|
10
7
|
|
|
11
8
|
var _semiAnimation = require("@douyinfe/semi-animation");
|
|
@@ -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");
|
|
@@ -1,45 +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 _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
-
|
|
9
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
10
|
-
|
|
11
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
4
|
value: true
|
|
13
5
|
});
|
|
14
|
-
|
|
15
6
|
exports.default = void 0;
|
|
16
7
|
|
|
17
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
18
|
-
|
|
19
|
-
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
20
|
-
|
|
21
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
22
|
-
|
|
23
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
24
|
-
|
|
25
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
26
|
-
|
|
27
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
28
|
-
|
|
29
|
-
var _map2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/map"));
|
|
30
|
-
|
|
31
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
32
|
-
|
|
33
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
34
|
-
|
|
35
|
-
var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
|
|
36
|
-
|
|
37
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/keys"));
|
|
38
|
-
|
|
39
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/values"));
|
|
40
|
-
|
|
41
|
-
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/entries"));
|
|
42
|
-
|
|
43
8
|
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
44
9
|
|
|
45
10
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
@@ -60,17 +25,19 @@ var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
|
60
25
|
|
|
61
26
|
var _a11y = require("../utils/a11y");
|
|
62
27
|
|
|
63
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
64
31
|
|
|
65
|
-
function
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
66
33
|
|
|
67
34
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
68
35
|
var t = {};
|
|
69
36
|
|
|
70
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
71
38
|
|
|
72
|
-
if (s != null && typeof
|
|
73
|
-
if (
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
74
41
|
}
|
|
75
42
|
return t;
|
|
76
43
|
};
|
|
@@ -81,7 +48,7 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
81
48
|
|
|
82
49
|
class SelectFoundation extends _foundation.default {
|
|
83
50
|
constructor(adapter) {
|
|
84
|
-
super(
|
|
51
|
+
super(Object.assign({}, adapter)); // keyboard event listner
|
|
85
52
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
86
53
|
|
|
87
54
|
this._keydownHandler = null;
|
|
@@ -146,11 +113,9 @@ class SelectFoundation extends _foundation.default {
|
|
|
146
113
|
let width;
|
|
147
114
|
|
|
148
115
|
if (dropdownMatchSelectWidth) {
|
|
149
|
-
var _context;
|
|
150
|
-
|
|
151
116
|
if (style && (0, _isNumber2.default)(style.width)) {
|
|
152
117
|
width = style.width;
|
|
153
|
-
} else if (style && (0, _isString2.default)(style.width) && !
|
|
118
|
+
} else if (style && (0, _isString2.default)(style.width) && !style.width.includes('%')) {
|
|
154
119
|
width = style.width;
|
|
155
120
|
} else {
|
|
156
121
|
width = this._adapter.getTriggerWidth();
|
|
@@ -219,9 +184,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
219
184
|
switch (true) {
|
|
220
185
|
case isMultiple && Boolean(selections.size):
|
|
221
186
|
try {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
value = (0, _map.default)(_context2 = [...selections]).call(_context2, item => // At this point item1 is directly the object
|
|
187
|
+
value = [...selections].map(item => // At this point item1 is directly the object
|
|
225
188
|
onChangeWithObject ? item[1] : item[1].value);
|
|
226
189
|
} catch (error) {
|
|
227
190
|
value = [];
|
|
@@ -261,7 +224,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
261
224
|
|
|
262
225
|
if (allowCreate && this._isControlledComponent()) {
|
|
263
226
|
originalOptions = this.getState('options');
|
|
264
|
-
|
|
227
|
+
originalOptions.forEach(item => item._show = true);
|
|
265
228
|
} else {
|
|
266
229
|
// originalOptions = this.getState('options');
|
|
267
230
|
// The options in state cannot be used directly here, because it is possible to update the optionList and props.value at the same time, and the options in state are still old at this time
|
|
@@ -294,18 +257,18 @@ class SelectFoundation extends _foundation.default {
|
|
|
294
257
|
|
|
295
258
|
|
|
296
259
|
_updateSingle(propValue, originalOptions) {
|
|
297
|
-
const selections = new
|
|
260
|
+
const selections = new Map();
|
|
298
261
|
const {
|
|
299
262
|
onChangeWithObject
|
|
300
263
|
} = this.getProps(); // When onChangeWithObject is true, the defaultValue or Value passed by the props should be the object, which corresponds to the result returned by onChange, so the value of the object needs to be taken as a judgment comparison
|
|
301
264
|
|
|
302
265
|
const selectedValue = onChangeWithObject && typeof propValue !== 'undefined' ? propValue.value : propValue;
|
|
303
|
-
const selectedOptions =
|
|
266
|
+
const selectedOptions = originalOptions.filter(option => option.value === selectedValue);
|
|
304
267
|
const noMatchOptionInList = !selectedOptions.length && typeof selectedValue !== 'undefined'; // If the current value, there is a matching option in the optionList
|
|
305
268
|
|
|
306
269
|
if (selectedOptions.length) {
|
|
307
270
|
const selectedOption = selectedOptions[0];
|
|
308
|
-
const optionExist =
|
|
271
|
+
const optionExist = Object.assign({}, selectedOption); // if (onChangeWithObject) {
|
|
309
272
|
// OptionExist = {... propValue }; // value is the object with the'value 'Key
|
|
310
273
|
// }
|
|
311
274
|
|
|
@@ -320,7 +283,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
320
283
|
};
|
|
321
284
|
|
|
322
285
|
if (onChangeWithObject) {
|
|
323
|
-
optionNotExist =
|
|
286
|
+
optionNotExist = Object.assign(Object.assign({}, propValue), {
|
|
324
287
|
_notExist: true,
|
|
325
288
|
_scrollIndex: -1
|
|
326
289
|
});
|
|
@@ -337,35 +300,33 @@ class SelectFoundation extends _foundation.default {
|
|
|
337
300
|
const nowSelections = this.getState('selections');
|
|
338
301
|
let selectedOptionList = []; // Multiple selection is to determine whether it is an array to avoid the problem of defaultValue/value incoming string error
|
|
339
302
|
|
|
340
|
-
const propValueIsArray =
|
|
303
|
+
const propValueIsArray = Array.isArray(propValue);
|
|
341
304
|
this.checkMultipleProps(); // If N values are currently selected, the corresponding option data is retrieved from the current selections for retrieval. Because these selected options may not exist in the new optionList
|
|
342
305
|
|
|
343
306
|
if (nowSelections.size) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
selectedOptionList = (0, _map.default)(_context3 = [...nowSelections]).call(_context3, item => item[1]);
|
|
307
|
+
selectedOptionList = [...nowSelections].map(item => item[1]);
|
|
347
308
|
}
|
|
348
309
|
|
|
349
|
-
const selections = new
|
|
310
|
+
const selections = new Map();
|
|
350
311
|
let selectedValues = propValue;
|
|
351
312
|
const {
|
|
352
313
|
onChangeWithObject
|
|
353
314
|
} = this.getProps(); // When onChangeWithObject is true
|
|
354
315
|
|
|
355
316
|
if (onChangeWithObject && propValueIsArray) {
|
|
356
|
-
selectedValues =
|
|
317
|
+
selectedValues = propValue.map(item => item.value);
|
|
357
318
|
}
|
|
358
319
|
|
|
359
320
|
if (propValueIsArray && selectedValues.length) {
|
|
360
|
-
|
|
321
|
+
selectedValues.forEach((selectedValue, i) => {
|
|
361
322
|
// The current value exists in the current optionList
|
|
362
|
-
const index =
|
|
323
|
+
const index = originalOptions.findIndex(option => option.value === selectedValue);
|
|
363
324
|
|
|
364
325
|
if (index !== -1) {
|
|
365
326
|
selections.set(originalOptions[index].label, originalOptions[index]);
|
|
366
327
|
} else {
|
|
367
328
|
// The current value exists in the optionList that has been selected before the change, and does not exist in the current optionList, then directly take the corresponding value from the selections, no need to construct a new option
|
|
368
|
-
const indexInSelectedList =
|
|
329
|
+
const indexInSelectedList = selectedOptionList.findIndex(option => option.value === selectedValue);
|
|
369
330
|
|
|
370
331
|
if (indexInSelectedList !== -1) {
|
|
371
332
|
const option = selectedOptionList[indexInSelectedList];
|
|
@@ -377,10 +338,10 @@ class SelectFoundation extends _foundation.default {
|
|
|
377
338
|
label: selectedValue,
|
|
378
339
|
_notExist: true
|
|
379
340
|
};
|
|
380
|
-
onChangeWithObject ? optionNotExist =
|
|
341
|
+
onChangeWithObject ? optionNotExist = Object.assign(Object.assign({}, propValue[i]), {
|
|
381
342
|
_notExist: true
|
|
382
343
|
}) : null;
|
|
383
|
-
selections.set(optionNotExist.label,
|
|
344
|
+
selections.set(optionNotExist.label, Object.assign(Object.assign({}, optionNotExist), {
|
|
384
345
|
_scrollIndex: -1
|
|
385
346
|
}));
|
|
386
347
|
}
|
|
@@ -432,12 +393,11 @@ class SelectFoundation extends _foundation.default {
|
|
|
432
393
|
const options = originalOptions || this.getState('options'); // When searchable, when the drop-down box expands
|
|
433
394
|
|
|
434
395
|
if (isFilterable) {
|
|
435
|
-
var _context4;
|
|
436
|
-
|
|
437
396
|
// Also clears the options filter to show all candidates
|
|
438
397
|
// Options created dynamically but not selected are also filtered out
|
|
439
398
|
const sugInput = '';
|
|
440
|
-
|
|
399
|
+
|
|
400
|
+
const newOptions = this._filterOption(options, sugInput).filter(item => !item._inputCreateOnly);
|
|
441
401
|
|
|
442
402
|
this._adapter.updateOptions(newOptions);
|
|
443
403
|
|
|
@@ -524,12 +484,12 @@ class SelectFoundation extends _foundation.default {
|
|
|
524
484
|
} = _a,
|
|
525
485
|
rest = __rest(_a, ["value", "label"]);
|
|
526
486
|
|
|
527
|
-
const selections = new
|
|
487
|
+
const selections = new Map().set(label, Object.assign({
|
|
528
488
|
value,
|
|
529
489
|
label
|
|
530
490
|
}, rest)); // First trigger onSelect, then trigger onChange
|
|
531
491
|
|
|
532
|
-
this._notifySelect(value,
|
|
492
|
+
this._notifySelect(value, Object.assign({
|
|
533
493
|
value,
|
|
534
494
|
label
|
|
535
495
|
}, rest)); // If it is a controlled component, directly notify
|
|
@@ -567,26 +527,26 @@ class SelectFoundation extends _foundation.default {
|
|
|
567
527
|
} = this.getProps();
|
|
568
528
|
|
|
569
529
|
if (selections.has(label)) {
|
|
570
|
-
this._notifyDeselect(value,
|
|
530
|
+
this._notifyDeselect(value, Object.assign({
|
|
571
531
|
value,
|
|
572
532
|
label
|
|
573
533
|
}, rest));
|
|
574
534
|
|
|
575
535
|
selections.delete(label);
|
|
576
536
|
} else if (maxLimit && selections.size === maxLimit) {
|
|
577
|
-
this._adapter.notifyMaxLimit(
|
|
537
|
+
this._adapter.notifyMaxLimit(Object.assign({
|
|
578
538
|
value,
|
|
579
539
|
label
|
|
580
540
|
}, (0, _omit2.default)(rest, '_scrollIndex')));
|
|
581
541
|
|
|
582
542
|
return;
|
|
583
543
|
} else {
|
|
584
|
-
this._notifySelect(value,
|
|
544
|
+
this._notifySelect(value, Object.assign({
|
|
585
545
|
value,
|
|
586
546
|
label
|
|
587
547
|
}, rest));
|
|
588
548
|
|
|
589
|
-
selections.set(label,
|
|
549
|
+
selections.set(label, Object.assign({
|
|
590
550
|
value,
|
|
591
551
|
label
|
|
592
552
|
}, rest));
|
|
@@ -633,7 +593,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
633
593
|
}
|
|
634
594
|
|
|
635
595
|
clearSelected() {
|
|
636
|
-
const selections = new
|
|
596
|
+
const selections = new Map();
|
|
637
597
|
|
|
638
598
|
if (this._isControlledComponent()) {
|
|
639
599
|
this._notifyChange(selections);
|
|
@@ -665,7 +625,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
665
625
|
const {
|
|
666
626
|
allowCreate
|
|
667
627
|
} = this.getProps();
|
|
668
|
-
const newOptions =
|
|
628
|
+
const newOptions = options.map(option => {
|
|
669
629
|
if (selections.has(option.label)) {
|
|
670
630
|
option._selected = true;
|
|
671
631
|
|
|
@@ -778,13 +738,11 @@ class SelectFoundation extends _foundation.default {
|
|
|
778
738
|
} else if (typeof filter === 'boolean' && filter) {
|
|
779
739
|
// 2. When true, the default filter is used
|
|
780
740
|
const input = sugInput.toLowerCase();
|
|
781
|
-
return
|
|
782
|
-
var _context5;
|
|
783
|
-
|
|
741
|
+
return originalOptions.map(option => {
|
|
784
742
|
const label = option.label.toString().toLowerCase();
|
|
785
743
|
const groupLabel = option._parentGroup && option._parentGroup.label;
|
|
786
|
-
const matchOption =
|
|
787
|
-
const matchGroup = (0, _isString2.default)(groupLabel) &&
|
|
744
|
+
const matchOption = label.includes(input);
|
|
745
|
+
const matchGroup = (0, _isString2.default)(groupLabel) && groupLabel.toLowerCase().includes(input);
|
|
788
746
|
|
|
789
747
|
if (matchOption || matchGroup) {
|
|
790
748
|
option._show = true;
|
|
@@ -796,7 +754,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
796
754
|
});
|
|
797
755
|
} else if (typeof filter === 'function') {
|
|
798
756
|
// 3. When passing in a custom function, use a custom function for filtering
|
|
799
|
-
return
|
|
757
|
+
return originalOptions.map(option => {
|
|
800
758
|
filter(sugInput, option) ? option._show = true : option._show = false;
|
|
801
759
|
return option;
|
|
802
760
|
});
|
|
@@ -819,7 +777,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
819
777
|
};
|
|
820
778
|
let createOptionIndex = -1;
|
|
821
779
|
let matchOptionIndex = -1;
|
|
822
|
-
|
|
780
|
+
optionsAfterFilter.forEach((option, index) => {
|
|
823
781
|
if (!option._show && !option._inputCreateOnly) {
|
|
824
782
|
return;
|
|
825
783
|
} // The matching algorithm is not necessarily through labels?
|
|
@@ -842,11 +800,11 @@ class SelectFoundation extends _foundation.default {
|
|
|
842
800
|
}
|
|
843
801
|
|
|
844
802
|
if (matchOptionIndex !== -1) {
|
|
845
|
-
optionsAfterFilter =
|
|
803
|
+
optionsAfterFilter = optionsAfterFilter.filter(item => !item._inputCreateOnly);
|
|
846
804
|
}
|
|
847
805
|
} else {
|
|
848
806
|
// Delete input unselected items
|
|
849
|
-
optionsAfterFilter =
|
|
807
|
+
optionsAfterFilter = optionsAfterFilter.filter(item => !item._inputCreateOnly);
|
|
850
808
|
}
|
|
851
809
|
} // TODO Promise supports asynchronous creation
|
|
852
810
|
|
|
@@ -955,7 +913,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
955
913
|
focusIndex,
|
|
956
914
|
options
|
|
957
915
|
} = this.getStates();
|
|
958
|
-
const visibleOptions =
|
|
916
|
+
const visibleOptions = options.filter(item => item._show); // let visibleOptions = options;
|
|
959
917
|
|
|
960
918
|
const optionsLength = visibleOptions.length;
|
|
961
919
|
let index = focusIndex + offset;
|
|
@@ -1101,7 +1059,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
1101
1059
|
this.open();
|
|
1102
1060
|
} else {
|
|
1103
1061
|
if (focusIndex !== -1) {
|
|
1104
|
-
const visibleOptions =
|
|
1062
|
+
const visibleOptions = options.filter(item => item._show);
|
|
1105
1063
|
const {
|
|
1106
1064
|
length
|
|
1107
1065
|
} = visibleOptions; // fix issue 1201
|
|
@@ -1135,7 +1093,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
1135
1093
|
const length = selections.size;
|
|
1136
1094
|
|
|
1137
1095
|
if (length && !inputValue) {
|
|
1138
|
-
const keys = [...
|
|
1096
|
+
const keys = [...selections.keys()];
|
|
1139
1097
|
let index = length - 1;
|
|
1140
1098
|
let targetLabel = keys[index];
|
|
1141
1099
|
let targetItem = selections.get(targetLabel);
|
|
@@ -1168,7 +1126,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
1168
1126
|
} = this.getProps();
|
|
1169
1127
|
const stateSelections = this.getState('selections');
|
|
1170
1128
|
let notifyVal;
|
|
1171
|
-
const selectionsProps = [...
|
|
1129
|
+
const selectionsProps = [...selections.values()];
|
|
1172
1130
|
|
|
1173
1131
|
const isMultiple = this._isMultiple();
|
|
1174
1132
|
|
|
@@ -1192,7 +1150,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
1192
1150
|
break;
|
|
1193
1151
|
|
|
1194
1152
|
case !onChangeWithObject && isMultiple:
|
|
1195
|
-
notifyVal = selectionsProps.length ?
|
|
1153
|
+
notifyVal = selectionsProps.length ? selectionsProps.map(props => props.value) : [];
|
|
1196
1154
|
|
|
1197
1155
|
this._adapter.notifyChange(notifyVal);
|
|
1198
1156
|
|
|
@@ -1205,7 +1163,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
1205
1163
|
|
|
1206
1164
|
_removeInternalKey(option) {
|
|
1207
1165
|
// eslint-disable-next-line
|
|
1208
|
-
let newOption =
|
|
1166
|
+
let newOption = Object.assign({}, option);
|
|
1209
1167
|
delete newOption._parentGroup;
|
|
1210
1168
|
delete newOption._show;
|
|
1211
1169
|
delete newOption._selected;
|
|
@@ -1235,8 +1193,8 @@ class SelectFoundation extends _foundation.default {
|
|
|
1235
1193
|
let diff = true;
|
|
1236
1194
|
|
|
1237
1195
|
if (!isMultiple) {
|
|
1238
|
-
const selectionProps = [...
|
|
1239
|
-
const oldSelectionProps = [...
|
|
1196
|
+
const selectionProps = [...selections.values()];
|
|
1197
|
+
const oldSelectionProps = [...oldSelections.values()];
|
|
1240
1198
|
const optionLabel = selectionProps[0] ? selectionProps[0].label : selectionProps[0];
|
|
1241
1199
|
const oldOptionLabel = oldSelectionProps[0] ? oldSelectionProps[0].label : oldSelectionProps[0];
|
|
1242
1200
|
diff = !(0, _isEqual2.default)(optionLabel, oldOptionLabel);
|
|
@@ -1251,8 +1209,8 @@ class SelectFoundation extends _foundation.default {
|
|
|
1251
1209
|
const stateSelections = this.getState('selections');
|
|
1252
1210
|
const values = [];
|
|
1253
1211
|
|
|
1254
|
-
for (const item of
|
|
1255
|
-
let val =
|
|
1212
|
+
for (const item of selections.entries()) {
|
|
1213
|
+
let val = Object.assign({
|
|
1256
1214
|
label: item[0]
|
|
1257
1215
|
}, item[1]);
|
|
1258
1216
|
val = this._removeInternalKey(val);
|
|
@@ -1348,9 +1306,9 @@ class SelectFoundation extends _foundation.default {
|
|
|
1348
1306
|
isOpen,
|
|
1349
1307
|
isFocus
|
|
1350
1308
|
} = this.getStates(); // Under normal circumstances, blur will be accompanied by clickOutsideHandler, so the notify of blur can be called uniformly in clickOutsideHandler
|
|
1351
|
-
// But when autoFocus, because clickOutsideHandler is not register, you need to listen for the trigger's blur and trigger the notify callback
|
|
1309
|
+
// But when autoFocus or the panel is close, because clickOutsideHandler is not register or unregister, you need to listen for the trigger's blur and trigger the notify callback
|
|
1352
1310
|
|
|
1353
|
-
if (
|
|
1311
|
+
if (isFocus && !isOpen) {
|
|
1354
1312
|
this._notifyBlur(e);
|
|
1355
1313
|
}
|
|
1356
1314
|
}
|
|
@@ -1388,7 +1346,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
1388
1346
|
if (onChangeWithObject) {
|
|
1389
1347
|
selectedValues = options;
|
|
1390
1348
|
} else {
|
|
1391
|
-
selectedValues =
|
|
1349
|
+
selectedValues = options.map(option => option.value);
|
|
1392
1350
|
}
|
|
1393
1351
|
|
|
1394
1352
|
this.handleValueChange(selectedValues);
|
|
@@ -1411,7 +1369,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
1411
1369
|
} = currentProps;
|
|
1412
1370
|
const selectedValues = value || defaultValue;
|
|
1413
1371
|
|
|
1414
|
-
if (!(0, _isNullOrUndefined.default)(selectedValues) && !
|
|
1372
|
+
if (!(0, _isNullOrUndefined.default)(selectedValues) && !Array.isArray(selectedValues)) {
|
|
1415
1373
|
/* istanbul ignore next */
|
|
1416
1374
|
(0, _warning.default)(true, '[Semi Select] defaultValue/value should be array type in multiple mode');
|
|
1417
1375
|
}
|