@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
|
@@ -2,13 +2,6 @@ import _isString from "lodash/isString";
|
|
|
2
2
|
import _get from "lodash/get";
|
|
3
3
|
import _toString from "lodash/toString";
|
|
4
4
|
import _toNumber from "lodash/toNumber";
|
|
5
|
-
import _setInterval from "@babel/runtime-corejs3/core-js-stable/set-interval";
|
|
6
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
7
|
-
import _lastIndexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/last-index-of";
|
|
8
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
9
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
10
|
-
import _Number$isNaN from "@babel/runtime-corejs3/core-js-stable/number/is-nan";
|
|
11
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
12
5
|
|
|
13
6
|
/* eslint-disable max-len */
|
|
14
7
|
|
|
@@ -75,7 +68,7 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
75
68
|
_registerInterval(cb) {
|
|
76
69
|
const pressInterval = this.getProp('pressInterval') || numbers.DEFAULT_PRESS_INTERVAL;
|
|
77
70
|
this._intervalHasRegistered = true;
|
|
78
|
-
this._interval =
|
|
71
|
+
this._interval = setInterval(() => {
|
|
79
72
|
if (typeof cb === 'function' && this._intervalHasRegistered) {
|
|
80
73
|
cb();
|
|
81
74
|
}
|
|
@@ -93,7 +86,7 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
93
86
|
_registerTimer(cb) {
|
|
94
87
|
const pressTimeout = this.getProp('pressTimeout') || numbers.DEFAULT_PRESS_TIMEOUT;
|
|
95
88
|
this._timerHasRegistered = true;
|
|
96
|
-
this._timer =
|
|
89
|
+
this._timer = setTimeout(() => {
|
|
97
90
|
if (this._timerHasRegistered && typeof cb === 'function') {
|
|
98
91
|
cb();
|
|
99
92
|
}
|
|
@@ -159,14 +152,13 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
159
152
|
if (typeof toNum === 'number' && !isNaN(toNum)) {
|
|
160
153
|
formattedNum = this.doFormat(toNum, false); // console.log(`parsedStr: `, parsedStr, `toNum: `, toNum);
|
|
161
154
|
|
|
162
|
-
const dotIndex =
|
|
163
|
-
|
|
155
|
+
const dotIndex = valueAfterParser.lastIndexOf('.');
|
|
164
156
|
const lengthAfterDot = valueAfterParser.length - 1 - dotIndex;
|
|
165
157
|
|
|
166
158
|
const precLength = this._getPrecLen(toNum);
|
|
167
159
|
|
|
168
160
|
if (!precLength) {
|
|
169
|
-
const dotBeginStr = dotIndex > -1 ?
|
|
161
|
+
const dotBeginStr = dotIndex > -1 ? valueAfterParser.slice(dotIndex) : '';
|
|
170
162
|
formattedNum += dotBeginStr;
|
|
171
163
|
} else if (precLength < lengthAfterDot) {
|
|
172
164
|
// eslint-disable-next-line max-depth
|
|
@@ -473,14 +465,14 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
473
465
|
num = String(Math.abs(Number(num || '')));
|
|
474
466
|
}
|
|
475
467
|
|
|
476
|
-
const idx =
|
|
468
|
+
const idx = num.indexOf('.') + 1;
|
|
477
469
|
return idx ? num.length - idx : 0;
|
|
478
470
|
}
|
|
479
471
|
|
|
480
472
|
_adjustPrec(num) {
|
|
481
473
|
const precision = this.getProp('precision');
|
|
482
474
|
|
|
483
|
-
if (typeof precision === 'number' && num !== '' && num !== null && !
|
|
475
|
+
if (typeof precision === 'number' && num !== '' && num !== null && !Number.isNaN(Number(num))) {
|
|
484
476
|
num = Number(num).toFixed(precision);
|
|
485
477
|
}
|
|
486
478
|
|
|
@@ -570,10 +562,8 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
570
562
|
}
|
|
571
563
|
|
|
572
564
|
if (needCheckPrec && typeof value === 'string') {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
const zeroIsValid = _indexOfInstanceProperty(value).call(value, '.') === -1 || _indexOfInstanceProperty(value).call(value, '.') > -1 && (value === '0' || _lastIndexOfInstanceProperty(value).call(value, '0') < value.length - 1);
|
|
576
|
-
const dotIsValid = _lastIndexOfInstanceProperty(value).call(value, '.') < value.length - 1 && _filterInstanceProperty(_context = value.split('')).call(_context, v => v === '.').length < 2;
|
|
565
|
+
const zeroIsValid = value.indexOf('.') === -1 || value.indexOf('.') > -1 && (value === '0' || value.lastIndexOf('0') < value.length - 1);
|
|
566
|
+
const dotIsValid = value.lastIndexOf('.') < value.length - 1 && value.split('').filter(v => v === '.').length < 2;
|
|
577
567
|
|
|
578
568
|
if (!zeroIsValid || !dotIsValid // (this.getProp('precision') > 0 && this._getPrecLen(value) > this.getProp('precision'))
|
|
579
569
|
) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
1
|
import BaseFoundation from '../base/foundation';
|
|
3
2
|
import KeyCode from '../utils/keyCode';
|
|
4
3
|
export default class ModalContentFoundation extends BaseFoundation {
|
|
5
4
|
constructor(adapter) {
|
|
6
|
-
super(
|
|
5
|
+
super(Object.assign(Object.assign({}, ModalContentFoundation.defaultAdapter), adapter));
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
destroy() {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
1
|
import BaseFoundation from '../base/foundation';
|
|
3
2
|
export default class ModalFoundation extends BaseFoundation {
|
|
4
3
|
constructor(adapter) {
|
|
5
|
-
super(
|
|
4
|
+
super(Object.assign({}, adapter));
|
|
6
5
|
|
|
7
6
|
this.toggleHidden = (hidden, callback) => {
|
|
8
7
|
this._adapter.toggleHidden(hidden, callback);
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
3
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
4
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
5
1
|
import { numbers } from './constants';
|
|
6
2
|
export const DEFAULT_TOGGLE_ICON = {
|
|
7
3
|
open: 'chevron_up',
|
|
@@ -27,19 +23,17 @@ export default class NavItem {
|
|
|
27
23
|
};
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
for (const key of
|
|
26
|
+
for (const key of Object.keys(options)) {
|
|
31
27
|
this[key] = options[key];
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
if (options.items &&
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.items = _mapInstanceProperty(_context = options.items).call(_context, item => new NavItem(item));
|
|
30
|
+
if (options.items && Array.isArray(options.items) && options.items.length) {
|
|
31
|
+
this.items = options.items.map(item => new NavItem(item));
|
|
38
32
|
|
|
39
33
|
if ('toggleIcon' in options) {
|
|
40
|
-
this.toggleIcon = NavItem.isValidToggleIcon(options.toggleIcon) ?
|
|
34
|
+
this.toggleIcon = NavItem.isValidToggleIcon(options.toggleIcon) ? Object.assign({}, options.toggleIcon) : Object.assign({}, DEFAULT_TOGGLE_ICON);
|
|
41
35
|
} else {
|
|
42
|
-
this.toggleIcon =
|
|
36
|
+
this.toggleIcon = Object.assign({}, DEFAULT_TOGGLE_ICON);
|
|
43
37
|
}
|
|
44
38
|
} else {
|
|
45
39
|
this.items = null;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import _get from "lodash/get";
|
|
2
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
4
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
5
|
-
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
6
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
7
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
8
2
|
|
|
9
3
|
/* eslint-disable max-depth */
|
|
10
4
|
|
|
@@ -15,7 +9,7 @@ import { strings } from './constants';
|
|
|
15
9
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
16
10
|
export default class NavigationFoundation extends BaseFoundation {
|
|
17
11
|
constructor(adapter) {
|
|
18
|
-
super(
|
|
12
|
+
super(Object.assign({}, adapter));
|
|
19
13
|
}
|
|
20
14
|
/* istanbul ignore next */
|
|
21
15
|
|
|
@@ -30,7 +24,7 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
30
24
|
|
|
31
25
|
if (itemKeys.length) {
|
|
32
26
|
for (const itemKey of itemKeys) {
|
|
33
|
-
if (
|
|
27
|
+
if (Array.isArray(itemKeysMap[itemKey]) && itemKeysMap[itemKey].length) {
|
|
34
28
|
const levelZeroParentKey = itemKeysMap[itemKey][0];
|
|
35
29
|
|
|
36
30
|
if (!isNullOrUndefined(levelZeroParentKey)) {
|
|
@@ -49,9 +43,9 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
49
43
|
let parentKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
50
44
|
let keyPropName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'itemKey';
|
|
51
45
|
|
|
52
|
-
if (
|
|
46
|
+
if (Array.isArray(items) && items.length) {
|
|
53
47
|
for (const item of items) {
|
|
54
|
-
if (
|
|
48
|
+
if (Array.isArray(item)) {
|
|
55
49
|
NavigationFoundation.buildItemKeysMap(item, keysMap, [...parentKeys], keyPropName);
|
|
56
50
|
} else {
|
|
57
51
|
let itemKey;
|
|
@@ -63,10 +57,10 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
63
57
|
if (itemKey) {
|
|
64
58
|
keysMap[itemKey] = [...parentKeys];
|
|
65
59
|
|
|
66
|
-
if (
|
|
60
|
+
if (Array.isArray(item.items) && item.items.length) {
|
|
67
61
|
NavigationFoundation.buildItemKeysMap(item.items, keysMap, [...parentKeys, itemKey], keyPropName);
|
|
68
62
|
} else if (item.props && item.props.children) {
|
|
69
|
-
const children =
|
|
63
|
+
const children = Array.isArray(item.props.children) ? item.props.children : [item.props.children];
|
|
70
64
|
NavigationFoundation.buildItemKeysMap(children, keysMap, [...parentKeys, itemKey], keyPropName);
|
|
71
65
|
}
|
|
72
66
|
}
|
|
@@ -97,7 +91,7 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
97
91
|
formattedItems
|
|
98
92
|
} = this.getCalcState();
|
|
99
93
|
const parentSelectKeys = this.selectLevelZeroParentKeys(itemKeysMap, willSelectedKeys);
|
|
100
|
-
willSelectedKeys =
|
|
94
|
+
willSelectedKeys = willSelectedKeys.concat(parentSelectKeys);
|
|
101
95
|
|
|
102
96
|
if (lifecycle === 'constructor') {
|
|
103
97
|
return {
|
|
@@ -148,7 +142,7 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
148
142
|
children
|
|
149
143
|
} = this.getProps();
|
|
150
144
|
const formattedItems = this.formatItems(items);
|
|
151
|
-
const willHandleItems =
|
|
145
|
+
const willHandleItems = Array.isArray(items) && items.length ? formattedItems : children;
|
|
152
146
|
const itemKeysMap = NavigationFoundation.buildItemKeysMap(willHandleItems);
|
|
153
147
|
return {
|
|
154
148
|
itemKeysMap,
|
|
@@ -171,8 +165,8 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
171
165
|
} = this.getProps();
|
|
172
166
|
let willOpenKeys = openKeys || defaultOpenKeys || [];
|
|
173
167
|
|
|
174
|
-
if (!(
|
|
175
|
-
const currentSelectedKeys =
|
|
168
|
+
if (!(Array.isArray(defaultOpenKeys) || Array.isArray(openKeys)) && mode === strings.MODE_VERTICAL && (Array.isArray(defaultSelectedKeys) || Array.isArray(selectedKeys))) {
|
|
169
|
+
const currentSelectedKeys = Array.isArray(selectedKeys) ? selectedKeys : defaultSelectedKeys;
|
|
176
170
|
willOpenKeys = this.getShouldOpenKeys(itemKeysMap, currentSelectedKeys);
|
|
177
171
|
}
|
|
178
172
|
|
|
@@ -192,15 +186,15 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
192
186
|
getShouldOpenKeys() {
|
|
193
187
|
let itemKeysMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
194
188
|
let selectedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
195
|
-
const willOpenKeySet = new
|
|
189
|
+
const willOpenKeySet = new Set();
|
|
196
190
|
|
|
197
|
-
if (
|
|
198
|
-
|
|
191
|
+
if (Array.isArray(selectedKeys) && selectedKeys.length) {
|
|
192
|
+
selectedKeys.forEach(item => {
|
|
199
193
|
if (item) {
|
|
200
194
|
const parentKeys = _get(itemKeysMap, this.getItemKey(item));
|
|
201
195
|
|
|
202
|
-
if (
|
|
203
|
-
|
|
196
|
+
if (Array.isArray(parentKeys)) {
|
|
197
|
+
parentKeys.forEach(k => willOpenKeySet.add(k));
|
|
204
198
|
}
|
|
205
199
|
}
|
|
206
200
|
});
|
|
@@ -224,7 +218,7 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
224
218
|
|
|
225
219
|
if (itemKeys.length) {
|
|
226
220
|
for (const itemKey of itemKeys) {
|
|
227
|
-
if (
|
|
221
|
+
if (Array.isArray(_itemKeysMap[itemKey]) && _itemKeysMap[itemKey].length) {
|
|
228
222
|
const levelZeroParentKey = _itemKeysMap[itemKey][0];
|
|
229
223
|
|
|
230
224
|
if (!isNullOrUndefined(levelZeroParentKey)) {
|
|
@@ -261,11 +255,11 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
261
255
|
judgeIfOpen(openKeys, items) {
|
|
262
256
|
let shouldBeOpen = false;
|
|
263
257
|
|
|
264
|
-
const _openKeys =
|
|
258
|
+
const _openKeys = Array.isArray(openKeys) ? openKeys : openKeys && [openKeys];
|
|
265
259
|
|
|
266
|
-
if (_openKeys &&
|
|
260
|
+
if (_openKeys && Array.isArray(items) && items.length) {
|
|
267
261
|
for (const item of items) {
|
|
268
|
-
shouldBeOpen =
|
|
262
|
+
shouldBeOpen = _openKeys.includes(item.itemKey) || this.judgeIfOpen(_openKeys, item.items);
|
|
269
263
|
|
|
270
264
|
if (shouldBeOpen) {
|
|
271
265
|
break;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
|
|
3
1
|
/* argus-disable unPkgSensitiveInfo */
|
|
4
2
|
import BaseFoundation from '../base/foundation';
|
|
5
3
|
import isEnterPress from '../utils/isEnterPress';
|
|
6
4
|
export default class ItemFoundation extends BaseFoundation {
|
|
7
5
|
constructor(adapter) {
|
|
8
|
-
super(
|
|
6
|
+
super(Object.assign({}, adapter));
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
init() {
|
|
@@ -1,39 +1,33 @@
|
|
|
1
|
-
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
2
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
3
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
4
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
5
1
|
import BaseFoundation from '../base/foundation';
|
|
6
2
|
import isEnterPress from '../utils/isEnterPress';
|
|
7
3
|
|
|
8
4
|
const addKeys = function addKeys() {
|
|
9
5
|
let originKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
10
|
-
const keySet = new
|
|
6
|
+
const keySet = new Set(originKeys);
|
|
11
7
|
|
|
12
8
|
for (var _len = arguments.length, willAddKeys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
13
9
|
willAddKeys[_key - 1] = arguments[_key];
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return _Array$from(keySet);
|
|
12
|
+
willAddKeys.forEach(key => key && keySet.add(key));
|
|
13
|
+
return Array.from(keySet);
|
|
19
14
|
};
|
|
20
15
|
|
|
21
16
|
const removeKeys = function removeKeys() {
|
|
22
17
|
let originKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
23
|
-
const keySet = new
|
|
18
|
+
const keySet = new Set(originKeys);
|
|
24
19
|
|
|
25
20
|
for (var _len2 = arguments.length, willRemoveKeys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
26
21
|
willRemoveKeys[_key2 - 1] = arguments[_key2];
|
|
27
22
|
}
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return _Array$from(keySet);
|
|
24
|
+
willRemoveKeys.forEach(key => key && keySet.delete(key));
|
|
25
|
+
return Array.from(keySet);
|
|
32
26
|
};
|
|
33
27
|
|
|
34
28
|
export default class SubNavFoundation extends BaseFoundation {
|
|
35
29
|
constructor(adapter) {
|
|
36
|
-
super(
|
|
30
|
+
super(Object.assign({}, adapter));
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
init() {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _isNumber from "lodash/isNumber";
|
|
2
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
4
2
|
import BaseFoundation from '../base/foundation';
|
|
5
3
|
export default class NotificationFoundation extends BaseFoundation {
|
|
6
4
|
constructor(adapter) {
|
|
7
|
-
super(
|
|
5
|
+
super(Object.assign(Object.assign({}, NotificationFoundation.defaultAdapter), adapter));
|
|
8
6
|
this._timer = null;
|
|
9
7
|
this._id = null; // cache id
|
|
10
8
|
}
|
|
@@ -24,7 +22,7 @@ export default class NotificationFoundation extends BaseFoundation {
|
|
|
24
22
|
const duration = this.getProp('duration');
|
|
25
23
|
|
|
26
24
|
if (duration && _isNumber(duration)) {
|
|
27
|
-
this._timer =
|
|
25
|
+
this._timer = setTimeout(() => {
|
|
28
26
|
this.close(); // call parent to remove itself
|
|
29
27
|
}, duration * 1000);
|
|
30
28
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
2
|
-
|
|
3
1
|
/* eslint-disable no-useless-constructor */
|
|
4
2
|
import BaseFoundation from '../base/foundation';
|
|
5
3
|
export default class NotificationListFoundation extends BaseFoundation {
|
|
@@ -22,7 +20,7 @@ export default class NotificationListFoundation extends BaseFoundation {
|
|
|
22
20
|
|
|
23
21
|
|
|
24
22
|
const removedItems = [];
|
|
25
|
-
notices =
|
|
23
|
+
notices = notices.filter(notice => {
|
|
26
24
|
if (notice.id === id) {
|
|
27
25
|
removedItems.push(notice);
|
|
28
26
|
return false;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
2
1
|
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
3
2
|
const cssClasses = {
|
|
4
3
|
PREFIX: BASE_CLASS_PREFIX + '-overflow-list'
|
|
@@ -17,9 +16,9 @@ const OVERFLOW_DIR = {
|
|
|
17
16
|
SHRINK: 2
|
|
18
17
|
};
|
|
19
18
|
const strings = {
|
|
20
|
-
BOUNDARY_SET:
|
|
19
|
+
BOUNDARY_SET: Object.values(BOUNDARY_MAP),
|
|
21
20
|
POSITION_SET: ['vertical', 'horizontal'],
|
|
22
|
-
MODE_SET:
|
|
21
|
+
MODE_SET: Object.values(MODE_MAP),
|
|
23
22
|
MODE_MAP,
|
|
24
23
|
BOUNDARY_MAP,
|
|
25
24
|
OVERFLOW_DIR
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import _cloneDeep from "lodash/cloneDeep";
|
|
2
2
|
import _get from "lodash/get";
|
|
3
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
4
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
5
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
6
|
-
import _lastIndexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/last-index-of";
|
|
7
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
8
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
9
|
-
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
|
|
10
3
|
import BaseFoundation from '../base/foundation';
|
|
11
4
|
import { strings } from './constants';
|
|
12
5
|
const Boundary = strings.BOUNDARY_MAP;
|
|
@@ -14,7 +7,7 @@ const OverflowDirection = strings.OVERFLOW_DIR;
|
|
|
14
7
|
|
|
15
8
|
class OverflowListFoundation extends BaseFoundation {
|
|
16
9
|
constructor(adapter) {
|
|
17
|
-
super(
|
|
10
|
+
super(Object.assign({}, adapter));
|
|
18
11
|
this.previousY = undefined;
|
|
19
12
|
|
|
20
13
|
this.isScrollMode = () => {
|
|
@@ -38,20 +31,17 @@ class OverflowListFoundation extends BaseFoundation {
|
|
|
38
31
|
return overflow;
|
|
39
32
|
}
|
|
40
33
|
|
|
41
|
-
const visibleStateArr =
|
|
34
|
+
const visibleStateArr = items.map(_ref => {
|
|
42
35
|
let {
|
|
43
36
|
key
|
|
44
37
|
} = _ref;
|
|
45
38
|
return Boolean(visibleState.get(key));
|
|
46
39
|
});
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const visibleEnd = _lastIndexOfInstanceProperty(visibleStateArr).call(visibleStateArr, true);
|
|
51
|
-
|
|
40
|
+
const visibleStart = visibleStateArr.indexOf(true);
|
|
41
|
+
const visibleEnd = visibleStateArr.lastIndexOf(true);
|
|
52
42
|
const overflowList = [];
|
|
53
|
-
overflowList[0] = visibleStart >= 0 ?
|
|
54
|
-
overflowList[1] = visibleEnd >= 0 ?
|
|
43
|
+
overflowList[0] = visibleStart >= 0 ? items.slice(0, visibleStart) : [];
|
|
44
|
+
overflowList[1] = visibleEnd >= 0 ? items.slice(visibleEnd + 1, items.length) : items;
|
|
55
45
|
return overflowList;
|
|
56
46
|
}
|
|
57
47
|
|
|
@@ -59,18 +49,16 @@ class OverflowListFoundation extends BaseFoundation {
|
|
|
59
49
|
const visibleState = _cloneDeep(this.getState('visibleState'));
|
|
60
50
|
|
|
61
51
|
const res = {};
|
|
62
|
-
|
|
63
|
-
_forEachInstanceProperty(entries).call(entries, entry => {
|
|
52
|
+
entries.forEach(entry => {
|
|
64
53
|
const itemKey = _get(entry, 'target.dataset.scrollkey');
|
|
65
54
|
|
|
66
55
|
const visible = entry.isIntersecting;
|
|
67
56
|
res[itemKey] = entry;
|
|
68
57
|
visibleState.set(itemKey, visible);
|
|
69
58
|
});
|
|
70
|
-
|
|
71
59
|
let someItemVisible = false;
|
|
72
60
|
|
|
73
|
-
for (const value of
|
|
61
|
+
for (const value of visibleState.values()) {
|
|
74
62
|
if (value) {
|
|
75
63
|
someItemVisible = true;
|
|
76
64
|
break;
|
|
@@ -128,9 +116,7 @@ class OverflowListFoundation extends BaseFoundation {
|
|
|
128
116
|
|
|
129
117
|
if (growing === OverflowDirection.SHRINK && visible.length > minVisibleItems) {
|
|
130
118
|
const collapseFromStart = collapseFrom === Boundary.START;
|
|
131
|
-
|
|
132
|
-
const newVisible = _sliceInstanceProperty(visible).call(visible);
|
|
133
|
-
|
|
119
|
+
const newVisible = visible.slice();
|
|
134
120
|
const next = collapseFromStart ? newVisible.shift() : newVisible.pop();
|
|
135
121
|
|
|
136
122
|
if (next !== undefined) {
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
3
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
4
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
5
|
-
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
6
|
-
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
7
|
-
import _Number$isNaN from "@babel/runtime-corejs3/core-js-stable/number/is-nan";
|
|
8
|
-
|
|
9
1
|
/* eslint-disable max-len */
|
|
10
2
|
|
|
11
3
|
/* eslint-disable no-param-reassign */
|
|
@@ -14,7 +6,7 @@ import { numbers } from './constants';
|
|
|
14
6
|
|
|
15
7
|
class PaginationFoundation extends BaseFoundation {
|
|
16
8
|
constructor(adapter) {
|
|
17
|
-
super(
|
|
9
|
+
super(Object.assign({}, adapter));
|
|
18
10
|
}
|
|
19
11
|
|
|
20
12
|
init() {
|
|
@@ -161,8 +153,6 @@ class PaginationFoundation extends BaseFoundation {
|
|
|
161
153
|
}
|
|
162
154
|
|
|
163
155
|
_updatePageList(pageListInfo) {
|
|
164
|
-
var _context, _context2;
|
|
165
|
-
|
|
166
156
|
const {
|
|
167
157
|
currentPage,
|
|
168
158
|
total,
|
|
@@ -199,7 +189,7 @@ class PaginationFoundation extends BaseFoundation {
|
|
|
199
189
|
} = numbers;
|
|
200
190
|
|
|
201
191
|
if (totalPageNum <= PAGE_SHOW_MAX) {
|
|
202
|
-
pageList =
|
|
192
|
+
pageList = Array.from({
|
|
203
193
|
length: totalPageNum
|
|
204
194
|
}, (v, i) => i + 1);
|
|
205
195
|
restLeftPageList = [];
|
|
@@ -209,7 +199,7 @@ class PaginationFoundation extends BaseFoundation {
|
|
|
209
199
|
case currentPage < 4:
|
|
210
200
|
pageList = [1, 2, 3, 4, '...', totalPageNum - 1, totalPageNum]; // length: (totalPageNum - 1) - 4
|
|
211
201
|
|
|
212
|
-
restRightPageList =
|
|
202
|
+
restRightPageList = Array.from({
|
|
213
203
|
length: Math.min(totalPageNum - 6, REST_PAGE_MAX_SIZE)
|
|
214
204
|
}, (v, i) => i + 5);
|
|
215
205
|
restLeftPageList = [];
|
|
@@ -217,35 +207,33 @@ class PaginationFoundation extends BaseFoundation {
|
|
|
217
207
|
|
|
218
208
|
case currentPage === 4:
|
|
219
209
|
pageList = [1, 2, 3, 4, 5, '...', totalPageNum];
|
|
220
|
-
restRightPageList =
|
|
210
|
+
restRightPageList = Array.from({
|
|
221
211
|
length: Math.min(totalPageNum - 6, REST_PAGE_MAX_SIZE)
|
|
222
212
|
}, (v, i) => i + 6);
|
|
223
213
|
restLeftPageList = [];
|
|
224
214
|
break;
|
|
225
215
|
|
|
226
216
|
case 4 < currentPage && currentPage < totalPageNum - 3:
|
|
227
|
-
const middle =
|
|
217
|
+
const middle = Array.from({
|
|
228
218
|
length: 3
|
|
229
219
|
}, (v, i) => currentPage + (i - 1));
|
|
220
|
+
pageList = [1].concat('...', middle, '...', totalPageNum); // length: total-(currentPage+1)-1
|
|
230
221
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
restRightPageList = _Array$from({
|
|
222
|
+
restRightPageList = Array.from({
|
|
234
223
|
length: Math.min(totalPageNum - currentPage - 2, REST_PAGE_MAX_SIZE)
|
|
235
224
|
}, (v, i) => currentPage + i + 2);
|
|
236
|
-
restLeftPageList =
|
|
225
|
+
restLeftPageList = Array.from({
|
|
237
226
|
length: Math.min(currentPage - 3, REST_PAGE_MAX_SIZE)
|
|
238
227
|
}, (v, i) => i + 2);
|
|
239
228
|
break;
|
|
240
229
|
|
|
241
230
|
case currentPage - 3 <= currentPage && currentPage <= totalPageNum:
|
|
242
|
-
const right =
|
|
231
|
+
const right = Array.from({
|
|
243
232
|
length: 5
|
|
244
233
|
}, (v, i) => totalPageNum - (4 - i));
|
|
245
|
-
|
|
246
|
-
pageList = _concatInstanceProperty(_context2 = [1, '...']).call(_context2, right);
|
|
234
|
+
pageList = [1, '...'].concat(right);
|
|
247
235
|
restRightPageList = [];
|
|
248
|
-
restLeftPageList =
|
|
236
|
+
restLeftPageList = Array.from({
|
|
249
237
|
length: Math.min(right[0] - 2, REST_PAGE_MAX_SIZE)
|
|
250
238
|
}, (v, i) => i + 2);
|
|
251
239
|
break;
|
|
@@ -303,10 +291,9 @@ class PaginationFoundation extends BaseFoundation {
|
|
|
303
291
|
} = this.getStates();
|
|
304
292
|
const newPageSizeOpts = [...pageSizeOpts];
|
|
305
293
|
|
|
306
|
-
if (
|
|
307
|
-
const firstLargerIndex =
|
|
308
|
-
|
|
309
|
-
_spliceInstanceProperty(newPageSizeOpts).call(newPageSizeOpts, firstLargerIndex, 0, pageSize);
|
|
294
|
+
if (newPageSizeOpts.indexOf(pageSize) === -1) {
|
|
295
|
+
const firstLargerIndex = newPageSizeOpts.findIndex(el => el > pageSize);
|
|
296
|
+
newPageSizeOpts.splice(firstLargerIndex, 0, pageSize);
|
|
310
297
|
}
|
|
311
298
|
|
|
312
299
|
return newPageSizeOpts;
|
|
@@ -325,7 +312,7 @@ class PaginationFoundation extends BaseFoundation {
|
|
|
325
312
|
|
|
326
313
|
const totalPageNum = this._getTotalPageNumber(total, pageSize);
|
|
327
314
|
|
|
328
|
-
if (
|
|
315
|
+
if (Number.isNaN(page)) {
|
|
329
316
|
return;
|
|
330
317
|
} // If the user input is greater than totalPage
|
|
331
318
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
1
|
import { numbers as tooltipNumbers } from '../tooltip/constants';
|
|
3
2
|
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
4
3
|
const cssClasses = {
|
|
@@ -16,7 +15,7 @@ const strings = {
|
|
|
16
15
|
}
|
|
17
16
|
};
|
|
18
17
|
const numbers = {
|
|
19
|
-
ARROW_BOUNDING:
|
|
18
|
+
ARROW_BOUNDING: Object.assign(Object.assign({}, tooltipNumbers.ARROW_BOUNDING), {
|
|
20
19
|
offsetY: 6,
|
|
21
20
|
offsetX: 0,
|
|
22
21
|
height: 8
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
1
|
import BaseFoundation from '../base/foundation';
|
|
3
2
|
export default class RadioGroupFoundation extends BaseFoundation {
|
|
4
3
|
constructor(adapter) {
|
|
5
|
-
super(
|
|
4
|
+
super(Object.assign({}, adapter));
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
init() {
|
|
@@ -37,8 +36,8 @@ export default class RadioGroupFoundation extends BaseFoundation {
|
|
|
37
36
|
|
|
38
37
|
const isControlledComponent = this._adapter.isInProps('value');
|
|
39
38
|
|
|
40
|
-
const cbValue =
|
|
41
|
-
target:
|
|
39
|
+
const cbValue = Object.assign(Object.assign({}, evt), {
|
|
40
|
+
target: Object.assign(Object.assign({}, evt.target), {
|
|
42
41
|
value
|
|
43
42
|
})
|
|
44
43
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
1
|
import BaseFoundation from '../base/foundation';
|
|
3
2
|
export default class RadioInnerFoundation extends BaseFoundation {
|
|
4
3
|
constructor(adapter) {
|
|
5
|
-
super(
|
|
4
|
+
super(Object.assign({}, adapter));
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
init() {
|
|
@@ -36,7 +35,7 @@ export default class RadioInnerFoundation extends BaseFoundation {
|
|
|
36
35
|
};
|
|
37
36
|
|
|
38
37
|
const cbValue = {
|
|
39
|
-
target:
|
|
38
|
+
target: Object.assign(Object.assign({}, this.getProps()), {
|
|
40
39
|
checked
|
|
41
40
|
}),
|
|
42
41
|
stopPropagation,
|