@autobest-ui/components 1.1.4 → 1.1.10
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/README.md +10 -10
- package/esm/affix/style/index.scss +34 -34
- package/esm/base.scss +42 -42
- package/esm/carousel/style/index.scss +37 -37
- package/esm/checkbox/style/index.scss +117 -117
- package/esm/collapse/style/index.scss +42 -42
- package/esm/confirm/style/index.scss +44 -44
- package/esm/date-picker/calendar/grid/index.scss +85 -85
- package/esm/date-picker/calendar/index.d.ts +4 -0
- package/esm/date-picker/calendar/index.js +1 -1
- package/esm/date-picker/calendar/index.scss +57 -57
- package/esm/date-picker/index.d.ts +17 -6
- package/esm/date-picker/index.js +49 -8
- package/esm/date-picker/style/index.css +1 -1
- package/esm/date-picker/style/index.scss +23 -19
- package/esm/drawer/style/index.scss +44 -44
- package/esm/ellipsis/style/index.scss +35 -35
- package/esm/guide/style/index.scss +17 -17
- package/esm/icon/style/index.scss +6 -6
- package/esm/index.d.ts +2 -1
- package/esm/input-number/index.d.ts +30 -17
- package/esm/input-number/index.js +116 -36
- package/esm/input-number/style/index.scss +86 -86
- package/esm/lazy-image/style/index.scss +24 -24
- package/esm/link-list/style/index.scss +125 -125
- package/esm/loading/style/index.scss +30 -30
- package/esm/loading-bar/style/index.scss +62 -62
- package/esm/loading-container/style/index.scss +27 -27
- package/esm/loading-icon/style/index.scss +23 -23
- package/esm/mask/style/index.scss +34 -34
- package/esm/message/style/index.scss +70 -70
- package/esm/modal/style/index.scss +112 -112
- package/esm/move/style/index.scss +7 -7
- package/esm/popover/style/index.scss +59 -59
- package/esm/select/style/index.scss +126 -126
- package/esm/show-more/style/index.scss +22 -22
- package/esm/skeleton/style/index.scss +26 -26
- package/esm/style.css +5 -19
- package/esm/table/body/BodyRow.d.ts +9 -3
- package/esm/table/body/BodyRow.js +6 -2
- package/esm/table/body/index.d.ts +2 -2
- package/esm/table/body/index.js +8 -7
- package/esm/table/header/HeaderCell.d.ts +2 -2
- package/esm/table/header/HeaderRow.d.ts +2 -2
- package/esm/table/index.d.ts +4 -4
- package/esm/table/index.js +3 -3
- package/esm/table/interface.d.ts +9 -3
- package/esm/table/style/index.scss +51 -51
- package/esm/tabs/style/index.scss +62 -62
- package/esm/tooltip/style/index.scss +61 -61
- package/esm/trigger/style/index.scss +79 -79
- package/lib/affix/style/index.scss +34 -34
- package/lib/base.scss +42 -42
- package/lib/carousel/style/index.scss +37 -37
- package/lib/checkbox/style/index.scss +117 -117
- package/lib/collapse/style/index.scss +42 -42
- package/lib/confirm/style/index.scss +44 -44
- package/lib/date-picker/calendar/grid/index.scss +85 -85
- package/lib/date-picker/calendar/index.d.ts +4 -0
- package/lib/date-picker/calendar/index.js +1 -1
- package/lib/date-picker/calendar/index.scss +57 -57
- package/lib/date-picker/index.d.ts +17 -6
- package/lib/date-picker/index.js +49 -8
- package/lib/date-picker/style/index.css +1 -1
- package/lib/date-picker/style/index.scss +23 -19
- package/lib/drawer/style/index.scss +44 -44
- package/lib/ellipsis/style/index.scss +35 -35
- package/lib/guide/style/index.scss +17 -17
- package/lib/icon/style/index.scss +6 -6
- package/lib/index.d.ts +2 -1
- package/lib/input-number/index.d.ts +30 -17
- package/lib/input-number/index.js +116 -36
- package/lib/input-number/style/index.scss +86 -86
- package/lib/lazy-image/style/index.scss +24 -24
- package/lib/link-list/style/index.scss +125 -125
- package/lib/loading/style/index.scss +30 -30
- package/lib/loading-bar/style/index.scss +62 -62
- package/lib/loading-container/style/index.scss +27 -27
- package/lib/loading-icon/style/index.scss +23 -23
- package/lib/mask/style/index.scss +34 -34
- package/lib/message/style/index.scss +70 -70
- package/lib/modal/style/index.scss +112 -112
- package/lib/move/style/index.scss +7 -7
- package/lib/popover/style/index.scss +59 -59
- package/lib/select/style/index.scss +126 -126
- package/lib/show-more/style/index.scss +22 -22
- package/lib/skeleton/style/index.scss +26 -26
- package/lib/style.css +5 -19
- package/lib/table/body/BodyRow.d.ts +9 -3
- package/lib/table/body/BodyRow.js +6 -2
- package/lib/table/body/index.d.ts +2 -2
- package/lib/table/body/index.js +8 -7
- package/lib/table/header/HeaderCell.d.ts +2 -2
- package/lib/table/header/HeaderRow.d.ts +2 -2
- package/lib/table/index.d.ts +4 -4
- package/lib/table/index.js +3 -3
- package/lib/table/interface.d.ts +9 -3
- package/lib/table/style/index.scss +51 -51
- package/lib/tabs/style/index.scss +62 -62
- package/lib/tooltip/style/index.scss +61 -61
- package/lib/trigger/style/index.scss +79 -79
- package/package.json +2 -2
- package/esm/accordion/__stories__/style.css +0 -1
- package/esm/accordion/__stories__/style.scss +0 -59
- package/esm/affix/__stories__/style.css +0 -1
- package/esm/affix/__stories__/style.scss +0 -13
- package/esm/carousel/__stories__/style.css +0 -1
- package/esm/carousel/__stories__/style.scss +0 -41
- package/esm/collapse/__stories__/style.css +0 -1
- package/esm/collapse/__stories__/style.scss +0 -19
- package/esm/guide/__stories__/style.css +0 -1
- package/esm/guide/__stories__/style.scss +0 -14
- package/esm/icon/__stories__/iconNames.d.ts +0 -2
- package/esm/icon/__stories__/iconNames.js +0 -1
- package/esm/icon/__stories__/style.css +0 -1
- package/esm/icon/__stories__/style.scss +0 -40
- package/esm/lazy-image/__stories__/style.css +0 -1
- package/esm/lazy-image/__stories__/style.scss +0 -9
- package/esm/loading-container/__stories__/style.css +0 -1
- package/esm/loading-container/__stories__/style.scss +0 -6
- package/esm/move/__stories__/style.css +0 -1
- package/esm/move/__stories__/style.scss +0 -6
- package/esm/popover/__stories__/style.css +0 -1
- package/esm/popover/__stories__/style.scss +0 -16
- package/esm/select/__stories__/style.css +0 -1
- package/esm/select/__stories__/style.scss +0 -8
- package/esm/skeleton/__stories__/style.css +0 -1
- package/esm/skeleton/__stories__/style.scss +0 -3
- package/esm/table/__stories__/style.css +0 -1
- package/esm/table/__stories__/style.scss +0 -34
- package/esm/tabs/__stories__/style.css +0 -1
- package/esm/tabs/__stories__/style.scss +0 -8
- package/lib/accordion/__stories__/style.css +0 -1
- package/lib/accordion/__stories__/style.scss +0 -59
- package/lib/affix/__stories__/style.css +0 -1
- package/lib/affix/__stories__/style.scss +0 -13
- package/lib/carousel/__stories__/style.css +0 -1
- package/lib/carousel/__stories__/style.scss +0 -41
- package/lib/collapse/__stories__/style.css +0 -1
- package/lib/collapse/__stories__/style.scss +0 -19
- package/lib/guide/__stories__/style.css +0 -1
- package/lib/guide/__stories__/style.scss +0 -14
- package/lib/icon/__stories__/iconNames.d.ts +0 -2
- package/lib/icon/__stories__/iconNames.js +0 -8
- package/lib/icon/__stories__/style.css +0 -1
- package/lib/icon/__stories__/style.scss +0 -40
- package/lib/lazy-image/__stories__/style.css +0 -1
- package/lib/lazy-image/__stories__/style.scss +0 -9
- package/lib/loading-container/__stories__/style.css +0 -1
- package/lib/loading-container/__stories__/style.scss +0 -6
- package/lib/move/__stories__/style.css +0 -1
- package/lib/move/__stories__/style.scss +0 -6
- package/lib/popover/__stories__/style.css +0 -1
- package/lib/popover/__stories__/style.scss +0 -16
- package/lib/select/__stories__/style.css +0 -1
- package/lib/select/__stories__/style.scss +0 -8
- package/lib/skeleton/__stories__/style.css +0 -1
- package/lib/skeleton/__stories__/style.scss +0 -3
- package/lib/table/__stories__/style.css +0 -1
- package/lib/table/__stories__/style.scss +0 -34
- package/lib/tabs/__stories__/style.css +0 -1
- package/lib/tabs/__stories__/style.scss +0 -8
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
$namespace: ab-dp-cg;
|
|
2
|
-
|
|
3
|
-
.#{$namespace} {
|
|
4
|
-
&-title, &-head, &-content {
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
&-title {
|
|
10
|
-
user-select: none;
|
|
11
|
-
font-size: .14rem;
|
|
12
|
-
padding-bottom: .08rem;
|
|
13
|
-
|
|
14
|
-
> strong {
|
|
15
|
-
flex: 1 1;
|
|
16
|
-
margin-left: .1rem;
|
|
17
|
-
cursor: default;
|
|
18
|
-
color: #4A4A4A;
|
|
19
|
-
|
|
20
|
-
&.#{$namespace}-clickable {
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
|
|
23
|
-
&:hover {
|
|
24
|
-
color: #000;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&-icon, &-dis-icon {
|
|
31
|
-
align-self: flex-end;
|
|
32
|
-
margin-left: .08rem;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&-icon {
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&-head {
|
|
40
|
-
padding-bottom: .05rem;
|
|
41
|
-
|
|
42
|
-
> li {
|
|
43
|
-
display: flex;
|
|
44
|
-
align-items: center;
|
|
45
|
-
justify-content: center;
|
|
46
|
-
cursor: default;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&-content {
|
|
51
|
-
flex-wrap: wrap;
|
|
52
|
-
|
|
53
|
-
> li {
|
|
54
|
-
cursor: pointer;
|
|
55
|
-
display: flex;
|
|
56
|
-
align-items: center;
|
|
57
|
-
justify-content: center;
|
|
58
|
-
color: #000;
|
|
59
|
-
|
|
60
|
-
&:hover {
|
|
61
|
-
background: #F0F0F0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&.#{$namespace}-dis {
|
|
65
|
-
cursor: not-allowed;
|
|
66
|
-
color: #b0b0b0;
|
|
67
|
-
|
|
68
|
-
&:hover {
|
|
69
|
-
background: none;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&:active, &.#{$namespace}-selected {
|
|
74
|
-
background: #c7e0f4;
|
|
75
|
-
border: 3px solid #C7E0F4;
|
|
76
|
-
border-radius: 2px;
|
|
77
|
-
color: #000000;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&.#{$namespace}-today {
|
|
81
|
-
background: #0078D4;
|
|
82
|
-
color: #ffffff;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
1
|
+
$namespace: ab-dp-cg;
|
|
2
|
+
|
|
3
|
+
.#{$namespace} {
|
|
4
|
+
&-title, &-head, &-content {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&-title {
|
|
10
|
+
user-select: none;
|
|
11
|
+
font-size: .14rem;
|
|
12
|
+
padding-bottom: .08rem;
|
|
13
|
+
|
|
14
|
+
> strong {
|
|
15
|
+
flex: 1 1;
|
|
16
|
+
margin-left: .1rem;
|
|
17
|
+
cursor: default;
|
|
18
|
+
color: #4A4A4A;
|
|
19
|
+
|
|
20
|
+
&.#{$namespace}-clickable {
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
color: #000;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-icon, &-dis-icon {
|
|
31
|
+
align-self: flex-end;
|
|
32
|
+
margin-left: .08rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-icon {
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&-head {
|
|
40
|
+
padding-bottom: .05rem;
|
|
41
|
+
|
|
42
|
+
> li {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
cursor: default;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&-content {
|
|
51
|
+
flex-wrap: wrap;
|
|
52
|
+
|
|
53
|
+
> li {
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
color: #000;
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
background: #F0F0F0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.#{$namespace}-dis {
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
color: #b0b0b0;
|
|
67
|
+
|
|
68
|
+
&:hover {
|
|
69
|
+
background: none;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:active, &.#{$namespace}-selected {
|
|
74
|
+
background: #c7e0f4;
|
|
75
|
+
border: 3px solid #C7E0F4;
|
|
76
|
+
border-radius: 2px;
|
|
77
|
+
color: #000000;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.#{$namespace}-today {
|
|
81
|
+
background: #0078D4;
|
|
82
|
+
color: #ffffff;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
86
|
}
|
|
@@ -12,6 +12,10 @@ export interface CalendarProps extends Omit<DayCalendarProps, omitType>, Omit<Mo
|
|
|
12
12
|
* 选择日期的回调函数
|
|
13
13
|
*/
|
|
14
14
|
onSelect: (date?: Date, name?: ReactText) => void;
|
|
15
|
+
/**
|
|
16
|
+
* 默认日期
|
|
17
|
+
*/
|
|
18
|
+
defaultDate?: Date;
|
|
15
19
|
}
|
|
16
20
|
interface CalendarState {
|
|
17
21
|
selectedDate: Date;
|
|
@@ -74,7 +74,7 @@ function (_super) {
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
var nowDate = props.
|
|
77
|
+
var nowDate = props.defaultDate || props.today || new Date();
|
|
78
78
|
_this.state = {
|
|
79
79
|
selectedDate: nowDate,
|
|
80
80
|
navigatedDate: getMonthStart(nowDate.getFullYear(), nowDate.getMonth())
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
$namespace: ab-dp-cal;
|
|
2
|
-
|
|
3
|
-
.#{$namespace} {
|
|
4
|
-
display: flex;
|
|
5
|
-
|
|
6
|
-
&-my {
|
|
7
|
-
padding-left: .12rem;
|
|
8
|
-
margin-left: .12rem;
|
|
9
|
-
border-left: 1px solid #B0B0B0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&-day, &-my {
|
|
13
|
-
width: 2.1rem;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&-dis {
|
|
17
|
-
color: #C8C8C8;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&-dg {
|
|
21
|
-
> ul {
|
|
22
|
-
> li {
|
|
23
|
-
width: 14.28%;
|
|
24
|
-
height: .28rem;
|
|
25
|
-
|
|
26
|
-
&.#{$namespace}-out {
|
|
27
|
-
color: #666666;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&-myg {
|
|
34
|
-
padding-bottom: .62rem;
|
|
35
|
-
|
|
36
|
-
> ul {
|
|
37
|
-
justify-content: space-between;
|
|
38
|
-
|
|
39
|
-
> li {
|
|
40
|
-
width: .4rem;
|
|
41
|
-
height: .4rem;
|
|
42
|
-
margin-bottom: .1rem;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&-t {
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
position: absolute;
|
|
50
|
-
right: .08rem;
|
|
51
|
-
bottom: .3rem;
|
|
52
|
-
|
|
53
|
-
&.#{$namespace}-t-dis {
|
|
54
|
-
color: #b0b0b0;
|
|
55
|
-
cursor: default;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
$namespace: ab-dp-cal;
|
|
2
|
+
|
|
3
|
+
.#{$namespace} {
|
|
4
|
+
display: flex;
|
|
5
|
+
|
|
6
|
+
&-my {
|
|
7
|
+
padding-left: .12rem;
|
|
8
|
+
margin-left: .12rem;
|
|
9
|
+
border-left: 1px solid #B0B0B0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-day, &-my {
|
|
13
|
+
width: 2.1rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-dis {
|
|
17
|
+
color: #C8C8C8;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-dg {
|
|
21
|
+
> ul {
|
|
22
|
+
> li {
|
|
23
|
+
width: 14.28%;
|
|
24
|
+
height: .28rem;
|
|
25
|
+
|
|
26
|
+
&.#{$namespace}-out {
|
|
27
|
+
color: #666666;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&-myg {
|
|
34
|
+
padding-bottom: .62rem;
|
|
35
|
+
|
|
36
|
+
> ul {
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
|
|
39
|
+
> li {
|
|
40
|
+
width: .4rem;
|
|
41
|
+
height: .4rem;
|
|
42
|
+
margin-bottom: .1rem;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&-t {
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
position: absolute;
|
|
50
|
+
right: .08rem;
|
|
51
|
+
bottom: .3rem;
|
|
52
|
+
|
|
53
|
+
&.#{$namespace}-t-dis {
|
|
54
|
+
color: #b0b0b0;
|
|
55
|
+
cursor: default;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
58
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactText } from 'react';
|
|
2
2
|
import Calendar, { CalendarProps } from './calendar';
|
|
3
|
-
export interface DatePickerProps extends Partial<CalendarProps
|
|
3
|
+
export interface DatePickerProps extends Partial<Omit<CalendarProps, 'defaultDate'>> {
|
|
4
4
|
/**
|
|
5
5
|
* 组件整体样式
|
|
6
6
|
*/
|
|
@@ -13,6 +13,14 @@ export interface DatePickerProps extends Partial<CalendarProps> {
|
|
|
13
13
|
* 需要显示在input框中的日期格式
|
|
14
14
|
*/
|
|
15
15
|
onFormatDate?: (v: Date, name?: ReactText) => string;
|
|
16
|
+
/**
|
|
17
|
+
* 默认选中的值,用于初始化展示
|
|
18
|
+
*/
|
|
19
|
+
defaultValue?: Date;
|
|
20
|
+
/**
|
|
21
|
+
* 外部控制value
|
|
22
|
+
*/
|
|
23
|
+
value?: Date;
|
|
16
24
|
/**
|
|
17
25
|
* 是否显示input框中的日历图标
|
|
18
26
|
*/
|
|
@@ -29,10 +37,6 @@ export interface DatePickerProps extends Partial<CalendarProps> {
|
|
|
29
37
|
* 是否禁用
|
|
30
38
|
*/
|
|
31
39
|
disabled?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* 默认选中的值,用于初始化展示
|
|
34
|
-
*/
|
|
35
|
-
defaultValue?: Date;
|
|
36
40
|
/**
|
|
37
41
|
* 与onFormatDate正相反,将input框中的字符串转为Date,当onFormatDate有值时,该属性``也需要有值
|
|
38
42
|
*/
|
|
@@ -45,7 +49,9 @@ interface DatePickerState {
|
|
|
45
49
|
declare class DatePicker extends React.Component<DatePickerProps, DatePickerState> {
|
|
46
50
|
prefixCls: string;
|
|
47
51
|
calendarRef: React.RefObject<Calendar>;
|
|
48
|
-
|
|
52
|
+
defaultDate?: Date;
|
|
53
|
+
popoverTriggered: boolean;
|
|
54
|
+
constructor(props: DatePickerProps);
|
|
49
55
|
static defaultProps: {
|
|
50
56
|
onFormatDate: (date: any) => any;
|
|
51
57
|
iconVisible: boolean;
|
|
@@ -53,7 +59,12 @@ declare class DatePicker extends React.Component<DatePickerProps, DatePickerStat
|
|
|
53
59
|
disabled: boolean;
|
|
54
60
|
parseDateFromString: (value: any) => Date;
|
|
55
61
|
};
|
|
62
|
+
static getDerivedStateFromProps(nextProps: DatePickerProps, prevState: DatePickerState): {
|
|
63
|
+
inputValue: string;
|
|
64
|
+
calendarVisible: boolean;
|
|
65
|
+
};
|
|
56
66
|
onCalendarSelect: (date: Date) => void;
|
|
67
|
+
updateDate: () => void;
|
|
57
68
|
onInputFocus: () => void;
|
|
58
69
|
onInputChange: (ev: any) => void;
|
|
59
70
|
onChangeDate: () => void;
|
package/esm/date-picker/index.js
CHANGED
|
@@ -56,6 +56,7 @@ function (_super) {
|
|
|
56
56
|
|
|
57
57
|
_this.prefixCls = 'ab-date-picker';
|
|
58
58
|
_this.calendarRef = createRef();
|
|
59
|
+
_this.popoverTriggered = false;
|
|
59
60
|
|
|
60
61
|
_this.onCalendarSelect = function (date) {
|
|
61
62
|
_this.setState({
|
|
@@ -68,14 +69,35 @@ function (_super) {
|
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
71
|
|
|
71
|
-
_this.
|
|
72
|
-
if (_this.calendarRef.current
|
|
73
|
-
|
|
72
|
+
_this.updateDate = function () {
|
|
73
|
+
if (!_this.calendarRef.current || !_this.state.inputValue) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var date = _this.props.parseDateFromString(_this.state.inputValue, _this.props.name);
|
|
78
|
+
|
|
79
|
+
if (isNaN(date.getTime())) {
|
|
80
|
+
return;
|
|
74
81
|
}
|
|
75
82
|
|
|
83
|
+
_this.calendarRef.current.updateDate(date);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
_this.onInputFocus = function () {
|
|
87
|
+
_this.updateDate();
|
|
88
|
+
|
|
76
89
|
_this.setState({
|
|
77
90
|
calendarVisible: true
|
|
78
91
|
});
|
|
92
|
+
|
|
93
|
+
if (!_this.popoverTriggered) {
|
|
94
|
+
// 标记触发过popover visible
|
|
95
|
+
_this.popoverTriggered = true;
|
|
96
|
+
|
|
97
|
+
if ('value' in _this.props && _this.props.value) {
|
|
98
|
+
_this.defaultDate = _this.props.value;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
79
101
|
};
|
|
80
102
|
|
|
81
103
|
_this.onInputChange = function (ev) {
|
|
@@ -89,13 +111,11 @@ function (_super) {
|
|
|
89
111
|
};
|
|
90
112
|
|
|
91
113
|
_this.onChangeDate = function () {
|
|
92
|
-
if (!_this.props.allowTextInput
|
|
114
|
+
if (!_this.props.allowTextInput) {
|
|
93
115
|
return;
|
|
94
116
|
}
|
|
95
117
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
_this.calendarRef.current.updateDate(date);
|
|
118
|
+
_this.updateDate();
|
|
99
119
|
};
|
|
100
120
|
|
|
101
121
|
_this.onPopoverVisibleChange = function (visible) {
|
|
@@ -123,12 +143,14 @@ function (_super) {
|
|
|
123
143
|
return React.createElement(Calendar, __assign({}, copyProps, {
|
|
124
144
|
ref: _this.calendarRef,
|
|
125
145
|
onSelect: _this.onCalendarSelect,
|
|
126
|
-
className: copyProps.calendarClassName
|
|
146
|
+
className: copyProps.calendarClassName,
|
|
147
|
+
defaultDate: _this.defaultDate
|
|
127
148
|
}));
|
|
128
149
|
};
|
|
129
150
|
|
|
130
151
|
var defaultValue = props.defaultValue,
|
|
131
152
|
onFormatDate = props.onFormatDate;
|
|
153
|
+
_this.defaultDate = defaultValue;
|
|
132
154
|
_this.state = {
|
|
133
155
|
calendarVisible: false,
|
|
134
156
|
inputValue: defaultValue ? onFormatDate(defaultValue) : ''
|
|
@@ -136,6 +158,25 @@ function (_super) {
|
|
|
136
158
|
return _this;
|
|
137
159
|
}
|
|
138
160
|
|
|
161
|
+
DatePicker.getDerivedStateFromProps = function (nextProps, prevState) {
|
|
162
|
+
if ('value' in nextProps) {
|
|
163
|
+
var onFormatDate = nextProps.onFormatDate,
|
|
164
|
+
value = nextProps.value;
|
|
165
|
+
var currentValue = value ? onFormatDate(value) : '';
|
|
166
|
+
|
|
167
|
+
if (prevState.inputValue === currentValue) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
inputValue: currentValue,
|
|
173
|
+
calendarVisible: false
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return null;
|
|
178
|
+
};
|
|
179
|
+
|
|
139
180
|
DatePicker.prototype.render = function () {
|
|
140
181
|
var cls = this.prefixCls;
|
|
141
182
|
var _a = this.props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ab-date-picker{position:relative}.ab-date-picker-input{outline:0;font-size:.14rem;padding:.04rem;width:1.44rem}.ab-date-picker-icon{position:absolute;right:.05rem;top:50%;transform:translateY(-50%)}
|
|
1
|
+
.ab-date-picker{position:relative}.ab-date-picker-input{outline:0;font-size:.14rem;padding:.04rem;width:1.44rem}.ab-date-picker-input.ab-date-picker-error{background:#fffacd}.ab-date-picker-icon{position:absolute;right:.05rem;top:50%;transform:translateY(-50%)}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
$namespace: ab-date-picker;
|
|
2
|
-
|
|
3
|
-
.#{$namespace} {
|
|
4
|
-
position: relative;
|
|
5
|
-
|
|
6
|
-
&-input {
|
|
7
|
-
outline: none;
|
|
8
|
-
font-size: .14rem;
|
|
9
|
-
padding: .04rem;
|
|
10
|
-
width: 1.44rem;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
$namespace: ab-date-picker;
|
|
2
|
+
|
|
3
|
+
.#{$namespace} {
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
&-input {
|
|
7
|
+
outline: none;
|
|
8
|
+
font-size: .14rem;
|
|
9
|
+
padding: .04rem;
|
|
10
|
+
width: 1.44rem;
|
|
11
|
+
|
|
12
|
+
&.#{$namespace}-error {
|
|
13
|
+
background: #fffacd;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-icon {
|
|
18
|
+
position: absolute;
|
|
19
|
+
right: 0.05rem;
|
|
20
|
+
top: 50%;
|
|
21
|
+
transform: translateY(-50%);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
$namespace: ab-drawer;
|
|
2
|
-
|
|
3
|
-
.#{$namespace} {
|
|
4
|
-
position: fixed;
|
|
5
|
-
z-index: 101;
|
|
6
|
-
background-color: #fff;
|
|
7
|
-
overflow: auto;
|
|
8
|
-
transition: transform 300ms cubic-bezier(.7, .3, .1, 1);
|
|
9
|
-
|
|
10
|
-
&-times {
|
|
11
|
-
position: absolute;
|
|
12
|
-
right: .17rem;
|
|
13
|
-
font-size: .16rem;
|
|
14
|
-
color: #b0b0b0;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
top: .11rem;
|
|
17
|
-
|
|
18
|
-
&:hover {
|
|
19
|
-
color: #333;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&-tf-top {
|
|
24
|
-
transform: translate(0, -100%);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&-tf-bottom {
|
|
28
|
-
transform: translate(0, 100%);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&-tf-left {
|
|
32
|
-
transform: translate(-100%, 0);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&-tf-right {
|
|
36
|
-
transform: translate(100%, 0);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&-hidden {
|
|
40
|
-
&.ab-mask, &.ab-drawer {
|
|
41
|
-
display: none;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
$namespace: ab-drawer;
|
|
2
|
+
|
|
3
|
+
.#{$namespace} {
|
|
4
|
+
position: fixed;
|
|
5
|
+
z-index: 101;
|
|
6
|
+
background-color: #fff;
|
|
7
|
+
overflow: auto;
|
|
8
|
+
transition: transform 300ms cubic-bezier(.7, .3, .1, 1);
|
|
9
|
+
|
|
10
|
+
&-times {
|
|
11
|
+
position: absolute;
|
|
12
|
+
right: .17rem;
|
|
13
|
+
font-size: .16rem;
|
|
14
|
+
color: #b0b0b0;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
top: .11rem;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
color: #333;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-tf-top {
|
|
24
|
+
transform: translate(0, -100%);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&-tf-bottom {
|
|
28
|
+
transform: translate(0, 100%);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-tf-left {
|
|
32
|
+
transform: translate(-100%, 0);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-tf-right {
|
|
36
|
+
transform: translate(100%, 0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&-hidden {
|
|
40
|
+
&.ab-mask, &.ab-drawer {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
$namespace: ab-ellipsis;
|
|
2
|
-
|
|
3
|
-
$lines: (1) (2) (3) (4) (5);
|
|
4
|
-
@mixin generateLines($type) {
|
|
5
|
-
@each $val in $lines {
|
|
6
|
-
&.#{$namespace}#{$type}#{$val} {
|
|
7
|
-
-webkit-line-clamp: $val;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@mixin clearLines($type) {
|
|
13
|
-
@each $val in $lines {
|
|
14
|
-
&.#{$namespace}#{$type}#{$val} {
|
|
15
|
-
-webkit-line-clamp: unset;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.#{$namespace} {
|
|
21
|
-
overflow: hidden;
|
|
22
|
-
display: block;
|
|
23
|
-
display: -webkit-box;
|
|
24
|
-
-webkit-box-orient: vertical;
|
|
25
|
-
|
|
26
|
-
@include generateLines('-line');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@media only screen and (max-width: 767px) {
|
|
31
|
-
.#{$namespace} {
|
|
32
|
-
@include clearLines('-line');
|
|
33
|
-
@include generateLines('-m-line');
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
$namespace: ab-ellipsis;
|
|
2
|
+
|
|
3
|
+
$lines: (1) (2) (3) (4) (5);
|
|
4
|
+
@mixin generateLines($type) {
|
|
5
|
+
@each $val in $lines {
|
|
6
|
+
&.#{$namespace}#{$type}#{$val} {
|
|
7
|
+
-webkit-line-clamp: $val;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@mixin clearLines($type) {
|
|
13
|
+
@each $val in $lines {
|
|
14
|
+
&.#{$namespace}#{$type}#{$val} {
|
|
15
|
+
-webkit-line-clamp: unset;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.#{$namespace} {
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
display: block;
|
|
23
|
+
display: -webkit-box;
|
|
24
|
+
-webkit-box-orient: vertical;
|
|
25
|
+
|
|
26
|
+
@include generateLines('-line');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@media only screen and (max-width: 767px) {
|
|
31
|
+
.#{$namespace} {
|
|
32
|
+
@include clearLines('-line');
|
|
33
|
+
@include generateLines('-m-line');
|
|
34
|
+
}
|
|
35
|
+
}
|