@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
package/lib/es/table/utils.js
CHANGED
|
@@ -11,15 +11,6 @@ import _filter from "lodash/filter";
|
|
|
11
11
|
import _get from "lodash/get";
|
|
12
12
|
import _isEqualWith from "lodash/isEqualWith";
|
|
13
13
|
import _cloneDeepWith from "lodash/cloneDeepWith";
|
|
14
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
15
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
16
|
-
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
17
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
18
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
19
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
20
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
21
|
-
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
22
|
-
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
23
14
|
import { strings, numbers } from './constants';
|
|
24
15
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
25
16
|
import Logger from '../utils/Logger';
|
|
@@ -53,7 +44,7 @@ export function equalWith(value, other, customizer) {
|
|
|
53
44
|
});
|
|
54
45
|
}
|
|
55
46
|
export function getColumnKey(column, keyPropNames) {
|
|
56
|
-
keyPropNames =
|
|
47
|
+
keyPropNames = Array.isArray(keyPropNames) ? keyPropNames : ['key', 'dataIndex'];
|
|
57
48
|
let key = null;
|
|
58
49
|
|
|
59
50
|
_each(keyPropNames, propName => {
|
|
@@ -77,13 +68,13 @@ export function mergeColumns() {
|
|
|
77
68
|
const clone = deep ? cloneDeep : _clone;
|
|
78
69
|
|
|
79
70
|
_map(newColumns, newColumn => {
|
|
80
|
-
newColumn =
|
|
71
|
+
newColumn = Object.assign({}, newColumn);
|
|
81
72
|
const key = getColumnKey(newColumn, keyPropNames);
|
|
82
73
|
|
|
83
74
|
const oldColumn = key != null && _find(oldColumns, item => getColumnKey(item, keyPropNames) === key);
|
|
84
75
|
|
|
85
76
|
if (oldColumn) {
|
|
86
|
-
finalColumns.push(clone(
|
|
77
|
+
finalColumns.push(clone(Object.assign(Object.assign({}, oldColumn), newColumn)));
|
|
87
78
|
} else {
|
|
88
79
|
finalColumns.push(clone(newColumn));
|
|
89
80
|
}
|
|
@@ -120,7 +111,7 @@ export function isLastLeftFixed(columns, column) {
|
|
|
120
111
|
|
|
121
112
|
const leftFixedColumns = _filter(columns, col => col.fixed === true || col.fixed === 'left');
|
|
122
113
|
|
|
123
|
-
const index = _findIndex(leftFixedColumns, col =>
|
|
114
|
+
const index = _findIndex(leftFixedColumns, col => checkKeys.every(key => col[key] != null && col[key] === column[key]));
|
|
124
115
|
|
|
125
116
|
return leftFixedColumns.length > 0 && index === leftFixedColumns.length - 1;
|
|
126
117
|
}
|
|
@@ -129,7 +120,7 @@ export function isFirstFixedRight(columns, column) {
|
|
|
129
120
|
|
|
130
121
|
const rightFixedColumns = _filter(columns, col => col.fixed === 'right');
|
|
131
122
|
|
|
132
|
-
const index = _findIndex(rightFixedColumns, col =>
|
|
123
|
+
const index = _findIndex(rightFixedColumns, col => checkKeys.every(key => col[key] != null && col[key] === column[key]));
|
|
133
124
|
|
|
134
125
|
return rightFixedColumns.length > 0 && index === 0;
|
|
135
126
|
}
|
|
@@ -140,28 +131,22 @@ export function isAnyFixed(columns) {
|
|
|
140
131
|
fixedSet = [fixedSet];
|
|
141
132
|
}
|
|
142
133
|
|
|
143
|
-
return fixedSet.length > 0 && _some(columns, col =>
|
|
134
|
+
return fixedSet.length > 0 && _some(columns, col => fixedSet.includes(col.fixed));
|
|
144
135
|
}
|
|
145
136
|
export function isAnyFixedRight(columns) {
|
|
146
137
|
return _some(columns, col => col.fixed === 'right');
|
|
147
138
|
}
|
|
148
139
|
export function isFixedLeft(column) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return _includesInstanceProperty(_context = ['left', true]).call(_context, _get(column, 'fixed'));
|
|
140
|
+
return ['left', true].includes(_get(column, 'fixed'));
|
|
152
141
|
}
|
|
153
142
|
export function isFixedRight(column) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return _includesInstanceProperty(_context2 = ['right']).call(_context2, _get(column, 'fixed'));
|
|
143
|
+
return ['right'].includes(_get(column, 'fixed'));
|
|
157
144
|
}
|
|
158
145
|
export function isFixed(column) {
|
|
159
146
|
return isFixedLeft(column) || isFixedRight(column);
|
|
160
147
|
}
|
|
161
148
|
export function isInnerColumnKey(key) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return _includesInstanceProperty(_context3 = [strings.DEFAULT_KEY_COLUMN_EXPAND, strings.DEFAULT_KEY_COLUMN_SCROLLBAR, strings.DEFAULT_KEY_COLUMN_SELECTION]).call(_context3, key);
|
|
149
|
+
return [strings.DEFAULT_KEY_COLUMN_EXPAND, strings.DEFAULT_KEY_COLUMN_SCROLLBAR, strings.DEFAULT_KEY_COLUMN_SELECTION].includes(key);
|
|
165
150
|
}
|
|
166
151
|
export function isExpandedColumn(column) {
|
|
167
152
|
return _get(column, 'key') === strings.DEFAULT_KEY_COLUMN_EXPAND;
|
|
@@ -174,7 +159,7 @@ export function isSelectionColumn(column) {
|
|
|
174
159
|
}
|
|
175
160
|
export function filterColumns(columns) {
|
|
176
161
|
let ignoreKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [strings.DEFAULT_KEY_COLUMN_SCROLLBAR];
|
|
177
|
-
return _filter(columns, col => !
|
|
162
|
+
return _filter(columns, col => !ignoreKeys.includes(col.key));
|
|
178
163
|
}
|
|
179
164
|
/**
|
|
180
165
|
* get width of scroll bar
|
|
@@ -274,9 +259,9 @@ export function flattenColumns(cols) {
|
|
|
274
259
|
let childrenColumnName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
275
260
|
const list = [];
|
|
276
261
|
|
|
277
|
-
if (
|
|
262
|
+
if (Array.isArray(cols) && cols.length) {
|
|
278
263
|
for (const col of cols) {
|
|
279
|
-
if (
|
|
264
|
+
if (Array.isArray(col[childrenColumnName]) && col[childrenColumnName].length) {
|
|
280
265
|
list.push(...flattenColumns(col[childrenColumnName], childrenColumnName));
|
|
281
266
|
} else {
|
|
282
267
|
warnIfNoDataIndex(col);
|
|
@@ -294,15 +279,13 @@ export function assignColumnKeys(columns) {
|
|
|
294
279
|
|
|
295
280
|
_each(columns, (column, index) => {
|
|
296
281
|
if (column.key == null) {
|
|
297
|
-
var _context4;
|
|
298
|
-
|
|
299
282
|
// if user give column a dataIndex, use it for backup
|
|
300
283
|
const _index = column.dataIndex || index;
|
|
301
284
|
|
|
302
|
-
column.key =
|
|
285
|
+
column.key = "".concat(level, "-").concat(_index);
|
|
303
286
|
}
|
|
304
287
|
|
|
305
|
-
if (
|
|
288
|
+
if (Array.isArray(column[childrenColumnName]) && column[childrenColumnName].length) {
|
|
306
289
|
sameLevelCols.push(...column[childrenColumnName]);
|
|
307
290
|
}
|
|
308
291
|
});
|
|
@@ -319,11 +302,11 @@ export function sliceColumnsByLevel(columns) {
|
|
|
319
302
|
let currentLevel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
320
303
|
const slicedColumns = [];
|
|
321
304
|
|
|
322
|
-
if (
|
|
323
|
-
|
|
305
|
+
if (Array.isArray(columns) && columns.length && currentLevel <= targetLevel) {
|
|
306
|
+
columns.forEach(column => {
|
|
324
307
|
const children = column[childrenColumnName];
|
|
325
308
|
|
|
326
|
-
if (
|
|
309
|
+
if (Array.isArray(children) && children.length && currentLevel < targetLevel) {
|
|
327
310
|
slicedColumns.push(...sliceColumnsByLevel(children, targetLevel, childrenColumnName, currentLevel + 1));
|
|
328
311
|
} else {
|
|
329
312
|
slicedColumns.push(column);
|
|
@@ -339,11 +322,11 @@ export function getColumnsByLevel(columns) {
|
|
|
339
322
|
let currentLevel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
340
323
|
let childrenColumnName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'children';
|
|
341
324
|
|
|
342
|
-
if (
|
|
325
|
+
if (Array.isArray(columns) && columns.length) {
|
|
343
326
|
if (targetLevel === currentLevel) {
|
|
344
327
|
targetColumns.push(...columns);
|
|
345
328
|
} else {
|
|
346
|
-
|
|
329
|
+
columns.forEach(column => {
|
|
347
330
|
getColumnsByLevel(column[childrenColumnName], targetLevel, targetColumns, currentLevel + 1, childrenColumnName);
|
|
348
331
|
});
|
|
349
332
|
}
|
|
@@ -355,14 +338,13 @@ export function getAllLevelColumns(columns) {
|
|
|
355
338
|
let childrenColumnName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
356
339
|
const all = [];
|
|
357
340
|
|
|
358
|
-
if (
|
|
341
|
+
if (Array.isArray(columns) && columns.length) {
|
|
359
342
|
all.push([...columns]);
|
|
360
343
|
const sameLevelColumns = [];
|
|
361
|
-
|
|
362
|
-
_forEachInstanceProperty(columns).call(columns, column => {
|
|
344
|
+
columns.forEach(column => {
|
|
363
345
|
const children = column[childrenColumnName];
|
|
364
346
|
|
|
365
|
-
if (
|
|
347
|
+
if (Array.isArray(children) && children.length) {
|
|
366
348
|
sameLevelColumns.push(...children);
|
|
367
349
|
}
|
|
368
350
|
});
|
|
@@ -391,7 +373,7 @@ export function findColumn(columns, column) {
|
|
|
391
373
|
}
|
|
392
374
|
}
|
|
393
375
|
|
|
394
|
-
if (item &&
|
|
376
|
+
if (item && Array.isArray(item[childrenColumnName]) && !found) {
|
|
395
377
|
found = findColumn(item[childrenColumnName], column, childrenColumnName);
|
|
396
378
|
}
|
|
397
379
|
|
|
@@ -413,10 +395,10 @@ export function expandBtnShouldInRow(props) {
|
|
|
413
395
|
rowExpandable
|
|
414
396
|
} = props;
|
|
415
397
|
const hasExpandedRowRender = typeof expandedRowRender === 'function';
|
|
416
|
-
return hideExpandedColumn && hasExpandedRowRender || !hasExpandedRowRender &&
|
|
398
|
+
return hideExpandedColumn && hasExpandedRowRender || !hasExpandedRowRender && dataSource.some(record => {
|
|
417
399
|
const children = _get(record, childrenRecordName);
|
|
418
400
|
|
|
419
|
-
if (
|
|
401
|
+
if (Array.isArray(children) && children.length || rowExpandable(record)) {
|
|
420
402
|
return true;
|
|
421
403
|
} else {
|
|
422
404
|
return false;
|
|
@@ -434,9 +416,9 @@ export function mergeQueries(query) {
|
|
|
434
416
|
|
|
435
417
|
let _mergedQuery;
|
|
436
418
|
|
|
437
|
-
const idx =
|
|
419
|
+
const idx = queries.findIndex(item => {
|
|
438
420
|
if (query.dataIndex === item.dataIndex) {
|
|
439
|
-
_mergedQuery =
|
|
421
|
+
_mergedQuery = Object.assign(Object.assign({}, item), query);
|
|
440
422
|
return true;
|
|
441
423
|
}
|
|
442
424
|
|
|
@@ -444,7 +426,7 @@ export function mergeQueries(query) {
|
|
|
444
426
|
});
|
|
445
427
|
|
|
446
428
|
if (idx > -1) {
|
|
447
|
-
|
|
429
|
+
queries.splice(idx, 1, _mergedQuery);
|
|
448
430
|
} else {
|
|
449
431
|
queries.push(_mergedQuery);
|
|
450
432
|
}
|
|
@@ -488,7 +470,7 @@ export function getAllDisabledRowKeys(_ref) {
|
|
|
488
470
|
} = _ref;
|
|
489
471
|
const disabledRowKeys = [];
|
|
490
472
|
|
|
491
|
-
if (
|
|
473
|
+
if (Array.isArray(dataSource) && dataSource.length && typeof getCheckboxProps === 'function') {
|
|
492
474
|
for (const record of dataSource) {
|
|
493
475
|
const props = getCheckboxProps(record);
|
|
494
476
|
const recordKey = typeof rowKey === 'function' ? rowKey(record) : _get(record, rowKey);
|
|
@@ -499,7 +481,7 @@ export function getAllDisabledRowKeys(_ref) {
|
|
|
499
481
|
|
|
500
482
|
const children = _get(record, childrenRecordName);
|
|
501
483
|
|
|
502
|
-
if (
|
|
484
|
+
if (Array.isArray(children) && children.length) {
|
|
503
485
|
const keys = getAllDisabledRowKeys({
|
|
504
486
|
dataSource: children,
|
|
505
487
|
getCheckboxProps
|
|
@@ -520,7 +502,7 @@ export function warnIfNoDataIndex(column) {
|
|
|
520
502
|
} = column;
|
|
521
503
|
const logger = new Logger('[@douyinfe/semi-ui Table]');
|
|
522
504
|
|
|
523
|
-
if ((
|
|
505
|
+
if ((Array.isArray(filters) || _isFunction(sorter)) && isNullOrUndefined(dataIndex)) {
|
|
524
506
|
logger.warn("The column with sorter or filter must pass the 'dataIndex' prop");
|
|
525
507
|
}
|
|
526
508
|
}
|
|
@@ -536,11 +518,11 @@ export function isTreeTable(_ref2) {
|
|
|
536
518
|
} = _ref2;
|
|
537
519
|
let flag = false;
|
|
538
520
|
|
|
539
|
-
if (
|
|
521
|
+
if (Array.isArray(dataSource)) {
|
|
540
522
|
for (const data of dataSource) {
|
|
541
523
|
const children = _get(data, childrenRecordName);
|
|
542
524
|
|
|
543
|
-
if (
|
|
525
|
+
if (Array.isArray(children) && children.length) {
|
|
544
526
|
flag = true;
|
|
545
527
|
break;
|
|
546
528
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import _noop from "lodash/noop";
|
|
2
2
|
import _get from "lodash/get";
|
|
3
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
4
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
5
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
6
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
7
3
|
import BaseFoundation from '../base/foundation';
|
|
8
4
|
|
|
9
5
|
class TabsFoundation extends BaseFoundation {
|
|
10
6
|
constructor(adapter) {
|
|
11
|
-
super(
|
|
7
|
+
super(Object.assign({}, adapter));
|
|
12
8
|
this.destroy = _noop;
|
|
13
9
|
|
|
14
10
|
this.handlePrevent = event => {
|
|
@@ -17,16 +13,11 @@ class TabsFoundation extends BaseFoundation {
|
|
|
17
13
|
};
|
|
18
14
|
|
|
19
15
|
this.handleKeyDown = (event, itemKey, closable) => {
|
|
20
|
-
var _context;
|
|
21
|
-
|
|
22
16
|
const {
|
|
23
17
|
preventScroll
|
|
24
18
|
} = this.getProps();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var _context2;
|
|
28
|
-
|
|
29
|
-
return _includesInstanceProperty(_context2 = _get(item, 'attributes.data-tabkey.value', '')).call(_context2, 'semiTab') && _get(item, 'attributes.aria-disabled.value', '') !== "true";
|
|
19
|
+
const tabs = [...event.target.parentNode.childNodes].filter(item => {
|
|
20
|
+
return _get(item, 'attributes.data-tabkey.value', '').includes('semiTab') && _get(item, 'attributes.aria-disabled.value', '') !== "true";
|
|
30
21
|
});
|
|
31
22
|
|
|
32
23
|
switch (event.key) {
|
|
@@ -160,11 +151,9 @@ class TabsFoundation extends BaseFoundation {
|
|
|
160
151
|
|
|
161
152
|
if (closable) {
|
|
162
153
|
this.handleTabDelete(itemKey);
|
|
163
|
-
|
|
164
|
-
const index = _indexOfInstanceProperty(tabs).call(tabs, event.target); // Move focus to next element after deletion
|
|
154
|
+
const index = tabs.indexOf(event.target); // Move focus to next element after deletion
|
|
165
155
|
// If the element is the last removable tab, focus to its previous tab
|
|
166
156
|
|
|
167
|
-
|
|
168
157
|
if (tabs.length !== 1) {
|
|
169
158
|
tabs[index + 1 >= tabs.length ? index - 1 : index + 1].focus({
|
|
170
159
|
preventScroll
|
|
@@ -177,9 +166,7 @@ class TabsFoundation extends BaseFoundation {
|
|
|
177
166
|
const {
|
|
178
167
|
preventScroll
|
|
179
168
|
} = this.getProps();
|
|
180
|
-
|
|
181
|
-
const index = _indexOfInstanceProperty(tabs).call(tabs, event.target);
|
|
182
|
-
|
|
169
|
+
const index = tabs.indexOf(event.target);
|
|
183
170
|
const direction = {
|
|
184
171
|
"ArrowLeft": -1,
|
|
185
172
|
"ArrowUp": -1,
|
|
@@ -2,14 +2,6 @@ import _isUndefined from "lodash/isUndefined";
|
|
|
2
2
|
import _isFunction from "lodash/isFunction";
|
|
3
3
|
import _isNumber from "lodash/isNumber";
|
|
4
4
|
import _isString from "lodash/isString";
|
|
5
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
6
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
7
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
8
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
9
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
10
|
-
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
|
|
11
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
12
|
-
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
13
5
|
import BaseFoundation from '../base/foundation';
|
|
14
6
|
import keyCode from '../utils/keyCode';
|
|
15
7
|
import getSplitedArray from './utils/getSplitedArray';
|
|
@@ -18,7 +10,7 @@ import arrayMove from '../utils/arrayMove';
|
|
|
18
10
|
|
|
19
11
|
class TagInputFoundation extends BaseFoundation {
|
|
20
12
|
constructor(adapter) {
|
|
21
|
-
super(
|
|
13
|
+
super(Object.assign({}, adapter));
|
|
22
14
|
/**
|
|
23
15
|
* handler of input change
|
|
24
16
|
*/
|
|
@@ -96,8 +88,7 @@ class TagInputFoundation extends BaseFoundation {
|
|
|
96
88
|
} = tagsArray;
|
|
97
89
|
|
|
98
90
|
if (code === keyCode.BACKSPACE && inputValue === '' && length > 0) {
|
|
99
|
-
const newTagList =
|
|
100
|
-
|
|
91
|
+
const newTagList = tagsArray.slice(0, length - 1);
|
|
101
92
|
const removedTag = tagsArray[length - 1];
|
|
102
93
|
|
|
103
94
|
this._onRemove(newTagList, removedTag, length - 1);
|
|
@@ -121,24 +112,23 @@ class TagInputFoundation extends BaseFoundation {
|
|
|
121
112
|
} = this._adapter.getStates();
|
|
122
113
|
|
|
123
114
|
let addTags = getSplitedArray(inputValue, separator);
|
|
124
|
-
addTags =
|
|
115
|
+
addTags = addTags.filter((item, idx) => {
|
|
125
116
|
// If allowDuplicates is false, then filter duplicates
|
|
126
117
|
if (!allowDuplicates) {
|
|
127
|
-
if (
|
|
118
|
+
if (tagsArray.includes(item) || addTags.indexOf(item) !== idx) {
|
|
128
119
|
return false;
|
|
129
120
|
}
|
|
130
121
|
} // Filter empty strings and pure space strings in new items
|
|
131
122
|
|
|
132
123
|
|
|
133
|
-
return _isString(item) &&
|
|
124
|
+
return _isString(item) && item.trim() !== '';
|
|
134
125
|
});
|
|
135
|
-
|
|
136
|
-
let newTagList = _concatInstanceProperty(tagsArray).call(tagsArray, addTags);
|
|
126
|
+
let newTagList = tagsArray.concat(addTags);
|
|
137
127
|
|
|
138
128
|
if (_isNumber(max) && newTagList.length > max) {
|
|
139
129
|
_isFunction(onExceed) && onExceed(newTagList);
|
|
140
|
-
newTagList =
|
|
141
|
-
addTags =
|
|
130
|
+
newTagList = newTagList.slice(0, max);
|
|
131
|
+
addTags = addTags.slice(0, max - tagsArray.length);
|
|
142
132
|
}
|
|
143
133
|
|
|
144
134
|
if (addTags.length > 0) {
|
|
@@ -206,9 +196,7 @@ class TagInputFoundation extends BaseFoundation {
|
|
|
206
196
|
} = this._adapter.getStates();
|
|
207
197
|
|
|
208
198
|
const newTagList = [...tagsArray];
|
|
209
|
-
|
|
210
|
-
_spliceInstanceProperty(newTagList).call(newTagList, index, 1);
|
|
211
|
-
|
|
199
|
+
newTagList.splice(index, 1);
|
|
212
200
|
const removedTag = tagsArray[index];
|
|
213
201
|
|
|
214
202
|
this._onRemove(newTagList, removedTag, index);
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
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 _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
5
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
6
|
-
import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
|
7
|
-
import _Date$now from "@babel/runtime-corejs3/core-js-stable/date/now";
|
|
8
1
|
import { strings } from './constants';
|
|
9
2
|
import BaseFoundation from '../base/foundation';
|
|
10
3
|
import { isValidDate } from '../datePicker/_utils/index';
|
|
@@ -21,7 +14,7 @@ export const formatOption = (option, disabledOptions) => {
|
|
|
21
14
|
|
|
22
15
|
let disabled = false;
|
|
23
16
|
|
|
24
|
-
if (disabledOptions &&
|
|
17
|
+
if (disabledOptions && disabledOptions.indexOf(option) >= 0) {
|
|
25
18
|
disabled = true;
|
|
26
19
|
}
|
|
27
20
|
|
|
@@ -36,7 +29,7 @@ function generateOptions(length, disabledOptions, hideDisabledOptions) {
|
|
|
36
29
|
const arr = [];
|
|
37
30
|
|
|
38
31
|
for (let value = 0; value < length; value += step) {
|
|
39
|
-
if (!disabledOptions ||
|
|
32
|
+
if (!disabledOptions || disabledOptions.indexOf(value) < 0 || !hideDisabledOptions) {
|
|
40
33
|
arr.push(value);
|
|
41
34
|
}
|
|
42
35
|
}
|
|
@@ -46,7 +39,7 @@ function generateOptions(length, disabledOptions, hideDisabledOptions) {
|
|
|
46
39
|
|
|
47
40
|
class ComboboxFoundation extends BaseFoundation {
|
|
48
41
|
constructor(adapter) {
|
|
49
|
-
super(
|
|
42
|
+
super(Object.assign({}, adapter));
|
|
50
43
|
}
|
|
51
44
|
|
|
52
45
|
isAM() {
|
|
@@ -104,13 +97,11 @@ class ComboboxFoundation extends BaseFoundation {
|
|
|
104
97
|
} = this.getProps();
|
|
105
98
|
let disabledOptions = disabledHours && disabledHours();
|
|
106
99
|
|
|
107
|
-
if (use12Hours &&
|
|
100
|
+
if (use12Hours && Array.isArray(disabledOptions)) {
|
|
108
101
|
if (this.isAM()) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
disabledOptions = _mapInstanceProperty(_context = _filterInstanceProperty(disabledOptions).call(disabledOptions, h => h < 12)).call(_context, h => h === 0 ? 12 : h);
|
|
102
|
+
disabledOptions = disabledOptions.filter(h => h < 12).map(h => h === 0 ? 12 : h);
|
|
112
103
|
} else {
|
|
113
|
-
disabledOptions =
|
|
104
|
+
disabledOptions = disabledOptions.map(h => h === 12 ? 12 : h - 12);
|
|
114
105
|
}
|
|
115
106
|
}
|
|
116
107
|
|
|
@@ -157,7 +148,7 @@ class ComboboxFoundation extends BaseFoundation {
|
|
|
157
148
|
|
|
158
149
|
|
|
159
150
|
createDateDefault() {
|
|
160
|
-
return new Date(
|
|
151
|
+
return new Date(parseInt(String(Date.now() / DAY), 10) * DAY - 8 * HOUR);
|
|
161
152
|
}
|
|
162
153
|
|
|
163
154
|
}
|
|
@@ -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
|
|