materialize-sass 1.0.0.alpha4 → 1.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/Rakefile +1 -2
- data/assets/javascripts/materialize.js +881 -608
- data/assets/javascripts/materialize/autocomplete.js +36 -16
- data/assets/javascripts/materialize/carousel.js +42 -34
- data/assets/javascripts/materialize/chips.js +3 -1
- data/assets/javascripts/materialize/collapsible.js +31 -8
- data/assets/javascripts/materialize/datepicker.js +38 -29
- data/assets/javascripts/materialize/dropdown.js +112 -24
- data/assets/javascripts/materialize/forms.js +2 -2
- data/assets/javascripts/materialize/global.js +35 -0
- data/assets/javascripts/materialize/modal.js +26 -1
- data/assets/javascripts/materialize/select.js +10 -0
- data/assets/javascripts/materialize/sidenav.js +30 -9
- data/assets/javascripts/materialize/slider.js +3 -1
- data/assets/javascripts/materialize/tabs.js +6 -0
- data/assets/javascripts/materialize/tapTarget.js +19 -19
- data/assets/javascripts/materialize/timepicker.js +584 -579
- data/assets/javascripts/materialize/tooltip.js +31 -12
- data/assets/stylesheets/materialize/components/_cards.scss +2 -1
- data/assets/stylesheets/materialize/components/_datepicker.scss +1 -0
- data/assets/stylesheets/materialize/components/_tabs.scss +7 -1
- data/assets/stylesheets/materialize/components/forms/_input-fields.scss +7 -5
- data/assets/stylesheets/materialize/components/forms/_select.scss +0 -14
- data/lib/materialize-sass/version.rb +1 -1
- metadata +2 -2
@@ -52,7 +52,9 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
52
52
|
// setup
|
53
53
|
_this.$slider = _this.$el.find('.slides');
|
54
54
|
_this.$slides = _this.$slider.children('li');
|
55
|
-
_this.activeIndex = _this.$
|
55
|
+
_this.activeIndex = _this.$slides.filter(function (item) {
|
56
|
+
return $(item).hasClass('active');
|
57
|
+
}).first().index();
|
56
58
|
if (_this.activeIndex != -1) {
|
57
59
|
_this.$active = _this.$slides.eq(_this.activeIndex);
|
58
60
|
}
|
@@ -277,6 +277,9 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
277
277
|
$tabsWrapper.append($tabsContent);
|
278
278
|
$tabsContent[0].style.display = '';
|
279
279
|
|
280
|
+
// Keep active tab index to set initial carousel slide
|
281
|
+
var activeTabIndex = this.$activeTabLink.closest('.tab').index();
|
282
|
+
|
280
283
|
this._tabsCarousel = M.Carousel.init($tabsWrapper[0], {
|
281
284
|
fullWidth: true,
|
282
285
|
noWrap: true,
|
@@ -292,6 +295,9 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
292
295
|
}
|
293
296
|
}
|
294
297
|
});
|
298
|
+
|
299
|
+
// Set initial carousel slide to active tab
|
300
|
+
this._tabsCarousel.set(activeTabIndex);
|
295
301
|
}
|
296
302
|
|
297
303
|
/**
|
@@ -21,29 +21,29 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
21
21
|
*
|
22
22
|
*/
|
23
23
|
|
24
|
-
var
|
25
|
-
_inherits(
|
24
|
+
var TapTarget = function (_Component) {
|
25
|
+
_inherits(TapTarget, _Component);
|
26
26
|
|
27
27
|
/**
|
28
|
-
* Construct
|
28
|
+
* Construct TapTarget instance
|
29
29
|
* @constructor
|
30
30
|
* @param {Element} el
|
31
31
|
* @param {Object} options
|
32
32
|
*/
|
33
|
-
function
|
34
|
-
_classCallCheck(this,
|
33
|
+
function TapTarget(el, options) {
|
34
|
+
_classCallCheck(this, TapTarget);
|
35
35
|
|
36
|
-
var _this = _possibleConstructorReturn(this, (
|
36
|
+
var _this = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options));
|
37
37
|
|
38
|
-
_this.el.
|
38
|
+
_this.el.M_TapTarget = _this;
|
39
39
|
|
40
40
|
/**
|
41
41
|
* Options for the select
|
42
|
-
* @member
|
42
|
+
* @member TapTarget#options
|
43
43
|
* @prop {Function} onOpen - Callback function called when feature discovery is opened
|
44
44
|
* @prop {Function} onClose - Callback function called when feature discovery is closed
|
45
45
|
*/
|
46
|
-
_this.options = $.extend({},
|
46
|
+
_this.options = $.extend({}, TapTarget.defaults, options);
|
47
47
|
|
48
48
|
_this.isOpen = false;
|
49
49
|
|
@@ -56,7 +56,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
56
56
|
return _this;
|
57
57
|
}
|
58
58
|
|
59
|
-
_createClass(
|
59
|
+
_createClass(TapTarget, [{
|
60
60
|
key: 'destroy',
|
61
61
|
|
62
62
|
|
@@ -65,7 +65,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
65
65
|
*/
|
66
66
|
value: function destroy() {
|
67
67
|
this._removeEventHandlers();
|
68
|
-
this.el.
|
68
|
+
this.el.TapTarget = undefined;
|
69
69
|
}
|
70
70
|
|
71
71
|
/**
|
@@ -150,7 +150,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
150
150
|
}
|
151
151
|
|
152
152
|
/**
|
153
|
-
* Setup
|
153
|
+
* Setup Tap Target
|
154
154
|
*/
|
155
155
|
|
156
156
|
}, {
|
@@ -286,7 +286,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
286
286
|
}
|
287
287
|
|
288
288
|
/**
|
289
|
-
* Open
|
289
|
+
* Open TapTarget
|
290
290
|
*/
|
291
291
|
|
292
292
|
}, {
|
@@ -309,7 +309,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
309
309
|
}
|
310
310
|
|
311
311
|
/**
|
312
|
-
* Close
|
312
|
+
* Close Tap Target
|
313
313
|
*/
|
314
314
|
|
315
315
|
}, {
|
@@ -333,7 +333,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
333
333
|
}], [{
|
334
334
|
key: 'init',
|
335
335
|
value: function init(els, options) {
|
336
|
-
return _get(
|
336
|
+
return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), 'init', this).call(this, this, els, options);
|
337
337
|
}
|
338
338
|
|
339
339
|
/**
|
@@ -344,7 +344,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
344
344
|
key: 'getInstance',
|
345
345
|
value: function getInstance(el) {
|
346
346
|
var domElem = !!el.jquery ? el[0] : el;
|
347
|
-
return domElem.
|
347
|
+
return domElem.M_TapTarget;
|
348
348
|
}
|
349
349
|
}, {
|
350
350
|
key: 'defaults',
|
@@ -353,12 +353,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
353
353
|
}
|
354
354
|
}]);
|
355
355
|
|
356
|
-
return
|
356
|
+
return TapTarget;
|
357
357
|
}(Component);
|
358
358
|
|
359
|
-
M.
|
359
|
+
M.TapTarget = TapTarget;
|
360
360
|
|
361
361
|
if (M.jQueryLoaded) {
|
362
|
-
M.initializeJqueryWrapper(
|
362
|
+
M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget');
|
363
363
|
}
|
364
364
|
})(cash);
|
@@ -9,617 +9,622 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
|
9
9
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
10
10
|
|
11
11
|
(function ($) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var _defaults = {
|
15
|
+
dialRadius: 135,
|
16
|
+
outerRadius: 105,
|
17
|
+
innerRadius: 70,
|
18
|
+
tickRadius: 20,
|
19
|
+
duration: 350,
|
20
|
+
container: null,
|
21
|
+
defaultTime: 'now', // default time, 'now' or '13:14' e.g.
|
22
|
+
fromNow: 0, // Millisecond offset from the defaultTime
|
23
|
+
showClearBtn: false,
|
24
|
+
|
25
|
+
// internationalization
|
26
|
+
i18n: {
|
27
|
+
cancel: 'Cancel',
|
28
|
+
clear: 'Clear',
|
29
|
+
done: 'Ok'
|
30
|
+
},
|
31
|
+
|
32
|
+
autoClose: false, // auto close when minute is selected
|
33
|
+
twelveHour: true, // change to 12 hour AM/PM clock from 24 hour
|
34
|
+
vibrate: true // vibrate the device when dragging clock hand
|
35
|
+
};
|
36
|
+
|
37
|
+
/**
|
37
38
|
* @class
|
38
39
|
*
|
39
40
|
*/
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
var Timepicker = function (_Component) {
|
43
|
+
_inherits(Timepicker, _Component);
|
43
44
|
|
44
|
-
|
45
|
-
|
45
|
+
function Timepicker(el, options) {
|
46
|
+
_classCallCheck(this, Timepicker);
|
46
47
|
|
47
|
-
|
48
|
+
var _this = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options));
|
48
49
|
|
49
|
-
|
50
|
+
_this.el.M_Timepicker = _this;
|
50
51
|
|
51
|
-
|
52
|
+
_this.options = $.extend({}, Timepicker.defaults, options);
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
_this.id = M.guid();
|
55
|
+
_this._insertHTMLIntoDOM();
|
56
|
+
_this._setupModal();
|
57
|
+
_this._setupVariables();
|
58
|
+
_this._setupEventHandlers();
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
_this._clockSetup();
|
61
|
+
_this._pickerSetup();
|
62
|
+
return _this;
|
63
|
+
}
|
63
64
|
|
64
|
-
|
65
|
-
|
65
|
+
_createClass(Timepicker, [{
|
66
|
+
key: 'destroy',
|
66
67
|
|
67
68
|
|
68
|
-
|
69
|
+
/**
|
69
70
|
* Teardown component
|
70
71
|
*/
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
value: function destroy() {
|
73
|
+
this._removeEventHandlers();
|
74
|
+
this.modal.destroy();
|
75
|
+
$(this.modalEl).remove();
|
76
|
+
this.el.M_Timepicker = undefined;
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
79
80
|
* Setup Event Handlers
|
80
81
|
*/
|
81
82
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
83
|
+
}, {
|
84
|
+
key: '_setupEventHandlers',
|
85
|
+
value: function _setupEventHandlers() {
|
86
|
+
this._handleInputKeydownBound = this._handleInputKeydown.bind(this);
|
87
|
+
this._handleInputClickBound = this._handleInputClick.bind(this);
|
88
|
+
this._handleClockClickStartBound = this._handleClockClickStart.bind(this);
|
89
|
+
this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this);
|
90
|
+
this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this);
|
91
|
+
|
92
|
+
this.el.addEventListener('click', this._handleInputClickBound);
|
93
|
+
this.el.addEventListener('keydown', this._handleInputKeydownBound);
|
94
|
+
this.plate.addEventListener('mousedown', this._handleClockClickStartBound);
|
95
|
+
this.plate.addEventListener('touchstart', this._handleClockClickStartBound);
|
96
|
+
|
97
|
+
$(this.spanHours).on('click', this.showView.bind(this, 'hours'));
|
98
|
+
$(this.spanMinutes).on('click', this.showView.bind(this, 'minutes'));
|
99
|
+
}
|
100
|
+
}, {
|
101
|
+
key: '_removeEventHandlers',
|
102
|
+
value: function _removeEventHandlers() {
|
103
|
+
this.el.removeEventListener('click', this._handleInputClickBound);
|
104
|
+
this.el.removeEventListener('keydown', this._handleInputKeydownBound);
|
105
|
+
}
|
106
|
+
}, {
|
107
|
+
key: '_handleInputClick',
|
108
|
+
value: function _handleInputClick() {
|
109
|
+
this.open();
|
110
|
+
}
|
111
|
+
}, {
|
112
|
+
key: '_handleInputKeydown',
|
113
|
+
value: function _handleInputKeydown(e) {
|
114
|
+
if (e.which === M.keys.ENTER) {
|
115
|
+
e.preventDefault();
|
116
|
+
this.open();
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}, {
|
120
|
+
key: '_handleClockClickStart',
|
121
|
+
value: function _handleClockClickStart(e) {
|
122
|
+
e.preventDefault();
|
123
|
+
var clockPlateBR = this.plate.getBoundingClientRect();
|
124
|
+
var offset = { x: clockPlateBR.left, y: clockPlateBR.top };
|
125
|
+
|
126
|
+
this.x0 = offset.x + this.options.dialRadius;
|
127
|
+
this.y0 = offset.y + this.options.dialRadius;
|
128
|
+
this.moved = false;
|
129
|
+
var clickPos = Timepicker._Pos(e);
|
130
|
+
this.dx = clickPos.x - this.x0;
|
131
|
+
this.dy = clickPos.y - this.y0;
|
132
|
+
|
133
|
+
// Set clock hands
|
134
|
+
this.setHand(this.dx, this.dy, false);
|
135
|
+
|
136
|
+
// Mousemove on document
|
137
|
+
document.addEventListener('mousemove', this._handleDocumentClickMoveBound);
|
138
|
+
document.addEventListener('touchmove', this._handleDocumentClickMoveBound);
|
139
|
+
|
140
|
+
// Mouseup on document
|
141
|
+
document.addEventListener('mouseup', this._handleDocumentClickEndBound);
|
142
|
+
document.addEventListener('touchend', this._handleDocumentClickEndBound);
|
143
|
+
}
|
144
|
+
}, {
|
145
|
+
key: '_handleDocumentClickMove',
|
146
|
+
value: function _handleDocumentClickMove(e) {
|
147
|
+
e.preventDefault();
|
148
|
+
var clickPos = Timepicker._Pos(e);
|
149
|
+
var x = clickPos.x - this.x0;
|
150
|
+
var y = clickPos.y - this.y0;
|
151
|
+
this.moved = true;
|
152
|
+
this.setHand(x, y, false, true);
|
153
|
+
}
|
154
|
+
}, {
|
155
|
+
key: '_handleDocumentClickEnd',
|
156
|
+
value: function _handleDocumentClickEnd(e) {
|
157
|
+
var _this2 = this;
|
158
|
+
|
159
|
+
e.preventDefault();
|
160
|
+
document.removeEventListener('mouseup', this._handleDocumentClickEndBound);
|
161
|
+
document.removeEventListener('touchend', this._handleDocumentClickEndBound);
|
162
|
+
var clickPos = Timepicker._Pos(e);
|
163
|
+
var x = clickPos.x - this.x0;
|
164
|
+
var y = clickPos.y - this.y0;
|
165
|
+
if (this.moved && x === this.dx && y === this.dy) {
|
166
|
+
this.setHand(x, y);
|
167
|
+
}
|
168
|
+
|
169
|
+
if (this.currentView === 'hours') {
|
170
|
+
this.showView('minutes', this.options.duration / 2);
|
171
|
+
} else if (this.options.autoClose) {
|
172
|
+
$(this.minutesView).addClass('timepicker-dial-out');
|
173
|
+
setTimeout(function () {
|
174
|
+
_this2.done();
|
175
|
+
}, this.options.duration / 2);
|
176
|
+
}
|
177
|
+
|
178
|
+
// Unbind mousemove event
|
179
|
+
document.removeEventListener('mousemove', this._handleDocumentClickMoveBound);
|
180
|
+
document.removeEventListener('touchmove', this._handleDocumentClickMoveBound);
|
181
|
+
}
|
182
|
+
}, {
|
183
|
+
key: '_insertHTMLIntoDOM',
|
184
|
+
value: function _insertHTMLIntoDOM() {
|
185
|
+
this.$modalEl = $(Timepicker._template);
|
186
|
+
this.modalEl = this.$modalEl[0];
|
187
|
+
this.modalEl.id = 'modal-' + this.id;
|
188
|
+
|
189
|
+
// Append popover to input by default
|
190
|
+
var containerEl = document.querySelector(this.options.container);
|
191
|
+
if (this.options.container && !!containerEl) {
|
192
|
+
this.$modalEl.appendTo(containerEl);
|
193
|
+
} else {
|
194
|
+
this.$modalEl.insertBefore(this.el);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}, {
|
198
|
+
key: '_setupModal',
|
199
|
+
value: function _setupModal() {
|
200
|
+
var _this3 = this;
|
201
|
+
|
202
|
+
this.modal = M.Modal.init(this.modalEl, {
|
203
|
+
onCloseEnd: function () {
|
204
|
+
_this3.isOpen = false;
|
205
|
+
}
|
206
|
+
});
|
207
|
+
}
|
208
|
+
}, {
|
209
|
+
key: '_setupVariables',
|
210
|
+
value: function _setupVariables() {
|
211
|
+
this.currentView = 'hours';
|
212
|
+
this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
|
213
|
+
|
214
|
+
this._canvas = this.modalEl.querySelector('.timepicker-canvas');
|
215
|
+
this.plate = this.modalEl.querySelector('.timepicker-plate');
|
216
|
+
|
217
|
+
this.hoursView = this.modalEl.querySelector('.timepicker-hours');
|
218
|
+
this.minutesView = this.modalEl.querySelector('.timepicker-minutes');
|
219
|
+
this.spanHours = this.modalEl.querySelector('.timepicker-span-hours');
|
220
|
+
this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes');
|
221
|
+
this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm');
|
222
|
+
this.footer = this.modalEl.querySelector('.timepicker-footer');
|
223
|
+
this.amOrPm = 'PM';
|
224
|
+
}
|
225
|
+
}, {
|
226
|
+
key: '_pickerSetup',
|
227
|
+
value: function _pickerSetup() {
|
228
|
+
|
229
|
+
var $clearBtn = $('<button class="btn-flat timepicker-clear waves-effect" style="visibility: hidden;" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.clear + '</button>').appendTo(this.footer).on('click', this.clear.bind(this));
|
230
|
+
if (this.options.showClearBtn) {
|
231
|
+
$clearBtn.css({ visibility: '' });
|
232
|
+
}
|
233
|
+
|
234
|
+
var confirmationBtnsContainer = $('<div class="confirmation-btns"></div>');
|
235
|
+
$('<button class="btn-flat timepicker-close waves-effect" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.cancel + '</button>').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this));
|
236
|
+
$('<button class="btn-flat timepicker-close waves-effect" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.done + '</button>').appendTo(confirmationBtnsContainer).on('click', this.done.bind(this));
|
237
|
+
confirmationBtnsContainer.appendTo(this.footer);
|
238
|
+
}
|
239
|
+
}, {
|
240
|
+
key: '_clockSetup',
|
241
|
+
value: function _clockSetup() {
|
242
|
+
if (this.options.twelveHour) {
|
243
|
+
this.$amBtn = $('<div class="am-btn">AM</div>');
|
244
|
+
this.$pmBtn = $('<div class="pm-btn">PM</div>');
|
245
|
+
this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm);
|
246
|
+
this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm);
|
247
|
+
}
|
248
|
+
|
249
|
+
this._buildHoursView();
|
250
|
+
this._buildMinutesView();
|
251
|
+
this._buildSVGClock();
|
252
|
+
}
|
253
|
+
}, {
|
254
|
+
key: '_buildSVGClock',
|
255
|
+
value: function _buildSVGClock() {
|
256
|
+
// Draw clock hands and others
|
257
|
+
var dialRadius = this.options.dialRadius;
|
258
|
+
var tickRadius = this.options.tickRadius;
|
259
|
+
var diameter = dialRadius * 2;
|
260
|
+
|
261
|
+
var svg = Timepicker._createSVGEl('svg');
|
262
|
+
svg.setAttribute('class', 'timepicker-svg');
|
263
|
+
svg.setAttribute('width', diameter);
|
264
|
+
svg.setAttribute('height', diameter);
|
265
|
+
var g = Timepicker._createSVGEl('g');
|
266
|
+
g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
|
267
|
+
var bearing = Timepicker._createSVGEl('circle');
|
268
|
+
bearing.setAttribute('class', 'timepicker-canvas-bearing');
|
269
|
+
bearing.setAttribute('cx', 0);
|
270
|
+
bearing.setAttribute('cy', 0);
|
271
|
+
bearing.setAttribute('r', 4);
|
272
|
+
var hand = Timepicker._createSVGEl('line');
|
273
|
+
hand.setAttribute('x1', 0);
|
274
|
+
hand.setAttribute('y1', 0);
|
275
|
+
var bg = Timepicker._createSVGEl('circle');
|
276
|
+
bg.setAttribute('class', 'timepicker-canvas-bg');
|
277
|
+
bg.setAttribute('r', tickRadius);
|
278
|
+
g.appendChild(hand);
|
279
|
+
g.appendChild(bg);
|
280
|
+
g.appendChild(bearing);
|
281
|
+
svg.appendChild(g);
|
282
|
+
this._canvas.appendChild(svg);
|
283
|
+
|
284
|
+
this.hand = hand;
|
285
|
+
this.bg = bg;
|
286
|
+
this.bearing = bearing;
|
287
|
+
this.g = g;
|
288
|
+
}
|
289
|
+
}, {
|
290
|
+
key: '_buildHoursView',
|
291
|
+
value: function _buildHoursView() {
|
292
|
+
var $tick = $('<div class="timepicker-tick"></div>');
|
293
|
+
// Hours view
|
294
|
+
if (this.options.twelveHour) {
|
295
|
+
for (var i = 1; i < 13; i += 1) {
|
296
|
+
var tick = $tick.clone();
|
297
|
+
var radian = i / 6 * Math.PI;
|
298
|
+
var radius = this.options.outerRadius;
|
299
|
+
tick.css({
|
300
|
+
left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px',
|
301
|
+
top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px'
|
302
|
+
});
|
303
|
+
tick.html(i === 0 ? '00' : i);
|
304
|
+
this.hoursView.appendChild(tick[0]);
|
305
|
+
// tick.on(mousedownEvent, mousedown);
|
306
|
+
}
|
307
|
+
} else {
|
308
|
+
for (var _i = 0; _i < 24; _i += 1) {
|
309
|
+
var _tick = $tick.clone();
|
310
|
+
var _radian = _i / 6 * Math.PI;
|
311
|
+
var inner = _i > 0 && _i < 13;
|
312
|
+
var _radius = inner ? this.options.innerRadius : this.options.outerRadius;
|
313
|
+
_tick.css({
|
314
|
+
left: this.options.dialRadius + Math.sin(_radian) * _radius - this.options.tickRadius + 'px',
|
315
|
+
top: this.options.dialRadius - Math.cos(_radian) * _radius - this.options.tickRadius + 'px'
|
316
|
+
});
|
317
|
+
_tick.html(_i === 0 ? '00' : _i);
|
318
|
+
this.hoursView.appendChild(_tick[0]);
|
319
|
+
// tick.on(mousedownEvent, mousedown);
|
320
|
+
}
|
321
|
+
}
|
322
|
+
}
|
323
|
+
}, {
|
324
|
+
key: '_buildMinutesView',
|
325
|
+
value: function _buildMinutesView() {
|
326
|
+
var $tick = $('<div class="timepicker-tick"></div>');
|
327
|
+
// Minutes view
|
328
|
+
for (var i = 0; i < 60; i += 5) {
|
329
|
+
var tick = $tick.clone();
|
330
|
+
var radian = i / 30 * Math.PI;
|
331
|
+
tick.css({
|
332
|
+
left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px',
|
333
|
+
top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px'
|
334
|
+
});
|
335
|
+
tick.html(Timepicker._addLeadingZero(i));
|
336
|
+
this.minutesView.appendChild(tick[0]);
|
337
|
+
}
|
338
|
+
}
|
339
|
+
}, {
|
340
|
+
key: '_handleAmPmClick',
|
341
|
+
value: function _handleAmPmClick(e) {
|
342
|
+
var $btnClicked = $(e.target);
|
343
|
+
this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM';
|
344
|
+
this._updateAmPmView();
|
345
|
+
}
|
346
|
+
}, {
|
347
|
+
key: '_updateAmPmView',
|
348
|
+
value: function _updateAmPmView() {
|
349
|
+
if (this.options.twelveHour) {
|
350
|
+
this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM');
|
351
|
+
this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM');
|
352
|
+
}
|
353
|
+
}
|
354
|
+
}, {
|
355
|
+
key: '_updateTimeFromInput',
|
356
|
+
value: function _updateTimeFromInput() {
|
357
|
+
// Get the time
|
358
|
+
var value = ((this.el.value || this.options.defaultTime || '') + '').split(':');
|
359
|
+
if (this.options.twelveHour && !(typeof value[1] === 'undefined')) {
|
360
|
+
if (value[1].toUpperCase().indexOf("AM") > 0) {
|
361
|
+
this.amOrPm = 'AM';
|
362
|
+
} else {
|
363
|
+
this.amOrPm = 'PM';
|
364
|
+
}
|
365
|
+
value[1] = value[1].replace("AM", "").replace("PM", "");
|
366
|
+
}
|
367
|
+
if (value[0] === 'now') {
|
368
|
+
var now = new Date(+new Date() + this.options.fromNow);
|
369
|
+
value = [now.getHours(), now.getMinutes()];
|
370
|
+
if (this.options.twelveHour) {
|
371
|
+
this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
|
372
|
+
}
|
373
|
+
}
|
374
|
+
this.hours = +value[0] || 0;
|
375
|
+
this.minutes = +value[1] || 0;
|
376
|
+
this.spanHours.innerHTML = this.hours;
|
377
|
+
this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes);
|
378
|
+
|
379
|
+
this._updateAmPmView();
|
380
|
+
}
|
381
|
+
}, {
|
382
|
+
key: 'showView',
|
383
|
+
value: function showView(view, delay) {
|
384
|
+
if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
|
385
|
+
// raiseCallback(this.options.beforeHourSelect);
|
386
|
+
}
|
387
|
+
var isHours = view === 'hours',
|
388
|
+
nextView = isHours ? this.hoursView : this.minutesView,
|
389
|
+
hideView = isHours ? this.minutesView : this.hoursView;
|
390
|
+
this.currentView = view;
|
391
|
+
|
392
|
+
$(this.spanHours).toggleClass('text-primary', isHours);
|
393
|
+
$(this.spanMinutes).toggleClass('text-primary', !isHours);
|
394
|
+
|
395
|
+
// Transition view
|
396
|
+
hideView.classList.add('timepicker-dial-out');
|
397
|
+
$(nextView).css('visibility', 'visible').removeClass('timepicker-dial-out');
|
398
|
+
|
399
|
+
// Reset clock hand
|
400
|
+
this.resetClock(delay);
|
401
|
+
|
402
|
+
// After transitions ended
|
403
|
+
clearTimeout(this.toggleViewTimer);
|
404
|
+
this.toggleViewTimer = setTimeout(function () {
|
405
|
+
$(hideView).css('visibility', 'hidden');
|
406
|
+
}, this.options.duration);
|
407
|
+
}
|
408
|
+
}, {
|
409
|
+
key: 'resetClock',
|
410
|
+
value: function resetClock(delay) {
|
411
|
+
var view = this.currentView,
|
412
|
+
value = this[view],
|
413
|
+
isHours = view === 'hours',
|
414
|
+
unit = Math.PI / (isHours ? 6 : 30),
|
415
|
+
radian = value * unit,
|
416
|
+
radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius,
|
417
|
+
x = Math.sin(radian) * radius,
|
418
|
+
y = -Math.cos(radian) * radius,
|
419
|
+
self = this;
|
420
|
+
|
421
|
+
if (delay) {
|
422
|
+
$(this.canvas).addClass('timepicker-canvas-out');
|
423
|
+
setTimeout(function () {
|
424
|
+
$(self.canvas).removeClass('timepicker-canvas-out');
|
425
|
+
self.setHand(x, y);
|
426
|
+
}, delay);
|
427
|
+
} else {
|
428
|
+
this.setHand(x, y);
|
429
|
+
}
|
430
|
+
}
|
431
|
+
}, {
|
432
|
+
key: 'setHand',
|
433
|
+
value: function setHand(x, y, roundBy5) {
|
434
|
+
var _this4 = this;
|
435
|
+
|
436
|
+
var radian = Math.atan2(x, -y),
|
437
|
+
isHours = this.currentView === 'hours',
|
438
|
+
unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
|
439
|
+
z = Math.sqrt(x * x + y * y),
|
440
|
+
inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2,
|
441
|
+
radius = inner ? this.options.innerRadius : this.options.outerRadius;
|
442
|
+
|
443
|
+
if (this.options.twelveHour) {
|
444
|
+
radius = this.options.outerRadius;
|
445
|
+
}
|
446
|
+
|
447
|
+
// Radian should in range [0, 2PI]
|
448
|
+
if (radian < 0) {
|
449
|
+
radian = Math.PI * 2 + radian;
|
450
|
+
}
|
451
|
+
|
452
|
+
// Get the round value
|
453
|
+
var value = Math.round(radian / unit);
|
454
|
+
|
455
|
+
// Get the round radian
|
456
|
+
radian = value * unit;
|
457
|
+
|
458
|
+
// Correct the hours or minutes
|
459
|
+
if (this.options.twelveHour) {
|
460
|
+
if (isHours) {
|
461
|
+
if (value === 0) value = 12;
|
462
|
+
} else {
|
463
|
+
if (roundBy5) value *= 5;
|
464
|
+
if (value === 60) value = 0;
|
465
|
+
}
|
466
|
+
} else {
|
467
|
+
if (isHours) {
|
468
|
+
if (value === 12) {
|
469
|
+
value = 0;
|
470
|
+
}
|
471
|
+
value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12;
|
472
|
+
} else {
|
473
|
+
if (roundBy5) {
|
474
|
+
value *= 5;
|
475
|
+
}
|
476
|
+
if (value === 60) {
|
477
|
+
value = 0;
|
478
|
+
}
|
479
|
+
}
|
480
|
+
}
|
481
|
+
|
482
|
+
// Once hours or minutes changed, vibrate the device
|
483
|
+
if (this[this.currentView] !== value) {
|
484
|
+
if (this.vibrate && this.options.vibrate) {
|
485
|
+
// Do not vibrate too frequently
|
486
|
+
if (!this.vibrateTimer) {
|
487
|
+
navigator[this.vibrate](10);
|
488
|
+
this.vibrateTimer = setTimeout(function () {
|
489
|
+
_this4.vibrateTimer = null;
|
490
|
+
}, 100);
|
491
|
+
}
|
492
|
+
}
|
493
|
+
}
|
494
|
+
|
495
|
+
this[this.currentView] = value;
|
496
|
+
if (isHours) {
|
497
|
+
this['spanHours'].innerHTML = value;
|
498
|
+
} else {
|
499
|
+
this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value);
|
500
|
+
}
|
501
|
+
|
502
|
+
// Set clock hand and others' position
|
503
|
+
var cx1 = Math.sin(radian) * (radius - this.options.tickRadius),
|
504
|
+
cy1 = -Math.cos(radian) * (radius - this.options.tickRadius),
|
505
|
+
cx2 = Math.sin(radian) * radius,
|
506
|
+
cy2 = -Math.cos(radian) * radius;
|
507
|
+
this.hand.setAttribute('x2', cx1);
|
508
|
+
this.hand.setAttribute('y2', cy1);
|
509
|
+
this.bg.setAttribute('cx', cx2);
|
510
|
+
this.bg.setAttribute('cy', cy2);
|
511
|
+
}
|
512
|
+
}, {
|
513
|
+
key: 'open',
|
514
|
+
value: function open() {
|
515
|
+
if (this.isOpen) {
|
516
|
+
return;
|
517
|
+
}
|
518
|
+
|
519
|
+
this.isOpen = true;
|
520
|
+
this._updateTimeFromInput();
|
521
|
+
this.showView('hours');
|
522
|
+
this.modal.open();
|
523
|
+
}
|
524
|
+
}, {
|
525
|
+
key: 'close',
|
526
|
+
value: function close() {
|
527
|
+
if (!this.isOpen) {
|
528
|
+
return;
|
529
|
+
}
|
530
|
+
|
531
|
+
this.isOpen = false;
|
532
|
+
this.modal.close();
|
533
|
+
}
|
534
|
+
|
535
|
+
/**
|
531
536
|
* Finish timepicker selection.
|
532
537
|
*/
|
533
538
|
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
539
|
+
}, {
|
540
|
+
key: 'done',
|
541
|
+
value: function done(e, clearValue) {
|
542
|
+
// Set input value
|
543
|
+
var last = this.el.value;
|
544
|
+
var value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes);
|
545
|
+
this.time = value;
|
546
|
+
if (!clearValue && this.options.twelveHour) {
|
547
|
+
value = value + ' ' + this.amOrPm;
|
548
|
+
}
|
549
|
+
this.el.value = value;
|
550
|
+
|
551
|
+
// Trigger change event
|
552
|
+
if (value !== last) {
|
553
|
+
this.$el.trigger('change');
|
554
|
+
}
|
555
|
+
|
556
|
+
this.close();
|
557
|
+
this.el.focus();
|
558
|
+
}
|
559
|
+
}, {
|
560
|
+
key: 'clear',
|
561
|
+
value: function clear() {
|
562
|
+
this.done(null, true);
|
563
|
+
}
|
564
|
+
}], [{
|
565
|
+
key: 'init',
|
566
|
+
value: function init(els, options) {
|
567
|
+
return _get(Timepicker.__proto__ || Object.getPrototypeOf(Timepicker), 'init', this).call(this, this, els, options);
|
568
|
+
}
|
569
|
+
}, {
|
570
|
+
key: '_addLeadingZero',
|
571
|
+
value: function _addLeadingZero(num) {
|
572
|
+
return (num < 10 ? '0' : '') + num;
|
573
|
+
}
|
574
|
+
}, {
|
575
|
+
key: '_createSVGEl',
|
576
|
+
value: function _createSVGEl(name) {
|
577
|
+
var svgNS = 'http://www.w3.org/2000/svg';
|
578
|
+
return document.createElementNS(svgNS, name);
|
579
|
+
}
|
580
|
+
|
581
|
+
/**
|
577
582
|
* @typedef {Object} Point
|
578
583
|
* @property {number} x The X Coordinate
|
579
584
|
* @property {number} y The Y Coordinate
|
580
585
|
*/
|
581
586
|
|
582
|
-
|
587
|
+
/**
|
583
588
|
* Get x position of mouse or touch event
|
584
589
|
* @param {Event} e
|
585
590
|
* @return {Point} x and y location
|
586
591
|
*/
|
587
592
|
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
593
|
+
}, {
|
594
|
+
key: '_Pos',
|
595
|
+
value: function _Pos(e) {
|
596
|
+
if (e.targetTouches && e.targetTouches.length >= 1) {
|
597
|
+
return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY };
|
598
|
+
}
|
599
|
+
// mouse event
|
600
|
+
return { x: e.clientX, y: e.clientY };
|
601
|
+
}
|
602
|
+
|
603
|
+
/**
|
599
604
|
* Get Instance
|
600
605
|
*/
|
601
606
|
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
607
|
+
}, {
|
608
|
+
key: 'getInstance',
|
609
|
+
value: function getInstance(el) {
|
610
|
+
var domElem = !!el.jquery ? el[0] : el;
|
611
|
+
return domElem.M_Timepicker;
|
612
|
+
}
|
613
|
+
}, {
|
614
|
+
key: 'defaults',
|
615
|
+
get: function () {
|
616
|
+
return _defaults;
|
617
|
+
}
|
618
|
+
}]);
|
619
|
+
|
620
|
+
return Timepicker;
|
621
|
+
}(Component);
|
622
|
+
|
623
|
+
Timepicker._template = ['<div class= "modal timepicker-modal">', '<div class="modal-content timepicker-container">', '<div class="timepicker-digital-display">', '<div class="timepicker-text-container">', '<div class="timepicker-display-column">', '<span class="timepicker-span-hours text-primary"></span>', ':', '<span class="timepicker-span-minutes"></span>', '</div>', '<div class="timepicker-display-column timepicker-display-am-pm">', '<div class="timepicker-span-am-pm"></div>', '</div>', '</div>', '</div>', '<div class="timepicker-analog-display">', '<div class="timepicker-plate">', '<div class="timepicker-canvas"></div>', '<div class="timepicker-dial timepicker-hours"></div>', '<div class="timepicker-dial timepicker-minutes timepicker-dial-out"></div>', '</div>', '<div class="timepicker-footer"></div>', '</div>', '</div>', '</div>'].join('');
|
624
|
+
|
625
|
+
M.Timepicker = Timepicker;
|
626
|
+
|
627
|
+
if (M.jQueryLoaded) {
|
628
|
+
M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker');
|
629
|
+
}
|
625
630
|
})(cash);
|