zartui 1.0.21 → 1.0.23
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/es/calendar/components/Header.js +6 -0
- package/es/calendar/index.js +5 -0
- package/es/index.js +4 -3
- package/es/radio-picker/PickerColumn.js +421 -0
- package/es/radio-picker/index.css +1 -0
- package/es/radio-picker/index.js +477 -0
- package/es/radio-picker/index.less +152 -0
- package/es/radio-picker/shared.js +36 -0
- package/es/radio-picker/style/index.js +13 -0
- package/es/radio-picker/style/less.js +13 -0
- package/es/style/var.less +3 -0
- package/lib/calendar/components/Header.js +6 -0
- package/lib/calendar/index.js +5 -0
- package/lib/index.css +1 -1
- package/lib/index.js +6 -2
- package/lib/index.less +1 -0
- package/lib/radio-picker/PickerColumn.js +441 -0
- package/lib/radio-picker/index.css +1 -0
- package/lib/radio-picker/index.js +495 -0
- package/lib/radio-picker/index.less +152 -0
- package/lib/radio-picker/shared.js +42 -0
- package/lib/radio-picker/style/index.js +13 -0
- package/lib/radio-picker/style/less.js +13 -0
- package/lib/style/var.less +3 -0
- package/lib/zart.js +1356 -406
- package/lib/zart.min.js +4 -4
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ export default createComponent({
|
|
|
11
11
|
subtitle: String,
|
|
12
12
|
showTitle: Boolean,
|
|
13
13
|
showSubtitle: Boolean,
|
|
14
|
+
showWeekDays: Boolean,
|
|
14
15
|
firstDayOfWeek: Number
|
|
15
16
|
},
|
|
16
17
|
methods: {
|
|
@@ -40,6 +41,11 @@ export default createComponent({
|
|
|
40
41
|
},
|
|
41
42
|
genWeekDays: function genWeekDays() {
|
|
42
43
|
var h = this.$createElement;
|
|
44
|
+
|
|
45
|
+
if (!this.showWeekDays) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
var weekdays = t('weekdays'); // console.log(" weekdays " + JSON.stringify(weekdays));
|
|
44
50
|
|
|
45
51
|
var firstDayOfWeek = this.firstDayOfWeek;
|
package/es/calendar/index.js
CHANGED
|
@@ -63,6 +63,10 @@ export default createComponent({
|
|
|
63
63
|
type: Boolean,
|
|
64
64
|
default: true
|
|
65
65
|
},
|
|
66
|
+
showWeekDays: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true
|
|
69
|
+
},
|
|
66
70
|
closeOnPopstate: {
|
|
67
71
|
type: Boolean,
|
|
68
72
|
default: true
|
|
@@ -432,6 +436,7 @@ export default createComponent({
|
|
|
432
436
|
"lazyRender": this.lazyRender,
|
|
433
437
|
"currentDate": this.currentDate,
|
|
434
438
|
"showSubtitle": this.showSubtitle,
|
|
439
|
+
"showWeekDays": this.showWeekDays,
|
|
435
440
|
"allowSameDay": this.allowSameDay,
|
|
436
441
|
"showMonthTitle": showMonthTitle,
|
|
437
442
|
"firstDayOfWeek": this.dayOffset
|
package/es/index.js
CHANGED
|
@@ -53,6 +53,7 @@ import Popup from './popup';
|
|
|
53
53
|
import PullRefresh from './pull-refresh';
|
|
54
54
|
import Radio from './radio';
|
|
55
55
|
import RadioGroup from './radio-group';
|
|
56
|
+
import RadioPicker from './radio-picker';
|
|
56
57
|
import Rate from './rate';
|
|
57
58
|
import Row from './row';
|
|
58
59
|
import Search from './search';
|
|
@@ -77,10 +78,10 @@ import Tag from './tag';
|
|
|
77
78
|
import Timeline from './timeline';
|
|
78
79
|
import Toast from './toast';
|
|
79
80
|
import Uploader from './uploader';
|
|
80
|
-
var version = '1.0.
|
|
81
|
+
var version = '1.0.23';
|
|
81
82
|
|
|
82
83
|
function install(Vue) {
|
|
83
|
-
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Circle, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, PdfViewerV2, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader];
|
|
84
|
+
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Circle, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, PdfViewerV2, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, RadioPicker, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader];
|
|
84
85
|
components.forEach(function (item) {
|
|
85
86
|
if (item.install) {
|
|
86
87
|
Vue.use(item);
|
|
@@ -94,7 +95,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
94
95
|
install(window.Vue);
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
export { install, version, ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Circle, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, PdfViewerV2, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader };
|
|
98
|
+
export { install, version, ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Circle, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, PdfViewerV2, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, RadioPicker, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader };
|
|
98
99
|
export default {
|
|
99
100
|
install: install,
|
|
100
101
|
version: version
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import _mergeJSXProps2 from "@vue/babel-helper-vue-jsx-merge-props";
|
|
2
|
+
import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
|
|
3
|
+
import Empty from '../empty';
|
|
4
|
+
import { TouchMixin } from '../mixins/touch';
|
|
5
|
+
import Radio from '../radio';
|
|
6
|
+
import RadioGroup from '../radio-group';
|
|
7
|
+
import { createNamespace, inBrowser, isObject } from '../utils';
|
|
8
|
+
import { deepClone } from '../utils/deep-clone';
|
|
9
|
+
import { off, on, preventDefault } from '../utils/dom/event';
|
|
10
|
+
import { range } from '../utils/format/number';
|
|
11
|
+
var DEFAULT_DURATION = 200;
|
|
12
|
+
/** 最底部的一个选项,在滚动到地图时,会有一个距离被截断,这里需要加回来 */
|
|
13
|
+
|
|
14
|
+
var RADIO_COLUMN_BOTTOM_ITEM_EMPTY_LEN = 10; // 惯性滑动思路:
|
|
15
|
+
// 在手指离开屏幕时,如果和上一次 move 时的间隔小于 `MOMENTUM_LIMIT_TIME` 且 move
|
|
16
|
+
// 距离大于 `MOMENTUM_LIMIT_DISTANCE` 时,执行惯性滑动
|
|
17
|
+
|
|
18
|
+
export var MOMENTUM_LIMIT_TIME = 300;
|
|
19
|
+
export var MOMENTUM_LIMIT_DISTANCE = 15;
|
|
20
|
+
|
|
21
|
+
var _createNamespace = createNamespace('radio-picker-column'),
|
|
22
|
+
createComponent = _createNamespace[0],
|
|
23
|
+
bem = _createNamespace[1];
|
|
24
|
+
|
|
25
|
+
function getElementTranslateY(element) {
|
|
26
|
+
var style = window.getComputedStyle(element);
|
|
27
|
+
var transform = style.transform || style.webkitTransform;
|
|
28
|
+
var translateY = transform.slice(7, transform.length - 1).split(', ')[5];
|
|
29
|
+
return Number(translateY);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function isOptionDisabled(option) {
|
|
33
|
+
return isObject(option) && option.disabled;
|
|
34
|
+
} // use standard WheelEvent:
|
|
35
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
var supportMousewheel = inBrowser && 'onwheel' in window;
|
|
39
|
+
var mousewheelTimer = null;
|
|
40
|
+
export default createComponent({
|
|
41
|
+
mixins: [TouchMixin],
|
|
42
|
+
props: {
|
|
43
|
+
columnCollector: Array,
|
|
44
|
+
valueKey: String,
|
|
45
|
+
readonly: Boolean,
|
|
46
|
+
allowHtml: Boolean,
|
|
47
|
+
className: String,
|
|
48
|
+
searchVal: String,
|
|
49
|
+
toolbarPosition: String,
|
|
50
|
+
wrapHeight: Number,
|
|
51
|
+
defaultIndex: Number,
|
|
52
|
+
swipeDuration: [Number, String],
|
|
53
|
+
initialOptions: {
|
|
54
|
+
type: Array,
|
|
55
|
+
default: function _default() {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
searchable: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
data: function data() {
|
|
65
|
+
return {
|
|
66
|
+
// 列表滚动了距离顶部多少距离
|
|
67
|
+
offset: 0,
|
|
68
|
+
duration: 0,
|
|
69
|
+
options: deepClone(this.initialOptions),
|
|
70
|
+
currentIndex: this.defaultIndex,
|
|
71
|
+
confirmIndex: '',
|
|
72
|
+
isSearchEmpty: false
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
created: function created() {
|
|
76
|
+
if (this.columnCollector) {
|
|
77
|
+
this.columnCollector.push(this);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this.setIndex(this.currentIndex);
|
|
81
|
+
},
|
|
82
|
+
mounted: function mounted() {
|
|
83
|
+
this.bindTouchEvent(this.$el);
|
|
84
|
+
|
|
85
|
+
if (supportMousewheel) {
|
|
86
|
+
on(this.$refs.wrapper, 'wheel', this.onMouseWheel, false);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
destroyed: function destroyed() {
|
|
90
|
+
if (this.columnCollector) {
|
|
91
|
+
this.columnCollector.splice(this.columnCollector.indexOf(this), 1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (supportMousewheel) {
|
|
95
|
+
off(this.$el, 'wheel');
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
watch: {
|
|
99
|
+
initialOptions: 'setOptions',
|
|
100
|
+
defaultIndex: function defaultIndex(val) {
|
|
101
|
+
this.setIndex(val);
|
|
102
|
+
},
|
|
103
|
+
searchVal: function searchVal() {
|
|
104
|
+
var _this = this;
|
|
105
|
+
|
|
106
|
+
// 查询的时候,这个需要回到顶部看数据
|
|
107
|
+
this.offset = this.baseOffset; // 判断是否搜索结果为空的
|
|
108
|
+
|
|
109
|
+
if (this.searchable) {
|
|
110
|
+
this.isSearchEmpty = !this.options.some(function (option) {
|
|
111
|
+
var text = _this.getOptionText(option); // 支持搜索处理
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
return text == null ? void 0 : text.includes(_this.searchVal);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
computed: {
|
|
120
|
+
count: function count() {
|
|
121
|
+
return this.options.length;
|
|
122
|
+
},
|
|
123
|
+
baseOffset: function baseOffset() {
|
|
124
|
+
return 0;
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
methods: {
|
|
128
|
+
setOptions: function setOptions(options) {
|
|
129
|
+
if (JSON.stringify(options) !== JSON.stringify(this.options)) {
|
|
130
|
+
this.options = deepClone(options);
|
|
131
|
+
this.setIndex(this.defaultIndex);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
onTouchStart: function onTouchStart(event) {
|
|
135
|
+
this.touchStart(event);
|
|
136
|
+
|
|
137
|
+
if (this.moving) {
|
|
138
|
+
var translateY = getElementTranslateY(this.$refs.wrapper);
|
|
139
|
+
this.offset = Math.min(0, translateY - this.baseOffset);
|
|
140
|
+
this.startOffset = this.offset;
|
|
141
|
+
} else {
|
|
142
|
+
this.startOffset = this.offset;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
this.duration = 0;
|
|
146
|
+
this.transitionEndTrigger = null;
|
|
147
|
+
this.touchStartTime = Date.now();
|
|
148
|
+
this.momentumOffset = this.startOffset;
|
|
149
|
+
},
|
|
150
|
+
onTouchMove: function onTouchMove(event) {
|
|
151
|
+
this.touchMove(event);
|
|
152
|
+
|
|
153
|
+
if (this.direction === 'vertical') {
|
|
154
|
+
this.moving = true;
|
|
155
|
+
preventDefault(event, true);
|
|
156
|
+
} // 在这个范围里面滚动
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
this.setRangeOffset(this.startOffset + this.deltaY);
|
|
160
|
+
var now = Date.now();
|
|
161
|
+
|
|
162
|
+
if (now - this.touchStartTime > MOMENTUM_LIMIT_TIME) {
|
|
163
|
+
this.touchStartTime = now;
|
|
164
|
+
this.momentumOffset = this.offset;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
onTouchEnd: function onTouchEnd() {
|
|
168
|
+
var _this2 = this;
|
|
169
|
+
|
|
170
|
+
var distance = this.offset - this.momentumOffset;
|
|
171
|
+
var duration = Date.now() - this.touchStartTime;
|
|
172
|
+
var allowMomentum = duration < MOMENTUM_LIMIT_TIME && Math.abs(distance) > MOMENTUM_LIMIT_DISTANCE;
|
|
173
|
+
|
|
174
|
+
if (allowMomentum) {
|
|
175
|
+
this.momentum(distance, duration);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this.duration = DEFAULT_DURATION; // compatible with desktop scenario
|
|
180
|
+
// use setTimeout to skip the click event Emitted after touchstart
|
|
181
|
+
|
|
182
|
+
setTimeout(function () {
|
|
183
|
+
_this2.moving = false;
|
|
184
|
+
}, 0);
|
|
185
|
+
},
|
|
186
|
+
onMouseWheel: function onMouseWheel(event) {
|
|
187
|
+
var _this3 = this;
|
|
188
|
+
|
|
189
|
+
preventDefault(event, true); // simply combine touchstart and touchmove
|
|
190
|
+
|
|
191
|
+
var translateY = getElementTranslateY(this.$refs.wrapper);
|
|
192
|
+
this.startOffset = Math.min(0, translateY - this.baseOffset);
|
|
193
|
+
this.momentumOffset = this.startOffset;
|
|
194
|
+
this.transitionEndTrigger = null; // directly use deltaY, see https://caniuse.com/?search=deltaY
|
|
195
|
+
// use deltaY to detect direction for not special setting device
|
|
196
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event
|
|
197
|
+
|
|
198
|
+
var deltaY = event.deltaY;
|
|
199
|
+
|
|
200
|
+
if (this.startOffset === 0 && deltaY < 0) {
|
|
201
|
+
return;
|
|
202
|
+
} // get offset
|
|
203
|
+
// if necessary, can adjust distance value to make scrolling smoother
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
var distance = -deltaY;
|
|
207
|
+
this.setRangeOffset(this.startOffset + distance);
|
|
208
|
+
|
|
209
|
+
if (mousewheelTimer) {
|
|
210
|
+
clearTimeout(mousewheelTimer);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
mousewheelTimer = setTimeout(function () {
|
|
214
|
+
_this3.onTouchEnd();
|
|
215
|
+
|
|
216
|
+
_this3.touchStartTime = 0;
|
|
217
|
+
}, MOMENTUM_LIMIT_TIME);
|
|
218
|
+
},
|
|
219
|
+
onTransitionEnd: function onTransitionEnd() {
|
|
220
|
+
this.stopMomentum();
|
|
221
|
+
},
|
|
222
|
+
onClickItem: function onClickItem(index) {
|
|
223
|
+
if (this.moving || this.readonly) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
this.transitionEndTrigger = null;
|
|
228
|
+
this.duration = DEFAULT_DURATION;
|
|
229
|
+
this.setIndex(index, true);
|
|
230
|
+
},
|
|
231
|
+
adjustIndex: function adjustIndex(index) {
|
|
232
|
+
index = range(index, 0, this.count);
|
|
233
|
+
|
|
234
|
+
for (var i = index; i < this.count; i++) {
|
|
235
|
+
if (!isOptionDisabled(this.options[i])) return i;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
for (var _i = index - 1; _i >= 0; _i--) {
|
|
239
|
+
if (!isOptionDisabled(this.options[_i])) return _i;
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
getOptionText: function getOptionText(option) {
|
|
243
|
+
if (isObject(option) && this.valueKey in option) {
|
|
244
|
+
return option[this.valueKey];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return option;
|
|
248
|
+
},
|
|
249
|
+
setOptionText: function setOptionText(option, text) {
|
|
250
|
+
if (isObject(option) && this.valueKey in option) {
|
|
251
|
+
option[this.valueKey] = text;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
option = text;
|
|
255
|
+
return option;
|
|
256
|
+
},
|
|
257
|
+
setIndex: function setIndex(index, emitChange) {
|
|
258
|
+
var _this4 = this;
|
|
259
|
+
|
|
260
|
+
index = this.adjustIndex(index) || 0;
|
|
261
|
+
|
|
262
|
+
var trigger = function trigger() {
|
|
263
|
+
if (index !== _this4.currentIndex) {
|
|
264
|
+
_this4.currentIndex = index;
|
|
265
|
+
|
|
266
|
+
if (emitChange) {
|
|
267
|
+
_this4.$emit('change', index);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}; // trigger the change event after transitionend when moving
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
if (this.moving) {
|
|
274
|
+
this.transitionEndTrigger = trigger;
|
|
275
|
+
} else {
|
|
276
|
+
trigger();
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
setValue: function setValue(value) {
|
|
280
|
+
var options = this.options;
|
|
281
|
+
|
|
282
|
+
for (var i = 0; i < options.length; i++) {
|
|
283
|
+
if (this.getOptionText(options[i]) === value) {
|
|
284
|
+
return this.setIndex(i);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
getValue: function getValue() {
|
|
289
|
+
return this.options[this.currentIndex];
|
|
290
|
+
},
|
|
291
|
+
setRangeOffset: function setRangeOffset(distance) {
|
|
292
|
+
var maxOffsetVal = this.$refs.wrapper.clientHeight - this.wrapHeight; // 在设置底部toolbar的时候,不需要这个间距
|
|
293
|
+
|
|
294
|
+
if (this.toolbarPosition !== 'bottom') {
|
|
295
|
+
maxOffsetVal += RADIO_COLUMN_BOTTOM_ITEM_EMPTY_LEN;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
this.offset = range(distance, -maxOffsetVal, 0);
|
|
299
|
+
},
|
|
300
|
+
momentum: function momentum(distance, duration) {
|
|
301
|
+
var speed = Math.abs(distance / duration);
|
|
302
|
+
distance = this.offset + speed / 0.003 * (distance < 0 ? -1 : 1);
|
|
303
|
+
this.setRangeOffset(distance);
|
|
304
|
+
this.duration = +this.swipeDuration;
|
|
305
|
+
},
|
|
306
|
+
stopMomentum: function stopMomentum() {
|
|
307
|
+
this.moving = false;
|
|
308
|
+
this.duration = 0;
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @description: 高亮显示搜索匹配的字段
|
|
313
|
+
* @param {*} text radio label
|
|
314
|
+
*/
|
|
315
|
+
transSearchedText: function transSearchedText(text) {
|
|
316
|
+
var regex = new RegExp(this.searchVal, 'gi');
|
|
317
|
+
var replaced = text.replace(regex, "<span style='color: #0091FA;'>$&</span>");
|
|
318
|
+
return replaced;
|
|
319
|
+
},
|
|
320
|
+
genOptions: function genOptions() {
|
|
321
|
+
var _this5 = this;
|
|
322
|
+
|
|
323
|
+
var h = this.$createElement;
|
|
324
|
+
return this.options.map(function (option, index) {
|
|
325
|
+
var _text, _domProps;
|
|
326
|
+
|
|
327
|
+
var text = _this5.getOptionText(option);
|
|
328
|
+
|
|
329
|
+
var disabled = isOptionDisabled(option);
|
|
330
|
+
var scopedSlots = option;
|
|
331
|
+
|
|
332
|
+
if (_this5.searchable) {
|
|
333
|
+
scopedSlots = {
|
|
334
|
+
option: option,
|
|
335
|
+
searchVal: _this5.searchVal
|
|
336
|
+
};
|
|
337
|
+
} // 支持搜索处理
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
var isSearchMatch = (_text = text) == null ? void 0 : _text.includes(_this5.searchVal);
|
|
341
|
+
var isSearchedTrans = false;
|
|
342
|
+
|
|
343
|
+
if (isSearchMatch && _this5.searchVal) {
|
|
344
|
+
text = _this5.transSearchedText(text);
|
|
345
|
+
isSearchedTrans = true;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
var data = {
|
|
349
|
+
attrs: {
|
|
350
|
+
role: 'radio',
|
|
351
|
+
tabindex: disabled ? -1 : 0
|
|
352
|
+
},
|
|
353
|
+
class: [bem('item', {
|
|
354
|
+
disabled: disabled,
|
|
355
|
+
'not-match': !isSearchMatch
|
|
356
|
+
})],
|
|
357
|
+
on: {
|
|
358
|
+
click: function click(e) {
|
|
359
|
+
e.preventDefault();
|
|
360
|
+
|
|
361
|
+
_this5.onClickItem(index);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
var childData = {
|
|
366
|
+
domProps: (_domProps = {}, _domProps[_this5.allowHtml || isSearchedTrans ? 'innerHTML' : 'textContent'] = text, _domProps)
|
|
367
|
+
};
|
|
368
|
+
return h(Radio, _mergeJSXProps2([{
|
|
369
|
+
"attrs": {
|
|
370
|
+
"name": index
|
|
371
|
+
}
|
|
372
|
+
}, data]), [_this5.slots('option', scopedSlots) || h("div", _mergeJSXProps([{}, childData]))]);
|
|
373
|
+
});
|
|
374
|
+
},
|
|
375
|
+
recordConfirmIndex: function recordConfirmIndex() {
|
|
376
|
+
this.confirmIndex = this.currentIndex;
|
|
377
|
+
},
|
|
378
|
+
setConfirmIndex: function setConfirmIndex() {
|
|
379
|
+
if (this.confirmIndex || this.confirmIndex === 0) {
|
|
380
|
+
this.setIndex(this.confirmIndex, true);
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
genEmpty: function genEmpty() {
|
|
384
|
+
var h = this.$createElement;
|
|
385
|
+
return h(Empty, {
|
|
386
|
+
"attrs": {
|
|
387
|
+
"description": "暂无搜索结果"
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
render: function render() {
|
|
393
|
+
var _this6 = this;
|
|
394
|
+
|
|
395
|
+
var h = arguments[0];
|
|
396
|
+
var wrapperStyle = {
|
|
397
|
+
transform: "translate3d(0, " + (this.offset + this.baseOffset) + "px, 0)",
|
|
398
|
+
transitionDuration: this.duration + "ms",
|
|
399
|
+
transitionProperty: this.duration ? 'all' : 'none'
|
|
400
|
+
};
|
|
401
|
+
return h("div", {
|
|
402
|
+
"class": [bem(), this.className]
|
|
403
|
+
}, [h("ul", {
|
|
404
|
+
"ref": "wrapper",
|
|
405
|
+
"style": wrapperStyle,
|
|
406
|
+
"class": bem('wrapper'),
|
|
407
|
+
"on": {
|
|
408
|
+
"transitionend": this.onTransitionEnd
|
|
409
|
+
}
|
|
410
|
+
}, [h(RadioGroup, {
|
|
411
|
+
"attrs": {
|
|
412
|
+
"value": this.currentIndex
|
|
413
|
+
},
|
|
414
|
+
"on": {
|
|
415
|
+
"change": function change(val) {
|
|
416
|
+
_this6.currentIndex = val;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}, [this.genOptions()]), this.isSearchEmpty ? this.genEmpty() : null])]);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[class*=zt-hairline]::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid rgba(0,0,0,.1);-webkit-transform:scale(.5);transform:scale(.5)}.zt-hairline,.zt-hairline--bottom,.zt-hairline--left,.zt-hairline--right,.zt-hairline--surround,.zt-hairline--top,.zt-hairline--top-bottom{position:relative}.zt-hairline--top::after{border-top-width:1px}.zt-hairline--left::after{border-left-width:1px}.zt-hairline--right::after{border-right-width:1px}.zt-hairline--bottom::after{border-bottom-width:1px}.zt-hairline--top-bottom::after,.zt-hairline-unset--top-bottom::after{border-width:1px 0}.zt-hairline--surround::after{border-width:1px}.zt-radio-picker{position:relative;background-color:#fff;-webkit-user-select:none;user-select:none}.zt-radio-picker__toolbar{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;height:44px}.zt-radio-picker__border{position:relative}.zt-radio-picker__border::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;bottom:0;left:0;border-bottom:1px solid rgba(0,0,0,.1);-webkit-transform:scaleY(.5);transform:scaleY(.5)}.zt-radio-picker__cancel,.zt-radio-picker__confirm{height:100%;padding:0 16px;font-size:16px;background-color:transparent;border:none;cursor:pointer}.zt-radio-picker__cancel:active,.zt-radio-picker__confirm:active{opacity:.7}.zt-radio-picker__confirm{color:#0091fa;font-weight:700}.zt-radio-picker__cancel{color:#000;font-weight:400}.zt-radio-picker__title{max-width:50%;font-weight:400;font-size:14px;line-height:20px;text-align:center;color:rgba(0,0,0,.4)}.zt-radio-picker__header{width:100%;height:40px;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;font-size:14px;font-weight:400}.zt-radio-picker__header>li{-webkit-box-flex:1;-webkit-flex:auto;flex:auto;text-align:center}.zt-radio-picker__columns{position:relative;display:-webkit-box;display:-webkit-flex;display:flex;cursor:grab}.zt-radio-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:3;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;color:#0091fa;background-color:rgba(255,255,255,.9)}.zt-radio-picker__frame{position:absolute;top:50%;right:16px;left:16px;z-index:2;-webkit-transform:translateY(-50%);transform:translateY(-50%);pointer-events:none}.zt-radio-picker__background{position:absolute;width:100%;height:100%;background-color:#fff}.zt-radio-picker-column{-webkit-box-flex:1;-webkit-flex:1;flex:1;overflow:hidden;font-size:16px}.zt-radio-picker-column__wrapper{-webkit-transition-timing-function:cubic-bezier(.23,1,.68,1);transition-timing-function:cubic-bezier(.23,1,.68,1)}.zt-radio-picker-column__item{position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:start;-webkit-justify-content:flex-start;justify-content:flex-start;padding:10px 16px;color:#000}.zt-radio-picker-column__item::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;bottom:0;left:calc(16px + 24px + 8px);border-bottom:1px solid rgba(0,0,0,.1);-webkit-transform:scaleY(.5);transform:scaleY(.5)}.zt-radio-picker-column__item--disabled{cursor:not-allowed;opacity:.3}.zt-radio-picker-column__item--not-match{display:none}.zt-radio-picker-column__item--selected{font-weight:700}.zt-radio-picker-column__item .zt-radio__label{font-family:PingFangSC-Regular;font-weight:400;font-size:14px;line-height:20px}
|