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