@tarojs/components 3.4.5 → 3.5.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/cjs/index-47a1959e.js +34 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/taro-button-core.cjs.entry.js +1 -1
  4. package/dist/cjs/taro-canvas-core.cjs.entry.js +1 -1
  5. package/dist/cjs/taro-checkbox-core_2.cjs.entry.js +1 -1
  6. package/dist/cjs/taro-components.cjs.js +1 -1
  7. package/dist/cjs/taro-image-core.cjs.entry.js +1 -1
  8. package/dist/cjs/taro-input-core.cjs.entry.js +1 -1
  9. package/dist/cjs/taro-navigator-core.cjs.entry.js +2 -2
  10. package/dist/cjs/taro-picker-view-column-core.cjs.entry.js +79 -3
  11. package/dist/cjs/taro-picker-view-core.cjs.entry.js +71 -2
  12. package/dist/cjs/taro-pull-to-refresh.cjs.entry.js +1 -1
  13. package/dist/cjs/taro-scroll-view-core.cjs.entry.js +5 -13
  14. package/dist/cjs/taro-swiper-core_2.cjs.entry.js +5 -13
  15. package/dist/cjs/taro-tabbar.cjs.entry.js +34 -35
  16. package/dist/cjs/taro-text-core.cjs.entry.js +1 -1
  17. package/dist/cjs/taro-textarea-core.cjs.entry.js +1 -1
  18. package/dist/cjs/taro-video-control_3.cjs.entry.js +102 -115
  19. package/dist/cjs/taro-view-core.cjs.entry.js +1 -1
  20. package/dist/cjs/taro-web-view-core.cjs.entry.js +1 -1
  21. package/dist/collection/components/button/style/index.css +49 -49
  22. package/dist/collection/components/canvas/canvas.js +1 -1
  23. package/dist/collection/components/canvas/style/index.css +6 -6
  24. package/dist/collection/components/checkbox/style/index.css +21 -22
  25. package/dist/collection/components/image/style/index.css +4 -4
  26. package/dist/collection/components/input/index.css +2 -2
  27. package/dist/collection/components/navigator/navigator.js +2 -2
  28. package/dist/collection/components/navigator/{navigator.css → style/index.css} +3 -3
  29. package/dist/collection/components/picker/style/index.css +2 -1
  30. package/dist/collection/components/picker-view/picker-view-column.js +218 -4
  31. package/dist/collection/components/picker-view/picker-view.js +217 -3
  32. package/dist/collection/components/picker-view/style/column.css +12 -0
  33. package/dist/collection/components/picker-view/style/index.css +28 -0
  34. package/dist/collection/components/pull-to-refresh/pull-to-refresh.js +1 -1
  35. package/dist/collection/components/pull-to-refresh/style/index.css +53 -50
  36. package/dist/collection/components/scroll-view/scroll-view.js +3 -11
  37. package/dist/collection/components/swiper/swiper.js +2 -10
  38. package/dist/collection/components/tabbar/style/index.css +7 -6
  39. package/dist/collection/components/tabbar/tabbar.js +11 -12
  40. package/dist/collection/components/text/style/index.css +0 -6
  41. package/dist/collection/components/textarea/style/index.css +5 -5
  42. package/dist/collection/components/video/style/index.css +89 -109
  43. package/dist/collection/components/video/utils.js +95 -109
  44. package/dist/collection/components/video/video.js +2 -1
  45. package/dist/collection/components/view/style/index.css +3 -5
  46. package/dist/collection/components/web-view/style/index.css +1 -1
  47. package/dist/collection/utils/index.js +23 -83
  48. package/dist/collection/utils/style.js +10 -0
  49. package/dist/collection/utils/url.js +67 -0
  50. package/dist/esm/index-cad8203e.js +31 -0
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/taro-button-core.entry.js +1 -1
  53. package/dist/esm/taro-canvas-core.entry.js +1 -1
  54. package/dist/esm/taro-checkbox-core_2.entry.js +1 -1
  55. package/dist/esm/taro-components.js +1 -1
  56. package/dist/esm/taro-image-core.entry.js +1 -1
  57. package/dist/esm/taro-input-core.entry.js +1 -1
  58. package/dist/esm/taro-navigator-core.entry.js +2 -2
  59. package/dist/esm/taro-picker-view-column-core.entry.js +80 -4
  60. package/dist/esm/taro-picker-view-core.entry.js +72 -3
  61. package/dist/esm/taro-pull-to-refresh.entry.js +1 -1
  62. package/dist/esm/taro-scroll-view-core.entry.js +3 -11
  63. package/dist/esm/taro-swiper-core_2.entry.js +1 -9
  64. package/dist/esm/taro-tabbar.entry.js +34 -35
  65. package/dist/esm/taro-text-core.entry.js +1 -1
  66. package/dist/esm/taro-textarea-core.entry.js +1 -1
  67. package/dist/esm/taro-video-control_3.entry.js +96 -109
  68. package/dist/esm/taro-view-core.entry.js +1 -1
  69. package/dist/esm/taro-web-view-core.entry.js +1 -1
  70. package/dist/esm-es5/index-cad8203e.js +1 -0
  71. package/dist/esm-es5/loader.js +1 -1
  72. package/dist/esm-es5/taro-button-core.entry.js +1 -1
  73. package/dist/esm-es5/taro-canvas-core.entry.js +1 -1
  74. package/dist/esm-es5/taro-checkbox-core_2.entry.js +1 -1
  75. package/dist/esm-es5/taro-components.js +1 -1
  76. package/dist/esm-es5/taro-image-core.entry.js +1 -1
  77. package/dist/esm-es5/taro-input-core.entry.js +1 -1
  78. package/dist/esm-es5/taro-navigator-core.entry.js +1 -1
  79. package/dist/esm-es5/taro-picker-view-column-core.entry.js +1 -1
  80. package/dist/esm-es5/taro-picker-view-core.entry.js +1 -1
  81. package/dist/esm-es5/taro-pull-to-refresh.entry.js +1 -1
  82. package/dist/esm-es5/taro-scroll-view-core.entry.js +1 -1
  83. package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
  84. package/dist/esm-es5/taro-tabbar.entry.js +1 -1
  85. package/dist/esm-es5/taro-text-core.entry.js +1 -1
  86. package/dist/esm-es5/taro-textarea-core.entry.js +1 -1
  87. package/dist/esm-es5/taro-video-control_3.entry.js +1 -1
  88. package/dist/esm-es5/taro-view-core.entry.js +1 -1
  89. package/dist/esm-es5/taro-web-view-core.entry.js +1 -1
  90. package/dist/taro-components/{p-4dbed323.entry.js → p-07062966.entry.js} +1 -1
  91. package/dist/taro-components/p-078230a0.system.entry.js +1 -0
  92. package/dist/taro-components/p-08aba8db.system.entry.js +1 -0
  93. package/dist/taro-components/p-08ea5931.system.entry.js +1 -0
  94. package/dist/taro-components/{p-9fc88fc1.system.entry.js → p-0c18bd18.system.entry.js} +1 -1
  95. package/dist/taro-components/{p-17cf8b5b.entry.js → p-1b48afb1.entry.js} +1 -1
  96. package/dist/taro-components/p-1c625d7d.entry.js +1 -0
  97. package/dist/taro-components/p-33ee636a.system.js +1 -1
  98. package/dist/taro-components/p-34188530.system.entry.js +1 -0
  99. package/dist/taro-components/{p-71e14298.entry.js → p-4039bcb5.entry.js} +1 -1
  100. package/dist/taro-components/p-44b60b72.entry.js +1 -0
  101. package/dist/taro-components/p-4aa4de0f.system.entry.js +1 -0
  102. package/dist/taro-components/{p-50066d5e.system.entry.js → p-4cd044c4.system.entry.js} +1 -1
  103. package/dist/taro-components/p-5746d7ce.js +1 -0
  104. package/dist/taro-components/{p-2b0d5c90.system.entry.js → p-58623cdd.system.entry.js} +1 -1
  105. package/dist/taro-components/{p-d041b413.entry.js → p-5c6aeb55.entry.js} +1 -1
  106. package/dist/taro-components/{p-1c1336f5.entry.js → p-5d5baadf.entry.js} +1 -1
  107. package/dist/taro-components/p-663d1bb9.system.js +1 -0
  108. package/dist/taro-components/{p-d567b95e.entry.js → p-758fb1ba.entry.js} +1 -1
  109. package/dist/taro-components/p-786653af.system.entry.js +1 -0
  110. package/dist/taro-components/p-7fdd59f0.entry.js +1 -0
  111. package/dist/taro-components/{p-fd8312e5.system.entry.js → p-8e0150eb.system.entry.js} +1 -1
  112. package/dist/taro-components/p-92a31933.system.entry.js +1 -0
  113. package/dist/taro-components/p-a05d66d1.system.entry.js +1 -0
  114. package/dist/taro-components/p-a1863c96.entry.js +1 -0
  115. package/dist/taro-components/p-aae3e479.entry.js +1 -0
  116. package/dist/taro-components/p-c5a86c19.system.entry.js +1 -0
  117. package/dist/taro-components/p-cc36cee7.entry.js +1 -0
  118. package/dist/taro-components/{p-8bc82aaa.entry.js → p-d0c608a8.entry.js} +1 -1
  119. package/dist/taro-components/{p-293531af.system.entry.js → p-d91ab597.system.entry.js} +1 -1
  120. package/dist/taro-components/{p-fe156231.system.entry.js → p-da8edf69.system.entry.js} +1 -1
  121. package/dist/taro-components/p-e0ad978e.entry.js +1 -0
  122. package/dist/taro-components/p-e35230e0.entry.js +1 -0
  123. package/dist/taro-components/p-e61d2113.system.entry.js +1 -0
  124. package/dist/taro-components/{p-4e54216b.entry.js → p-f5fe8711.entry.js} +1 -1
  125. package/dist/taro-components/taro-components.esm.js +1 -1
  126. package/dist/types/components/picker-view/picker-view-column.d.ts +15 -1
  127. package/dist/types/components/picker-view/picker-view.d.ts +24 -0
  128. package/dist/types/components/scroll-view/scroll-view.d.ts +1 -1
  129. package/dist/types/components/swiper/swiper.d.ts +2 -2
  130. package/dist/types/components/tabbar/tabbar.d.ts +3 -2
  131. package/dist/types/components/video/utils.d.ts +7 -0
  132. package/dist/types/components.d.ts +22 -0
  133. package/dist/types/utils/index.d.ts +4 -8
  134. package/dist/types/utils/style.d.ts +1 -0
  135. package/dist/types/utils/url.d.ts +6 -0
  136. package/package.json +3 -3
  137. package/types/Input.d.ts +5 -4
  138. package/types/PickerViewColumn.d.ts +2 -2
  139. package/types/index.vue3.d.ts +159 -0
  140. package/dist/taro-components/p-32937866.entry.js +0 -1
  141. package/dist/taro-components/p-431197bc.entry.js +0 -1
  142. package/dist/taro-components/p-43de2f12.system.entry.js +0 -1
  143. package/dist/taro-components/p-5ae86835.system.entry.js +0 -1
  144. package/dist/taro-components/p-5c420456.entry.js +0 -1
  145. package/dist/taro-components/p-6de12779.entry.js +0 -1
  146. package/dist/taro-components/p-83dedaa2.entry.js +0 -1
  147. package/dist/taro-components/p-8486c251.system.entry.js +0 -1
  148. package/dist/taro-components/p-95529dc0.entry.js +0 -1
  149. package/dist/taro-components/p-b15d0302.system.entry.js +0 -1
  150. package/dist/taro-components/p-b32442fc.system.entry.js +0 -1
  151. package/dist/taro-components/p-cc818a13.entry.js +0 -1
  152. package/dist/taro-components/p-d394a61f.system.entry.js +0 -1
  153. package/dist/taro-components/p-d5971476.entry.js +0 -1
  154. package/dist/taro-components/p-e0af1d0d.system.entry.js +0 -1
  155. package/dist/taro-components/p-fb2252b7.system.entry.js +0 -1
  156. package/dist/taro-components/p-fd0d1168.system.entry.js +0 -1
  157. package/dist/taro-components/p-fde3a009.system.entry.js +0 -1
@@ -1,63 +1,63 @@
1
1
  taro-button-core {
2
- position: relative;
3
2
  display: block;
3
+ overflow: hidden;
4
+ position: relative;
5
+ box-sizing: border-box;
4
6
  margin-left: auto;
5
7
  margin-right: auto;
6
8
  padding-left: 14px;
7
9
  padding-right: 14px;
8
- box-sizing: border-box;
9
- font-size: 18px;
10
- text-align: center;
11
- text-decoration: none;
12
- color: #000000;
13
- background-color: #F8F8F8;
14
- line-height: 2.55555556;
10
+ border-width: 0;
15
11
  border-radius: 5px;
16
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
17
- overflow: hidden;
18
12
  width: 100%;
19
- border-width: 0;
13
+ appearance: none;
20
14
  outline: 0;
21
- -webkit-appearance: none;
22
- }
23
- taro-button-core:not([disabled]):active {
24
- color: rgba(0, 0, 0, 0.6);
25
- background-color: #DEDEDE;
15
+ background-color: #f8f8f8;
16
+ line-height: 2.55555556;
17
+ text-decoration: none;
18
+ text-align: center;
19
+ font-size: 18px;
20
+ color: #000;
21
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
26
22
  }
27
23
  taro-button-core:focus {
28
24
  outline: 0;
29
25
  }
30
- taro-button-core:after {
31
- content: " ";
32
- width: 200%;
33
- height: 200%;
26
+ taro-button-core:not([disabled]):active {
27
+ background-color: #dedede;
28
+ color: rgba(0, 0, 0, 0.6);
29
+ }
30
+ taro-button-core::after {
34
31
  position: absolute;
35
- top: 0;
36
32
  left: 0;
33
+ top: 0;
34
+ box-sizing: border-box;
37
35
  border: 1px solid rgba(0, 0, 0, 0.2);
36
+ border-radius: 10px;
37
+ width: 200%;
38
+ height: 200%;
39
+ content: " ";
38
40
  transform: scale(0.5);
39
41
  transform-origin: 0 0;
40
- box-sizing: border-box;
41
- border-radius: 10px;
42
42
  }
43
43
  taro-button-core + taro-button-core {
44
44
  margin-top: 15px;
45
45
  }
46
46
  taro-button-core[type=default] {
47
- color: #000000;
48
- background-color: #F8F8F8;
47
+ background-color: #f8f8f8;
48
+ color: #000;
49
49
  }
50
50
  taro-button-core[type=default]:not([disabled]):visited {
51
- color: #000000;
51
+ color: #000;
52
52
  }
53
53
  taro-button-core[type=default]:not([disabled]):active {
54
+ background-color: #dedede;
54
55
  color: rgba(0, 0, 0, 0.6);
55
- background-color: #DEDEDE;
56
56
  }
57
57
  taro-button-core[size=mini] {
58
- width: auto;
59
58
  display: inline-block;
60
59
  padding: 0 1.32em;
60
+ width: auto;
61
61
  line-height: 2.3;
62
62
  font-size: 13px;
63
63
  }
@@ -69,14 +69,14 @@ taro-button-core[disabled] {
69
69
  color: rgba(255, 255, 255, 0.6);
70
70
  }
71
71
  taro-button-core[disabled][type=default] {
72
+ background-color: #f7f7f7;
72
73
  color: rgba(0, 0, 0, 0.3);
73
- background-color: #F7F7F7;
74
74
  }
75
75
  taro-button-core[disabled][type=primary] {
76
- background-color: #9ED99D;
76
+ background-color: #9ed99d;
77
77
  }
78
78
  taro-button-core[disabled][type=warn] {
79
- background-color: #EC8B89;
79
+ background-color: #ec8b89;
80
80
  }
81
81
  taro-button-core[loading] .weui-loading {
82
82
  margin: -0.2em 0.34em 0 0;
@@ -85,64 +85,64 @@ taro-button-core[loading][type=primary], taro-button-core[loading][type=warn] {
85
85
  color: rgba(255, 255, 255, 0.6);
86
86
  }
87
87
  taro-button-core[loading][type=primary] {
88
- background-color: #179B16;
88
+ background-color: #179b16;
89
89
  }
90
90
  taro-button-core[loading][type=warn] {
91
- background-color: #CE3C39;
91
+ background-color: #ce3c39;
92
92
  }
93
93
  taro-button-core[plain][type=primary] {
94
- color: #1aad19;
95
94
  border: 1px solid #1aad19;
95
+ color: #1aad19;
96
96
  }
97
97
  taro-button-core[plain][type=primary]:not([disabled]):active {
98
- color: rgba(26, 173, 25, 0.6);
99
98
  border-color: rgba(26, 173, 25, 0.6);
100
99
  background-color: transparent;
100
+ color: rgba(26, 173, 25, 0.6);
101
101
  }
102
- taro-button-core[plain][type=primary]:after {
102
+ taro-button-core[plain][type=primary]::after {
103
103
  border-width: 0;
104
104
  }
105
105
  taro-button-core[plain], taro-button-core[plain][type=default] {
106
- color: #353535;
107
106
  border: 1px solid #353535;
107
+ color: #353535;
108
108
  }
109
109
  taro-button-core[plain]:not([disabled]):active, taro-button-core[plain][type=default]:not([disabled]):active {
110
- color: rgba(53, 53, 53, 0.6);
111
110
  border-color: rgba(53, 53, 53, 0.6);
112
111
  background-color: transparent;
112
+ color: rgba(53, 53, 53, 0.6);
113
113
  }
114
- taro-button-core[plain]:after, taro-button-core[plain][type=default]:after {
114
+ taro-button-core[plain]::after, taro-button-core[plain][type=default]::after {
115
115
  border-width: 0;
116
116
  }
117
117
  taro-button-core[type=primary] {
118
+ background-color: #1aad19;
118
119
  color: #fff;
119
- background-color: #1AAD19;
120
120
  }
121
121
  taro-button-core[type=primary]:not([disabled]):visited {
122
- color: #FFFFFF;
122
+ color: #fff;
123
123
  }
124
124
  taro-button-core[type=primary]:not([disabled]):active {
125
+ background-color: #179b16;
125
126
  color: rgba(255, 255, 255, 0.6);
126
- background-color: #179B16;
127
127
  }
128
128
  taro-button-core[type=warn] {
129
+ background-color: #e64340;
129
130
  color: #fff;
130
- background-color: #E64340;
131
131
  }
132
132
  taro-button-core[type=warn]:not([disabled]):visited {
133
- color: #FFFFFF;
133
+ color: #fff;
134
134
  }
135
135
  taro-button-core[type=warn]:not([disabled]):active {
136
+ background-color: #ce3c39;
136
137
  color: rgba(255, 255, 255, 0.6);
137
- background-color: #CE3C39;
138
138
  }
139
139
  taro-button-core[plain][disabled] {
140
- color: rgba(0, 0, 0, 0.3);
141
140
  border: 1px solid rgba(0, 0, 0, 0.2);
142
- background-color: #F7F7F7;
141
+ background-color: #f7f7f7;
142
+ color: rgba(0, 0, 0, 0.3);
143
143
  }
144
144
  taro-button-core[plain][disabled][type=primary] {
145
- color: rgba(0, 0, 0, 0.3);
146
145
  border: 1px solid rgba(0, 0, 0, 0.2);
147
- background-color: #F7F7F7;
146
+ background-color: #f7f7f7;
147
+ color: rgba(0, 0, 0, 0.3);
148
148
  }
@@ -25,7 +25,7 @@ export class Canvas {
25
25
  }
26
26
  static get is() { return "taro-canvas-core"; }
27
27
  static get originalStyleUrls() { return {
28
- "$": ["./style/index.css"]
28
+ "$": ["./style/index.scss"]
29
29
  }; }
30
30
  static get styleUrls() { return {
31
31
  "$": ["./style/index.css"]
@@ -1,6 +1,6 @@
1
- taro-canvas-core {
2
- position: relative;
3
- display: block;
4
- width: 300px;
5
- height: 150px;
6
- }
1
+ taro-canvas-core {
2
+ display: block;
3
+ position: relative;
4
+ width: 300px;
5
+ height: 150px;
6
+ }
@@ -1,41 +1,40 @@
1
1
  @charset "UTF-8";
2
2
  .taro-checkbox {
3
- position: relative;
4
3
  display: inline-block;
4
+ position: relative;
5
5
  }
6
6
  .taro-checkbox_checked {
7
7
  display: inline-block;
8
- min-height: 0;
9
- -webkit-appearance: none;
10
- appearance: none;
11
- outline: 0;
12
- font-size: 23px;
8
+ position: relative;
9
+ top: 5px;
13
10
  border: 1px solid #d1d1d1;
14
- background-color: #ffffff;
15
11
  border-radius: 3px;
16
- color: #1AAD19;
17
12
  width: 23px;
18
13
  height: 23px;
19
- position: relative;
14
+ min-height: 0;
15
+ appearance: none;
16
+ outline: 0;
17
+ background-color: #fff;
20
18
  vertical-align: 0;
21
- top: 5px;
19
+ font-size: 23px;
20
+ color: #1aad19;
22
21
  }
23
22
  .taro-checkbox_checked:checked::before {
24
- font-family: "weui";
25
- font-style: normal;
26
- font-weight: normal;
27
- font-variant: normal;
28
- text-transform: none;
29
- text-align: center;
30
- speak: none;
31
23
  display: inline-block;
24
+ position: absolute;
25
+ left: 50%;
26
+ top: 50%;
32
27
  vertical-align: middle;
33
28
  text-decoration: inherit;
34
- content: "";
35
- color: inherit;
29
+ text-align: center;
30
+ text-transform: none;
31
+ font-family: weui;
32
+ font-style: normal;
33
+ font-weight: normal;
34
+ font-variant: normal;
36
35
  font-size: inherit;
37
- position: absolute;
38
- top: 50%;
39
- left: 50%;
36
+ color: inherit;
37
+ content: "";
40
38
  transform: translate(-50%, -48%) scale(0.73);
39
+ speak: none;
41
40
  }
@@ -6,9 +6,9 @@ taro-image-core {
6
6
  display: inline-block;
7
7
  overflow: hidden;
8
8
  position: relative;
9
- font-size: 0;
10
9
  width: auto;
11
10
  height: auto;
11
+ font-size: 0;
12
12
  }
13
13
 
14
14
  .taro-img.taro-img__widthfix {
@@ -24,8 +24,8 @@ taro-image-core {
24
24
  }
25
25
  .taro-img__mode-aspectfill {
26
26
  position: absolute;
27
- top: 50%;
28
27
  left: 50%;
28
+ top: 50%;
29
29
  transform: translate(-50%, -50%);
30
30
  }
31
31
  .taro-img__mode-aspectfill--width {
@@ -46,17 +46,17 @@ taro-image-core {
46
46
  width: 100%;
47
47
  }
48
48
  .taro-img__mode-bottom {
49
- width: 100%;
50
49
  position: absolute;
51
50
  bottom: 0;
51
+ width: 100%;
52
52
  }
53
53
  .taro-img__mode-left {
54
54
  height: 100%;
55
55
  }
56
56
  .taro-img__mode-right {
57
57
  position: absolute;
58
- height: 100%;
59
58
  right: 0;
59
+ height: 100%;
60
60
  }
61
61
  .taro-img__mode-topright {
62
62
  position: absolute;
@@ -4,9 +4,9 @@ taro-input-core {
4
4
 
5
5
  input {
6
6
  display: block;
7
+ overflow: hidden;
7
8
  height: 1.4rem;
8
- text-align: inherit;
9
9
  text-overflow: clip;
10
- overflow: hidden;
10
+ text-align: inherit;
11
11
  white-space: nowrap;
12
12
  }
@@ -79,10 +79,10 @@ export class Navigator {
79
79
  }
80
80
  static get is() { return "taro-navigator-core"; }
81
81
  static get originalStyleUrls() { return {
82
- "$": ["navigator.css"]
82
+ "$": ["./style/index.scss"]
83
83
  }; }
84
84
  static get styleUrls() { return {
85
- "$": ["navigator.css"]
85
+ "$": ["./style/index.css"]
86
86
  }; }
87
87
  static get properties() { return {
88
88
  "hoverClass": {
@@ -1,3 +1,3 @@
1
- .navigator-hover {
2
- background: #efefef;
3
- }
1
+ .navigator-hover {
2
+ background: #efefef;
3
+ }
@@ -1,3 +1,4 @@
1
- .weui-picker, .weui-picker__hd {
1
+ .weui-picker,
2
+ .weui-picker__hd {
2
3
  font-size: 12px;
3
4
  }
@@ -1,11 +1,225 @@
1
1
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
- import { Component, h, Host } from '@stencil/core';
2
+ import { Component, h, Host, Listen, Element, Event, Prop, State } from '@stencil/core';
3
+ import { debounce } from '../../utils';
3
4
  export class PickerViewColumn {
4
- componentDidLoad() {
5
- console.error('H5 暂不支持 PickerViewColumn 组件!');
5
+ constructor() {
6
+ // 初始化的选中位置
7
+ this.initialPosition = '0';
8
+ // 滑动距离上下留白区域-通过父视图和 indicator 计算而来
9
+ this.paddingVertical = 0;
10
+ this.isInit = false;
11
+ this.isMove = false;
12
+ // 滚动结束自动回到合适的位置
13
+ this.handleSelected = debounce(() => {
14
+ const childList = this.el.childNodes;
15
+ let sum = 0;
16
+ let selectedIndex = '0';
17
+ for (const index in childList) {
18
+ const item = childList[index];
19
+ const itemHeight = item.offsetHeight;
20
+ if (sum + itemHeight / 2.0 > this.el.scrollTop) {
21
+ selectedIndex = index;
22
+ break;
23
+ }
24
+ sum += itemHeight;
25
+ }
26
+ this.el.scrollTo({
27
+ top: sum,
28
+ behavior: 'smooth'
29
+ });
30
+ this.onChange.emit({
31
+ curIndex: this.col,
32
+ selectedIndex: selectedIndex
33
+ });
34
+ this.onSelectEnd.emit();
35
+ }, 500);
36
+ }
37
+ onScroll(_event) {
38
+ if (!this.isMove) {
39
+ this.isMove = true;
40
+ this.onSelectStart.emit();
41
+ }
42
+ this.handleSelected();
43
+ }
44
+ onMouseEnd() {
45
+ if (!this.isMove)
46
+ return;
47
+ this.isMove = false;
48
+ this.handleSelected();
49
+ }
50
+ onTouchEnd() {
51
+ this.isMove = false;
52
+ this.handleSelected();
53
+ }
54
+ componentDidUpdate() {
55
+ if (!this.isInit) {
56
+ this.isInit = true;
57
+ const childList = this.el.childNodes;
58
+ let idx = 0;
59
+ let sum = 0;
60
+ for (const index in childList) {
61
+ const item = childList[index];
62
+ if (this.initialPosition === index || !item || typeof item.offsetHeight !== 'number') {
63
+ break;
64
+ }
65
+ sum += item.offsetHeight;
66
+ idx++;
67
+ }
68
+ this.el.scrollTo({ top: sum });
69
+ if (idx >= childList.length) {
70
+ this.onChange.emit({
71
+ curIndex: this.col,
72
+ selectedIndex: idx - 1
73
+ });
74
+ }
75
+ }
6
76
  }
7
77
  render() {
8
- return (h(Host, null));
78
+ const { paddingVertical = 0 } = this;
79
+ return (h(Host, { class: "taro-picker-view-column-container", style: { 'padding-top': `${paddingVertical}px`, 'padding-bottom': `${paddingVertical}px` } }));
9
80
  }
10
81
  static get is() { return "taro-picker-view-column-core"; }
82
+ static get originalStyleUrls() { return {
83
+ "$": ["./style/column.scss"]
84
+ }; }
85
+ static get styleUrls() { return {
86
+ "$": ["./style/column.css"]
87
+ }; }
88
+ static get properties() { return {
89
+ "col": {
90
+ "type": "string",
91
+ "mutable": false,
92
+ "complexType": {
93
+ "original": "string",
94
+ "resolved": "string",
95
+ "references": {}
96
+ },
97
+ "required": false,
98
+ "optional": false,
99
+ "docs": {
100
+ "tags": [],
101
+ "text": ""
102
+ },
103
+ "attribute": "col",
104
+ "reflect": false
105
+ },
106
+ "initialPosition": {
107
+ "type": "string",
108
+ "mutable": false,
109
+ "complexType": {
110
+ "original": "string",
111
+ "resolved": "string",
112
+ "references": {}
113
+ },
114
+ "required": false,
115
+ "optional": false,
116
+ "docs": {
117
+ "tags": [],
118
+ "text": ""
119
+ },
120
+ "attribute": "initial-position",
121
+ "reflect": false,
122
+ "defaultValue": "'0'"
123
+ },
124
+ "paddingVertical": {
125
+ "type": "number",
126
+ "mutable": false,
127
+ "complexType": {
128
+ "original": "number",
129
+ "resolved": "number",
130
+ "references": {}
131
+ },
132
+ "required": false,
133
+ "optional": false,
134
+ "docs": {
135
+ "tags": [],
136
+ "text": ""
137
+ },
138
+ "attribute": "padding-vertical",
139
+ "reflect": false,
140
+ "defaultValue": "0"
141
+ }
142
+ }; }
143
+ static get states() { return {
144
+ "isInit": {},
145
+ "isMove": {}
146
+ }; }
147
+ static get events() { return [{
148
+ "method": "onChange",
149
+ "name": "onselect",
150
+ "bubbles": true,
151
+ "cancelable": true,
152
+ "composed": true,
153
+ "docs": {
154
+ "tags": [],
155
+ "text": ""
156
+ },
157
+ "complexType": {
158
+ "original": "any",
159
+ "resolved": "any",
160
+ "references": {}
161
+ }
162
+ }, {
163
+ "method": "onSelectStart",
164
+ "name": "onselectstart",
165
+ "bubbles": true,
166
+ "cancelable": true,
167
+ "composed": true,
168
+ "docs": {
169
+ "tags": [],
170
+ "text": ""
171
+ },
172
+ "complexType": {
173
+ "original": "any",
174
+ "resolved": "any",
175
+ "references": {}
176
+ }
177
+ }, {
178
+ "method": "onSelectEnd",
179
+ "name": "onselectend",
180
+ "bubbles": true,
181
+ "cancelable": true,
182
+ "composed": true,
183
+ "docs": {
184
+ "tags": [],
185
+ "text": ""
186
+ },
187
+ "complexType": {
188
+ "original": "any",
189
+ "resolved": "any",
190
+ "references": {}
191
+ }
192
+ }]; }
193
+ static get elementRef() { return "el"; }
194
+ static get listeners() { return [{
195
+ "name": "scroll",
196
+ "method": "onScroll",
197
+ "target": undefined,
198
+ "capture": false,
199
+ "passive": true
200
+ }, {
201
+ "name": "mouseup",
202
+ "method": "onMouseEnd",
203
+ "target": undefined,
204
+ "capture": false,
205
+ "passive": true
206
+ }, {
207
+ "name": "mouseout",
208
+ "method": "onMouseEnd",
209
+ "target": undefined,
210
+ "capture": false,
211
+ "passive": true
212
+ }, {
213
+ "name": "mouseleave",
214
+ "method": "onMouseEnd",
215
+ "target": undefined,
216
+ "capture": false,
217
+ "passive": true
218
+ }, {
219
+ "name": "touchend",
220
+ "method": "onTouchEnd",
221
+ "target": undefined,
222
+ "capture": false,
223
+ "passive": true
224
+ }]; }
11
225
  }