fastman2 3.0.0-alpha.1 → 3.0.0-alpha.2
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/actionsheetman.js +1 -96
- package/alertman.js +1 -79
- package/annotationman.js +17 -2912
- package/baseman.js +1 -115
- package/blankpageman.js +1 -171
- package/cascadepickerman.js +1 -322
- package/confirmman.js +1 -87
- package/coreman.js +3 -2182
- package/cryptoman.js +2 -8931
- package/datetimepickerman.js +1 -181
- package/domman.js +1 -2759
- package/eventemitterman.js +1 -112
- package/fileuploadman.js +1 -2970
- package/formvalidateman.js +1 -335
- package/jsbridgeman.js +1 -992
- package/lazyloadman.js +1 -133
- package/loadingman.js +1 -81
- package/modalman.js +1 -264
- package/mutationobserverman.js +1 -356
- package/package.json +1 -1
- package/passguardman.js +1 -1722
- package/persistman.js +1 -60
- package/pickerman.js +1 -680
- package/popupman.js +1 -61
- package/postman.js +1 -1649
- package/preloadman.js +2 -8760
- package/resultpageman.js +1 -153
- package/routerman.js +1 -1201
- package/scrollman-infiniteRefresh.js +1 -117
- package/scrollman-pullDownRefresh.js +1 -302
- package/scrollman.js +2 -2567
- package/storeman.js +1 -585
- package/swiperman.js +1 -4702
- package/swiperoldman.js +1 -3005
- package/tabman.js +1 -145
- package/tipman.js +1 -110
- package/toastman.js +1 -78
- package/toolman.js +1 -22
- package/whenman.js +1 -774
- package/wsman.js +1 -7624
package/pickerman.js
CHANGED
|
@@ -1,680 +1 @@
|
|
|
1
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory();
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define([], factory);
|
|
6
|
-
else if(typeof exports === 'object')
|
|
7
|
-
exports["fastman"] = factory();
|
|
8
|
-
else
|
|
9
|
-
root["fastman"] = factory();
|
|
10
|
-
})(this, function() {
|
|
11
|
-
return webpackJsonpfastman([21],{
|
|
12
|
-
|
|
13
|
-
/***/ 222:
|
|
14
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
15
|
-
|
|
16
|
-
module.exports = __webpack_require__(30);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/***/ }),
|
|
20
|
-
|
|
21
|
-
/***/ 30:
|
|
22
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
23
|
-
|
|
24
|
-
"use strict";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Object.defineProperty(exports, "__esModule", {
|
|
28
|
-
value: true
|
|
29
|
-
});
|
|
30
|
-
var _arguments = arguments;
|
|
31
|
-
|
|
32
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /**
|
|
33
|
-
* Created by linyiqing on 2017/3/16.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var _modal = __webpack_require__(10);
|
|
38
|
-
|
|
39
|
-
var pickerModal = function pickerModal(_pickerModal, removeOnClose) {
|
|
40
|
-
if (typeof removeOnClose === 'undefined') removeOnClose = true;
|
|
41
|
-
if (typeof _pickerModal === 'string' && _pickerModal.indexOf('<') >= 0) {
|
|
42
|
-
_pickerModal = $(_pickerModal);
|
|
43
|
-
if (_pickerModal.length > 0) {
|
|
44
|
-
if (removeOnClose) _pickerModal.addClass('remove-on-close');
|
|
45
|
-
$(_modal.defaults.modalContainer).append(_pickerModal[0]);
|
|
46
|
-
} else return false; //nothing found
|
|
47
|
-
}
|
|
48
|
-
_pickerModal = $(_pickerModal);
|
|
49
|
-
if (_pickerModal.length === 0) return false;
|
|
50
|
-
_pickerModal.show();
|
|
51
|
-
(0, _modal.openModal)(_pickerModal);
|
|
52
|
-
return _pickerModal[0];
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
var Picker = function Picker(params) {
|
|
56
|
-
var p = this;
|
|
57
|
-
var defaults = {
|
|
58
|
-
updateValuesOnMomentum: false,
|
|
59
|
-
updateValuesOnTouchmove: true,
|
|
60
|
-
rotateEffect: false,
|
|
61
|
-
momentumRatio: 7,
|
|
62
|
-
freeMode: false,
|
|
63
|
-
// Common settings
|
|
64
|
-
scrollToInput: true,
|
|
65
|
-
inputReadOnly: true,
|
|
66
|
-
toolbar: true,
|
|
67
|
-
toolbarCloseText: '确定',
|
|
68
|
-
toolbarTemplate: '<header class="bar bar-nav">\
|
|
69
|
-
<button class="button button-link pull-right close-picker">确定</button>\
|
|
70
|
-
<h1 class="title">请选择</h1>\
|
|
71
|
-
</header>',
|
|
72
|
-
updateValue: true
|
|
73
|
-
};
|
|
74
|
-
params = params || {};
|
|
75
|
-
for (var def in defaults) {
|
|
76
|
-
if (typeof params[def] === 'undefined') {
|
|
77
|
-
params[def] = defaults[def];
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
p.params = params;
|
|
81
|
-
p.cols = [];
|
|
82
|
-
p.initialized = false;
|
|
83
|
-
|
|
84
|
-
// Inline flag
|
|
85
|
-
p.inline = p.params.container ? true : false;
|
|
86
|
-
|
|
87
|
-
// 3D Transforms origin bug, only on safari
|
|
88
|
-
var originBug = $.device.ios || navigator.userAgent.toLowerCase().indexOf('safari') >= 0 && navigator.userAgent.toLowerCase().indexOf('chrome') < 0 && !$.device.android;
|
|
89
|
-
|
|
90
|
-
// Value
|
|
91
|
-
p.setValue = function (arrValues, transition) {
|
|
92
|
-
var valueIndex = 0;
|
|
93
|
-
for (var i = 0; i < p.cols.length; i++) {
|
|
94
|
-
if (p.cols[i] && !p.cols[i].divider) {
|
|
95
|
-
p.cols[i].setValue(arrValues[valueIndex], transition);
|
|
96
|
-
valueIndex++;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
p.updateValue = function () {
|
|
101
|
-
var newValue = [];
|
|
102
|
-
var newDisplayValue = [];
|
|
103
|
-
for (var i = 0; i < p.cols.length; i++) {
|
|
104
|
-
if (!p.cols[i].divider) {
|
|
105
|
-
newValue.push(p.cols[i].value);
|
|
106
|
-
newDisplayValue.push(p.cols[i].displayValue);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if (newValue.indexOf(undefined) >= 0) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
p.value = newValue;
|
|
113
|
-
p.displayValue = newDisplayValue;
|
|
114
|
-
if (p.params.onChange) {
|
|
115
|
-
p.params.onChange(p, p.value, p.displayValue);
|
|
116
|
-
}
|
|
117
|
-
if (p.input && p.input.length > 0) {
|
|
118
|
-
$(p.input).val(p.params.formatValue ? p.params.formatValue(p, p.value, p.displayValue) : p.value.join(' '));
|
|
119
|
-
$(p.input).trigger('change');
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// Columns Handlers
|
|
124
|
-
p.initPickerCol = function (colElement, updateItems) {
|
|
125
|
-
var colContainer = $(colElement);
|
|
126
|
-
var colIndex = colContainer.index();
|
|
127
|
-
var col = p.cols[colIndex];
|
|
128
|
-
if (col.divider) return;
|
|
129
|
-
col.container = colContainer;
|
|
130
|
-
col.wrapper = col.container.find('.picker-items-col-wrapper');
|
|
131
|
-
col.items = col.wrapper.find('.picker-item');
|
|
132
|
-
|
|
133
|
-
var i, j;
|
|
134
|
-
var wrapperHeight, itemHeight, itemsHeight, minTranslate, maxTranslate;
|
|
135
|
-
col.replaceValues = function (values, displayValues) {
|
|
136
|
-
col.destroyEvents();
|
|
137
|
-
col.values = values;
|
|
138
|
-
col.displayValues = displayValues;
|
|
139
|
-
var newItemsHTML = p.columnHTML(col, true);
|
|
140
|
-
col.wrapper.html(newItemsHTML);
|
|
141
|
-
col.items = col.wrapper.find('.picker-item');
|
|
142
|
-
col.calcSize();
|
|
143
|
-
col.setValue(col.values[0], 0, true);
|
|
144
|
-
col.initEvents();
|
|
145
|
-
};
|
|
146
|
-
col.calcSize = function () {
|
|
147
|
-
if (p.params.rotateEffect) {
|
|
148
|
-
col.container.removeClass('picker-items-col-absolute');
|
|
149
|
-
if (!col.width) col.container.css({ width: '' });
|
|
150
|
-
}
|
|
151
|
-
var colWidth, colHeight;
|
|
152
|
-
colWidth = 0;
|
|
153
|
-
colHeight = col.container[0].offsetHeight;
|
|
154
|
-
wrapperHeight = col.wrapper[0].offsetHeight;
|
|
155
|
-
itemHeight = col.items[0].offsetHeight;
|
|
156
|
-
itemsHeight = itemHeight * col.items.length;
|
|
157
|
-
minTranslate = colHeight / 2 - itemsHeight + itemHeight / 2;
|
|
158
|
-
maxTranslate = colHeight / 2 - itemHeight / 2;
|
|
159
|
-
if (col.width) {
|
|
160
|
-
colWidth = col.width;
|
|
161
|
-
if (parseInt(colWidth, 10) === colWidth) colWidth = colWidth + 'px';
|
|
162
|
-
col.container.css({ width: colWidth });
|
|
163
|
-
}
|
|
164
|
-
if (p.params.rotateEffect) {
|
|
165
|
-
if (!col.width) {
|
|
166
|
-
col.items.each(function () {
|
|
167
|
-
var item = $(this);
|
|
168
|
-
item.css({ width: 'auto' });
|
|
169
|
-
colWidth = Math.max(colWidth, item[0].offsetWidth);
|
|
170
|
-
item.css({ width: '' });
|
|
171
|
-
});
|
|
172
|
-
col.container.css({ width: colWidth + 2 + 'px' });
|
|
173
|
-
}
|
|
174
|
-
col.container.addClass('picker-items-col-absolute');
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
col.calcSize();
|
|
178
|
-
|
|
179
|
-
col.wrapper.transform('translate3d(0,' + maxTranslate + 'px,0)').transition(0);
|
|
180
|
-
|
|
181
|
-
var activeIndex = 0;
|
|
182
|
-
var animationFrameId;
|
|
183
|
-
|
|
184
|
-
// Set Value Function
|
|
185
|
-
col.setValue = function (newValue, transition, valueCallbacks) {
|
|
186
|
-
if (typeof transition === 'undefined') transition = '';
|
|
187
|
-
var newActiveIndex = col.wrapper.find('.picker-item[data-picker-value="' + newValue + '"]').index();
|
|
188
|
-
if (typeof newActiveIndex === 'undefined' || newActiveIndex === -1) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
var newTranslate = -newActiveIndex * itemHeight + maxTranslate;
|
|
192
|
-
// Update wrapper
|
|
193
|
-
col.wrapper.transition(transition);
|
|
194
|
-
col.wrapper.transform('translate3d(0,' + newTranslate + 'px,0)');
|
|
195
|
-
|
|
196
|
-
// Watch items
|
|
197
|
-
if (p.params.updateValuesOnMomentum && col.activeIndex && col.activeIndex !== newActiveIndex) {
|
|
198
|
-
$.cancelAnimationFrame(animationFrameId);
|
|
199
|
-
col.wrapper.transitionEnd(function () {
|
|
200
|
-
$.cancelAnimationFrame(animationFrameId);
|
|
201
|
-
});
|
|
202
|
-
updateDuringScroll();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Update items
|
|
206
|
-
col.updateItems(newActiveIndex, newTranslate, transition, valueCallbacks);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
col.updateItems = function (activeIndex, translate, transition, valueCallbacks) {
|
|
210
|
-
if (typeof translate === 'undefined') {
|
|
211
|
-
translate = $.getTranslate(col.wrapper[0], 'y');
|
|
212
|
-
}
|
|
213
|
-
if (typeof activeIndex === 'undefined') activeIndex = -Math.round((translate - maxTranslate) / itemHeight);
|
|
214
|
-
if (activeIndex < 0) activeIndex = 0;
|
|
215
|
-
if (activeIndex >= col.items.length) activeIndex = col.items.length - 1;
|
|
216
|
-
var previousActiveIndex = col.activeIndex;
|
|
217
|
-
col.activeIndex = activeIndex;
|
|
218
|
-
/*
|
|
219
|
-
col.wrapper.find('.picker-selected, .picker-after-selected, .picker-before-selected').removeClass('picker-selected picker-after-selected picker-before-selected');
|
|
220
|
-
col.items.transition(transition);
|
|
221
|
-
var selectedItem = col.items.eq(activeIndex).addClass('picker-selected').transform('');
|
|
222
|
-
var prevItems = selectedItem.prevAll().addClass('picker-before-selected');
|
|
223
|
-
var nextItems = selectedItem.nextAll().addClass('picker-after-selected');
|
|
224
|
-
*/
|
|
225
|
-
//去掉 .picker-after-selected, .picker-before-selected 以提高性能
|
|
226
|
-
col.wrapper.find('.picker-selected').removeClass('picker-selected');
|
|
227
|
-
if (p.params.rotateEffect) {
|
|
228
|
-
col.items.transition(transition);
|
|
229
|
-
}
|
|
230
|
-
var selectedItem = col.items.eq(activeIndex).addClass('picker-selected').transform('');
|
|
231
|
-
|
|
232
|
-
if (valueCallbacks || typeof valueCallbacks === 'undefined') {
|
|
233
|
-
// Update values
|
|
234
|
-
col.value = selectedItem.attr('data-picker-value');
|
|
235
|
-
col.displayValue = col.displayValues ? col.displayValues[activeIndex] : col.value;
|
|
236
|
-
// On change callback
|
|
237
|
-
if (previousActiveIndex !== activeIndex) {
|
|
238
|
-
if (col.onChange) {
|
|
239
|
-
col.onChange(p, col.value, col.displayValue);
|
|
240
|
-
}
|
|
241
|
-
if (p.params.updateValue) {
|
|
242
|
-
p.updateValue();
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// Set 3D rotate effect
|
|
248
|
-
if (!p.params.rotateEffect) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
var percentage = (translate - (Math.floor((translate - maxTranslate) / itemHeight) * itemHeight + maxTranslate)) / itemHeight;
|
|
252
|
-
|
|
253
|
-
col.items.each(function () {
|
|
254
|
-
var item = $(this);
|
|
255
|
-
var itemOffsetTop = item.index() * itemHeight;
|
|
256
|
-
var translateOffset = maxTranslate - translate;
|
|
257
|
-
var itemOffset = itemOffsetTop - translateOffset;
|
|
258
|
-
var percentage = itemOffset / itemHeight;
|
|
259
|
-
|
|
260
|
-
var itemsFit = Math.ceil(col.height / itemHeight / 2) + 1;
|
|
261
|
-
|
|
262
|
-
var angle = -18 * percentage;
|
|
263
|
-
if (angle > 180) angle = 180;
|
|
264
|
-
if (angle < -180) angle = -180;
|
|
265
|
-
// Far class
|
|
266
|
-
if (Math.abs(percentage) > itemsFit) item.addClass('picker-item-far');else item.removeClass('picker-item-far');
|
|
267
|
-
// Set transform
|
|
268
|
-
item.transform('translate3d(0, ' + (-translate + maxTranslate) + 'px, ' + (originBug ? -110 : 0) + 'px) rotateX(' + angle + 'deg)');
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
function updateDuringScroll() {
|
|
273
|
-
animationFrameId = $.requestAnimationFrame(function () {
|
|
274
|
-
col.updateItems(undefined, undefined, 0);
|
|
275
|
-
updateDuringScroll();
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Update items on init
|
|
280
|
-
if (updateItems) col.updateItems(0, maxTranslate, 0);
|
|
281
|
-
|
|
282
|
-
var allowItemClick = true;
|
|
283
|
-
//记录最后一次位置
|
|
284
|
-
var lastTranslate;
|
|
285
|
-
var isTouched, isMoved, touchStartY, touchCurrentY, touchStartTime, touchEndTime, startTranslate, returnTo, currentTranslate, prevTranslate, velocityTranslate, velocityTime;
|
|
286
|
-
function handleTouchStart(e) {
|
|
287
|
-
if (isMoved || isTouched) return;
|
|
288
|
-
e.preventDefault();
|
|
289
|
-
isTouched = true;
|
|
290
|
-
touchStartY = touchCurrentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
|
|
291
|
-
touchStartTime = new Date().getTime();
|
|
292
|
-
|
|
293
|
-
allowItemClick = true;
|
|
294
|
-
lastTranslate = startTranslate = currentTranslate = $.getTranslate(col.wrapper[0], 'y');
|
|
295
|
-
}
|
|
296
|
-
function handleTouchMove(e) {
|
|
297
|
-
if (!isTouched) return;
|
|
298
|
-
e.preventDefault();
|
|
299
|
-
allowItemClick = false;
|
|
300
|
-
touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
|
|
301
|
-
if (!isMoved) {
|
|
302
|
-
// First move
|
|
303
|
-
$.cancelAnimationFrame(animationFrameId);
|
|
304
|
-
isMoved = true;
|
|
305
|
-
startTranslate = currentTranslate = $.getTranslate(col.wrapper[0], 'y');
|
|
306
|
-
col.wrapper.transition(0);
|
|
307
|
-
}
|
|
308
|
-
e.preventDefault();
|
|
309
|
-
|
|
310
|
-
var diff = touchCurrentY - touchStartY;
|
|
311
|
-
currentTranslate = startTranslate + diff;
|
|
312
|
-
returnTo = undefined;
|
|
313
|
-
|
|
314
|
-
// Normalize translate
|
|
315
|
-
if (currentTranslate < minTranslate) {
|
|
316
|
-
currentTranslate = minTranslate - Math.pow(minTranslate - currentTranslate, 0.8);
|
|
317
|
-
returnTo = 'min';
|
|
318
|
-
}
|
|
319
|
-
if (currentTranslate > maxTranslate) {
|
|
320
|
-
currentTranslate = maxTranslate + Math.pow(currentTranslate - maxTranslate, 0.8);
|
|
321
|
-
returnTo = 'max';
|
|
322
|
-
}
|
|
323
|
-
// Transform wrapper
|
|
324
|
-
col.wrapper.transform('translate3d(0,' + currentTranslate + 'px,0)');
|
|
325
|
-
|
|
326
|
-
// Update items
|
|
327
|
-
col.updateItems(undefined, currentTranslate, 0, p.params.updateValuesOnTouchmove);
|
|
328
|
-
|
|
329
|
-
// Calc velocity
|
|
330
|
-
velocityTranslate = currentTranslate - prevTranslate || currentTranslate;
|
|
331
|
-
velocityTime = new Date().getTime();
|
|
332
|
-
prevTranslate = currentTranslate;
|
|
333
|
-
}
|
|
334
|
-
function handleTouchEnd(e) {
|
|
335
|
-
if (!isTouched || !isMoved) {
|
|
336
|
-
isTouched = isMoved = false;
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
isTouched = isMoved = false;
|
|
340
|
-
col.wrapper.transition('');
|
|
341
|
-
if (returnTo) {
|
|
342
|
-
if (returnTo === 'min') {
|
|
343
|
-
col.wrapper.transform('translate3d(0,' + minTranslate + 'px,0)');
|
|
344
|
-
} else col.wrapper.transform('translate3d(0,' + maxTranslate + 'px,0)');
|
|
345
|
-
}
|
|
346
|
-
touchEndTime = new Date().getTime();
|
|
347
|
-
var velocity, newTranslate;
|
|
348
|
-
if (touchEndTime - touchStartTime > 300) {
|
|
349
|
-
newTranslate = currentTranslate;
|
|
350
|
-
} else {
|
|
351
|
-
velocity = Math.abs(velocityTranslate / (touchEndTime - velocityTime));
|
|
352
|
-
newTranslate = currentTranslate + velocityTranslate * p.params.momentumRatio;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
newTranslate = Math.max(Math.min(newTranslate, maxTranslate), minTranslate);
|
|
356
|
-
|
|
357
|
-
// Active Index
|
|
358
|
-
var activeIndex;
|
|
359
|
-
//偏移的高度
|
|
360
|
-
var offsetHeight = (newTranslate - maxTranslate) % itemHeight;
|
|
361
|
-
//判断上下滑动 滑动超过该item高度一半时,选择该item
|
|
362
|
-
if (lastTranslate > newTranslate && Math.abs(offsetHeight + itemHeight) < itemHeight / 2 || lastTranslate < newTranslate && Math.abs(offsetHeight + itemHeight) < itemHeight / 2) {
|
|
363
|
-
activeIndex = -Math.floor((newTranslate - maxTranslate) / itemHeight);
|
|
364
|
-
} else {
|
|
365
|
-
activeIndex = -Math.ceil((newTranslate - maxTranslate) / itemHeight);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// Normalize translate
|
|
369
|
-
if (!p.params.freeMode) newTranslate = -activeIndex * itemHeight + maxTranslate;
|
|
370
|
-
|
|
371
|
-
// Transform wrapper
|
|
372
|
-
col.wrapper.transform('translate3d(0,' + parseInt(newTranslate, 10) + 'px,0)');
|
|
373
|
-
|
|
374
|
-
// Update items
|
|
375
|
-
col.updateItems(activeIndex, newTranslate, '', true);
|
|
376
|
-
|
|
377
|
-
// Watch items
|
|
378
|
-
if (p.params.updateValuesOnMomentum) {
|
|
379
|
-
updateDuringScroll();
|
|
380
|
-
col.wrapper.transitionEnd(function () {
|
|
381
|
-
$.cancelAnimationFrame(animationFrameId);
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// Allow click
|
|
386
|
-
setTimeout(function () {
|
|
387
|
-
allowItemClick = true;
|
|
388
|
-
}, 100);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
function handleClick(e) {
|
|
392
|
-
if (!allowItemClick) return;
|
|
393
|
-
$.cancelAnimationFrame(animationFrameId);
|
|
394
|
-
/*jshint validthis:true */
|
|
395
|
-
var value = $(this).attr('data-picker-value');
|
|
396
|
-
col.setValue(value);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
col.initEvents = function (detach) {
|
|
400
|
-
var method = detach ? 'off' : 'on';
|
|
401
|
-
col.container[method]($.touchEvents.start, handleTouchStart);
|
|
402
|
-
col.container[method]($.touchEvents.move, handleTouchMove);
|
|
403
|
-
col.container[method]($.touchEvents.end, handleTouchEnd);
|
|
404
|
-
col.items[method]('click', handleClick);
|
|
405
|
-
};
|
|
406
|
-
col.destroyEvents = function () {
|
|
407
|
-
col.initEvents(true);
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
col.container[0].f7DestroyPickerCol = function () {
|
|
411
|
-
col.destroyEvents();
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
col.initEvents();
|
|
415
|
-
};
|
|
416
|
-
p.destroyPickerCol = function (colContainer) {
|
|
417
|
-
colContainer = $(colContainer);
|
|
418
|
-
if ('f7DestroyPickerCol' in colContainer[0]) colContainer[0].f7DestroyPickerCol();
|
|
419
|
-
};
|
|
420
|
-
// Resize cols
|
|
421
|
-
function resizeCols() {
|
|
422
|
-
if (!p.opened) return;
|
|
423
|
-
for (var i = 0; i < p.cols.length; i++) {
|
|
424
|
-
if (!p.cols[i].divider) {
|
|
425
|
-
p.cols[i].calcSize();
|
|
426
|
-
p.cols[i].setValue(p.cols[i].value, 0, false);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
$(window).on('resize', resizeCols);
|
|
431
|
-
|
|
432
|
-
// HTML Layout
|
|
433
|
-
p.columnHTML = function (col, onlyItems) {
|
|
434
|
-
var columnItemsHTML = '';
|
|
435
|
-
var columnHTML = '';
|
|
436
|
-
if (col.divider) {
|
|
437
|
-
columnHTML += '<div class="picker-items-col picker-items-col-divider ' + (col.textAlign ? 'picker-items-col-' + col.textAlign : '') + ' ' + (col.cssClass || '') + '">' + col.content + '</div>';
|
|
438
|
-
} else {
|
|
439
|
-
for (var j = 0; j < col.values.length; j++) {
|
|
440
|
-
columnItemsHTML += '<div class="picker-item" data-picker-value="' + col.values[j] + '">' + (col.displayValues ? col.displayValues[j] : col.values[j]) + '</div>';
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
columnHTML += '<div class="picker-items-col ' + (col.textAlign ? 'picker-items-col-' + col.textAlign : '') + ' ' + (col.cssClass || '') + '"><div class="picker-items-col-wrapper">' + columnItemsHTML + '</div></div>';
|
|
444
|
-
}
|
|
445
|
-
return onlyItems ? columnItemsHTML : columnHTML;
|
|
446
|
-
};
|
|
447
|
-
p.layout = function () {
|
|
448
|
-
var pickerHTML = '';
|
|
449
|
-
var pickerClass = '';
|
|
450
|
-
var i;
|
|
451
|
-
p.cols = [];
|
|
452
|
-
var colsHTML = '';
|
|
453
|
-
for (i = 0; i < p.params.cols.length; i++) {
|
|
454
|
-
var col = p.params.cols[i];
|
|
455
|
-
colsHTML += p.columnHTML(p.params.cols[i]);
|
|
456
|
-
p.cols.push(col);
|
|
457
|
-
}
|
|
458
|
-
pickerClass = 'picker-modal picker-columns ' + (p.params.cssClass || '') + (p.params.rotateEffect ? ' picker-3d' : '');
|
|
459
|
-
pickerHTML = '<div class="' + pickerClass + '">' + (p.params.toolbar ? p.params.toolbarTemplate.replace(/{{closeText}}/g, p.params.toolbarCloseText) : '') + '<div class="picker-modal-inner picker-items">' + colsHTML + '<div class="picker-center-highlight"></div>' + '</div>' + '</div>';
|
|
460
|
-
|
|
461
|
-
p.pickerHTML = pickerHTML;
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
// Input Events
|
|
465
|
-
function openOnInput(e) {
|
|
466
|
-
e.preventDefault();
|
|
467
|
-
// 安卓微信webviewreadonly的input依然弹出软键盘问题修复
|
|
468
|
-
if ($.device.isWeixin && $.device.android && p.params.inputReadOnly) {
|
|
469
|
-
/*jshint validthis:true */
|
|
470
|
-
this.focus();
|
|
471
|
-
this.blur();
|
|
472
|
-
}
|
|
473
|
-
if (p.opened) return;
|
|
474
|
-
//关闭其他picker
|
|
475
|
-
(0, _modal.closeModal)($('.picker-modal'));
|
|
476
|
-
p.open();
|
|
477
|
-
if (p.params.scrollToInput) {
|
|
478
|
-
var pageContent = p.input.parents('.content');
|
|
479
|
-
if (pageContent.length === 0) return;
|
|
480
|
-
|
|
481
|
-
var paddingTop = parseInt(pageContent.css('padding-top'), 10),
|
|
482
|
-
paddingBottom = parseInt(pageContent.css('padding-bottom'), 10),
|
|
483
|
-
pageHeight = pageContent[0].offsetHeight - paddingTop - p.container.height(),
|
|
484
|
-
pageScrollHeight = pageContent[0].scrollHeight - paddingTop - p.container.height(),
|
|
485
|
-
newPaddingBottom;
|
|
486
|
-
var inputTop = p.input.offset().top - paddingTop + p.input[0].offsetHeight;
|
|
487
|
-
if (inputTop > pageHeight) {
|
|
488
|
-
var scrollTop = pageContent.scrollTop() + inputTop - pageHeight;
|
|
489
|
-
if (scrollTop + pageHeight > pageScrollHeight) {
|
|
490
|
-
newPaddingBottom = scrollTop + pageHeight - pageScrollHeight + paddingBottom;
|
|
491
|
-
if (pageHeight === pageScrollHeight) {
|
|
492
|
-
newPaddingBottom = p.container.height();
|
|
493
|
-
}
|
|
494
|
-
pageContent.css({ 'padding-bottom': newPaddingBottom + 'px' });
|
|
495
|
-
}
|
|
496
|
-
pageContent.scrollTop(scrollTop, 300);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
//停止事件冒泡,主动处理
|
|
500
|
-
e.stopPropagation();
|
|
501
|
-
}
|
|
502
|
-
function closeOnHTMLClick(e) {
|
|
503
|
-
if (!p.opened) return;
|
|
504
|
-
p.closeFromOverlay = false;
|
|
505
|
-
if (p.input && p.input.length > 0) {
|
|
506
|
-
// if (e.target !== p.input[0] && $(e.target).parents('.picker-modal').length === 0) p.close();
|
|
507
|
-
if (e.target !== p.input[0] && $(e.target).parents('.picker-modal').length === 0) {
|
|
508
|
-
p.closeFromOverlay = true;
|
|
509
|
-
(0, _modal.closeModal)(p.container);
|
|
510
|
-
}
|
|
511
|
-
} else {
|
|
512
|
-
// if ($(e.target).parents('.picker-modal').length === 0) p.close();
|
|
513
|
-
if ($(e.target).parents('.picker-modal').length === 0) {
|
|
514
|
-
p.closeFromOverlay = true;
|
|
515
|
-
(0, _modal.closeModal)(p.container);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
if (p.params.input) {
|
|
521
|
-
p.input = $(p.params.input);
|
|
522
|
-
if (p.input.length > 0) {
|
|
523
|
-
if (p.params.inputReadOnly) p.input.prop('readOnly', true);
|
|
524
|
-
if (!p.inline) {
|
|
525
|
-
p.input.on('click', openOnInput);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
if (!p.inline) $('html').on('click', closeOnHTMLClick);
|
|
531
|
-
|
|
532
|
-
// Open
|
|
533
|
-
function onPickerClose() {
|
|
534
|
-
p.opened = false;
|
|
535
|
-
if (p.input && p.input.length > 0) p.input.parents('.content').css({ 'padding-bottom': '' });
|
|
536
|
-
if (p.params.onClose) p.params.onClose(p);
|
|
537
|
-
|
|
538
|
-
// Destroy events
|
|
539
|
-
p.container.find('.picker-items-col').each(function () {
|
|
540
|
-
p.destroyPickerCol(this);
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
p.opened = false;
|
|
545
|
-
p.open = function () {
|
|
546
|
-
|
|
547
|
-
if (!p.opened) {
|
|
548
|
-
|
|
549
|
-
// Layout
|
|
550
|
-
p.layout();
|
|
551
|
-
p.opened = true;
|
|
552
|
-
// Append
|
|
553
|
-
if (p.inline) {
|
|
554
|
-
p.container = $(p.pickerHTML);
|
|
555
|
-
p.container.addClass('picker-modal-inline');
|
|
556
|
-
$(p.params.container).append(p.container);
|
|
557
|
-
} else {
|
|
558
|
-
|
|
559
|
-
p.container = $(pickerModal(p.pickerHTML));
|
|
560
|
-
|
|
561
|
-
//fix点击picker选择项以外的区域会触发后面页面滚动的bug(ios的bug)
|
|
562
|
-
$(p.container).on('touchmove', function (e) {
|
|
563
|
-
return false;
|
|
564
|
-
});
|
|
565
|
-
|
|
566
|
-
$(p.container).on('close', function () {
|
|
567
|
-
onPickerClose();
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
// Store picker instance
|
|
572
|
-
p.container[0].f7Picker = p;
|
|
573
|
-
|
|
574
|
-
// Init Events
|
|
575
|
-
p.container.find('.picker-items-col').each(function () {
|
|
576
|
-
var updateItems = true;
|
|
577
|
-
if (!p.initialized && p.params.value || p.initialized && p.value) updateItems = false;
|
|
578
|
-
p.initPickerCol(this, updateItems);
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
// Set value
|
|
582
|
-
if (!p.initialized) {
|
|
583
|
-
if (p.params.value) {
|
|
584
|
-
p.setValue(p.params.value, 0);
|
|
585
|
-
}
|
|
586
|
-
} else {
|
|
587
|
-
if (p.value) p.setValue(p.value, 0);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// Set flag
|
|
592
|
-
p.initialized = true;
|
|
593
|
-
|
|
594
|
-
if (p.params.onOpen) p.params.onOpen(p);
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
// Close
|
|
598
|
-
p.close = function () {
|
|
599
|
-
if (!p.opened || p.inline) return;
|
|
600
|
-
if (!p.params.updateValue) {
|
|
601
|
-
p.updateValue();
|
|
602
|
-
}
|
|
603
|
-
(0, _modal.closeModal)(p.container);
|
|
604
|
-
return;
|
|
605
|
-
};
|
|
606
|
-
|
|
607
|
-
// Destroy
|
|
608
|
-
p.destroy = function () {
|
|
609
|
-
p.close();
|
|
610
|
-
if (p.params.input && p.input.length > 0) {
|
|
611
|
-
p.input.off('click', openOnInput);
|
|
612
|
-
}
|
|
613
|
-
$('html').off('click', closeOnHTMLClick);
|
|
614
|
-
$(window).off('resize', resizeCols);
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
if (p.inline) {
|
|
618
|
-
p.open();
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
$(document).on("click", ".close-picker", function () {
|
|
622
|
-
p.close();
|
|
623
|
-
});
|
|
624
|
-
|
|
625
|
-
return p;
|
|
626
|
-
};
|
|
627
|
-
|
|
628
|
-
/*$(document).on("click", ".close-picker", function() {
|
|
629
|
-
var pickerToClose = $('.picker-modal.modal-in');
|
|
630
|
-
closeModal(pickerToClose);
|
|
631
|
-
});*/
|
|
632
|
-
|
|
633
|
-
$.fn.picker = function (params) {
|
|
634
|
-
var args = arguments;
|
|
635
|
-
return this.each(function () {
|
|
636
|
-
if (!this) return;
|
|
637
|
-
var $this = $(this);
|
|
638
|
-
|
|
639
|
-
var picker = $this.data("picker");
|
|
640
|
-
if (!picker) {
|
|
641
|
-
var p = $.extend({
|
|
642
|
-
input: this,
|
|
643
|
-
value: $this.val() ? $this.val().split(' ') : ''
|
|
644
|
-
}, params);
|
|
645
|
-
picker = new Picker(p);
|
|
646
|
-
$this.data("picker", picker);
|
|
647
|
-
}
|
|
648
|
-
if ((typeof params === 'undefined' ? 'undefined' : _typeof(params)) === _typeof("a")) {
|
|
649
|
-
if (typeof picker[params] === 'function') {
|
|
650
|
-
picker[params].apply(picker, Array.prototype.slice.call(args, 1));
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
exports.default = function (picker, params) {
|
|
657
|
-
var args = _arguments;
|
|
658
|
-
var $this = $(picker);
|
|
659
|
-
if (!$this) return;
|
|
660
|
-
return $this.each(function () {
|
|
661
|
-
|
|
662
|
-
var picker = $this.data("picker");
|
|
663
|
-
if (!picker) {
|
|
664
|
-
var p = $.extend({
|
|
665
|
-
input: this,
|
|
666
|
-
value: $this.val() ? $this.val().split(' ') : ''
|
|
667
|
-
}, params);
|
|
668
|
-
picker = new Picker(p);
|
|
669
|
-
$this.data("picker", picker);
|
|
670
|
-
}
|
|
671
|
-
if ((typeof params === 'undefined' ? 'undefined' : _typeof(params)) === _typeof("a")) {
|
|
672
|
-
picker[params].apply(picker, Array.prototype.slice.call(args, 1));
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
/***/ })
|
|
678
|
-
|
|
679
|
-
},[222]);
|
|
680
|
-
});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.fastman=t():e.fastman=t()}(this,function(){return webpackJsonpfastman([21],{222:function(e,t,a){e.exports=a(30)},30:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=arguments,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=a(10),o=function(e,t){if(void 0===t&&(t=!0),"string"==typeof e&&e.indexOf("<")>=0){if(e=$(e),!(e.length>0))return!1;t&&e.addClass("remove-on-close"),$(r.defaults.modalContainer).append(e[0])}return e=$(e),0!==e.length&&(e.show(),(0,r.openModal)(e),e[0])},s=function(e){function t(){if(s.opened)for(var e=0;e<s.cols.length;e++)s.cols[e].divider||(s.cols[e].calcSize(),s.cols[e].setValue(s.cols[e].value,0,!1))}function a(e){if(e.preventDefault(),$.device.isWeixin&&$.device.android&&s.params.inputReadOnly&&(this.focus(),this.blur()),!s.opened){if((0,r.closeModal)($(".picker-modal")),s.open(),s.params.scrollToInput){var t=s.input.parents(".content");if(0===t.length)return;var a,n=parseInt(t.css("padding-top"),10),i=parseInt(t.css("padding-bottom"),10),o=t[0].offsetHeight-n-s.container.height(),l=t[0].scrollHeight-n-s.container.height(),c=s.input.offset().top-n+s.input[0].offsetHeight;if(c>o){var p=t.scrollTop()+c-o;p+o>l&&(a=p+o-l+i,o===l&&(a=s.container.height()),t.css({"padding-bottom":a+"px"})),t.scrollTop(p,300)}}e.stopPropagation()}}function n(e){s.opened&&(s.closeFromOverlay=!1,s.input&&s.input.length>0?e.target!==s.input[0]&&0===$(e.target).parents(".picker-modal").length&&(s.closeFromOverlay=!0,(0,r.closeModal)(s.container)):0===$(e.target).parents(".picker-modal").length&&(s.closeFromOverlay=!0,(0,r.closeModal)(s.container)))}function i(){s.opened=!1,s.input&&s.input.length>0&&s.input.parents(".content").css({"padding-bottom":""}),s.params.onClose&&s.params.onClose(s),s.container.find(".picker-items-col").each(function(){s.destroyPickerCol(this)})}var s=this,l={updateValuesOnMomentum:!1,updateValuesOnTouchmove:!0,rotateEffect:!1,momentumRatio:7,freeMode:!1,scrollToInput:!0,inputReadOnly:!0,toolbar:!0,toolbarCloseText:"确定",toolbarTemplate:'<header class="bar bar-nav"> <button class="button button-link pull-right close-picker">确定</button> <h1 class="title">请选择</h1> </header>',updateValue:!0};e=e||{};for(var c in l)void 0===e[c]&&(e[c]=l[c]);s.params=e,s.cols=[],s.initialized=!1,s.inline=!!s.params.container;var p=$.device.ios||navigator.userAgent.toLowerCase().indexOf("safari")>=0&&navigator.userAgent.toLowerCase().indexOf("chrome")<0&&!$.device.android;return s.setValue=function(e,t){for(var a=0,n=0;n<s.cols.length;n++)s.cols[n]&&!s.cols[n].divider&&(s.cols[n].setValue(e[a],t),a++)},s.updateValue=function(){for(var e=[],t=[],a=0;a<s.cols.length;a++)s.cols[a].divider||(e.push(s.cols[a].value),t.push(s.cols[a].displayValue));e.indexOf(void 0)>=0||(s.value=e,s.displayValue=t,s.params.onChange&&s.params.onChange(s,s.value,s.displayValue),s.input&&s.input.length>0&&($(s.input).val(s.params.formatValue?s.params.formatValue(s,s.value,s.displayValue):s.value.join(" ")),$(s.input).trigger("change")))},s.initPickerCol=function(e,t){function a(){g=$.requestAnimationFrame(function(){u.updateItems(void 0,void 0,0),a()})}function n(e){w||y||(e.preventDefault(),y=!0,x=b="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY,V=(new Date).getTime(),H=!0,k=C=O=$.getTranslate(u.wrapper[0],"y"))}function i(e){if(y){e.preventDefault(),H=!1,b="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,w||($.cancelAnimationFrame(g),w=!0,C=O=$.getTranslate(u.wrapper[0],"y"),u.wrapper.transition(0)),e.preventDefault();O=C+(b-x),T=void 0,O<v&&(O=v-Math.pow(v-O,.8),T="min"),O>h&&(O=h+Math.pow(O-h,.8),T="max"),u.wrapper.transform("translate3d(0,"+O+"px,0)"),u.updateItems(void 0,O,0,s.params.updateValuesOnTouchmove),I=O-E||O,A=(new Date).getTime(),E=O}}function r(e){if(!y||!w)return void(y=w=!1);y=w=!1,u.wrapper.transition(""),T&&("min"===T?u.wrapper.transform("translate3d(0,"+v+"px,0)"):u.wrapper.transform("translate3d(0,"+h+"px,0)")),M=(new Date).getTime();var t;M-V>300?t=O:(Math.abs(I/(M-A)),t=O+I*s.params.momentumRatio),t=Math.max(Math.min(t,h),v);var n,i=(t-h)%f;n=k>t&&Math.abs(i+f)<f/2||k<t&&Math.abs(i+f)<f/2?-Math.floor((t-h)/f):-Math.ceil((t-h)/f),s.params.freeMode||(t=-n*f+h),u.wrapper.transform("translate3d(0,"+parseInt(t,10)+"px,0)"),u.updateItems(n,t,"",!0),s.params.updateValuesOnMomentum&&(a(),u.wrapper.transitionEnd(function(){$.cancelAnimationFrame(g)})),setTimeout(function(){H=!0},100)}function o(e){if(H){$.cancelAnimationFrame(g);var t=$(this).attr("data-picker-value");u.setValue(t)}}var l=$(e),c=l.index(),u=s.cols[c];if(!u.divider){u.container=l,u.wrapper=u.container.find(".picker-items-col-wrapper"),u.items=u.wrapper.find(".picker-item");var d,f,m,v,h;u.replaceValues=function(e,t){u.destroyEvents(),u.values=e,u.displayValues=t;var a=s.columnHTML(u,!0);u.wrapper.html(a),u.items=u.wrapper.find(".picker-item"),u.calcSize(),u.setValue(u.values[0],0,!0),u.initEvents()},u.calcSize=function(){s.params.rotateEffect&&(u.container.removeClass("picker-items-col-absolute"),u.width||u.container.css({width:""}));var e,t;e=0,t=u.container[0].offsetHeight,d=u.wrapper[0].offsetHeight,f=u.items[0].offsetHeight,m=f*u.items.length,v=t/2-m+f/2,h=t/2-f/2,u.width&&(e=u.width,parseInt(e,10)===e&&(e+="px"),u.container.css({width:e})),s.params.rotateEffect&&(u.width||(u.items.each(function(){var t=$(this);t.css({width:"auto"}),e=Math.max(e,t[0].offsetWidth),t.css({width:""})}),u.container.css({width:e+2+"px"})),u.container.addClass("picker-items-col-absolute"))},u.calcSize(),u.wrapper.transform("translate3d(0,"+h+"px,0)").transition(0);var g;u.setValue=function(e,t,n){void 0===t&&(t="");var i=u.wrapper.find('.picker-item[data-picker-value="'+e+'"]').index();if(void 0!==i&&-1!==i){var r=-i*f+h;u.wrapper.transition(t),u.wrapper.transform("translate3d(0,"+r+"px,0)"),s.params.updateValuesOnMomentum&&u.activeIndex&&u.activeIndex!==i&&($.cancelAnimationFrame(g),u.wrapper.transitionEnd(function(){$.cancelAnimationFrame(g)}),a()),u.updateItems(i,r,t,n)}},u.updateItems=function(e,t,a,n){void 0===t&&(t=$.getTranslate(u.wrapper[0],"y")),void 0===e&&(e=-Math.round((t-h)/f)),e<0&&(e=0),e>=u.items.length&&(e=u.items.length-1);var i=u.activeIndex;u.activeIndex=e,u.wrapper.find(".picker-selected").removeClass("picker-selected"),s.params.rotateEffect&&u.items.transition(a);var r=u.items.eq(e).addClass("picker-selected").transform("");if((n||void 0===n)&&(u.value=r.attr("data-picker-value"),u.displayValue=u.displayValues?u.displayValues[e]:u.value,i!==e&&(u.onChange&&u.onChange(s,u.value,u.displayValue),s.params.updateValue&&s.updateValue())),s.params.rotateEffect){Math.floor((t-h)/f);u.items.each(function(){var e=$(this),a=e.index()*f,n=h-t,i=a-n,r=i/f,o=Math.ceil(u.height/f/2)+1,s=-18*r;s>180&&(s=180),s<-180&&(s=-180),Math.abs(r)>o?e.addClass("picker-item-far"):e.removeClass("picker-item-far"),e.transform("translate3d(0, "+(-t+h)+"px, "+(p?-110:0)+"px) rotateX("+s+"deg)")})}},t&&u.updateItems(0,h,0);var k,y,w,x,b,V,M,C,T,O,E,I,A,H=!0;u.initEvents=function(e){var t=e?"off":"on";u.container[t]($.touchEvents.start,n),u.container[t]($.touchEvents.move,i),u.container[t]($.touchEvents.end,r),u.items[t]("click",o)},u.destroyEvents=function(){u.initEvents(!0)},u.container[0].f7DestroyPickerCol=function(){u.destroyEvents()},u.initEvents()}},s.destroyPickerCol=function(e){e=$(e),"f7DestroyPickerCol"in e[0]&&e[0].f7DestroyPickerCol()},$(window).on("resize",t),s.columnHTML=function(e,t){var a="",n="";if(e.divider)n+='<div class="picker-items-col picker-items-col-divider '+(e.textAlign?"picker-items-col-"+e.textAlign:"")+" "+(e.cssClass||"")+'">'+e.content+"</div>";else{for(var i=0;i<e.values.length;i++)a+='<div class="picker-item" data-picker-value="'+e.values[i]+'">'+(e.displayValues?e.displayValues[i]:e.values[i])+"</div>";n+='<div class="picker-items-col '+(e.textAlign?"picker-items-col-"+e.textAlign:"")+" "+(e.cssClass||"")+'"><div class="picker-items-col-wrapper">'+a+"</div></div>"}return t?a:n},s.layout=function(){var e,t="",a="";s.cols=[];var n="";for(e=0;e<s.params.cols.length;e++){var i=s.params.cols[e];n+=s.columnHTML(s.params.cols[e]),s.cols.push(i)}a="picker-modal picker-columns "+(s.params.cssClass||"")+(s.params.rotateEffect?" picker-3d":""),t='<div class="'+a+'">'+(s.params.toolbar?s.params.toolbarTemplate.replace(/{{closeText}}/g,s.params.toolbarCloseText):"")+'<div class="picker-modal-inner picker-items">'+n+'<div class="picker-center-highlight"></div></div></div>',s.pickerHTML=t},s.params.input&&(s.input=$(s.params.input),s.input.length>0&&(s.params.inputReadOnly&&s.input.prop("readOnly",!0),s.inline||s.input.on("click",a))),s.inline||$("html").on("click",n),s.opened=!1,s.open=function(){s.opened||(s.layout(),s.opened=!0,s.inline?(s.container=$(s.pickerHTML),s.container.addClass("picker-modal-inline"),$(s.params.container).append(s.container)):(s.container=$(o(s.pickerHTML)),$(s.container).on("touchmove",function(e){return!1}),$(s.container).on("close",function(){i()})),s.container[0].f7Picker=s,s.container.find(".picker-items-col").each(function(){var e=!0;(!s.initialized&&s.params.value||s.initialized&&s.value)&&(e=!1),s.initPickerCol(this,e)}),s.initialized?s.value&&s.setValue(s.value,0):s.params.value&&s.setValue(s.params.value,0)),s.initialized=!0,s.params.onOpen&&s.params.onOpen(s)},s.close=function(){s.opened&&!s.inline&&(s.params.updateValue||s.updateValue(),(0,r.closeModal)(s.container))},s.destroy=function(){s.close(),s.params.input&&s.input.length>0&&s.input.off("click",a),$("html").off("click",n),$(window).off("resize",t)},s.inline&&s.open(),$(document).on("click",".close-picker",function(){s.close()}),s};$.fn.picker=function(e){var t=arguments;return this.each(function(){if(this){var a=$(this),n=a.data("picker");if(!n){var r=$.extend({input:this,value:a.val()?a.val().split(" "):""},e);n=new s(r),a.data("picker",n)}(void 0===e?"undefined":i(e))===i("a")&&"function"==typeof n[e]&&n[e].apply(n,Array.prototype.slice.call(t,1))}})},t.default=function(e,t){var a=n,r=$(e);if(r)return r.each(function(){var e=r.data("picker");if(!e){var n=$.extend({input:this,value:r.val()?r.val().split(" "):""},t);e=new s(n),r.data("picker",e)}(void 0===t?"undefined":i(t))===i("a")&&e[t].apply(e,Array.prototype.slice.call(a,1))})}}},[222])});
|