@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,6 +1,4 @@
|
|
|
1
1
|
import _toNumber from "lodash/toNumber";
|
|
2
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
3
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
4
2
|
|
|
5
3
|
/* eslint-disable max-len */
|
|
6
4
|
import { format, parse } from 'date-fns';
|
|
@@ -64,7 +62,7 @@ export const hourIsDisabled = (disabledHours, hour) => {
|
|
|
64
62
|
if (typeof disabledHours === 'function') {
|
|
65
63
|
const disabledOptions = disabledHours();
|
|
66
64
|
|
|
67
|
-
if (
|
|
65
|
+
if (Array.isArray(disabledOptions) && !isNullOrUndefined(hour) && disabledOptions.some(v => _toNumber(v) === _toNumber(hour))) {
|
|
68
66
|
return true;
|
|
69
67
|
}
|
|
70
68
|
}
|
|
@@ -75,7 +73,7 @@ export const minuteIsDisabled = (disabledMinutes, hour, minute) => {
|
|
|
75
73
|
if (typeof disabledMinutes === 'function') {
|
|
76
74
|
const disabledOptions = disabledMinutes(hour);
|
|
77
75
|
|
|
78
|
-
if (
|
|
76
|
+
if (Array.isArray(disabledOptions) && !isNullOrUndefined(hour) && !isNullOrUndefined(minute) && disabledOptions.some(v => _toNumber(v) === _toNumber(minute))) {
|
|
79
77
|
return true;
|
|
80
78
|
}
|
|
81
79
|
}
|
|
@@ -86,7 +84,7 @@ export const secondIsDisabled = (disabledSeconds, hour, minute, second) => {
|
|
|
86
84
|
if (typeof disabledSeconds === 'function') {
|
|
87
85
|
const disabledOptions = disabledSeconds(hour, minute);
|
|
88
86
|
|
|
89
|
-
if (
|
|
87
|
+
if (Array.isArray(disabledOptions) && !isNullOrUndefined(hour) && !isNullOrUndefined(minute) && !isNullOrUndefined(second) && disabledOptions.some(v => _toNumber(v) === _toNumber(second))) {
|
|
90
88
|
return true;
|
|
91
89
|
}
|
|
92
90
|
}
|
|
@@ -94,7 +92,7 @@ export const secondIsDisabled = (disabledSeconds, hour, minute, second) => {
|
|
|
94
92
|
return false;
|
|
95
93
|
};
|
|
96
94
|
export const transformToArray = value => {
|
|
97
|
-
if (!
|
|
95
|
+
if (!Array.isArray(value)) {
|
|
98
96
|
return [];
|
|
99
97
|
} else {
|
|
100
98
|
return [...value];
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
1
|
import { format as dateFnsFormat, parse as dateFnsParse } from 'date-fns';
|
|
3
2
|
/* istanbul ignore next */
|
|
4
3
|
|
|
5
4
|
const replace = function replace(str, replacements) {
|
|
6
5
|
let _str = str;
|
|
7
6
|
|
|
8
|
-
for (const key of
|
|
7
|
+
for (const key of Object.keys(replacements)) {
|
|
9
8
|
if (typeof replacements[key] === 'string') {
|
|
10
9
|
_str = _str.replace(key, replacements[key]);
|
|
11
10
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _isNumber from "lodash/isNumber";
|
|
2
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
4
2
|
import BaseFoundation from '../base/foundation';
|
|
5
3
|
export default class ToastFoundation extends BaseFoundation {
|
|
6
4
|
constructor(adapter) {
|
|
7
|
-
super(
|
|
5
|
+
super(Object.assign(Object.assign({}, ToastFoundation.defaultAdapter), adapter));
|
|
8
6
|
this._timer = null;
|
|
9
7
|
this._id = null; // cache id
|
|
10
8
|
}
|
|
@@ -23,7 +21,7 @@ export default class ToastFoundation extends BaseFoundation {
|
|
|
23
21
|
const duration = this._adapter.getProp('duration');
|
|
24
22
|
|
|
25
23
|
if (duration && _isNumber(duration)) {
|
|
26
|
-
this._timer =
|
|
24
|
+
this._timer = setTimeout(() => {
|
|
27
25
|
this.close(); // call parent to remove itself
|
|
28
26
|
}, duration * 1000);
|
|
29
27
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
3
1
|
import BaseFoundation from '../base/foundation';
|
|
4
2
|
export default class ToastListFoundation extends BaseFoundation {
|
|
5
3
|
constructor(adapter) {
|
|
6
|
-
super(
|
|
4
|
+
super(Object.assign(Object.assign({}, ToastListFoundation.defaultAdapter), adapter));
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
addToast(toastOpts) {
|
|
@@ -22,7 +20,7 @@ export default class ToastListFoundation extends BaseFoundation {
|
|
|
22
20
|
let toastList = this._adapter.getState('list');
|
|
23
21
|
|
|
24
22
|
const removedItems = [];
|
|
25
|
-
toastList =
|
|
23
|
+
toastList = toastList.filter(toastOpts => {
|
|
26
24
|
if (toastOpts.id === id) {
|
|
27
25
|
removedItems.push(toastOpts);
|
|
28
26
|
return false;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import _isEmpty from "lodash/isEmpty";
|
|
2
2
|
import _get from "lodash/get";
|
|
3
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
4
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
5
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
6
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
7
|
-
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
8
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
9
3
|
import BaseFoundation from '../base/foundation';
|
|
10
4
|
import { handlePrevent } from '../utils/a11y';
|
|
11
5
|
const REGS = {
|
|
@@ -26,7 +20,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
26
20
|
constructor(adapter) {
|
|
27
21
|
var _this;
|
|
28
22
|
|
|
29
|
-
super(
|
|
23
|
+
super(Object.assign({}, adapter));
|
|
30
24
|
_this = this;
|
|
31
25
|
|
|
32
26
|
this.onResize = () => {
|
|
@@ -40,7 +34,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
40
34
|
this.clearDelayTimer();
|
|
41
35
|
|
|
42
36
|
if (mouseEnterDelay > 0) {
|
|
43
|
-
this._timer =
|
|
37
|
+
this._timer = setTimeout(() => {
|
|
44
38
|
this.show();
|
|
45
39
|
this.clearDelayTimer();
|
|
46
40
|
}, mouseEnterDelay);
|
|
@@ -112,9 +106,9 @@ export default class Tooltip extends BaseFoundation {
|
|
|
112
106
|
|
|
113
107
|
this.calcPosition = function (triggerRect, wrapperRect, containerRect) {
|
|
114
108
|
let shouldUpdatePos = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
115
|
-
triggerRect = (_isEmpty(triggerRect) ? _this._adapter.getTriggerBounding() : triggerRect) ||
|
|
116
|
-
containerRect = (_isEmpty(containerRect) ? _this._adapter.getPopupContainerRect() : containerRect) ||
|
|
117
|
-
wrapperRect = (_isEmpty(wrapperRect) ? _this._adapter.getWrapperBounding() : wrapperRect) ||
|
|
109
|
+
triggerRect = (_isEmpty(triggerRect) ? _this._adapter.getTriggerBounding() : triggerRect) || Object.assign({}, defaultRect);
|
|
110
|
+
containerRect = (_isEmpty(containerRect) ? _this._adapter.getPopupContainerRect() : containerRect) || Object.assign({}, defaultRect);
|
|
111
|
+
wrapperRect = (_isEmpty(wrapperRect) ? _this._adapter.getWrapperBounding() : wrapperRect) || Object.assign({}, defaultRect); // console.log('containerRect: ', containerRect, 'triggerRect: ', triggerRect, 'wrapperRect: ', wrapperRect);
|
|
118
112
|
|
|
119
113
|
let style = _this.calcPosStyle(triggerRect, wrapperRect, containerRect);
|
|
120
114
|
|
|
@@ -132,7 +126,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
132
126
|
|
|
133
127
|
if (shouldUpdatePos && _this._mounted) {
|
|
134
128
|
// this._adapter.updatePlacementAttr(style.position);
|
|
135
|
-
_this._adapter.setPosition(
|
|
129
|
+
_this._adapter.setPosition(Object.assign(Object.assign({}, style), {
|
|
136
130
|
position
|
|
137
131
|
}));
|
|
138
132
|
}
|
|
@@ -145,7 +139,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
145
139
|
this.clearDelayTimer();
|
|
146
140
|
|
|
147
141
|
if (mouseLeaveDelay > 0) {
|
|
148
|
-
this._timer =
|
|
142
|
+
this._timer = setTimeout(() => {
|
|
149
143
|
// console.log('delayHide for ', mouseLeaveDelay, ' ms, ', ...args);
|
|
150
144
|
this.hide();
|
|
151
145
|
this.clearDelayTimer();
|
|
@@ -374,7 +368,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
374
368
|
!disableFocusListener && this.delayHide();
|
|
375
369
|
};
|
|
376
370
|
|
|
377
|
-
portalEventSet =
|
|
371
|
+
portalEventSet = Object.assign({}, triggerEventSet);
|
|
378
372
|
|
|
379
373
|
if (this.getProp('clickToHide')) {
|
|
380
374
|
portalEventSet[eventNames.click] = () => {
|
|
@@ -442,46 +436,34 @@ export default class Tooltip extends BaseFoundation {
|
|
|
442
436
|
calcTransformOrigin(position, triggerRect, translateX, translateY) {
|
|
443
437
|
// eslint-disable-next-line
|
|
444
438
|
if (position && triggerRect && translateX != null && translateY != null) {
|
|
445
|
-
var _context9;
|
|
446
|
-
|
|
447
439
|
if (this.getProp('transformFromCenter')) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
if (_includesInstanceProperty(_context = ['topLeft', 'bottomLeft']).call(_context, position)) {
|
|
451
|
-
var _context2;
|
|
452
|
-
|
|
453
|
-
return _concatInstanceProperty(_context2 = "".concat(this._roundPixel(triggerRect.width / 2), "px ")).call(_context2, -translateY * 100, "%");
|
|
440
|
+
if (['topLeft', 'bottomLeft'].includes(position)) {
|
|
441
|
+
return "".concat(this._roundPixel(triggerRect.width / 2), "px ").concat(-translateY * 100, "%");
|
|
454
442
|
}
|
|
455
443
|
|
|
456
|
-
if (
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
return _concatInstanceProperty(_context4 = "calc(100% - ".concat(this._roundPixel(triggerRect.width / 2), "px) ")).call(_context4, -translateY * 100, "%");
|
|
444
|
+
if (['topRight', 'bottomRight'].includes(position)) {
|
|
445
|
+
return "calc(100% - ".concat(this._roundPixel(triggerRect.width / 2), "px) ").concat(-translateY * 100, "%");
|
|
460
446
|
}
|
|
461
447
|
|
|
462
|
-
if (
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
return _concatInstanceProperty(_context6 = "".concat(-translateX * 100, "% ")).call(_context6, this._roundPixel(triggerRect.height / 2), "px");
|
|
448
|
+
if (['leftTop', 'rightTop'].includes(position)) {
|
|
449
|
+
return "".concat(-translateX * 100, "% ").concat(this._roundPixel(triggerRect.height / 2), "px");
|
|
466
450
|
}
|
|
467
451
|
|
|
468
|
-
if (
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
return _concatInstanceProperty(_context8 = "".concat(-translateX * 100, "% calc(100% - ")).call(_context8, this._roundPixel(triggerRect.height / 2), "px)");
|
|
452
|
+
if (['leftBottom', 'rightBottom'].includes(position)) {
|
|
453
|
+
return "".concat(-translateX * 100, "% calc(100% - ").concat(this._roundPixel(triggerRect.height / 2), "px)");
|
|
472
454
|
}
|
|
473
455
|
}
|
|
474
456
|
|
|
475
|
-
return
|
|
457
|
+
return "".concat(-translateX * 100, "% ").concat(-translateY * 100, "%");
|
|
476
458
|
}
|
|
477
459
|
|
|
478
460
|
return null;
|
|
479
461
|
}
|
|
480
462
|
|
|
481
463
|
calcPosStyle(triggerRect, wrapperRect, containerRect, position, spacing) {
|
|
482
|
-
triggerRect = (_isEmpty(triggerRect) ? triggerRect : this._adapter.getTriggerBounding()) ||
|
|
483
|
-
containerRect = (_isEmpty(containerRect) ? containerRect : this._adapter.getPopupContainerRect()) ||
|
|
484
|
-
wrapperRect = (_isEmpty(wrapperRect) ? wrapperRect : this._adapter.getWrapperBounding()) ||
|
|
464
|
+
triggerRect = (_isEmpty(triggerRect) ? triggerRect : this._adapter.getTriggerBounding()) || Object.assign({}, defaultRect);
|
|
465
|
+
containerRect = (_isEmpty(containerRect) ? containerRect : this._adapter.getPopupContainerRect()) || Object.assign({}, defaultRect);
|
|
466
|
+
wrapperRect = (_isEmpty(wrapperRect) ? wrapperRect : this._adapter.getWrapperBounding()) || Object.assign({}, defaultRect); // eslint-disable-next-line
|
|
485
467
|
|
|
486
468
|
position = position != null ? position : this.getProp('position'); // eslint-disable-next-line
|
|
487
469
|
|
|
@@ -649,8 +631,8 @@ export default class Tooltip extends BaseFoundation {
|
|
|
649
631
|
if (this.getProp('showArrow') && !arrowPointAtCenter && triggerHeight <= (verticalArrowHeight / 2 + arrowOffsetY) * 2) {
|
|
650
632
|
const offsetY = triggerHeight / 2 - (arrowOffsetY + verticalArrowHeight / 2);
|
|
651
633
|
|
|
652
|
-
if ((
|
|
653
|
-
top =
|
|
634
|
+
if ((position.includes('Top') || position.includes('Bottom')) && !position.includes('Over')) {
|
|
635
|
+
top = position.includes('Top') ? top + offsetY : top - offsetY;
|
|
654
636
|
}
|
|
655
637
|
} // The left/top value here must be rounded, otherwise it will cause the small triangle to shake
|
|
656
638
|
|
|
@@ -663,8 +645,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
663
645
|
|
|
664
646
|
if (translateX != null) {
|
|
665
647
|
transform += "translateX(".concat(translateX * 100, "%) ");
|
|
666
|
-
|
|
667
|
-
_Object$defineProperty(style, 'translateX', {
|
|
648
|
+
Object.defineProperty(style, 'translateX', {
|
|
668
649
|
enumerable: false,
|
|
669
650
|
value: translateX
|
|
670
651
|
});
|
|
@@ -673,8 +654,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
673
654
|
|
|
674
655
|
if (translateY != null) {
|
|
675
656
|
transform += "translateY(".concat(translateY * 100, "%) ");
|
|
676
|
-
|
|
677
|
-
_Object$defineProperty(style, 'translateY', {
|
|
657
|
+
Object.defineProperty(style, 'translateY', {
|
|
678
658
|
enumerable: false,
|
|
679
659
|
value: translateY
|
|
680
660
|
});
|
|
@@ -694,12 +674,12 @@ export default class Tooltip extends BaseFoundation {
|
|
|
694
674
|
|
|
695
675
|
isLR() {
|
|
696
676
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
697
|
-
return
|
|
677
|
+
return position.indexOf('left') === 0 || position.indexOf('right') === 0;
|
|
698
678
|
}
|
|
699
679
|
|
|
700
680
|
isTB() {
|
|
701
681
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
702
|
-
return
|
|
682
|
+
return position.indexOf('top') === 0 || position.indexOf('bottom') === 0;
|
|
703
683
|
} // place the dom correctly
|
|
704
684
|
|
|
705
685
|
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import _omit from "lodash/omit";
|
|
2
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
4
|
-
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
5
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
6
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
7
|
-
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
8
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
9
|
-
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
|
|
10
2
|
import BaseFoundation from '../base/foundation';
|
|
11
3
|
import { strings } from './constants';
|
|
12
4
|
import { _generateGroupedData, _generateTreeData } from './transferUtils';
|
|
@@ -14,7 +6,7 @@ import arrayMove from '../utils/arrayMove'; // eslint-disable-next-line max-len
|
|
|
14
6
|
|
|
15
7
|
export default class TransferFoundation extends BaseFoundation {
|
|
16
8
|
constructor(adapter) {
|
|
17
|
-
super(
|
|
9
|
+
super(Object.assign({}, adapter));
|
|
18
10
|
}
|
|
19
11
|
|
|
20
12
|
_generateGroupedData(dataSource) {
|
|
@@ -29,7 +21,7 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
29
21
|
const {
|
|
30
22
|
path = []
|
|
31
23
|
} = item;
|
|
32
|
-
return
|
|
24
|
+
return path.map(p => p.label).join(' > ');
|
|
33
25
|
}
|
|
34
26
|
|
|
35
27
|
handleInputChange(inputVal) {
|
|
@@ -42,7 +34,7 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
42
34
|
} = this.getProps();
|
|
43
35
|
|
|
44
36
|
if (type === strings.TYPE_TREE_TO_LIST) {
|
|
45
|
-
const searchResult = new
|
|
37
|
+
const searchResult = new Set(data.map(item => item.key));
|
|
46
38
|
|
|
47
39
|
this._adapter.searchTree(inputVal);
|
|
48
40
|
|
|
@@ -55,15 +47,9 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
55
47
|
return;
|
|
56
48
|
}
|
|
57
49
|
|
|
58
|
-
const filterFunc = typeof filter === 'function' ? item => filter(inputVal, item) : item =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return typeof item.label === 'string' && _includesInstanceProperty(_context = item.label).call(_context, inputVal);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const searchData = _filterInstanceProperty(data).call(data, filterFunc);
|
|
65
|
-
|
|
66
|
-
const searchResult = new _Set(_mapInstanceProperty(searchData).call(searchData, item => item.key));
|
|
50
|
+
const filterFunc = typeof filter === 'function' ? item => filter(inputVal, item) : item => typeof item.label === 'string' && item.label.includes(inputVal);
|
|
51
|
+
const searchData = data.filter(filterFunc);
|
|
52
|
+
const searchResult = new Set(searchData.map(item => item.key));
|
|
67
53
|
|
|
68
54
|
this._adapter.notifySearch(inputVal);
|
|
69
55
|
|
|
@@ -91,27 +77,24 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
91
77
|
|
|
92
78
|
const inSearchMode = inputValue !== '';
|
|
93
79
|
let operateData = [];
|
|
94
|
-
operateData = inSearchMode ?
|
|
80
|
+
operateData = inSearchMode ? data.filter(item => searchResult.has(item.key)) : data;
|
|
95
81
|
operateData = type === strings.TYPE_TREE_TO_LIST ? data : operateData;
|
|
96
|
-
let newSelectedItems = new
|
|
82
|
+
let newSelectedItems = new Map();
|
|
97
83
|
|
|
98
84
|
switch (true) {
|
|
99
85
|
case !wantAllChecked:
|
|
100
|
-
newSelectedItems = new
|
|
101
|
-
|
|
102
|
-
_forEachInstanceProperty(operateData).call(operateData, item => {
|
|
86
|
+
newSelectedItems = new Map(selectedItems);
|
|
87
|
+
operateData.forEach(item => {
|
|
103
88
|
// If the item is disabled, keep it
|
|
104
89
|
if (!item.disabled) {
|
|
105
90
|
newSelectedItems.delete(item.key);
|
|
106
91
|
}
|
|
107
92
|
});
|
|
108
|
-
|
|
109
93
|
break;
|
|
110
94
|
|
|
111
95
|
case wantAllChecked:
|
|
112
|
-
newSelectedItems = new
|
|
113
|
-
|
|
114
|
-
_forEachInstanceProperty(operateData).call(operateData, item => {
|
|
96
|
+
newSelectedItems = new Map(selectedItems);
|
|
97
|
+
operateData.forEach(item => {
|
|
115
98
|
if (item.disabled) {
|
|
116
99
|
// The disabled item, judge whether it is selected, if it is selected, still need to add the selection
|
|
117
100
|
if (selectedItems.has(item.key)) {
|
|
@@ -123,7 +106,6 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
123
106
|
|
|
124
107
|
newSelectedItems.set(item.key, item);
|
|
125
108
|
});
|
|
126
|
-
|
|
127
109
|
break;
|
|
128
110
|
|
|
129
111
|
default:
|
|
@@ -150,9 +132,8 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
150
132
|
return;
|
|
151
133
|
}
|
|
152
134
|
|
|
153
|
-
const newSelectedItems = new
|
|
154
|
-
|
|
155
|
-
_forEachInstanceProperty(data).call(data, item => {
|
|
135
|
+
const newSelectedItems = new Map(selectedItems);
|
|
136
|
+
data.forEach(item => {
|
|
156
137
|
// If the item is disabled, keep it
|
|
157
138
|
if (!item.disabled) {
|
|
158
139
|
newSelectedItems.delete(item.key);
|
|
@@ -204,17 +185,15 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
204
185
|
const {
|
|
205
186
|
data
|
|
206
187
|
} = this.getStates();
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
const allItemsMap = new _Map(dataItems);
|
|
211
|
-
const nextSelectedItemsMap = new _Map();
|
|
188
|
+
const dataItems = data.map(d => [d.value, d]);
|
|
189
|
+
const allItemsMap = new Map(dataItems);
|
|
190
|
+
const nextSelectedItemsMap = new Map();
|
|
212
191
|
|
|
213
192
|
if (disabled) {
|
|
214
193
|
return;
|
|
215
194
|
}
|
|
216
195
|
|
|
217
|
-
|
|
196
|
+
values.forEach(value => {
|
|
218
197
|
const node = allItemsMap.get(value); // The value passed in is an array of the value used, but the internal selectedItems stores a map of keys
|
|
219
198
|
|
|
220
199
|
if (selectedItems.has(node.key)) {
|
|
@@ -273,11 +252,10 @@ export default class TransferFoundation extends BaseFoundation {
|
|
|
273
252
|
|
|
274
253
|
const selectedItems = this._adapter.getSelected();
|
|
275
254
|
|
|
276
|
-
let selectedArr = [...
|
|
255
|
+
let selectedArr = [...selectedItems.values()];
|
|
277
256
|
selectedArr = arrayMove(selectedArr, oldIndex, newIndex);
|
|
278
|
-
let newSelectedItems = new
|
|
279
|
-
|
|
280
|
-
_forEachInstanceProperty(selectedArr).call(selectedArr, option => {
|
|
257
|
+
let newSelectedItems = new Map();
|
|
258
|
+
selectedArr.forEach(option => {
|
|
281
259
|
newSelectedItems = newSelectedItems.set(option.key, option);
|
|
282
260
|
});
|
|
283
261
|
|
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import _omit from "lodash/omit";
|
|
2
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
3
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
4
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
5
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
6
|
-
import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
|
|
7
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
8
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
9
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
10
|
-
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
11
|
-
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
12
2
|
|
|
13
3
|
var __rest = this && this.__rest || function (s, e) {
|
|
14
4
|
var t = {};
|
|
15
5
|
|
|
16
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
17
7
|
|
|
18
|
-
if (s != null && typeof
|
|
19
|
-
if (
|
|
8
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
20
10
|
}
|
|
21
11
|
return t;
|
|
22
12
|
};
|
|
@@ -26,15 +16,13 @@ export function _generateGroupedData(dataSource) {
|
|
|
26
16
|
const newData = [];
|
|
27
17
|
|
|
28
18
|
for (const group of dataSource) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_forEachInstanceProperty(_context = group.children).call(_context, item => {
|
|
19
|
+
group.children.forEach(item => {
|
|
32
20
|
const {
|
|
33
21
|
children
|
|
34
22
|
} = group,
|
|
35
23
|
rest = __rest(group, ["children"]);
|
|
36
24
|
|
|
37
|
-
newData.push(
|
|
25
|
+
newData.push(Object.assign(Object.assign({}, item), {
|
|
38
26
|
_parent: rest
|
|
39
27
|
}));
|
|
40
28
|
});
|
|
@@ -44,25 +32,19 @@ export function _generateGroupedData(dataSource) {
|
|
|
44
32
|
} // DFS
|
|
45
33
|
|
|
46
34
|
export function _generateTreeData(dataSource) {
|
|
47
|
-
var _context2;
|
|
48
|
-
|
|
49
35
|
const newData = [];
|
|
50
|
-
|
|
51
|
-
const stack = _reverseInstanceProperty(_context2 = [...dataSource]).call(_context2);
|
|
36
|
+
const stack = [...dataSource].reverse();
|
|
52
37
|
|
|
53
38
|
while (stack.length) {
|
|
54
39
|
const current = stack.pop();
|
|
55
40
|
current.path = current.path || [_omit(current, ['children'])];
|
|
56
41
|
|
|
57
|
-
if (current.children &&
|
|
42
|
+
if (current.children && Array.isArray(current.children)) {
|
|
58
43
|
const nodes = current.children;
|
|
59
44
|
|
|
60
45
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const child = _Object$assign({}, nodes[i]);
|
|
64
|
-
|
|
65
|
-
child.path = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = []).call(_context4, current.path)).call(_context3, _omit(child, ['children']));
|
|
46
|
+
const child = Object.assign({}, nodes[i]);
|
|
47
|
+
child.path = [].concat(current.path).concat(_omit(child, ['children']));
|
|
66
48
|
stack.push(child);
|
|
67
49
|
}
|
|
68
50
|
} else {
|
|
@@ -75,7 +57,7 @@ export function _generateTreeData(dataSource) {
|
|
|
75
57
|
return newData;
|
|
76
58
|
}
|
|
77
59
|
export function _generateDataByType(dataSource, type) {
|
|
78
|
-
const newData =
|
|
60
|
+
const newData = dataSource.slice() || [];
|
|
79
61
|
|
|
80
62
|
if (type === strings.TYPE_GROUP_LIST) {
|
|
81
63
|
return _generateGroupedData(newData);
|
|
@@ -88,16 +70,14 @@ export function _generateDataByType(dataSource, type) {
|
|
|
88
70
|
return newData;
|
|
89
71
|
}
|
|
90
72
|
export function _generateSelectedItems(value, data) {
|
|
91
|
-
const selectedItems = new
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const index = _findIndexInstanceProperty(data).call(data, option => option.value === val);
|
|
73
|
+
const selectedItems = new Map();
|
|
74
|
+
value.forEach(val => {
|
|
75
|
+
const index = data.findIndex(option => option.value === val);
|
|
95
76
|
|
|
96
77
|
if (index !== -1) {
|
|
97
78
|
const option = data[index];
|
|
98
79
|
selectedItems.set(option.key, option);
|
|
99
80
|
}
|
|
100
81
|
});
|
|
101
|
-
|
|
102
82
|
return selectedItems;
|
|
103
83
|
}
|