@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,20 +1,9 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
import _Date$now from "@babel/runtime-corejs3/core-js-stable/date/now";
|
|
3
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
4
|
-
import _keysInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/keys";
|
|
5
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
-
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/sort";
|
|
7
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
8
|
-
import _entriesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/entries";
|
|
9
|
-
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
10
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
11
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
12
1
|
import BaseFoundation from '../base/foundation';
|
|
13
2
|
import { format, getWeeksInMonth, getWeekOfMonth, isSameMonth, startOfMonth, endOfMonth, isBefore, isAfter, addDays, startOfWeek, differenceInCalendarDays, isSameDay, startOfDay, isSameWeek } from 'date-fns';
|
|
14
3
|
import { parseEvent, parseAllDayEvent, calcWeekData, getCurrDate, parseWeeklyAllDayEvent, sortDate, collectDailyEvents, round, getPos, convertEventsArrToMap, filterWeeklyEvents, renderDailyEvent, calcRangeData, filterEvents, parseRangeAllDayEvent, checkWeekend } from './eventUtil';
|
|
15
4
|
export default class CalendarFoundation extends BaseFoundation {
|
|
16
5
|
constructor(adapter) {
|
|
17
|
-
super(
|
|
6
|
+
super(Object.assign({}, adapter));
|
|
18
7
|
} // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
19
8
|
|
|
20
9
|
|
|
@@ -87,7 +76,7 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
87
76
|
this._adapter.updateCurrPos(round(pos));
|
|
88
77
|
|
|
89
78
|
const frameFunc = () => {
|
|
90
|
-
const timestamp =
|
|
79
|
+
const timestamp = Date.now();
|
|
91
80
|
|
|
92
81
|
if (!startTime) {
|
|
93
82
|
startTime = timestamp;
|
|
@@ -111,12 +100,13 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
111
100
|
|
|
112
101
|
getWeeklyData(value, dateFnsLocale) {
|
|
113
102
|
const data = {};
|
|
114
|
-
data.month = format(value, 'LLL', {
|
|
115
|
-
locale: dateFnsLocale
|
|
116
|
-
});
|
|
117
103
|
const {
|
|
118
104
|
weekStartsOn
|
|
119
105
|
} = this.getProps();
|
|
106
|
+
data.month = format(value, 'LLL', {
|
|
107
|
+
locale: dateFnsLocale,
|
|
108
|
+
weekStartsOn
|
|
109
|
+
});
|
|
120
110
|
data.week = calcWeekData(value, 'week', dateFnsLocale, weekStartsOn);
|
|
121
111
|
|
|
122
112
|
this._adapter.setWeeklyData(data);
|
|
@@ -127,13 +117,15 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
127
117
|
getRangeData(value, dateFnsLocale) {
|
|
128
118
|
const data = {};
|
|
129
119
|
const {
|
|
130
|
-
range
|
|
120
|
+
range,
|
|
121
|
+
weekStartsOn
|
|
131
122
|
} = this.getProps();
|
|
132
123
|
const len = differenceInCalendarDays(range[1], range[0]);
|
|
133
124
|
data.month = format(value, 'LLL', {
|
|
134
|
-
locale: dateFnsLocale
|
|
125
|
+
locale: dateFnsLocale,
|
|
126
|
+
weekStartsOn
|
|
135
127
|
});
|
|
136
|
-
data.week = calcRangeData(value, range[0], len, 'week', dateFnsLocale);
|
|
128
|
+
data.week = calcRangeData(value, range[0], len, 'week', dateFnsLocale, weekStartsOn);
|
|
137
129
|
|
|
138
130
|
this._adapter.setRangeData(data);
|
|
139
131
|
|
|
@@ -141,16 +133,15 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
141
133
|
}
|
|
142
134
|
|
|
143
135
|
getMonthlyData(value, dateFnsLocale) {
|
|
144
|
-
var _context, _context2;
|
|
145
|
-
|
|
146
136
|
const monthStart = startOfMonth(value);
|
|
147
137
|
const data = {};
|
|
148
138
|
const {
|
|
149
139
|
weekStartsOn
|
|
150
140
|
} = this.getProps();
|
|
151
|
-
const numberOfWeek = getWeeksInMonth(value
|
|
152
|
-
|
|
153
|
-
|
|
141
|
+
const numberOfWeek = getWeeksInMonth(value, {
|
|
142
|
+
weekStartsOn
|
|
143
|
+
});
|
|
144
|
+
[...Array(numberOfWeek).keys()].map(ind => {
|
|
154
145
|
data[ind] = calcWeekData(addDays(monthStart, ind * 7), 'month', dateFnsLocale, weekStartsOn);
|
|
155
146
|
});
|
|
156
147
|
|
|
@@ -161,25 +152,19 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
161
152
|
|
|
162
153
|
|
|
163
154
|
_parseEvents(events) {
|
|
164
|
-
var _context3;
|
|
165
|
-
|
|
166
155
|
const parsed = {
|
|
167
156
|
allDay: [],
|
|
168
157
|
day: []
|
|
169
158
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
_forEachInstanceProperty(item).call(item, i => {
|
|
159
|
+
events.map(event => parseEvent(event)).forEach(item => {
|
|
160
|
+
item.forEach(i => {
|
|
173
161
|
i.allDay ? parsed.allDay.push(i) : parsed.day.push(i);
|
|
174
162
|
});
|
|
175
163
|
});
|
|
176
|
-
|
|
177
164
|
return parsed;
|
|
178
165
|
}
|
|
179
166
|
|
|
180
167
|
getParseDailyEvents(events, date) {
|
|
181
|
-
var _context4;
|
|
182
|
-
|
|
183
168
|
if (!date) {
|
|
184
169
|
date = this._getDate();
|
|
185
170
|
}
|
|
@@ -201,7 +186,7 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
201
186
|
parsed.day = [];
|
|
202
187
|
}
|
|
203
188
|
|
|
204
|
-
parsed.day =
|
|
189
|
+
parsed.day = parsed.day.map(item => renderDailyEvent(item));
|
|
205
190
|
return parsed;
|
|
206
191
|
}
|
|
207
192
|
|
|
@@ -214,38 +199,30 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
214
199
|
|
|
215
200
|
this._adapter.setParsedEvents(parsed);
|
|
216
201
|
|
|
217
|
-
this._adapter.cacheEventKeys(
|
|
202
|
+
this._adapter.cacheEventKeys(events.map(i => i.key));
|
|
218
203
|
} // ================== Weekly Event ==================
|
|
219
204
|
|
|
220
205
|
|
|
221
206
|
_parseWeeklyEvents(events, weekStart) {
|
|
222
|
-
|
|
223
|
-
|
|
207
|
+
const {
|
|
208
|
+
weekStartsOn
|
|
209
|
+
} = this.getProps();
|
|
224
210
|
let parsed = [[]];
|
|
225
|
-
const filtered = filterWeeklyEvents(events, weekStart);
|
|
226
|
-
|
|
227
|
-
_forEachInstanceProperty(_context5 = _sortInstanceProperty(_context6 = [..._keysInstanceProperty(filtered).call(filtered)]).call(_context6, (a, b) => sortDate(a, b))).call(_context5, item => {
|
|
228
|
-
var _context7;
|
|
229
|
-
|
|
211
|
+
const filtered = filterWeeklyEvents(events, weekStart, weekStartsOn);
|
|
212
|
+
[...filtered.keys()].sort((a, b) => sortDate(a, b)).forEach(item => {
|
|
230
213
|
const startDate = new Date(item);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
parsed = parseWeeklyAllDayEvent(curr, startDate, weekStart, parsed);
|
|
214
|
+
const curr = filtered.get(item).filter(event => isSameDay(event.date, startDate));
|
|
215
|
+
parsed = parseWeeklyAllDayEvent(curr, startDate, weekStart, parsed, weekStartsOn);
|
|
235
216
|
});
|
|
236
|
-
|
|
237
217
|
return parsed;
|
|
238
218
|
}
|
|
239
219
|
|
|
240
220
|
_renderWeeklyAllDayEvent(events) {
|
|
241
221
|
const res = [];
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const event = _filterInstanceProperty(row).call(row, item => 'leftPos' in item);
|
|
245
|
-
|
|
222
|
+
events.forEach(row => {
|
|
223
|
+
const event = row.filter(item => 'leftPos' in item);
|
|
246
224
|
res.push(...event);
|
|
247
225
|
});
|
|
248
|
-
|
|
249
226
|
return res;
|
|
250
227
|
} // return parsed weekly allday events
|
|
251
228
|
|
|
@@ -285,7 +262,7 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
285
262
|
|
|
286
263
|
this._adapter.setParsedEvents(parsed);
|
|
287
264
|
|
|
288
|
-
this._adapter.cacheEventKeys(
|
|
265
|
+
this._adapter.cacheEventKeys(events.map(i => i.key));
|
|
289
266
|
} // ================== Monthly Event ==================
|
|
290
267
|
|
|
291
268
|
|
|
@@ -300,9 +277,9 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
300
277
|
convertMapToArray(weekMap, weekStart) {
|
|
301
278
|
const eventArray = [];
|
|
302
279
|
|
|
303
|
-
for (const entry of
|
|
280
|
+
for (const entry of weekMap.entries()) {
|
|
304
281
|
const [key, value] = entry;
|
|
305
|
-
const map = new
|
|
282
|
+
const map = new Map();
|
|
306
283
|
map.set(key, value);
|
|
307
284
|
|
|
308
285
|
const weekEvents = this._parseWeeklyEvents(map, weekStart);
|
|
@@ -314,12 +291,11 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
314
291
|
}
|
|
315
292
|
|
|
316
293
|
getParseMonthlyEvents(itemLimit) {
|
|
317
|
-
var _context8, _context9;
|
|
318
|
-
|
|
319
294
|
const parsed = {};
|
|
320
295
|
const {
|
|
321
296
|
displayValue,
|
|
322
|
-
events
|
|
297
|
+
events,
|
|
298
|
+
weekStartsOn
|
|
323
299
|
} = this.getProps();
|
|
324
300
|
|
|
325
301
|
const currDate = this._getDate();
|
|
@@ -327,8 +303,7 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
327
303
|
const firstDayOfMonth = startOfMonth(displayValue);
|
|
328
304
|
const lastDayOfMonth = endOfMonth(displayValue);
|
|
329
305
|
const res = [];
|
|
330
|
-
|
|
331
|
-
_forEachInstanceProperty(_context8 = _sortInstanceProperty(events).call(events, (prev, next) => {
|
|
306
|
+
events.sort((prev, next) => {
|
|
332
307
|
if (isBefore(prev.start, next.start)) {
|
|
333
308
|
return -1;
|
|
334
309
|
}
|
|
@@ -338,25 +313,27 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
338
313
|
}
|
|
339
314
|
|
|
340
315
|
return 0;
|
|
341
|
-
})
|
|
316
|
+
}).forEach(event => {
|
|
342
317
|
const parsedEvent = parseAllDayEvent(event, event.allDay, currDate);
|
|
343
318
|
res.push(...parsedEvent);
|
|
344
319
|
});
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
_forEachInstanceProperty(res).call(res, item => {
|
|
320
|
+
res.filter(item => isSameMonth(item.date, displayValue));
|
|
321
|
+
res.forEach(item => {
|
|
349
322
|
// WeekInd calculation error, need to consider the boundary situation at the beginning/end of the month
|
|
350
323
|
// When the date falls within the month
|
|
351
324
|
if (isSameMonth(item.date, displayValue)) {
|
|
352
|
-
const weekInd = getWeekOfMonth(item.date
|
|
325
|
+
const weekInd = getWeekOfMonth(item.date, {
|
|
326
|
+
weekStartsOn
|
|
327
|
+
}) - 1;
|
|
353
328
|
this.pushDayEventIntoWeekMap(item, weekInd, parsed);
|
|
354
329
|
return;
|
|
355
330
|
} // When the date is within the previous month
|
|
356
331
|
|
|
357
332
|
|
|
358
333
|
if (isBefore(item.date, firstDayOfMonth)) {
|
|
359
|
-
if (isSameWeek(item.date, firstDayOfMonth
|
|
334
|
+
if (isSameWeek(item.date, firstDayOfMonth, {
|
|
335
|
+
weekStartsOn
|
|
336
|
+
})) {
|
|
360
337
|
this.pushDayEventIntoWeekMap(item, 0, parsed);
|
|
361
338
|
}
|
|
362
339
|
|
|
@@ -365,19 +342,24 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
365
342
|
|
|
366
343
|
|
|
367
344
|
if (isAfter(item.date, lastDayOfMonth)) {
|
|
368
|
-
if (isSameWeek(item.date, lastDayOfMonth
|
|
369
|
-
|
|
345
|
+
if (isSameWeek(item.date, lastDayOfMonth, {
|
|
346
|
+
weekStartsOn
|
|
347
|
+
})) {
|
|
348
|
+
const weekInd = getWeekOfMonth(lastDayOfMonth, {
|
|
349
|
+
weekStartsOn
|
|
350
|
+
}) - 1;
|
|
370
351
|
this.pushDayEventIntoWeekMap(item, weekInd, parsed);
|
|
371
352
|
}
|
|
372
353
|
|
|
373
354
|
return;
|
|
374
355
|
}
|
|
375
356
|
});
|
|
376
|
-
|
|
377
|
-
_forEachInstanceProperty(_context9 = _Object$keys(parsed)).call(_context9, key => {
|
|
357
|
+
Object.keys(parsed).forEach(key => {
|
|
378
358
|
const week = parsed[key];
|
|
379
359
|
parsed[key] = {};
|
|
380
|
-
const weekStart = startOfWeek(week[0].date
|
|
360
|
+
const weekStart = startOfWeek(week[0].date, {
|
|
361
|
+
weekStartsOn
|
|
362
|
+
});
|
|
381
363
|
const weekMap = convertEventsArrToMap(week, 'start', startOfDay); // When there are multiple events in a week, multiple events should be parsed
|
|
382
364
|
// const oldParsedWeeklyEvent = this._parseWeeklyEvents(weekMap, weekStart);
|
|
383
365
|
|
|
@@ -385,7 +367,6 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
385
367
|
parsed[key].day = collectDailyEvents(parsedWeeklyEvent);
|
|
386
368
|
parsed[key].display = this._renderDisplayEvents(parsedWeeklyEvent);
|
|
387
369
|
});
|
|
388
|
-
|
|
389
370
|
return parsed;
|
|
390
371
|
}
|
|
391
372
|
|
|
@@ -399,12 +380,12 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
399
380
|
|
|
400
381
|
this._adapter.setItemLimit(itemLimit);
|
|
401
382
|
|
|
402
|
-
this._adapter.cacheEventKeys(
|
|
383
|
+
this._adapter.cacheEventKeys(events.map(i => i.key));
|
|
403
384
|
}
|
|
404
385
|
|
|
405
386
|
_renderDisplayEvents(events) {
|
|
406
387
|
// Limits should not be added when calculating the relative position of each event, because there will be calculations that separate two events in the middle of the week
|
|
407
|
-
let displayEvents =
|
|
388
|
+
let displayEvents = events.slice();
|
|
408
389
|
|
|
409
390
|
if (displayEvents.length) {
|
|
410
391
|
displayEvents = this._renderWeeklyAllDayEvent(displayEvents);
|
|
@@ -415,34 +396,23 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
415
396
|
|
|
416
397
|
|
|
417
398
|
_parseRangeEvents(events) {
|
|
418
|
-
var _context10, _context11;
|
|
419
|
-
|
|
420
399
|
let parsed = [[]];
|
|
421
400
|
const [start, end] = this.getProp('range');
|
|
422
401
|
const filtered = filterEvents(events, start, end);
|
|
423
|
-
|
|
424
|
-
_forEachInstanceProperty(_context10 = _sortInstanceProperty(_context11 = [..._keysInstanceProperty(filtered).call(filtered)]).call(_context11, (a, b) => sortDate(a, b))).call(_context10, item => {
|
|
425
|
-
var _context12;
|
|
426
|
-
|
|
402
|
+
[...filtered.keys()].sort((a, b) => sortDate(a, b)).forEach(item => {
|
|
427
403
|
const startDate = new Date(item);
|
|
428
|
-
|
|
429
|
-
const curr = _filterInstanceProperty(_context12 = filtered.get(item)).call(_context12, event => isSameDay(event.date, startDate));
|
|
430
|
-
|
|
404
|
+
const curr = filtered.get(item).filter(event => isSameDay(event.date, startDate));
|
|
431
405
|
parsed = parseRangeAllDayEvent(curr, startDate, start, end, parsed);
|
|
432
406
|
});
|
|
433
|
-
|
|
434
407
|
return parsed;
|
|
435
408
|
}
|
|
436
409
|
|
|
437
410
|
_renderRangeAllDayEvent(events) {
|
|
438
411
|
let res = [];
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
const event = _filterInstanceProperty(row).call(row, item => 'leftPos' in item);
|
|
442
|
-
|
|
412
|
+
events.forEach(row => {
|
|
413
|
+
const event = row.filter(item => 'leftPos' in item);
|
|
443
414
|
res = [...res, ...event];
|
|
444
415
|
});
|
|
445
|
-
|
|
446
416
|
return res;
|
|
447
417
|
} // return parsed weekly allday events
|
|
448
418
|
|
|
@@ -473,7 +443,7 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
473
443
|
|
|
474
444
|
this._adapter.setParsedEvents(parsed);
|
|
475
445
|
|
|
476
|
-
this._adapter.cacheEventKeys(
|
|
446
|
+
this._adapter.cacheEventKeys(events.map(i => i.key));
|
|
477
447
|
}
|
|
478
448
|
|
|
479
449
|
checkWeekend(val) {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import _get from "lodash/get";
|
|
2
2
|
import _isObject from "lodash/isObject";
|
|
3
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
4
|
-
import _setInterval from "@babel/runtime-corejs3/core-js-stable/set-interval";
|
|
5
3
|
import BaseFoundation from '../base/foundation';
|
|
6
4
|
import { numbers } from './constants';
|
|
7
5
|
|
|
8
6
|
class CarouselFoundation extends BaseFoundation {
|
|
9
7
|
constructor(adapter) {
|
|
10
|
-
super(
|
|
8
|
+
super(Object.assign({}, adapter));
|
|
11
9
|
this._interval = null;
|
|
12
10
|
}
|
|
13
11
|
|
|
@@ -16,7 +14,7 @@ class CarouselFoundation extends BaseFoundation {
|
|
|
16
14
|
clearInterval(this._interval);
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
this._interval =
|
|
17
|
+
this._interval = setInterval(() => {
|
|
20
18
|
this.next();
|
|
21
19
|
}, interval);
|
|
22
20
|
}
|