@tarojs/components 3.4.4 → 3.4.7
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/cjs/index-bf151ad6.js +13 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/taro-button-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-canvas-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-checkbox-core_2.cjs.entry.js +1 -1
- package/dist/cjs/taro-components.cjs.js +1 -1
- package/dist/cjs/taro-image-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-input-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-navigator-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-picker-view-column-core.cjs.entry.js +79 -3
- package/dist/cjs/taro-picker-view-core.cjs.entry.js +71 -2
- package/dist/cjs/taro-pull-to-refresh.cjs.entry.js +1 -1
- package/dist/cjs/taro-scroll-view-core.cjs.entry.js +5 -13
- package/dist/cjs/taro-swiper-core_2.cjs.entry.js +5 -13
- package/dist/cjs/taro-tabbar.cjs.entry.js +23 -23
- package/dist/cjs/taro-text-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-textarea-core.cjs.entry.js +4 -2
- package/dist/cjs/taro-video-control_3.cjs.entry.js +1 -1
- package/dist/cjs/taro-view-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-web-view-core.cjs.entry.js +1 -1
- package/dist/collection/components/button/style/index.css +49 -49
- package/dist/collection/components/canvas/canvas.js +1 -1
- package/dist/collection/components/canvas/style/index.css +6 -6
- package/dist/collection/components/checkbox/style/index.css +21 -22
- package/dist/collection/components/image/image.js +1 -1
- package/dist/collection/components/image/style/index.css +7 -4
- package/dist/collection/components/input/index.css +2 -2
- package/dist/collection/components/navigator/navigator.js +2 -2
- package/dist/collection/components/navigator/{navigator.css → style/index.css} +3 -3
- package/dist/collection/components/picker/style/index.css +2 -1
- package/dist/collection/components/picker-view/picker-view-column.js +218 -4
- package/dist/collection/components/picker-view/picker-view.js +217 -3
- package/dist/collection/components/picker-view/style/column.css +12 -0
- package/dist/collection/components/picker-view/style/index.css +28 -0
- package/dist/collection/components/pull-to-refresh/pull-to-refresh.js +1 -1
- package/dist/collection/components/pull-to-refresh/style/index.css +53 -50
- package/dist/collection/components/scroll-view/scroll-view.js +3 -11
- package/dist/collection/components/swiper/swiper.js +2 -10
- package/dist/collection/components/tabbar/style/index.css +7 -6
- package/dist/collection/components/text/style/index.css +0 -6
- package/dist/collection/components/textarea/style/index.css +5 -5
- package/dist/collection/components/textarea/textarea.js +3 -1
- package/dist/collection/components/video/style/index.css +89 -109
- package/dist/collection/components/view/style/index.css +3 -5
- package/dist/collection/components/web-view/style/index.css +1 -1
- package/dist/collection/utils/index.js +13 -73
- package/dist/collection/utils/style.js +10 -0
- package/dist/collection/utils/url.js +67 -0
- package/dist/esm/index-c58e5e14.js +11 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/taro-button-core.entry.js +1 -1
- package/dist/esm/taro-canvas-core.entry.js +1 -1
- package/dist/esm/taro-checkbox-core_2.entry.js +1 -1
- package/dist/esm/taro-components.js +1 -1
- package/dist/esm/taro-image-core.entry.js +1 -1
- package/dist/esm/taro-input-core.entry.js +1 -1
- package/dist/esm/taro-navigator-core.entry.js +2 -2
- package/dist/esm/taro-picker-view-column-core.entry.js +80 -4
- package/dist/esm/taro-picker-view-core.entry.js +72 -3
- package/dist/esm/taro-pull-to-refresh.entry.js +1 -1
- package/dist/esm/taro-scroll-view-core.entry.js +3 -11
- package/dist/esm/taro-swiper-core_2.entry.js +1 -9
- package/dist/esm/taro-tabbar.entry.js +23 -23
- package/dist/esm/taro-text-core.entry.js +1 -1
- package/dist/esm/taro-textarea-core.entry.js +4 -2
- package/dist/esm/taro-video-control_3.entry.js +1 -1
- package/dist/esm/taro-view-core.entry.js +1 -1
- package/dist/esm/taro-web-view-core.entry.js +1 -1
- package/dist/esm-es5/index-c58e5e14.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/taro-button-core.entry.js +1 -1
- package/dist/esm-es5/taro-canvas-core.entry.js +1 -1
- package/dist/esm-es5/taro-checkbox-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-components.js +1 -1
- package/dist/esm-es5/taro-image-core.entry.js +1 -1
- package/dist/esm-es5/taro-input-core.entry.js +1 -1
- package/dist/esm-es5/taro-navigator-core.entry.js +1 -1
- package/dist/esm-es5/taro-picker-view-column-core.entry.js +1 -1
- package/dist/esm-es5/taro-picker-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-pull-to-refresh.entry.js +1 -1
- package/dist/esm-es5/taro-scroll-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-tabbar.entry.js +1 -1
- package/dist/esm-es5/taro-text-core.entry.js +1 -1
- package/dist/esm-es5/taro-textarea-core.entry.js +1 -1
- package/dist/esm-es5/taro-video-control_3.entry.js +1 -1
- package/dist/esm-es5/taro-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-web-view-core.entry.js +1 -1
- package/dist/taro-components/{p-4dbed323.entry.js → p-07062966.entry.js} +1 -1
- package/dist/taro-components/p-092d81b8.system.entry.js +1 -0
- package/dist/taro-components/{p-9fc88fc1.system.entry.js → p-0c18bd18.system.entry.js} +1 -1
- package/dist/taro-components/{p-5ae86835.system.entry.js → p-15b51e54.system.entry.js} +1 -1
- package/dist/taro-components/{p-17cf8b5b.entry.js → p-1b48afb1.entry.js} +1 -1
- package/dist/taro-components/p-1c625d7d.entry.js +1 -0
- package/dist/taro-components/p-2c05106f.system.entry.js +1 -0
- package/dist/taro-components/p-33ee636a.system.js +1 -1
- package/dist/taro-components/p-34188530.system.entry.js +1 -0
- package/dist/taro-components/{p-71e14298.entry.js → p-4039bcb5.entry.js} +1 -1
- package/dist/taro-components/p-4aa4de0f.system.entry.js +1 -0
- package/dist/taro-components/{p-50066d5e.system.entry.js → p-4cd044c4.system.entry.js} +1 -1
- package/dist/taro-components/{p-2b0d5c90.system.entry.js → p-58623cdd.system.entry.js} +1 -1
- package/dist/taro-components/p-5c6aeb55.entry.js +1 -0
- package/dist/taro-components/{p-9eb7dfa8.entry.js → p-5d5baadf.entry.js} +1 -1
- package/dist/taro-components/p-724abeb7.js +1 -0
- package/dist/taro-components/{p-d567b95e.entry.js → p-758fb1ba.entry.js} +1 -1
- package/dist/taro-components/p-7fdd59f0.entry.js +1 -0
- package/dist/taro-components/{p-fd8312e5.system.entry.js → p-8e0150eb.system.entry.js} +1 -1
- package/dist/taro-components/p-9086b901.system.entry.js +1 -0
- package/dist/taro-components/p-92a31933.system.entry.js +1 -0
- package/dist/taro-components/p-93fe9ea6.system.entry.js +1 -0
- package/dist/taro-components/p-a05d66d1.system.entry.js +1 -0
- package/dist/taro-components/p-b246a0d1.entry.js +1 -0
- package/dist/taro-components/p-c5a86c19.system.entry.js +1 -0
- package/dist/taro-components/{p-8bc82aaa.entry.js → p-d0c608a8.entry.js} +1 -1
- package/dist/taro-components/p-d2be4eb3.entry.js +1 -0
- package/dist/taro-components/p-d8862a47.entry.js +1 -0
- package/dist/taro-components/p-d91ab597.system.entry.js +1 -0
- package/dist/taro-components/{p-fe156231.system.entry.js → p-da8edf69.system.entry.js} +1 -1
- package/dist/taro-components/p-e12cb218.entry.js +1 -0
- package/dist/taro-components/p-e35230e0.entry.js +1 -0
- package/dist/taro-components/p-f05cac3f.entry.js +1 -0
- package/dist/taro-components/{p-4e54216b.entry.js → p-f5fe8711.entry.js} +1 -1
- package/dist/taro-components/p-f885783f.system.js +1 -0
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/types/components/image/image.d.ts +1 -1
- package/dist/types/components/picker-view/picker-view-column.d.ts +15 -1
- package/dist/types/components/picker-view/picker-view.d.ts +24 -0
- package/dist/types/components/scroll-view/scroll-view.d.ts +1 -1
- package/dist/types/components.d.ts +22 -0
- package/dist/types/utils/index.d.ts +4 -8
- package/dist/types/utils/style.d.ts +1 -0
- package/dist/types/utils/url.d.ts +6 -0
- package/dist-h5/react/components/input.js +2 -2
- package/dist-h5/react/utils/reactify-wc.js +2 -2
- package/dist-h5/vue/components/picker.js +2 -2
- package/dist-h5/vue/components/scroll-view.js +2 -2
- package/dist-h5/vue/createFormsComponent.js +2 -2
- package/dist-h5/vue/mixins/listeners.js +2 -2
- package/dist-h5/vue3/components/icon.js +3 -0
- package/dist-h5/vue3/components/image.js +3 -0
- package/dist-h5/vue3/components/scroll-view.js +3 -0
- package/dist-h5/vue3/components/text.js +3 -0
- package/dist-h5/vue3/createComponent.js +3 -0
- package/dist-h5/vue3/createFormsComponent.js +5 -2
- package/dist-h5/vue3/forwardRef.js +11 -0
- package/dist-h5/vue3/index.js +41 -5
- package/package.json +3 -3
- package/types/Button.d.ts +24 -26
- package/types/Input.d.ts +23 -19
- package/types/KeyboardAccessory.d.ts +19 -7
- package/types/Picker.d.ts +3 -3
- package/types/PickerViewColumn.d.ts +2 -2
- package/types/ShareElement.d.ts +193 -0
- package/types/common.d.ts +1 -1
- package/types/index.vue3.d.ts +159 -0
- package/virtual-list/react/createListComponent.js +2 -2
- package/dist/taro-components/p-2dc57c71.system.entry.js +0 -1
- package/dist/taro-components/p-32937866.entry.js +0 -1
- package/dist/taro-components/p-431197bc.entry.js +0 -1
- package/dist/taro-components/p-43de2f12.system.entry.js +0 -1
- package/dist/taro-components/p-5c420456.entry.js +0 -1
- package/dist/taro-components/p-63ff7fa7.entry.js +0 -1
- package/dist/taro-components/p-6de12779.entry.js +0 -1
- package/dist/taro-components/p-83dedaa2.entry.js +0 -1
- package/dist/taro-components/p-8486c251.system.entry.js +0 -1
- package/dist/taro-components/p-95529dc0.entry.js +0 -1
- package/dist/taro-components/p-b15d0302.system.entry.js +0 -1
- package/dist/taro-components/p-cc818a13.entry.js +0 -1
- package/dist/taro-components/p-d394a61f.system.entry.js +0 -1
- package/dist/taro-components/p-d5971476.entry.js +0 -1
- package/dist/taro-components/p-e0af1d0d.system.entry.js +0 -1
- package/dist/taro-components/p-fb2252b7.system.entry.js +0 -1
- package/dist/taro-components/p-fcc1c676.system.entry.js +0 -1
- package/dist/taro-components/p-fd0d1168.system.entry.js +0 -1
- package/dist/taro-components/p-fde3a009.system.entry.js +0 -1
|
@@ -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
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -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, Element, Prop, Event, Listen } from '@stencil/core';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { convertStyle } from '../../utils';
|
|
3
5
|
export class PickerView {
|
|
6
|
+
onSelect(e) {
|
|
7
|
+
e.stopPropagation();
|
|
8
|
+
if (e.target.tagName !== 'TARO-PICKER-VIEW-COLUMN-CORE')
|
|
9
|
+
return;
|
|
10
|
+
let _curIndex = +e.detail.curIndex;
|
|
11
|
+
let _selectedIndex = +e.detail.selectedIndex;
|
|
12
|
+
this.value[_curIndex] = _selectedIndex;
|
|
13
|
+
this.onChange.emit({ value: this.value });
|
|
14
|
+
}
|
|
15
|
+
onSelectStart(e) {
|
|
16
|
+
e.stopPropagation();
|
|
17
|
+
if (e.target.tagName !== 'TARO-PICKER-VIEW-COLUMN-CORE')
|
|
18
|
+
return;
|
|
19
|
+
this.onPickStart.emit();
|
|
20
|
+
}
|
|
21
|
+
onPickerColEnd(e) {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
if (e.target.tagName !== 'TARO-PICKER-VIEW-COLUMN-CORE')
|
|
24
|
+
return;
|
|
25
|
+
this.onPickEnd.emit();
|
|
26
|
+
}
|
|
4
27
|
componentDidLoad() {
|
|
5
|
-
|
|
28
|
+
const childList = this.el.querySelectorAll('taro-picker-view-column-core');
|
|
29
|
+
childList.forEach((element, index) => {
|
|
30
|
+
var _a;
|
|
31
|
+
element.setAttribute('col', `${index}`);
|
|
32
|
+
let selectIndex = '0';
|
|
33
|
+
if (!!this.value && this.value.length > index) {
|
|
34
|
+
selectIndex = `${this.value[index]}`;
|
|
35
|
+
}
|
|
36
|
+
const pickerHeight = this.el.getBoundingClientRect().height;
|
|
37
|
+
const indicatorHeight = ((_a = this.indicator) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0;
|
|
38
|
+
const paddingVertical = (pickerHeight - indicatorHeight) / 2.0;
|
|
39
|
+
element.setAttribute('initial-position', `${selectIndex}`);
|
|
40
|
+
element.setAttribute('padding-vertical', `${paddingVertical}`);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// 过滤非 PickerViewColumn 组件
|
|
44
|
+
componentDidRender() {
|
|
45
|
+
this.el.childNodes.forEach(item => {
|
|
46
|
+
const childEle = item;
|
|
47
|
+
if ('TARO-PICKER-VIEW-COLUMN-CORE' !== childEle.tagName &&
|
|
48
|
+
childEle.className !== 'taro-picker-view-mask-container') {
|
|
49
|
+
this.el.removeChild(item);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
6
52
|
}
|
|
7
53
|
render() {
|
|
8
|
-
|
|
54
|
+
const indicatorCls = classNames('taro-picker-view-mask-indicator', this.indicatorClass);
|
|
55
|
+
const maskTopCls = classNames('taro-picker-view-mask-top', this.maskClass);
|
|
56
|
+
const maskBtmCls = classNames('taro-picker-view-mask-bottom', this.maskClass);
|
|
57
|
+
const indicatorStyle = convertStyle(this.indicatorStyle);
|
|
58
|
+
const maskTopStyle = convertStyle(this.maskStyle);
|
|
59
|
+
const maskBottomStyle = convertStyle(this.maskStyle);
|
|
60
|
+
return (h(Host, { class: "taro-picker-view-container" },
|
|
61
|
+
h("slot", null),
|
|
62
|
+
h("div", { class: "taro-picker-view-mask-container" },
|
|
63
|
+
h("div", { class: maskTopCls, style: maskTopStyle }),
|
|
64
|
+
h("div", { class: indicatorCls, style: indicatorStyle, ref: indicator => (this.indicator = indicator) }),
|
|
65
|
+
h("div", { class: maskBtmCls, style: maskBottomStyle }))));
|
|
9
66
|
}
|
|
10
67
|
static get is() { return "taro-picker-view-core"; }
|
|
68
|
+
static get originalStyleUrls() { return {
|
|
69
|
+
"$": ["./style/index.scss"]
|
|
70
|
+
}; }
|
|
71
|
+
static get styleUrls() { return {
|
|
72
|
+
"$": ["./style/index.css"]
|
|
73
|
+
}; }
|
|
74
|
+
static get properties() { return {
|
|
75
|
+
"indicatorStyle": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"mutable": false,
|
|
78
|
+
"complexType": {
|
|
79
|
+
"original": "string",
|
|
80
|
+
"resolved": "string",
|
|
81
|
+
"references": {}
|
|
82
|
+
},
|
|
83
|
+
"required": false,
|
|
84
|
+
"optional": false,
|
|
85
|
+
"docs": {
|
|
86
|
+
"tags": [],
|
|
87
|
+
"text": ""
|
|
88
|
+
},
|
|
89
|
+
"attribute": "indicator-style",
|
|
90
|
+
"reflect": false
|
|
91
|
+
},
|
|
92
|
+
"indicatorClass": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"mutable": false,
|
|
95
|
+
"complexType": {
|
|
96
|
+
"original": "string",
|
|
97
|
+
"resolved": "string",
|
|
98
|
+
"references": {}
|
|
99
|
+
},
|
|
100
|
+
"required": false,
|
|
101
|
+
"optional": false,
|
|
102
|
+
"docs": {
|
|
103
|
+
"tags": [],
|
|
104
|
+
"text": ""
|
|
105
|
+
},
|
|
106
|
+
"attribute": "indicator-class",
|
|
107
|
+
"reflect": false
|
|
108
|
+
},
|
|
109
|
+
"value": {
|
|
110
|
+
"type": "unknown",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "number[]",
|
|
114
|
+
"resolved": "number[]",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": ""
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"maskStyle": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"mutable": false,
|
|
127
|
+
"complexType": {
|
|
128
|
+
"original": "string",
|
|
129
|
+
"resolved": "string",
|
|
130
|
+
"references": {}
|
|
131
|
+
},
|
|
132
|
+
"required": false,
|
|
133
|
+
"optional": false,
|
|
134
|
+
"docs": {
|
|
135
|
+
"tags": [],
|
|
136
|
+
"text": ""
|
|
137
|
+
},
|
|
138
|
+
"attribute": "mask-style",
|
|
139
|
+
"reflect": false
|
|
140
|
+
},
|
|
141
|
+
"maskClass": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"mutable": false,
|
|
144
|
+
"complexType": {
|
|
145
|
+
"original": "string",
|
|
146
|
+
"resolved": "string",
|
|
147
|
+
"references": {}
|
|
148
|
+
},
|
|
149
|
+
"required": false,
|
|
150
|
+
"optional": false,
|
|
151
|
+
"docs": {
|
|
152
|
+
"tags": [],
|
|
153
|
+
"text": ""
|
|
154
|
+
},
|
|
155
|
+
"attribute": "mask-class",
|
|
156
|
+
"reflect": false
|
|
157
|
+
}
|
|
158
|
+
}; }
|
|
159
|
+
static get events() { return [{
|
|
160
|
+
"method": "onChange",
|
|
161
|
+
"name": "change",
|
|
162
|
+
"bubbles": true,
|
|
163
|
+
"cancelable": true,
|
|
164
|
+
"composed": true,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": ""
|
|
168
|
+
},
|
|
169
|
+
"complexType": {
|
|
170
|
+
"original": "any",
|
|
171
|
+
"resolved": "any",
|
|
172
|
+
"references": {}
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
"method": "onPickStart",
|
|
176
|
+
"name": "pickstart",
|
|
177
|
+
"bubbles": true,
|
|
178
|
+
"cancelable": true,
|
|
179
|
+
"composed": true,
|
|
180
|
+
"docs": {
|
|
181
|
+
"tags": [],
|
|
182
|
+
"text": ""
|
|
183
|
+
},
|
|
184
|
+
"complexType": {
|
|
185
|
+
"original": "any",
|
|
186
|
+
"resolved": "any",
|
|
187
|
+
"references": {}
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
"method": "onPickEnd",
|
|
191
|
+
"name": "pickend",
|
|
192
|
+
"bubbles": true,
|
|
193
|
+
"cancelable": true,
|
|
194
|
+
"composed": true,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": ""
|
|
198
|
+
},
|
|
199
|
+
"complexType": {
|
|
200
|
+
"original": "any",
|
|
201
|
+
"resolved": "any",
|
|
202
|
+
"references": {}
|
|
203
|
+
}
|
|
204
|
+
}]; }
|
|
205
|
+
static get elementRef() { return "el"; }
|
|
206
|
+
static get listeners() { return [{
|
|
207
|
+
"name": "onselect",
|
|
208
|
+
"method": "onSelect",
|
|
209
|
+
"target": undefined,
|
|
210
|
+
"capture": false,
|
|
211
|
+
"passive": false
|
|
212
|
+
}, {
|
|
213
|
+
"name": "onselectstart",
|
|
214
|
+
"method": "onSelectStart",
|
|
215
|
+
"target": undefined,
|
|
216
|
+
"capture": false,
|
|
217
|
+
"passive": false
|
|
218
|
+
}, {
|
|
219
|
+
"name": "onselectend",
|
|
220
|
+
"method": "onPickerColEnd",
|
|
221
|
+
"target": undefined,
|
|
222
|
+
"capture": false,
|
|
223
|
+
"passive": false
|
|
224
|
+
}]; }
|
|
11
225
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.taro-picker-view-column-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
overflow: scroll;
|
|
4
|
+
overflow-x: hidden;
|
|
5
|
+
position: relative;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
flex: 1;
|
|
8
|
+
text-align: center;
|
|
9
|
+
}
|
|
10
|
+
.taro-picker-view-column-container::-webkit-scrollbar {
|
|
11
|
+
display: none;
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.taro-picker-view-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
.taro-picker-view-mask-container {
|
|
6
|
+
display: flex;
|
|
7
|
+
position: absolute;
|
|
8
|
+
left: 0;
|
|
9
|
+
right: 0;
|
|
10
|
+
top: 0;
|
|
11
|
+
bottom: 0;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
}
|
|
15
|
+
.taro-picker-view-mask-indicator {
|
|
16
|
+
display: flex;
|
|
17
|
+
border-top: 1px solid #ddd;
|
|
18
|
+
border-bottom: 1px solid #ddd;
|
|
19
|
+
height: 50px;
|
|
20
|
+
}
|
|
21
|
+
.taro-picker-view-mask-top {
|
|
22
|
+
flex: 1;
|
|
23
|
+
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6));
|
|
24
|
+
}
|
|
25
|
+
.taro-picker-view-mask-bottom {
|
|
26
|
+
flex: 1;
|
|
27
|
+
background: linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6));
|
|
28
|
+
}
|
|
@@ -246,7 +246,7 @@ export class PullToRefresh {
|
|
|
246
246
|
}
|
|
247
247
|
static get is() { return "taro-pull-to-refresh"; }
|
|
248
248
|
static get originalStyleUrls() { return {
|
|
249
|
-
"$": ["./style/index.
|
|
249
|
+
"$": ["./style/index.scss"]
|
|
250
250
|
}; }
|
|
251
251
|
static get styleUrls() { return {
|
|
252
252
|
"$": ["./style/index.css"]
|
|
@@ -1,50 +1,53 @@
|
|
|
1
|
-
.rmc-pull-to-refresh-content {
|
|
2
|
-
transform-origin: left top
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@keyframes rmc-pull-to-refresh-indicator {
|
|
15
|
-
50% {
|
|
16
|
-
opacity: 0.2;
|
|
17
|
-
}
|
|
18
|
-
100% {
|
|
19
|
-
opacity: 1;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
animation-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.rmc-pull-to-refresh-indicator > div:nth-child(0) {
|
|
40
|
-
animation-delay: -0.1s !important;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
.rmc-pull-to-refresh-content {
|
|
2
|
+
transform-origin: left top 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.rmc-pull-to-refresh-content-wrapper {
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
min-height: 100vh;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.rmc-pull-to-refresh-transition {
|
|
11
|
+
transition: transform 0.3s;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@keyframes rmc-pull-to-refresh-indicator {
|
|
15
|
+
50% {
|
|
16
|
+
opacity: 0.2;
|
|
17
|
+
}
|
|
18
|
+
100% {
|
|
19
|
+
opacity: 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.rmc-pull-to-refresh-indicator {
|
|
23
|
+
height: 30px;
|
|
24
|
+
line-height: 10px;
|
|
25
|
+
text-align: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.rmc-pull-to-refresh-indicator > div {
|
|
29
|
+
display: inline-block;
|
|
30
|
+
margin: 3px;
|
|
31
|
+
border-radius: 100%;
|
|
32
|
+
width: 6px;
|
|
33
|
+
height: 6px;
|
|
34
|
+
background-color: grey;
|
|
35
|
+
animation: rmc-pull-to-refresh-indicator 0.5s 0s infinite linear;
|
|
36
|
+
animation-fill-mode: both;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.rmc-pull-to-refresh-indicator > div:nth-child(0) {
|
|
40
|
+
animation-delay: -0.1s !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.rmc-pull-to-refresh-indicator > div:nth-child(1) {
|
|
44
|
+
animation-delay: -0.2s !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.rmc-pull-to-refresh-indicator > div:nth-child(2) {
|
|
48
|
+
animation-delay: -0.3s !important;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.rmc-pull-to-refresh-down .rmc-pull-to-refresh-indicator {
|
|
52
|
+
margin-top: -25px;
|
|
53
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import { Component, h, Prop, Event, Watch, Element, Host } from '@stencil/core';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import { debounce } from '../../utils';
|
|
4
5
|
function easeOutScroll(from, to, callback) {
|
|
5
6
|
if (from === to || typeof from !== 'number') {
|
|
6
7
|
return;
|
|
@@ -23,15 +24,6 @@ function easeOutScroll(from, to, callback) {
|
|
|
23
24
|
}
|
|
24
25
|
step();
|
|
25
26
|
}
|
|
26
|
-
function debounce(fn, delay) {
|
|
27
|
-
let timer;
|
|
28
|
-
return function (...arrs) {
|
|
29
|
-
clearTimeout(timer);
|
|
30
|
-
timer = setTimeout(function () {
|
|
31
|
-
fn(...arrs);
|
|
32
|
-
}, delay);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
27
|
export class ScrollView {
|
|
36
28
|
constructor() {
|
|
37
29
|
this.scrollX = false;
|
|
@@ -45,7 +37,7 @@ export class ScrollView {
|
|
|
45
37
|
const { scrollLeft, scrollTop, scrollHeight, scrollWidth } = this.el;
|
|
46
38
|
this._scrollLeft = scrollLeft;
|
|
47
39
|
this._scrollTop = scrollTop;
|
|
48
|
-
this.
|
|
40
|
+
this.upperAndLower();
|
|
49
41
|
this.onScroll.emit({
|
|
50
42
|
scrollLeft,
|
|
51
43
|
scrollTop,
|
|
@@ -53,7 +45,7 @@ export class ScrollView {
|
|
|
53
45
|
scrollWidth
|
|
54
46
|
});
|
|
55
47
|
};
|
|
56
|
-
this.
|
|
48
|
+
this.upperAndLower = debounce(() => {
|
|
57
49
|
const { offsetWidth, offsetHeight, scrollLeft, scrollTop, scrollHeight, scrollWidth } = this.el;
|
|
58
50
|
const lowerThreshold = Number(this.lowerThreshold);
|
|
59
51
|
const upperThreshold = Number(this.upperThreshold);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import { Component, h, Prop, Event, Watch, Host, Element, State } from '@stencil/core';
|
|
3
|
-
import SwiperJS from 'swiper/swiper-bundle.esm.js';
|
|
4
3
|
import classNames from 'classnames';
|
|
4
|
+
import SwiperJS from 'swiper/swiper-bundle.esm.js';
|
|
5
|
+
import { debounce } from '../../utils';
|
|
5
6
|
let INSTANCE_ID = 0;
|
|
6
7
|
export class Swiper {
|
|
7
8
|
constructor() {
|
|
@@ -588,12 +589,3 @@ export class Swiper {
|
|
|
588
589
|
"methodName": "watchCircular"
|
|
589
590
|
}]; }
|
|
590
591
|
}
|
|
591
|
-
function debounce(fn, delay) {
|
|
592
|
-
let timer;
|
|
593
|
-
return function (...arrs) {
|
|
594
|
-
clearTimeout(timer);
|
|
595
|
-
timer = setTimeout(function () {
|
|
596
|
-
fn(...arrs);
|
|
597
|
-
}, delay);
|
|
598
|
-
};
|
|
599
|
-
}
|