@douyinfe/semi-foundation 2.19.0-alpha.8 → 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/popconfirm.css +1 -7
- package/lib/cjs/popconfirm/popconfirm.scss +1 -11
- 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/sideSheet.css +1 -0
- package/lib/cjs/sideSheet/sideSheet.scss +1 -0
- 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 +32 -33
- 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/mixin.scss +2 -2
- package/lib/cjs/table/rtl.scss +8 -8
- package/lib/cjs/table/table.scss +16 -16
- 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/table/variables.scss +0 -3
- 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/tree.css +3 -0
- package/lib/cjs/tree/tree.scss +4 -0
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- 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.d.ts +1 -1
- 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/popconfirm/popconfirm.css +1 -7
- package/lib/es/popconfirm/popconfirm.scss +1 -11
- 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/sideSheet.css +1 -0
- package/lib/es/sideSheet/sideSheet.scss +1 -0
- package/lib/es/sideSheet/sideSheetFoundation.js +3 -7
- package/lib/es/slider/foundation.js +29 -25
- 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/mixin.scss +2 -2
- package/lib/es/table/rtl.scss +8 -8
- package/lib/es/table/table.scss +16 -16
- package/lib/es/table/utils.js +33 -51
- package/lib/es/table/variables.scss +0 -3
- 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/tree.css +3 -0
- package/lib/es/tree/tree.scss +4 -0
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/tree/treeUtil.js +57 -109
- package/lib/es/treeSelect/foundation.js +45 -73
- package/lib/es/upload/constants.d.ts +1 -1
- 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/popconfirm/popconfirm.scss +1 -11
- package/select/foundation.ts +2 -2
- package/sideSheet/sideSheet.scss +1 -0
- package/slider/foundation.ts +15 -8
- package/table/mixin.scss +2 -2
- package/table/rtl.scss +8 -8
- package/table/table.scss +16 -16
- package/table/variables.scss +0 -3
- package/tree/tree.scss +4 -0
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import _split from "lodash/split";
|
|
2
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
4
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
5
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
7
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
8
2
|
|
|
9
3
|
/* eslint-disable max-len */
|
|
10
4
|
import { strings } from './constants';
|
|
@@ -16,7 +10,7 @@ import isNullOrUndefined from '../utils/isNullOrUndefined'; // TODO: split, time
|
|
|
16
10
|
|
|
17
11
|
class TimePickerFoundation extends BaseFoundation {
|
|
18
12
|
constructor(adapter) {
|
|
19
|
-
super(
|
|
13
|
+
super(Object.assign({}, adapter));
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
init() {
|
|
@@ -55,11 +49,9 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
55
49
|
}
|
|
56
50
|
|
|
57
51
|
isValidTimeZone(timeZone) {
|
|
58
|
-
var _context;
|
|
59
|
-
|
|
60
52
|
const _timeZone = timeZone === undefined ? this.getProp('timeZone') : timeZone;
|
|
61
53
|
|
|
62
|
-
return
|
|
54
|
+
return ['string', 'number'].includes(typeof _timeZone) && _timeZone !== '';
|
|
63
55
|
}
|
|
64
56
|
|
|
65
57
|
getDefaultFormatIfNeed() {
|
|
@@ -87,24 +79,21 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
87
79
|
} = this.getProps();
|
|
88
80
|
value = value || defaultValue;
|
|
89
81
|
|
|
90
|
-
if (!
|
|
82
|
+
if (!Array.isArray(value)) {
|
|
91
83
|
value = value ? [value] : [];
|
|
92
84
|
}
|
|
93
85
|
|
|
94
86
|
const parsedValues = [];
|
|
95
87
|
let invalid = false;
|
|
96
|
-
|
|
97
|
-
_forEachInstanceProperty(value).call(value, v => {
|
|
88
|
+
value.forEach(v => {
|
|
98
89
|
const pv = parseToDate(v, formatToken, dateFnsLocale);
|
|
99
90
|
|
|
100
91
|
if (!isNaN(pv.getTime())) {
|
|
101
92
|
parsedValues.push(this.isValidTimeZone() ? utcToZonedTime(pv, timeZone) : pv);
|
|
102
93
|
}
|
|
103
94
|
});
|
|
104
|
-
|
|
105
95
|
const isAM = [true, false];
|
|
106
|
-
|
|
107
|
-
_mapInstanceProperty(parsedValues).call(parsedValues, (item, idx) => {
|
|
96
|
+
parsedValues.map((item, idx) => {
|
|
108
97
|
isAM[idx] = getHours(item) < 12;
|
|
109
98
|
});
|
|
110
99
|
|
|
@@ -121,7 +110,7 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
121
110
|
let inputValue = '';
|
|
122
111
|
|
|
123
112
|
if (!invalid) {
|
|
124
|
-
inputValue =
|
|
113
|
+
inputValue = value.map(v => formatToString(v, formatToken, dateFnsLocale)).join(rangeSeparator);
|
|
125
114
|
}
|
|
126
115
|
|
|
127
116
|
this.setState({
|
|
@@ -197,7 +186,7 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
197
186
|
|
|
198
187
|
if (!invalid) {
|
|
199
188
|
if (this.isValidTimeZone(timeZone)) {
|
|
200
|
-
dates =
|
|
189
|
+
dates = dates.map(date => utcToZonedTime(this.isValidTimeZone(__prevTimeZone) ? zonedTimeToUtc(date, __prevTimeZone) : date, timeZone));
|
|
201
190
|
}
|
|
202
191
|
|
|
203
192
|
const inputValue = this.formatValue(dates);
|
|
@@ -275,7 +264,7 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
275
264
|
* -when emptying, the input is "', at this time you need to skip isTimeFormatLike judgment
|
|
276
265
|
*/
|
|
277
266
|
|
|
278
|
-
if (input !== '' &&
|
|
267
|
+
if (input !== '' && inputValues.some(time => !isTimeFormatLike(time, formatToken))) {
|
|
279
268
|
return;
|
|
280
269
|
}
|
|
281
270
|
|
|
@@ -306,7 +295,7 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
306
295
|
doValidate(args) {
|
|
307
296
|
if (typeof args === 'string') {
|
|
308
297
|
return this.validateStr(args);
|
|
309
|
-
} else if (
|
|
298
|
+
} else if (Array.isArray(args)) {
|
|
310
299
|
return this.validateDates(args);
|
|
311
300
|
}
|
|
312
301
|
|
|
@@ -321,11 +310,10 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
321
310
|
|
|
322
311
|
validateDates() {
|
|
323
312
|
let dates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
324
|
-
|
|
325
|
-
let invalid = _someInstanceProperty(dates).call(dates, d => isNaN(Number(d)));
|
|
313
|
+
let invalid = dates.some(d => isNaN(Number(d)));
|
|
326
314
|
|
|
327
315
|
if (!invalid) {
|
|
328
|
-
invalid =
|
|
316
|
+
invalid = dates.some(d => this.isDisabledHMS({
|
|
329
317
|
hours: d.getHours(),
|
|
330
318
|
minutes: d.getMinutes(),
|
|
331
319
|
seconds: d.getSeconds()
|
|
@@ -366,12 +354,12 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
366
354
|
const dateFnsLocale = this.getProp('dateFnsLocale');
|
|
367
355
|
let _dates = dates;
|
|
368
356
|
|
|
369
|
-
if (_dates && !
|
|
357
|
+
if (_dates && !Array.isArray(_dates)) {
|
|
370
358
|
_dates = _dates[_dates];
|
|
371
359
|
}
|
|
372
360
|
|
|
373
|
-
if (_dates &&
|
|
374
|
-
return
|
|
361
|
+
if (_dates && Array.isArray(_dates)) {
|
|
362
|
+
return _dates.map(date => formatToString(date, validFormat, dateFnsLocale)).join(rangeSeparator);
|
|
375
363
|
}
|
|
376
364
|
|
|
377
365
|
return undefined;
|
|
@@ -383,9 +371,7 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
383
371
|
const dateFnsLocale = this.getProp('dateFnsLocale');
|
|
384
372
|
|
|
385
373
|
if (str && typeof str === 'string') {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
return _mapInstanceProperty(_context2 = _split(str, rangeSeparator)).call(_context2, v => parseToDate(v, validFormat, dateFnsLocale));
|
|
374
|
+
return _split(str, rangeSeparator).map(v => parseToDate(v, validFormat, dateFnsLocale));
|
|
389
375
|
}
|
|
390
376
|
|
|
391
377
|
return [];
|
|
@@ -397,12 +383,12 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
397
383
|
const dateFnsLocale = this.getProp('dateFnsLocale');
|
|
398
384
|
let _value = value;
|
|
399
385
|
|
|
400
|
-
if (!
|
|
386
|
+
if (!Array.isArray(_value)) {
|
|
401
387
|
_value = _value ? [_value] : [];
|
|
402
388
|
}
|
|
403
389
|
|
|
404
|
-
if (
|
|
405
|
-
return
|
|
390
|
+
if (Array.isArray(_value)) {
|
|
391
|
+
return _value.map(v => parseToDate(v, formatToken, dateFnsLocale));
|
|
406
392
|
}
|
|
407
393
|
|
|
408
394
|
return [];
|
|
@@ -417,15 +403,15 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
417
403
|
const rangeSeparator = this.getProp('rangeSeparator');
|
|
418
404
|
str = _split(inputValue, rangeSeparator);
|
|
419
405
|
} else {
|
|
420
|
-
_value =
|
|
406
|
+
_value = Array.isArray(_value) ? _value[0] : _value;
|
|
421
407
|
}
|
|
422
408
|
|
|
423
409
|
if (this.isValidTimeZone() && _value) {
|
|
424
410
|
const formatToken = this.getValidFormat();
|
|
425
411
|
|
|
426
|
-
if (
|
|
427
|
-
_value =
|
|
428
|
-
str =
|
|
412
|
+
if (Array.isArray(_value)) {
|
|
413
|
+
_value = _value.map(v => zonedTimeToUtc(v, timeZone));
|
|
414
|
+
str = _value.map(v => format(v, formatToken));
|
|
429
415
|
} else {
|
|
430
416
|
_value = zonedTimeToUtc(_value, timeZone);
|
|
431
417
|
str = format(_value, formatToken);
|
|
@@ -446,7 +432,7 @@ class TimePickerFoundation extends BaseFoundation {
|
|
|
446
432
|
let oldDates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
447
433
|
const formatToken = this.getValidFormat();
|
|
448
434
|
const dateFnsLocale = this.getProp('dateFnsLocale');
|
|
449
|
-
return dates.length !== oldDates.length ||
|
|
435
|
+
return dates.length !== oldDates.length || dates.some((date, index) => {
|
|
450
436
|
const oldDate = oldDates[index];
|
|
451
437
|
|
|
452
438
|
if (isValid(date) && isValid(oldDate) && formatToString(date, formatToken, dateFnsLocale) === formatToString(oldDate, formatToken, dateFnsLocale)) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
1
|
import BaseFoundation from '../base/foundation';
|
|
3
2
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
4
3
|
|
|
5
4
|
class TimePickerFoundation extends BaseFoundation {
|
|
6
5
|
constructor(adapter) {
|
|
7
|
-
super(
|
|
6
|
+
super(Object.assign({}, adapter));
|
|
8
7
|
} // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
9
8
|
|
|
10
9
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _toNumber from "lodash/toNumber";
|
|
2
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
3
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
4
2
|
|
|
5
3
|
/* eslint-disable max-len */
|
|
6
4
|
import { format, parse } from 'date-fns';
|
|
@@ -64,7 +62,7 @@ export const hourIsDisabled = (disabledHours, hour) => {
|
|
|
64
62
|
if (typeof disabledHours === 'function') {
|
|
65
63
|
const disabledOptions = disabledHours();
|
|
66
64
|
|
|
67
|
-
if (
|
|
65
|
+
if (Array.isArray(disabledOptions) && !isNullOrUndefined(hour) && disabledOptions.some(v => _toNumber(v) === _toNumber(hour))) {
|
|
68
66
|
return true;
|
|
69
67
|
}
|
|
70
68
|
}
|
|
@@ -75,7 +73,7 @@ export const minuteIsDisabled = (disabledMinutes, hour, minute) => {
|
|
|
75
73
|
if (typeof disabledMinutes === 'function') {
|
|
76
74
|
const disabledOptions = disabledMinutes(hour);
|
|
77
75
|
|
|
78
|
-
if (
|
|
76
|
+
if (Array.isArray(disabledOptions) && !isNullOrUndefined(hour) && !isNullOrUndefined(minute) && disabledOptions.some(v => _toNumber(v) === _toNumber(minute))) {
|
|
79
77
|
return true;
|
|
80
78
|
}
|
|
81
79
|
}
|
|
@@ -86,7 +84,7 @@ export const secondIsDisabled = (disabledSeconds, hour, minute, second) => {
|
|
|
86
84
|
if (typeof disabledSeconds === 'function') {
|
|
87
85
|
const disabledOptions = disabledSeconds(hour, minute);
|
|
88
86
|
|
|
89
|
-
if (
|
|
87
|
+
if (Array.isArray(disabledOptions) && !isNullOrUndefined(hour) && !isNullOrUndefined(minute) && !isNullOrUndefined(second) && disabledOptions.some(v => _toNumber(v) === _toNumber(second))) {
|
|
90
88
|
return true;
|
|
91
89
|
}
|
|
92
90
|
}
|
|
@@ -94,7 +92,7 @@ export const secondIsDisabled = (disabledSeconds, hour, minute, second) => {
|
|
|
94
92
|
return false;
|
|
95
93
|
};
|
|
96
94
|
export const transformToArray = value => {
|
|
97
|
-
if (!
|
|
95
|
+
if (!Array.isArray(value)) {
|
|
98
96
|
return [];
|
|
99
97
|
} else {
|
|
100
98
|
return [...value];
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
1
|
import { format as dateFnsFormat, parse as dateFnsParse } from 'date-fns';
|
|
3
2
|
/* istanbul ignore next */
|
|
4
3
|
|
|
5
4
|
const replace = function replace(str, replacements) {
|
|
6
5
|
let _str = str;
|
|
7
6
|
|
|
8
|
-
for (const key of
|
|
7
|
+
for (const key of Object.keys(replacements)) {
|
|
9
8
|
if (typeof replacements[key] === 'string') {
|
|
10
9
|
_str = _str.replace(key, replacements[key]);
|
|
11
10
|
}
|
|
@@ -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 ToastFoundation extends BaseFoundation {
|
|
6
4
|
constructor(adapter) {
|
|
7
|
-
super(
|
|
5
|
+
super(Object.assign(Object.assign({}, ToastFoundation.defaultAdapter), adapter));
|
|
8
6
|
this._timer = null;
|
|
9
7
|
this._id = null; // cache id
|
|
10
8
|
}
|
|
@@ -23,7 +21,7 @@ export default class ToastFoundation extends BaseFoundation {
|
|
|
23
21
|
const duration = this._adapter.getProp('duration');
|
|
24
22
|
|
|
25
23
|
if (duration && _isNumber(duration)) {
|
|
26
|
-
this._timer =
|
|
24
|
+
this._timer = setTimeout(() => {
|
|
27
25
|
this.close(); // call parent to remove itself
|
|
28
26
|
}, duration * 1000);
|
|
29
27
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
3
1
|
import BaseFoundation from '../base/foundation';
|
|
4
2
|
export default class ToastListFoundation extends BaseFoundation {
|
|
5
3
|
constructor(adapter) {
|
|
6
|
-
super(
|
|
4
|
+
super(Object.assign(Object.assign({}, ToastListFoundation.defaultAdapter), adapter));
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
addToast(toastOpts) {
|
|
@@ -22,7 +20,7 @@ export default class ToastListFoundation extends BaseFoundation {
|
|
|
22
20
|
let toastList = this._adapter.getState('list');
|
|
23
21
|
|
|
24
22
|
const removedItems = [];
|
|
25
|
-
toastList =
|
|
23
|
+
toastList = toastList.filter(toastOpts => {
|
|
26
24
|
if (toastOpts.id === id) {
|
|
27
25
|
removedItems.push(toastOpts);
|
|
28
26
|
return false;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import _isEmpty from "lodash/isEmpty";
|
|
2
2
|
import _get from "lodash/get";
|
|
3
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
4
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
5
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
6
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
7
|
-
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
8
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
9
3
|
import BaseFoundation from '../base/foundation';
|
|
10
4
|
import { handlePrevent } from '../utils/a11y';
|
|
11
5
|
const REGS = {
|
|
@@ -26,7 +20,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
26
20
|
constructor(adapter) {
|
|
27
21
|
var _this;
|
|
28
22
|
|
|
29
|
-
super(
|
|
23
|
+
super(Object.assign({}, adapter));
|
|
30
24
|
_this = this;
|
|
31
25
|
|
|
32
26
|
this.onResize = () => {
|
|
@@ -40,7 +34,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
40
34
|
this.clearDelayTimer();
|
|
41
35
|
|
|
42
36
|
if (mouseEnterDelay > 0) {
|
|
43
|
-
this._timer =
|
|
37
|
+
this._timer = setTimeout(() => {
|
|
44
38
|
this.show();
|
|
45
39
|
this.clearDelayTimer();
|
|
46
40
|
}, mouseEnterDelay);
|
|
@@ -112,9 +106,9 @@ export default class Tooltip extends BaseFoundation {
|
|
|
112
106
|
|
|
113
107
|
this.calcPosition = function (triggerRect, wrapperRect, containerRect) {
|
|
114
108
|
let shouldUpdatePos = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
115
|
-
triggerRect = (_isEmpty(triggerRect) ? _this._adapter.getTriggerBounding() : triggerRect) ||
|
|
116
|
-
containerRect = (_isEmpty(containerRect) ? _this._adapter.getPopupContainerRect() : containerRect) ||
|
|
117
|
-
wrapperRect = (_isEmpty(wrapperRect) ? _this._adapter.getWrapperBounding() : wrapperRect) ||
|
|
109
|
+
triggerRect = (_isEmpty(triggerRect) ? _this._adapter.getTriggerBounding() : triggerRect) || Object.assign({}, defaultRect);
|
|
110
|
+
containerRect = (_isEmpty(containerRect) ? _this._adapter.getPopupContainerRect() : containerRect) || Object.assign({}, defaultRect);
|
|
111
|
+
wrapperRect = (_isEmpty(wrapperRect) ? _this._adapter.getWrapperBounding() : wrapperRect) || Object.assign({}, defaultRect); // console.log('containerRect: ', containerRect, 'triggerRect: ', triggerRect, 'wrapperRect: ', wrapperRect);
|
|
118
112
|
|
|
119
113
|
let style = _this.calcPosStyle(triggerRect, wrapperRect, containerRect);
|
|
120
114
|
|
|
@@ -132,7 +126,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
132
126
|
|
|
133
127
|
if (shouldUpdatePos && _this._mounted) {
|
|
134
128
|
// this._adapter.updatePlacementAttr(style.position);
|
|
135
|
-
_this._adapter.setPosition(
|
|
129
|
+
_this._adapter.setPosition(Object.assign(Object.assign({}, style), {
|
|
136
130
|
position
|
|
137
131
|
}));
|
|
138
132
|
}
|
|
@@ -145,7 +139,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
145
139
|
this.clearDelayTimer();
|
|
146
140
|
|
|
147
141
|
if (mouseLeaveDelay > 0) {
|
|
148
|
-
this._timer =
|
|
142
|
+
this._timer = setTimeout(() => {
|
|
149
143
|
// console.log('delayHide for ', mouseLeaveDelay, ' ms, ', ...args);
|
|
150
144
|
this.hide();
|
|
151
145
|
this.clearDelayTimer();
|
|
@@ -374,7 +368,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
374
368
|
!disableFocusListener && this.delayHide();
|
|
375
369
|
};
|
|
376
370
|
|
|
377
|
-
portalEventSet =
|
|
371
|
+
portalEventSet = Object.assign({}, triggerEventSet);
|
|
378
372
|
|
|
379
373
|
if (this.getProp('clickToHide')) {
|
|
380
374
|
portalEventSet[eventNames.click] = () => {
|
|
@@ -442,46 +436,34 @@ export default class Tooltip extends BaseFoundation {
|
|
|
442
436
|
calcTransformOrigin(position, triggerRect, translateX, translateY) {
|
|
443
437
|
// eslint-disable-next-line
|
|
444
438
|
if (position && triggerRect && translateX != null && translateY != null) {
|
|
445
|
-
var _context9;
|
|
446
|
-
|
|
447
439
|
if (this.getProp('transformFromCenter')) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
if (_includesInstanceProperty(_context = ['topLeft', 'bottomLeft']).call(_context, position)) {
|
|
451
|
-
var _context2;
|
|
452
|
-
|
|
453
|
-
return _concatInstanceProperty(_context2 = "".concat(this._roundPixel(triggerRect.width / 2), "px ")).call(_context2, -translateY * 100, "%");
|
|
440
|
+
if (['topLeft', 'bottomLeft'].includes(position)) {
|
|
441
|
+
return "".concat(this._roundPixel(triggerRect.width / 2), "px ").concat(-translateY * 100, "%");
|
|
454
442
|
}
|
|
455
443
|
|
|
456
|
-
if (
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
return _concatInstanceProperty(_context4 = "calc(100% - ".concat(this._roundPixel(triggerRect.width / 2), "px) ")).call(_context4, -translateY * 100, "%");
|
|
444
|
+
if (['topRight', 'bottomRight'].includes(position)) {
|
|
445
|
+
return "calc(100% - ".concat(this._roundPixel(triggerRect.width / 2), "px) ").concat(-translateY * 100, "%");
|
|
460
446
|
}
|
|
461
447
|
|
|
462
|
-
if (
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
return _concatInstanceProperty(_context6 = "".concat(-translateX * 100, "% ")).call(_context6, this._roundPixel(triggerRect.height / 2), "px");
|
|
448
|
+
if (['leftTop', 'rightTop'].includes(position)) {
|
|
449
|
+
return "".concat(-translateX * 100, "% ").concat(this._roundPixel(triggerRect.height / 2), "px");
|
|
466
450
|
}
|
|
467
451
|
|
|
468
|
-
if (
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
return _concatInstanceProperty(_context8 = "".concat(-translateX * 100, "% calc(100% - ")).call(_context8, this._roundPixel(triggerRect.height / 2), "px)");
|
|
452
|
+
if (['leftBottom', 'rightBottom'].includes(position)) {
|
|
453
|
+
return "".concat(-translateX * 100, "% calc(100% - ").concat(this._roundPixel(triggerRect.height / 2), "px)");
|
|
472
454
|
}
|
|
473
455
|
}
|
|
474
456
|
|
|
475
|
-
return
|
|
457
|
+
return "".concat(-translateX * 100, "% ").concat(-translateY * 100, "%");
|
|
476
458
|
}
|
|
477
459
|
|
|
478
460
|
return null;
|
|
479
461
|
}
|
|
480
462
|
|
|
481
463
|
calcPosStyle(triggerRect, wrapperRect, containerRect, position, spacing) {
|
|
482
|
-
triggerRect = (_isEmpty(triggerRect) ? triggerRect : this._adapter.getTriggerBounding()) ||
|
|
483
|
-
containerRect = (_isEmpty(containerRect) ? containerRect : this._adapter.getPopupContainerRect()) ||
|
|
484
|
-
wrapperRect = (_isEmpty(wrapperRect) ? wrapperRect : this._adapter.getWrapperBounding()) ||
|
|
464
|
+
triggerRect = (_isEmpty(triggerRect) ? triggerRect : this._adapter.getTriggerBounding()) || Object.assign({}, defaultRect);
|
|
465
|
+
containerRect = (_isEmpty(containerRect) ? containerRect : this._adapter.getPopupContainerRect()) || Object.assign({}, defaultRect);
|
|
466
|
+
wrapperRect = (_isEmpty(wrapperRect) ? wrapperRect : this._adapter.getWrapperBounding()) || Object.assign({}, defaultRect); // eslint-disable-next-line
|
|
485
467
|
|
|
486
468
|
position = position != null ? position : this.getProp('position'); // eslint-disable-next-line
|
|
487
469
|
|
|
@@ -649,8 +631,8 @@ export default class Tooltip extends BaseFoundation {
|
|
|
649
631
|
if (this.getProp('showArrow') && !arrowPointAtCenter && triggerHeight <= (verticalArrowHeight / 2 + arrowOffsetY) * 2) {
|
|
650
632
|
const offsetY = triggerHeight / 2 - (arrowOffsetY + verticalArrowHeight / 2);
|
|
651
633
|
|
|
652
|
-
if ((
|
|
653
|
-
top =
|
|
634
|
+
if ((position.includes('Top') || position.includes('Bottom')) && !position.includes('Over')) {
|
|
635
|
+
top = position.includes('Top') ? top + offsetY : top - offsetY;
|
|
654
636
|
}
|
|
655
637
|
} // The left/top value here must be rounded, otherwise it will cause the small triangle to shake
|
|
656
638
|
|
|
@@ -663,8 +645,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
663
645
|
|
|
664
646
|
if (translateX != null) {
|
|
665
647
|
transform += "translateX(".concat(translateX * 100, "%) ");
|
|
666
|
-
|
|
667
|
-
_Object$defineProperty(style, 'translateX', {
|
|
648
|
+
Object.defineProperty(style, 'translateX', {
|
|
668
649
|
enumerable: false,
|
|
669
650
|
value: translateX
|
|
670
651
|
});
|
|
@@ -673,8 +654,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
673
654
|
|
|
674
655
|
if (translateY != null) {
|
|
675
656
|
transform += "translateY(".concat(translateY * 100, "%) ");
|
|
676
|
-
|
|
677
|
-
_Object$defineProperty(style, 'translateY', {
|
|
657
|
+
Object.defineProperty(style, 'translateY', {
|
|
678
658
|
enumerable: false,
|
|
679
659
|
value: translateY
|
|
680
660
|
});
|
|
@@ -694,12 +674,12 @@ export default class Tooltip extends BaseFoundation {
|
|
|
694
674
|
|
|
695
675
|
isLR() {
|
|
696
676
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
697
|
-
return
|
|
677
|
+
return position.indexOf('left') === 0 || position.indexOf('right') === 0;
|
|
698
678
|
}
|
|
699
679
|
|
|
700
680
|
isTB() {
|
|
701
681
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
702
|
-
return
|
|
682
|
+
return position.indexOf('top') === 0 || position.indexOf('bottom') === 0;
|
|
703
683
|
} // place the dom correctly
|
|
704
684
|
|
|
705
685
|
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import _omit from "lodash/omit";
|
|
2
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
4
|
-
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
5
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
6
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
7
|
-
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
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
2
|
import BaseFoundation from '../base/foundation';
|
|
11
3
|
import { strings } from './constants';
|
|
12
4
|
import { _generateGroupedData, _generateTreeData } from './transferUtils';
|
|
@@ -14,7 +6,7 @@ import arrayMove from '../utils/arrayMove'; // eslint-disable-next-line max-len
|
|
|
14
6
|
|
|
15
7
|
export default class TransferFoundation extends BaseFoundation {
|
|
16
8
|
constructor(adapter) {
|
|
17
|
-
super(
|
|
9
|
+
super(Object.assign({}, adapter));
|
|
18
10
|
}
|
|
19
11
|
|
|
20
12
|
_generateGroupedData(dataSource) {
|
|
@@ -29,7 +21,7 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
29
21
|
const {
|
|
30
22
|
path = []
|
|
31
23
|
} = item;
|
|
32
|
-
return
|
|
24
|
+
return path.map(p => p.label).join(' > ');
|
|
33
25
|
}
|
|
34
26
|
|
|
35
27
|
handleInputChange(inputVal) {
|
|
@@ -42,7 +34,7 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
42
34
|
} = this.getProps();
|
|
43
35
|
|
|
44
36
|
if (type === strings.TYPE_TREE_TO_LIST) {
|
|
45
|
-
const searchResult = new
|
|
37
|
+
const searchResult = new Set(data.map(item => item.key));
|
|
46
38
|
|
|
47
39
|
this._adapter.searchTree(inputVal);
|
|
48
40
|
|
|
@@ -55,15 +47,9 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
55
47
|
return;
|
|
56
48
|
}
|
|
57
49
|
|
|
58
|
-
const filterFunc = typeof filter === 'function' ? item => filter(inputVal, item) : item =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return typeof item.label === 'string' && _includesInstanceProperty(_context = item.label).call(_context, inputVal);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const searchData = _filterInstanceProperty(data).call(data, filterFunc);
|
|
65
|
-
|
|
66
|
-
const searchResult = new _Set(_mapInstanceProperty(searchData).call(searchData, item => item.key));
|
|
50
|
+
const filterFunc = typeof filter === 'function' ? item => filter(inputVal, item) : item => typeof item.label === 'string' && item.label.includes(inputVal);
|
|
51
|
+
const searchData = data.filter(filterFunc);
|
|
52
|
+
const searchResult = new Set(searchData.map(item => item.key));
|
|
67
53
|
|
|
68
54
|
this._adapter.notifySearch(inputVal);
|
|
69
55
|
|
|
@@ -91,27 +77,24 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
91
77
|
|
|
92
78
|
const inSearchMode = inputValue !== '';
|
|
93
79
|
let operateData = [];
|
|
94
|
-
operateData = inSearchMode ?
|
|
80
|
+
operateData = inSearchMode ? data.filter(item => searchResult.has(item.key)) : data;
|
|
95
81
|
operateData = type === strings.TYPE_TREE_TO_LIST ? data : operateData;
|
|
96
|
-
let newSelectedItems = new
|
|
82
|
+
let newSelectedItems = new Map();
|
|
97
83
|
|
|
98
84
|
switch (true) {
|
|
99
85
|
case !wantAllChecked:
|
|
100
|
-
newSelectedItems = new
|
|
101
|
-
|
|
102
|
-
_forEachInstanceProperty(operateData).call(operateData, item => {
|
|
86
|
+
newSelectedItems = new Map(selectedItems);
|
|
87
|
+
operateData.forEach(item => {
|
|
103
88
|
// If the item is disabled, keep it
|
|
104
89
|
if (!item.disabled) {
|
|
105
90
|
newSelectedItems.delete(item.key);
|
|
106
91
|
}
|
|
107
92
|
});
|
|
108
|
-
|
|
109
93
|
break;
|
|
110
94
|
|
|
111
95
|
case wantAllChecked:
|
|
112
|
-
newSelectedItems = new
|
|
113
|
-
|
|
114
|
-
_forEachInstanceProperty(operateData).call(operateData, item => {
|
|
96
|
+
newSelectedItems = new Map(selectedItems);
|
|
97
|
+
operateData.forEach(item => {
|
|
115
98
|
if (item.disabled) {
|
|
116
99
|
// The disabled item, judge whether it is selected, if it is selected, still need to add the selection
|
|
117
100
|
if (selectedItems.has(item.key)) {
|
|
@@ -123,7 +106,6 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
123
106
|
|
|
124
107
|
newSelectedItems.set(item.key, item);
|
|
125
108
|
});
|
|
126
|
-
|
|
127
109
|
break;
|
|
128
110
|
|
|
129
111
|
default:
|
|
@@ -150,9 +132,8 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
150
132
|
return;
|
|
151
133
|
}
|
|
152
134
|
|
|
153
|
-
const newSelectedItems = new
|
|
154
|
-
|
|
155
|
-
_forEachInstanceProperty(data).call(data, item => {
|
|
135
|
+
const newSelectedItems = new Map(selectedItems);
|
|
136
|
+
data.forEach(item => {
|
|
156
137
|
// If the item is disabled, keep it
|
|
157
138
|
if (!item.disabled) {
|
|
158
139
|
newSelectedItems.delete(item.key);
|
|
@@ -204,17 +185,15 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
204
185
|
const {
|
|
205
186
|
data
|
|
206
187
|
} = this.getStates();
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
const allItemsMap = new _Map(dataItems);
|
|
211
|
-
const nextSelectedItemsMap = new _Map();
|
|
188
|
+
const dataItems = data.map(d => [d.value, d]);
|
|
189
|
+
const allItemsMap = new Map(dataItems);
|
|
190
|
+
const nextSelectedItemsMap = new Map();
|
|
212
191
|
|
|
213
192
|
if (disabled) {
|
|
214
193
|
return;
|
|
215
194
|
}
|
|
216
195
|
|
|
217
|
-
|
|
196
|
+
values.forEach(value => {
|
|
218
197
|
const node = allItemsMap.get(value); // The value passed in is an array of the value used, but the internal selectedItems stores a map of keys
|
|
219
198
|
|
|
220
199
|
if (selectedItems.has(node.key)) {
|
|
@@ -273,11 +252,10 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
273
252
|
|
|
274
253
|
const selectedItems = this._adapter.getSelected();
|
|
275
254
|
|
|
276
|
-
let selectedArr = [...
|
|
255
|
+
let selectedArr = [...selectedItems.values()];
|
|
277
256
|
selectedArr = arrayMove(selectedArr, oldIndex, newIndex);
|
|
278
|
-
let newSelectedItems = new
|
|
279
|
-
|
|
280
|
-
_forEachInstanceProperty(selectedArr).call(selectedArr, option => {
|
|
257
|
+
let newSelectedItems = new Map();
|
|
258
|
+
selectedArr.forEach(option => {
|
|
281
259
|
newSelectedItems = newSelectedItems.set(option.key, option);
|
|
282
260
|
});
|
|
283
261
|
|