bootstrap4-datetime-picker-rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5412ce8ac0174cc97181b200956787a271b33080
4
- data.tar.gz: a1d167f42f9714698026641133f645c9e9bd5a58
3
+ metadata.gz: 20a5db3c07c193e1b6277250fda84c61056f124b
4
+ data.tar.gz: '09ac9b30065ad1854fe8779fb344e4e5ca9bb845'
5
5
  SHA512:
6
- metadata.gz: 2fb0afe7f6ced52130a31f70cb501fa1272126bfe73c1068c02e636c0d208da604dc571e448074bf654018d80b373d342138ae3999416922e432d01cdbc01b10
7
- data.tar.gz: 47e2e832d29405dc433d900690ffc816b0fc01d01b309a2d78139b76009e99920a04fd231bf814a49ccf15d01e9a011aec5ed7f31c70aa97e8cce6c223d41f2d
6
+ metadata.gz: 12b93f60eb47db9985e02419b27daf508376561d6b580ccb49642a1c825ea93dbe7f1ad6b2df08eeef4b55c7f826537ddca7cceba20cb93451f24df4a3448eeb
7
+ data.tar.gz: 34c297ab716276563a626af3116ed439ecf2c9c0adb0f65f904c324ef946476b2023399c543b43199f51add98c28bb2510fa2d86912d44a128b91bb90ae90f16
@@ -0,0 +1,4 @@
1
+ Gemfile.lock
2
+ *.gem
3
+ tempus-dominus-source
4
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bootstrap-rails.gemspec
4
+ gemspec
@@ -0,0 +1,17 @@
1
+ # bootstrap4 datetime picker rails
2
+
3
+ Makes [Tempus Dominus](https://github.com/tempusdominus/bootstrap-4) available to your rails appliation through the asset pipeline.
4
+
5
+ ## Usage Instructions
6
+
7
+ Add the following to your `Gemfile` and then run `bundle`
8
+
9
+ `gem 'bootstrap4-datetime-picker-rails'`
10
+
11
+ Add the following to `application.js`
12
+
13
+ `//= require tempusdominus-bootstrap-4.js`
14
+
15
+ Add the following to `application.scss`
16
+
17
+ `@import "tempusdominus-bootstrap-4.css";`
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'json'
4
+ require File.expand_path('../lib/bootstrap4_datetime_picker_rails/version', __FILE__)
5
+
6
+ desc 'Update assets'
7
+ task :update do
8
+
9
+ checkout_branch = '5.0.0-alpha12'
10
+
11
+ if Dir.exist?('tempus-dominus-source')
12
+ system("cd tempus-dominus-source && git checkout master && git pull && git checkout #{checkout_branch}")
13
+ else
14
+ system('git clone https://github.com/tempusdominus/bootstrap-4.git tempus-dominus-source')
15
+ system("cd tempus-dominus-source && git checkout #{checkout_branch}")
16
+ end
17
+
18
+ system('cp tempus-dominus-source/build/css/tempusdominus-bootstrap-4.css vendor/assets/stylesheets/tempusdominus-bootstrap-4.css')
19
+ system('cp tempus-dominus-source/build/css/tempusdominus-bootstrap-4.min.css vendor/assets/stylesheets/tempusdominus-bootstrap-4.min.css')
20
+ system('cp tempus-dominus-source/build/js/tempusdominus-bootstrap-4.js vendor/assets/javascripts/tempusdominus-bootstrap-4.js')
21
+ system('cp tempus-dominus-source/build/js/tempusdominus-bootstrap-4.min.js vendor/assets/javascripts/tempusdominus-bootstrap-4.min.js')
22
+ system('git status')
23
+
24
+ puts "\n"
25
+ puts "tempusdominus-bootstrap-4 version: #{JSON.parse(File.read('./tempus-dominus-source/bower.json'))['version']}"
26
+ puts "tempus-dominus-datetime-picker-rails version: #{Bootstrap4DatetimePickerRails::Rails::VERSION}"
27
+ end
28
+
29
+ desc 'Build'
30
+ task 'build' do
31
+ system('gem build bootstrap4_datetime_picker_rails.gemspec')
32
+ end
33
+
34
+ desc 'Build and publish the gem'
35
+ task publish: :build do
36
+ tags = `git tag`.split
37
+ current_version = Bootstrap4DatetimePickerRails::Rails::VERSION
38
+ system("git tag -a #{current_version} -m 'Release #{current_version}'") unless tags.include?(current_version)
39
+ system("gem push bootstrap4-datetime-picker-rails-#{current_version}.gem")
40
+ system('git push --follow-tags')
41
+ end
42
+
43
+ task release: :publish do
44
+ end
@@ -0,0 +1,20 @@
1
+
2
+ require File.expand_path('../lib/bootstrap4_datetime_picker_rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ['Kyle Fagan']
6
+ gem.email = ['kfagan@mitre.org']
7
+ gem.description = 'Rails integration for Tempus Dominus Bootstrap 4 datetime picker'
8
+ gem.homepage = 'https://github.com/Bialogs/bootstrap4-datetime-picker-rails'
9
+ gem.summary = gem.description
10
+ gem.license = 'MIT'
11
+
12
+ gem.name = 'bootstrap4-datetime-picker-rails'
13
+ gem.require_path = 'lib'
14
+ gem.version = Bootstrap4DatetimePickerRails::Rails::VERSION
15
+ gem.files = `git ls-files`.split("\n")
16
+ gem.add_dependency 'momentjs-rails', '>= 2.10.5'
17
+ gem.add_development_dependency 'bundler', '~> 0'
18
+ gem.add_development_dependency 'json', '~> 0'
19
+ gem.add_development_dependency 'rake', '~> 0'
20
+ end
@@ -0,0 +1,8 @@
1
+ require 'rails'
2
+ require 'bootstrap4_datetime_picker_rails/version'
3
+ require 'bootstrap4_datetime_picker_rails/engine'
4
+
5
+ module Bootstrap4DatetimePickerRails
6
+ module Rails
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ module Bootstrap4DatetimePickerRails
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Bootstrap4DatetimePickerRails
2
+ module Rails
3
+ class Railtie < ::Rails::Railtie; end
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ module Bootstrap4DatetimePickerRails
2
+ module Rails
3
+ VERSION = '0.1.2'
4
+ TEMPUS_DOMINUS_VERSION = '5.0.0-alpha12'
5
+ end
6
+ end
@@ -0,0 +1,2746 @@
1
+ /*@preserve
2
+ * Tempus Dominus Bootstrap4 v5.0.0-alpha11 (https://tempusdominus.github.io/bootstrap-4/)
3
+ * Copyright 2016-2017 Jonathan Peterson
4
+ * Licensed under MIT (https://github.com/tempusdominus/bootstrap-3/blob/master/LICENSE)
5
+ */
6
+
7
+ if (typeof jQuery === 'undefined') {
8
+ throw new Error('Tempus Dominus Bootstrap4\'s requires jQuery. jQuery must be included before Tempus Dominus Bootstrap4\'s JavaScript.');
9
+ }
10
+
11
+ +function ($) {
12
+ var version = $.fn.jquery.split(' ')[0].split('.');
13
+ if ((version[0] < 2 && version[1] < 9) || (version[0] === 1 && version[1] === 9 && version[2] < 1) || (version[0] >= 4)) {
14
+ throw new Error('Tempus Dominus Bootstrap4\'s requires at least jQuery v1.9.1 but less than v4.0.0');
15
+ }
16
+ }(jQuery);
17
+
18
+
19
+ if (typeof moment === 'undefined') {
20
+ throw new Error('Tempus Dominus Bootstrap4\'s requires moment.js. Moment.js must be included before Tempus Dominus Bootstrap4\'s JavaScript.');
21
+ }
22
+
23
+ var version = moment.version.split('.')
24
+ if ((version[0] <= 2 && version[1] < 17) || (version[0] >= 3)) {
25
+ throw new Error('Tempus Dominus Bootstrap4\'s requires at least moment.js v2.17.0 but less than v3.0.0');
26
+ }
27
+
28
+ +function () {
29
+
30
+ 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; };
31
+
32
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
33
+
34
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
35
+
36
+ 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; }
37
+
38
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
39
+
40
+ // ReSharper disable once InconsistentNaming
41
+ var DateTimePicker = function ($, moment) {
42
+ // ReSharper disable InconsistentNaming
43
+ var NAME = 'datetimepicker',
44
+ VERSION = '5.0.0-alpha11',
45
+ DATA_KEY = '' + NAME,
46
+ EVENT_KEY = '.' + DATA_KEY,
47
+ EMIT_EVENT_KEY = DATA_KEY + '.',
48
+ DATA_API_KEY = '.data-api',
49
+ Selector = {
50
+ DATA_TOGGLE: '[data-toggle="' + DATA_KEY + '"]'
51
+ },
52
+ ClassName = {
53
+ INPUT: NAME + '-input'
54
+ },
55
+ Event = {
56
+ CHANGE: 'change' + EVENT_KEY,
57
+ BLUR: 'blur' + EVENT_KEY,
58
+ KEYUP: 'keyup' + EVENT_KEY,
59
+ KEYDOWN: 'keydown' + EVENT_KEY,
60
+ FOCUS: 'focus' + EVENT_KEY,
61
+ CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
62
+ //emitted
63
+ UPDATE: EMIT_EVENT_KEY + 'update',
64
+ ERROR: EMIT_EVENT_KEY + 'error',
65
+ HIDE: EMIT_EVENT_KEY + 'hide',
66
+ SHOW: EMIT_EVENT_KEY + 'show'
67
+ },
68
+ DatePickerModes = [{
69
+ CLASS_NAME: 'days',
70
+ NAV_FUNCTION: 'M',
71
+ NAV_STEP: 1
72
+ }, {
73
+ CLASS_NAME: 'months',
74
+ NAV_FUNCTION: 'y',
75
+ NAV_STEP: 1
76
+ }, {
77
+ CLASS_NAME: 'years',
78
+ NAV_FUNCTION: 'y',
79
+ NAV_STEP: 10
80
+ }, {
81
+ CLASS_NAME: 'decades',
82
+ NAV_FUNCTION: 'y',
83
+ NAV_STEP: 100
84
+ }],
85
+ KeyMap = {
86
+ 'up': 38,
87
+ 38: 'up',
88
+ 'down': 40,
89
+ 40: 'down',
90
+ 'left': 37,
91
+ 37: 'left',
92
+ 'right': 39,
93
+ 39: 'right',
94
+ 'tab': 9,
95
+ 9: 'tab',
96
+ 'escape': 27,
97
+ 27: 'escape',
98
+ 'enter': 13,
99
+ 13: 'enter',
100
+ 'pageUp': 33,
101
+ 33: 'pageUp',
102
+ 'pageDown': 34,
103
+ 34: 'pageDown',
104
+ 'shift': 16,
105
+ 16: 'shift',
106
+ 'control': 17,
107
+ 17: 'control',
108
+ 'space': 32,
109
+ 32: 'space',
110
+ 't': 84,
111
+ 84: 't',
112
+ 'delete': 46,
113
+ 46: 'delete'
114
+ },
115
+ ViewModes = ['times', 'days', 'months', 'years', 'decades'],
116
+ keyState = {},
117
+ keyPressHandled = {};
118
+
119
+ var MinViewModeNumber = 0,
120
+ Default = {
121
+ timeZone: '',
122
+ format: false,
123
+ dayViewHeaderFormat: 'MMMM YYYY',
124
+ extraFormats: false,
125
+ stepping: 1,
126
+ minDate: false,
127
+ maxDate: false,
128
+ useCurrent: true,
129
+ collapse: true,
130
+ locale: moment.locale(),
131
+ defaultDate: false,
132
+ disabledDates: false,
133
+ enabledDates: false,
134
+ icons: {
135
+ time: 'fa fa-clock-o',
136
+ date: 'fa fa-calendar',
137
+ up: 'fa fa-arrow-up',
138
+ down: 'fa fa-arrow-down',
139
+ previous: 'fa fa-chevron-left',
140
+ next: 'fa fa-chevron-right',
141
+ today: 'fa fa-calendar-check-o',
142
+ clear: 'fa fa-delete',
143
+ close: 'fa fa-times'
144
+ },
145
+ tooltips: {
146
+ today: 'Go to today',
147
+ clear: 'Clear selection',
148
+ close: 'Close the picker',
149
+ selectMonth: 'Select Month',
150
+ prevMonth: 'Previous Month',
151
+ nextMonth: 'Next Month',
152
+ selectYear: 'Select Year',
153
+ prevYear: 'Previous Year',
154
+ nextYear: 'Next Year',
155
+ selectDecade: 'Select Decade',
156
+ prevDecade: 'Previous Decade',
157
+ nextDecade: 'Next Decade',
158
+ prevCentury: 'Previous Century',
159
+ nextCentury: 'Next Century',
160
+ pickHour: 'Pick Hour',
161
+ incrementHour: 'Increment Hour',
162
+ decrementHour: 'Decrement Hour',
163
+ pickMinute: 'Pick Minute',
164
+ incrementMinute: 'Increment Minute',
165
+ decrementMinute: 'Decrement Minute',
166
+ pickSecond: 'Pick Second',
167
+ incrementSecond: 'Increment Second',
168
+ decrementSecond: 'Decrement Second',
169
+ togglePeriod: 'Toggle Period',
170
+ selectTime: 'Select Time',
171
+ selectDate: 'Select Date'
172
+ },
173
+ useStrict: false,
174
+ sideBySide: false,
175
+ daysOfWeekDisabled: false,
176
+ calendarWeeks: false,
177
+ viewMode: 'days',
178
+ toolbarPlacement: 'default',
179
+ buttons: {
180
+ showToday: false,
181
+ showClear: false,
182
+ showClose: false
183
+ },
184
+ widgetPositioning: {
185
+ horizontal: 'auto',
186
+ vertical: 'auto'
187
+ },
188
+ widgetParent: null,
189
+ ignoreReadonly: false,
190
+ keepOpen: false,
191
+ focusOnShow: true,
192
+ inline: false,
193
+ keepInvalid: false,
194
+ keyBinds: {
195
+ up: function up() {
196
+ if (!this.widget) {
197
+ return false;
198
+ }
199
+ var d = this._dates[0] || this.getMoment();
200
+ if (this.widget.find('.datepicker').is(':visible')) {
201
+ this.date(d.clone().subtract(7, 'd'));
202
+ } else {
203
+ this.date(d.clone().add(this.stepping(), 'm'));
204
+ }
205
+ return true;
206
+ },
207
+ down: function down() {
208
+ if (!this.widget) {
209
+ this.show();
210
+ return false;
211
+ }
212
+ var d = this._dates[0] || this.getMoment();
213
+ if (this.widget.find('.datepicker').is(':visible')) {
214
+ this.date(d.clone().add(7, 'd'));
215
+ } else {
216
+ this.date(d.clone().subtract(this.stepping(), 'm'));
217
+ }
218
+ return true;
219
+ },
220
+ 'control up': function controlUp() {
221
+ if (!this.widget) {
222
+ return false;
223
+ }
224
+ var d = this._dates[0] || this.getMoment();
225
+ if (this.widget.find('.datepicker').is(':visible')) {
226
+ this.date(d.clone().subtract(1, 'y'));
227
+ } else {
228
+ this.date(d.clone().add(1, 'h'));
229
+ }
230
+ return true;
231
+ },
232
+ 'control down': function controlDown() {
233
+ if (!this.widget) {
234
+ return false;
235
+ }
236
+ var d = this._dates[0] || this.getMoment();
237
+ if (this.widget.find('.datepicker').is(':visible')) {
238
+ this.date(d.clone().add(1, 'y'));
239
+ } else {
240
+ this.date(d.clone().subtract(1, 'h'));
241
+ }
242
+ return true;
243
+ },
244
+ left: function left() {
245
+ if (!this.widget) {
246
+ return false;
247
+ }
248
+ var d = this._dates[0] || this.getMoment();
249
+ if (this.widget.find('.datepicker').is(':visible')) {
250
+ this.date(d.clone().subtract(1, 'd'));
251
+ }
252
+ return true;
253
+ },
254
+ right: function right() {
255
+ if (!this.widget) {
256
+ return false;
257
+ }
258
+ var d = this._dates[0] || this.getMoment();
259
+ if (this.widget.find('.datepicker').is(':visible')) {
260
+ this.date(d.clone().add(1, 'd'));
261
+ }
262
+ return true;
263
+ },
264
+ pageUp: function pageUp() {
265
+ if (!this.widget) {
266
+ return false;
267
+ }
268
+ var d = this._dates[0] || this.getMoment();
269
+ if (this.widget.find('.datepicker').is(':visible')) {
270
+ this.date(d.clone().subtract(1, 'M'));
271
+ }
272
+ return true;
273
+ },
274
+ pageDown: function pageDown() {
275
+ if (!this.widget) {
276
+ return false;
277
+ }
278
+ var d = this._dates[0] || this.getMoment();
279
+ if (this.widget.find('.datepicker').is(':visible')) {
280
+ this.date(d.clone().add(1, 'M'));
281
+ }
282
+ return true;
283
+ },
284
+ enter: function enter() {
285
+ this.hide();
286
+ return true;
287
+ },
288
+ escape: function escape() {
289
+ if (!this.widget) {
290
+ return false;
291
+ }
292
+ this.hide();
293
+ return true;
294
+ },
295
+ 'control space': function controlSpace() {
296
+ if (!this.widget) {
297
+ return false;
298
+ }
299
+ if (this.widget.find('.timepicker').is(':visible')) {
300
+ this.widget.find('.btn[data-action="togglePeriod"]').click();
301
+ }
302
+ return true;
303
+ },
304
+ t: function t() {
305
+ this.date(this.getMoment());
306
+ return true;
307
+ },
308
+ 'delete': function _delete() {
309
+ if (!this.widget) {
310
+ return false;
311
+ }
312
+ this.clear();
313
+ return true;
314
+ }
315
+ },
316
+ debug: false,
317
+ allowInputToggle: false,
318
+ disabledTimeIntervals: false,
319
+ disabledHours: false,
320
+ enabledHours: false,
321
+ viewDate: false,
322
+ allowMultidate: false,
323
+ multidateSeparator: ','
324
+ };
325
+
326
+ // ReSharper restore InconsistentNaming
327
+
328
+ // ReSharper disable once DeclarationHides
329
+ // ReSharper disable once InconsistentNaming
330
+
331
+ var DateTimePicker = function () {
332
+ /** @namespace eData.dateOptions */
333
+ /** @namespace moment.tz */
334
+
335
+ function DateTimePicker(element, options) {
336
+ _classCallCheck(this, DateTimePicker);
337
+
338
+ this._options = this._getOptions(options);
339
+ this._element = element;
340
+ this._dates = [];
341
+ this._datesFormatted = [];
342
+ this._viewDate = null;
343
+ this.unset = true;
344
+ this.component = false;
345
+ this.widget = false;
346
+ this.use24Hours = null;
347
+ this.actualFormat = null;
348
+ this.parseFormats = null;
349
+ this.currentViewMode = null;
350
+
351
+ this._int();
352
+ }
353
+
354
+ /**
355
+ * @return {string}
356
+ */
357
+
358
+
359
+ //private
360
+
361
+ DateTimePicker.prototype._int = function _int() {
362
+ var targetInput = this._element.data('target-input');
363
+ if (this._element.is('input')) {
364
+ this.input = this._element;
365
+ } else if (targetInput !== undefined) {
366
+ if (targetInput === 'nearest') {
367
+ this.input = this._element.find('input');
368
+ } else {
369
+ this.input = $(targetInput);
370
+ }
371
+ }
372
+
373
+ this._dates = [];
374
+ this._dates[0] = this.getMoment();
375
+ this._viewDate = this.getMoment().clone();
376
+
377
+ $.extend(true, this._options, this._dataToOptions());
378
+
379
+ this.options(this._options);
380
+
381
+ this._initFormatting();
382
+
383
+ if (this.input !== undefined && this.input.is('input') && this.input.val().trim().length !== 0) {
384
+ this._setValue(this._parseInputDate(this.input.val().trim()), 0);
385
+ } else if (this._options.defaultDate && this.input !== undefined && this.input.attr('placeholder') === undefined) {
386
+ this._setValue(this._options.defaultDate, 0);
387
+ }
388
+ if (this._options.inline) {
389
+ this.show();
390
+ }
391
+ };
392
+
393
+ DateTimePicker.prototype._update = function _update() {
394
+ if (!this.widget) {
395
+ return;
396
+ }
397
+ this._fillDate();
398
+ this._fillTime();
399
+ };
400
+
401
+ DateTimePicker.prototype._setValue = function _setValue(targetMoment, index) {
402
+ var oldDate = this.unset ? null : this._dates[index];
403
+ var outpValue = '';
404
+ // case of calling setValue(null or false)
405
+ if (!targetMoment) {
406
+ if (!this._options.allowMultidate || this._dates.length === 1) {
407
+ this.unset = true;
408
+ this._dates = [];
409
+ this._datesFormatted = [];
410
+ } else {
411
+ outpValue = this._element.data('date') + ',';
412
+ outpValue = outpValue.replace(oldDate.format(this.actualFormat) + ',', '').replace(',,', '').replace(/,\s*$/, '');
413
+ this._dates.splice(index, 1);
414
+ this._datesFormatted.splice(index, 1);
415
+ }
416
+ if (this.input !== undefined) {
417
+ this.input.val(outpValue);
418
+ this.input.trigger('input');
419
+ }
420
+ this._element.data('date', outpValue);
421
+ this._notifyEvent({
422
+ type: DateTimePicker.Event.CHANGE,
423
+ date: false,
424
+ oldDate: oldDate
425
+ });
426
+ this._update();
427
+ return;
428
+ }
429
+
430
+ targetMoment = targetMoment.clone().locale(this._options.locale);
431
+
432
+ if (this._hasTimeZone()) {
433
+ targetMoment.tz(this._options.timeZone);
434
+ }
435
+
436
+ if (this._options.stepping !== 1) {
437
+ targetMoment.minutes(Math.round(targetMoment.minutes() / this._options.stepping) * this._options.stepping).seconds(0);
438
+ }
439
+
440
+ if (this._isValid(targetMoment)) {
441
+ this._dates[index] = targetMoment;
442
+ this._datesFormatted[index] = targetMoment.format('YYYY-MM-DD');
443
+ this._viewDate = targetMoment.clone();
444
+ if (this._options.allowMultidate && this._dates.length > 1) {
445
+ for (var i = 0; i < this._dates.length; i++) {
446
+ outpValue += '' + this._dates[i].format(this.actualFormat) + this._options.multidateSeparator;
447
+ }
448
+ outpValue = outpValue.replace(/,\s*$/, '');
449
+ } else {
450
+ outpValue = this._dates[index].format(this.actualFormat);
451
+ }
452
+ if (this.input !== undefined) {
453
+ this.input.val(outpValue);
454
+ this.input.trigger('input');
455
+ }
456
+ this._element.data('date', outpValue);
457
+
458
+ this.unset = false;
459
+ this._update();
460
+ this._notifyEvent({
461
+ type: DateTimePicker.Event.CHANGE,
462
+ date: this._dates[index].clone(),
463
+ oldDate: oldDate
464
+ });
465
+ } else {
466
+ if (!this._options.keepInvalid) {
467
+ if (this.input !== undefined) {
468
+ this.input.val('' + (this.unset ? '' : this._dates[index].format(this.actualFormat)));
469
+ this.input.trigger('input');
470
+ }
471
+ } else {
472
+ this._notifyEvent({
473
+ type: DateTimePicker.Event.CHANGE,
474
+ date: targetMoment,
475
+ oldDate: oldDate
476
+ });
477
+ }
478
+ this._notifyEvent({
479
+ type: DateTimePicker.Event.ERROR,
480
+ date: targetMoment,
481
+ oldDate: oldDate
482
+ });
483
+ }
484
+ };
485
+
486
+ DateTimePicker.prototype._change = function _change(e) {
487
+ var val = $(e.target).val().trim(),
488
+ parsedDate = val ? this._parseInputDate(val) : null;
489
+ this._setValue(parsedDate);
490
+ e.stopImmediatePropagation();
491
+ return false;
492
+ };
493
+
494
+ //noinspection JSMethodCanBeStatic
495
+
496
+
497
+ DateTimePicker.prototype._getOptions = function _getOptions(options) {
498
+ options = $.extend(true, {}, Default, options);
499
+ return options;
500
+ };
501
+
502
+ DateTimePicker.prototype._hasTimeZone = function _hasTimeZone() {
503
+ return moment.tz !== undefined && this._options.timeZone !== undefined && this._options.timeZone !== null && this._options.timeZone !== '';
504
+ };
505
+
506
+ DateTimePicker.prototype._isEnabled = function _isEnabled(granularity) {
507
+ if (typeof granularity !== 'string' || granularity.length > 1) {
508
+ throw new TypeError('isEnabled expects a single character string parameter');
509
+ }
510
+ switch (granularity) {
511
+ case 'y':
512
+ return this.actualFormat.indexOf('Y') !== -1;
513
+ case 'M':
514
+ return this.actualFormat.indexOf('M') !== -1;
515
+ case 'd':
516
+ return this.actualFormat.toLowerCase().indexOf('d') !== -1;
517
+ case 'h':
518
+ case 'H':
519
+ return this.actualFormat.toLowerCase().indexOf('h') !== -1;
520
+ case 'm':
521
+ return this.actualFormat.indexOf('m') !== -1;
522
+ case 's':
523
+ return this.actualFormat.indexOf('s') !== -1;
524
+ default:
525
+ return false;
526
+ }
527
+ };
528
+
529
+ DateTimePicker.prototype._hasTime = function _hasTime() {
530
+ return this._isEnabled('h') || this._isEnabled('m') || this._isEnabled('s');
531
+ };
532
+
533
+ DateTimePicker.prototype._hasDate = function _hasDate() {
534
+ return this._isEnabled('y') || this._isEnabled('M') || this._isEnabled('d');
535
+ };
536
+
537
+ DateTimePicker.prototype._dataToOptions = function _dataToOptions() {
538
+ var eData = this._element.data();
539
+ var dataOptions = {};
540
+
541
+ if (eData.dateOptions && eData.dateOptions instanceof Object) {
542
+ dataOptions = $.extend(true, dataOptions, eData.dateOptions);
543
+ }
544
+
545
+ $.each(this._options, function (key) {
546
+ var attributeName = 'date' + key.charAt(0).toUpperCase() + key.slice(1); //todo data api key
547
+ if (eData[attributeName] !== undefined) {
548
+ dataOptions[key] = eData[attributeName];
549
+ } else {
550
+ delete dataOptions[key];
551
+ }
552
+ });
553
+ return dataOptions;
554
+ };
555
+
556
+ DateTimePicker.prototype._notifyEvent = function _notifyEvent(e) {
557
+ if (e.type === DateTimePicker.Event.CHANGE && e.date && e.date.isSame(e.oldDate) || !e.date && !e.oldDate) {
558
+ return;
559
+ }
560
+ this._element.trigger(e);
561
+ };
562
+
563
+ DateTimePicker.prototype._viewUpdate = function _viewUpdate(e) {
564
+ if (e === 'y') {
565
+ e = 'YYYY';
566
+ }
567
+ this._notifyEvent({
568
+ type: DateTimePicker.Event.UPDATE,
569
+ change: e,
570
+ viewDate: this._viewDate.clone()
571
+ });
572
+ };
573
+
574
+ DateTimePicker.prototype._showMode = function _showMode(dir) {
575
+ if (!this.widget) {
576
+ return;
577
+ }
578
+ if (dir) {
579
+ this.currentViewMode = Math.max(MinViewModeNumber, Math.min(3, this.currentViewMode + dir));
580
+ }
581
+ this.widget.find('.datepicker > div').hide().filter('.datepicker-' + DatePickerModes[this.currentViewMode].CLASS_NAME).show();
582
+ };
583
+
584
+ DateTimePicker.prototype._isInDisabledDates = function _isInDisabledDates(testDate) {
585
+ return this._options.disabledDates[testDate.format('YYYY-MM-DD')] === true;
586
+ };
587
+
588
+ DateTimePicker.prototype._isInEnabledDates = function _isInEnabledDates(testDate) {
589
+ return this._options.enabledDates[testDate.format('YYYY-MM-DD')] === true;
590
+ };
591
+
592
+ DateTimePicker.prototype._isInDisabledHours = function _isInDisabledHours(testDate) {
593
+ return this._options.disabledHours[testDate.format('H')] === true;
594
+ };
595
+
596
+ DateTimePicker.prototype._isInEnabledHours = function _isInEnabledHours(testDate) {
597
+ return this._options.enabledHours[testDate.format('H')] === true;
598
+ };
599
+
600
+ DateTimePicker.prototype._isValid = function _isValid(targetMoment, granularity) {
601
+ if (!targetMoment.isValid()) {
602
+ return false;
603
+ }
604
+ if (this._options.disabledDates && granularity === 'd' && this._isInDisabledDates(targetMoment)) {
605
+ return false;
606
+ }
607
+ if (this._options.enabledDates && granularity === 'd' && !this._isInEnabledDates(targetMoment)) {
608
+ return false;
609
+ }
610
+ if (this._options.minDate && targetMoment.isBefore(this._options.minDate, granularity)) {
611
+ return false;
612
+ }
613
+ if (this._options.maxDate && targetMoment.isAfter(this._options.maxDate, granularity)) {
614
+ return false;
615
+ }
616
+ if (this._options.daysOfWeekDisabled && granularity === 'd' && this._options.daysOfWeekDisabled.indexOf(targetMoment.day()) !== -1) {
617
+ return false;
618
+ }
619
+ if (this._options.disabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && this._isInDisabledHours(targetMoment)) {
620
+ return false;
621
+ }
622
+ if (this._options.enabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && !this._isInEnabledHours(targetMoment)) {
623
+ return false;
624
+ }
625
+ if (this._options.disabledTimeIntervals && (granularity === 'h' || granularity === 'm' || granularity === 's')) {
626
+ var found = false;
627
+ $.each(this._options.disabledTimeIntervals, function () {
628
+ if (targetMoment.isBetween(this[0], this[1])) {
629
+ found = true;
630
+ return false;
631
+ }
632
+ });
633
+ if (found) {
634
+ return false;
635
+ }
636
+ }
637
+ return true;
638
+ };
639
+
640
+ DateTimePicker.prototype._parseInputDate = function _parseInputDate(inputDate) {
641
+ if (this._options.parseInputDate === undefined) {
642
+ if (!moment.isMoment(inputDate)) {
643
+ inputDate = this.getMoment(inputDate);
644
+ }
645
+ } else {
646
+ inputDate = this._options.parseInputDate(inputDate);
647
+ }
648
+ //inputDate.locale(this.options.locale);
649
+ return inputDate;
650
+ };
651
+
652
+ DateTimePicker.prototype._keydown = function _keydown(e) {
653
+ var handler = null,
654
+ index = void 0,
655
+ index2 = void 0,
656
+ keyBindKeys = void 0,
657
+ allModifiersPressed = void 0;
658
+ var pressedKeys = [],
659
+ pressedModifiers = {},
660
+ currentKey = e.which,
661
+ pressed = 'p';
662
+
663
+ keyState[currentKey] = pressed;
664
+
665
+ for (index in keyState) {
666
+ if (keyState.hasOwnProperty(index) && keyState[index] === pressed) {
667
+ pressedKeys.push(index);
668
+ if (parseInt(index, 10) !== currentKey) {
669
+ pressedModifiers[index] = true;
670
+ }
671
+ }
672
+ }
673
+
674
+ for (index in this._options.keyBinds) {
675
+ if (this._options.keyBinds.hasOwnProperty(index) && typeof this._options.keyBinds[index] === 'function') {
676
+ keyBindKeys = index.split(' ');
677
+ if (keyBindKeys.length === pressedKeys.length && KeyMap[currentKey] === keyBindKeys[keyBindKeys.length - 1]) {
678
+ allModifiersPressed = true;
679
+ for (index2 = keyBindKeys.length - 2; index2 >= 0; index2--) {
680
+ if (!(KeyMap[keyBindKeys[index2]] in pressedModifiers)) {
681
+ allModifiersPressed = false;
682
+ break;
683
+ }
684
+ }
685
+ if (allModifiersPressed) {
686
+ handler = this._options.keyBinds[index];
687
+ break;
688
+ }
689
+ }
690
+ }
691
+ }
692
+
693
+ if (handler) {
694
+ if (handler.call(this.widget)) {
695
+ e.stopPropagation();
696
+ e.preventDefault();
697
+ }
698
+ }
699
+ };
700
+
701
+ //noinspection JSMethodCanBeStatic,SpellCheckingInspection
702
+
703
+
704
+ DateTimePicker.prototype._keyup = function _keyup(e) {
705
+ keyState[e.which] = 'r';
706
+ if (keyPressHandled[e.which]) {
707
+ keyPressHandled[e.which] = false;
708
+ e.stopPropagation();
709
+ e.preventDefault();
710
+ }
711
+ };
712
+
713
+ DateTimePicker.prototype._indexGivenDates = function _indexGivenDates(givenDatesArray) {
714
+ // Store given enabledDates and disabledDates as keys.
715
+ // This way we can check their existence in O(1) time instead of looping through whole array.
716
+ // (for example: options.enabledDates['2014-02-27'] === true)
717
+ var givenDatesIndexed = {},
718
+ self = this;
719
+ $.each(givenDatesArray, function () {
720
+ var dDate = self._parseInputDate(this);
721
+ if (dDate.isValid()) {
722
+ givenDatesIndexed[dDate.format('YYYY-MM-DD')] = true;
723
+ }
724
+ });
725
+ return Object.keys(givenDatesIndexed).length ? givenDatesIndexed : false;
726
+ };
727
+
728
+ DateTimePicker.prototype._indexGivenHours = function _indexGivenHours(givenHoursArray) {
729
+ // Store given enabledHours and disabledHours as keys.
730
+ // This way we can check their existence in O(1) time instead of looping through whole array.
731
+ // (for example: options.enabledHours['2014-02-27'] === true)
732
+ var givenHoursIndexed = {};
733
+ $.each(givenHoursArray, function () {
734
+ givenHoursIndexed[this] = true;
735
+ });
736
+ return Object.keys(givenHoursIndexed).length ? givenHoursIndexed : false;
737
+ };
738
+
739
+ DateTimePicker.prototype._initFormatting = function _initFormatting() {
740
+ var format = this._options.format || 'L LT',
741
+ self = this;
742
+
743
+ this.actualFormat = format.replace(/(\[[^\[]*])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) {
744
+ return self._dates[0].localeData().longDateFormat(formatInput) || formatInput; //todo taking the first date should be ok
745
+ });
746
+
747
+ this.parseFormats = this._options.extraFormats ? this._options.extraFormats.slice() : [];
748
+ if (this.parseFormats.indexOf(format) < 0 && this.parseFormats.indexOf(this.actualFormat) < 0) {
749
+ this.parseFormats.push(this.actualFormat);
750
+ }
751
+
752
+ this.use24Hours = this.actualFormat.toLowerCase().indexOf('a') < 1 && this.actualFormat.replace(/\[.*?]/g, '').indexOf('h') < 1;
753
+
754
+ if (this._isEnabled('y')) {
755
+ MinViewModeNumber = 2;
756
+ }
757
+ if (this._isEnabled('M')) {
758
+ MinViewModeNumber = 1;
759
+ }
760
+ if (this._isEnabled('d')) {
761
+ MinViewModeNumber = 0;
762
+ }
763
+
764
+ this.currentViewMode = Math.max(MinViewModeNumber, this.currentViewMode);
765
+
766
+ if (!this.unset) {
767
+ this._setValue(this._dates[0], 0);
768
+ }
769
+ };
770
+
771
+ DateTimePicker.prototype._getLastPickedDate = function _getLastPickedDate() {
772
+ return this._dates[this._getLastPickedDateIndex()];
773
+ };
774
+
775
+ DateTimePicker.prototype._getLastPickedDateIndex = function _getLastPickedDateIndex() {
776
+ return this._dates.length - 1;
777
+ };
778
+
779
+ //public
780
+
781
+
782
+ DateTimePicker.prototype.getMoment = function getMoment(d) {
783
+ var returnMoment = void 0;
784
+
785
+ if (d === undefined || d === null) {
786
+ returnMoment = moment(); //TODO should this use format? and locale?
787
+ } else if (this._hasTimeZone()) {
788
+ // There is a string to parse and a default time zone
789
+ // parse with the tz function which takes a default time zone if it is not in the format string
790
+ returnMoment = moment.tz(d, this.parseFormats, this._options.useStrict, this._options.timeZone);
791
+ } else {
792
+ returnMoment = moment(d, this.parseFormats, this._options.useStrict);
793
+ }
794
+
795
+ if (this._hasTimeZone()) {
796
+ returnMoment.tz(this._options.timeZone);
797
+ }
798
+
799
+ return returnMoment;
800
+ };
801
+
802
+ DateTimePicker.prototype.toggle = function toggle() {
803
+ return this.widget ? this.hide() : this.show();
804
+ };
805
+
806
+ DateTimePicker.prototype.ignoreReadonly = function ignoreReadonly(_ignoreReadonly) {
807
+ if (arguments.length === 0) {
808
+ return this._options.ignoreReadonly;
809
+ }
810
+ if (typeof _ignoreReadonly !== 'boolean') {
811
+ throw new TypeError('ignoreReadonly () expects a boolean parameter');
812
+ }
813
+ this._options.ignoreReadonly = _ignoreReadonly;
814
+ };
815
+
816
+ DateTimePicker.prototype.options = function options(newOptions) {
817
+ if (arguments.length === 0) {
818
+ return $.extend(true, {}, this._options);
819
+ }
820
+
821
+ if (!(newOptions instanceof Object)) {
822
+ throw new TypeError('options() this.options parameter should be an object');
823
+ }
824
+ $.extend(true, this._options, newOptions);
825
+ var self = this;
826
+ $.each(this._options, function (key, value) {
827
+ if (self[key] !== undefined) {
828
+ self[key](value);
829
+ }
830
+ });
831
+ };
832
+
833
+ DateTimePicker.prototype.date = function date(newDate, index) {
834
+ index = index || 0;
835
+ if (arguments.length === 0) {
836
+ if (this.unset) {
837
+ return null;
838
+ }
839
+ if (this._options.allowMultidate) {
840
+ return this._dates.join(this._options.multidateSeparator);
841
+ } else {
842
+ return this._dates[index].clone();
843
+ }
844
+ }
845
+
846
+ if (newDate !== null && typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) {
847
+ throw new TypeError('date() parameter must be one of [null, string, moment or Date]');
848
+ }
849
+
850
+ this._setValue(newDate === null ? null : this._parseInputDate(newDate), index);
851
+ };
852
+
853
+ DateTimePicker.prototype.format = function format(newFormat) {
854
+ if (arguments.length === 0) {
855
+ return this._options.format;
856
+ }
857
+
858
+ if (typeof newFormat !== 'string' && (typeof newFormat !== 'boolean' || newFormat !== false)) {
859
+ throw new TypeError('format() expects a string or boolean:false parameter ' + newFormat);
860
+ }
861
+
862
+ this._options.format = newFormat;
863
+ if (this.actualFormat) {
864
+ this._initFormatting(); // reinitialize formatting
865
+ }
866
+ };
867
+
868
+ DateTimePicker.prototype.timeZone = function timeZone(newZone) {
869
+ if (arguments.length === 0) {
870
+ return this._options.timeZone;
871
+ }
872
+
873
+ if (typeof newZone !== 'string') {
874
+ throw new TypeError('newZone() expects a string parameter');
875
+ }
876
+
877
+ this._options.timeZone = newZone;
878
+ };
879
+
880
+ DateTimePicker.prototype.dayViewHeaderFormat = function dayViewHeaderFormat(newFormat) {
881
+ if (arguments.length === 0) {
882
+ return this._options.dayViewHeaderFormat;
883
+ }
884
+
885
+ if (typeof newFormat !== 'string') {
886
+ throw new TypeError('dayViewHeaderFormat() expects a string parameter');
887
+ }
888
+
889
+ this._options.dayViewHeaderFormat = newFormat;
890
+ };
891
+
892
+ DateTimePicker.prototype.extraFormats = function extraFormats(formats) {
893
+ if (arguments.length === 0) {
894
+ return this._options.extraFormats;
895
+ }
896
+
897
+ if (formats !== false && !(formats instanceof Array)) {
898
+ throw new TypeError('extraFormats() expects an array or false parameter');
899
+ }
900
+
901
+ this._options.extraFormats = formats;
902
+ if (this.parseFormats) {
903
+ this._initFormatting(); // reinit formatting
904
+ }
905
+ };
906
+
907
+ DateTimePicker.prototype.disabledDates = function disabledDates(dates) {
908
+ if (arguments.length === 0) {
909
+ return this._options.disabledDates ? $.extend({}, this._options.disabledDates) : this._options.disabledDates;
910
+ }
911
+
912
+ if (!dates) {
913
+ this._options.disabledDates = false;
914
+ this._update();
915
+ return true;
916
+ }
917
+ if (!(dates instanceof Array)) {
918
+ throw new TypeError('disabledDates() expects an array parameter');
919
+ }
920
+ this._options.disabledDates = this._indexGivenDates(dates);
921
+ this._options.enabledDates = false;
922
+ this._update();
923
+ };
924
+
925
+ DateTimePicker.prototype.enabledDates = function enabledDates(dates) {
926
+ if (arguments.length === 0) {
927
+ return this._options.enabledDates ? $.extend({}, this._options.enabledDates) : this._options.enabledDates;
928
+ }
929
+
930
+ if (!dates) {
931
+ this._options.enabledDates = false;
932
+ this._update();
933
+ return true;
934
+ }
935
+ if (!(dates instanceof Array)) {
936
+ throw new TypeError('enabledDates() expects an array parameter');
937
+ }
938
+ this._options.enabledDates = this._indexGivenDates(dates);
939
+ this._options.disabledDates = false;
940
+ this._update();
941
+ };
942
+
943
+ DateTimePicker.prototype.daysOfWeekDisabled = function daysOfWeekDisabled(_daysOfWeekDisabled) {
944
+ if (arguments.length === 0) {
945
+ return this._options.daysOfWeekDisabled.splice(0);
946
+ }
947
+
948
+ if (typeof _daysOfWeekDisabled === 'boolean' && !_daysOfWeekDisabled) {
949
+ this._options.daysOfWeekDisabled = false;
950
+ this._update();
951
+ return true;
952
+ }
953
+
954
+ if (!(_daysOfWeekDisabled instanceof Array)) {
955
+ throw new TypeError('daysOfWeekDisabled() expects an array parameter');
956
+ }
957
+ this._options.daysOfWeekDisabled = _daysOfWeekDisabled.reduce(function (previousValue, currentValue) {
958
+ currentValue = parseInt(currentValue, 10);
959
+ if (currentValue > 6 || currentValue < 0 || isNaN(currentValue)) {
960
+ return previousValue;
961
+ }
962
+ if (previousValue.indexOf(currentValue) === -1) {
963
+ previousValue.push(currentValue);
964
+ }
965
+ return previousValue;
966
+ }, []).sort();
967
+ if (this._options.useCurrent && !this._options.keepInvalid) {
968
+ for (var i = 0; i < this._dates.length; i++) {
969
+ var tries = 0;
970
+ while (!this._isValid(this._dates[i], 'd')) {
971
+ this._dates[i].add(1, 'd');
972
+ if (tries === 31) {
973
+ throw 'Tried 31 times to find a valid date';
974
+ }
975
+ tries++;
976
+ }
977
+ this._setValue(this._dates[i], i);
978
+ }
979
+ }
980
+ this._update();
981
+ };
982
+
983
+ DateTimePicker.prototype.maxDate = function maxDate(_maxDate) {
984
+ if (arguments.length === 0) {
985
+ return this._options.maxDate ? this._options.maxDate.clone() : this._options.maxDate;
986
+ }
987
+
988
+ if (typeof _maxDate === 'boolean' && _maxDate === false) {
989
+ this._options.maxDate = false;
990
+ this._update();
991
+ return true;
992
+ }
993
+
994
+ if (typeof _maxDate === 'string') {
995
+ if (_maxDate === 'now' || _maxDate === 'moment') {
996
+ _maxDate = this.getMoment();
997
+ }
998
+ }
999
+
1000
+ var parsedDate = this._parseInputDate(_maxDate);
1001
+
1002
+ if (!parsedDate.isValid()) {
1003
+ throw new TypeError('maxDate() Could not parse date parameter: ' + _maxDate);
1004
+ }
1005
+ if (this._options.minDate && parsedDate.isBefore(this._options.minDate)) {
1006
+ throw new TypeError('maxDate() date parameter is before this.options.minDate: ' + parsedDate.format(this.actualFormat));
1007
+ }
1008
+ this._options.maxDate = parsedDate;
1009
+ for (var i = 0; i < this._dates.length; i++) {
1010
+ if (this._options.useCurrent && !this._options.keepInvalid && this._dates[i].isAfter(_maxDate)) {
1011
+ this._setValue(this._options.maxDate, i);
1012
+ }
1013
+ }
1014
+ if (this._viewDate.isAfter(parsedDate)) {
1015
+ this._viewDate = parsedDate.clone().subtract(this._options.stepping, 'm');
1016
+ }
1017
+ this._update();
1018
+ };
1019
+
1020
+ DateTimePicker.prototype.minDate = function minDate(_minDate) {
1021
+ if (arguments.length === 0) {
1022
+ return this._options.minDate ? this._options.minDate.clone() : this._options.minDate;
1023
+ }
1024
+
1025
+ if (typeof _minDate === 'boolean' && _minDate === false) {
1026
+ this._options.minDate = false;
1027
+ this._update();
1028
+ return true;
1029
+ }
1030
+
1031
+ if (typeof _minDate === 'string') {
1032
+ if (_minDate === 'now' || _minDate === 'moment') {
1033
+ _minDate = this.getMoment();
1034
+ }
1035
+ }
1036
+
1037
+ var parsedDate = this._parseInputDate(_minDate);
1038
+
1039
+ if (!parsedDate.isValid()) {
1040
+ throw new TypeError('minDate() Could not parse date parameter: ' + _minDate);
1041
+ }
1042
+ if (this._options.maxDate && parsedDate.isAfter(this._options.maxDate)) {
1043
+ throw new TypeError('minDate() date parameter is after this.options.maxDate: ' + parsedDate.format(this.actualFormat));
1044
+ }
1045
+ this._options.minDate = parsedDate;
1046
+ for (var i = 0; i < this._dates.length; i++) {
1047
+ if (this._options.useCurrent && !this._options.keepInvalid && this._dates[i].isBefore(_minDate)) {
1048
+ this._setValue(this._options.minDate, i);
1049
+ }
1050
+ }
1051
+ if (this._viewDate.isBefore(parsedDate)) {
1052
+ this._viewDate = parsedDate.clone().add(this._options.stepping, 'm');
1053
+ }
1054
+ this._update();
1055
+ };
1056
+
1057
+ DateTimePicker.prototype.defaultDate = function defaultDate(_defaultDate) {
1058
+ if (arguments.length === 0) {
1059
+ return this._options.defaultDate ? this._options.defaultDate.clone() : this._options.defaultDate;
1060
+ }
1061
+ if (!_defaultDate) {
1062
+ this._options.defaultDate = false;
1063
+ return true;
1064
+ }
1065
+
1066
+ if (typeof _defaultDate === 'string') {
1067
+ if (_defaultDate === 'now' || _defaultDate === 'moment') {
1068
+ _defaultDate = this.getMoment();
1069
+ } else {
1070
+ _defaultDate = this.getMoment(_defaultDate);
1071
+ }
1072
+ }
1073
+
1074
+ var parsedDate = this._parseInputDate(_defaultDate);
1075
+ if (!parsedDate.isValid()) {
1076
+ throw new TypeError('defaultDate() Could not parse date parameter: ' + _defaultDate);
1077
+ }
1078
+ if (!this._isValid(parsedDate)) {
1079
+ throw new TypeError('defaultDate() date passed is invalid according to component setup validations');
1080
+ }
1081
+
1082
+ this._options.defaultDate = parsedDate;
1083
+
1084
+ if (this._options.defaultDate && this._options.inline || this.input !== undefined && this.input.val().trim() === '') {
1085
+ this._setValue(this._options.defaultDate, 0);
1086
+ }
1087
+ };
1088
+
1089
+ DateTimePicker.prototype.locale = function locale(_locale) {
1090
+ if (arguments.length === 0) {
1091
+ return this._options.locale;
1092
+ }
1093
+
1094
+ if (!moment.localeData(_locale)) {
1095
+ throw new TypeError('locale() locale ' + _locale + ' is not loaded from moment locales!');
1096
+ }
1097
+
1098
+ for (var i = 0; i < this._dates.length; i++) {
1099
+ this._dates[i].locale(this._options.locale);
1100
+ }
1101
+ this._viewDate.locale(this._options.locale);
1102
+
1103
+ if (this.actualFormat) {
1104
+ this._initFormatting(); // reinitialize formatting
1105
+ }
1106
+ if (this.widget) {
1107
+ this.hide();
1108
+ this.show();
1109
+ }
1110
+ };
1111
+
1112
+ DateTimePicker.prototype.stepping = function stepping(_stepping) {
1113
+ if (arguments.length === 0) {
1114
+ return this._options.stepping;
1115
+ }
1116
+
1117
+ _stepping = parseInt(_stepping, 10);
1118
+ if (isNaN(_stepping) || _stepping < 1) {
1119
+ _stepping = 1;
1120
+ }
1121
+ this._options.stepping = _stepping;
1122
+ };
1123
+
1124
+ DateTimePicker.prototype.useCurrent = function useCurrent(_useCurrent) {
1125
+ var useCurrentOptions = ['year', 'month', 'day', 'hour', 'minute'];
1126
+ if (arguments.length === 0) {
1127
+ return this._options.useCurrent;
1128
+ }
1129
+
1130
+ if (typeof _useCurrent !== 'boolean' && typeof _useCurrent !== 'string') {
1131
+ throw new TypeError('useCurrent() expects a boolean or string parameter');
1132
+ }
1133
+ if (typeof _useCurrent === 'string' && useCurrentOptions.indexOf(_useCurrent.toLowerCase()) === -1) {
1134
+ throw new TypeError('useCurrent() expects a string parameter of ' + useCurrentOptions.join(', '));
1135
+ }
1136
+ this._options.useCurrent = _useCurrent;
1137
+ };
1138
+
1139
+ DateTimePicker.prototype.collapse = function collapse(_collapse) {
1140
+ if (arguments.length === 0) {
1141
+ return this._options.collapse;
1142
+ }
1143
+
1144
+ if (typeof _collapse !== 'boolean') {
1145
+ throw new TypeError('collapse() expects a boolean parameter');
1146
+ }
1147
+ if (this._options.collapse === _collapse) {
1148
+ return true;
1149
+ }
1150
+ this._options.collapse = _collapse;
1151
+ if (this.widget) {
1152
+ this.hide();
1153
+ this.show();
1154
+ }
1155
+ };
1156
+
1157
+ DateTimePicker.prototype.icons = function icons(_icons) {
1158
+ if (arguments.length === 0) {
1159
+ return $.extend({}, this._options.icons);
1160
+ }
1161
+
1162
+ if (!(_icons instanceof Object)) {
1163
+ throw new TypeError('icons() expects parameter to be an Object');
1164
+ }
1165
+
1166
+ $.extend(this._options.icons, _icons);
1167
+
1168
+ if (this.widget) {
1169
+ this.hide();
1170
+ this.show();
1171
+ }
1172
+ };
1173
+
1174
+ DateTimePicker.prototype.tooltips = function tooltips(_tooltips) {
1175
+ if (arguments.length === 0) {
1176
+ return $.extend({}, this._options.tooltips);
1177
+ }
1178
+
1179
+ if (!(_tooltips instanceof Object)) {
1180
+ throw new TypeError('tooltips() expects parameter to be an Object');
1181
+ }
1182
+ $.extend(this._options.tooltips, _tooltips);
1183
+ if (this.widget) {
1184
+ this.hide();
1185
+ this.show();
1186
+ }
1187
+ };
1188
+
1189
+ DateTimePicker.prototype.useStrict = function useStrict(_useStrict) {
1190
+ if (arguments.length === 0) {
1191
+ return this._options.useStrict;
1192
+ }
1193
+
1194
+ if (typeof _useStrict !== 'boolean') {
1195
+ throw new TypeError('useStrict() expects a boolean parameter');
1196
+ }
1197
+ this._options.useStrict = _useStrict;
1198
+ };
1199
+
1200
+ DateTimePicker.prototype.sideBySide = function sideBySide(_sideBySide) {
1201
+ if (arguments.length === 0) {
1202
+ return this._options.sideBySide;
1203
+ }
1204
+
1205
+ if (typeof _sideBySide !== 'boolean') {
1206
+ throw new TypeError('sideBySide() expects a boolean parameter');
1207
+ }
1208
+ this._options.sideBySide = _sideBySide;
1209
+ if (this.widget) {
1210
+ this.hide();
1211
+ this.show();
1212
+ }
1213
+ };
1214
+
1215
+ DateTimePicker.prototype.viewMode = function viewMode(_viewMode) {
1216
+ if (arguments.length === 0) {
1217
+ return this._options.viewMode;
1218
+ }
1219
+
1220
+ if (typeof _viewMode !== 'string') {
1221
+ throw new TypeError('viewMode() expects a string parameter');
1222
+ }
1223
+
1224
+ if (DateTimePicker.ViewModes.indexOf(_viewMode) === -1) {
1225
+ throw new TypeError('viewMode() parameter must be one of (' + DateTimePicker.ViewModes.join(', ') + ') value');
1226
+ }
1227
+
1228
+ this._options.viewMode = _viewMode;
1229
+ this.currentViewMode = Math.max(DateTimePicker.ViewModes.indexOf(_viewMode) - 1, DateTimePicker.MinViewModeNumber);
1230
+
1231
+ this._showMode();
1232
+ };
1233
+
1234
+ DateTimePicker.prototype.calendarWeeks = function calendarWeeks(_calendarWeeks) {
1235
+ if (arguments.length === 0) {
1236
+ return this._options.calendarWeeks;
1237
+ }
1238
+
1239
+ if (typeof _calendarWeeks !== 'boolean') {
1240
+ throw new TypeError('calendarWeeks() expects parameter to be a boolean value');
1241
+ }
1242
+
1243
+ this._options.calendarWeeks = _calendarWeeks;
1244
+ this._update();
1245
+ };
1246
+
1247
+ DateTimePicker.prototype.buttons = function buttons(_buttons) {
1248
+ if (arguments.length === 0) {
1249
+ return $.extend({}, this._options.buttons);
1250
+ }
1251
+
1252
+ if (!(_buttons instanceof Object)) {
1253
+ throw new TypeError('buttons() expects parameter to be an Object');
1254
+ }
1255
+
1256
+ $.extend(this._options.buttons, _buttons);
1257
+
1258
+ if (typeof this._options.buttons.showToday !== 'boolean') {
1259
+ throw new TypeError('buttons.showToday expects a boolean parameter');
1260
+ }
1261
+ if (typeof this._options.buttons.showClear !== 'boolean') {
1262
+ throw new TypeError('buttons.showClear expects a boolean parameter');
1263
+ }
1264
+ if (typeof this._options.buttons.showClose !== 'boolean') {
1265
+ throw new TypeError('buttons.showClose expects a boolean parameter');
1266
+ }
1267
+
1268
+ if (this.widget) {
1269
+ this.hide();
1270
+ this.show();
1271
+ }
1272
+ };
1273
+
1274
+ DateTimePicker.prototype.keepOpen = function keepOpen(_keepOpen) {
1275
+ if (arguments.length === 0) {
1276
+ return this._options.keepOpen;
1277
+ }
1278
+
1279
+ if (typeof _keepOpen !== 'boolean') {
1280
+ throw new TypeError('keepOpen() expects a boolean parameter');
1281
+ }
1282
+
1283
+ this._options.keepOpen = _keepOpen;
1284
+ };
1285
+
1286
+ DateTimePicker.prototype.focusOnShow = function focusOnShow(_focusOnShow) {
1287
+ if (arguments.length === 0) {
1288
+ return this._options.focusOnShow;
1289
+ }
1290
+
1291
+ if (typeof _focusOnShow !== 'boolean') {
1292
+ throw new TypeError('focusOnShow() expects a boolean parameter');
1293
+ }
1294
+
1295
+ this._options.focusOnShow = _focusOnShow;
1296
+ };
1297
+
1298
+ DateTimePicker.prototype.inline = function inline(_inline) {
1299
+ if (arguments.length === 0) {
1300
+ return this._options.inline;
1301
+ }
1302
+
1303
+ if (typeof _inline !== 'boolean') {
1304
+ throw new TypeError('inline() expects a boolean parameter');
1305
+ }
1306
+
1307
+ this._options.inline = _inline;
1308
+ };
1309
+
1310
+ DateTimePicker.prototype.clear = function clear() {
1311
+ this._setValue(null); //todo
1312
+ };
1313
+
1314
+ DateTimePicker.prototype.keyBinds = function keyBinds(_keyBinds) {
1315
+ if (arguments.length === 0) {
1316
+ return this._options.keyBinds;
1317
+ }
1318
+
1319
+ this._options.keyBinds = _keyBinds;
1320
+ };
1321
+
1322
+ DateTimePicker.prototype.debug = function debug(_debug) {
1323
+ if (typeof _debug !== 'boolean') {
1324
+ throw new TypeError('debug() expects a boolean parameter');
1325
+ }
1326
+
1327
+ this._options.debug = _debug;
1328
+ };
1329
+
1330
+ DateTimePicker.prototype.allowInputToggle = function allowInputToggle(_allowInputToggle) {
1331
+ if (arguments.length === 0) {
1332
+ return this._options.allowInputToggle;
1333
+ }
1334
+
1335
+ if (typeof _allowInputToggle !== 'boolean') {
1336
+ throw new TypeError('allowInputToggle() expects a boolean parameter');
1337
+ }
1338
+
1339
+ this._options.allowInputToggle = _allowInputToggle;
1340
+ };
1341
+
1342
+ DateTimePicker.prototype.keepInvalid = function keepInvalid(_keepInvalid) {
1343
+ if (arguments.length === 0) {
1344
+ return this._options.keepInvalid;
1345
+ }
1346
+
1347
+ if (typeof _keepInvalid !== 'boolean') {
1348
+ throw new TypeError('keepInvalid() expects a boolean parameter');
1349
+ }
1350
+ this._options.keepInvalid = _keepInvalid;
1351
+ };
1352
+
1353
+ DateTimePicker.prototype.datepickerInput = function datepickerInput(_datepickerInput) {
1354
+ if (arguments.length === 0) {
1355
+ return this._options.datepickerInput;
1356
+ }
1357
+
1358
+ if (typeof _datepickerInput !== 'string') {
1359
+ throw new TypeError('datepickerInput() expects a string parameter');
1360
+ }
1361
+
1362
+ this._options.datepickerInput = _datepickerInput;
1363
+ };
1364
+
1365
+ DateTimePicker.prototype.parseInputDate = function parseInputDate(_parseInputDate2) {
1366
+ if (arguments.length === 0) {
1367
+ return this._options.parseInputDate;
1368
+ }
1369
+
1370
+ if (typeof _parseInputDate2 !== 'function') {
1371
+ throw new TypeError('parseInputDate() should be as function');
1372
+ }
1373
+
1374
+ this._options.parseInputDate = _parseInputDate2;
1375
+ };
1376
+
1377
+ DateTimePicker.prototype.disabledTimeIntervals = function disabledTimeIntervals(_disabledTimeIntervals) {
1378
+ if (arguments.length === 0) {
1379
+ return this._options.disabledTimeIntervals ? $.extend({}, this._options.disabledTimeIntervals) : this._options.disabledTimeIntervals;
1380
+ }
1381
+
1382
+ if (!_disabledTimeIntervals) {
1383
+ this._options.disabledTimeIntervals = false;
1384
+ this._update();
1385
+ return true;
1386
+ }
1387
+ if (!(_disabledTimeIntervals instanceof Array)) {
1388
+ throw new TypeError('disabledTimeIntervals() expects an array parameter');
1389
+ }
1390
+ this._options.disabledTimeIntervals = _disabledTimeIntervals;
1391
+ this._update();
1392
+ };
1393
+
1394
+ DateTimePicker.prototype.disabledHours = function disabledHours(hours) {
1395
+ if (arguments.length === 0) {
1396
+ return this._options.disabledHours ? $.extend({}, this._options.disabledHours) : this._options.disabledHours;
1397
+ }
1398
+
1399
+ if (!hours) {
1400
+ this._options.disabledHours = false;
1401
+ this._update();
1402
+ return true;
1403
+ }
1404
+ if (!(hours instanceof Array)) {
1405
+ throw new TypeError('disabledHours() expects an array parameter');
1406
+ }
1407
+ this._options.disabledHours = this._indexGivenHours(hours);
1408
+ this._options.enabledHours = false;
1409
+ if (this._options.useCurrent && !this._options.keepInvalid) {
1410
+ for (var i = 0; i < this._dates.length; i++) {
1411
+ var tries = 0;
1412
+ while (!this._isValid(this._dates[i], 'h')) {
1413
+ this._dates[i].add(1, 'h');
1414
+ if (tries === 24) {
1415
+ throw 'Tried 24 times to find a valid date';
1416
+ }
1417
+ tries++;
1418
+ }
1419
+ this._setValue(this._dates[i], i);
1420
+ }
1421
+ }
1422
+ this._update();
1423
+ };
1424
+
1425
+ DateTimePicker.prototype.enabledHours = function enabledHours(hours) {
1426
+ if (arguments.length === 0) {
1427
+ return this._options.enabledHours ? $.extend({}, this._options.enabledHours) : this._options.enabledHours;
1428
+ }
1429
+
1430
+ if (!hours) {
1431
+ this._options.enabledHours = false;
1432
+ this._update();
1433
+ return true;
1434
+ }
1435
+ if (!(hours instanceof Array)) {
1436
+ throw new TypeError('enabledHours() expects an array parameter');
1437
+ }
1438
+ this._options.enabledHours = this._indexGivenHours(hours);
1439
+ this._options.disabledHours = false;
1440
+ if (this._options.useCurrent && !this._options.keepInvalid) {
1441
+ for (var i = 0; i < this._dates.length; i++) {
1442
+ var tries = 0;
1443
+ while (!this._isValid(this._dates[i], 'h')) {
1444
+ this._dates[i].add(1, 'h');
1445
+ if (tries === 24) {
1446
+ throw 'Tried 24 times to find a valid date';
1447
+ }
1448
+ tries++;
1449
+ }
1450
+ this._setValue(this._dates[i], i);
1451
+ }
1452
+ }
1453
+ this._update();
1454
+ };
1455
+
1456
+ DateTimePicker.prototype.viewDate = function viewDate(newDate) {
1457
+ if (arguments.length === 0) {
1458
+ return this._viewDate.clone();
1459
+ }
1460
+
1461
+ if (!newDate) {
1462
+ this._viewDate = (this._dates[0] || this.getMoment()).clone();
1463
+ return true;
1464
+ }
1465
+
1466
+ if (typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) {
1467
+ throw new TypeError('viewDate() parameter must be one of [string, moment or Date]');
1468
+ }
1469
+
1470
+ this._viewDate = this._parseInputDate(newDate);
1471
+ this._viewUpdate();
1472
+ };
1473
+
1474
+ DateTimePicker.prototype.allowMultidate = function allowMultidate(_allowMultidate) {
1475
+ if (typeof _allowMultidate !== 'boolean') {
1476
+ throw new TypeError('allowMultidate() expects a boolean parameter');
1477
+ }
1478
+
1479
+ this._options.allowMultidate = _allowMultidate;
1480
+ };
1481
+
1482
+ DateTimePicker.prototype.multidateSeparator = function multidateSeparator(_multidateSeparator) {
1483
+ if (arguments.length === 0) {
1484
+ return this._options.multidateSeparator;
1485
+ }
1486
+
1487
+ if (typeof _multidateSeparator !== 'string' || _multidateSeparator.length > 1) {
1488
+ throw new TypeError('multidateSeparator expects a single character string parameter');
1489
+ }
1490
+
1491
+ this._options.multidateSeparator = _multidateSeparator;
1492
+ };
1493
+
1494
+ _createClass(DateTimePicker, null, [{
1495
+ key: 'NAME',
1496
+ get: function get() {
1497
+ return NAME;
1498
+ }
1499
+
1500
+ /**
1501
+ * @return {string}
1502
+ */
1503
+
1504
+ }, {
1505
+ key: 'VERSION',
1506
+ get: function get() {
1507
+ return VERSION;
1508
+ }
1509
+
1510
+ /**
1511
+ * @return {string}
1512
+ */
1513
+
1514
+ }, {
1515
+ key: 'DATA_KEY',
1516
+ get: function get() {
1517
+ return DATA_KEY;
1518
+ }
1519
+
1520
+ /**
1521
+ * @return {string}
1522
+ */
1523
+
1524
+ }, {
1525
+ key: 'EVENT_KEY',
1526
+ get: function get() {
1527
+ return EVENT_KEY;
1528
+ }
1529
+
1530
+ /**
1531
+ * @return {string}
1532
+ */
1533
+
1534
+ }, {
1535
+ key: 'DATA_API_KEY',
1536
+ get: function get() {
1537
+ return DATA_API_KEY;
1538
+ }
1539
+ }, {
1540
+ key: 'DatePickerModes',
1541
+ get: function get() {
1542
+ return DatePickerModes;
1543
+ }
1544
+ }, {
1545
+ key: 'ViewModes',
1546
+ get: function get() {
1547
+ return ViewModes;
1548
+ }
1549
+
1550
+ /**
1551
+ * @return {number}
1552
+ */
1553
+
1554
+ }, {
1555
+ key: 'MinViewModeNumber',
1556
+ get: function get() {
1557
+ return MinViewModeNumber;
1558
+ }
1559
+ }, {
1560
+ key: 'Event',
1561
+ get: function get() {
1562
+ return Event;
1563
+ }
1564
+ }, {
1565
+ key: 'Selector',
1566
+ get: function get() {
1567
+ return Selector;
1568
+ }
1569
+ }, {
1570
+ key: 'Default',
1571
+ get: function get() {
1572
+ return Default;
1573
+ },
1574
+ set: function set(value) {
1575
+ Default = value;
1576
+ }
1577
+ }, {
1578
+ key: 'ClassName',
1579
+ get: function get() {
1580
+ return ClassName;
1581
+ }
1582
+ }]);
1583
+
1584
+ return DateTimePicker;
1585
+ }();
1586
+
1587
+ return DateTimePicker;
1588
+ }(jQuery, moment);
1589
+
1590
+ //noinspection JSUnusedGlobalSymbols
1591
+ /* global DateTimePicker */
1592
+ var TempusDominusBootstrap4 = function ($) {
1593
+ // eslint-disable-line no-unused-vars
1594
+ // ReSharper disable once InconsistentNaming
1595
+ var JQUERY_NO_CONFLICT = $.fn[DateTimePicker.NAME],
1596
+ verticalModes = ['top', 'bottom', 'auto'],
1597
+ horizontalModes = ['left', 'right', 'auto'],
1598
+ toolbarPlacements = ['default', 'top', 'bottom'],
1599
+ getSelectorFromElement = function getSelectorFromElement($element) {
1600
+ var selector = $element.data('target'),
1601
+ $selector = void 0;
1602
+
1603
+ if (!selector) {
1604
+ selector = $element.attr('href') || '';
1605
+ selector = /^#[a-z]/i.test(selector) ? selector : null;
1606
+ }
1607
+ $selector = $(selector);
1608
+ if ($selector.length === 0) {
1609
+ return $selector;
1610
+ }
1611
+
1612
+ if (!$selector.data(DateTimePicker.DATA_KEY)) {
1613
+ $.extend({}, $selector.data(), $(this).data());
1614
+ }
1615
+
1616
+ return $selector;
1617
+ };
1618
+
1619
+ // ReSharper disable once InconsistentNaming
1620
+
1621
+ var TempusDominusBootstrap4 = function (_DateTimePicker) {
1622
+ _inherits(TempusDominusBootstrap4, _DateTimePicker);
1623
+
1624
+ function TempusDominusBootstrap4(element, options) {
1625
+ _classCallCheck(this, TempusDominusBootstrap4);
1626
+
1627
+ var _this = _possibleConstructorReturn(this, _DateTimePicker.call(this, element, options));
1628
+
1629
+ _this._init();
1630
+ return _this;
1631
+ }
1632
+
1633
+ TempusDominusBootstrap4.prototype._init = function _init() {
1634
+ if (this._element.hasClass('input-group')) {
1635
+ // in case there is more then one 'input-group-addon' Issue #48
1636
+ var datepickerButton = this._element.find('.datepickerbutton');
1637
+ if (datepickerButton.length === 0) {
1638
+ this.component = this._element.find('.input-group-addon');
1639
+ } else {
1640
+ this.component = datepickerButton;
1641
+ }
1642
+ }
1643
+ };
1644
+
1645
+ TempusDominusBootstrap4.prototype._getDatePickerTemplate = function _getDatePickerTemplate() {
1646
+ var headTemplate = $('<thead>').append($('<tr>').append($('<th>').addClass('prev').attr('data-action', 'previous').append($('<span>').addClass(this._options.icons.previous))).append($('<th>').addClass('picker-switch').attr('data-action', 'pickerSwitch').attr('colspan', '' + (this._options.calendarWeeks ? '6' : '5'))).append($('<th>').addClass('next').attr('data-action', 'next').append($('<span>').addClass(this._options.icons.next)))),
1647
+ contTemplate = $('<tbody>').append($('<tr>').append($('<td>').attr('colspan', '' + (this._options.calendarWeeks ? '8' : '7'))));
1648
+
1649
+ return [$('<div>').addClass('datepicker-days').append($('<table>').addClass('table table-sm').append(headTemplate).append($('<tbody>'))), $('<div>').addClass('datepicker-months').append($('<table>').addClass('table-condensed').append(headTemplate.clone()).append(contTemplate.clone())), $('<div>').addClass('datepicker-years').append($('<table>').addClass('table-condensed').append(headTemplate.clone()).append(contTemplate.clone())), $('<div>').addClass('datepicker-decades').append($('<table>').addClass('table-condensed').append(headTemplate.clone()).append(contTemplate.clone()))];
1650
+ };
1651
+
1652
+ TempusDominusBootstrap4.prototype._getTimePickerMainTemplate = function _getTimePickerMainTemplate() {
1653
+ var topRow = $('<tr>'),
1654
+ middleRow = $('<tr>'),
1655
+ bottomRow = $('<tr>');
1656
+
1657
+ if (this._isEnabled('h')) {
1658
+ topRow.append($('<td>').append($('<a>').attr({
1659
+ href: '#',
1660
+ tabindex: '-1',
1661
+ 'title': this._options.tooltips.incrementHour
1662
+ }).addClass('btn').attr('data-action', 'incrementHours').append($('<span>').addClass(this._options.icons.up))));
1663
+ middleRow.append($('<td>').append($('<span>').addClass('timepicker-hour').attr({
1664
+ 'data-time-component': 'hours',
1665
+ 'title': this._options.tooltips.pickHour
1666
+ }).attr('data-action', 'showHours')));
1667
+ bottomRow.append($('<td>').append($('<a>').attr({
1668
+ href: '#',
1669
+ tabindex: '-1',
1670
+ 'title': this._options.tooltips.decrementHour
1671
+ }).addClass('btn').attr('data-action', 'decrementHours').append($('<span>').addClass(this._options.icons.down))));
1672
+ }
1673
+ if (this._isEnabled('m')) {
1674
+ if (this._isEnabled('h')) {
1675
+ topRow.append($('<td>').addClass('separator'));
1676
+ middleRow.append($('<td>').addClass('separator').html(':'));
1677
+ bottomRow.append($('<td>').addClass('separator'));
1678
+ }
1679
+ topRow.append($('<td>').append($('<a>').attr({
1680
+ href: '#',
1681
+ tabindex: '-1',
1682
+ 'title': this._options.tooltips.incrementMinute
1683
+ }).addClass('btn').attr('data-action', 'incrementMinutes').append($('<span>').addClass(this._options.icons.up))));
1684
+ middleRow.append($('<td>').append($('<span>').addClass('timepicker-minute').attr({
1685
+ 'data-time-component': 'minutes',
1686
+ 'title': this._options.tooltips.pickMinute
1687
+ }).attr('data-action', 'showMinutes')));
1688
+ bottomRow.append($('<td>').append($('<a>').attr({
1689
+ href: '#',
1690
+ tabindex: '-1',
1691
+ 'title': this._options.tooltips.decrementMinute
1692
+ }).addClass('btn').attr('data-action', 'decrementMinutes').append($('<span>').addClass(this._options.icons.down))));
1693
+ }
1694
+ if (this._isEnabled('s')) {
1695
+ if (this._isEnabled('m')) {
1696
+ topRow.append($('<td>').addClass('separator'));
1697
+ middleRow.append($('<td>').addClass('separator').html(':'));
1698
+ bottomRow.append($('<td>').addClass('separator'));
1699
+ }
1700
+ topRow.append($('<td>').append($('<a>').attr({
1701
+ href: '#',
1702
+ tabindex: '-1',
1703
+ 'title': this._options.tooltips.incrementSecond
1704
+ }).addClass('btn').attr('data-action', 'incrementSeconds').append($('<span>').addClass(this._options.icons.up))));
1705
+ middleRow.append($('<td>').append($('<span>').addClass('timepicker-second').attr({
1706
+ 'data-time-component': 'seconds',
1707
+ 'title': this._options.tooltips.pickSecond
1708
+ }).attr('data-action', 'showSeconds')));
1709
+ bottomRow.append($('<td>').append($('<a>').attr({
1710
+ href: '#',
1711
+ tabindex: '-1',
1712
+ 'title': this._options.tooltips.decrementSecond
1713
+ }).addClass('btn').attr('data-action', 'decrementSeconds').append($('<span>').addClass(this._options.icons.down))));
1714
+ }
1715
+
1716
+ if (!this.use24Hours) {
1717
+ topRow.append($('<td>').addClass('separator'));
1718
+ middleRow.append($('<td>').append($('<button>').addClass('btn btn-primary').attr({
1719
+ 'data-action': 'togglePeriod',
1720
+ tabindex: '-1',
1721
+ 'title': this._options.tooltips.togglePeriod
1722
+ })));
1723
+ bottomRow.append($('<td>').addClass('separator'));
1724
+ }
1725
+
1726
+ return $('<div>').addClass('timepicker-picker').append($('<table>').addClass('table-condensed').append([topRow, middleRow, bottomRow]));
1727
+ };
1728
+
1729
+ TempusDominusBootstrap4.prototype._getTimePickerTemplate = function _getTimePickerTemplate() {
1730
+ var hoursView = $('<div>').addClass('timepicker-hours').append($('<table>').addClass('table-condensed')),
1731
+ minutesView = $('<div>').addClass('timepicker-minutes').append($('<table>').addClass('table-condensed')),
1732
+ secondsView = $('<div>').addClass('timepicker-seconds').append($('<table>').addClass('table-condensed')),
1733
+ ret = [this._getTimePickerMainTemplate()];
1734
+
1735
+ if (this._isEnabled('h')) {
1736
+ ret.push(hoursView);
1737
+ }
1738
+ if (this._isEnabled('m')) {
1739
+ ret.push(minutesView);
1740
+ }
1741
+ if (this._isEnabled('s')) {
1742
+ ret.push(secondsView);
1743
+ }
1744
+
1745
+ return ret;
1746
+ };
1747
+
1748
+ TempusDominusBootstrap4.prototype._getToolbar = function _getToolbar() {
1749
+ var row = [];
1750
+ if (this._options.buttons.showToday) {
1751
+ row.push($('<td>').append($('<a>').attr({
1752
+ 'data-action': 'today',
1753
+ 'title': this._options.tooltips.today
1754
+ }).append($('<span>').addClass(this._options.icons.today))));
1755
+ }
1756
+ if (!this._options.sideBySide && this._hasDate() && this._hasTime()) {
1757
+ row.push($('<td>').append($('<a>').attr({
1758
+ 'data-action': 'togglePicker',
1759
+ 'title': this._options.tooltips.selectTime
1760
+ }).append($('<span>').addClass(this._options.icons.time))));
1761
+ }
1762
+ if (this._options.buttons.showClear) {
1763
+ row.push($('<td>').append($('<a>').attr({
1764
+ 'data-action': 'clear',
1765
+ 'title': this._options.tooltips.clear
1766
+ }).append($('<span>').addClass(this._options.icons.clear))));
1767
+ }
1768
+ if (this._options.buttons.showClose) {
1769
+ row.push($('<td>').append($('<a>').attr({
1770
+ 'data-action': 'close',
1771
+ 'title': this._options.tooltips.close
1772
+ }).append($('<span>').addClass(this._options.icons.close))));
1773
+ }
1774
+ return row.length === 0 ? '' : $('<table>').addClass('table-condensed').append($('<tbody>').append($('<tr>').append(row)));
1775
+ };
1776
+
1777
+ TempusDominusBootstrap4.prototype._getTemplate = function _getTemplate() {
1778
+ var template = $('<div>').addClass('bootstrap-datetimepicker-widget dropdown-menu'),
1779
+ dateView = $('<div>').addClass('datepicker').append(this._getDatePickerTemplate()),
1780
+ timeView = $('<div>').addClass('timepicker').append(this._getTimePickerTemplate()),
1781
+ content = $('<ul>').addClass('list-unstyled'),
1782
+ toolbar = $('<li>').addClass('picker-switch' + (this._options.collapse ? ' accordion-toggle' : '')).append(this._getToolbar());
1783
+
1784
+ if (this._options.inline) {
1785
+ template.removeClass('dropdown-menu');
1786
+ }
1787
+
1788
+ if (this.use24Hours) {
1789
+ template.addClass('usetwentyfour');
1790
+ }
1791
+ if (this._isEnabled('s') && !this.use24Hours) {
1792
+ template.addClass('wider');
1793
+ }
1794
+
1795
+ if (this._options.sideBySide && this._hasDate() && this._hasTime()) {
1796
+ template.addClass('timepicker-sbs');
1797
+ if (this._options.toolbarPlacement === 'top') {
1798
+ template.append(toolbar);
1799
+ }
1800
+ template.append($('<div>').addClass('row').append(dateView.addClass('col-md-6')).append(timeView.addClass('col-md-6')));
1801
+ if (this._options.toolbarPlacement === 'bottom' || this._options.toolbarPlacement === 'default') {
1802
+ template.append(toolbar);
1803
+ }
1804
+ return template;
1805
+ }
1806
+
1807
+ if (this._options.toolbarPlacement === 'top') {
1808
+ content.append(toolbar);
1809
+ }
1810
+ if (this._hasDate()) {
1811
+ content.append($('<li>').addClass(this._options.collapse && this._hasTime() ? 'collapse' : '').addClass(this._options.collapse && this._hasTime() && this._options.viewMode === 'time' ? '' : 'show').append(dateView));
1812
+ }
1813
+ if (this._options.toolbarPlacement === 'default') {
1814
+ content.append(toolbar);
1815
+ }
1816
+ if (this._hasTime()) {
1817
+ content.append($('<li>').addClass(this._options.collapse && this._hasDate() ? 'collapse' : '').addClass(this._options.collapse && this._hasDate() && this._options.viewMode === 'time' ? 'show' : '').append(timeView));
1818
+ }
1819
+ if (this._options.toolbarPlacement === 'bottom') {
1820
+ content.append(toolbar);
1821
+ }
1822
+ return template.append(content);
1823
+ };
1824
+
1825
+ TempusDominusBootstrap4.prototype._place = function _place(e) {
1826
+ var self = e && e.data && e.data.picker || this,
1827
+ vertical = self._options.widgetPositioning.vertical,
1828
+ horizontal = self._options.widgetPositioning.horizontal,
1829
+ parent = void 0;
1830
+ var position = (self.component || self._element).position(),
1831
+ offset = (self.component || self._element).offset();
1832
+ if (self._options.widgetParent) {
1833
+ parent = self._options.widgetParent.append(self.widget);
1834
+ } else if (self._element.is('input')) {
1835
+ parent = self._element.after(self.widget).parent();
1836
+ } else if (self._options.inline) {
1837
+ parent = self._element.append(self.widget);
1838
+ return;
1839
+ } else {
1840
+ parent = self._element;
1841
+ self._element.children().first().after(self.widget);
1842
+ }
1843
+
1844
+ // Top and bottom logic
1845
+ if (vertical === 'auto') {
1846
+ //noinspection JSValidateTypes
1847
+ if (offset.top + self.widget.height() * 1.5 >= $(window).height() + $(window).scrollTop() && self.widget.height() + self._element.outerHeight() < offset.top) {
1848
+ vertical = 'top';
1849
+ } else {
1850
+ vertical = 'bottom';
1851
+ }
1852
+ }
1853
+
1854
+ // Left and right logic
1855
+ if (horizontal === 'auto') {
1856
+ if (parent.width() < offset.left + self.widget.outerWidth() / 2 && offset.left + self.widget.outerWidth() > $(window).width()) {
1857
+ horizontal = 'right';
1858
+ } else {
1859
+ horizontal = 'left';
1860
+ }
1861
+ }
1862
+
1863
+ if (vertical === 'top') {
1864
+ self.widget.addClass('top').removeClass('bottom');
1865
+ } else {
1866
+ self.widget.addClass('bottom').removeClass('top');
1867
+ }
1868
+
1869
+ if (horizontal === 'right') {
1870
+ self.widget.addClass('float-right');
1871
+ } else {
1872
+ self.widget.removeClass('float-right');
1873
+ }
1874
+
1875
+ // find the first parent element that has a relative css positioning
1876
+ if (parent.css('position') !== 'relative') {
1877
+ parent = parent.parents().filter(function () {
1878
+ return $(this).css('position') === 'relative';
1879
+ }).first();
1880
+ }
1881
+
1882
+ if (parent.length === 0) {
1883
+ throw new Error('datetimepicker component should be placed within a relative positioned container');
1884
+ }
1885
+
1886
+ self.widget.css({
1887
+ top: vertical === 'top' ? 'auto' : position.top + self._element.outerHeight() + 'px',
1888
+ bottom: vertical === 'top' ? parent.outerHeight() - (parent === self._element ? 0 : position.top) + 'px' : 'auto',
1889
+ left: horizontal === 'left' ? (parent === self._element ? 0 : position.left) + 'px' : 'auto',
1890
+ right: horizontal === 'left' ? 'auto' : parent.outerWidth() - self._element.outerWidth() - (parent === self._element ? 0 : position.left) + 'px'
1891
+ });
1892
+ };
1893
+
1894
+ TempusDominusBootstrap4.prototype._fillDow = function _fillDow() {
1895
+ var row = $('<tr>'),
1896
+ currentDate = this._viewDate.clone().startOf('w').startOf('d');
1897
+
1898
+ if (this._options.calendarWeeks === true) {
1899
+ row.append($('<th>').addClass('cw').text('#'));
1900
+ }
1901
+
1902
+ while (currentDate.isBefore(this._viewDate.clone().endOf('w'))) {
1903
+ row.append($('<th>').addClass('dow').text(currentDate.format('dd')));
1904
+ currentDate.add(1, 'd');
1905
+ }
1906
+ this.widget.find('.datepicker-days thead').append(row);
1907
+ };
1908
+
1909
+ TempusDominusBootstrap4.prototype._fillMonths = function _fillMonths() {
1910
+ var spans = [],
1911
+ monthsShort = this._viewDate.clone().startOf('y').startOf('d');
1912
+ while (monthsShort.isSame(this._viewDate, 'y')) {
1913
+ spans.push($('<span>').attr('data-action', 'selectMonth').addClass('month').text(monthsShort.format('MMM')));
1914
+ monthsShort.add(1, 'M');
1915
+ }
1916
+ this.widget.find('.datepicker-months td').empty().append(spans);
1917
+ };
1918
+
1919
+ TempusDominusBootstrap4.prototype._updateMonths = function _updateMonths() {
1920
+ var monthsView = this.widget.find('.datepicker-months'),
1921
+ monthsViewHeader = monthsView.find('th'),
1922
+ months = monthsView.find('tbody').find('span'),
1923
+ self = this;
1924
+
1925
+ monthsViewHeader.eq(0).find('span').attr('title', this._options.tooltips.prevYear);
1926
+ monthsViewHeader.eq(1).attr('title', this._options.tooltips.selectYear);
1927
+ monthsViewHeader.eq(2).find('span').attr('title', this._options.tooltips.nextYear);
1928
+
1929
+ monthsView.find('.disabled').removeClass('disabled');
1930
+
1931
+ if (!this._isValid(this._viewDate.clone().subtract(1, 'y'), 'y')) {
1932
+ monthsViewHeader.eq(0).addClass('disabled');
1933
+ }
1934
+
1935
+ monthsViewHeader.eq(1).text(this._viewDate.year());
1936
+
1937
+ if (!this._isValid(this._viewDate.clone().add(1, 'y'), 'y')) {
1938
+ monthsViewHeader.eq(2).addClass('disabled');
1939
+ }
1940
+
1941
+ months.removeClass('active');
1942
+ if (this._getLastPickedDate().isSame(this._viewDate, 'y') && !this.unset) {
1943
+ months.eq(this._getLastPickedDate().month()).addClass('active');
1944
+ }
1945
+
1946
+ months.each(function (index) {
1947
+ if (!self._isValid(self._viewDate.clone().month(index), 'M')) {
1948
+ $(this).addClass('disabled');
1949
+ }
1950
+ });
1951
+ };
1952
+
1953
+ TempusDominusBootstrap4.prototype._getStartEndYear = function _getStartEndYear(factor, year) {
1954
+ var step = factor / 10,
1955
+ startYear = Math.floor(year / factor) * factor,
1956
+ endYear = startYear + step * 9,
1957
+ focusValue = Math.floor(year / step) * step;
1958
+ return [startYear, endYear, focusValue];
1959
+ };
1960
+
1961
+ TempusDominusBootstrap4.prototype._updateYears = function _updateYears() {
1962
+ var yearsView = this.widget.find('.datepicker-years'),
1963
+ yearsViewHeader = yearsView.find('th'),
1964
+ yearCaps = this._getStartEndYear(10, this._viewDate.year()),
1965
+ startYear = this._viewDate.clone().year(yearCaps[0]),
1966
+ endYear = this._viewDate.clone().year(yearCaps[1]);
1967
+ var html = '';
1968
+
1969
+ yearsViewHeader.eq(0).find('span').attr('title', this._options.tooltips.prevDecade);
1970
+ yearsViewHeader.eq(1).attr('title', this._options.tooltips.selectDecade);
1971
+ yearsViewHeader.eq(2).find('span').attr('title', this._options.tooltips.nextDecade);
1972
+
1973
+ yearsView.find('.disabled').removeClass('disabled');
1974
+
1975
+ if (this._options.minDate && this._options.minDate.isAfter(startYear, 'y')) {
1976
+ yearsViewHeader.eq(0).addClass('disabled');
1977
+ }
1978
+
1979
+ yearsViewHeader.eq(1).text(startYear.year() + '-' + endYear.year());
1980
+
1981
+ if (this._options.maxDate && this._options.maxDate.isBefore(endYear, 'y')) {
1982
+ yearsViewHeader.eq(2).addClass('disabled');
1983
+ }
1984
+
1985
+ html += '<span data-action="selectYear" class="year old">' + (startYear.year() - 1) + '</span>';
1986
+ while (!startYear.isAfter(endYear, 'y')) {
1987
+ html += '<span data-action="selectYear" class="year' + (startYear.isSame(this._getLastPickedDate(), 'y') && !this.unset ? ' active' : '') + (!this._isValid(startYear, 'y') ? ' disabled' : '') + '">' + startYear.year() + '</span>';
1988
+ startYear.add(1, 'y');
1989
+ }
1990
+ html += '<span data-action="selectYear" class="year old">' + startYear.year() + '</span>';
1991
+
1992
+ yearsView.find('td').html(html);
1993
+ };
1994
+
1995
+ TempusDominusBootstrap4.prototype._updateDecades = function _updateDecades() {
1996
+ var decadesView = this.widget.find('.datepicker-decades'),
1997
+ decadesViewHeader = decadesView.find('th'),
1998
+ yearCaps = this._getStartEndYear(100, this._viewDate.year()),
1999
+ startDecade = this._viewDate.clone().year(yearCaps[0]),
2000
+ endDecade = this._viewDate.clone().year(yearCaps[1]);
2001
+ var minDateDecade = false,
2002
+ maxDateDecade = false,
2003
+ endDecadeYear = void 0,
2004
+ html = '';
2005
+
2006
+ decadesViewHeader.eq(0).find('span').attr('title', this._options.tooltips.prevCentury);
2007
+ decadesViewHeader.eq(2).find('span').attr('title', this._options.tooltips.nextCentury);
2008
+
2009
+ decadesView.find('.disabled').removeClass('disabled');
2010
+
2011
+ if (startDecade.year() === 0 || this._options.minDate && this._options.minDate.isAfter(startDecade, 'y')) {
2012
+ decadesViewHeader.eq(0).addClass('disabled');
2013
+ }
2014
+
2015
+ decadesViewHeader.eq(1).text(startDecade.year() + '-' + endDecade.year());
2016
+
2017
+ if (this._options.maxDate && this._options.maxDate.isBefore(endDecade, 'y')) {
2018
+ decadesViewHeader.eq(2).addClass('disabled');
2019
+ }
2020
+
2021
+ if (startDecade.year() - 10 < 0) {
2022
+ html += '<span>&nbsp;</span>';
2023
+ } else {
2024
+ html += '<span data-action="selectDecade" class="decade old" data-selection="' + (startDecade.year() + 6) + '">' + (startDecade.year() - 10) + '</span>';
2025
+ }
2026
+
2027
+ while (!startDecade.isAfter(endDecade, 'y')) {
2028
+ endDecadeYear = startDecade.year() + 11;
2029
+ minDateDecade = this._options.minDate && this._options.minDate.isAfter(startDecade, 'y') && this._options.minDate.year() <= endDecadeYear;
2030
+ maxDateDecade = this._options.maxDate && this._options.maxDate.isAfter(startDecade, 'y') && this._options.maxDate.year() <= endDecadeYear;
2031
+ html += '<span data-action="selectDecade" class="decade' + (this._getLastPickedDate().isAfter(startDecade) && this._getLastPickedDate().year() <= endDecadeYear ? ' active' : '') + (!this._isValid(startDecade, 'y') && !minDateDecade && !maxDateDecade ? ' disabled' : '') + '" data-selection="' + (startDecade.year() + 6) + '">' + startDecade.year() + '</span>';
2032
+ startDecade.add(10, 'y');
2033
+ }
2034
+ html += '<span data-action="selectDecade" class="decade old" data-selection="' + (startDecade.year() + 6) + '">' + startDecade.year() + '</span>';
2035
+
2036
+ decadesView.find('td').html(html);
2037
+ };
2038
+
2039
+ TempusDominusBootstrap4.prototype._fillDate = function _fillDate() {
2040
+ var daysView = this.widget.find('.datepicker-days'),
2041
+ daysViewHeader = daysView.find('th'),
2042
+ html = [];
2043
+ var currentDate = void 0,
2044
+ row = void 0,
2045
+ clsName = void 0,
2046
+ i = void 0;
2047
+
2048
+ if (!this._hasDate()) {
2049
+ return;
2050
+ }
2051
+
2052
+ daysViewHeader.eq(0).find('span').attr('title', this._options.tooltips.prevMonth);
2053
+ daysViewHeader.eq(1).attr('title', this._options.tooltips.selectMonth);
2054
+ daysViewHeader.eq(2).find('span').attr('title', this._options.tooltips.nextMonth);
2055
+
2056
+ daysView.find('.disabled').removeClass('disabled');
2057
+ daysViewHeader.eq(1).text(this._viewDate.format(this._options.dayViewHeaderFormat));
2058
+
2059
+ if (!this._isValid(this._viewDate.clone().subtract(1, 'M'), 'M')) {
2060
+ daysViewHeader.eq(0).addClass('disabled');
2061
+ }
2062
+ if (!this._isValid(this._viewDate.clone().add(1, 'M'), 'M')) {
2063
+ daysViewHeader.eq(2).addClass('disabled');
2064
+ }
2065
+
2066
+ currentDate = this._viewDate.clone().startOf('M').startOf('w').startOf('d');
2067
+
2068
+ for (i = 0; i < 42; i++) {
2069
+ //always display 42 days (should show 6 weeks)
2070
+ if (currentDate.weekday() === 0) {
2071
+ row = $('<tr>');
2072
+ if (this._options.calendarWeeks) {
2073
+ row.append('<td class="cw">' + currentDate.week() + '</td>');
2074
+ }
2075
+ html.push(row);
2076
+ }
2077
+ clsName = '';
2078
+ if (currentDate.isBefore(this._viewDate, 'M')) {
2079
+ clsName += ' old';
2080
+ }
2081
+ if (currentDate.isAfter(this._viewDate, 'M')) {
2082
+ clsName += ' new';
2083
+ }
2084
+ if (this._options.allowMultidate) {
2085
+ var index = this._datesFormatted.indexOf(currentDate.format('YYYY-MM-DD'));
2086
+ if (index !== -1) {
2087
+ if (currentDate.isSame(this._datesFormatted[index], 'd') && !this.unset) {
2088
+ clsName += ' active';
2089
+ }
2090
+ }
2091
+ } else {
2092
+ if (currentDate.isSame(this._getLastPickedDate(), 'd') && !this.unset) {
2093
+ clsName += ' active';
2094
+ }
2095
+ }
2096
+ if (!this._isValid(currentDate, 'd')) {
2097
+ clsName += ' disabled';
2098
+ }
2099
+ if (currentDate.isSame(this.getMoment(), 'd')) {
2100
+ clsName += ' today';
2101
+ }
2102
+ if (currentDate.day() === 0 || currentDate.day() === 6) {
2103
+ clsName += ' weekend';
2104
+ }
2105
+ row.append('<td data-action="selectDay" data-day="' + currentDate.format('L') + '" class="day' + clsName + '">' + currentDate.date() + '</td>');
2106
+ currentDate.add(1, 'd');
2107
+ }
2108
+
2109
+ daysView.find('tbody').empty().append(html);
2110
+
2111
+ this._updateMonths();
2112
+
2113
+ this._updateYears();
2114
+
2115
+ this._updateDecades();
2116
+ };
2117
+
2118
+ TempusDominusBootstrap4.prototype._fillHours = function _fillHours() {
2119
+ var table = this.widget.find('.timepicker-hours table'),
2120
+ currentHour = this._viewDate.clone().startOf('d'),
2121
+ html = [];
2122
+ var row = $('<tr>');
2123
+
2124
+ if (this._viewDate.hour() > 11 && !this.use24Hours) {
2125
+ currentHour.hour(12);
2126
+ }
2127
+ while (currentHour.isSame(this._viewDate, 'd') && (this.use24Hours || this._viewDate.hour() < 12 && currentHour.hour() < 12 || this._viewDate.hour() > 11)) {
2128
+ if (currentHour.hour() % 4 === 0) {
2129
+ row = $('<tr>');
2130
+ html.push(row);
2131
+ }
2132
+ row.append('<td data-action="selectHour" class="hour' + (!this._isValid(currentHour, 'h') ? ' disabled' : '') + '">' + currentHour.format(this.use24Hours ? 'HH' : 'hh') + '</td>');
2133
+ currentHour.add(1, 'h');
2134
+ }
2135
+ table.empty().append(html);
2136
+ };
2137
+
2138
+ TempusDominusBootstrap4.prototype._fillMinutes = function _fillMinutes() {
2139
+ var table = this.widget.find('.timepicker-minutes table'),
2140
+ currentMinute = this._viewDate.clone().startOf('h'),
2141
+ html = [],
2142
+ step = this._options.stepping === 1 ? 5 : this._options.stepping;
2143
+ var row = $('<tr>');
2144
+
2145
+ while (this._viewDate.isSame(currentMinute, 'h')) {
2146
+ if (currentMinute.minute() % (step * 4) === 0) {
2147
+ row = $('<tr>');
2148
+ html.push(row);
2149
+ }
2150
+ row.append('<td data-action="selectMinute" class="minute' + (!this._isValid(currentMinute, 'm') ? ' disabled' : '') + '">' + currentMinute.format('mm') + '</td>');
2151
+ currentMinute.add(step, 'm');
2152
+ }
2153
+ table.empty().append(html);
2154
+ };
2155
+
2156
+ TempusDominusBootstrap4.prototype._fillSeconds = function _fillSeconds() {
2157
+ var table = this.widget.find('.timepicker-seconds table'),
2158
+ currentSecond = this._viewDate.clone().startOf('m'),
2159
+ html = [];
2160
+ var row = $('<tr>');
2161
+
2162
+ while (this._viewDate.isSame(currentSecond, 'm')) {
2163
+ if (currentSecond.second() % 20 === 0) {
2164
+ row = $('<tr>');
2165
+ html.push(row);
2166
+ }
2167
+ row.append('<td data-action="selectSecond" class="second' + (!this._isValid(currentSecond, 's') ? ' disabled' : '') + '">' + currentSecond.format('ss') + '</td>');
2168
+ currentSecond.add(5, 's');
2169
+ }
2170
+
2171
+ table.empty().append(html);
2172
+ };
2173
+
2174
+ TempusDominusBootstrap4.prototype._fillTime = function _fillTime() {
2175
+ var toggle = void 0,
2176
+ newDate = void 0;
2177
+ var timeComponents = this.widget.find('.timepicker span[data-time-component]');
2178
+
2179
+ if (!this.use24Hours) {
2180
+ toggle = this.widget.find('.timepicker [data-action=togglePeriod]');
2181
+ newDate = this._getLastPickedDate().clone().add(this._getLastPickedDate().hours() >= 12 ? -12 : 12, 'h');
2182
+
2183
+ toggle.text(this._getLastPickedDate().format('A'));
2184
+
2185
+ if (this._isValid(newDate, 'h')) {
2186
+ toggle.removeClass('disabled');
2187
+ } else {
2188
+ toggle.addClass('disabled');
2189
+ }
2190
+ }
2191
+ timeComponents.filter('[data-time-component=hours]').text(this._getLastPickedDate().format('' + (this.use24Hours ? 'HH' : 'hh')));
2192
+ timeComponents.filter('[data-time-component=minutes]').text(this._getLastPickedDate().format('mm'));
2193
+ timeComponents.filter('[data-time-component=seconds]').text(this._getLastPickedDate().format('ss'));
2194
+
2195
+ this._fillHours();
2196
+ this._fillMinutes();
2197
+ this._fillSeconds();
2198
+ };
2199
+
2200
+ TempusDominusBootstrap4.prototype._doAction = function _doAction(e, action) {
2201
+ var lastPicked = this._getLastPickedDate();
2202
+ if ($(e.currentTarget).is('.disabled')) {
2203
+ return false;
2204
+ }
2205
+ action = action || $(e.currentTarget).data('action');
2206
+ switch (action) {
2207
+ case 'next':
2208
+ {
2209
+ var navFnc = DateTimePicker.DatePickerModes[this.currentViewMode].NAV_FUNCTION;
2210
+ this._viewDate.add(DateTimePicker.DatePickerModes[this.currentViewMode].NAV_STEP, navFnc);
2211
+ this._fillDate();
2212
+ this._viewUpdate(navFnc);
2213
+ break;
2214
+ }
2215
+ case 'previous':
2216
+ {
2217
+ var _navFnc = DateTimePicker.DatePickerModes[this.currentViewMode].NAV_FUNCTION;
2218
+ this._viewDate.subtract(DateTimePicker.DatePickerModes[this.currentViewMode].NAV_STEP, _navFnc);
2219
+ this._fillDate();
2220
+ this._viewUpdate(_navFnc);
2221
+ break;
2222
+ }
2223
+ case 'pickerSwitch':
2224
+ this._showMode(1);
2225
+ break;
2226
+ case 'selectMonth':
2227
+ {
2228
+ var month = $(e.target).closest('tbody').find('span').index($(e.target));
2229
+ this._viewDate.month(month);
2230
+ if (this.currentViewMode === DateTimePicker.MinViewModeNumber) {
2231
+ this._setValue(lastPicked.clone().year(this._viewDate.year()).month(this._viewDate.month()), this._getLastPickedDateIndex());
2232
+ if (!this._options.inline) {
2233
+ this.hide();
2234
+ }
2235
+ } else {
2236
+ this._showMode(-1);
2237
+ this._fillDate();
2238
+ }
2239
+ this._viewUpdate('M');
2240
+ break;
2241
+ }
2242
+ case 'selectYear':
2243
+ {
2244
+ var year = parseInt($(e.target).text(), 10) || 0;
2245
+ this._viewDate.year(year);
2246
+ if (this.currentViewMode === DateTimePicker.MinViewModeNumber) {
2247
+ this._setValue(lastPicked.clone().year(this._viewDate.year()), this._getLastPickedDateIndex());
2248
+ if (!this._options.inline) {
2249
+ this.hide();
2250
+ }
2251
+ } else {
2252
+ this._showMode(-1);
2253
+ this._fillDate();
2254
+ }
2255
+ this._viewUpdate('YYYY');
2256
+ break;
2257
+ }
2258
+ case 'selectDecade':
2259
+ {
2260
+ var _year = parseInt($(e.target).data('selection'), 10) || 0;
2261
+ this._viewDate.year(_year);
2262
+ if (this.currentViewMode === DateTimePicker.MinViewModeNumber) {
2263
+ this._setValue(lastPicked.clone().year(this._viewDate.year()), this._getLastPickedDateIndex());
2264
+ if (!this._options.inline) {
2265
+ this.hide();
2266
+ }
2267
+ } else {
2268
+ this._showMode(-1);
2269
+ this._fillDate();
2270
+ }
2271
+ this._viewUpdate('YYYY');
2272
+ break;
2273
+ }
2274
+ case 'selectDay':
2275
+ {
2276
+ var day = this._viewDate.clone();
2277
+ if ($(e.target).is('.old')) {
2278
+ day.subtract(1, 'M');
2279
+ }
2280
+ if ($(e.target).is('.new')) {
2281
+ day.add(1, 'M');
2282
+ }
2283
+ this._setValue(day.date(parseInt($(e.target).text(), 10)), this._getLastPickedDateIndex());
2284
+ if (!this._hasTime() && !this._options.keepOpen && !this._options.inline) {
2285
+ this.hide();
2286
+ }
2287
+ break;
2288
+ }
2289
+ case 'incrementHours':
2290
+ {
2291
+ var newDate = lastPicked.clone().add(1, 'h');
2292
+ if (this._isValid(newDate, 'h')) {
2293
+ this._setValue(newDate, this._getLastPickedDateIndex());
2294
+ }
2295
+ break;
2296
+ }
2297
+ case 'incrementMinutes':
2298
+ {
2299
+ var _newDate = lastPicked.clone().add(this._options.stepping, 'm');
2300
+ if (this._isValid(_newDate, 'm')) {
2301
+ this._setValue(_newDate, this._getLastPickedDateIndex());
2302
+ }
2303
+ break;
2304
+ }
2305
+ case 'incrementSeconds':
2306
+ {
2307
+ var _newDate2 = lastPicked.clone().add(1, 's');
2308
+ if (this._isValid(_newDate2, 's')) {
2309
+ this._setValue(_newDate2, this._getLastPickedDateIndex());
2310
+ }
2311
+ break;
2312
+ }
2313
+ case 'decrementHours':
2314
+ {
2315
+ var _newDate3 = lastPicked.clone().subtract(1, 'h');
2316
+ if (this._isValid(_newDate3, 'h')) {
2317
+ this._setValue(_newDate3, this._getLastPickedDateIndex());
2318
+ }
2319
+ break;
2320
+ }
2321
+ case 'decrementMinutes':
2322
+ {
2323
+ var _newDate4 = lastPicked.clone().subtract(this._options.stepping, 'm');
2324
+ if (this._isValid(_newDate4, 'm')) {
2325
+ this._setValue(_newDate4, this._getLastPickedDateIndex());
2326
+ }
2327
+ break;
2328
+ }
2329
+ case 'decrementSeconds':
2330
+ {
2331
+ var _newDate5 = lastPicked.clone().subtract(1, 's');
2332
+ if (this._isValid(_newDate5, 's')) {
2333
+ this._setValue(_newDate5, this._getLastPickedDateIndex());
2334
+ }
2335
+ break;
2336
+ }
2337
+ case 'togglePeriod':
2338
+ {
2339
+ this._setValue(lastPicked.clone().add(lastPicked.hours() >= 12 ? -12 : 12, 'h'), this._getLastPickedDateIndex());
2340
+ break;
2341
+ }
2342
+ case 'togglePicker':
2343
+ {
2344
+ var $this = $(e.target),
2345
+ $link = $this.closest('a'),
2346
+ $parent = $this.closest('ul'),
2347
+ expanded = $parent.find('.show'),
2348
+ closed = $parent.find('.collapse:not(.show)'),
2349
+ $span = $this.is('span') ? $this : $this.find('span');
2350
+ var collapseData = void 0;
2351
+
2352
+ if (expanded && expanded.length) {
2353
+ collapseData = expanded.data('collapse');
2354
+ if (collapseData && collapseData.transitioning) {
2355
+ return true;
2356
+ }
2357
+ if (expanded.collapse) {
2358
+ // if collapse plugin is available through bootstrap.js then use it
2359
+ expanded.collapse('hide');
2360
+ closed.collapse('show');
2361
+ } else {
2362
+ // otherwise just toggle in class on the two views
2363
+ expanded.removeClass('show');
2364
+ closed.addClass('show');
2365
+ }
2366
+ $span.toggleClass(this._options.icons.time + ' ' + this._options.icons.date);
2367
+
2368
+ if ($span.hasClass(this._options.icons.date)) {
2369
+ $link.attr('title', this._options.tooltips.selectDate);
2370
+ } else {
2371
+ $link.attr('title', this._options.tooltips.selectTime);
2372
+ }
2373
+ }
2374
+ }
2375
+ break;
2376
+ case 'showPicker':
2377
+ this.widget.find('.timepicker > div:not(.timepicker-picker)').hide();
2378
+ this.widget.find('.timepicker .timepicker-picker').show();
2379
+ break;
2380
+ case 'showHours':
2381
+ this.widget.find('.timepicker .timepicker-picker').hide();
2382
+ this.widget.find('.timepicker .timepicker-hours').show();
2383
+ break;
2384
+ case 'showMinutes':
2385
+ this.widget.find('.timepicker .timepicker-picker').hide();
2386
+ this.widget.find('.timepicker .timepicker-minutes').show();
2387
+ break;
2388
+ case 'showSeconds':
2389
+ this.widget.find('.timepicker .timepicker-picker').hide();
2390
+ this.widget.find('.timepicker .timepicker-seconds').show();
2391
+ break;
2392
+ case 'selectHour':
2393
+ {
2394
+ var hour = parseInt($(e.target).text(), 10);
2395
+
2396
+ if (!this.use24Hours) {
2397
+ if (lastPicked.hours() >= 12) {
2398
+ if (hour !== 12) {
2399
+ hour += 12;
2400
+ }
2401
+ } else {
2402
+ if (hour === 12) {
2403
+ hour = 0;
2404
+ }
2405
+ }
2406
+ }
2407
+ this._setValue(lastPicked.clone().hours(hour), this._getLastPickedDateIndex());
2408
+ this._doAction(e, 'showPicker');
2409
+ break;
2410
+ }
2411
+ case 'selectMinute':
2412
+ this._setValue(lastPicked.clone().minutes(parseInt($(e.target).text(), 10)), this._getLastPickedDateIndex());
2413
+ this._doAction(e, 'showPicker');
2414
+ break;
2415
+ case 'selectSecond':
2416
+ this._setValue(lastPicked.clone().seconds(parseInt($(e.target).text(), 10)), this._getLastPickedDateIndex());
2417
+ this._doAction(e, 'showPicker');
2418
+ break;
2419
+ case 'clear':
2420
+ this.clear();
2421
+ break;
2422
+ case 'today':
2423
+ {
2424
+ var todaysDate = this.getMoment();
2425
+ if (this._isValid(todaysDate, 'd')) {
2426
+ this._setValue(todaysDate, this._getLastPickedDateIndex());
2427
+ }
2428
+ break;
2429
+ }
2430
+ }
2431
+ return false;
2432
+ };
2433
+
2434
+ //public
2435
+
2436
+
2437
+ TempusDominusBootstrap4.prototype.hide = function hide() {
2438
+ var transitioning = false;
2439
+ if (!this.widget) {
2440
+ return;
2441
+ }
2442
+ // Ignore event if in the middle of a picker transition
2443
+ this.widget.find('.collapse').each(function () {
2444
+ var collapseData = $(this).data('collapse');
2445
+ if (collapseData && collapseData.transitioning) {
2446
+ transitioning = true;
2447
+ return false;
2448
+ }
2449
+ return true;
2450
+ });
2451
+ if (transitioning) {
2452
+ return;
2453
+ }
2454
+ if (this.component && this.component.hasClass('btn')) {
2455
+ this.component.toggleClass('active');
2456
+ }
2457
+ this.widget.hide();
2458
+
2459
+ $(window).off('resize', this._place());
2460
+ this.widget.off('click', '[data-action]');
2461
+ this.widget.off('mousedown', false);
2462
+
2463
+ this.widget.remove();
2464
+ this.widget = false;
2465
+
2466
+ this._notifyEvent({
2467
+ type: DateTimePicker.Event.HIDE,
2468
+ date: this._getLastPickedDate().clone()
2469
+ });
2470
+
2471
+ if (this.input !== undefined) {
2472
+ this.input.blur();
2473
+ }
2474
+
2475
+ this._viewDate = this._getLastPickedDate().clone();
2476
+ };
2477
+
2478
+ TempusDominusBootstrap4.prototype.show = function show() {
2479
+ var currentMoment = void 0;
2480
+ var useCurrentGranularity = {
2481
+ 'year': function year(m) {
2482
+ return m.month(0).date(1).hours(0).seconds(0).minutes(0);
2483
+ },
2484
+ 'month': function month(m) {
2485
+ return m.date(1).hours(0).seconds(0).minutes(0);
2486
+ },
2487
+ 'day': function day(m) {
2488
+ return m.hours(0).seconds(0).minutes(0);
2489
+ },
2490
+ 'hour': function hour(m) {
2491
+ return m.seconds(0).minutes(0);
2492
+ },
2493
+ 'minute': function minute(m) {
2494
+ return m.seconds(0);
2495
+ }
2496
+ };
2497
+
2498
+ if (this.input !== undefined) {
2499
+ if (this.input.prop('disabled') || !this._options.ignoreReadonly && this.input.prop('readonly') || this.widget) {
2500
+ return;
2501
+ }
2502
+ if (this.input.val() !== undefined && this.input.val().trim().length !== 0) {
2503
+ this._setValue(this._parseInputDate(this.input.val().trim()), 0);
2504
+ } else if (this.unset && this._options.useCurrent) {
2505
+ currentMoment = this.getMoment();
2506
+ if (typeof this._options.useCurrent === 'string') {
2507
+ currentMoment = useCurrentGranularity[this._options.useCurrent](currentMoment);
2508
+ }
2509
+ this._setValue(currentMoment, 0);
2510
+ }
2511
+ } else if (this.unset && this._options.useCurrent) {
2512
+ currentMoment = this.getMoment();
2513
+ if (typeof this._options.useCurrent === 'string') {
2514
+ currentMoment = useCurrentGranularity[this._options.useCurrent](currentMoment);
2515
+ }
2516
+ this._setValue(currentMoment, 0);
2517
+ }
2518
+
2519
+ this.widget = this._getTemplate();
2520
+
2521
+ this._fillDow();
2522
+ this._fillMonths();
2523
+
2524
+ this.widget.find('.timepicker-hours').hide();
2525
+ this.widget.find('.timepicker-minutes').hide();
2526
+ this.widget.find('.timepicker-seconds').hide();
2527
+
2528
+ this._update();
2529
+ this._showMode();
2530
+
2531
+ $(window).on('resize', { picker: this }, this._place);
2532
+ this.widget.on('click', '[data-action]', $.proxy(this._doAction, this)); // this handles clicks on the widget
2533
+ this.widget.on('mousedown', false);
2534
+
2535
+ if (this.component && this.component.hasClass('btn')) {
2536
+ this.component.toggleClass('active');
2537
+ }
2538
+ this._place();
2539
+ this.widget.show();
2540
+ if (this.input !== undefined && this._options.focusOnShow && !this.input.is(':focus')) {
2541
+ this.input.focus();
2542
+ }
2543
+
2544
+ this._notifyEvent({
2545
+ type: DateTimePicker.Event.SHOW
2546
+ });
2547
+ };
2548
+
2549
+ TempusDominusBootstrap4.prototype.destroy = function destroy() {
2550
+ this.hide();
2551
+ //todo doc off?
2552
+ this._element.removeData(DateTimePicker.DATA_KEY);
2553
+ this._element.removeData('date');
2554
+ };
2555
+
2556
+ TempusDominusBootstrap4.prototype.disable = function disable() {
2557
+ this.hide();
2558
+ if (this.component && this.component.hasClass('btn')) {
2559
+ this.component.addClass('disabled');
2560
+ }
2561
+ if (this.input !== undefined) {
2562
+ this.input.prop('disabled', true); //todo disable this/comp if input is null
2563
+ }
2564
+ };
2565
+
2566
+ TempusDominusBootstrap4.prototype.enable = function enable() {
2567
+ if (this.component && this.component.hasClass('btn')) {
2568
+ this.component.removeClass('disabled');
2569
+ }
2570
+ if (this.input !== undefined) {
2571
+ this.input.prop('disabled', false); //todo enable comp/this if input is null
2572
+ }
2573
+ };
2574
+
2575
+ TempusDominusBootstrap4.prototype.toolbarPlacement = function toolbarPlacement(_toolbarPlacement) {
2576
+ if (arguments.length === 0) {
2577
+ return this._options.toolbarPlacement;
2578
+ }
2579
+
2580
+ if (typeof _toolbarPlacement !== 'string') {
2581
+ throw new TypeError('toolbarPlacement() expects a string parameter');
2582
+ }
2583
+ if (toolbarPlacements.indexOf(_toolbarPlacement) === -1) {
2584
+ throw new TypeError('toolbarPlacement() parameter must be one of (' + toolbarPlacements.join(', ') + ') value');
2585
+ }
2586
+ this._options.toolbarPlacement = _toolbarPlacement;
2587
+
2588
+ if (this.widget) {
2589
+ this.hide();
2590
+ this.show();
2591
+ }
2592
+ };
2593
+
2594
+ TempusDominusBootstrap4.prototype.widgetPositioning = function widgetPositioning(_widgetPositioning) {
2595
+ if (arguments.length === 0) {
2596
+ return $.extend({}, this._options.widgetPositioning);
2597
+ }
2598
+
2599
+ if ({}.toString.call(_widgetPositioning) !== '[object Object]') {
2600
+ throw new TypeError('widgetPositioning() expects an object variable');
2601
+ }
2602
+ if (_widgetPositioning.horizontal) {
2603
+ if (typeof _widgetPositioning.horizontal !== 'string') {
2604
+ throw new TypeError('widgetPositioning() horizontal variable must be a string');
2605
+ }
2606
+ _widgetPositioning.horizontal = _widgetPositioning.horizontal.toLowerCase();
2607
+ if (horizontalModes.indexOf(_widgetPositioning.horizontal) === -1) {
2608
+ throw new TypeError('widgetPositioning() expects horizontal parameter to be one of (' + horizontalModes.join(', ') + ')');
2609
+ }
2610
+ this._options.widgetPositioning.horizontal = _widgetPositioning.horizontal;
2611
+ }
2612
+ if (_widgetPositioning.vertical) {
2613
+ if (typeof _widgetPositioning.vertical !== 'string') {
2614
+ throw new TypeError('widgetPositioning() vertical variable must be a string');
2615
+ }
2616
+ _widgetPositioning.vertical = _widgetPositioning.vertical.toLowerCase();
2617
+ if (verticalModes.indexOf(_widgetPositioning.vertical) === -1) {
2618
+ throw new TypeError('widgetPositioning() expects vertical parameter to be one of (' + verticalModes.join(', ') + ')');
2619
+ }
2620
+ this._options.widgetPositioning.vertical = _widgetPositioning.vertical;
2621
+ }
2622
+ this._update();
2623
+ };
2624
+
2625
+ TempusDominusBootstrap4.prototype.widgetParent = function widgetParent(_widgetParent) {
2626
+ if (arguments.length === 0) {
2627
+ return this._options.widgetParent;
2628
+ }
2629
+
2630
+ if (typeof _widgetParent === 'string') {
2631
+ _widgetParent = $(_widgetParent);
2632
+ }
2633
+
2634
+ if (_widgetParent !== null && typeof _widgetParent !== 'string' && !(_widgetParent instanceof $)) {
2635
+ throw new TypeError('widgetParent() expects a string or a jQuery object parameter');
2636
+ }
2637
+
2638
+ this._options.widgetParent = _widgetParent;
2639
+ if (this.widget) {
2640
+ this.hide();
2641
+ this.show();
2642
+ }
2643
+ };
2644
+
2645
+ //static
2646
+
2647
+
2648
+ TempusDominusBootstrap4._jQueryHandleThis = function _jQueryHandleThis(me, option, argument) {
2649
+ var data = $(me).data(DateTimePicker.DATA_KEY);
2650
+ if ((typeof option === 'undefined' ? 'undefined' : _typeof(option)) === 'object') {
2651
+ $.extend({}, DateTimePicker.Default, option);
2652
+ }
2653
+
2654
+ if (!data) {
2655
+ data = new TempusDominusBootstrap4($(me), option);
2656
+ $(me).data(DateTimePicker.DATA_KEY, data);
2657
+ }
2658
+
2659
+ if (typeof option === 'string') {
2660
+ if (data[option] === undefined) {
2661
+ throw new Error('No method named "' + option + '"');
2662
+ }
2663
+ if (argument === undefined) {
2664
+ return data[option]();
2665
+ } else {
2666
+ return data[option](argument);
2667
+ }
2668
+ }
2669
+ };
2670
+
2671
+ TempusDominusBootstrap4._jQueryInterface = function _jQueryInterface(option, argument) {
2672
+ if (this.length === 1) {
2673
+ return TempusDominusBootstrap4._jQueryHandleThis(this[0], option, argument);
2674
+ }
2675
+ return this.each(function () {
2676
+ TempusDominusBootstrap4._jQueryHandleThis(this, option, argument);
2677
+ });
2678
+ };
2679
+
2680
+ return TempusDominusBootstrap4;
2681
+ }(DateTimePicker);
2682
+
2683
+ /**
2684
+ * ------------------------------------------------------------------------
2685
+ * jQuery
2686
+ * ------------------------------------------------------------------------
2687
+ */
2688
+
2689
+
2690
+ $(document).on(DateTimePicker.Event.CLICK_DATA_API, DateTimePicker.Selector.DATA_TOGGLE, function () {
2691
+ var $target = getSelectorFromElement($(this));
2692
+ if ($target.length === 0) {
2693
+ return;
2694
+ }
2695
+ TempusDominusBootstrap4._jQueryInterface.call($target, 'toggle');
2696
+ }).on(DateTimePicker.Event.CHANGE, '.' + DateTimePicker.ClassName.INPUT, function (event) {
2697
+ var $target = getSelectorFromElement($(this));
2698
+ if ($target.length === 0) {
2699
+ return;
2700
+ }
2701
+ TempusDominusBootstrap4._jQueryInterface.call($target, '_change', event);
2702
+ }).on(DateTimePicker.Event.BLUR, '.' + DateTimePicker.ClassName.INPUT, function (event) {
2703
+ var $target = getSelectorFromElement($(this)),
2704
+ config = $target.data(DateTimePicker.DATA_KEY);
2705
+ if ($target.length === 0) {
2706
+ return;
2707
+ }
2708
+ if (config._options.debug || window.debug) {
2709
+ return;
2710
+ }
2711
+ TempusDominusBootstrap4._jQueryInterface.call($target, 'hide', event);
2712
+ }).on(DateTimePicker.Event.KEYDOWN, '.' + DateTimePicker.ClassName.INPUT, function (event) {
2713
+ var $target = getSelectorFromElement($(this));
2714
+ if ($target.length === 0) {
2715
+ return;
2716
+ }
2717
+ TempusDominusBootstrap4._jQueryInterface.call($target, '_keydown', event);
2718
+ }).on(DateTimePicker.Event.KEYUP, '.' + DateTimePicker.ClassName.INPUT, function (event) {
2719
+ var $target = getSelectorFromElement($(this));
2720
+ if ($target.length === 0) {
2721
+ return;
2722
+ }
2723
+ TempusDominusBootstrap4._jQueryInterface.call($target, '_keyup', event);
2724
+ }).on(DateTimePicker.Event.FOCUS, '.' + DateTimePicker.ClassName.INPUT, function (event) {
2725
+ var $target = getSelectorFromElement($(this)),
2726
+ config = $target.data(DateTimePicker.DATA_KEY);
2727
+ if ($target.length === 0) {
2728
+ return;
2729
+ }
2730
+ if (!config._options.allowInputToggle) {
2731
+ return;
2732
+ }
2733
+ TempusDominusBootstrap4._jQueryInterface.call($target, config, event);
2734
+ });
2735
+
2736
+ $.fn[DateTimePicker.NAME] = TempusDominusBootstrap4._jQueryInterface;
2737
+ $.fn[DateTimePicker.NAME].Constructor = TempusDominusBootstrap4;
2738
+ $.fn[DateTimePicker.NAME].noConflict = function () {
2739
+ $.fn[DateTimePicker.NAME] = JQUERY_NO_CONFLICT;
2740
+ return TempusDominusBootstrap4._jQueryInterface;
2741
+ };
2742
+
2743
+ return TempusDominusBootstrap4;
2744
+ }(jQuery);
2745
+
2746
+ }();