@bifrostui/react 1.0.5 → 1.1.5
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/dist/ActionSheet/ActionSheet.less +31 -0
- package/dist/ActionSheet/ActionSheetItem.less +62 -0
- package/dist/Alert/index.less +112 -0
- package/dist/Avatar/Avatar.less +52 -0
- package/dist/Avatar/AvatarGroup.less +39 -0
- package/dist/Backdrop/{Backdrop.css → Backdrop.less} +4 -3
- package/dist/Badge/Badge.less +118 -0
- package/dist/Button/Button.less +244 -0
- package/dist/Calendar/Calendar.less +126 -0
- package/{es/Card/Card.css → dist/Card/Card.less} +1 -0
- package/dist/Card/CardHeader.less +53 -0
- package/dist/Checkbox/Checkbox.less +55 -0
- package/dist/CitySelector/CitySelector.d.ts +4 -0
- package/dist/CitySelector/CitySelector.js +36 -0
- package/dist/CitySelector/CitySelector.less +122 -0
- package/dist/CitySelector/CitySelector.miniapp.d.ts +5 -0
- package/dist/CitySelector/CitySelector.miniapp.js +79 -0
- package/dist/CitySelector/CitySelector.types.d.ts +47 -0
- package/dist/CitySelector/CitySelector.types.js +5 -0
- package/dist/CitySelector/CitySelectorCore.d.ts +5 -0
- package/dist/CitySelector/CitySelectorCore.js +183 -0
- package/dist/CitySelector/Selector/index.d.ts +9 -0
- package/dist/CitySelector/Selector/index.js +22 -0
- package/dist/CitySelector/Selector/index.less +13 -0
- package/dist/CitySelector/index.d.ts +2 -0
- package/dist/CitySelector/index.js +34 -0
- package/dist/CitySelector/miniapp.less +4 -0
- package/dist/Countdown/Countdown.less +39 -0
- package/dist/Divider/Divider.less +50 -0
- package/dist/Drawer/Drawer.less +40 -0
- package/dist/IconButton/IconButton.less +167 -0
- package/dist/Image/index.less +40 -0
- package/dist/Input/Input.less +72 -0
- package/dist/List/{List.css → List.less} +1 -0
- package/dist/List/{ListItem.css → ListItem.less} +17 -6
- package/dist/List/{ListItemContent.css → ListItemContent.less} +7 -2
- package/dist/List/{ListItemFooter.css → ListItemFooter.less} +4 -3
- package/dist/Loading/Loading.less +40 -0
- package/dist/Modal/{Modal.css → Modal.less} +8 -6
- package/dist/Modal/Modal.miniapp.d.ts +16 -0
- package/dist/Modal/Modal.miniapp.js +73 -0
- package/dist/NavBar/NavBar.less +67 -0
- package/dist/Picker/Picker.d.ts +5 -0
- package/dist/Picker/Picker.js +155 -0
- package/dist/Picker/Picker.less +62 -0
- package/dist/Picker/Picker.types.d.ts +98 -0
- package/dist/Picker/Picker.types.js +5 -0
- package/dist/Picker/PickerPanel.d.ts +5 -0
- package/dist/Picker/PickerPanel.js +210 -0
- package/dist/Picker/PickerPanel.less +67 -0
- package/dist/Picker/index.d.ts +2 -0
- package/dist/Picker/index.js +34 -0
- package/dist/Picker/utils.d.ts +13 -0
- package/dist/Picker/utils.js +66 -0
- package/dist/Progress/Progress.less +24 -0
- package/dist/Radio/Radio.less +81 -0
- package/dist/Rating/Rating.less +64 -0
- package/dist/ScrollView/{ScrollView.css → ScrollView.less} +4 -0
- package/dist/Select/Select.less +105 -0
- package/dist/Skeleton/Skeleton.less +72 -0
- package/dist/Slider/Slider.less +108 -0
- package/dist/Stack/demo/index.less +27 -0
- package/dist/Steps/Step.less +228 -0
- package/{es/Steps/Steps.css → dist/Steps/Steps.less} +5 -3
- package/dist/Swiper/Swiper.less +25 -0
- package/dist/Switch/Switch.less +177 -0
- package/dist/TabBar/TabBarItem.less +54 -0
- package/dist/Tabs/Tab.js +1 -1
- package/dist/Tabs/Tab.less +60 -0
- package/dist/Tabs/TabPanel.less +11 -0
- package/dist/Tabs/Tabs.less +77 -0
- package/dist/Tag/Tag.less +119 -0
- package/dist/Tag/TagGroup.less +52 -0
- package/dist/TextArea/{TextArea.css → TextArea.less} +27 -19
- package/dist/index.d.ts +2 -0
- package/dist/index.js +22 -0
- package/es/ActionSheet/ActionSheet.less +31 -0
- package/es/ActionSheet/ActionSheetItem.less +62 -0
- package/es/Alert/index.less +112 -0
- package/es/Avatar/Avatar.less +52 -0
- package/es/Avatar/AvatarGroup.less +39 -0
- package/es/Backdrop/{Backdrop.css → Backdrop.less} +4 -3
- package/es/Badge/Badge.less +118 -0
- package/es/Button/Button.less +244 -0
- package/es/Calendar/Calendar.less +126 -0
- package/{dist/Card/Card.css → es/Card/Card.less} +1 -0
- package/es/Card/CardHeader.less +53 -0
- package/es/Checkbox/Checkbox.less +55 -0
- package/es/CitySelector/CitySelector.d.ts +4 -0
- package/es/CitySelector/CitySelector.js +36 -0
- package/es/CitySelector/CitySelector.less +122 -0
- package/es/CitySelector/CitySelector.miniapp.d.ts +5 -0
- package/es/CitySelector/CitySelector.miniapp.js +77 -0
- package/es/CitySelector/CitySelector.types.d.ts +47 -0
- package/es/CitySelector/CitySelector.types.js +1 -0
- package/es/CitySelector/CitySelectorCore.d.ts +5 -0
- package/es/CitySelector/CitySelectorCore.js +194 -0
- package/es/CitySelector/Selector/index.d.ts +9 -0
- package/es/CitySelector/Selector/index.js +13 -0
- package/es/CitySelector/Selector/index.less +13 -0
- package/es/CitySelector/index.d.ts +2 -0
- package/es/CitySelector/index.js +2 -0
- package/es/CitySelector/miniapp.less +4 -0
- package/es/Countdown/Countdown.less +39 -0
- package/es/Divider/Divider.less +50 -0
- package/es/Drawer/Drawer.less +40 -0
- package/es/IconButton/IconButton.less +167 -0
- package/es/Image/index.less +40 -0
- package/es/Input/Input.less +72 -0
- package/es/List/{List.css → List.less} +1 -0
- package/es/List/{ListItem.css → ListItem.less} +17 -6
- package/es/List/{ListItemContent.css → ListItemContent.less} +7 -2
- package/es/List/{ListItemFooter.css → ListItemFooter.less} +4 -3
- package/es/Loading/Loading.less +40 -0
- package/es/Modal/{Modal.css → Modal.less} +8 -6
- package/es/Modal/Modal.miniapp.d.ts +16 -0
- package/es/Modal/Modal.miniapp.js +78 -0
- package/es/NavBar/NavBar.less +67 -0
- package/es/Picker/Picker.d.ts +5 -0
- package/es/Picker/Picker.js +171 -0
- package/es/Picker/Picker.less +62 -0
- package/es/Picker/Picker.types.d.ts +98 -0
- package/es/Picker/Picker.types.js +1 -0
- package/es/Picker/PickerPanel.d.ts +5 -0
- package/es/Picker/PickerPanel.js +234 -0
- package/es/Picker/PickerPanel.less +67 -0
- package/es/Picker/index.d.ts +2 -0
- package/es/Picker/index.js +2 -0
- package/es/Picker/utils.d.ts +13 -0
- package/es/Picker/utils.js +65 -0
- package/es/Progress/Progress.less +24 -0
- package/es/Radio/Radio.less +81 -0
- package/es/Rating/Rating.less +64 -0
- package/es/ScrollView/{ScrollView.css → ScrollView.less} +4 -0
- package/es/Select/Select.less +105 -0
- package/es/Skeleton/Skeleton.less +72 -0
- package/es/Slider/Slider.less +108 -0
- package/es/Stack/demo/index.less +27 -0
- package/es/Steps/Step.less +228 -0
- package/{dist/Steps/Steps.css → es/Steps/Steps.less} +5 -3
- package/es/Swiper/Swiper.less +25 -0
- package/es/Switch/Switch.less +177 -0
- package/es/TabBar/TabBarItem.less +54 -0
- package/es/Tabs/Tab.js +1 -1
- package/es/Tabs/Tab.less +60 -0
- package/es/Tabs/TabPanel.less +11 -0
- package/es/Tabs/Tabs.less +77 -0
- package/es/Tag/Tag.less +119 -0
- package/es/Tag/TagGroup.less +52 -0
- package/es/TextArea/{TextArea.css → TextArea.less} +27 -19
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/package.json +6 -6
- package/dist/ActionSheet/ActionSheet.css +0 -27
- package/dist/ActionSheet/ActionSheetItem.css +0 -51
- package/dist/Alert/index.css +0 -89
- package/dist/Avatar/Avatar.css +0 -43
- package/dist/Avatar/AvatarGroup.css +0 -31
- package/dist/Badge/Badge.css +0 -95
- package/dist/Button/Button.css +0 -200
- package/dist/Calendar/Calendar.css +0 -105
- package/dist/Card/CardHeader.css +0 -45
- package/dist/Checkbox/Checkbox.css +0 -45
- package/dist/Countdown/Countdown.css +0 -28
- package/dist/Divider/Divider.css +0 -41
- package/dist/Drawer/Drawer.css +0 -35
- package/dist/IconButton/IconButton.css +0 -130
- package/dist/Image/index.css +0 -35
- package/dist/Input/Input.css +0 -59
- package/dist/Loading/Loading.css +0 -31
- package/dist/NavBar/NavBar.css +0 -57
- package/dist/Progress/Progress.css +0 -22
- package/dist/Radio/Radio.css +0 -65
- package/dist/Rating/Rating.css +0 -52
- package/dist/Select/Select.css +0 -89
- package/dist/Skeleton/Skeleton.css +0 -54
- package/dist/Slider/Slider.css +0 -95
- package/dist/Stack/demo/index.css +0 -23
- package/dist/Steps/Step.css +0 -174
- package/dist/Swiper/Swiper.css +0 -20
- package/dist/Switch/Switch.css +0 -127
- package/dist/TabBar/TabBarItem.css +0 -38
- package/dist/Tabs/Tab.css +0 -52
- package/dist/Tabs/TabPanel.css +0 -9
- package/dist/Tabs/Tabs.css +0 -56
- package/dist/Tag/Tag.css +0 -97
- package/dist/Tag/TagGroup.css +0 -43
- package/es/ActionSheet/ActionSheet.css +0 -27
- package/es/ActionSheet/ActionSheetItem.css +0 -51
- package/es/Alert/index.css +0 -89
- package/es/Avatar/Avatar.css +0 -43
- package/es/Avatar/AvatarGroup.css +0 -31
- package/es/Badge/Badge.css +0 -95
- package/es/Button/Button.css +0 -200
- package/es/Calendar/Calendar.css +0 -105
- package/es/Card/CardHeader.css +0 -45
- package/es/Checkbox/Checkbox.css +0 -45
- package/es/Countdown/Countdown.css +0 -28
- package/es/Divider/Divider.css +0 -41
- package/es/Drawer/Drawer.css +0 -35
- package/es/IconButton/IconButton.css +0 -130
- package/es/Image/index.css +0 -35
- package/es/Input/Input.css +0 -59
- package/es/Loading/Loading.css +0 -31
- package/es/NavBar/NavBar.css +0 -57
- package/es/Progress/Progress.css +0 -22
- package/es/Radio/Radio.css +0 -65
- package/es/Rating/Rating.css +0 -52
- package/es/Select/Select.css +0 -89
- package/es/Skeleton/Skeleton.css +0 -54
- package/es/Slider/Slider.css +0 -95
- package/es/Stack/demo/index.css +0 -23
- package/es/Steps/Step.css +0 -174
- package/es/Swiper/Swiper.css +0 -20
- package/es/Switch/Switch.css +0 -127
- package/es/TabBar/TabBarItem.css +0 -38
- package/es/Tabs/Tab.css +0 -52
- package/es/Tabs/TabPanel.css +0 -9
- package/es/Tabs/Tabs.css +0 -56
- package/es/Tag/Tag.css +0 -97
- package/es/Tag/TagGroup.css +0 -43
- /package/dist/Card/{CardContent.css → CardContent.less} +0 -0
- /package/dist/Card/{CardFooter.css → CardFooter.less} +0 -0
- /package/dist/List/{ListItemExtra.css → ListItemExtra.less} +0 -0
- /package/dist/List/{ListItemHeader.css → ListItemHeader.less} +0 -0
- /package/dist/Stack/{Stack.css → Stack.less} +0 -0
- /package/dist/TabBar/{TabBar.css → TabBar.less} +0 -0
- /package/es/Card/{CardContent.css → CardContent.less} +0 -0
- /package/es/Card/{CardFooter.css → CardFooter.less} +0 -0
- /package/es/List/{ListItemExtra.css → ListItemExtra.less} +0 -0
- /package/es/List/{ListItemHeader.css → ListItemHeader.less} +0 -0
- /package/es/Stack/{Stack.css → Stack.less} +0 -0
- /package/es/TabBar/{TabBar.css → TabBar.less} +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
@import '~@bifrostui/styles/mixins/index.less';
|
|
2
|
+
|
|
3
|
+
.bui-calendar {
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
background-color: var(--bui-color-bg-view);
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 100%;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
padding: 6px 12px 7px;
|
|
12
|
+
font-family: var(--bui-font-family);
|
|
13
|
+
|
|
14
|
+
&-week {
|
|
15
|
+
height: 30px;
|
|
16
|
+
font-size: var(--bui-text-size-2);
|
|
17
|
+
font-weight: var(--bui-font-weight-medium);
|
|
18
|
+
color: var(--bui-color-fg-default);
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
|
|
23
|
+
&-item {
|
|
24
|
+
width: 14.28%;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-item:nth-child(1),
|
|
31
|
+
&-item:nth-child(7) {
|
|
32
|
+
color: var(--bui-color-primary);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&-handler {
|
|
37
|
+
height: 28px;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
margin-bottom: 7px;
|
|
42
|
+
|
|
43
|
+
&-text {
|
|
44
|
+
width: 80px;
|
|
45
|
+
font-size: var(--bui-title-size-3);
|
|
46
|
+
font-weight: var(--bui-font-weight-medium);
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&-btn {
|
|
51
|
+
font-size: 16px;
|
|
52
|
+
height: 100%;
|
|
53
|
+
width: 46px;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
|
|
59
|
+
&-icon {
|
|
60
|
+
font-size: 28px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&-month {
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-wrap: wrap;
|
|
68
|
+
margin-bottom: var(--bui-spacing-sm);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&-day-box {
|
|
72
|
+
width: 14.28%;
|
|
73
|
+
height: 30px;
|
|
74
|
+
margin-bottom: 7px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&-highlight-day {
|
|
78
|
+
.bui-calendar-day {
|
|
79
|
+
color: var(--bui-color-primary);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&-day {
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 100%;
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
border-radius: 6px;
|
|
90
|
+
font-size: var(--bui-title-size-4);
|
|
91
|
+
font-weight: var(--bui-font-weight-medium);
|
|
92
|
+
color: var(--bui-color-fg-default);
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
|
|
95
|
+
&.bui-calendar-disabled {
|
|
96
|
+
color: #9c9ca5;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&-today {
|
|
101
|
+
color: var(--bui-color-primary);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&-middle {
|
|
105
|
+
color: #000;
|
|
106
|
+
border-radius: 0;
|
|
107
|
+
background-color: #ffeaf1;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&-start {
|
|
111
|
+
color: #000;
|
|
112
|
+
background-color: #ffc7da;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&-range {
|
|
116
|
+
border-top-right-radius: 0;
|
|
117
|
+
border-bottom-right-radius: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&-end {
|
|
121
|
+
color: #000;
|
|
122
|
+
background-color: #ffc7da;
|
|
123
|
+
border-top-left-radius: 0;
|
|
124
|
+
border-bottom-left-radius: 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.bui-card-flex() {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.bui-card-header {
|
|
8
|
+
.bui-card-flex();
|
|
9
|
+
position: relative;
|
|
10
|
+
padding: var(--bui-spacing-md) var(--bui-spacing-lg);
|
|
11
|
+
font-size: var(--bui-title-size-4);
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
color: var(--bui-color-fg-default);
|
|
14
|
+
font-family: var(--bui-font-family);
|
|
15
|
+
|
|
16
|
+
&-title {
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
text-overflow: ellipsis;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&-subtitle {
|
|
25
|
+
font-size: var(--bui-text-size-3);
|
|
26
|
+
font-weight: normal;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
text-overflow: ellipsis;
|
|
30
|
+
color: var(--bui-color-fg-subtle);
|
|
31
|
+
padding: 0 var(--bui-spacing-xs);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-extra {
|
|
35
|
+
white-space: nowrap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&-end-icon {
|
|
39
|
+
.bui-card-flex();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&-extra,
|
|
43
|
+
&-end-icon {
|
|
44
|
+
font-size: var(--bui-text-size-3);
|
|
45
|
+
font-weight: normal;
|
|
46
|
+
color: var(--bui-color-fg-subtle);
|
|
47
|
+
margin-left: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&-extra + &-end-icon {
|
|
51
|
+
margin-left: 2px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@import '~@bifrostui/styles/mixins/index.less';
|
|
2
|
+
|
|
3
|
+
.bui-checkbox {
|
|
4
|
+
--label-color: var(--bui-color-fg-default);
|
|
5
|
+
--label-font-size: var(--bui-text-size-1);
|
|
6
|
+
--icon-font-size: var(--bui-title-size-2);
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
position: relative;
|
|
10
|
+
font-family: var(--bui-font-family);
|
|
11
|
+
|
|
12
|
+
&.bui-checkbox-disabled {
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
opacity: 0.5;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-label-left {
|
|
18
|
+
flex-direction: row-reverse;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-label-top {
|
|
22
|
+
flex-direction: column-reverse;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-label-bottom {
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-input {
|
|
30
|
+
opacity: 0;
|
|
31
|
+
// 解决onClick触发两次的问题 & 微信文案点击选中
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
z-index: 1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-icon {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
padding: 5px;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
font-size: var(--icon-font-size);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&-label {
|
|
52
|
+
font-size: var(--label-font-size);
|
|
53
|
+
color: var(--label-color);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _CitySelectorCore = _interopRequireDefault(require("./CitySelectorCore"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
+
const CitySelector = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
14
|
+
const {
|
|
15
|
+
cities
|
|
16
|
+
} = props;
|
|
17
|
+
const [height, setHeight] = (0, _react.useState)('');
|
|
18
|
+
const touchHandler = (e, scrollToCode) => {
|
|
19
|
+
const t = document.elementFromPoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY);
|
|
20
|
+
const code = t?.dataset?.code;
|
|
21
|
+
scrollToCode(code);
|
|
22
|
+
};
|
|
23
|
+
(0, _react.useEffect)(() => {
|
|
24
|
+
if (!cities?.length || height) return;
|
|
25
|
+
const screenHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
26
|
+
const domHeight = document.querySelector('.bui-city-selector-scroll-view-container')?.getBoundingClientRect().height;
|
|
27
|
+
setHeight(`${domHeight / screenHeight * 100}vh`);
|
|
28
|
+
}, [cities]);
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_CitySelectorCore.default, _extends({}, props, {
|
|
30
|
+
ref: ref,
|
|
31
|
+
touchHandler: touchHandler,
|
|
32
|
+
height: height
|
|
33
|
+
}));
|
|
34
|
+
});
|
|
35
|
+
CitySelector.displayName = 'BuiCitySelector';
|
|
36
|
+
var _default = exports.default = CitySelector;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
@import '~@bifrostui/styles/mixins/index.less';
|
|
2
|
+
|
|
3
|
+
.bui-city-selector {
|
|
4
|
+
font-family: var(--bui-font-family);
|
|
5
|
+
height: 100%;
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
&-title {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 45px;
|
|
11
|
+
color: var(--bui-color-fg-default);
|
|
12
|
+
font-size: var(--bui-title-size-3);
|
|
13
|
+
line-height: 45px;
|
|
14
|
+
text-align: center;
|
|
15
|
+
position: sticky;
|
|
16
|
+
top: 0;
|
|
17
|
+
z-index: 1004;
|
|
18
|
+
border-bottom: solid 1px var(--bui-color-border-default);
|
|
19
|
+
background-color: var(--bui-color-bg-view);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&-btn-close {
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
width: 45px;
|
|
27
|
+
height: 45px;
|
|
28
|
+
color: var(--bui-color-fg-muted);
|
|
29
|
+
text-align: center;
|
|
30
|
+
font-size: 20px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&-scroll-view-container {
|
|
34
|
+
height: 100%;
|
|
35
|
+
|
|
36
|
+
&.container-has-title {
|
|
37
|
+
height: calc(100% - 45px);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-all-city {
|
|
42
|
+
min-height: 500px;
|
|
43
|
+
font-size: var(--bui-text-size-2);
|
|
44
|
+
width: 100%;
|
|
45
|
+
background: var(--bui-color-bg-view);
|
|
46
|
+
align-self: flex-start;
|
|
47
|
+
|
|
48
|
+
.select-city-buttons {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-flow: wrap;
|
|
51
|
+
padding-left: 3px;
|
|
52
|
+
padding-top: 7.5px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.select-city-title {
|
|
56
|
+
font-size: var(--bui-title-size-4);
|
|
57
|
+
line-height: 15px;
|
|
58
|
+
font-weight: 600;
|
|
59
|
+
padding-left: var(--bui-spacing-lg);
|
|
60
|
+
padding-top: 9px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&-list {
|
|
65
|
+
padding-left: var(--bui-spacing-lg);
|
|
66
|
+
list-style-type: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&-list-item {
|
|
70
|
+
height: 45px;
|
|
71
|
+
font-size: var(--bui-title-size-4);
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
|
|
75
|
+
&:not(:last-child) {
|
|
76
|
+
border-bottom: 0.5px solid var(--bui-color-border-default);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&-index-container {
|
|
81
|
+
z-index: 1001;
|
|
82
|
+
position: absolute;
|
|
83
|
+
white-space: nowrap;
|
|
84
|
+
right: 0;
|
|
85
|
+
top: 50%;
|
|
86
|
+
width: 40px;
|
|
87
|
+
will-change: transform;
|
|
88
|
+
// transform: translate(100%, -50%);
|
|
89
|
+
transform: translate(0, -50%);
|
|
90
|
+
transition:
|
|
91
|
+
opacity 0.2s ease-out,
|
|
92
|
+
transform 0.2s ease-out;
|
|
93
|
+
|
|
94
|
+
&.left-in {
|
|
95
|
+
opacity: 1;
|
|
96
|
+
transform: translate(0, -50%);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&.city-index-has-title {
|
|
100
|
+
top: calc(50% + 22.5px);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
ul {
|
|
104
|
+
margin: 0;
|
|
105
|
+
padding: 0;
|
|
106
|
+
float: left;
|
|
107
|
+
width: 100%;
|
|
108
|
+
touch-action: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
li {
|
|
112
|
+
list-style: none;
|
|
113
|
+
height: 20px;
|
|
114
|
+
text-align: center;
|
|
115
|
+
font-size: var(--bui-text-size-3);
|
|
116
|
+
color: var(--bui-color-info, --bui-color-info);
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CitySelectorProps } from './CitySelector.types';
|
|
3
|
+
import './miniapp.less';
|
|
4
|
+
declare const CitySelector: React.ForwardRefExoticComponent<Omit<CitySelectorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export default CitySelector;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _taro = _interopRequireDefault(require("@tarojs/taro"));
|
|
9
|
+
var _CitySelectorCore = _interopRequireDefault(require("./CitySelectorCore"));
|
|
10
|
+
require("./miniapp.css");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
const CitySelector = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
16
|
+
const {
|
|
17
|
+
cities
|
|
18
|
+
} = props;
|
|
19
|
+
const containerTop = (0, _react.useRef)(0);
|
|
20
|
+
const codeHeight = (0, _react.useRef)(0);
|
|
21
|
+
const [height, setHeight] = (0, _react.useState)('');
|
|
22
|
+
const queryContainerTop = cbk => {
|
|
23
|
+
const query = _taro.default.createSelectorQuery();
|
|
24
|
+
query.select('.bui-city-selector-index-container').boundingClientRect();
|
|
25
|
+
query.exec(res => {
|
|
26
|
+
containerTop.current = res[0]?.top;
|
|
27
|
+
cbk?.();
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
(0, _react.useEffect)(() => {
|
|
31
|
+
if (cities?.length === 0 || codeHeight.current) return;
|
|
32
|
+
// 演示获取字母高度
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
const query = _taro.default.createSelectorQuery();
|
|
35
|
+
query.select('.bui-city-selector-index-item').boundingClientRect();
|
|
36
|
+
query.exec(res => {
|
|
37
|
+
codeHeight.current = res[0]?.height;
|
|
38
|
+
});
|
|
39
|
+
}, 300);
|
|
40
|
+
}, [cities, height]);
|
|
41
|
+
(0, _react.useEffect)(() => {
|
|
42
|
+
if (!cities?.length || height) return;
|
|
43
|
+
const {
|
|
44
|
+
screenHeight
|
|
45
|
+
} = _taro.default.getSystemInfoSync();
|
|
46
|
+
const query = _taro.default.createSelectorQuery();
|
|
47
|
+
query.select('.bui-city-selector-scroll-view-container').boundingClientRect();
|
|
48
|
+
query.exec(codeRect => {
|
|
49
|
+
const domHeight = codeRect?.[0]?.height;
|
|
50
|
+
setHeight(`${domHeight / screenHeight * 100}vh`);
|
|
51
|
+
});
|
|
52
|
+
}, [cities]);
|
|
53
|
+
const parseIndex = (length, index) => {
|
|
54
|
+
if (index <= 0) return 0;
|
|
55
|
+
if (index >= length - 1) return length - 1;
|
|
56
|
+
return index;
|
|
57
|
+
};
|
|
58
|
+
const pxToCode = (clientY, scrollToCode, codeGroup) => {
|
|
59
|
+
let index = Math.floor((clientY - containerTop.current) / codeHeight.current);
|
|
60
|
+
index = parseIndex(codeGroup.length, index);
|
|
61
|
+
const codeItem = codeGroup[index];
|
|
62
|
+
scrollToCode(codeItem.code || codeItem);
|
|
63
|
+
};
|
|
64
|
+
const touchHandler = (event, scrollToCode, codeGroup) => {
|
|
65
|
+
const {
|
|
66
|
+
clientY
|
|
67
|
+
} = event.changedTouches[0];
|
|
68
|
+
queryContainerTop(() => {
|
|
69
|
+
pxToCode(clientY, scrollToCode, codeGroup);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_CitySelectorCore.default, _extends({}, props, {
|
|
73
|
+
ref: ref,
|
|
74
|
+
touchHandler: touchHandler,
|
|
75
|
+
height: height
|
|
76
|
+
}));
|
|
77
|
+
});
|
|
78
|
+
CitySelector.displayName = 'BuiCitySelector';
|
|
79
|
+
var _default = exports.default = CitySelector;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OverrideProps } from '@bifrostui/types';
|
|
3
|
+
export type cityType = {
|
|
4
|
+
/** 城市名 */
|
|
5
|
+
name: string;
|
|
6
|
+
/** 城市名id */
|
|
7
|
+
code: string;
|
|
8
|
+
};
|
|
9
|
+
export type allCityItemType = {
|
|
10
|
+
/** 城市列表 */
|
|
11
|
+
cities: cityType[];
|
|
12
|
+
/** 索引字母 */
|
|
13
|
+
groupName: string;
|
|
14
|
+
};
|
|
15
|
+
export type CitySelectorProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
16
|
+
props: P & {
|
|
17
|
+
/** 当前城市信息 */
|
|
18
|
+
selectedCity?: cityType;
|
|
19
|
+
/** 当前城市栏的title */
|
|
20
|
+
selectedCityGroupName?: string;
|
|
21
|
+
/** 定位城市信息 */
|
|
22
|
+
currentCity?: cityType;
|
|
23
|
+
/** 定位城市栏的title */
|
|
24
|
+
currentCityGroupName?: string;
|
|
25
|
+
/** 热门城市信息 */
|
|
26
|
+
hotCities?: cityType[];
|
|
27
|
+
/** 热门城市栏的title */
|
|
28
|
+
hotCitiesGroupName?: string;
|
|
29
|
+
/** 城市列表 */
|
|
30
|
+
cities: allCityItemType[];
|
|
31
|
+
/** 禁用展示索引 默认false 即展示索引 */
|
|
32
|
+
disableIndex?: boolean;
|
|
33
|
+
/** 头部标题 */
|
|
34
|
+
title?: string;
|
|
35
|
+
/** 选择城市回调 */
|
|
36
|
+
onSelect: (e: React.SyntheticEvent, data: {
|
|
37
|
+
city: cityType;
|
|
38
|
+
}) => void;
|
|
39
|
+
/** 和title配合使用,头部右侧的关闭回调 */
|
|
40
|
+
onClose?: (e: React.SyntheticEvent) => void;
|
|
41
|
+
};
|
|
42
|
+
defaultComponent: D;
|
|
43
|
+
}, D>;
|
|
44
|
+
export type CitySelectorCoreProps = CitySelectorProps & {
|
|
45
|
+
touchHandler: any;
|
|
46
|
+
height?: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CitySelectorCoreProps } from './CitySelector.types';
|
|
3
|
+
import './CitySelector.less';
|
|
4
|
+
declare const CitySelector: React.ForwardRefExoticComponent<Omit<CitySelectorCoreProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export default CitySelector;
|