@tuya-miniapp/smart-ui 1.3.1-beta-2 → 1.3.1-beta-4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/action-sheet/demo/index.d.ts +1 -0
- package/dist/action-sheet/demo/index.js +101 -0
- package/dist/action-sheet/index.js +1 -1
- package/dist/area/demo/index.d.ts +1 -0
- package/dist/area/demo/index.js +41 -0
- package/dist/area/index.js +4 -5
- package/dist/battery/demo/index.d.ts +1 -0
- package/dist/battery/demo/index.js +2 -0
- package/dist/battery/index.js +1 -3
- package/dist/bottom-sheet/demo/index.d.ts +1 -0
- package/dist/bottom-sheet/demo/index.js +24 -0
- package/dist/bottom-sheet/index.css +1 -1
- package/dist/bottom-sheet/index.js +3 -2
- package/dist/bottom-sheet/index.wxml +3 -1
- package/dist/bottom-sheet/index.wxss +1 -1
- package/dist/button/demo/index.d.ts +1 -0
- package/dist/button/demo/index.js +9 -0
- package/dist/button/index.js +1 -1
- package/dist/calendar/calendar.wxml +13 -8
- package/dist/calendar/components/header/index.css +1 -1
- package/dist/calendar/components/header/index.js +7 -3
- package/dist/calendar/components/header/index.wxml +3 -3
- package/dist/calendar/components/header/index.wxss +1 -1
- package/dist/calendar/components/month/index.css +1 -1
- package/dist/calendar/components/month/index.js +3 -5
- package/dist/calendar/components/month/index.wxs +1 -4
- package/dist/calendar/components/month/index.wxss +1 -1
- package/dist/calendar/components/month-list/index.css +1 -1
- package/dist/calendar/components/month-list/index.js +26 -41
- package/dist/calendar/components/month-list/index.wxml +8 -2
- package/dist/calendar/components/month-list/index.wxss +1 -1
- package/dist/calendar/components/year-list/index.css +1 -1
- package/dist/calendar/components/year-list/index.js +17 -4
- package/dist/calendar/components/year-list/index.wxml +8 -2
- package/dist/calendar/components/year-list/index.wxss +1 -1
- package/dist/calendar/demo/index.d.ts +1 -0
- package/dist/calendar/demo/index.js +103 -0
- package/dist/calendar/index.js +32 -39
- package/dist/calendar/index.wxs +5 -8
- package/dist/calendar/utils.d.ts +4 -0
- package/dist/calendar/utils.js +30 -4
- package/dist/cascader/demo/index.d.ts +1 -0
- package/dist/cascader/demo/index.js +191 -0
- package/dist/cascader/index.js +3 -3
- package/dist/cell/demo/index.d.ts +1 -0
- package/dist/cell/demo/index.js +14 -0
- package/dist/cell/index.js +1 -7
- package/dist/checkbox/demo/index.d.ts +1 -0
- package/dist/checkbox/demo/index.js +34 -0
- package/dist/checkbox-group/index.js +1 -1
- package/dist/circle/demo/index.d.ts +1 -0
- package/dist/circle/demo/index.js +19 -0
- package/dist/col/demo/index.d.ts +1 -0
- package/dist/col/demo/index.js +4 -0
- package/dist/collapse/demo/index.d.ts +1 -0
- package/dist/collapse/demo/index.js +36 -0
- package/dist/collapse/index.js +1 -1
- package/dist/collapse-item/animate.js +1 -1
- package/dist/common/component.js +1 -1
- package/dist/common/utils.js +3 -3
- package/dist/config-provider/demo/index.d.ts +1 -0
- package/dist/config-provider/demo/index.js +22 -0
- package/dist/count-down/demo/index.d.ts +1 -0
- package/dist/count-down/demo/index.js +33 -0
- package/dist/custom-keyboard/demo/index.d.ts +1 -0
- package/dist/custom-keyboard/demo/index.js +17 -0
- package/dist/custom-keyboard/index.js +1 -3
- package/dist/datetime-picker/demo/index.d.ts +1 -0
- package/dist/datetime-picker/demo/index.js +63 -0
- package/dist/datetime-picker/index.js +4 -5
- package/dist/dialog/demo/index.d.ts +1 -0
- package/dist/dialog/demo/index.js +134 -0
- package/dist/dialog/dialog.js +3 -5
- package/dist/dialog/index.js +1 -1
- package/dist/divider/demo/index.d.ts +1 -0
- package/dist/divider/demo/index.js +4 -0
- package/dist/dropdown-item/index.js +3 -3
- package/dist/dropdown-item/index.wxml +1 -7
- package/dist/dropdown-menu/demo/index.d.ts +1 -0
- package/dist/dropdown-menu/demo/index.js +47 -0
- package/dist/dropdown-menu/index.js +8 -10
- package/dist/empty/demo/index.d.ts +1 -0
- package/dist/empty/demo/index.js +13 -0
- package/dist/empty/index.css +1 -1
- package/dist/empty/index.wxs +1 -1
- package/dist/empty/index.wxss +1 -1
- package/dist/field/demo/index.d.ts +1 -0
- package/dist/field/demo/index.js +21 -0
- package/dist/goods-action/demo/index.d.ts +1 -0
- package/dist/goods-action/demo/index.js +12 -0
- package/dist/goods-action/index.js +1 -1
- package/dist/grid/demo/index.d.ts +1 -0
- package/dist/grid/demo/index.js +9 -0
- package/dist/grid/index.js +1 -1
- package/dist/grid-item/index.js +1 -1
- package/dist/icon/demo/index.d.ts +1 -0
- package/dist/icon/demo/index.js +26 -0
- package/dist/image/demo/index.d.ts +1 -0
- package/dist/image/demo/index.js +15 -0
- package/dist/index-anchor/index.js +1 -1
- package/dist/index-bar/demo/index.d.ts +1 -0
- package/dist/index-bar/demo/index.js +21 -0
- package/dist/index-bar/index.js +9 -16
- package/dist/loading/demo/index.d.ts +1 -0
- package/dist/loading/demo/index.js +4 -0
- package/dist/loading/index.js +25 -1
- package/dist/loading/index.wxml +2 -2
- package/dist/loading/index.wxs +6 -21
- package/dist/mixins/basic.js +2 -2
- package/dist/mixins/link.js +1 -2
- package/dist/mixins/page-scroll.js +1 -1
- package/dist/mixins/touch.js +1 -2
- package/dist/mixins/transition.js +1 -1
- package/dist/nav-bar/demo/index.d.ts +1 -0
- package/dist/nav-bar/demo/index.js +26 -0
- package/dist/nav-bar/index.css +1 -1
- package/dist/nav-bar/index.js +1 -1
- package/dist/nav-bar/index.wxml +1 -1
- package/dist/nav-bar/index.wxss +1 -1
- package/dist/normal-slider/demo/index.d.ts +1 -0
- package/dist/normal-slider/demo/index.js +19 -0
- package/dist/notice-bar/demo/index.d.ts +1 -0
- package/dist/notice-bar/demo/index.js +11 -0
- package/dist/notice-bar/index.css +1 -1
- package/dist/notice-bar/index.js +3 -6
- package/dist/notice-bar/index.wxml +1 -5
- package/dist/notice-bar/index.wxss +1 -1
- package/dist/notify/demo/index.d.ts +1 -0
- package/dist/notify/demo/index.js +45 -0
- package/dist/overlay/demo/index.d.ts +1 -0
- package/dist/overlay/demo/index.js +22 -0
- package/dist/picker/demo/index.d.ts +1 -0
- package/dist/picker/demo/index.js +76 -0
- package/dist/picker/index.css +1 -1
- package/dist/picker/index.js +2 -2
- package/dist/picker/index.wxml +1 -0
- package/dist/picker/index.wxss +1 -1
- package/dist/picker-column/index.js +3 -8
- package/dist/popup/demo/index.d.ts +1 -0
- package/dist/popup/demo/index.js +79 -0
- package/dist/progress/demo/index.d.ts +1 -0
- package/dist/progress/demo/index.js +4 -0
- package/dist/progress/index.js +1 -4
- package/dist/radio/demo/index.d.ts +1 -0
- package/dist/radio/demo/index.js +31 -0
- package/dist/radio-group/index.js +1 -1
- package/dist/rate/demo/index.d.ts +1 -0
- package/dist/rate/demo/index.js +25 -0
- package/dist/rate/index.js +2 -2
- package/dist/row/index.js +1 -1
- package/dist/search/demo/index.d.ts +1 -0
- package/dist/search/demo/index.js +43 -0
- package/dist/search/index.css +1 -1
- package/dist/search/index.js +1 -5
- package/dist/search/index.wxml +1 -1
- package/dist/search/index.wxss +1 -1
- package/dist/sidebar/demo/index.d.ts +1 -0
- package/dist/sidebar/demo/index.js +9 -0
- package/dist/skeleton/demo/index.d.ts +1 -0
- package/dist/skeleton/demo/index.js +11 -0
- package/dist/slider/demo/index.d.ts +1 -0
- package/dist/slider/demo/index.js +19 -0
- package/dist/slider/index.js +5 -7
- package/dist/stepper/demo/index.d.ts +1 -0
- package/dist/stepper/demo/index.js +19 -0
- package/dist/steps/demo/index.d.ts +1 -0
- package/dist/steps/demo/index.js +42 -0
- package/dist/sticky/demo/index.d.ts +1 -0
- package/dist/sticky/demo/index.js +26 -0
- package/dist/sticky/index.js +2 -2
- package/dist/swipe-cell/demo/index.d.ts +1 -0
- package/dist/swipe-cell/demo/index.js +45 -0
- package/dist/swipe-cell/index.js +3 -5
- package/dist/switch/demo/index.d.ts +1 -0
- package/dist/switch/demo/index.js +29 -0
- package/dist/switch/index.css +1 -1
- package/dist/switch/index.wxss +1 -1
- package/dist/tab/demo/index.d.ts +1 -0
- package/dist/tab/demo/index.js +55 -0
- package/dist/tabbar/demo/index.d.ts +1 -0
- package/dist/tabbar/demo/index.js +34 -0
- package/dist/tabbar/index.js +1 -1
- package/dist/tabs/index.css +1 -1
- package/dist/tabs/index.js +7 -25
- package/dist/tabs/index.wxss +1 -1
- package/dist/tag/demo/index.d.ts +1 -0
- package/dist/tag/demo/index.js +16 -0
- package/dist/tag/index.css +1 -1
- package/dist/tag/index.wxss +1 -1
- package/dist/toast/demo/index.d.ts +1 -0
- package/dist/toast/demo/index.js +67 -0
- package/dist/toast/toast.js +5 -5
- package/dist/transition/demo/index.d.ts +1 -0
- package/dist/transition/demo/index.js +67 -0
- package/dist/tree-select/demo/index.d.ts +1 -0
- package/dist/tree-select/demo/index.js +113 -0
- package/dist/wxs/style.wxs +0 -7
- package/lib/action-sheet/demo/index.d.ts +1 -0
- package/lib/action-sheet/demo/index.js +115 -0
- package/lib/area/demo/index.d.ts +1 -0
- package/lib/area/demo/index.js +47 -0
- package/lib/area/index.js +1 -2
- package/lib/battery/demo/index.d.ts +1 -0
- package/lib/battery/demo/index.js +4 -0
- package/lib/battery/index.js +1 -3
- package/lib/bottom-sheet/demo/index.d.ts +1 -0
- package/lib/bottom-sheet/demo/index.js +27 -0
- package/lib/bottom-sheet/index.css +1 -1
- package/lib/bottom-sheet/index.js +3 -2
- package/lib/bottom-sheet/index.wxml +3 -1
- package/lib/bottom-sheet/index.wxss +1 -1
- package/lib/button/demo/index.d.ts +1 -0
- package/lib/button/demo/index.js +14 -0
- package/lib/calendar/calendar.wxml +13 -8
- package/lib/calendar/components/header/index.css +1 -1
- package/lib/calendar/components/header/index.js +6 -2
- package/lib/calendar/components/header/index.wxml +3 -3
- package/lib/calendar/components/header/index.wxss +1 -1
- package/lib/calendar/components/month/index.css +1 -1
- package/lib/calendar/components/month/index.js +2 -6
- package/lib/calendar/components/month/index.wxs +1 -4
- package/lib/calendar/components/month/index.wxss +1 -1
- package/lib/calendar/components/month-list/index.css +1 -1
- package/lib/calendar/components/month-list/index.js +25 -40
- package/lib/calendar/components/month-list/index.wxml +8 -2
- package/lib/calendar/components/month-list/index.wxss +1 -1
- package/lib/calendar/components/year-list/index.css +1 -1
- package/lib/calendar/components/year-list/index.js +15 -2
- package/lib/calendar/components/year-list/index.wxml +8 -2
- package/lib/calendar/components/year-list/index.wxss +1 -1
- package/lib/calendar/demo/index.d.ts +1 -0
- package/lib/calendar/demo/index.js +105 -0
- package/lib/calendar/index.js +29 -38
- package/lib/calendar/index.wxs +5 -8
- package/lib/calendar/utils.d.ts +4 -0
- package/lib/calendar/utils.js +31 -4
- package/lib/cascader/demo/index.d.ts +1 -0
- package/lib/cascader/demo/index.js +197 -0
- package/lib/cell/demo/index.d.ts +1 -0
- package/lib/cell/demo/index.js +39 -0
- package/lib/cell/index.js +1 -7
- package/lib/checkbox/demo/index.d.ts +1 -0
- package/lib/checkbox/demo/index.js +38 -0
- package/lib/circle/demo/index.d.ts +1 -0
- package/lib/circle/demo/index.js +21 -0
- package/lib/col/demo/index.d.ts +1 -0
- package/lib/col/demo/index.js +6 -0
- package/lib/collapse/demo/index.d.ts +1 -0
- package/lib/collapse/demo/index.js +42 -0
- package/lib/config-provider/demo/index.d.ts +1 -0
- package/lib/config-provider/demo/index.js +24 -0
- package/lib/count-down/demo/index.d.ts +1 -0
- package/lib/count-down/demo/index.js +38 -0
- package/lib/custom-keyboard/demo/index.d.ts +1 -0
- package/lib/custom-keyboard/demo/index.js +19 -0
- package/lib/custom-keyboard/index.js +1 -3
- package/lib/datetime-picker/demo/index.d.ts +1 -0
- package/lib/datetime-picker/demo/index.js +68 -0
- package/lib/datetime-picker/index.js +4 -3
- package/lib/dialog/demo/index.d.ts +1 -0
- package/lib/dialog/demo/index.js +144 -0
- package/lib/dialog/dialog.js +1 -3
- package/lib/divider/demo/index.d.ts +1 -0
- package/lib/divider/demo/index.js +6 -0
- package/lib/dropdown-item/index.wxml +1 -7
- package/lib/dropdown-menu/demo/index.d.ts +1 -0
- package/lib/dropdown-menu/demo/index.js +52 -0
- package/lib/dropdown-menu/index.js +2 -4
- package/lib/empty/demo/index.d.ts +1 -0
- package/lib/empty/demo/index.js +15 -0
- package/lib/empty/index.css +1 -1
- package/lib/empty/index.wxs +1 -1
- package/lib/empty/index.wxss +1 -1
- package/lib/field/demo/index.d.ts +1 -0
- package/lib/field/demo/index.js +23 -0
- package/lib/goods-action/demo/index.d.ts +1 -0
- package/lib/goods-action/demo/index.js +17 -0
- package/lib/grid/demo/index.d.ts +1 -0
- package/lib/grid/demo/index.js +11 -0
- package/lib/icon/demo/index.d.ts +1 -0
- package/lib/icon/demo/index.js +54 -0
- package/lib/image/demo/index.d.ts +1 -0
- package/lib/image/demo/index.js +17 -0
- package/lib/index-bar/demo/index.d.ts +1 -0
- package/lib/index-bar/demo/index.js +23 -0
- package/lib/index-bar/index.js +3 -10
- package/lib/loading/demo/index.d.ts +1 -0
- package/lib/loading/demo/index.js +6 -0
- package/lib/loading/index.js +27 -1
- package/lib/loading/index.wxml +2 -2
- package/lib/loading/index.wxs +6 -21
- package/lib/mixins/link.js +1 -2
- package/lib/mixins/touch.js +1 -2
- package/lib/nav-bar/demo/index.d.ts +1 -0
- package/lib/nav-bar/demo/index.js +31 -0
- package/lib/nav-bar/index.css +1 -1
- package/lib/nav-bar/index.wxml +1 -1
- package/lib/nav-bar/index.wxss +1 -1
- package/lib/normal-slider/demo/index.d.ts +1 -0
- package/lib/normal-slider/demo/index.js +21 -0
- package/lib/notice-bar/demo/index.d.ts +1 -0
- package/lib/notice-bar/demo/index.js +16 -0
- package/lib/notice-bar/index.css +1 -1
- package/lib/notice-bar/index.js +2 -5
- package/lib/notice-bar/index.wxml +1 -5
- package/lib/notice-bar/index.wxss +1 -1
- package/lib/notify/demo/index.d.ts +1 -0
- package/lib/notify/demo/index.js +50 -0
- package/lib/overlay/demo/index.d.ts +1 -0
- package/lib/overlay/demo/index.js +24 -0
- package/lib/picker/demo/index.d.ts +1 -0
- package/lib/picker/demo/index.js +82 -0
- package/lib/picker/index.css +1 -1
- package/lib/picker/index.js +1 -3
- package/lib/picker/index.wxml +1 -0
- package/lib/picker/index.wxss +1 -1
- package/lib/picker-column/index.js +2 -7
- package/lib/popup/demo/index.d.ts +1 -0
- package/lib/popup/demo/index.js +85 -0
- package/lib/progress/demo/index.d.ts +1 -0
- package/lib/progress/demo/index.js +6 -0
- package/lib/progress/index.js +1 -4
- package/lib/radio/demo/index.d.ts +1 -0
- package/lib/radio/demo/index.js +34 -0
- package/lib/rate/demo/index.d.ts +1 -0
- package/lib/rate/demo/index.js +30 -0
- package/lib/search/demo/index.d.ts +1 -0
- package/lib/search/demo/index.js +48 -0
- package/lib/search/index.css +1 -1
- package/lib/search/index.js +1 -5
- package/lib/search/index.wxml +1 -1
- package/lib/search/index.wxss +1 -1
- package/lib/sidebar/demo/index.d.ts +1 -0
- package/lib/sidebar/demo/index.js +14 -0
- package/lib/skeleton/demo/index.d.ts +1 -0
- package/lib/skeleton/demo/index.js +14 -0
- package/lib/slider/demo/index.d.ts +1 -0
- package/lib/slider/demo/index.js +21 -0
- package/lib/slider/index.js +1 -3
- package/lib/stepper/demo/index.d.ts +1 -0
- package/lib/stepper/demo/index.js +25 -0
- package/lib/steps/demo/index.d.ts +1 -0
- package/lib/steps/demo/index.js +47 -0
- package/lib/sticky/demo/index.d.ts +1 -0
- package/lib/sticky/demo/index.js +30 -0
- package/lib/sticky/index.js +3 -1
- package/lib/swipe-cell/demo/index.d.ts +1 -0
- package/lib/swipe-cell/demo/index.js +50 -0
- package/lib/swipe-cell/index.js +1 -3
- package/lib/switch/demo/index.d.ts +1 -0
- package/lib/switch/demo/index.js +37 -0
- package/lib/switch/index.css +1 -1
- package/lib/switch/index.wxss +1 -1
- package/lib/tab/demo/index.d.ts +1 -0
- package/lib/tab/demo/index.js +57 -0
- package/lib/tabbar/demo/index.d.ts +1 -0
- package/lib/tabbar/demo/index.js +41 -0
- package/lib/tabs/index.css +1 -1
- package/lib/tabs/index.js +6 -24
- package/lib/tabs/index.wxss +1 -1
- package/lib/tag/demo/index.d.ts +1 -0
- package/lib/tag/demo/index.js +19 -0
- package/lib/tag/index.css +1 -1
- package/lib/tag/index.wxss +1 -1
- package/lib/toast/demo/index.d.ts +1 -0
- package/lib/toast/demo/index.js +74 -0
- package/lib/toast/toast.js +3 -3
- package/lib/transition/demo/index.d.ts +1 -0
- package/lib/transition/demo/index.js +71 -0
- package/lib/tree-select/demo/index.d.ts +1 -0
- package/lib/tree-select/demo/index.js +130 -0
- package/lib/wxs/style.wxs +0 -7
- package/package.json +15 -3
@@ -1,6 +1,9 @@
|
|
1
1
|
// components/month-list.js
|
2
2
|
import { getMonths } from '../../utils';
|
3
3
|
import { SmartComponent } from '../../../common/component';
|
4
|
+
const currentYear = new Date().getFullYear();
|
5
|
+
const minMonthDate = new Date(currentYear - 10, 1, 1).getTime();
|
6
|
+
const maxMonthDate = new Date(currentYear + 10, 12, 31).getTime();
|
4
7
|
SmartComponent({
|
5
8
|
/**
|
6
9
|
* 组件的属性列表
|
@@ -10,47 +13,29 @@ SmartComponent({
|
|
10
13
|
type: null,
|
11
14
|
observer(newVal, oldVal) {
|
12
15
|
if (newVal !== oldVal) {
|
13
|
-
this.
|
16
|
+
this.getMonthList();
|
14
17
|
}
|
15
18
|
},
|
16
19
|
},
|
20
|
+
color: {
|
21
|
+
type: String,
|
22
|
+
value: '#3678e3',
|
23
|
+
},
|
17
24
|
minDate: {
|
18
25
|
type: null,
|
19
|
-
value:
|
26
|
+
value: minMonthDate,
|
20
27
|
},
|
21
28
|
maxDate: {
|
22
29
|
type: null,
|
23
|
-
value:
|
30
|
+
value: maxMonthDate,
|
24
31
|
},
|
25
|
-
|
26
|
-
type:
|
27
|
-
value:
|
28
|
-
},
|
29
|
-
visibleIndex: {
|
30
|
-
type: Number,
|
31
|
-
value: 0,
|
32
|
-
observer(newVal, oldVal) {
|
33
|
-
if (newVal !== oldVal) {
|
34
|
-
this.getMonthList();
|
35
|
-
}
|
36
|
-
},
|
32
|
+
readonly: {
|
33
|
+
type: Boolean,
|
34
|
+
value: false,
|
37
35
|
},
|
38
36
|
monthsFormatter: {
|
39
37
|
type: null,
|
40
|
-
value: [
|
41
|
-
'Jan',
|
42
|
-
'Feb',
|
43
|
-
'Mar',
|
44
|
-
'Apr',
|
45
|
-
'May',
|
46
|
-
'Jun',
|
47
|
-
'Jul',
|
48
|
-
'Aug',
|
49
|
-
'Sept',
|
50
|
-
'Oct',
|
51
|
-
'Nov',
|
52
|
-
'Dec',
|
53
|
-
],
|
38
|
+
value: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'],
|
54
39
|
},
|
55
40
|
},
|
56
41
|
/**
|
@@ -62,31 +47,28 @@ SmartComponent({
|
|
62
47
|
},
|
63
48
|
created() {
|
64
49
|
this.getMonthList();
|
65
|
-
this.calcMonth();
|
66
50
|
},
|
67
51
|
/**
|
68
52
|
* 组件的方法列表
|
69
53
|
*/
|
70
54
|
methods: {
|
71
|
-
calcMonth() {
|
72
|
-
const date = new Date(this.data.date);
|
73
|
-
const cur = date.getMonth();
|
74
|
-
this.setData({
|
75
|
-
currentMonth: cur,
|
76
|
-
});
|
77
|
-
},
|
78
55
|
getMonthList() {
|
79
|
-
const { minDate, maxDate,
|
80
|
-
const
|
56
|
+
const { minDate, maxDate, monthsFormatter = [] } = this.data;
|
57
|
+
const curDate = new Date(this.data.date);
|
58
|
+
const cur = curDate.getFullYear();
|
59
|
+
const curMonthDate = new Date(curDate.getFullYear(), curDate.getMonth(), 1);
|
81
60
|
const start = new Date(cur, 0, 1).getTime();
|
82
61
|
const end = new Date(cur, 11, 31).getTime();
|
83
62
|
const minDateTime = new Date(minDate).getTime();
|
84
63
|
const maxDateTime = new Date(maxDate).getTime();
|
85
64
|
const months = getMonths(start, end);
|
86
|
-
const monthlist = months.map(
|
65
|
+
const monthlist = months.map(date => {
|
87
66
|
const monthVal = new Date(date).getMonth();
|
88
67
|
const time = new Date(date).getTime();
|
89
|
-
|
68
|
+
let isDisabled = false;
|
69
|
+
if (minDate && maxDate) {
|
70
|
+
isDisabled = time < minDateTime || time > maxDateTime;
|
71
|
+
}
|
90
72
|
return {
|
91
73
|
value: date,
|
92
74
|
month: monthVal,
|
@@ -96,9 +78,12 @@ SmartComponent({
|
|
96
78
|
});
|
97
79
|
this.setData({
|
98
80
|
months: monthlist,
|
81
|
+
currentMonth: curMonthDate.getTime(),
|
99
82
|
});
|
100
83
|
},
|
101
84
|
onClick(event) {
|
85
|
+
if (this.data.readonly)
|
86
|
+
return;
|
102
87
|
const { index } = event.currentTarget.dataset;
|
103
88
|
const item = this.data.months[index];
|
104
89
|
if (item.type !== 'disabled') {
|
@@ -1,7 +1,13 @@
|
|
1
1
|
<view class="contain">
|
2
2
|
<smart-row>
|
3
|
-
<smart-col wx:for="{{months}}" span="6">
|
4
|
-
<view
|
3
|
+
<smart-col wx:for="{{months}}" span="6" custom-class="col_item">
|
4
|
+
<view wx:if="{{item.type === 'disabled'}}" class="item item_disabled" data-index="{{index}}">
|
5
|
+
{{item.text}}
|
6
|
+
</view>
|
7
|
+
<view wx:elif="{{currentMonth === item.value}}" class="item item_active" data-index="{{index}}" bindtap="onClick" style="background: {{ color }};">
|
8
|
+
{{item.text}}
|
9
|
+
</view>
|
10
|
+
<view wx:else class="item" data-index="{{index}}" bindtap="onClick">
|
5
11
|
{{item.text}}
|
6
12
|
</view>
|
7
13
|
</smart-col>
|
@@ -1 +1 @@
|
|
1
|
-
@import '../../../common/index.wxss';.item{border-radius:
|
1
|
+
@import '../../../common/index.wxss';.contain{margin:24rpx 0}.item{border-radius:var(--calendar-cell-item-border-radius,104rpx);color:var(--calendar-cell-item-font-color,var(--app-B4-N1,#000));font-size:var(--calendar-cell-item-font-size,15px);font-weight:var(--calendar-day-font-weight,500);height:var(--calendar-cell-item-height,104rpx);line-height:var(--calendar-cell-item-height,104rpx);text-align:center;width:var(--calendar-cell-item-width,104rpx)}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}.col_item{display:flex;justify-content:center}
|
@@ -1 +1 @@
|
|
1
|
-
@import '../../../common/index.css';.contain{margin:24rpx 0}.item{border-radius:
|
1
|
+
@import '../../../common/index.css';.contain{margin:24rpx 0}.item{border-radius:var(--calendar-cell-item-border-radius,104rpx);color:var(--calendar-cell-item-font-color,var(--app-B4-N1,#000));font-size:var(--calendar-cell-item-font-size,15px);font-weight:var(--calendar-day-font-weight,500);height:var(--calendar-cell-item-height,104rpx);line-height:var(--calendar-cell-item-height,104rpx);text-align:center;width:var(--calendar-cell-item-width,104rpx)}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}.col_item{display:flex;justify-content:center}
|
@@ -14,6 +14,10 @@ SmartComponent({
|
|
14
14
|
}
|
15
15
|
},
|
16
16
|
},
|
17
|
+
readonly: {
|
18
|
+
type: Boolean,
|
19
|
+
value: false,
|
20
|
+
},
|
17
21
|
minDate: {
|
18
22
|
type: null,
|
19
23
|
value: new Date(new Date().getFullYear() - 30, 0, 1).getTime(),
|
@@ -22,6 +26,10 @@ SmartComponent({
|
|
22
26
|
type: null,
|
23
27
|
value: new Date(new Date().getFullYear() + 30, 11, 31).getTime(),
|
24
28
|
},
|
29
|
+
color: {
|
30
|
+
type: String,
|
31
|
+
value: '#3678e3',
|
32
|
+
},
|
25
33
|
currentYear: {
|
26
34
|
type: null,
|
27
35
|
value: new Date().getFullYear(),
|
@@ -63,7 +71,7 @@ SmartComponent({
|
|
63
71
|
});
|
64
72
|
},
|
65
73
|
getYearList() {
|
66
|
-
const { minDate, maxDate, yearFormatter = 'YYYY', visibleIndex, date
|
74
|
+
const { minDate, maxDate, yearFormatter = 'YYYY', visibleIndex, date } = this.data;
|
67
75
|
const cur = new Date(date).getFullYear();
|
68
76
|
const offset = visibleIndex * 12;
|
69
77
|
const start = new Date(cur + offset - 5, 0, 1).getTime();
|
@@ -71,15 +79,18 @@ SmartComponent({
|
|
71
79
|
const minStart = new Date(minDate).getTime();
|
72
80
|
const maxStart = new Date(maxDate).getTime();
|
73
81
|
const years = getYears(start, end);
|
74
|
-
const yearlist = years.map(
|
82
|
+
const yearlist = years.map(date => {
|
75
83
|
const yearVal = new Date(date).getFullYear();
|
76
84
|
const curTime = new Date(date).getTime();
|
77
|
-
|
85
|
+
let isDisabled = false;
|
86
|
+
if (minDate && maxDate) {
|
87
|
+
isDisabled = curTime <= minStart || curTime >= maxStart;
|
88
|
+
}
|
78
89
|
return {
|
79
90
|
value: date,
|
80
91
|
year: yearVal,
|
81
92
|
text: yearFormatter.replace('YYYY', yearVal),
|
82
|
-
type:
|
93
|
+
type: isDisabled ? 'disabled' : '',
|
83
94
|
};
|
84
95
|
});
|
85
96
|
this.setData({
|
@@ -87,6 +98,8 @@ SmartComponent({
|
|
87
98
|
});
|
88
99
|
},
|
89
100
|
onClick(event) {
|
101
|
+
if (this.data.readonly)
|
102
|
+
return;
|
90
103
|
const { index } = event.currentTarget.dataset;
|
91
104
|
const item = this.data.years[index];
|
92
105
|
if (item.type !== 'disabled') {
|
@@ -1,7 +1,13 @@
|
|
1
1
|
<view class="contain">
|
2
2
|
<smart-row>
|
3
|
-
<smart-col wx:for="{{years}}" span="6">
|
4
|
-
<view
|
3
|
+
<smart-col wx:for="{{years}}" span="6" custom-class="col_item">
|
4
|
+
<view wx:if="{{item.type === 'disabled'}}" class="item item_disabled" data-index="{{index}}">
|
5
|
+
{{item.text}}
|
6
|
+
</view>
|
7
|
+
<view wx:elif="{{currentYear === item.year}}" class="item item_active" data-index="{{index}}" bindtap="onClick" style="background: {{ color }};">
|
8
|
+
{{item.text}}
|
9
|
+
</view>
|
10
|
+
<view wx:else class="item" data-index="{{index}}" bindtap="onClick">
|
5
11
|
{{item.text}}
|
6
12
|
</view>
|
7
13
|
</smart-col>
|
@@ -1 +1 @@
|
|
1
|
-
@import '../../../common/index.wxss';.contain{margin:24rpx 0}.item{border-radius:
|
1
|
+
@import '../../../common/index.wxss';.contain{margin:24rpx 0}.item{border-radius:var(--calendar-cell-item-border-radius,104rpx);color:var(--calendar-cell-item-font-color,var(--app-B4-N1,#000));font-size:var(--calendar-cell-item-font-size,15px);font-weight:var(--calendar-day-font-weight,500);height:var(--calendar-cell-item-height,104rpx);line-height:var(--calendar-cell-item-height,104rpx);text-align:center;width:var(--calendar-cell-item-width,104rpx)}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}.col_item{display:flex;justify-content:center}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import { SmartComponent } from '../../common/component';
|
2
|
+
SmartComponent({
|
3
|
+
data: {
|
4
|
+
// day
|
5
|
+
curDayDate: new Date(2024, 0, 15).getTime(),
|
6
|
+
minDayDate: new Date(2024, 0, 4).getTime(),
|
7
|
+
maxDayDate: new Date(2024, 1, 20).getTime(),
|
8
|
+
// weekday
|
9
|
+
curWeekDayDate: [
|
10
|
+
new Date(2024, 0, 15).getTime(),
|
11
|
+
new Date(2024, 0, 21).getTime(),
|
12
|
+
],
|
13
|
+
minWeekDayDate: new Date(2024, 0, 4).getTime(),
|
14
|
+
maxWeekDayDate: new Date(2024, 1, 20).getTime(),
|
15
|
+
// range
|
16
|
+
curRangeDayDate: [
|
17
|
+
new Date(2024, 0, 10).getTime(),
|
18
|
+
new Date(2024, 0, 20).getTime(),
|
19
|
+
],
|
20
|
+
minRangeDayDate: new Date(2024, 0, 4).getTime(),
|
21
|
+
maxRangeDayDate: new Date(2024, 1, 20).getTime(),
|
22
|
+
// month
|
23
|
+
curMonthDate: new Date(2024, 6, 1).getTime(),
|
24
|
+
minMonthDate: new Date(2024, 2, 1).getTime(),
|
25
|
+
maxMonthDate: new Date(2025, 9, 31).getTime(),
|
26
|
+
// year
|
27
|
+
curYearDate: new Date(2017, 6, 1).getTime(),
|
28
|
+
minYearDate: new Date(2012, 0, 1).getTime(),
|
29
|
+
maxYearDate: new Date(2029, 10, 31).getTime(),
|
30
|
+
// locale
|
31
|
+
confirmText: I18n.t('confirm'),
|
32
|
+
confirmDisabledText: I18n.t('confirm'),
|
33
|
+
firstDayOfWeek: 0,
|
34
|
+
locale: {
|
35
|
+
shortWeekDays: [
|
36
|
+
I18n.t('week0'),
|
37
|
+
I18n.t('week1'),
|
38
|
+
I18n.t('week2'),
|
39
|
+
I18n.t('week3'),
|
40
|
+
I18n.t('week4'),
|
41
|
+
I18n.t('week5'),
|
42
|
+
I18n.t('week6'),
|
43
|
+
],
|
44
|
+
subFormatter: 'YYYY' + I18n.t('year') + 'MM' + I18n.t('month'),
|
45
|
+
},
|
46
|
+
locale2: {
|
47
|
+
subFormatter: 'YYYY' + I18n.t('year'),
|
48
|
+
monthsFormatter: [
|
49
|
+
I18n.t('cal_Jan'),
|
50
|
+
I18n.t('cal_Feb'),
|
51
|
+
I18n.t('cal_Mar'),
|
52
|
+
I18n.t('cal_Apr'),
|
53
|
+
I18n.t('cal_May'),
|
54
|
+
I18n.t('cal_Jun'),
|
55
|
+
I18n.t('cal_Jul'),
|
56
|
+
I18n.t('cal_Aug'),
|
57
|
+
I18n.t('cal_Sept'),
|
58
|
+
I18n.t('cal_Oct'),
|
59
|
+
I18n.t('cal_Nov'),
|
60
|
+
I18n.t('cal_Dec')
|
61
|
+
]
|
62
|
+
},
|
63
|
+
showDayPicker: false,
|
64
|
+
},
|
65
|
+
methods: {
|
66
|
+
setCurDay(event) {
|
67
|
+
const date = event.detail;
|
68
|
+
this.setData({
|
69
|
+
curDayDate: new Date(date).getTime(),
|
70
|
+
showDayPicker: false,
|
71
|
+
});
|
72
|
+
},
|
73
|
+
setWeekCurDay(event) {
|
74
|
+
const date = event.detail;
|
75
|
+
this.setData({
|
76
|
+
curWeekDayDate: [date[0], date[1]],
|
77
|
+
});
|
78
|
+
},
|
79
|
+
setRangeCurDay(event) {
|
80
|
+
const date = event.detail;
|
81
|
+
this.setData({
|
82
|
+
curRangeDayDate: [date[0], date[1]],
|
83
|
+
});
|
84
|
+
},
|
85
|
+
setCurMonth(event) {
|
86
|
+
const date = event.detail;
|
87
|
+
this.setData({
|
88
|
+
curMonthDate: date,
|
89
|
+
});
|
90
|
+
},
|
91
|
+
setCurYear(event) {
|
92
|
+
const date = event.detail;
|
93
|
+
this.setData({
|
94
|
+
curYearDate: date,
|
95
|
+
});
|
96
|
+
},
|
97
|
+
onShowDayPicker() {
|
98
|
+
this.setData({
|
99
|
+
showDayPicker: !this.data.showDayPicker,
|
100
|
+
});
|
101
|
+
},
|
102
|
+
},
|
103
|
+
});
|
package/dist/calendar/index.js
CHANGED
@@ -1,17 +1,13 @@
|
|
1
1
|
import { SmartComponent } from '../common/component';
|
2
|
-
import { ROW_HEIGHT, getPrevDay, getNextDay, getToday, compareDay, copyDates, calcDateNum, getMonths, getDayByOffset, getCurrentIndex, getWeekStartAndEnd, } from './utils';
|
2
|
+
import { ROW_HEIGHT, getPrevDay, getNextDay, getToday, compareDay, copyDates, calcDateNum, getMonths, getDayByOffset, getCurrentIndex, getWeekStartAndEnd, getInitEdgeDate, } from './utils';
|
3
3
|
import Toast from '../toast/toast';
|
4
|
-
const
|
5
|
-
const
|
6
|
-
const now = getToday();
|
7
|
-
return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate()).getTime();
|
8
|
-
})();
|
9
|
-
const getTime = (date) => date instanceof Date ? date.getTime() : date;
|
4
|
+
const dateEdge = getInitEdgeDate('year');
|
5
|
+
const getTime = (date) => (date instanceof Date ? date.getTime() : date);
|
10
6
|
SmartComponent({
|
11
7
|
props: {
|
12
8
|
title: {
|
13
9
|
type: String,
|
14
|
-
value: '
|
10
|
+
value: 'Select Date',
|
15
11
|
},
|
16
12
|
color: String,
|
17
13
|
show: {
|
@@ -47,18 +43,13 @@ SmartComponent({
|
|
47
43
|
rangeEnd: 'End',
|
48
44
|
},
|
49
45
|
},
|
50
|
-
formatter: null,
|
51
46
|
confirmText: {
|
52
47
|
type: String,
|
53
|
-
value: '
|
48
|
+
value: 'Confirm',
|
54
49
|
},
|
55
50
|
confirmDisabledText: {
|
56
51
|
type: String,
|
57
|
-
value: '
|
58
|
-
},
|
59
|
-
mode: {
|
60
|
-
type: String,
|
61
|
-
value: 'day',
|
52
|
+
value: 'Confirm',
|
62
53
|
},
|
63
54
|
rangePrompt: String,
|
64
55
|
showRangePrompt: {
|
@@ -81,11 +72,11 @@ SmartComponent({
|
|
81
72
|
},
|
82
73
|
minDate: {
|
83
74
|
type: Number,
|
84
|
-
value:
|
75
|
+
value: dateEdge.min,
|
85
76
|
},
|
86
77
|
maxDate: {
|
87
78
|
type: Number,
|
88
|
-
value:
|
79
|
+
value: dateEdge.max,
|
89
80
|
},
|
90
81
|
position: {
|
91
82
|
type: String,
|
@@ -101,7 +92,7 @@ SmartComponent({
|
|
101
92
|
},
|
102
93
|
poppable: {
|
103
94
|
type: Boolean,
|
104
|
-
value:
|
95
|
+
value: false,
|
105
96
|
},
|
106
97
|
showMark: {
|
107
98
|
type: Boolean,
|
@@ -113,7 +104,7 @@ SmartComponent({
|
|
113
104
|
},
|
114
105
|
showConfirm: {
|
115
106
|
type: Boolean,
|
116
|
-
value:
|
107
|
+
value: false,
|
117
108
|
},
|
118
109
|
showSubtitle: {
|
119
110
|
type: Boolean,
|
@@ -173,15 +164,19 @@ SmartComponent({
|
|
173
164
|
methods: {
|
174
165
|
onPrev() {
|
175
166
|
const visibleIndex = this.data.visibleIndex - 1;
|
176
|
-
if (this.data.
|
167
|
+
if (this.data.type === 'year') {
|
177
168
|
this.setData({
|
178
169
|
visibleIndex,
|
179
170
|
});
|
180
171
|
return;
|
181
172
|
}
|
182
|
-
if (this.data.
|
173
|
+
if (this.data.type === 'month') {
|
174
|
+
const nextDate = new Date(this.data.currentDate);
|
175
|
+
nextDate.setFullYear(nextDate.getFullYear() - 1);
|
176
|
+
this.select(nextDate, true);
|
183
177
|
this.setData({
|
184
178
|
visibleIndex,
|
179
|
+
currentDate: nextDate,
|
185
180
|
});
|
186
181
|
return;
|
187
182
|
}
|
@@ -193,15 +188,19 @@ SmartComponent({
|
|
193
188
|
},
|
194
189
|
onNext() {
|
195
190
|
const visibleIndex = this.data.visibleIndex + 1;
|
196
|
-
if (this.data.
|
191
|
+
if (this.data.type === 'year') {
|
197
192
|
this.setData({
|
198
193
|
visibleIndex,
|
199
194
|
});
|
200
195
|
return;
|
201
196
|
}
|
202
|
-
if (this.data.
|
197
|
+
if (this.data.type === 'month') {
|
198
|
+
const nextDate = new Date(this.data.currentDate);
|
199
|
+
nextDate.setFullYear(nextDate.getFullYear() + 1);
|
200
|
+
this.select(nextDate, true);
|
203
201
|
this.setData({
|
204
202
|
visibleIndex,
|
203
|
+
currentDate: nextDate,
|
205
204
|
});
|
206
205
|
return;
|
207
206
|
}
|
@@ -215,16 +214,14 @@ SmartComponent({
|
|
215
214
|
this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) });
|
216
215
|
this.scrollIntoView();
|
217
216
|
},
|
218
|
-
initYearIdx(currentDate) {
|
219
|
-
},
|
220
217
|
initData() {
|
221
218
|
const currentDate = this.getInitialDate(this.data.defaultDate);
|
222
219
|
const months = getMonths(this.data.minDate, this.data.maxDate);
|
223
220
|
const visibleIndex = this.data.defaultDate
|
224
221
|
? getCurrentIndex(currentDate, months)
|
225
222
|
: months.length - 1;
|
226
|
-
const isYear = this.data.
|
227
|
-
const isMonth = this.data.
|
223
|
+
const isYear = this.data.type === 'year';
|
224
|
+
const isMonth = this.data.type === 'month';
|
228
225
|
const data = {
|
229
226
|
currentDate,
|
230
227
|
months,
|
@@ -242,8 +239,9 @@ SmartComponent({
|
|
242
239
|
this.initData();
|
243
240
|
},
|
244
241
|
limitDateRange(date, minDate = null, maxDate = null) {
|
245
|
-
|
246
|
-
|
242
|
+
const { min, max } = getInitEdgeDate(this.data.type);
|
243
|
+
minDate = minDate || this.data.minDate || min;
|
244
|
+
maxDate = maxDate || this.data.maxDate || max;
|
247
245
|
if (compareDay(date, minDate) === -1) {
|
248
246
|
return minDate;
|
249
247
|
}
|
@@ -270,7 +268,7 @@ SmartComponent({
|
|
270
268
|
}
|
271
269
|
if (type === 'multiple') {
|
272
270
|
if (Array.isArray(defaultDate)) {
|
273
|
-
return defaultDate.map(
|
271
|
+
return defaultDate.map(date => this.limitDateRange(date));
|
274
272
|
}
|
275
273
|
return [this.limitDateRange(now)];
|
276
274
|
}
|
@@ -280,8 +278,7 @@ SmartComponent({
|
|
280
278
|
return this.limitDateRange(defaultDate);
|
281
279
|
},
|
282
280
|
scrollIntoView() {
|
283
|
-
if (!this.isMounted)
|
284
|
-
return;
|
281
|
+
// if (!this.isMounted) return;
|
285
282
|
},
|
286
283
|
onOpen() {
|
287
284
|
this.$emit('open');
|
@@ -366,7 +363,7 @@ SmartComponent({
|
|
366
363
|
if (this.data.readonly) {
|
367
364
|
return;
|
368
365
|
}
|
369
|
-
|
366
|
+
const date = event.detail;
|
370
367
|
this.select(date, true);
|
371
368
|
},
|
372
369
|
unselect(dateArray) {
|
@@ -381,10 +378,7 @@ SmartComponent({
|
|
381
378
|
if (!valid) {
|
382
379
|
// auto selected to max range if showConfirm
|
383
380
|
if (this.data.showConfirm) {
|
384
|
-
this.emit([
|
385
|
-
date[0],
|
386
|
-
getDayByOffset(date[0], this.data.maxRange - 1),
|
387
|
-
]);
|
381
|
+
this.emit([date[0], getDayByOffset(date[0], this.data.maxRange - 1)]);
|
388
382
|
}
|
389
383
|
else {
|
390
384
|
this.emit(date);
|
@@ -418,8 +412,7 @@ SmartComponent({
|
|
418
412
|
return true;
|
419
413
|
},
|
420
414
|
onConfirm() {
|
421
|
-
if (this.data.type === 'range' &&
|
422
|
-
!this.checkRange(this.data.currentDate)) {
|
415
|
+
if (this.data.type === 'range' && !this.checkRange(this.data.currentDate)) {
|
423
416
|
return;
|
424
417
|
}
|
425
418
|
wx.nextTick(() => {
|
package/dist/calendar/index.wxs
CHANGED
@@ -38,23 +38,20 @@ function getVisible(visibleIndex, curIndex) {
|
|
38
38
|
function formatMonthTitle(date, formatter = 'YYYY-MM') {
|
39
39
|
date = getDate(date);
|
40
40
|
const year = date.getFullYear();
|
41
|
-
const month =
|
42
|
-
date.getMonth() + 1 < 10
|
43
|
-
? `0${date.getMonth() + 1}`
|
44
|
-
: date.getMonth() + 1 + '';
|
41
|
+
const month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1 + "";
|
45
42
|
return formatter.replace('YYYY', year + '').replace('MM', month);
|
46
43
|
}
|
47
44
|
|
48
45
|
function formatYearTitle(date, offset, formatter = 'YYYY') {
|
49
46
|
date = getDate(date);
|
50
|
-
const year = date.getFullYear()
|
47
|
+
const year = date.getFullYear();
|
51
48
|
return formatter.replace('YYYY', year + '');
|
52
49
|
}
|
53
50
|
|
54
51
|
module.exports = {
|
55
52
|
getMonths: getMonths,
|
56
|
-
getVisible,
|
53
|
+
getVisible: getVisible,
|
57
54
|
getButtonDisabled: getButtonDisabled,
|
58
|
-
formatMonthTitle,
|
59
|
-
formatYearTitle,
|
55
|
+
formatMonthTitle: formatMonthTitle,
|
56
|
+
formatYearTitle: formatYearTitle,
|
60
57
|
};
|
package/dist/calendar/utils.d.ts
CHANGED
package/dist/calendar/utils.js
CHANGED
@@ -4,9 +4,7 @@ export function formatMonthTitle(date, formatter = 'YYYY-MM') {
|
|
4
4
|
date = new Date(date);
|
5
5
|
}
|
6
6
|
const year = date.getFullYear();
|
7
|
-
const month = date.getMonth() + 1 < 10
|
8
|
-
? `0${date.getMonth() + 1}`
|
9
|
-
: date.getMonth() + 1 + '';
|
7
|
+
const month = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1 + '';
|
10
8
|
return formatter.replace('YYYY', year + '').replace('MM', month);
|
11
9
|
}
|
12
10
|
export function compareMonth(date1, date2) {
|
@@ -63,7 +61,7 @@ export function calcDateNum(date) {
|
|
63
61
|
}
|
64
62
|
export function copyDates(dates) {
|
65
63
|
if (Array.isArray(dates)) {
|
66
|
-
return dates.map(
|
64
|
+
return dates.map(date => {
|
67
65
|
if (date === null) {
|
68
66
|
return date;
|
69
67
|
}
|
@@ -129,3 +127,31 @@ export function getWeekStartAndEnd(date) {
|
|
129
127
|
weekEnd: endOfWeek,
|
130
128
|
};
|
131
129
|
}
|
130
|
+
export const getInitEdgeDate = (type) => {
|
131
|
+
const currentYear = new Date().getFullYear();
|
132
|
+
if (type === 'month') {
|
133
|
+
const minMonthDate = new Date(currentYear - 1, 1, 1).getTime();
|
134
|
+
const maxMonthDate = new Date(currentYear + 1, 12, 31).getTime();
|
135
|
+
return {
|
136
|
+
min: minMonthDate,
|
137
|
+
max: maxMonthDate,
|
138
|
+
};
|
139
|
+
}
|
140
|
+
if (type === 'year') {
|
141
|
+
const minMonthDate = new Date(currentYear - 10, 1, 1).getTime();
|
142
|
+
const maxMonthDate = new Date(currentYear + 10, 12, 31).getTime();
|
143
|
+
return {
|
144
|
+
min: minMonthDate,
|
145
|
+
max: maxMonthDate,
|
146
|
+
};
|
147
|
+
}
|
148
|
+
const initialMinDate = getToday().getTime();
|
149
|
+
const initialMaxDate = (() => {
|
150
|
+
const now = getToday();
|
151
|
+
return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate()).getTime();
|
152
|
+
})();
|
153
|
+
return {
|
154
|
+
min: initialMinDate,
|
155
|
+
max: initialMaxDate,
|
156
|
+
};
|
157
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|