@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/cjs/table/utils.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.arrayAdd = arrayAdd;
|
|
12
7
|
exports.assignColumnKeys = assignColumnKeys;
|
|
13
8
|
exports.cloneDeep = cloneDeep;
|
|
@@ -48,33 +43,15 @@ exports.sliceColumnsByLevel = sliceColumnsByLevel;
|
|
|
48
43
|
exports.warnIfNoDataIndex = warnIfNoDataIndex;
|
|
49
44
|
exports.withResizeWidth = withResizeWidth;
|
|
50
45
|
|
|
51
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
52
|
-
|
|
53
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
54
|
-
|
|
55
|
-
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
|
56
|
-
|
|
57
|
-
var _includes2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
58
|
-
|
|
59
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
60
|
-
|
|
61
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
62
|
-
|
|
63
|
-
var _some2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
64
|
-
|
|
65
|
-
var _findIndex2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
|
|
66
|
-
|
|
67
|
-
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
|
|
68
|
-
|
|
69
46
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
70
47
|
|
|
71
48
|
var _toString2 = _interopRequireDefault(require("lodash/toString"));
|
|
72
49
|
|
|
73
|
-
var
|
|
50
|
+
var _includes2 = _interopRequireDefault(require("lodash/includes"));
|
|
74
51
|
|
|
75
|
-
var
|
|
52
|
+
var _some2 = _interopRequireDefault(require("lodash/some"));
|
|
76
53
|
|
|
77
|
-
var
|
|
54
|
+
var _findIndex2 = _interopRequireDefault(require("lodash/findIndex"));
|
|
78
55
|
|
|
79
56
|
var _each2 = _interopRequireDefault(require("lodash/each"));
|
|
80
57
|
|
|
@@ -98,6 +75,8 @@ var _isNullOrUndefined = _interopRequireDefault(require("../utils/isNullOrUndefi
|
|
|
98
75
|
|
|
99
76
|
var _Logger = _interopRequireDefault(require("../utils/Logger"));
|
|
100
77
|
|
|
78
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
79
|
+
|
|
101
80
|
function cloneDeep(value, customizer) {
|
|
102
81
|
return (0, _cloneDeepWith2.default)(value, v => {
|
|
103
82
|
if (typeof v === 'function') {
|
|
@@ -130,7 +109,7 @@ function equalWith(value, other, customizer) {
|
|
|
130
109
|
}
|
|
131
110
|
|
|
132
111
|
function getColumnKey(column, keyPropNames) {
|
|
133
|
-
keyPropNames =
|
|
112
|
+
keyPropNames = Array.isArray(keyPropNames) ? keyPropNames : ['key', 'dataIndex'];
|
|
134
113
|
let key = null;
|
|
135
114
|
(0, _each2.default)(keyPropNames, propName => {
|
|
136
115
|
key = (0, _get2.default)(column, propName);
|
|
@@ -152,12 +131,12 @@ function mergeColumns() {
|
|
|
152
131
|
const finalColumns = [];
|
|
153
132
|
const clone = deep ? cloneDeep : _clone2.default;
|
|
154
133
|
(0, _map2.default)(newColumns, newColumn => {
|
|
155
|
-
newColumn =
|
|
134
|
+
newColumn = Object.assign({}, newColumn);
|
|
156
135
|
const key = getColumnKey(newColumn, keyPropNames);
|
|
157
136
|
const oldColumn = key != null && (0, _find2.default)(oldColumns, item => getColumnKey(item, keyPropNames) === key);
|
|
158
137
|
|
|
159
138
|
if (oldColumn) {
|
|
160
|
-
finalColumns.push(clone(
|
|
139
|
+
finalColumns.push(clone(Object.assign(Object.assign({}, oldColumn), newColumn)));
|
|
161
140
|
} else {
|
|
162
141
|
finalColumns.push(clone(newColumn));
|
|
163
142
|
}
|
|
@@ -191,14 +170,14 @@ function arrayAdd() {
|
|
|
191
170
|
function isLastLeftFixed(columns, column) {
|
|
192
171
|
let checkKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['key'];
|
|
193
172
|
const leftFixedColumns = (0, _filter2.default)(columns, col => col.fixed === true || col.fixed === 'left');
|
|
194
|
-
const index = (0,
|
|
173
|
+
const index = (0, _findIndex2.default)(leftFixedColumns, col => checkKeys.every(key => col[key] != null && col[key] === column[key]));
|
|
195
174
|
return leftFixedColumns.length > 0 && index === leftFixedColumns.length - 1;
|
|
196
175
|
}
|
|
197
176
|
|
|
198
177
|
function isFirstFixedRight(columns, column) {
|
|
199
178
|
let checkKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['key'];
|
|
200
179
|
const rightFixedColumns = (0, _filter2.default)(columns, col => col.fixed === 'right');
|
|
201
|
-
const index = (0,
|
|
180
|
+
const index = (0, _findIndex2.default)(rightFixedColumns, col => checkKeys.every(key => col[key] != null && col[key] === column[key]));
|
|
202
181
|
return rightFixedColumns.length > 0 && index === 0;
|
|
203
182
|
}
|
|
204
183
|
|
|
@@ -209,23 +188,19 @@ function isAnyFixed(columns) {
|
|
|
209
188
|
fixedSet = [fixedSet];
|
|
210
189
|
}
|
|
211
190
|
|
|
212
|
-
return fixedSet.length > 0 && (0,
|
|
191
|
+
return fixedSet.length > 0 && (0, _some2.default)(columns, col => fixedSet.includes(col.fixed));
|
|
213
192
|
}
|
|
214
193
|
|
|
215
194
|
function isAnyFixedRight(columns) {
|
|
216
|
-
return (0,
|
|
195
|
+
return (0, _some2.default)(columns, col => col.fixed === 'right');
|
|
217
196
|
}
|
|
218
197
|
|
|
219
198
|
function isFixedLeft(column) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return (0, _includes2.default)(_context = ['left', true]).call(_context, (0, _get2.default)(column, 'fixed'));
|
|
199
|
+
return ['left', true].includes((0, _get2.default)(column, 'fixed'));
|
|
223
200
|
}
|
|
224
201
|
|
|
225
202
|
function isFixedRight(column) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return (0, _includes2.default)(_context2 = ['right']).call(_context2, (0, _get2.default)(column, 'fixed'));
|
|
203
|
+
return ['right'].includes((0, _get2.default)(column, 'fixed'));
|
|
229
204
|
}
|
|
230
205
|
|
|
231
206
|
function isFixed(column) {
|
|
@@ -233,9 +208,7 @@ function isFixed(column) {
|
|
|
233
208
|
}
|
|
234
209
|
|
|
235
210
|
function isInnerColumnKey(key) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return (0, _includes2.default)(_context3 = [_constants.strings.DEFAULT_KEY_COLUMN_EXPAND, _constants.strings.DEFAULT_KEY_COLUMN_SCROLLBAR, _constants.strings.DEFAULT_KEY_COLUMN_SELECTION]).call(_context3, key);
|
|
211
|
+
return [_constants.strings.DEFAULT_KEY_COLUMN_EXPAND, _constants.strings.DEFAULT_KEY_COLUMN_SCROLLBAR, _constants.strings.DEFAULT_KEY_COLUMN_SELECTION].includes(key);
|
|
239
212
|
}
|
|
240
213
|
|
|
241
214
|
function isExpandedColumn(column) {
|
|
@@ -252,7 +225,7 @@ function isSelectionColumn(column) {
|
|
|
252
225
|
|
|
253
226
|
function filterColumns(columns) {
|
|
254
227
|
let ignoreKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [_constants.strings.DEFAULT_KEY_COLUMN_SCROLLBAR];
|
|
255
|
-
return (0, _filter2.default)(columns, col => !
|
|
228
|
+
return (0, _filter2.default)(columns, col => !ignoreKeys.includes(col.key));
|
|
256
229
|
}
|
|
257
230
|
/**
|
|
258
231
|
* get width of scroll bar
|
|
@@ -289,7 +262,7 @@ function getRecordKey(record, rowKey) {
|
|
|
289
262
|
|
|
290
263
|
|
|
291
264
|
function isExpanded(expandedRowKeys, key) {
|
|
292
|
-
return key != null && (0,
|
|
265
|
+
return key != null && (0, _includes2.default)(expandedRowKeys, key);
|
|
293
266
|
}
|
|
294
267
|
/**
|
|
295
268
|
* Determine whether the selectedKeysSet includes the key
|
|
@@ -362,9 +335,9 @@ function flattenColumns(cols) {
|
|
|
362
335
|
let childrenColumnName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
363
336
|
const list = [];
|
|
364
337
|
|
|
365
|
-
if (
|
|
338
|
+
if (Array.isArray(cols) && cols.length) {
|
|
366
339
|
for (const col of cols) {
|
|
367
|
-
if (
|
|
340
|
+
if (Array.isArray(col[childrenColumnName]) && col[childrenColumnName].length) {
|
|
368
341
|
list.push(...flattenColumns(col[childrenColumnName], childrenColumnName));
|
|
369
342
|
} else {
|
|
370
343
|
warnIfNoDataIndex(col);
|
|
@@ -382,15 +355,13 @@ function assignColumnKeys(columns) {
|
|
|
382
355
|
const sameLevelCols = [];
|
|
383
356
|
(0, _each2.default)(columns, (column, index) => {
|
|
384
357
|
if (column.key == null) {
|
|
385
|
-
var _context4;
|
|
386
|
-
|
|
387
358
|
// if user give column a dataIndex, use it for backup
|
|
388
359
|
const _index = column.dataIndex || index;
|
|
389
360
|
|
|
390
|
-
column.key =
|
|
361
|
+
column.key = "".concat(level, "-").concat(_index);
|
|
391
362
|
}
|
|
392
363
|
|
|
393
|
-
if (
|
|
364
|
+
if (Array.isArray(column[childrenColumnName]) && column[childrenColumnName].length) {
|
|
394
365
|
sameLevelCols.push(...column[childrenColumnName]);
|
|
395
366
|
}
|
|
396
367
|
});
|
|
@@ -408,11 +379,11 @@ function sliceColumnsByLevel(columns) {
|
|
|
408
379
|
let currentLevel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
409
380
|
const slicedColumns = [];
|
|
410
381
|
|
|
411
|
-
if (
|
|
412
|
-
|
|
382
|
+
if (Array.isArray(columns) && columns.length && currentLevel <= targetLevel) {
|
|
383
|
+
columns.forEach(column => {
|
|
413
384
|
const children = column[childrenColumnName];
|
|
414
385
|
|
|
415
|
-
if (
|
|
386
|
+
if (Array.isArray(children) && children.length && currentLevel < targetLevel) {
|
|
416
387
|
slicedColumns.push(...sliceColumnsByLevel(children, targetLevel, childrenColumnName, currentLevel + 1));
|
|
417
388
|
} else {
|
|
418
389
|
slicedColumns.push(column);
|
|
@@ -429,11 +400,11 @@ function getColumnsByLevel(columns) {
|
|
|
429
400
|
let currentLevel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
430
401
|
let childrenColumnName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'children';
|
|
431
402
|
|
|
432
|
-
if (
|
|
403
|
+
if (Array.isArray(columns) && columns.length) {
|
|
433
404
|
if (targetLevel === currentLevel) {
|
|
434
405
|
targetColumns.push(...columns);
|
|
435
406
|
} else {
|
|
436
|
-
|
|
407
|
+
columns.forEach(column => {
|
|
437
408
|
getColumnsByLevel(column[childrenColumnName], targetLevel, targetColumns, currentLevel + 1, childrenColumnName);
|
|
438
409
|
});
|
|
439
410
|
}
|
|
@@ -446,13 +417,13 @@ function getAllLevelColumns(columns) {
|
|
|
446
417
|
let childrenColumnName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
447
418
|
const all = [];
|
|
448
419
|
|
|
449
|
-
if (
|
|
420
|
+
if (Array.isArray(columns) && columns.length) {
|
|
450
421
|
all.push([...columns]);
|
|
451
422
|
const sameLevelColumns = [];
|
|
452
|
-
|
|
423
|
+
columns.forEach(column => {
|
|
453
424
|
const children = column[childrenColumnName];
|
|
454
425
|
|
|
455
|
-
if (
|
|
426
|
+
if (Array.isArray(children) && children.length) {
|
|
456
427
|
sameLevelColumns.push(...children);
|
|
457
428
|
}
|
|
458
429
|
});
|
|
@@ -482,7 +453,7 @@ function findColumn(columns, column) {
|
|
|
482
453
|
}
|
|
483
454
|
}
|
|
484
455
|
|
|
485
|
-
if (item &&
|
|
456
|
+
if (item && Array.isArray(item[childrenColumnName]) && !found) {
|
|
486
457
|
found = findColumn(item[childrenColumnName], column, childrenColumnName);
|
|
487
458
|
}
|
|
488
459
|
|
|
@@ -504,10 +475,10 @@ function expandBtnShouldInRow(props) {
|
|
|
504
475
|
rowExpandable
|
|
505
476
|
} = props;
|
|
506
477
|
const hasExpandedRowRender = typeof expandedRowRender === 'function';
|
|
507
|
-
return hideExpandedColumn && hasExpandedRowRender || !hasExpandedRowRender &&
|
|
478
|
+
return hideExpandedColumn && hasExpandedRowRender || !hasExpandedRowRender && dataSource.some(record => {
|
|
508
479
|
const children = (0, _get2.default)(record, childrenRecordName);
|
|
509
480
|
|
|
510
|
-
if (
|
|
481
|
+
if (Array.isArray(children) && children.length || rowExpandable(record)) {
|
|
511
482
|
return true;
|
|
512
483
|
} else {
|
|
513
484
|
return false;
|
|
@@ -526,9 +497,9 @@ function mergeQueries(query) {
|
|
|
526
497
|
|
|
527
498
|
let _mergedQuery;
|
|
528
499
|
|
|
529
|
-
const idx =
|
|
500
|
+
const idx = queries.findIndex(item => {
|
|
530
501
|
if (query.dataIndex === item.dataIndex) {
|
|
531
|
-
_mergedQuery =
|
|
502
|
+
_mergedQuery = Object.assign(Object.assign({}, item), query);
|
|
532
503
|
return true;
|
|
533
504
|
}
|
|
534
505
|
|
|
@@ -536,7 +507,7 @@ function mergeQueries(query) {
|
|
|
536
507
|
});
|
|
537
508
|
|
|
538
509
|
if (idx > -1) {
|
|
539
|
-
|
|
510
|
+
queries.splice(idx, 1, _mergedQuery);
|
|
540
511
|
} else {
|
|
541
512
|
queries.push(_mergedQuery);
|
|
542
513
|
}
|
|
@@ -556,7 +527,7 @@ function withResizeWidth(columns, newColumns) {
|
|
|
556
527
|
for (const column of columns) {
|
|
557
528
|
if (!(0, _isNullOrUndefined.default)(column.width)) {
|
|
558
529
|
const currentColumn = column.key;
|
|
559
|
-
const columnIndex = (0,
|
|
530
|
+
const columnIndex = (0, _findIndex2.default)(_newColumns, item => item.key === currentColumn);
|
|
560
531
|
|
|
561
532
|
if (columnIndex !== -1) {
|
|
562
533
|
_newColumns[columnIndex].width = (0, _get2.default)(column, 'width');
|
|
@@ -581,7 +552,7 @@ function getAllDisabledRowKeys(_ref) {
|
|
|
581
552
|
} = _ref;
|
|
582
553
|
const disabledRowKeys = [];
|
|
583
554
|
|
|
584
|
-
if (
|
|
555
|
+
if (Array.isArray(dataSource) && dataSource.length && typeof getCheckboxProps === 'function') {
|
|
585
556
|
for (const record of dataSource) {
|
|
586
557
|
const props = getCheckboxProps(record);
|
|
587
558
|
const recordKey = typeof rowKey === 'function' ? rowKey(record) : (0, _get2.default)(record, rowKey);
|
|
@@ -592,7 +563,7 @@ function getAllDisabledRowKeys(_ref) {
|
|
|
592
563
|
|
|
593
564
|
const children = (0, _get2.default)(record, childrenRecordName);
|
|
594
565
|
|
|
595
|
-
if (
|
|
566
|
+
if (Array.isArray(children) && children.length) {
|
|
596
567
|
const keys = getAllDisabledRowKeys({
|
|
597
568
|
dataSource: children,
|
|
598
569
|
getCheckboxProps
|
|
@@ -614,7 +585,7 @@ function warnIfNoDataIndex(column) {
|
|
|
614
585
|
} = column;
|
|
615
586
|
const logger = new _Logger.default('[@douyinfe/semi-ui Table]');
|
|
616
587
|
|
|
617
|
-
if ((
|
|
588
|
+
if ((Array.isArray(filters) || (0, _isFunction2.default)(sorter)) && (0, _isNullOrUndefined.default)(dataIndex)) {
|
|
618
589
|
logger.warn("The column with sorter or filter must pass the 'dataIndex' prop");
|
|
619
590
|
}
|
|
620
591
|
}
|
|
@@ -631,11 +602,11 @@ function isTreeTable(_ref2) {
|
|
|
631
602
|
} = _ref2;
|
|
632
603
|
let flag = false;
|
|
633
604
|
|
|
634
|
-
if (
|
|
605
|
+
if (Array.isArray(dataSource)) {
|
|
635
606
|
for (const data of dataSource) {
|
|
636
607
|
const children = (0, _get2.default)(data, childrenRecordName);
|
|
637
608
|
|
|
638
|
-
if (
|
|
609
|
+
if (Array.isArray(children) && children.length) {
|
|
639
610
|
flag = true;
|
|
640
611
|
break;
|
|
641
612
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
|
|
9
6
|
exports.strings = exports.numbers = exports.cssClasses = void 0;
|
|
10
7
|
|
|
11
8
|
var _constants = require("../base/constants");
|
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
14
|
-
|
|
15
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
16
|
-
|
|
17
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
18
|
-
|
|
19
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
20
|
-
|
|
21
8
|
var _noop2 = _interopRequireDefault(require("lodash/noop"));
|
|
22
9
|
|
|
23
10
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
24
11
|
|
|
25
12
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
26
13
|
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
27
16
|
class TabsFoundation extends _foundation.default {
|
|
28
17
|
constructor(adapter) {
|
|
29
|
-
super(
|
|
18
|
+
super(Object.assign({}, adapter));
|
|
30
19
|
this.destroy = _noop2.default;
|
|
31
20
|
|
|
32
21
|
this.handlePrevent = event => {
|
|
@@ -35,15 +24,11 @@ class TabsFoundation extends _foundation.default {
|
|
|
35
24
|
};
|
|
36
25
|
|
|
37
26
|
this.handleKeyDown = (event, itemKey, closable) => {
|
|
38
|
-
var _context;
|
|
39
|
-
|
|
40
27
|
const {
|
|
41
28
|
preventScroll
|
|
42
29
|
} = this.getProps();
|
|
43
|
-
const tabs =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return (0, _includes.default)(_context2 = (0, _get2.default)(item, 'attributes.data-tabkey.value', '')).call(_context2, 'semiTab') && (0, _get2.default)(item, 'attributes.aria-disabled.value', '') !== "true";
|
|
30
|
+
const tabs = [...event.target.parentNode.childNodes].filter(item => {
|
|
31
|
+
return (0, _get2.default)(item, 'attributes.data-tabkey.value', '').includes('semiTab') && (0, _get2.default)(item, 'attributes.aria-disabled.value', '') !== "true";
|
|
47
32
|
});
|
|
48
33
|
|
|
49
34
|
switch (event.key) {
|
|
@@ -177,7 +162,7 @@ class TabsFoundation extends _foundation.default {
|
|
|
177
162
|
|
|
178
163
|
if (closable) {
|
|
179
164
|
this.handleTabDelete(itemKey);
|
|
180
|
-
const index =
|
|
165
|
+
const index = tabs.indexOf(event.target); // Move focus to next element after deletion
|
|
181
166
|
// If the element is the last removable tab, focus to its previous tab
|
|
182
167
|
|
|
183
168
|
if (tabs.length !== 1) {
|
|
@@ -192,7 +177,7 @@ class TabsFoundation extends _foundation.default {
|
|
|
192
177
|
const {
|
|
193
178
|
preventScroll
|
|
194
179
|
} = this.getProps();
|
|
195
|
-
const index =
|
|
180
|
+
const index = tabs.indexOf(event.target);
|
|
196
181
|
const direction = {
|
|
197
182
|
"ArrowLeft": -1,
|
|
198
183
|
"ArrowUp": -1,
|
package/lib/cjs/tag/constants.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
|
|
9
6
|
exports.strings = exports.cssClasses = void 0;
|
|
10
7
|
|
|
11
8
|
var _constants = require("../base/constants");
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
|
|
9
6
|
exports.strings = exports.cssClasses = void 0;
|
|
10
7
|
|
|
11
8
|
var _constants = require("../base/constants");
|
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
14
|
-
|
|
15
|
-
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
16
|
-
|
|
17
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
18
|
-
|
|
19
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
20
|
-
|
|
21
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
22
|
-
|
|
23
|
-
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
|
24
|
-
|
|
25
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
26
|
-
|
|
27
|
-
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
|
|
28
|
-
|
|
29
8
|
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
30
9
|
|
|
31
10
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
@@ -44,9 +23,11 @@ var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
|
44
23
|
|
|
45
24
|
var _arrayMove = _interopRequireDefault(require("../utils/arrayMove"));
|
|
46
25
|
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
47
28
|
class TagInputFoundation extends _foundation.default {
|
|
48
29
|
constructor(adapter) {
|
|
49
|
-
super(
|
|
30
|
+
super(Object.assign({}, adapter));
|
|
50
31
|
/**
|
|
51
32
|
* handler of input change
|
|
52
33
|
*/
|
|
@@ -124,7 +105,7 @@ class TagInputFoundation extends _foundation.default {
|
|
|
124
105
|
} = tagsArray;
|
|
125
106
|
|
|
126
107
|
if (code === _keyCode.default.BACKSPACE && inputValue === '' && length > 0) {
|
|
127
|
-
const newTagList =
|
|
108
|
+
const newTagList = tagsArray.slice(0, length - 1);
|
|
128
109
|
const removedTag = tagsArray[length - 1];
|
|
129
110
|
|
|
130
111
|
this._onRemove(newTagList, removedTag, length - 1);
|
|
@@ -148,23 +129,23 @@ class TagInputFoundation extends _foundation.default {
|
|
|
148
129
|
} = this._adapter.getStates();
|
|
149
130
|
|
|
150
131
|
let addTags = (0, _getSplitedArray.default)(inputValue, separator);
|
|
151
|
-
addTags =
|
|
132
|
+
addTags = addTags.filter((item, idx) => {
|
|
152
133
|
// If allowDuplicates is false, then filter duplicates
|
|
153
134
|
if (!allowDuplicates) {
|
|
154
|
-
if (
|
|
135
|
+
if (tagsArray.includes(item) || addTags.indexOf(item) !== idx) {
|
|
155
136
|
return false;
|
|
156
137
|
}
|
|
157
138
|
} // Filter empty strings and pure space strings in new items
|
|
158
139
|
|
|
159
140
|
|
|
160
|
-
return (0, _isString2.default)(item) &&
|
|
141
|
+
return (0, _isString2.default)(item) && item.trim() !== '';
|
|
161
142
|
});
|
|
162
|
-
let newTagList =
|
|
143
|
+
let newTagList = tagsArray.concat(addTags);
|
|
163
144
|
|
|
164
145
|
if ((0, _isNumber2.default)(max) && newTagList.length > max) {
|
|
165
146
|
(0, _isFunction2.default)(onExceed) && onExceed(newTagList);
|
|
166
|
-
newTagList =
|
|
167
|
-
addTags =
|
|
147
|
+
newTagList = newTagList.slice(0, max);
|
|
148
|
+
addTags = addTags.slice(0, max - tagsArray.length);
|
|
168
149
|
}
|
|
169
150
|
|
|
170
151
|
if (addTags.length > 0) {
|
|
@@ -232,7 +213,7 @@ class TagInputFoundation extends _foundation.default {
|
|
|
232
213
|
} = this._adapter.getStates();
|
|
233
214
|
|
|
234
215
|
const newTagList = [...tagsArray];
|
|
235
|
-
|
|
216
|
+
newTagList.splice(index, 1);
|
|
236
217
|
const removedTag = tagsArray[index];
|
|
237
218
|
|
|
238
219
|
this._onRemove(newTagList, removedTag, index);
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = void 0;
|
|
12
7
|
|
|
13
8
|
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
|
@@ -16,6 +11,8 @@ var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
|
|
|
16
11
|
|
|
17
12
|
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
|
18
13
|
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
19
16
|
/**
|
|
20
17
|
* Get the splited array.
|
|
21
18
|
* We expect separators to be string | string[] | null, but users
|
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.formatOption = exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
14
|
-
|
|
15
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
16
|
-
|
|
17
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
18
|
-
|
|
19
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
20
|
-
|
|
21
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
22
|
-
|
|
23
|
-
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-int"));
|
|
24
|
-
|
|
25
|
-
var _now = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/date/now"));
|
|
26
|
-
|
|
27
8
|
var _constants = require("./constants");
|
|
28
9
|
|
|
29
10
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
@@ -32,6 +13,8 @@ var _index = require("../datePicker/_utils/index");
|
|
|
32
13
|
|
|
33
14
|
var _isNullOrUndefined = _interopRequireDefault(require("../utils/isNullOrUndefined"));
|
|
34
15
|
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
35
18
|
const HOUR = 1000 * 60 * 60;
|
|
36
19
|
const DAY = 24 * HOUR; // TODO: move to utils
|
|
37
20
|
|
|
@@ -44,7 +27,7 @@ const formatOption = (option, disabledOptions) => {
|
|
|
44
27
|
|
|
45
28
|
let disabled = false;
|
|
46
29
|
|
|
47
|
-
if (disabledOptions &&
|
|
30
|
+
if (disabledOptions && disabledOptions.indexOf(option) >= 0) {
|
|
48
31
|
disabled = true;
|
|
49
32
|
}
|
|
50
33
|
|
|
@@ -61,7 +44,7 @@ function generateOptions(length, disabledOptions, hideDisabledOptions) {
|
|
|
61
44
|
const arr = [];
|
|
62
45
|
|
|
63
46
|
for (let value = 0; value < length; value += step) {
|
|
64
|
-
if (!disabledOptions ||
|
|
47
|
+
if (!disabledOptions || disabledOptions.indexOf(value) < 0 || !hideDisabledOptions) {
|
|
65
48
|
arr.push(value);
|
|
66
49
|
}
|
|
67
50
|
}
|
|
@@ -71,7 +54,7 @@ function generateOptions(length, disabledOptions, hideDisabledOptions) {
|
|
|
71
54
|
|
|
72
55
|
class ComboboxFoundation extends _foundation.default {
|
|
73
56
|
constructor(adapter) {
|
|
74
|
-
super(
|
|
57
|
+
super(Object.assign({}, adapter));
|
|
75
58
|
}
|
|
76
59
|
|
|
77
60
|
isAM() {
|
|
@@ -131,13 +114,11 @@ class ComboboxFoundation extends _foundation.default {
|
|
|
131
114
|
} = this.getProps();
|
|
132
115
|
let disabledOptions = disabledHours && disabledHours();
|
|
133
116
|
|
|
134
|
-
if (use12Hours &&
|
|
117
|
+
if (use12Hours && Array.isArray(disabledOptions)) {
|
|
135
118
|
if (this.isAM()) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
disabledOptions = (0, _map.default)(_context = (0, _filter.default)(disabledOptions).call(disabledOptions, h => h < 12)).call(_context, h => h === 0 ? 12 : h);
|
|
119
|
+
disabledOptions = disabledOptions.filter(h => h < 12).map(h => h === 0 ? 12 : h);
|
|
139
120
|
} else {
|
|
140
|
-
disabledOptions =
|
|
121
|
+
disabledOptions = disabledOptions.map(h => h === 12 ? 12 : h - 12);
|
|
141
122
|
}
|
|
142
123
|
}
|
|
143
124
|
|
|
@@ -184,7 +165,7 @@ class ComboboxFoundation extends _foundation.default {
|
|
|
184
165
|
|
|
185
166
|
|
|
186
167
|
createDateDefault() {
|
|
187
|
-
return new Date((
|
|
168
|
+
return new Date(parseInt(String(Date.now() / DAY), 10) * DAY - 8 * HOUR);
|
|
188
169
|
}
|
|
189
170
|
|
|
190
171
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
|
|
9
6
|
exports.strings = exports.numbers = exports.cssClasses = void 0;
|
|
10
7
|
|
|
11
8
|
var _constants = require("../base/constants");
|