@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,15 +1,6 @@
|
|
|
1
1
|
import _isEqual from "lodash/isEqual";
|
|
2
2
|
import _isSet from "lodash/isSet";
|
|
3
3
|
import _includes from "lodash/includes";
|
|
4
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
5
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
6
|
-
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
7
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
8
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
9
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
10
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
11
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
12
|
-
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
|
|
13
4
|
|
|
14
5
|
/* eslint-disable max-len */
|
|
15
6
|
import BaseFoundation from '../base/foundation';
|
|
@@ -33,7 +24,7 @@ const dateCalcFns = {
|
|
|
33
24
|
};
|
|
34
25
|
export default class MonthsGridFoundation extends BaseFoundation {
|
|
35
26
|
constructor(adapter) {
|
|
36
|
-
super(
|
|
27
|
+
super(Object.assign({}, adapter)); // Date change data when double panels
|
|
37
28
|
|
|
38
29
|
this.newBiMonthPanelDate = [this.getState('monthLeft').pickerDate, this.getState('monthRight').pickerDate];
|
|
39
30
|
}
|
|
@@ -92,10 +83,10 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
92
83
|
default:
|
|
93
84
|
break;
|
|
94
85
|
}
|
|
95
|
-
} else if (
|
|
86
|
+
} else if (Array.isArray(values) && !values.length || !values) {
|
|
96
87
|
// Empty panel when value is empty Select date
|
|
97
88
|
if (_isSet(selected) && selected.size) {
|
|
98
|
-
this._adapter.updateDaySelected(new
|
|
89
|
+
this._adapter.updateDaySelected(new Set());
|
|
99
90
|
}
|
|
100
91
|
|
|
101
92
|
if (rangeStart) {
|
|
@@ -109,14 +100,12 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
109
100
|
}
|
|
110
101
|
|
|
111
102
|
calcDisabledTime(panelType) {
|
|
112
|
-
var _context;
|
|
113
|
-
|
|
114
103
|
const {
|
|
115
104
|
disabledTime,
|
|
116
105
|
type
|
|
117
106
|
} = this.getProps();
|
|
118
107
|
|
|
119
|
-
if (typeof disabledTime === 'function' && panelType &&
|
|
108
|
+
if (typeof disabledTime === 'function' && panelType && ['dateTime', 'dateTimeRange'].includes(type)) {
|
|
120
109
|
const {
|
|
121
110
|
rangeStart,
|
|
122
111
|
rangeEnd,
|
|
@@ -136,8 +125,7 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
136
125
|
selected.push(monthLeft.showDate);
|
|
137
126
|
}
|
|
138
127
|
|
|
139
|
-
const selectedDates =
|
|
140
|
-
|
|
128
|
+
const selectedDates = selected.map(str => str instanceof Date ? str : parseISO(str));
|
|
141
129
|
const cbDates = type === 'dateTimeRange' ? selectedDates : selectedDates[0];
|
|
142
130
|
return disabledTime(cbDates, panelType);
|
|
143
131
|
}
|
|
@@ -146,18 +134,16 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
146
134
|
_initDatePickerFromValue(values) {
|
|
147
135
|
let refreshPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
148
136
|
const monthLeft = this.getState('monthLeft');
|
|
149
|
-
|
|
150
|
-
const newMonthLeft = _Object$assign({}, monthLeft); // REMOVE:
|
|
151
|
-
|
|
137
|
+
const newMonthLeft = Object.assign({}, monthLeft); // REMOVE:
|
|
152
138
|
|
|
153
139
|
this._adapter.updateMonthOnLeft(newMonthLeft);
|
|
154
140
|
|
|
155
|
-
const newSelected = new
|
|
141
|
+
const newSelected = new Set();
|
|
156
142
|
|
|
157
143
|
if (!this._isMultiple()) {
|
|
158
144
|
values[0] && newSelected.add(format(values[0], strings.FORMAT_FULL_DATE));
|
|
159
145
|
} else {
|
|
160
|
-
|
|
146
|
+
values.forEach(date => {
|
|
161
147
|
date && newSelected.add(format(date, strings.FORMAT_FULL_DATE));
|
|
162
148
|
});
|
|
163
149
|
}
|
|
@@ -178,9 +164,9 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
178
164
|
const monthLeft = this.getState('monthLeft');
|
|
179
165
|
const monthRight = this.getState('monthRight');
|
|
180
166
|
|
|
181
|
-
const adjustResult = this._autoAdjustMonth(
|
|
167
|
+
const adjustResult = this._autoAdjustMonth(Object.assign(Object.assign({}, monthLeft), {
|
|
182
168
|
pickerDate: values[0] || monthLeft.pickerDate
|
|
183
|
-
}),
|
|
169
|
+
}), Object.assign(Object.assign({}, monthRight), {
|
|
184
170
|
pickerDate: values[1] || monthRight.pickerDate
|
|
185
171
|
}));
|
|
186
172
|
|
|
@@ -405,13 +391,11 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
405
391
|
}
|
|
406
392
|
|
|
407
393
|
isValidTimeZone(timeZone) {
|
|
408
|
-
var _context2;
|
|
409
|
-
|
|
410
394
|
const propTimeZone = this.getProp('timeZone');
|
|
411
395
|
|
|
412
396
|
const _timeZone = isNullOrUndefined(timeZone) ? propTimeZone : timeZone;
|
|
413
397
|
|
|
414
|
-
return
|
|
398
|
+
return ['string', 'number'].includes(typeof _timeZone) && _timeZone !== '';
|
|
415
399
|
}
|
|
416
400
|
/**
|
|
417
401
|
* 根据 type 处理 onChange 返回的参数
|
|
@@ -443,11 +427,11 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
443
427
|
|
|
444
428
|
|
|
445
429
|
disposeCallbackArgs(value) {
|
|
446
|
-
let _value =
|
|
430
|
+
let _value = Array.isArray(value) ? value : value && [value] || [];
|
|
447
431
|
|
|
448
432
|
if (this.isValidTimeZone()) {
|
|
449
433
|
const timeZone = this.getProp('timeZone');
|
|
450
|
-
_value =
|
|
434
|
+
_value = _value.map(date => zonedTimeToUtc(date, timeZone));
|
|
451
435
|
}
|
|
452
436
|
|
|
453
437
|
const type = this.getProp('type');
|
|
@@ -462,7 +446,7 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
462
446
|
notifyValue = _value[0] && this.localeFormat(_value[0], formatToken);
|
|
463
447
|
[notifyDate] = _value;
|
|
464
448
|
} else {
|
|
465
|
-
notifyValue =
|
|
449
|
+
notifyValue = _value.map(v => v && this.localeFormat(v, formatToken));
|
|
466
450
|
notifyDate = [..._value];
|
|
467
451
|
}
|
|
468
452
|
|
|
@@ -470,7 +454,7 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
470
454
|
|
|
471
455
|
case 'dateRange':
|
|
472
456
|
case 'dateTimeRange':
|
|
473
|
-
notifyValue =
|
|
457
|
+
notifyValue = _value.map(v => v && this.localeFormat(v, formatToken));
|
|
474
458
|
notifyDate = [..._value];
|
|
475
459
|
break;
|
|
476
460
|
|
|
@@ -557,35 +541,41 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
557
541
|
|
|
558
542
|
|
|
559
543
|
updateDateAfterChangeYM(type, targetDate) {
|
|
560
|
-
var _context3;
|
|
561
|
-
|
|
562
544
|
const {
|
|
563
545
|
multiple,
|
|
564
|
-
disabledDate
|
|
546
|
+
disabledDate,
|
|
547
|
+
type: dateType
|
|
565
548
|
} = this.getProps();
|
|
566
549
|
const {
|
|
567
550
|
selected: selectedSet,
|
|
568
551
|
rangeStart,
|
|
569
|
-
rangeEnd
|
|
552
|
+
rangeEnd,
|
|
553
|
+
monthLeft
|
|
570
554
|
} = this.getStates(); // FIXME:
|
|
571
555
|
|
|
572
|
-
const includeRange =
|
|
573
|
-
|
|
556
|
+
const includeRange = ['dateRange', 'dateTimeRange'].includes(type);
|
|
574
557
|
const options = {
|
|
575
558
|
closePanel: false
|
|
576
559
|
};
|
|
577
560
|
|
|
578
561
|
if (!multiple && !includeRange && selectedSet.size) {
|
|
579
|
-
const selectedStr =
|
|
580
|
-
|
|
562
|
+
const selectedStr = Array.from(selectedSet)[0];
|
|
581
563
|
const selectedDate = new Date(selectedStr);
|
|
582
564
|
const year = targetDate.getFullYear();
|
|
583
565
|
const month = targetDate.getMonth();
|
|
584
|
-
|
|
566
|
+
let fullDate = set(selectedDate, {
|
|
585
567
|
year,
|
|
586
568
|
month
|
|
587
569
|
});
|
|
588
570
|
|
|
571
|
+
if (dateType === 'dateTime') {
|
|
572
|
+
/**
|
|
573
|
+
* 如果是 type dateTime 切换月份要读取只取的time
|
|
574
|
+
* 无论 monthLeft 还是 monthRight 他们的 time 是不变的,所以只取 monthLeft 即可
|
|
575
|
+
*/
|
|
576
|
+
fullDate = this._mergeDateAndTime(fullDate, monthLeft.pickerDate);
|
|
577
|
+
}
|
|
578
|
+
|
|
589
579
|
if (disabledDate(fullDate, {
|
|
590
580
|
rangeStart,
|
|
591
581
|
rangeEnd
|
|
@@ -622,8 +612,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
622
612
|
}
|
|
623
613
|
|
|
624
614
|
handleDateSelected(day, panelType) {
|
|
625
|
-
var _context4;
|
|
626
|
-
|
|
627
615
|
const {
|
|
628
616
|
max,
|
|
629
617
|
type,
|
|
@@ -639,7 +627,7 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
639
627
|
|
|
640
628
|
const monthDetail = this._getPanelDetail(panelType);
|
|
641
629
|
|
|
642
|
-
const newSelected = new
|
|
630
|
+
const newSelected = new Set(multiple ? [...selected] : []);
|
|
643
631
|
const {
|
|
644
632
|
fullDate
|
|
645
633
|
} = day;
|
|
@@ -660,8 +648,7 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
660
648
|
|
|
661
649
|
const dateFormat = this.getValidDateFormat(); // When passed to the upper layer, it is converted into a Date object to ensure that the input parameter format of initFormDefaultValue is consistent
|
|
662
650
|
|
|
663
|
-
const newSelectedDates =
|
|
664
|
-
|
|
651
|
+
const newSelectedDates = [...newSelected].map(_dateStr => compatibleParse(_dateStr, dateFormat, undefined, dateFnsLocale));
|
|
665
652
|
this.handleShowDateAndTime(panelType, time);
|
|
666
653
|
|
|
667
654
|
if (!isControlledComponent) {
|
|
@@ -691,14 +678,12 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
691
678
|
|
|
692
679
|
|
|
693
680
|
_mergeDateAndTime(date, time) {
|
|
694
|
-
var _context5;
|
|
695
|
-
|
|
696
681
|
const dateFnsLocale = this._adapter.getProp('dateFnsLocale');
|
|
697
682
|
|
|
698
683
|
const dateStr = format(isValidDate(date) ? date : compatibleParse(date, strings.FORMAT_FULL_DATE, undefined, dateFnsLocale), strings.FORMAT_FULL_DATE);
|
|
699
684
|
const timeStr = format(isValidDate(time) ? time : compatibleParse(time, strings.FORMAT_TIME_PICKER, undefined, dateFnsLocale), strings.FORMAT_TIME_PICKER);
|
|
700
685
|
const timeFormat = this.getValidTimeFormat();
|
|
701
|
-
return compatibleParse(
|
|
686
|
+
return compatibleParse("".concat(dateStr, " ").concat(timeStr), timeFormat, undefined, dateFnsLocale);
|
|
702
687
|
}
|
|
703
688
|
|
|
704
689
|
handleRangeSelected(day) {
|
|
@@ -730,7 +715,7 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
730
715
|
if (rangeInputFocus === 'rangeEnd') {
|
|
731
716
|
rangeEnd = fullDate; // rangStart Parten in dateTime: 'yyyy-MM-dd HH:MM:SS', rangeEnd parten: 'yyyy-MM-dd'
|
|
732
717
|
|
|
733
|
-
if (rangeStart && rangeEnd && isBefore(rangeEnd,
|
|
718
|
+
if (rangeStart && rangeEnd && isBefore(rangeEnd, rangeStart.trim().split(/\s+/)[0])) {
|
|
734
719
|
rangeStart = null;
|
|
735
720
|
rangeStartReset = true;
|
|
736
721
|
} // Compatible to select date after opening the panel without click input
|
|
@@ -738,7 +723,7 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
738
723
|
} else if (rangeInputFocus === 'rangeStart' || !rangeInputFocus) {
|
|
739
724
|
rangeStart = fullDate; // rangEnd Parten in dateTime: 'yyyy-MM-dd HH:MM:SS', rangeStart parten: 'yyyy-MM-dd'
|
|
740
725
|
|
|
741
|
-
if (rangeStart && rangeEnd && isBefore(
|
|
726
|
+
if (rangeStart && rangeEnd && isBefore(rangeEnd.trim().split(/\s+/)[0], rangeStart)) {
|
|
742
727
|
rangeEnd = null;
|
|
743
728
|
rangeEndReset = true;
|
|
744
729
|
}
|
|
@@ -854,12 +839,12 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
854
839
|
|
|
855
840
|
if (difference > 0) {
|
|
856
841
|
// The month on the left is larger than the month on the right, swap
|
|
857
|
-
newMonthLeft =
|
|
858
|
-
newMonthRight =
|
|
842
|
+
newMonthLeft = Object.assign({}, monthRight);
|
|
843
|
+
newMonthRight = Object.assign({}, monthLeft);
|
|
859
844
|
} else if (difference === 0) {
|
|
860
845
|
// Around the same month, the number of months on the right + 1
|
|
861
846
|
newMonthLeft = monthLeft;
|
|
862
|
-
newMonthRight =
|
|
847
|
+
newMonthRight = Object.assign(Object.assign({}, monthRight), {
|
|
863
848
|
pickerDate: addMonths(monthRight.pickerDate, 1)
|
|
864
849
|
});
|
|
865
850
|
}
|
|
@@ -1007,9 +992,9 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
1007
992
|
} = this.getStates();
|
|
1008
993
|
|
|
1009
994
|
if (panelType === strings.PANEL_TYPE_RIGHT) {
|
|
1010
|
-
this._adapter.updateMonthOnRight(
|
|
995
|
+
this._adapter.updateMonthOnRight(Object.assign(Object.assign({}, monthRight), kvs));
|
|
1011
996
|
} else {
|
|
1012
|
-
this._adapter.updateMonthOnLeft(
|
|
997
|
+
this._adapter.updateMonthOnLeft(Object.assign(Object.assign({}, monthLeft), kvs));
|
|
1013
998
|
}
|
|
1014
999
|
}
|
|
1015
1000
|
|
|
@@ -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 YearAndMonthFoundation extends BaseFoundation {
|
|
4
3
|
constructor(adapter) {
|
|
5
|
-
super(
|
|
4
|
+
super(Object.assign({}, adapter));
|
|
6
5
|
} // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
7
6
|
|
|
8
7
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
2
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
3
1
|
import BaseFoundation from '../base/foundation';
|
|
4
2
|
import { handlePrevent, setFocusToFirstItem, setFocusToLastItem } from '../utils/a11y';
|
|
5
3
|
export default class DropdownFoundation extends BaseFoundation {
|
|
@@ -10,12 +8,10 @@ export default class DropdownFoundation extends BaseFoundation {
|
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
getMenuItemNodes(target) {
|
|
13
|
-
var _context;
|
|
14
|
-
|
|
15
11
|
const id = target.attributes['data-popupid'].value;
|
|
16
12
|
const menuWrapper = document.getElementById(id); // if has dropdown item, the item must wrapped by li
|
|
17
13
|
|
|
18
|
-
return menuWrapper ?
|
|
14
|
+
return menuWrapper ? Array.from(menuWrapper.getElementsByTagName('li')).filter(item => item.ariaDisabled === "false") : null;
|
|
19
15
|
}
|
|
20
16
|
|
|
21
17
|
setFocusToFirstMenuItem(target) {
|
|
@@ -32,8 +28,9 @@ export default class DropdownFoundation extends BaseFoundation {
|
|
|
32
28
|
switch (event.key) {
|
|
33
29
|
case ' ':
|
|
34
30
|
case 'Enter':
|
|
35
|
-
event.target.click();
|
|
36
|
-
handlePrevent(event);
|
|
31
|
+
event.target.click(); // user may use input to be the trigger and bind some key event on it, so do not stoppropagation
|
|
32
|
+
// handlePrevent(event);
|
|
33
|
+
|
|
37
34
|
break;
|
|
38
35
|
|
|
39
36
|
case 'ArrowDown':
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
2
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
3
|
-
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
|
|
4
|
-
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
5
1
|
import BaseFoundation from '../base/foundation';
|
|
6
2
|
import { handlePrevent, isPrintableCharacter, findIndexByCharacter, getAncestorNodeByRole, getMenuButton, setFocusToFirstItem, setFocusToItem, setFocusToNextMenuitem, setFocusToPreviousMenuItem } from '../utils/a11y';
|
|
7
3
|
export default class DropdownMenuFoundation extends BaseFoundation {
|
|
@@ -16,10 +12,8 @@ export default class DropdownMenuFoundation extends BaseFoundation {
|
|
|
16
12
|
const trigger = this._adapter.getContext('trigger');
|
|
17
13
|
|
|
18
14
|
if (trigger === 'click') {
|
|
19
|
-
var _context;
|
|
20
|
-
|
|
21
15
|
// find all non-disabled li under this menu and set focus to the first menu
|
|
22
|
-
this.menuItemNodes =
|
|
16
|
+
this.menuItemNodes = [...ulElement.getElementsByTagName('li')].filter(item => item.ariaDisabled !== "true");
|
|
23
17
|
setFocusToFirstItem(this.menuItemNodes);
|
|
24
18
|
}
|
|
25
19
|
}
|
|
@@ -42,37 +36,30 @@ export default class DropdownMenuFoundation extends BaseFoundation {
|
|
|
42
36
|
}
|
|
43
37
|
|
|
44
38
|
onMenuKeydown(event) {
|
|
45
|
-
var _context5;
|
|
46
|
-
|
|
47
39
|
const menu = getAncestorNodeByRole(event.target, 'tooltip');
|
|
48
40
|
|
|
49
41
|
if (!this.menuItemNodes) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.menuItemNodes = _filterInstanceProperty(_context2 = [...event.target.parentNode.getElementsByTagName('li')]).call(_context2, item => item.ariaDisabled !== "true");
|
|
42
|
+
this.menuItemNodes = [...event.target.parentNode.getElementsByTagName('li')].filter(item => item.ariaDisabled !== "true");
|
|
53
43
|
}
|
|
54
44
|
|
|
55
45
|
if (this.firstChars.length === 0) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
_forEachInstanceProperty(_context3 = this.menuItemNodes).call(_context3, item => {
|
|
59
|
-
var _context4;
|
|
60
|
-
|
|
46
|
+
this.menuItemNodes.forEach(item => {
|
|
61
47
|
var _a; // the menuItemNodes can be an component and not exit textContent
|
|
62
48
|
|
|
63
49
|
|
|
64
|
-
this.firstChars.push((_a =
|
|
50
|
+
this.firstChars.push((_a = item.textContent.trim()[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
65
51
|
});
|
|
66
52
|
} // get the currently focused menu item
|
|
67
53
|
|
|
68
54
|
|
|
69
|
-
const curItem =
|
|
55
|
+
const curItem = this.menuItemNodes.find(item => item.tabIndex === 0);
|
|
70
56
|
|
|
71
57
|
switch (event.key) {
|
|
72
58
|
case ' ':
|
|
73
59
|
case 'Enter':
|
|
74
|
-
event.target.click();
|
|
75
|
-
handlePrevent(event);
|
|
60
|
+
event.target.click(); // user may use input to be the trigger and bind some key event on it, so do not stoppropagation
|
|
61
|
+
// handlePrevent(event);
|
|
62
|
+
|
|
76
63
|
break;
|
|
77
64
|
|
|
78
65
|
case 'Escape':
|