action_ui 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +36 -0
- data/lib/cre_pro-rails.rb +8 -0
- data/lib/cre_pro/rails.rb +7 -0
- data/lib/cre_pro/rails/version.rb +5 -0
- data/vendor/assets/javascripts/gp/gp.js +292 -0
- data/vendor/assets/javascripts/ld/bootstrap-checkbox-radio-switch-tags.js +869 -0
- data/vendor/assets/javascripts/ld/bootstrap-datetimepicker.js +2573 -0
- data/vendor/assets/javascripts/ld/bootstrap-notify.js +379 -0
- data/vendor/assets/javascripts/ld/bootstrap-selectpicker.js +1711 -0
- data/vendor/assets/javascripts/ld/bootstrap-table.js +2484 -0
- data/vendor/assets/javascripts/ld/chartist.min.js +8 -0
- data/vendor/assets/javascripts/ld/demo.js +731 -0
- data/vendor/assets/javascripts/ld/fullcalendar.min.js +9 -0
- data/vendor/assets/javascripts/ld/jquery-jvectormap.js +3381 -0
- data/vendor/assets/javascripts/ld/jquery-ui.min.js +24 -0
- data/vendor/assets/javascripts/ld/jquery.bootstrap.wizard.min.js +22 -0
- data/vendor/assets/javascripts/ld/jquery.datatables.js +15498 -0
- data/vendor/assets/javascripts/ld/jquery.min.js +5 -0
- data/vendor/assets/javascripts/ld/jquery.validate.min.js +4 -0
- data/vendor/assets/javascripts/ld/ld.js +422 -0
- data/vendor/assets/javascripts/ld/moment.min.js +7 -0
- data/vendor/assets/javascripts/ld/sweetalert2.js +877 -0
- data/vendor/assets/javascripts/mk/bootstrap-datepicker.js +474 -0
- data/vendor/assets/javascripts/mk/bootstrap.min.js +7 -0
- data/vendor/assets/javascripts/mk/jasny-bootstrap.min.js +6 -0
- data/vendor/assets/javascripts/mk/jquery.dropdown.js +378 -0
- data/vendor/assets/javascripts/mk/jquery.flexisel.js +342 -0
- data/vendor/assets/javascripts/mk/jquery.min.js +3 -0
- data/vendor/assets/javascripts/mk/jquery.tagsinput.js +355 -0
- data/vendor/assets/javascripts/mk/mk.js +191 -0
- data/vendor/assets/javascripts/mk/mk.min.js +1 -0
- data/vendor/assets/javascripts/mk/nouislider.min.js +31 -0
- data/vendor/assets/javascripts/pd/bootstrap-checkbox-radio-switch-tags.js +869 -0
- data/vendor/assets/javascripts/pd/bootstrap-datetimepicker.js +2576 -0
- data/vendor/assets/javascripts/pd/bootstrap-notify.js +379 -0
- data/vendor/assets/javascripts/pd/bootstrap-selectpicker.js +1711 -0
- data/vendor/assets/javascripts/pd/bootstrap-table.js +2484 -0
- data/vendor/assets/javascripts/pd/bootstrap.min.js +12 -0
- data/vendor/assets/javascripts/pd/chartist.min.js +9 -0
- data/vendor/assets/javascripts/pd/demo.js +911 -0
- data/vendor/assets/javascripts/pd/fullcalendar.min.js +9 -0
- data/vendor/assets/javascripts/pd/jquery-1.10.2.js +9789 -0
- data/vendor/assets/javascripts/pd/jquery-1.10.2.min.js +3 -0
- data/vendor/assets/javascripts/pd/jquery-jvectormap.js +3381 -0
- data/vendor/assets/javascripts/pd/jquery-ui.min.js +24 -0
- data/vendor/assets/javascripts/pd/jquery.bootstrap.wizard.min.js +22 -0
- data/vendor/assets/javascripts/pd/jquery.datatables.js +15498 -0
- data/vendor/assets/javascripts/pd/jquery.easypiechart.min.js +9 -0
- data/vendor/assets/javascripts/pd/jquery.min.js +5 -0
- data/vendor/assets/javascripts/pd/jquery.tagsinput.js +355 -0
- data/vendor/assets/javascripts/pd/jquery.validate.min.js +4 -0
- data/vendor/assets/javascripts/pd/moment.min.js +7 -0
- data/vendor/assets/javascripts/pd/pd.js +335 -0
- data/vendor/assets/javascripts/pd/sweetalert2.js +877 -0
- data/vendor/assets/javascripts/pk/bootstrap-datepicker.js +492 -0
- data/vendor/assets/javascripts/pk/bootstrap-select.js +1711 -0
- data/vendor/assets/javascripts/pk/chartist.min.js +8 -0
- data/vendor/assets/javascripts/pk/ct-pk-bootstrapswitch.js +249 -0
- data/vendor/assets/javascripts/pk/ct-pk-checkbox.js +109 -0
- data/vendor/assets/javascripts/pk/ct-pk-radio.js +140 -0
- data/vendor/assets/javascripts/pk/ct-pk.js +305 -0
- data/vendor/assets/javascripts/pk/demo.js +289 -0
- data/vendor/assets/javascripts/pk/jasny-bootstrap.min.js +6 -0
- data/vendor/assets/javascripts/pk/jquery-1.10.2.js +9789 -0
- data/vendor/assets/javascripts/pk/jquery-ui-1.10.4.custom.min.js +6 -0
- data/vendor/assets/javascripts/pk/jquery.tagsinput.js +355 -0
- data/vendor/assets/javascripts/pk/photo_swipe/init-gallery.js +205 -0
- data/vendor/assets/javascripts/pk/photo_swipe/photoswipe-ui-default.min.js +4 -0
- data/vendor/assets/javascripts/pk/photo_swipe/photoswipe.min.js +4 -0
- data/vendor/assets/javascripts/pk/presentation-page/atv-img-min.js +233 -0
- data/vendor/assets/javascripts/pk/presentation-page/jquery.sharrre.js +585 -0
- data/vendor/assets/javascripts/sd/bootstrap-datepicker.js +492 -0
- data/vendor/assets/javascripts/sd/bootstrap-select.js +1711 -0
- data/vendor/assets/javascripts/sd/chartist.min.js +8 -0
- data/vendor/assets/javascripts/sd/demo.js +227 -0
- data/vendor/assets/javascripts/sd/jquery-ui.custom.min.js +7 -0
- data/vendor/assets/javascripts/sd/jquery.flexisel.js +342 -0
- data/vendor/assets/javascripts/sd/jquery.js +9789 -0
- data/vendor/assets/javascripts/sd/jquery.tagsinput.js +355 -0
- data/vendor/assets/javascripts/sd/retina.min.js +10 -0
- data/vendor/assets/javascripts/sd/sd-bootstrapswitch.js +249 -0
- data/vendor/assets/javascripts/sd/sd-checkbox.js +109 -0
- data/vendor/assets/javascripts/sd/sd-morphing.js +89 -0
- data/vendor/assets/javascripts/sd/sd-radio.js +140 -0
- data/vendor/assets/javascripts/sd/sd.js +398 -0
- data/vendor/assets/stylesheets/gp/components/_buttons.scss +121 -0
- data/vendor/assets/stylesheets/gp/components/_cards.scss +271 -0
- data/vendor/assets/stylesheets/gp/components/_carousel.scss +15 -0
- data/vendor/assets/stylesheets/gp/components/_clients.scss +172 -0
- data/vendor/assets/stylesheets/gp/components/_closure.scss +19 -0
- data/vendor/assets/stylesheets/gp/components/_contact.scss +93 -0
- data/vendor/assets/stylesheets/gp/components/_dropdown.scss +173 -0
- data/vendor/assets/stylesheets/gp/components/_example-pages.scss +524 -0
- data/vendor/assets/stylesheets/gp/components/_footers.scss +191 -0
- data/vendor/assets/stylesheets/gp/components/_headers.scss +72 -0
- data/vendor/assets/stylesheets/gp/components/_inputs.scss +145 -0
- data/vendor/assets/stylesheets/gp/components/_labels.scss +15 -0
- data/vendor/assets/stylesheets/gp/components/_misc.scss +332 -0
- data/vendor/assets/stylesheets/gp/components/_mixins.scss +11 -0
- data/vendor/assets/stylesheets/gp/components/_navbars.scss +252 -0
- data/vendor/assets/stylesheets/gp/components/_numbers.scss +61 -0
- data/vendor/assets/stylesheets/gp/components/_projects.scss +279 -0
- data/vendor/assets/stylesheets/gp/components/_responsive.scss +950 -0
- data/vendor/assets/stylesheets/gp/components/_sections.scss +328 -0
- data/vendor/assets/stylesheets/gp/components/_social-buttons.scss +30 -0
- data/vendor/assets/stylesheets/gp/components/_team.scss +182 -0
- data/vendor/assets/stylesheets/gp/components/_theme.scss +22 -0
- data/vendor/assets/stylesheets/gp/components/_typography.scss +252 -0
- data/vendor/assets/stylesheets/gp/components/_variables.scss +267 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_buttons.scss +61 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_cards.scss +8 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_transparency.scss +20 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_vendor-prefixes.scss +284 -0
- data/vendor/assets/stylesheets/gp/gp.scss +30 -0
- data/vendor/assets/stylesheets/ld/ld.scss +53 -0
- data/vendor/assets/stylesheets/ld/ld/_alerts.scss +82 -0
- data/vendor/assets/stylesheets/ld/ld/_buttons.scss +123 -0
- data/vendor/assets/stylesheets/ld/ld/_cards.scss +315 -0
- data/vendor/assets/stylesheets/ld/ld/_carousel.scss +15 -0
- data/vendor/assets/stylesheets/ld/ld/_checkbox-radio-switch.scss +253 -0
- data/vendor/assets/stylesheets/ld/ld/_collapse.scss +49 -0
- data/vendor/assets/stylesheets/ld/ld/_dropdown.scss +176 -0
- data/vendor/assets/stylesheets/ld/ld/_footers.scss +155 -0
- data/vendor/assets/stylesheets/ld/ld/_forms.scss +41 -0
- data/vendor/assets/stylesheets/ld/ld/_inputs.scss +170 -0
- data/vendor/assets/stylesheets/ld/ld/_labels.scss +54 -0
- data/vendor/assets/stylesheets/ld/ld/_media.scss +80 -0
- data/vendor/assets/stylesheets/ld/ld/_misc.scss +87 -0
- data/vendor/assets/stylesheets/ld/ld/_mixins.scss +22 -0
- data/vendor/assets/stylesheets/ld/ld/_modal.scss +79 -0
- data/vendor/assets/stylesheets/ld/ld/_navbars.scss +362 -0
- data/vendor/assets/stylesheets/ld/ld/_pages.scss +215 -0
- data/vendor/assets/stylesheets/ld/ld/_progress-bars.scss +26 -0
- data/vendor/assets/stylesheets/ld/ld/_responsive.scss +647 -0
- data/vendor/assets/stylesheets/ld/ld/_sidebar-and-main-panel.scss +576 -0
- data/vendor/assets/stylesheets/ld/ld/_sliders.scss +219 -0
- data/vendor/assets/stylesheets/ld/ld/_social-buttons.scss +77 -0
- data/vendor/assets/stylesheets/ld/ld/_tables.scss +120 -0
- data/vendor/assets/stylesheets/ld/ld/_tabs-navs-pagination.scss +302 -0
- data/vendor/assets/stylesheets/ld/ld/_tags.scss +123 -0
- data/vendor/assets/stylesheets/ld/ld/_tooltips-and-popovers.scss +156 -0
- data/vendor/assets/stylesheets/ld/ld/_typography.scss +93 -0
- data/vendor/assets/stylesheets/ld/ld/_variables.scss +319 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_buttons.scss +74 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_cards.scss +8 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_chartist.scss +85 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_icons.scss +13 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_labels.scss +21 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_morphing-buttons.scss +34 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_social-buttons.scss +43 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_table-row.scss +22 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_tabs.scss +4 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_transparency.scss +20 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_vendor-prefixes.scss +197 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_animate.scss +188 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_bootstrap-select.scss +308 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_bootstrap-table.scss +328 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_chartist.scss +247 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_datatables.net.scss +513 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_datetime-picker.scss +440 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_fullcalendar.scss +1114 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_jquery.jvectormap.scss +135 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_perfect-scrollbar.scss +111 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_sweetalert2.scss +531 -0
- data/vendor/assets/stylesheets/mk/mk.scss +50 -0
- data/vendor/assets/stylesheets/mk/mk/_alerts.scss +41 -0
- data/vendor/assets/stylesheets/mk/mk/_buttons.scss +283 -0
- data/vendor/assets/stylesheets/mk/mk/_cards.scss +576 -0
- data/vendor/assets/stylesheets/mk/mk/_carousel.scss +86 -0
- data/vendor/assets/stylesheets/mk/mk/_checkboxes.scss +195 -0
- data/vendor/assets/stylesheets/mk/mk/_colors.scss +326 -0
- data/vendor/assets/stylesheets/mk/mk/_dialogs.scss +99 -0
- data/vendor/assets/stylesheets/mk/mk/_dividers.scss +73 -0
- data/vendor/assets/stylesheets/mk/mk/_dropdown.scss +86 -0
- data/vendor/assets/stylesheets/mk/mk/_example-pages.scss +775 -0
- data/vendor/assets/stylesheets/mk/mk/_fileupload.scss +115 -0
- data/vendor/assets/stylesheets/mk/mk/_flexisel.scss +54 -0
- data/vendor/assets/stylesheets/mk/mk/_form.scss +58 -0
- data/vendor/assets/stylesheets/mk/mk/_images.scss +6 -0
- data/vendor/assets/stylesheets/mk/mk/_import-bs-less.scss +4 -0
- data/vendor/assets/stylesheets/mk/mk/_import-bs-sass.scss +2 -0
- data/vendor/assets/stylesheets/mk/mk/_info-areas.scss +57 -0
- data/vendor/assets/stylesheets/mk/mk/_inputs-size.scss +223 -0
- data/vendor/assets/stylesheets/mk/mk/_inputs.scss +394 -0
- data/vendor/assets/stylesheets/mk/mk/_labels.scss +10 -0
- data/vendor/assets/stylesheets/mk/mk/_lists.scss +104 -0
- data/vendor/assets/stylesheets/mk/mk/_media.scss +47 -0
- data/vendor/assets/stylesheets/mk/mk/_misc.scss +94 -0
- data/vendor/assets/stylesheets/mk/mk/_mixins.scss +413 -0
- data/vendor/assets/stylesheets/mk/mk/_navbar.scss +311 -0
- data/vendor/assets/stylesheets/mk/mk/_pagination.scss +91 -0
- data/vendor/assets/stylesheets/mk/mk/_panels.scss +47 -0
- data/vendor/assets/stylesheets/mk/mk/_pills.scss +128 -0
- data/vendor/assets/stylesheets/mk/mk/_popups.scss +77 -0
- data/vendor/assets/stylesheets/mk/mk/_progress.scss +33 -0
- data/vendor/assets/stylesheets/mk/mk/_radios.scss +114 -0
- data/vendor/assets/stylesheets/mk/mk/_responsive.scss +115 -0
- data/vendor/assets/stylesheets/mk/mk/_ripples.scss +40 -0
- data/vendor/assets/stylesheets/mk/mk/_sections.scss +131 -0
- data/vendor/assets/stylesheets/mk/mk/_select.scss +108 -0
- data/vendor/assets/stylesheets/mk/mk/_shadows.scss +138 -0
- data/vendor/assets/stylesheets/mk/mk/_tables.scss +104 -0
- data/vendor/assets/stylesheets/mk/mk/_tabs.scss +53 -0
- data/vendor/assets/stylesheets/mk/mk/_tags.scss +97 -0
- data/vendor/assets/stylesheets/mk/mk/_togglebutton.scss +87 -0
- data/vendor/assets/stylesheets/mk/mk/_typography.scss +75 -0
- data/vendor/assets/stylesheets/mk/mk/_variables.scss +224 -0
- data/vendor/assets/stylesheets/mk/mk/_variables_bootstrap.scss +883 -0
- data/vendor/assets/stylesheets/mk/mk/_welljumbo.scss +28 -0
- data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-datepicker.scss +204 -0
- data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-nouislider.scss +161 -0
- data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-selectize.scss +93 -0
- data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-snackbarjs.scss +34 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_blogs.scss +17 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_contactus.scss +51 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_features.scss +92 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_footers.scss +163 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_headers.scss +125 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_pricing.scss +40 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_projects.scss +75 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_social-subscribe-lines.scss +71 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_team.scss +53 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_testimonials.scss +5 -0
- data/vendor/assets/stylesheets/pd/pd.scss +51 -0
- data/vendor/assets/stylesheets/pd/pd/_alerts.scss +60 -0
- data/vendor/assets/stylesheets/pd/pd/_animated-buttons.scss +61 -0
- data/vendor/assets/stylesheets/pd/pd/_buttons.scss +173 -0
- data/vendor/assets/stylesheets/pd/pd/_cards.scss +546 -0
- data/vendor/assets/stylesheets/pd/pd/_carousel.scss +15 -0
- data/vendor/assets/stylesheets/pd/pd/_chat-message.scss +206 -0
- data/vendor/assets/stylesheets/pd/pd/_checkbox-radio.scss +126 -0
- data/vendor/assets/stylesheets/pd/pd/_circlechart.scss +18 -0
- data/vendor/assets/stylesheets/pd/pd/_collapse.scss +40 -0
- data/vendor/assets/stylesheets/pd/pd/_dropdown.scss +413 -0
- data/vendor/assets/stylesheets/pd/pd/_footers.scss +87 -0
- data/vendor/assets/stylesheets/pd/pd/_forms.scss +43 -0
- data/vendor/assets/stylesheets/pd/pd/_inputs.scss +190 -0
- data/vendor/assets/stylesheets/pd/pd/_labels.scss +29 -0
- data/vendor/assets/stylesheets/pd/pd/_media.scss +80 -0
- data/vendor/assets/stylesheets/pd/pd/_misc.scss +104 -0
- data/vendor/assets/stylesheets/pd/pd/_mixins.scss +17 -0
- data/vendor/assets/stylesheets/pd/pd/_modal.scss +79 -0
- data/vendor/assets/stylesheets/pd/pd/_navbars.scss +289 -0
- data/vendor/assets/stylesheets/pd/pd/_pages.scss +196 -0
- data/vendor/assets/stylesheets/pd/pd/_progress-bars.scss +27 -0
- data/vendor/assets/stylesheets/pd/pd/_responsive.scss +666 -0
- data/vendor/assets/stylesheets/pd/pd/_sidebar-and-main-panel.scss +514 -0
- data/vendor/assets/stylesheets/pd/pd/_sliders.scss +222 -0
- data/vendor/assets/stylesheets/pd/pd/_social.scss +130 -0
- data/vendor/assets/stylesheets/pd/pd/_switch.scss +145 -0
- data/vendor/assets/stylesheets/pd/pd/_tables.scss +194 -0
- data/vendor/assets/stylesheets/pd/pd/_tabs-navs-pagination.scss +341 -0
- data/vendor/assets/stylesheets/pd/pd/_tags.scss +104 -0
- data/vendor/assets/stylesheets/pd/pd/_timeline.scss +178 -0
- data/vendor/assets/stylesheets/pd/pd/_tooltips-and-popovers.scss +156 -0
- data/vendor/assets/stylesheets/pd/pd/_typography.scss +117 -0
- data/vendor/assets/stylesheets/pd/pd/_variables.scss +367 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_alerts.scss +13 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_buttons.scss +89 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_cards.scss +7 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_chartist.scss +104 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_icons.scss +13 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_labels.scss +10 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_sidebar.scss +54 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_social.scss +68 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_table-row.scss +22 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_tabs.scss +4 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_transparency.scss +20 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_vendor-prefixes.scss +254 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_animate.scss +189 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_bootstrap-select.scss +313 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_bootstrap-table.scss +375 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_chartist.scss +246 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_datatables.net.scss +504 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_datetime-picker.scss +418 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_fullcalendar.scss +1124 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_jquery.jvectormap.scss +135 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_perfect-scrollbar.scss +112 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_sweetalert2.scss +531 -0
- data/vendor/assets/stylesheets/pk/ct-pk.scss +64 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_alerts.scss +69 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_animated-buttons.scss +63 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_bootstrap-select.scss +320 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_buttons.scss +161 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_cards.scss +570 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_carousel.scss +59 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_chartist.scss +354 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_checkbox-radio.scss +129 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_collapse.scss +40 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_datepicker.scss +198 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_dropdown.scss +291 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_fileupload.scss +112 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_footers.scss +193 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_headers.scss +85 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_images.scss +28 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_info-areas.scss +62 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_inputs.scss +171 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_labels.scss +29 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_media.scss +82 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_misc.scss +124 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_mixins.scss +16 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_modal.scss +91 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_navbars.scss +285 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_preloaders.scss +282 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_progress-bars.scss +27 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_responsive.scss +411 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_sections.scss +45 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_sidebar.scss +206 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_sliders.scss +222 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_social.scss +130 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_switch.scss +145 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_tables.scss +135 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_tabs-navs-pagination.scss +311 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_tags.scss +108 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_tooltips-and-popovers.scss +188 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_typography.scss +106 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_variables.scss +301 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_alerts.scss +11 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_buttons.scss +104 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_labels.scss +10 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_popovers.scss +21 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_social.scss +68 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_tabs.scss +4 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_transparency.scss +17 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_vendor-prefixes.scss +233 -0
- data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_default-skin.scss +592 -0
- data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_gallery.scss +27 -0
- data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_main-settings.scss +11 -0
- data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_main.scss +213 -0
- data/vendor/assets/stylesheets/pk/examples.scss +1083 -0
- data/vendor/assets/stylesheets/sd/examples.scss +403 -0
- data/vendor/assets/stylesheets/sd/sd.scss +41 -0
- data/vendor/assets/stylesheets/sd/sd/_alerts.scss +37 -0
- data/vendor/assets/stylesheets/sd/sd/_bootstrap-select.scss +307 -0
- data/vendor/assets/stylesheets/sd/sd/_buttons.scss +108 -0
- data/vendor/assets/stylesheets/sd/sd/_cards.scss +462 -0
- data/vendor/assets/stylesheets/sd/sd/_carousel.scss +15 -0
- data/vendor/assets/stylesheets/sd/sd/_chartist.scss +335 -0
- data/vendor/assets/stylesheets/sd/sd/_checkbox-radio-switch.scss +246 -0
- data/vendor/assets/stylesheets/sd/sd/_collapse.scss +33 -0
- data/vendor/assets/stylesheets/sd/sd/_datepicker.scss +199 -0
- data/vendor/assets/stylesheets/sd/sd/_dropdown.scss +98 -0
- data/vendor/assets/stylesheets/sd/sd/_flexisel.scss +53 -0
- data/vendor/assets/stylesheets/sd/sd/_footers.scss +216 -0
- data/vendor/assets/stylesheets/sd/sd/_icons.scss +127 -0
- data/vendor/assets/stylesheets/sd/sd/_inputs.scss +141 -0
- data/vendor/assets/stylesheets/sd/sd/_labels.scss +54 -0
- data/vendor/assets/stylesheets/sd/sd/_media.scss +80 -0
- data/vendor/assets/stylesheets/sd/sd/_misc.scss +115 -0
- data/vendor/assets/stylesheets/sd/sd/_mixins.scss +20 -0
- data/vendor/assets/stylesheets/sd/sd/_modal.scss +79 -0
- data/vendor/assets/stylesheets/sd/sd/_morphing-buttons.scss +161 -0
- data/vendor/assets/stylesheets/sd/sd/_navbars.scss +293 -0
- data/vendor/assets/stylesheets/sd/sd/_progress-bars.scss +9 -0
- data/vendor/assets/stylesheets/sd/sd/_responsive.scss +302 -0
- data/vendor/assets/stylesheets/sd/sd/_sections.scss +12 -0
- data/vendor/assets/stylesheets/sd/sd/_sidebar-menu.scss +232 -0
- data/vendor/assets/stylesheets/sd/sd/_sliders.scss +218 -0
- data/vendor/assets/stylesheets/sd/sd/_social-buttons.scss +76 -0
- data/vendor/assets/stylesheets/sd/sd/_tables.scss +110 -0
- data/vendor/assets/stylesheets/sd/sd/_tabs-navs-pagination.scss +217 -0
- data/vendor/assets/stylesheets/sd/sd/_tags.scss +220 -0
- data/vendor/assets/stylesheets/sd/sd/_tooltips-and-popovers.scss +156 -0
- data/vendor/assets/stylesheets/sd/sd/_typography.scss +73 -0
- data/vendor/assets/stylesheets/sd/sd/_variables.scss +249 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_buttons.scss +76 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_cards.scss +8 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_icons.scss +13 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_labels.scss +21 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_morphing-buttons.scss +34 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_social-buttons.scss +43 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_tabs.scss +4 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_transparency.scss +20 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_vendor-prefixes.scss +177 -0
- metadata +484 -0
@@ -0,0 +1,2573 @@
|
|
1
|
+
/*! version : 4.17.37
|
2
|
+
=========================================================
|
3
|
+
bootstrap-datetimejs
|
4
|
+
https://github.com/Eonasdan/bootstrap-datetimepicker
|
5
|
+
Copyright (c) 2015 Jonathan Peterson
|
6
|
+
=========================================================
|
7
|
+
*/
|
8
|
+
/*
|
9
|
+
The MIT License (MIT)
|
10
|
+
|
11
|
+
Copyright (c) 2015 Jonathan Peterson
|
12
|
+
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
15
|
+
in the Software without restriction, including without limitation the rights
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
18
|
+
furnished to do so, subject to the following conditions:
|
19
|
+
|
20
|
+
The above copyright notice and this permission notice shall be included in
|
21
|
+
all copies or substantial portions of the Software.
|
22
|
+
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
29
|
+
THE SOFTWARE.
|
30
|
+
*/
|
31
|
+
/*global define:false */
|
32
|
+
/*global exports:false */
|
33
|
+
/*global require:false */
|
34
|
+
/*global jQuery:false */
|
35
|
+
/*global moment:false */
|
36
|
+
(function (factory) {
|
37
|
+
'use strict';
|
38
|
+
if (typeof define === 'function' && define.amd) {
|
39
|
+
// AMD is used - Register as an anonymous module.
|
40
|
+
define(['jquery', 'moment'], factory);
|
41
|
+
} else if (typeof exports === 'object') {
|
42
|
+
factory(require('jquery'), require('moment'));
|
43
|
+
} else {
|
44
|
+
// Neither AMD nor CommonJS used. Use global variables.
|
45
|
+
if (typeof jQuery === 'undefined') {
|
46
|
+
throw 'bootstrap-datetimepicker requires jQuery to be loaded first';
|
47
|
+
}
|
48
|
+
if (typeof moment === 'undefined') {
|
49
|
+
throw 'bootstrap-datetimepicker requires Moment.js to be loaded first';
|
50
|
+
}
|
51
|
+
factory(jQuery, moment);
|
52
|
+
}
|
53
|
+
}(function ($, moment) {
|
54
|
+
'use strict';
|
55
|
+
if (!moment) {
|
56
|
+
throw new Error('bootstrap-datetimepicker requires Moment.js to be loaded first');
|
57
|
+
}
|
58
|
+
|
59
|
+
var dateTimePicker = function (element, options) {
|
60
|
+
var picker = {},
|
61
|
+
date,
|
62
|
+
viewDate,
|
63
|
+
unset = true,
|
64
|
+
input,
|
65
|
+
component = false,
|
66
|
+
widget = false,
|
67
|
+
use24Hours,
|
68
|
+
minViewModeNumber = 0,
|
69
|
+
actualFormat,
|
70
|
+
parseFormats,
|
71
|
+
currentViewMode,
|
72
|
+
datePickerModes = [
|
73
|
+
{
|
74
|
+
clsName: 'days',
|
75
|
+
navFnc: 'M',
|
76
|
+
navStep: 1
|
77
|
+
},
|
78
|
+
{
|
79
|
+
clsName: 'months',
|
80
|
+
navFnc: 'y',
|
81
|
+
navStep: 1
|
82
|
+
},
|
83
|
+
{
|
84
|
+
clsName: 'years',
|
85
|
+
navFnc: 'y',
|
86
|
+
navStep: 10
|
87
|
+
},
|
88
|
+
{
|
89
|
+
clsName: 'decades',
|
90
|
+
navFnc: 'y',
|
91
|
+
navStep: 100
|
92
|
+
}
|
93
|
+
],
|
94
|
+
viewModes = ['days', 'months', 'years', 'decades'],
|
95
|
+
verticalModes = ['top', 'bottom', 'auto'],
|
96
|
+
horizontalModes = ['left', 'right', 'auto'],
|
97
|
+
toolbarPlacements = ['default', 'top', 'bottom'],
|
98
|
+
keyMap = {
|
99
|
+
'up': 38,
|
100
|
+
38: 'up',
|
101
|
+
'down': 40,
|
102
|
+
40: 'down',
|
103
|
+
'left': 37,
|
104
|
+
37: 'left',
|
105
|
+
'right': 39,
|
106
|
+
39: 'right',
|
107
|
+
'tab': 9,
|
108
|
+
9: 'tab',
|
109
|
+
'escape': 27,
|
110
|
+
27: 'escape',
|
111
|
+
'enter': 13,
|
112
|
+
13: 'enter',
|
113
|
+
'pageUp': 33,
|
114
|
+
33: 'pageUp',
|
115
|
+
'pageDown': 34,
|
116
|
+
34: 'pageDown',
|
117
|
+
'shift': 16,
|
118
|
+
16: 'shift',
|
119
|
+
'control': 17,
|
120
|
+
17: 'control',
|
121
|
+
'space': 32,
|
122
|
+
32: 'space',
|
123
|
+
't': 84,
|
124
|
+
84: 't',
|
125
|
+
'delete': 46,
|
126
|
+
46: 'delete'
|
127
|
+
},
|
128
|
+
keyState = {},
|
129
|
+
|
130
|
+
/********************************************************************************
|
131
|
+
*
|
132
|
+
* Private functions
|
133
|
+
*
|
134
|
+
********************************************************************************/
|
135
|
+
getMoment = function (d) {
|
136
|
+
var tzEnabled = false,
|
137
|
+
returnMoment,
|
138
|
+
currentZoneOffset,
|
139
|
+
incomingZoneOffset,
|
140
|
+
timeZoneIndicator,
|
141
|
+
dateWithTimeZoneInfo;
|
142
|
+
|
143
|
+
if (moment.tz !== undefined && options.timeZone !== undefined && options.timeZone !== null && options.timeZone !== '') {
|
144
|
+
tzEnabled = true;
|
145
|
+
}
|
146
|
+
if (d === undefined || d === null) {
|
147
|
+
if (tzEnabled) {
|
148
|
+
returnMoment = moment().tz(options.timeZone).startOf('d');
|
149
|
+
} else {
|
150
|
+
returnMoment = moment().startOf('d');
|
151
|
+
}
|
152
|
+
} else {
|
153
|
+
if (tzEnabled) {
|
154
|
+
currentZoneOffset = moment().tz(options.timeZone).utcOffset();
|
155
|
+
incomingZoneOffset = moment(d, parseFormats, options.useStrict).utcOffset();
|
156
|
+
if (incomingZoneOffset !== currentZoneOffset) {
|
157
|
+
timeZoneIndicator = moment().tz(options.timeZone).format('Z');
|
158
|
+
dateWithTimeZoneInfo = moment(d, parseFormats, options.useStrict).format('YYYY-MM-DD[T]HH:mm:ss') + timeZoneIndicator;
|
159
|
+
returnMoment = moment(dateWithTimeZoneInfo, parseFormats, options.useStrict).tz(options.timeZone);
|
160
|
+
} else {
|
161
|
+
returnMoment = moment(d, parseFormats, options.useStrict).tz(options.timeZone);
|
162
|
+
}
|
163
|
+
} else {
|
164
|
+
returnMoment = moment(d, parseFormats, options.useStrict);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
return returnMoment;
|
168
|
+
},
|
169
|
+
isEnabled = function (granularity) {
|
170
|
+
if (typeof granularity !== 'string' || granularity.length > 1) {
|
171
|
+
throw new TypeError('isEnabled expects a single character string parameter');
|
172
|
+
}
|
173
|
+
switch (granularity) {
|
174
|
+
case 'y':
|
175
|
+
return actualFormat.indexOf('Y') !== -1;
|
176
|
+
case 'M':
|
177
|
+
return actualFormat.indexOf('M') !== -1;
|
178
|
+
case 'd':
|
179
|
+
return actualFormat.toLowerCase().indexOf('d') !== -1;
|
180
|
+
case 'h':
|
181
|
+
case 'H':
|
182
|
+
return actualFormat.toLowerCase().indexOf('h') !== -1;
|
183
|
+
case 'm':
|
184
|
+
return actualFormat.indexOf('m') !== -1;
|
185
|
+
case 's':
|
186
|
+
return actualFormat.indexOf('s') !== -1;
|
187
|
+
default:
|
188
|
+
return false;
|
189
|
+
}
|
190
|
+
},
|
191
|
+
hasTime = function () {
|
192
|
+
return (isEnabled('h') || isEnabled('m') || isEnabled('s'));
|
193
|
+
},
|
194
|
+
|
195
|
+
hasDate = function () {
|
196
|
+
return (isEnabled('y') || isEnabled('M') || isEnabled('d'));
|
197
|
+
},
|
198
|
+
|
199
|
+
getDatePickerTemplate = function () {
|
200
|
+
var headTemplate = $('<thead>')
|
201
|
+
.append($('<tr>')
|
202
|
+
.append($('<th>').addClass('prev').attr('data-action', 'previous')
|
203
|
+
.append($('<span>').addClass(options.icons.previous))
|
204
|
+
)
|
205
|
+
.append($('<th>').addClass('picker-switch').attr('data-action', 'pickerSwitch').attr('colspan', (options.calendarWeeks ? '6' : '5')))
|
206
|
+
.append($('<th>').addClass('next').attr('data-action', 'next')
|
207
|
+
.append($('<span>').addClass(options.icons.next))
|
208
|
+
)
|
209
|
+
),
|
210
|
+
contTemplate = $('<tbody>')
|
211
|
+
.append($('<tr>')
|
212
|
+
.append($('<td>').attr('colspan', (options.calendarWeeks ? '8' : '7')))
|
213
|
+
);
|
214
|
+
|
215
|
+
return [
|
216
|
+
$('<div>').addClass('datepicker-days')
|
217
|
+
.append($('<table>').addClass('table-condensed')
|
218
|
+
.append(headTemplate)
|
219
|
+
.append($('<tbody>'))
|
220
|
+
),
|
221
|
+
$('<div>').addClass('datepicker-months')
|
222
|
+
.append($('<table>').addClass('table-condensed')
|
223
|
+
.append(headTemplate.clone())
|
224
|
+
.append(contTemplate.clone())
|
225
|
+
),
|
226
|
+
$('<div>').addClass('datepicker-years')
|
227
|
+
.append($('<table>').addClass('table-condensed')
|
228
|
+
.append(headTemplate.clone())
|
229
|
+
.append(contTemplate.clone())
|
230
|
+
),
|
231
|
+
$('<div>').addClass('datepicker-decades')
|
232
|
+
.append($('<table>').addClass('table-condensed')
|
233
|
+
.append(headTemplate.clone())
|
234
|
+
.append(contTemplate.clone())
|
235
|
+
)
|
236
|
+
];
|
237
|
+
},
|
238
|
+
|
239
|
+
getTimePickerMainTemplate = function () {
|
240
|
+
var topRow = $('<tr>'),
|
241
|
+
middleRow = $('<tr>'),
|
242
|
+
bottomRow = $('<tr>');
|
243
|
+
|
244
|
+
if (isEnabled('h')) {
|
245
|
+
topRow.append($('<td>')
|
246
|
+
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.incrementHour}).addClass('btn').attr('data-action', 'incrementHours')
|
247
|
+
.append($('<span>').addClass(options.icons.up))));
|
248
|
+
middleRow.append($('<td>')
|
249
|
+
.append($('<span>').addClass('timepicker-hour').attr({'data-time-component':'hours', 'title': options.tooltips.pickHour}).attr('data-action', 'showHours')));
|
250
|
+
bottomRow.append($('<td>')
|
251
|
+
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.decrementHour}).addClass('btn').attr('data-action', 'decrementHours')
|
252
|
+
.append($('<span>').addClass(options.icons.down))));
|
253
|
+
}
|
254
|
+
if (isEnabled('m')) {
|
255
|
+
if (isEnabled('h')) {
|
256
|
+
topRow.append($('<td>').addClass('separator'));
|
257
|
+
middleRow.append($('<td>').addClass('separator').html(':'));
|
258
|
+
bottomRow.append($('<td>').addClass('separator'));
|
259
|
+
}
|
260
|
+
topRow.append($('<td>')
|
261
|
+
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.incrementMinute}).addClass('btn').attr('data-action', 'incrementMinutes')
|
262
|
+
.append($('<span>').addClass(options.icons.up))));
|
263
|
+
middleRow.append($('<td>')
|
264
|
+
.append($('<span>').addClass('timepicker-minute').attr({'data-time-component': 'minutes', 'title': options.tooltips.pickMinute}).attr('data-action', 'showMinutes')));
|
265
|
+
bottomRow.append($('<td>')
|
266
|
+
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.decrementMinute}).addClass('btn').attr('data-action', 'decrementMinutes')
|
267
|
+
.append($('<span>').addClass(options.icons.down))));
|
268
|
+
}
|
269
|
+
if (isEnabled('s')) {
|
270
|
+
if (isEnabled('m')) {
|
271
|
+
topRow.append($('<td>').addClass('separator'));
|
272
|
+
middleRow.append($('<td>').addClass('separator').html(':'));
|
273
|
+
bottomRow.append($('<td>').addClass('separator'));
|
274
|
+
}
|
275
|
+
topRow.append($('<td>')
|
276
|
+
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.incrementSecond}).addClass('btn').attr('data-action', 'incrementSeconds')
|
277
|
+
.append($('<span>').addClass(options.icons.up))));
|
278
|
+
middleRow.append($('<td>')
|
279
|
+
.append($('<span>').addClass('timepicker-second').attr({'data-time-component': 'seconds', 'title': options.tooltips.pickSecond}).attr('data-action', 'showSeconds')));
|
280
|
+
bottomRow.append($('<td>')
|
281
|
+
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.decrementSecond}).addClass('btn').attr('data-action', 'decrementSeconds')
|
282
|
+
.append($('<span>').addClass(options.icons.down))));
|
283
|
+
}
|
284
|
+
|
285
|
+
if (!use24Hours) {
|
286
|
+
topRow.append($('<td>').addClass('separator'));
|
287
|
+
middleRow.append($('<td>')
|
288
|
+
.append($('<button>').addClass('btn btn-info btn-round').attr({'data-action': 'togglePeriod', tabindex: '-1', 'title': options.tooltips.togglePeriod})));
|
289
|
+
bottomRow.append($('<td>').addClass('separator'));
|
290
|
+
}
|
291
|
+
|
292
|
+
return $('<div>').addClass('timepicker-picker')
|
293
|
+
.append($('<table>').addClass('table-condensed')
|
294
|
+
.append([topRow, middleRow, bottomRow]));
|
295
|
+
},
|
296
|
+
|
297
|
+
getTimePickerTemplate = function () {
|
298
|
+
var hoursView = $('<div>').addClass('timepicker-hours')
|
299
|
+
.append($('<table>').addClass('table-condensed')),
|
300
|
+
minutesView = $('<div>').addClass('timepicker-minutes')
|
301
|
+
.append($('<table>').addClass('table-condensed')),
|
302
|
+
secondsView = $('<div>').addClass('timepicker-seconds')
|
303
|
+
.append($('<table>').addClass('table-condensed')),
|
304
|
+
ret = [getTimePickerMainTemplate()];
|
305
|
+
|
306
|
+
if (isEnabled('h')) {
|
307
|
+
ret.push(hoursView);
|
308
|
+
}
|
309
|
+
if (isEnabled('m')) {
|
310
|
+
ret.push(minutesView);
|
311
|
+
}
|
312
|
+
if (isEnabled('s')) {
|
313
|
+
ret.push(secondsView);
|
314
|
+
}
|
315
|
+
|
316
|
+
return ret;
|
317
|
+
},
|
318
|
+
|
319
|
+
getToolbar = function () {
|
320
|
+
var row = [];
|
321
|
+
if (options.showTodayButton) {
|
322
|
+
row.push($('<td>').append($('<a>').attr({'data-action':'today', 'title': options.tooltips.today}).append($('<span>').addClass(options.icons.today))));
|
323
|
+
}
|
324
|
+
if (!options.sideBySide && hasDate() && hasTime()) {
|
325
|
+
row.push($('<td>').append($('<a>').attr({'data-action':'togglePicker', 'title': options.tooltips.selectTime}).append($('<span>').addClass(options.icons.time))));
|
326
|
+
}
|
327
|
+
if (options.showClear) {
|
328
|
+
row.push($('<td>').append($('<a>').attr({'data-action':'clear', 'title': options.tooltips.clear}).append($('<span>').addClass(options.icons.clear))));
|
329
|
+
}
|
330
|
+
if (options.showClose) {
|
331
|
+
row.push($('<td>').append($('<a>').attr({'data-action':'close', 'title': options.tooltips.close}).append($('<span>').addClass(options.icons.close))));
|
332
|
+
}
|
333
|
+
return $('<table>').addClass('table-condensed').append($('<tbody>').append($('<tr>').append(row)));
|
334
|
+
},
|
335
|
+
|
336
|
+
getTemplate = function () {
|
337
|
+
var template = $('<div>').addClass('bootstrap-datetimepicker-widget dropdown-menu'),
|
338
|
+
dateView = $('<div>').addClass('datepicker').append(getDatePickerTemplate()),
|
339
|
+
timeView = $('<div>').addClass('timepicker').append(getTimePickerTemplate()),
|
340
|
+
content = $('<ul>').addClass('list-unstyled'),
|
341
|
+
toolbar = $('<li>').addClass('picker-switch' + (options.collapse ? ' accordion-toggle' : '')).append(getToolbar());
|
342
|
+
|
343
|
+
if (options.inline) {
|
344
|
+
template.removeClass('dropdown-menu');
|
345
|
+
}
|
346
|
+
|
347
|
+
if (use24Hours) {
|
348
|
+
template.addClass('usetwentyfour');
|
349
|
+
}
|
350
|
+
if (isEnabled('s') && !use24Hours) {
|
351
|
+
template.addClass('wider');
|
352
|
+
}
|
353
|
+
|
354
|
+
if (options.sideBySide && hasDate() && hasTime()) {
|
355
|
+
template.addClass('timepicker-sbs');
|
356
|
+
if (options.toolbarPlacement === 'top') {
|
357
|
+
template.append(toolbar);
|
358
|
+
}
|
359
|
+
template.append(
|
360
|
+
$('<div>').addClass('row')
|
361
|
+
.append(dateView.addClass('col-md-6'))
|
362
|
+
.append(timeView.addClass('col-md-6'))
|
363
|
+
);
|
364
|
+
if (options.toolbarPlacement === 'bottom') {
|
365
|
+
template.append(toolbar);
|
366
|
+
}
|
367
|
+
return template;
|
368
|
+
}
|
369
|
+
|
370
|
+
if (options.toolbarPlacement === 'top') {
|
371
|
+
content.append(toolbar);
|
372
|
+
}
|
373
|
+
if (hasDate()) {
|
374
|
+
content.append($('<li>').addClass((options.collapse && hasTime() ? 'collapse in' : '')).append(dateView));
|
375
|
+
}
|
376
|
+
if (options.toolbarPlacement === 'default') {
|
377
|
+
content.append(toolbar);
|
378
|
+
}
|
379
|
+
if (hasTime()) {
|
380
|
+
content.append($('<li>').addClass((options.collapse && hasDate() ? 'collapse' : '')).append(timeView));
|
381
|
+
}
|
382
|
+
if (options.toolbarPlacement === 'bottom') {
|
383
|
+
content.append(toolbar);
|
384
|
+
}
|
385
|
+
return template.append(content);
|
386
|
+
},
|
387
|
+
|
388
|
+
dataToOptions = function () {
|
389
|
+
var eData,
|
390
|
+
dataOptions = {};
|
391
|
+
|
392
|
+
if (element.is('input') || options.inline) {
|
393
|
+
eData = element.data();
|
394
|
+
} else {
|
395
|
+
eData = element.find('input').data();
|
396
|
+
}
|
397
|
+
|
398
|
+
if (eData.dateOptions && eData.dateOptions instanceof Object) {
|
399
|
+
dataOptions = $.extend(true, dataOptions, eData.dateOptions);
|
400
|
+
}
|
401
|
+
|
402
|
+
$.each(options, function (key) {
|
403
|
+
var attributeName = 'date' + key.charAt(0).toUpperCase() + key.slice(1);
|
404
|
+
if (eData[attributeName] !== undefined) {
|
405
|
+
dataOptions[key] = eData[attributeName];
|
406
|
+
}
|
407
|
+
});
|
408
|
+
return dataOptions;
|
409
|
+
},
|
410
|
+
|
411
|
+
place = function () {
|
412
|
+
var position = (component || element).position(),
|
413
|
+
offset = (component || element).offset(),
|
414
|
+
vertical = options.widgetPositioning.vertical,
|
415
|
+
horizontal = options.widgetPositioning.horizontal,
|
416
|
+
parent;
|
417
|
+
|
418
|
+
if (options.widgetParent) {
|
419
|
+
parent = options.widgetParent.append(widget);
|
420
|
+
} else if (element.is('input')) {
|
421
|
+
parent = element.after(widget).parent();
|
422
|
+
} else if (options.inline) {
|
423
|
+
parent = element.append(widget);
|
424
|
+
return;
|
425
|
+
} else {
|
426
|
+
parent = element;
|
427
|
+
element.children().first().after(widget);
|
428
|
+
}
|
429
|
+
|
430
|
+
// Top and bottom logic
|
431
|
+
if (vertical === 'auto') {
|
432
|
+
if (offset.top + widget.height() * 1.5 >= $(window).height() + $(window).scrollTop() &&
|
433
|
+
widget.height() + element.outerHeight() < offset.top) {
|
434
|
+
vertical = 'top';
|
435
|
+
} else {
|
436
|
+
vertical = 'bottom';
|
437
|
+
}
|
438
|
+
}
|
439
|
+
|
440
|
+
// Left and right logic
|
441
|
+
if (horizontal === 'auto') {
|
442
|
+
if (parent.width() < offset.left + widget.outerWidth() / 2 &&
|
443
|
+
offset.left + widget.outerWidth() > $(window).width()) {
|
444
|
+
horizontal = 'right';
|
445
|
+
} else {
|
446
|
+
horizontal = 'left';
|
447
|
+
}
|
448
|
+
}
|
449
|
+
|
450
|
+
if (vertical === 'top') {
|
451
|
+
widget.addClass('top').removeClass('bottom');
|
452
|
+
} else {
|
453
|
+
widget.addClass('bottom').removeClass('top');
|
454
|
+
}
|
455
|
+
|
456
|
+
if (horizontal === 'right') {
|
457
|
+
widget.addClass('pull-right');
|
458
|
+
} else {
|
459
|
+
widget.removeClass('pull-right');
|
460
|
+
}
|
461
|
+
|
462
|
+
// find the first parent element that has a relative css positioning
|
463
|
+
if (parent.css('position') !== 'relative') {
|
464
|
+
parent = parent.parents().filter(function () {
|
465
|
+
return $(this).css('position') === 'relative';
|
466
|
+
}).first();
|
467
|
+
}
|
468
|
+
|
469
|
+
if (parent.length === 0) {
|
470
|
+
throw new Error('datetimepicker component should be placed within a relative positioned container');
|
471
|
+
}
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
widget.css({
|
476
|
+
top: vertical === 'top' ? 'auto' : position.top + element.outerHeight(),
|
477
|
+
bottom: vertical === 'top' ? position.top + element.outerHeight() : 'auto',
|
478
|
+
left: horizontal === 'left' ? (parent === element ? 0 : position.left) : 'auto',
|
479
|
+
right: horizontal === 'left' ? 'auto' : parent.outerWidth() - element.outerWidth() - (parent === element ? 0 : position.left)
|
480
|
+
});
|
481
|
+
|
482
|
+
setTimeout(function(){
|
483
|
+
widget.addClass('open');
|
484
|
+
}, 180);
|
485
|
+
|
486
|
+
},
|
487
|
+
|
488
|
+
notifyEvent = function (e) {
|
489
|
+
if (e.type === 'dp.change' && ((e.date && e.date.isSame(e.oldDate)) || (!e.date && !e.oldDate))) {
|
490
|
+
return;
|
491
|
+
}
|
492
|
+
element.trigger(e);
|
493
|
+
},
|
494
|
+
|
495
|
+
viewUpdate = function (e) {
|
496
|
+
if (e === 'y') {
|
497
|
+
e = 'YYYY';
|
498
|
+
}
|
499
|
+
notifyEvent({
|
500
|
+
type: 'dp.update',
|
501
|
+
change: e,
|
502
|
+
viewDate: viewDate.clone()
|
503
|
+
});
|
504
|
+
},
|
505
|
+
|
506
|
+
showMode = function (dir) {
|
507
|
+
if (!widget) {
|
508
|
+
return;
|
509
|
+
}
|
510
|
+
if (dir) {
|
511
|
+
currentViewMode = Math.max(minViewModeNumber, Math.min(3, currentViewMode + dir));
|
512
|
+
}
|
513
|
+
widget.find('.datepicker > div').hide().filter('.datepicker-' + datePickerModes[currentViewMode].clsName).show();
|
514
|
+
},
|
515
|
+
|
516
|
+
fillDow = function () {
|
517
|
+
var row = $('<tr>'),
|
518
|
+
currentDate = viewDate.clone().startOf('w').startOf('d');
|
519
|
+
|
520
|
+
if (options.calendarWeeks === true) {
|
521
|
+
row.append($('<th>').addClass('cw').text('#'));
|
522
|
+
}
|
523
|
+
|
524
|
+
while (currentDate.isBefore(viewDate.clone().endOf('w'))) {
|
525
|
+
row.append($('<th>').addClass('dow').text(currentDate.format('dd')));
|
526
|
+
currentDate.add(1, 'd');
|
527
|
+
}
|
528
|
+
widget.find('.datepicker-days thead').append(row);
|
529
|
+
},
|
530
|
+
|
531
|
+
isInDisabledDates = function (testDate) {
|
532
|
+
return options.disabledDates[testDate.format('YYYY-MM-DD')] === true;
|
533
|
+
},
|
534
|
+
|
535
|
+
isInEnabledDates = function (testDate) {
|
536
|
+
return options.enabledDates[testDate.format('YYYY-MM-DD')] === true;
|
537
|
+
},
|
538
|
+
|
539
|
+
isInDisabledHours = function (testDate) {
|
540
|
+
return options.disabledHours[testDate.format('H')] === true;
|
541
|
+
},
|
542
|
+
|
543
|
+
isInEnabledHours = function (testDate) {
|
544
|
+
return options.enabledHours[testDate.format('H')] === true;
|
545
|
+
},
|
546
|
+
|
547
|
+
isValid = function (targetMoment, granularity) {
|
548
|
+
if (!targetMoment.isValid()) {
|
549
|
+
return false;
|
550
|
+
}
|
551
|
+
if (options.disabledDates && granularity === 'd' && isInDisabledDates(targetMoment)) {
|
552
|
+
return false;
|
553
|
+
}
|
554
|
+
if (options.enabledDates && granularity === 'd' && !isInEnabledDates(targetMoment)) {
|
555
|
+
return false;
|
556
|
+
}
|
557
|
+
if (options.minDate && targetMoment.isBefore(options.minDate, granularity)) {
|
558
|
+
return false;
|
559
|
+
}
|
560
|
+
if (options.maxDate && targetMoment.isAfter(options.maxDate, granularity)) {
|
561
|
+
return false;
|
562
|
+
}
|
563
|
+
if (options.daysOfWeekDisabled && granularity === 'd' && options.daysOfWeekDisabled.indexOf(targetMoment.day()) !== -1) {
|
564
|
+
return false;
|
565
|
+
}
|
566
|
+
if (options.disabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && isInDisabledHours(targetMoment)) {
|
567
|
+
return false;
|
568
|
+
}
|
569
|
+
if (options.enabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && !isInEnabledHours(targetMoment)) {
|
570
|
+
return false;
|
571
|
+
}
|
572
|
+
if (options.disabledTimeIntervals && (granularity === 'h' || granularity === 'm' || granularity === 's')) {
|
573
|
+
var found = false;
|
574
|
+
$.each(options.disabledTimeIntervals, function () {
|
575
|
+
if (targetMoment.isBetween(this[0], this[1])) {
|
576
|
+
found = true;
|
577
|
+
return false;
|
578
|
+
}
|
579
|
+
});
|
580
|
+
if (found) {
|
581
|
+
return false;
|
582
|
+
}
|
583
|
+
}
|
584
|
+
return true;
|
585
|
+
},
|
586
|
+
|
587
|
+
fillMonths = function () {
|
588
|
+
var spans = [],
|
589
|
+
monthsShort = viewDate.clone().startOf('y').startOf('d');
|
590
|
+
while (monthsShort.isSame(viewDate, 'y')) {
|
591
|
+
spans.push($('<span>').attr('data-action', 'selectMonth').addClass('month').text(monthsShort.format('MMM')));
|
592
|
+
monthsShort.add(1, 'M');
|
593
|
+
}
|
594
|
+
widget.find('.datepicker-months td').empty().append(spans);
|
595
|
+
},
|
596
|
+
|
597
|
+
updateMonths = function () {
|
598
|
+
var monthsView = widget.find('.datepicker-months'),
|
599
|
+
monthsViewHeader = monthsView.find('th'),
|
600
|
+
months = monthsView.find('tbody').find('span');
|
601
|
+
|
602
|
+
monthsViewHeader.eq(0).find('span').attr('title', options.tooltips.prevYear);
|
603
|
+
monthsViewHeader.eq(1).attr('title', options.tooltips.selectYear);
|
604
|
+
monthsViewHeader.eq(2).find('span').attr('title', options.tooltips.nextYear);
|
605
|
+
|
606
|
+
monthsView.find('.disabled').removeClass('disabled');
|
607
|
+
|
608
|
+
if (!isValid(viewDate.clone().subtract(1, 'y'), 'y')) {
|
609
|
+
monthsViewHeader.eq(0).addClass('disabled');
|
610
|
+
}
|
611
|
+
|
612
|
+
monthsViewHeader.eq(1).text(viewDate.year());
|
613
|
+
|
614
|
+
if (!isValid(viewDate.clone().add(1, 'y'), 'y')) {
|
615
|
+
monthsViewHeader.eq(2).addClass('disabled');
|
616
|
+
}
|
617
|
+
|
618
|
+
months.removeClass('active');
|
619
|
+
if (date.isSame(viewDate, 'y') && !unset) {
|
620
|
+
months.eq(date.month()).addClass('active');
|
621
|
+
}
|
622
|
+
|
623
|
+
months.each(function (index) {
|
624
|
+
if (!isValid(viewDate.clone().month(index), 'M')) {
|
625
|
+
$(this).addClass('disabled');
|
626
|
+
}
|
627
|
+
});
|
628
|
+
},
|
629
|
+
|
630
|
+
updateYears = function () {
|
631
|
+
var yearsView = widget.find('.datepicker-years'),
|
632
|
+
yearsViewHeader = yearsView.find('th'),
|
633
|
+
startYear = viewDate.clone().subtract(5, 'y'),
|
634
|
+
endYear = viewDate.clone().add(6, 'y'),
|
635
|
+
html = '';
|
636
|
+
|
637
|
+
yearsViewHeader.eq(0).find('span').attr('title', options.tooltips.prevDecade);
|
638
|
+
yearsViewHeader.eq(1).attr('title', options.tooltips.selectDecade);
|
639
|
+
yearsViewHeader.eq(2).find('span').attr('title', options.tooltips.nextDecade);
|
640
|
+
|
641
|
+
yearsView.find('.disabled').removeClass('disabled');
|
642
|
+
|
643
|
+
if (options.minDate && options.minDate.isAfter(startYear, 'y')) {
|
644
|
+
yearsViewHeader.eq(0).addClass('disabled');
|
645
|
+
}
|
646
|
+
|
647
|
+
yearsViewHeader.eq(1).text(startYear.year() + '-' + endYear.year());
|
648
|
+
|
649
|
+
if (options.maxDate && options.maxDate.isBefore(endYear, 'y')) {
|
650
|
+
yearsViewHeader.eq(2).addClass('disabled');
|
651
|
+
}
|
652
|
+
|
653
|
+
while (!startYear.isAfter(endYear, 'y')) {
|
654
|
+
html += '<span data-action="selectYear" class="year' + (startYear.isSame(date, 'y') && !unset ? ' active' : '') + (!isValid(startYear, 'y') ? ' disabled' : '') + '">' + startYear.year() + '</span>';
|
655
|
+
startYear.add(1, 'y');
|
656
|
+
}
|
657
|
+
|
658
|
+
yearsView.find('td').html(html);
|
659
|
+
},
|
660
|
+
|
661
|
+
updateDecades = function () {
|
662
|
+
var decadesView = widget.find('.datepicker-decades'),
|
663
|
+
decadesViewHeader = decadesView.find('th'),
|
664
|
+
startDecade = moment({y: viewDate.year() - (viewDate.year() % 100) - 1}),
|
665
|
+
endDecade = startDecade.clone().add(100, 'y'),
|
666
|
+
startedAt = startDecade.clone(),
|
667
|
+
html = '';
|
668
|
+
|
669
|
+
decadesViewHeader.eq(0).find('span').attr('title', options.tooltips.prevCentury);
|
670
|
+
decadesViewHeader.eq(2).find('span').attr('title', options.tooltips.nextCentury);
|
671
|
+
|
672
|
+
decadesView.find('.disabled').removeClass('disabled');
|
673
|
+
|
674
|
+
if (startDecade.isSame(moment({y: 1900})) || (options.minDate && options.minDate.isAfter(startDecade, 'y'))) {
|
675
|
+
decadesViewHeader.eq(0).addClass('disabled');
|
676
|
+
}
|
677
|
+
|
678
|
+
decadesViewHeader.eq(1).text(startDecade.year() + '-' + endDecade.year());
|
679
|
+
|
680
|
+
if (startDecade.isSame(moment({y: 2000})) || (options.maxDate && options.maxDate.isBefore(endDecade, 'y'))) {
|
681
|
+
decadesViewHeader.eq(2).addClass('disabled');
|
682
|
+
}
|
683
|
+
|
684
|
+
while (!startDecade.isAfter(endDecade, 'y')) {
|
685
|
+
html += '<span data-action="selectDecade" class="decade' + (startDecade.isSame(date, 'y') ? ' active' : '') +
|
686
|
+
(!isValid(startDecade, 'y') ? ' disabled' : '') + '" data-selection="' + (startDecade.year() + 6) + '">' + (startDecade.year() + 1) + ' - ' + (startDecade.year() + 12) + '</span>';
|
687
|
+
startDecade.add(12, 'y');
|
688
|
+
}
|
689
|
+
html += '<span></span><span></span><span></span>'; //push the dangling block over, at least this way it's even
|
690
|
+
|
691
|
+
decadesView.find('td').html(html);
|
692
|
+
decadesViewHeader.eq(1).text((startedAt.year() + 1) + '-' + (startDecade.year()));
|
693
|
+
},
|
694
|
+
|
695
|
+
fillDate = function () {
|
696
|
+
var daysView = widget.find('.datepicker-days'),
|
697
|
+
daysViewHeader = daysView.find('th'),
|
698
|
+
currentDate,
|
699
|
+
html = [],
|
700
|
+
row,
|
701
|
+
clsName,
|
702
|
+
i;
|
703
|
+
|
704
|
+
if (!hasDate()) {
|
705
|
+
return;
|
706
|
+
}
|
707
|
+
|
708
|
+
daysViewHeader.eq(0).find('span').attr('title', options.tooltips.prevMonth);
|
709
|
+
daysViewHeader.eq(1).attr('title', options.tooltips.selectMonth);
|
710
|
+
daysViewHeader.eq(2).find('span').attr('title', options.tooltips.nextMonth);
|
711
|
+
|
712
|
+
daysView.find('.disabled').removeClass('disabled');
|
713
|
+
daysViewHeader.eq(1).text(viewDate.format(options.dayViewHeaderFormat));
|
714
|
+
|
715
|
+
if (!isValid(viewDate.clone().subtract(1, 'M'), 'M')) {
|
716
|
+
daysViewHeader.eq(0).addClass('disabled');
|
717
|
+
}
|
718
|
+
if (!isValid(viewDate.clone().add(1, 'M'), 'M')) {
|
719
|
+
daysViewHeader.eq(2).addClass('disabled');
|
720
|
+
}
|
721
|
+
|
722
|
+
currentDate = viewDate.clone().startOf('M').startOf('w').startOf('d');
|
723
|
+
|
724
|
+
for (i = 0; i < 42; i++) { //always display 42 days (should show 6 weeks)
|
725
|
+
if (currentDate.weekday() === 0) {
|
726
|
+
row = $('<tr>');
|
727
|
+
if (options.calendarWeeks) {
|
728
|
+
row.append('<td class="cw">' + currentDate.week() + '</td>');
|
729
|
+
}
|
730
|
+
html.push(row);
|
731
|
+
}
|
732
|
+
clsName = '';
|
733
|
+
if (currentDate.isBefore(viewDate, 'M')) {
|
734
|
+
clsName += ' old';
|
735
|
+
}
|
736
|
+
if (currentDate.isAfter(viewDate, 'M')) {
|
737
|
+
clsName += ' new';
|
738
|
+
}
|
739
|
+
if (currentDate.isSame(date, 'd') && !unset) {
|
740
|
+
clsName += ' active';
|
741
|
+
}
|
742
|
+
if (!isValid(currentDate, 'd')) {
|
743
|
+
clsName += ' disabled';
|
744
|
+
}
|
745
|
+
if (currentDate.isSame(getMoment(), 'd')) {
|
746
|
+
clsName += ' today';
|
747
|
+
}
|
748
|
+
if (currentDate.day() === 0 || currentDate.day() === 6) {
|
749
|
+
clsName += ' weekend';
|
750
|
+
}
|
751
|
+
|
752
|
+
row.append('<td data-action="selectDay" data-day="' + currentDate.format('L') + '" class="day' + clsName + '"><div>' + currentDate.date() + '</div></td>');
|
753
|
+
currentDate.add(1, 'd');
|
754
|
+
}
|
755
|
+
|
756
|
+
daysView.find('tbody').empty().append(html);
|
757
|
+
|
758
|
+
updateMonths();
|
759
|
+
|
760
|
+
updateYears();
|
761
|
+
|
762
|
+
updateDecades();
|
763
|
+
},
|
764
|
+
|
765
|
+
fillHours = function () {
|
766
|
+
var table = widget.find('.timepicker-hours table'),
|
767
|
+
currentHour = viewDate.clone().startOf('d'),
|
768
|
+
html = [],
|
769
|
+
row = $('<tr>');
|
770
|
+
|
771
|
+
if (viewDate.hour() > 11 && !use24Hours) {
|
772
|
+
currentHour.hour(12);
|
773
|
+
}
|
774
|
+
while (currentHour.isSame(viewDate, 'd') && (use24Hours || (viewDate.hour() < 12 && currentHour.hour() < 12) || viewDate.hour() > 11)) {
|
775
|
+
if (currentHour.hour() % 4 === 0) {
|
776
|
+
row = $('<tr>');
|
777
|
+
html.push(row);
|
778
|
+
}
|
779
|
+
|
780
|
+
row.append('<td data-action="selectHour" class="hour' + (!isValid(currentHour, 'h') ? ' disabled' : '') + '"><div>' + currentHour.format(use24Hours ? 'HH' : 'hh') + '</div></td>');
|
781
|
+
currentHour.add(1, 'h');
|
782
|
+
}
|
783
|
+
table.empty().append(html);
|
784
|
+
},
|
785
|
+
|
786
|
+
fillMinutes = function () {
|
787
|
+
var table = widget.find('.timepicker-minutes table'),
|
788
|
+
currentMinute = viewDate.clone().startOf('h'),
|
789
|
+
html = [],
|
790
|
+
row = $('<tr>'),
|
791
|
+
step = options.stepping === 1 ? 5 : options.stepping;
|
792
|
+
|
793
|
+
while (viewDate.isSame(currentMinute, 'h')) {
|
794
|
+
if (currentMinute.minute() % (step * 4) === 0) {
|
795
|
+
row = $('<tr>');
|
796
|
+
html.push(row);
|
797
|
+
}
|
798
|
+
|
799
|
+
row.append('<td data-action="selectMinute" class="minute' + (!isValid(currentMinute, 'm') ? ' disabled' : '') + '"><div>' + currentMinute.format('mm') + '</div></td>');
|
800
|
+
currentMinute.add(step, 'm');
|
801
|
+
}
|
802
|
+
table.empty().append(html);
|
803
|
+
},
|
804
|
+
|
805
|
+
fillSeconds = function () {
|
806
|
+
var table = widget.find('.timepicker-seconds table'),
|
807
|
+
currentSecond = viewDate.clone().startOf('m'),
|
808
|
+
html = [],
|
809
|
+
row = $('<tr>');
|
810
|
+
|
811
|
+
while (viewDate.isSame(currentSecond, 'm')) {
|
812
|
+
if (currentSecond.second() % 20 === 0) {
|
813
|
+
row = $('<tr>');
|
814
|
+
html.push(row);
|
815
|
+
}
|
816
|
+
|
817
|
+
row.append('<td data-action="selectSecond" class="second' + (!isValid(currentSecond, 's') ? ' disabled' : '') + '"><div>' + currentSecond.format('ss') + '</div></td>');
|
818
|
+
currentSecond.add(5, 's');
|
819
|
+
}
|
820
|
+
|
821
|
+
table.empty().append(html);
|
822
|
+
},
|
823
|
+
|
824
|
+
fillTime = function () {
|
825
|
+
var toggle, newDate, timeComponents = widget.find('.timepicker span[data-time-component]');
|
826
|
+
|
827
|
+
if (!use24Hours) {
|
828
|
+
toggle = widget.find('.timepicker [data-action=togglePeriod]');
|
829
|
+
newDate = date.clone().add((date.hours() >= 12) ? -12 : 12, 'h');
|
830
|
+
|
831
|
+
toggle.text(date.format('A'));
|
832
|
+
|
833
|
+
if (isValid(newDate, 'h')) {
|
834
|
+
toggle.removeClass('disabled');
|
835
|
+
} else {
|
836
|
+
toggle.addClass('disabled');
|
837
|
+
}
|
838
|
+
}
|
839
|
+
timeComponents.filter('[data-time-component=hours]').text(date.format(use24Hours ? 'HH' : 'hh'));
|
840
|
+
timeComponents.filter('[data-time-component=minutes]').text(date.format('mm'));
|
841
|
+
timeComponents.filter('[data-time-component=seconds]').text(date.format('ss'));
|
842
|
+
|
843
|
+
fillHours();
|
844
|
+
fillMinutes();
|
845
|
+
fillSeconds();
|
846
|
+
},
|
847
|
+
|
848
|
+
update = function () {
|
849
|
+
if (!widget) {
|
850
|
+
return;
|
851
|
+
}
|
852
|
+
fillDate();
|
853
|
+
fillTime();
|
854
|
+
},
|
855
|
+
|
856
|
+
setValue = function (targetMoment) {
|
857
|
+
var oldDate = unset ? null : date;
|
858
|
+
|
859
|
+
// case of calling setValue(null or false)
|
860
|
+
if (!targetMoment) {
|
861
|
+
unset = true;
|
862
|
+
input.val('');
|
863
|
+
element.data('date', '');
|
864
|
+
notifyEvent({
|
865
|
+
type: 'dp.change',
|
866
|
+
date: false,
|
867
|
+
oldDate: oldDate
|
868
|
+
});
|
869
|
+
update();
|
870
|
+
return;
|
871
|
+
}
|
872
|
+
|
873
|
+
targetMoment = targetMoment.clone().locale(options.locale);
|
874
|
+
|
875
|
+
if (options.stepping !== 1) {
|
876
|
+
targetMoment.minutes((Math.round(targetMoment.minutes() / options.stepping) * options.stepping) % 60).seconds(0);
|
877
|
+
}
|
878
|
+
|
879
|
+
if (isValid(targetMoment)) {
|
880
|
+
date = targetMoment;
|
881
|
+
viewDate = date.clone();
|
882
|
+
input.val(date.format(actualFormat));
|
883
|
+
element.data('date', date.format(actualFormat));
|
884
|
+
unset = false;
|
885
|
+
update();
|
886
|
+
notifyEvent({
|
887
|
+
type: 'dp.change',
|
888
|
+
date: date.clone(),
|
889
|
+
oldDate: oldDate
|
890
|
+
});
|
891
|
+
} else {
|
892
|
+
if (!options.keepInvalid) {
|
893
|
+
input.val(unset ? '' : date.format(actualFormat));
|
894
|
+
}
|
895
|
+
notifyEvent({
|
896
|
+
type: 'dp.error',
|
897
|
+
date: targetMoment
|
898
|
+
});
|
899
|
+
}
|
900
|
+
},
|
901
|
+
|
902
|
+
hide = function () {
|
903
|
+
///<summary>Hides the widget. Possibly will emit dp.hide</summary>
|
904
|
+
var transitioning = false;
|
905
|
+
if (!widget) {
|
906
|
+
return picker;
|
907
|
+
}
|
908
|
+
// Ignore event if in the middle of a picker transition
|
909
|
+
widget.find('.collapse').each(function () {
|
910
|
+
var collapseData = $(this).data('collapse');
|
911
|
+
if (collapseData && collapseData.transitioning) {
|
912
|
+
transitioning = true;
|
913
|
+
return false;
|
914
|
+
}
|
915
|
+
return true;
|
916
|
+
});
|
917
|
+
if (transitioning) {
|
918
|
+
return picker;
|
919
|
+
}
|
920
|
+
if (component && component.hasClass('btn')) {
|
921
|
+
component.toggleClass('active');
|
922
|
+
}
|
923
|
+
|
924
|
+
|
925
|
+
$(window).off('resize', place);
|
926
|
+
widget.off('click', '[data-action]');
|
927
|
+
widget.off('mousedown', false);
|
928
|
+
|
929
|
+
widget.removeClass('open');
|
930
|
+
|
931
|
+
setTimeout(function(){
|
932
|
+
widget.hide();
|
933
|
+
|
934
|
+
widget.remove();
|
935
|
+
widget = false;
|
936
|
+
|
937
|
+
notifyEvent({
|
938
|
+
type: 'dp.hide',
|
939
|
+
date: date.clone()
|
940
|
+
});
|
941
|
+
|
942
|
+
input.blur();
|
943
|
+
|
944
|
+
return picker;
|
945
|
+
|
946
|
+
}, 400);
|
947
|
+
|
948
|
+
},
|
949
|
+
|
950
|
+
clear = function () {
|
951
|
+
setValue(null);
|
952
|
+
},
|
953
|
+
|
954
|
+
/********************************************************************************
|
955
|
+
*
|
956
|
+
* Widget UI interaction functions
|
957
|
+
*
|
958
|
+
********************************************************************************/
|
959
|
+
actions = {
|
960
|
+
next: function () {
|
961
|
+
var navFnc = datePickerModes[currentViewMode].navFnc;
|
962
|
+
viewDate.add(datePickerModes[currentViewMode].navStep, navFnc);
|
963
|
+
fillDate();
|
964
|
+
viewUpdate(navFnc);
|
965
|
+
},
|
966
|
+
|
967
|
+
previous: function () {
|
968
|
+
var navFnc = datePickerModes[currentViewMode].navFnc;
|
969
|
+
viewDate.subtract(datePickerModes[currentViewMode].navStep, navFnc);
|
970
|
+
fillDate();
|
971
|
+
viewUpdate(navFnc);
|
972
|
+
},
|
973
|
+
|
974
|
+
pickerSwitch: function () {
|
975
|
+
showMode(1);
|
976
|
+
},
|
977
|
+
|
978
|
+
selectMonth: function (e) {
|
979
|
+
var month = $(e.target).closest('tbody').find('span').index($(e.target));
|
980
|
+
viewDate.month(month);
|
981
|
+
if (currentViewMode === minViewModeNumber) {
|
982
|
+
setValue(date.clone().year(viewDate.year()).month(viewDate.month()));
|
983
|
+
if (!options.inline) {
|
984
|
+
hide();
|
985
|
+
}
|
986
|
+
} else {
|
987
|
+
showMode(-1);
|
988
|
+
fillDate();
|
989
|
+
}
|
990
|
+
viewUpdate('M');
|
991
|
+
},
|
992
|
+
|
993
|
+
selectYear: function (e) {
|
994
|
+
var year = parseInt($(e.target).text(), 10) || 0;
|
995
|
+
viewDate.year(year);
|
996
|
+
if (currentViewMode === minViewModeNumber) {
|
997
|
+
setValue(date.clone().year(viewDate.year()));
|
998
|
+
if (!options.inline) {
|
999
|
+
hide();
|
1000
|
+
}
|
1001
|
+
} else {
|
1002
|
+
showMode(-1);
|
1003
|
+
fillDate();
|
1004
|
+
}
|
1005
|
+
viewUpdate('YYYY');
|
1006
|
+
},
|
1007
|
+
|
1008
|
+
selectDecade: function (e) {
|
1009
|
+
var year = parseInt($(e.target).data('selection'), 10) || 0;
|
1010
|
+
viewDate.year(year);
|
1011
|
+
if (currentViewMode === minViewModeNumber) {
|
1012
|
+
setValue(date.clone().year(viewDate.year()));
|
1013
|
+
if (!options.inline) {
|
1014
|
+
hide();
|
1015
|
+
}
|
1016
|
+
} else {
|
1017
|
+
showMode(-1);
|
1018
|
+
fillDate();
|
1019
|
+
}
|
1020
|
+
viewUpdate('YYYY');
|
1021
|
+
},
|
1022
|
+
|
1023
|
+
selectDay: function (e) {
|
1024
|
+
var day = viewDate.clone();
|
1025
|
+
if ($(e.target).is('.old')) {
|
1026
|
+
day.subtract(1, 'M');
|
1027
|
+
}
|
1028
|
+
if ($(e.target).is('.new')) {
|
1029
|
+
day.add(1, 'M');
|
1030
|
+
}
|
1031
|
+
setValue(day.date(parseInt($(e.target).text(), 10)));
|
1032
|
+
if (!hasTime() && !options.keepOpen && !options.inline) {
|
1033
|
+
hide();
|
1034
|
+
}
|
1035
|
+
},
|
1036
|
+
|
1037
|
+
incrementHours: function () {
|
1038
|
+
var newDate = date.clone().add(1, 'h');
|
1039
|
+
if (isValid(newDate, 'h')) {
|
1040
|
+
setValue(newDate);
|
1041
|
+
}
|
1042
|
+
},
|
1043
|
+
|
1044
|
+
incrementMinutes: function () {
|
1045
|
+
var newDate = date.clone().add(options.stepping, 'm');
|
1046
|
+
if (isValid(newDate, 'm')) {
|
1047
|
+
setValue(newDate);
|
1048
|
+
}
|
1049
|
+
},
|
1050
|
+
|
1051
|
+
incrementSeconds: function () {
|
1052
|
+
var newDate = date.clone().add(1, 's');
|
1053
|
+
if (isValid(newDate, 's')) {
|
1054
|
+
setValue(newDate);
|
1055
|
+
}
|
1056
|
+
},
|
1057
|
+
|
1058
|
+
decrementHours: function () {
|
1059
|
+
var newDate = date.clone().subtract(1, 'h');
|
1060
|
+
if (isValid(newDate, 'h')) {
|
1061
|
+
setValue(newDate);
|
1062
|
+
}
|
1063
|
+
},
|
1064
|
+
|
1065
|
+
decrementMinutes: function () {
|
1066
|
+
var newDate = date.clone().subtract(options.stepping, 'm');
|
1067
|
+
if (isValid(newDate, 'm')) {
|
1068
|
+
setValue(newDate);
|
1069
|
+
}
|
1070
|
+
},
|
1071
|
+
|
1072
|
+
decrementSeconds: function () {
|
1073
|
+
var newDate = date.clone().subtract(1, 's');
|
1074
|
+
if (isValid(newDate, 's')) {
|
1075
|
+
setValue(newDate);
|
1076
|
+
}
|
1077
|
+
},
|
1078
|
+
|
1079
|
+
togglePeriod: function () {
|
1080
|
+
setValue(date.clone().add((date.hours() >= 12) ? -12 : 12, 'h'));
|
1081
|
+
},
|
1082
|
+
|
1083
|
+
togglePicker: function (e) {
|
1084
|
+
var $this = $(e.target),
|
1085
|
+
$parent = $this.closest('ul'),
|
1086
|
+
expanded = $parent.find('.in'),
|
1087
|
+
closed = $parent.find('.collapse:not(.in)'),
|
1088
|
+
collapseData;
|
1089
|
+
|
1090
|
+
if (expanded && expanded.length) {
|
1091
|
+
collapseData = expanded.data('collapse');
|
1092
|
+
if (collapseData && collapseData.transitioning) {
|
1093
|
+
return;
|
1094
|
+
}
|
1095
|
+
if (expanded.collapse) { // if collapse plugin is available through bootstrap.js then use it
|
1096
|
+
expanded.collapse('hide');
|
1097
|
+
closed.collapse('show');
|
1098
|
+
} else { // otherwise just toggle in class on the two views
|
1099
|
+
expanded.removeClass('in');
|
1100
|
+
closed.addClass('in');
|
1101
|
+
}
|
1102
|
+
if ($this.is('span')) {
|
1103
|
+
$this.toggleClass(options.icons.time + ' ' + options.icons.date);
|
1104
|
+
} else {
|
1105
|
+
$this.find('span').toggleClass(options.icons.time + ' ' + options.icons.date);
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
// NOTE: uncomment if toggled state will be restored in show()
|
1109
|
+
//if (component) {
|
1110
|
+
// component.find('span').toggleClass(options.icons.time + ' ' + options.icons.date);
|
1111
|
+
//}
|
1112
|
+
}
|
1113
|
+
},
|
1114
|
+
|
1115
|
+
showPicker: function () {
|
1116
|
+
widget.find('.timepicker > div:not(.timepicker-picker)').hide();
|
1117
|
+
widget.find('.timepicker .timepicker-picker').show();
|
1118
|
+
},
|
1119
|
+
|
1120
|
+
showHours: function () {
|
1121
|
+
widget.find('.timepicker .timepicker-picker').hide();
|
1122
|
+
widget.find('.timepicker .timepicker-hours').show();
|
1123
|
+
},
|
1124
|
+
|
1125
|
+
showMinutes: function () {
|
1126
|
+
widget.find('.timepicker .timepicker-picker').hide();
|
1127
|
+
widget.find('.timepicker .timepicker-minutes').show();
|
1128
|
+
},
|
1129
|
+
|
1130
|
+
showSeconds: function () {
|
1131
|
+
widget.find('.timepicker .timepicker-picker').hide();
|
1132
|
+
widget.find('.timepicker .timepicker-seconds').show();
|
1133
|
+
},
|
1134
|
+
|
1135
|
+
selectHour: function (e) {
|
1136
|
+
var hour = parseInt($(e.target).text(), 10);
|
1137
|
+
|
1138
|
+
if (!use24Hours) {
|
1139
|
+
if (date.hours() >= 12) {
|
1140
|
+
if (hour !== 12) {
|
1141
|
+
hour += 12;
|
1142
|
+
}
|
1143
|
+
} else {
|
1144
|
+
if (hour === 12) {
|
1145
|
+
hour = 0;
|
1146
|
+
}
|
1147
|
+
}
|
1148
|
+
}
|
1149
|
+
setValue(date.clone().hours(hour));
|
1150
|
+
actions.showPicker.call(picker);
|
1151
|
+
},
|
1152
|
+
|
1153
|
+
selectMinute: function (e) {
|
1154
|
+
setValue(date.clone().minutes(parseInt($(e.target).text(), 10)));
|
1155
|
+
actions.showPicker.call(picker);
|
1156
|
+
},
|
1157
|
+
|
1158
|
+
selectSecond: function (e) {
|
1159
|
+
setValue(date.clone().seconds(parseInt($(e.target).text(), 10)));
|
1160
|
+
actions.showPicker.call(picker);
|
1161
|
+
},
|
1162
|
+
|
1163
|
+
clear: clear,
|
1164
|
+
|
1165
|
+
today: function () {
|
1166
|
+
var todaysDate = getMoment();
|
1167
|
+
if (isValid(todaysDate, 'd')) {
|
1168
|
+
setValue(todaysDate);
|
1169
|
+
}
|
1170
|
+
},
|
1171
|
+
|
1172
|
+
close: hide
|
1173
|
+
},
|
1174
|
+
|
1175
|
+
doAction = function (e) {
|
1176
|
+
if ($(e.currentTarget).is('.disabled')) {
|
1177
|
+
return false;
|
1178
|
+
}
|
1179
|
+
actions[$(e.currentTarget).data('action')].apply(picker, arguments);
|
1180
|
+
return false;
|
1181
|
+
},
|
1182
|
+
|
1183
|
+
show = function () {
|
1184
|
+
///<summary>Shows the widget. Possibly will emit dp.show and dp.change</summary>
|
1185
|
+
var currentMoment,
|
1186
|
+
useCurrentGranularity = {
|
1187
|
+
'year': function (m) {
|
1188
|
+
return m.month(0).date(1).hours(0).seconds(0).minutes(0);
|
1189
|
+
},
|
1190
|
+
'month': function (m) {
|
1191
|
+
return m.date(1).hours(0).seconds(0).minutes(0);
|
1192
|
+
},
|
1193
|
+
'day': function (m) {
|
1194
|
+
return m.hours(0).seconds(0).minutes(0);
|
1195
|
+
},
|
1196
|
+
'hour': function (m) {
|
1197
|
+
return m.seconds(0).minutes(0);
|
1198
|
+
},
|
1199
|
+
'minute': function (m) {
|
1200
|
+
return m.seconds(0);
|
1201
|
+
}
|
1202
|
+
};
|
1203
|
+
|
1204
|
+
if (input.prop('disabled') || (!options.ignoreReadonly && input.prop('readonly')) || widget) {
|
1205
|
+
return picker;
|
1206
|
+
}
|
1207
|
+
if (input.val() !== undefined && input.val().trim().length !== 0) {
|
1208
|
+
setValue(parseInputDate(input.val().trim()));
|
1209
|
+
} else if (options.useCurrent && unset && ((input.is('input') && input.val().trim().length === 0) || options.inline)) {
|
1210
|
+
currentMoment = getMoment();
|
1211
|
+
if (typeof options.useCurrent === 'string') {
|
1212
|
+
currentMoment = useCurrentGranularity[options.useCurrent](currentMoment);
|
1213
|
+
}
|
1214
|
+
setValue(currentMoment);
|
1215
|
+
}
|
1216
|
+
|
1217
|
+
widget = getTemplate();
|
1218
|
+
|
1219
|
+
fillDow();
|
1220
|
+
fillMonths();
|
1221
|
+
|
1222
|
+
widget.find('.timepicker-hours').hide();
|
1223
|
+
widget.find('.timepicker-minutes').hide();
|
1224
|
+
widget.find('.timepicker-seconds').hide();
|
1225
|
+
|
1226
|
+
update();
|
1227
|
+
showMode();
|
1228
|
+
|
1229
|
+
$(window).on('resize', place);
|
1230
|
+
widget.on('click', '[data-action]', doAction); // this handles clicks on the widget
|
1231
|
+
widget.on('mousedown', false);
|
1232
|
+
|
1233
|
+
if (component && component.hasClass('btn')) {
|
1234
|
+
component.toggleClass('active');
|
1235
|
+
}
|
1236
|
+
widget.show();
|
1237
|
+
|
1238
|
+
place();
|
1239
|
+
|
1240
|
+
|
1241
|
+
if (options.focusOnShow && !input.is(':focus')) {
|
1242
|
+
input.focus();
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
notifyEvent({
|
1246
|
+
type: 'dp.show'
|
1247
|
+
});
|
1248
|
+
return picker;
|
1249
|
+
},
|
1250
|
+
|
1251
|
+
toggle = function () {
|
1252
|
+
/// <summary>Shows or hides the widget</summary>
|
1253
|
+
return (widget ? hide() : show());
|
1254
|
+
},
|
1255
|
+
|
1256
|
+
parseInputDate = function (inputDate) {
|
1257
|
+
if (options.parseInputDate === undefined) {
|
1258
|
+
if (moment.isMoment(inputDate) || inputDate instanceof Date) {
|
1259
|
+
inputDate = moment(inputDate);
|
1260
|
+
} else {
|
1261
|
+
inputDate = getMoment(inputDate);
|
1262
|
+
}
|
1263
|
+
} else {
|
1264
|
+
inputDate = options.parseInputDate(inputDate);
|
1265
|
+
}
|
1266
|
+
inputDate.locale(options.locale);
|
1267
|
+
return inputDate;
|
1268
|
+
},
|
1269
|
+
|
1270
|
+
keydown = function (e) {
|
1271
|
+
var handler = null,
|
1272
|
+
index,
|
1273
|
+
index2,
|
1274
|
+
pressedKeys = [],
|
1275
|
+
pressedModifiers = {},
|
1276
|
+
currentKey = e.which,
|
1277
|
+
keyBindKeys,
|
1278
|
+
allModifiersPressed,
|
1279
|
+
pressed = 'p';
|
1280
|
+
|
1281
|
+
keyState[currentKey] = pressed;
|
1282
|
+
|
1283
|
+
for (index in keyState) {
|
1284
|
+
if (keyState.hasOwnProperty(index) && keyState[index] === pressed) {
|
1285
|
+
pressedKeys.push(index);
|
1286
|
+
if (parseInt(index, 10) !== currentKey) {
|
1287
|
+
pressedModifiers[index] = true;
|
1288
|
+
}
|
1289
|
+
}
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
for (index in options.keyBinds) {
|
1293
|
+
if (options.keyBinds.hasOwnProperty(index) && typeof (options.keyBinds[index]) === 'function') {
|
1294
|
+
keyBindKeys = index.split(' ');
|
1295
|
+
if (keyBindKeys.length === pressedKeys.length && keyMap[currentKey] === keyBindKeys[keyBindKeys.length - 1]) {
|
1296
|
+
allModifiersPressed = true;
|
1297
|
+
for (index2 = keyBindKeys.length - 2; index2 >= 0; index2--) {
|
1298
|
+
if (!(keyMap[keyBindKeys[index2]] in pressedModifiers)) {
|
1299
|
+
allModifiersPressed = false;
|
1300
|
+
break;
|
1301
|
+
}
|
1302
|
+
}
|
1303
|
+
if (allModifiersPressed) {
|
1304
|
+
handler = options.keyBinds[index];
|
1305
|
+
break;
|
1306
|
+
}
|
1307
|
+
}
|
1308
|
+
}
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
if (handler) {
|
1312
|
+
handler.call(picker, widget);
|
1313
|
+
e.stopPropagation();
|
1314
|
+
e.preventDefault();
|
1315
|
+
}
|
1316
|
+
},
|
1317
|
+
|
1318
|
+
keyup = function (e) {
|
1319
|
+
keyState[e.which] = 'r';
|
1320
|
+
e.stopPropagation();
|
1321
|
+
e.preventDefault();
|
1322
|
+
},
|
1323
|
+
|
1324
|
+
change = function (e) {
|
1325
|
+
var val = $(e.target).val().trim(),
|
1326
|
+
parsedDate = val ? parseInputDate(val) : null;
|
1327
|
+
setValue(parsedDate);
|
1328
|
+
e.stopImmediatePropagation();
|
1329
|
+
return false;
|
1330
|
+
},
|
1331
|
+
|
1332
|
+
attachDatePickerElementEvents = function () {
|
1333
|
+
input.on({
|
1334
|
+
'change': change,
|
1335
|
+
'blur': options.debug ? '' : hide,
|
1336
|
+
'keydown': keydown,
|
1337
|
+
'keyup': keyup,
|
1338
|
+
'focus': options.allowInputToggle ? show : ''
|
1339
|
+
});
|
1340
|
+
|
1341
|
+
if (element.is('input')) {
|
1342
|
+
input.on({
|
1343
|
+
'focus': show
|
1344
|
+
});
|
1345
|
+
} else if (component) {
|
1346
|
+
component.on('click', toggle);
|
1347
|
+
component.on('mousedown', false);
|
1348
|
+
}
|
1349
|
+
},
|
1350
|
+
|
1351
|
+
detachDatePickerElementEvents = function () {
|
1352
|
+
input.off({
|
1353
|
+
'change': change,
|
1354
|
+
'blur': blur,
|
1355
|
+
'keydown': keydown,
|
1356
|
+
'keyup': keyup,
|
1357
|
+
'focus': options.allowInputToggle ? hide : ''
|
1358
|
+
});
|
1359
|
+
|
1360
|
+
if (element.is('input')) {
|
1361
|
+
input.off({
|
1362
|
+
'focus': show
|
1363
|
+
});
|
1364
|
+
} else if (component) {
|
1365
|
+
component.off('click', toggle);
|
1366
|
+
component.off('mousedown', false);
|
1367
|
+
}
|
1368
|
+
},
|
1369
|
+
|
1370
|
+
indexGivenDates = function (givenDatesArray) {
|
1371
|
+
// Store given enabledDates and disabledDates as keys.
|
1372
|
+
// This way we can check their existence in O(1) time instead of looping through whole array.
|
1373
|
+
// (for example: options.enabledDates['2014-02-27'] === true)
|
1374
|
+
var givenDatesIndexed = {};
|
1375
|
+
$.each(givenDatesArray, function () {
|
1376
|
+
var dDate = parseInputDate(this);
|
1377
|
+
if (dDate.isValid()) {
|
1378
|
+
givenDatesIndexed[dDate.format('YYYY-MM-DD')] = true;
|
1379
|
+
}
|
1380
|
+
});
|
1381
|
+
return (Object.keys(givenDatesIndexed).length) ? givenDatesIndexed : false;
|
1382
|
+
},
|
1383
|
+
|
1384
|
+
indexGivenHours = function (givenHoursArray) {
|
1385
|
+
// Store given enabledHours and disabledHours as keys.
|
1386
|
+
// This way we can check their existence in O(1) time instead of looping through whole array.
|
1387
|
+
// (for example: options.enabledHours['2014-02-27'] === true)
|
1388
|
+
var givenHoursIndexed = {};
|
1389
|
+
$.each(givenHoursArray, function () {
|
1390
|
+
givenHoursIndexed[this] = true;
|
1391
|
+
});
|
1392
|
+
return (Object.keys(givenHoursIndexed).length) ? givenHoursIndexed : false;
|
1393
|
+
},
|
1394
|
+
|
1395
|
+
initFormatting = function () {
|
1396
|
+
var format = options.format || 'L LT';
|
1397
|
+
|
1398
|
+
actualFormat = format.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) {
|
1399
|
+
var newinput = date.localeData().longDateFormat(formatInput) || formatInput;
|
1400
|
+
return newinput.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput2) { //temp fix for #740
|
1401
|
+
return date.localeData().longDateFormat(formatInput2) || formatInput2;
|
1402
|
+
});
|
1403
|
+
});
|
1404
|
+
|
1405
|
+
|
1406
|
+
parseFormats = options.extraFormats ? options.extraFormats.slice() : [];
|
1407
|
+
if (parseFormats.indexOf(format) < 0 && parseFormats.indexOf(actualFormat) < 0) {
|
1408
|
+
parseFormats.push(actualFormat);
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
use24Hours = (actualFormat.toLowerCase().indexOf('a') < 1 && actualFormat.replace(/\[.*?\]/g, '').indexOf('h') < 1);
|
1412
|
+
|
1413
|
+
if (isEnabled('y')) {
|
1414
|
+
minViewModeNumber = 2;
|
1415
|
+
}
|
1416
|
+
if (isEnabled('M')) {
|
1417
|
+
minViewModeNumber = 1;
|
1418
|
+
}
|
1419
|
+
if (isEnabled('d')) {
|
1420
|
+
minViewModeNumber = 0;
|
1421
|
+
}
|
1422
|
+
|
1423
|
+
currentViewMode = Math.max(minViewModeNumber, currentViewMode);
|
1424
|
+
|
1425
|
+
if (!unset) {
|
1426
|
+
setValue(date);
|
1427
|
+
}
|
1428
|
+
};
|
1429
|
+
|
1430
|
+
/********************************************************************************
|
1431
|
+
*
|
1432
|
+
* Public API functions
|
1433
|
+
* =====================
|
1434
|
+
*
|
1435
|
+
* Important: Do not expose direct references to private objects or the options
|
1436
|
+
* object to the outer world. Always return a clone when returning values or make
|
1437
|
+
* a clone when setting a private variable.
|
1438
|
+
*
|
1439
|
+
********************************************************************************/
|
1440
|
+
picker.destroy = function () {
|
1441
|
+
///<summary>Destroys the widget and removes all attached event listeners</summary>
|
1442
|
+
hide();
|
1443
|
+
detachDatePickerElementEvents();
|
1444
|
+
element.removeData('DateTimePicker');
|
1445
|
+
element.removeData('date');
|
1446
|
+
};
|
1447
|
+
|
1448
|
+
picker.toggle = toggle;
|
1449
|
+
|
1450
|
+
picker.show = show;
|
1451
|
+
|
1452
|
+
picker.hide = hide;
|
1453
|
+
|
1454
|
+
picker.disable = function () {
|
1455
|
+
///<summary>Disables the input element, the component is attached to, by adding a disabled="true" attribute to it.
|
1456
|
+
///If the widget was visible before that call it is hidden. Possibly emits dp.hide</summary>
|
1457
|
+
hide();
|
1458
|
+
if (component && component.hasClass('btn')) {
|
1459
|
+
component.addClass('disabled');
|
1460
|
+
}
|
1461
|
+
input.prop('disabled', true);
|
1462
|
+
return picker;
|
1463
|
+
};
|
1464
|
+
|
1465
|
+
picker.enable = function () {
|
1466
|
+
///<summary>Enables the input element, the component is attached to, by removing disabled attribute from it.</summary>
|
1467
|
+
if (component && component.hasClass('btn')) {
|
1468
|
+
component.removeClass('disabled');
|
1469
|
+
}
|
1470
|
+
input.prop('disabled', false);
|
1471
|
+
return picker;
|
1472
|
+
};
|
1473
|
+
|
1474
|
+
picker.ignoreReadonly = function (ignoreReadonly) {
|
1475
|
+
if (arguments.length === 0) {
|
1476
|
+
return options.ignoreReadonly;
|
1477
|
+
}
|
1478
|
+
if (typeof ignoreReadonly !== 'boolean') {
|
1479
|
+
throw new TypeError('ignoreReadonly () expects a boolean parameter');
|
1480
|
+
}
|
1481
|
+
options.ignoreReadonly = ignoreReadonly;
|
1482
|
+
return picker;
|
1483
|
+
};
|
1484
|
+
|
1485
|
+
picker.options = function (newOptions) {
|
1486
|
+
if (arguments.length === 0) {
|
1487
|
+
return $.extend(true, {}, options);
|
1488
|
+
}
|
1489
|
+
|
1490
|
+
if (!(newOptions instanceof Object)) {
|
1491
|
+
throw new TypeError('options() options parameter should be an object');
|
1492
|
+
}
|
1493
|
+
$.extend(true, options, newOptions);
|
1494
|
+
$.each(options, function (key, value) {
|
1495
|
+
if (picker[key] !== undefined) {
|
1496
|
+
picker[key](value);
|
1497
|
+
} else {
|
1498
|
+
throw new TypeError('option ' + key + ' is not recognized!');
|
1499
|
+
}
|
1500
|
+
});
|
1501
|
+
return picker;
|
1502
|
+
};
|
1503
|
+
|
1504
|
+
picker.date = function (newDate) {
|
1505
|
+
///<signature helpKeyword="$.fn.datetimepicker.date">
|
1506
|
+
///<summary>Returns the component's model current date, a moment object or null if not set.</summary>
|
1507
|
+
///<returns type="Moment">date.clone()</returns>
|
1508
|
+
///</signature>
|
1509
|
+
///<signature>
|
1510
|
+
///<summary>Sets the components model current moment to it. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.</summary>
|
1511
|
+
///<param name="newDate" locid="$.fn.datetimepicker.date_p:newDate">Takes string, Date, moment, null parameter.</param>
|
1512
|
+
///</signature>
|
1513
|
+
if (arguments.length === 0) {
|
1514
|
+
if (unset) {
|
1515
|
+
return null;
|
1516
|
+
}
|
1517
|
+
return date.clone();
|
1518
|
+
}
|
1519
|
+
|
1520
|
+
if (newDate !== null && typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) {
|
1521
|
+
throw new TypeError('date() parameter must be one of [null, string, moment or Date]');
|
1522
|
+
}
|
1523
|
+
|
1524
|
+
setValue(newDate === null ? null : parseInputDate(newDate));
|
1525
|
+
return picker;
|
1526
|
+
};
|
1527
|
+
|
1528
|
+
picker.format = function (newFormat) {
|
1529
|
+
///<summary>test su</summary>
|
1530
|
+
///<param name="newFormat">info about para</param>
|
1531
|
+
///<returns type="string|boolean">returns foo</returns>
|
1532
|
+
if (arguments.length === 0) {
|
1533
|
+
return options.format;
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
if ((typeof newFormat !== 'string') && ((typeof newFormat !== 'boolean') || (newFormat !== false))) {
|
1537
|
+
throw new TypeError('format() expects a sting or boolean:false parameter ' + newFormat);
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
options.format = newFormat;
|
1541
|
+
if (actualFormat) {
|
1542
|
+
initFormatting(); // reinit formatting
|
1543
|
+
}
|
1544
|
+
return picker;
|
1545
|
+
};
|
1546
|
+
|
1547
|
+
picker.timeZone = function (newZone) {
|
1548
|
+
if (arguments.length === 0) {
|
1549
|
+
return options.timeZone;
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
options.timeZone = newZone;
|
1553
|
+
|
1554
|
+
return picker;
|
1555
|
+
};
|
1556
|
+
|
1557
|
+
picker.dayViewHeaderFormat = function (newFormat) {
|
1558
|
+
if (arguments.length === 0) {
|
1559
|
+
return options.dayViewHeaderFormat;
|
1560
|
+
}
|
1561
|
+
|
1562
|
+
if (typeof newFormat !== 'string') {
|
1563
|
+
throw new TypeError('dayViewHeaderFormat() expects a string parameter');
|
1564
|
+
}
|
1565
|
+
|
1566
|
+
options.dayViewHeaderFormat = newFormat;
|
1567
|
+
return picker;
|
1568
|
+
};
|
1569
|
+
|
1570
|
+
picker.extraFormats = function (formats) {
|
1571
|
+
if (arguments.length === 0) {
|
1572
|
+
return options.extraFormats;
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
if (formats !== false && !(formats instanceof Array)) {
|
1576
|
+
throw new TypeError('extraFormats() expects an array or false parameter');
|
1577
|
+
}
|
1578
|
+
|
1579
|
+
options.extraFormats = formats;
|
1580
|
+
if (parseFormats) {
|
1581
|
+
initFormatting(); // reinit formatting
|
1582
|
+
}
|
1583
|
+
return picker;
|
1584
|
+
};
|
1585
|
+
|
1586
|
+
picker.disabledDates = function (dates) {
|
1587
|
+
///<signature helpKeyword="$.fn.datetimepicker.disabledDates">
|
1588
|
+
///<summary>Returns an array with the currently set disabled dates on the component.</summary>
|
1589
|
+
///<returns type="array">options.disabledDates</returns>
|
1590
|
+
///</signature>
|
1591
|
+
///<signature>
|
1592
|
+
///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
|
1593
|
+
///options.enabledDates if such exist.</summary>
|
1594
|
+
///<param name="dates" locid="$.fn.datetimepicker.disabledDates_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
|
1595
|
+
///</signature>
|
1596
|
+
if (arguments.length === 0) {
|
1597
|
+
return (options.disabledDates ? $.extend({}, options.disabledDates) : options.disabledDates);
|
1598
|
+
}
|
1599
|
+
|
1600
|
+
if (!dates) {
|
1601
|
+
options.disabledDates = false;
|
1602
|
+
update();
|
1603
|
+
return picker;
|
1604
|
+
}
|
1605
|
+
if (!(dates instanceof Array)) {
|
1606
|
+
throw new TypeError('disabledDates() expects an array parameter');
|
1607
|
+
}
|
1608
|
+
options.disabledDates = indexGivenDates(dates);
|
1609
|
+
options.enabledDates = false;
|
1610
|
+
update();
|
1611
|
+
return picker;
|
1612
|
+
};
|
1613
|
+
|
1614
|
+
picker.enabledDates = function (dates) {
|
1615
|
+
///<signature helpKeyword="$.fn.datetimepicker.enabledDates">
|
1616
|
+
///<summary>Returns an array with the currently set enabled dates on the component.</summary>
|
1617
|
+
///<returns type="array">options.enabledDates</returns>
|
1618
|
+
///</signature>
|
1619
|
+
///<signature>
|
1620
|
+
///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledDates if such exist.</summary>
|
1621
|
+
///<param name="dates" locid="$.fn.datetimepicker.enabledDates_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
|
1622
|
+
///</signature>
|
1623
|
+
if (arguments.length === 0) {
|
1624
|
+
return (options.enabledDates ? $.extend({}, options.enabledDates) : options.enabledDates);
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
if (!dates) {
|
1628
|
+
options.enabledDates = false;
|
1629
|
+
update();
|
1630
|
+
return picker;
|
1631
|
+
}
|
1632
|
+
if (!(dates instanceof Array)) {
|
1633
|
+
throw new TypeError('enabledDates() expects an array parameter');
|
1634
|
+
}
|
1635
|
+
options.enabledDates = indexGivenDates(dates);
|
1636
|
+
options.disabledDates = false;
|
1637
|
+
update();
|
1638
|
+
return picker;
|
1639
|
+
};
|
1640
|
+
|
1641
|
+
picker.daysOfWeekDisabled = function (daysOfWeekDisabled) {
|
1642
|
+
if (arguments.length === 0) {
|
1643
|
+
return options.daysOfWeekDisabled.splice(0);
|
1644
|
+
}
|
1645
|
+
|
1646
|
+
if ((typeof daysOfWeekDisabled === 'boolean') && !daysOfWeekDisabled) {
|
1647
|
+
options.daysOfWeekDisabled = false;
|
1648
|
+
update();
|
1649
|
+
return picker;
|
1650
|
+
}
|
1651
|
+
|
1652
|
+
if (!(daysOfWeekDisabled instanceof Array)) {
|
1653
|
+
throw new TypeError('daysOfWeekDisabled() expects an array parameter');
|
1654
|
+
}
|
1655
|
+
options.daysOfWeekDisabled = daysOfWeekDisabled.reduce(function (previousValue, currentValue) {
|
1656
|
+
currentValue = parseInt(currentValue, 10);
|
1657
|
+
if (currentValue > 6 || currentValue < 0 || isNaN(currentValue)) {
|
1658
|
+
return previousValue;
|
1659
|
+
}
|
1660
|
+
if (previousValue.indexOf(currentValue) === -1) {
|
1661
|
+
previousValue.push(currentValue);
|
1662
|
+
}
|
1663
|
+
return previousValue;
|
1664
|
+
}, []).sort();
|
1665
|
+
if (options.useCurrent && !options.keepInvalid) {
|
1666
|
+
var tries = 0;
|
1667
|
+
while (!isValid(date, 'd')) {
|
1668
|
+
date.add(1, 'd');
|
1669
|
+
if (tries === 7) {
|
1670
|
+
throw 'Tried 7 times to find a valid date';
|
1671
|
+
}
|
1672
|
+
tries++;
|
1673
|
+
}
|
1674
|
+
setValue(date);
|
1675
|
+
}
|
1676
|
+
update();
|
1677
|
+
return picker;
|
1678
|
+
};
|
1679
|
+
|
1680
|
+
picker.maxDate = function (maxDate) {
|
1681
|
+
if (arguments.length === 0) {
|
1682
|
+
return options.maxDate ? options.maxDate.clone() : options.maxDate;
|
1683
|
+
}
|
1684
|
+
|
1685
|
+
if ((typeof maxDate === 'boolean') && maxDate === false) {
|
1686
|
+
options.maxDate = false;
|
1687
|
+
update();
|
1688
|
+
return picker;
|
1689
|
+
}
|
1690
|
+
|
1691
|
+
if (typeof maxDate === 'string') {
|
1692
|
+
if (maxDate === 'now' || maxDate === 'moment') {
|
1693
|
+
maxDate = getMoment();
|
1694
|
+
}
|
1695
|
+
}
|
1696
|
+
|
1697
|
+
var parsedDate = parseInputDate(maxDate);
|
1698
|
+
|
1699
|
+
if (!parsedDate.isValid()) {
|
1700
|
+
throw new TypeError('maxDate() Could not parse date parameter: ' + maxDate);
|
1701
|
+
}
|
1702
|
+
if (options.minDate && parsedDate.isBefore(options.minDate)) {
|
1703
|
+
throw new TypeError('maxDate() date parameter is before options.minDate: ' + parsedDate.format(actualFormat));
|
1704
|
+
}
|
1705
|
+
options.maxDate = parsedDate;
|
1706
|
+
if (options.useCurrent && !options.keepInvalid && date.isAfter(maxDate)) {
|
1707
|
+
setValue(options.maxDate);
|
1708
|
+
}
|
1709
|
+
if (viewDate.isAfter(parsedDate)) {
|
1710
|
+
viewDate = parsedDate.clone().subtract(options.stepping, 'm');
|
1711
|
+
}
|
1712
|
+
update();
|
1713
|
+
return picker;
|
1714
|
+
};
|
1715
|
+
|
1716
|
+
picker.minDate = function (minDate) {
|
1717
|
+
if (arguments.length === 0) {
|
1718
|
+
return options.minDate ? options.minDate.clone() : options.minDate;
|
1719
|
+
}
|
1720
|
+
|
1721
|
+
if ((typeof minDate === 'boolean') && minDate === false) {
|
1722
|
+
options.minDate = false;
|
1723
|
+
update();
|
1724
|
+
return picker;
|
1725
|
+
}
|
1726
|
+
|
1727
|
+
if (typeof minDate === 'string') {
|
1728
|
+
if (minDate === 'now' || minDate === 'moment') {
|
1729
|
+
minDate = getMoment();
|
1730
|
+
}
|
1731
|
+
}
|
1732
|
+
|
1733
|
+
var parsedDate = parseInputDate(minDate);
|
1734
|
+
|
1735
|
+
if (!parsedDate.isValid()) {
|
1736
|
+
throw new TypeError('minDate() Could not parse date parameter: ' + minDate);
|
1737
|
+
}
|
1738
|
+
if (options.maxDate && parsedDate.isAfter(options.maxDate)) {
|
1739
|
+
throw new TypeError('minDate() date parameter is after options.maxDate: ' + parsedDate.format(actualFormat));
|
1740
|
+
}
|
1741
|
+
options.minDate = parsedDate;
|
1742
|
+
if (options.useCurrent && !options.keepInvalid && date.isBefore(minDate)) {
|
1743
|
+
setValue(options.minDate);
|
1744
|
+
}
|
1745
|
+
if (viewDate.isBefore(parsedDate)) {
|
1746
|
+
viewDate = parsedDate.clone().add(options.stepping, 'm');
|
1747
|
+
}
|
1748
|
+
update();
|
1749
|
+
return picker;
|
1750
|
+
};
|
1751
|
+
|
1752
|
+
picker.defaultDate = function (defaultDate) {
|
1753
|
+
///<signature helpKeyword="$.fn.datetimepicker.defaultDate">
|
1754
|
+
///<summary>Returns a moment with the options.defaultDate option configuration or false if not set</summary>
|
1755
|
+
///<returns type="Moment">date.clone()</returns>
|
1756
|
+
///</signature>
|
1757
|
+
///<signature>
|
1758
|
+
///<summary>Will set the picker's inital date. If a boolean:false value is passed the options.defaultDate parameter is cleared.</summary>
|
1759
|
+
///<param name="defaultDate" locid="$.fn.datetimepicker.defaultDate_p:defaultDate">Takes a string, Date, moment, boolean:false</param>
|
1760
|
+
///</signature>
|
1761
|
+
if (arguments.length === 0) {
|
1762
|
+
return options.defaultDate ? options.defaultDate.clone() : options.defaultDate;
|
1763
|
+
}
|
1764
|
+
if (!defaultDate) {
|
1765
|
+
options.defaultDate = false;
|
1766
|
+
return picker;
|
1767
|
+
}
|
1768
|
+
|
1769
|
+
if (typeof defaultDate === 'string') {
|
1770
|
+
if (defaultDate === 'now' || defaultDate === 'moment') {
|
1771
|
+
defaultDate = getMoment();
|
1772
|
+
}
|
1773
|
+
}
|
1774
|
+
|
1775
|
+
var parsedDate = parseInputDate(defaultDate);
|
1776
|
+
if (!parsedDate.isValid()) {
|
1777
|
+
throw new TypeError('defaultDate() Could not parse date parameter: ' + defaultDate);
|
1778
|
+
}
|
1779
|
+
if (!isValid(parsedDate)) {
|
1780
|
+
throw new TypeError('defaultDate() date passed is invalid according to component setup validations');
|
1781
|
+
}
|
1782
|
+
|
1783
|
+
options.defaultDate = parsedDate;
|
1784
|
+
|
1785
|
+
if ((options.defaultDate && options.inline) || input.val().trim() === '') {
|
1786
|
+
setValue(options.defaultDate);
|
1787
|
+
}
|
1788
|
+
return picker;
|
1789
|
+
};
|
1790
|
+
|
1791
|
+
picker.locale = function (locale) {
|
1792
|
+
if (arguments.length === 0) {
|
1793
|
+
return options.locale;
|
1794
|
+
}
|
1795
|
+
|
1796
|
+
if (!moment.localeData(locale)) {
|
1797
|
+
throw new TypeError('locale() locale ' + locale + ' is not loaded from moment locales!');
|
1798
|
+
}
|
1799
|
+
|
1800
|
+
options.locale = locale;
|
1801
|
+
date.locale(options.locale);
|
1802
|
+
viewDate.locale(options.locale);
|
1803
|
+
|
1804
|
+
if (actualFormat) {
|
1805
|
+
initFormatting(); // reinit formatting
|
1806
|
+
}
|
1807
|
+
if (widget) {
|
1808
|
+
hide();
|
1809
|
+
show();
|
1810
|
+
}
|
1811
|
+
return picker;
|
1812
|
+
};
|
1813
|
+
|
1814
|
+
picker.stepping = function (stepping) {
|
1815
|
+
if (arguments.length === 0) {
|
1816
|
+
return options.stepping;
|
1817
|
+
}
|
1818
|
+
|
1819
|
+
stepping = parseInt(stepping, 10);
|
1820
|
+
if (isNaN(stepping) || stepping < 1) {
|
1821
|
+
stepping = 1;
|
1822
|
+
}
|
1823
|
+
options.stepping = stepping;
|
1824
|
+
return picker;
|
1825
|
+
};
|
1826
|
+
|
1827
|
+
picker.useCurrent = function (useCurrent) {
|
1828
|
+
var useCurrentOptions = ['year', 'month', 'day', 'hour', 'minute'];
|
1829
|
+
if (arguments.length === 0) {
|
1830
|
+
return options.useCurrent;
|
1831
|
+
}
|
1832
|
+
|
1833
|
+
if ((typeof useCurrent !== 'boolean') && (typeof useCurrent !== 'string')) {
|
1834
|
+
throw new TypeError('useCurrent() expects a boolean or string parameter');
|
1835
|
+
}
|
1836
|
+
if (typeof useCurrent === 'string' && useCurrentOptions.indexOf(useCurrent.toLowerCase()) === -1) {
|
1837
|
+
throw new TypeError('useCurrent() expects a string parameter of ' + useCurrentOptions.join(', '));
|
1838
|
+
}
|
1839
|
+
options.useCurrent = useCurrent;
|
1840
|
+
return picker;
|
1841
|
+
};
|
1842
|
+
|
1843
|
+
picker.collapse = function (collapse) {
|
1844
|
+
if (arguments.length === 0) {
|
1845
|
+
return options.collapse;
|
1846
|
+
}
|
1847
|
+
|
1848
|
+
if (typeof collapse !== 'boolean') {
|
1849
|
+
throw new TypeError('collapse() expects a boolean parameter');
|
1850
|
+
}
|
1851
|
+
if (options.collapse === collapse) {
|
1852
|
+
return picker;
|
1853
|
+
}
|
1854
|
+
options.collapse = collapse;
|
1855
|
+
if (widget) {
|
1856
|
+
hide();
|
1857
|
+
show();
|
1858
|
+
}
|
1859
|
+
return picker;
|
1860
|
+
};
|
1861
|
+
|
1862
|
+
picker.icons = function (icons) {
|
1863
|
+
if (arguments.length === 0) {
|
1864
|
+
return $.extend({}, options.icons);
|
1865
|
+
}
|
1866
|
+
|
1867
|
+
if (!(icons instanceof Object)) {
|
1868
|
+
throw new TypeError('icons() expects parameter to be an Object');
|
1869
|
+
}
|
1870
|
+
$.extend(options.icons, icons);
|
1871
|
+
if (widget) {
|
1872
|
+
hide();
|
1873
|
+
show();
|
1874
|
+
}
|
1875
|
+
return picker;
|
1876
|
+
};
|
1877
|
+
|
1878
|
+
picker.tooltips = function (tooltips) {
|
1879
|
+
if (arguments.length === 0) {
|
1880
|
+
return $.extend({}, options.tooltips);
|
1881
|
+
}
|
1882
|
+
|
1883
|
+
if (!(tooltips instanceof Object)) {
|
1884
|
+
throw new TypeError('tooltips() expects parameter to be an Object');
|
1885
|
+
}
|
1886
|
+
$.extend(options.tooltips, tooltips);
|
1887
|
+
if (widget) {
|
1888
|
+
hide();
|
1889
|
+
show();
|
1890
|
+
}
|
1891
|
+
return picker;
|
1892
|
+
};
|
1893
|
+
|
1894
|
+
picker.useStrict = function (useStrict) {
|
1895
|
+
if (arguments.length === 0) {
|
1896
|
+
return options.useStrict;
|
1897
|
+
}
|
1898
|
+
|
1899
|
+
if (typeof useStrict !== 'boolean') {
|
1900
|
+
throw new TypeError('useStrict() expects a boolean parameter');
|
1901
|
+
}
|
1902
|
+
options.useStrict = useStrict;
|
1903
|
+
return picker;
|
1904
|
+
};
|
1905
|
+
|
1906
|
+
picker.sideBySide = function (sideBySide) {
|
1907
|
+
if (arguments.length === 0) {
|
1908
|
+
return options.sideBySide;
|
1909
|
+
}
|
1910
|
+
|
1911
|
+
if (typeof sideBySide !== 'boolean') {
|
1912
|
+
throw new TypeError('sideBySide() expects a boolean parameter');
|
1913
|
+
}
|
1914
|
+
options.sideBySide = sideBySide;
|
1915
|
+
if (widget) {
|
1916
|
+
hide();
|
1917
|
+
show();
|
1918
|
+
}
|
1919
|
+
return picker;
|
1920
|
+
};
|
1921
|
+
|
1922
|
+
picker.viewMode = function (viewMode) {
|
1923
|
+
if (arguments.length === 0) {
|
1924
|
+
return options.viewMode;
|
1925
|
+
}
|
1926
|
+
|
1927
|
+
if (typeof viewMode !== 'string') {
|
1928
|
+
throw new TypeError('viewMode() expects a string parameter');
|
1929
|
+
}
|
1930
|
+
|
1931
|
+
if (viewModes.indexOf(viewMode) === -1) {
|
1932
|
+
throw new TypeError('viewMode() parameter must be one of (' + viewModes.join(', ') + ') value');
|
1933
|
+
}
|
1934
|
+
|
1935
|
+
options.viewMode = viewMode;
|
1936
|
+
currentViewMode = Math.max(viewModes.indexOf(viewMode), minViewModeNumber);
|
1937
|
+
|
1938
|
+
showMode();
|
1939
|
+
return picker;
|
1940
|
+
};
|
1941
|
+
|
1942
|
+
picker.toolbarPlacement = function (toolbarPlacement) {
|
1943
|
+
if (arguments.length === 0) {
|
1944
|
+
return options.toolbarPlacement;
|
1945
|
+
}
|
1946
|
+
|
1947
|
+
if (typeof toolbarPlacement !== 'string') {
|
1948
|
+
throw new TypeError('toolbarPlacement() expects a string parameter');
|
1949
|
+
}
|
1950
|
+
if (toolbarPlacements.indexOf(toolbarPlacement) === -1) {
|
1951
|
+
throw new TypeError('toolbarPlacement() parameter must be one of (' + toolbarPlacements.join(', ') + ') value');
|
1952
|
+
}
|
1953
|
+
options.toolbarPlacement = toolbarPlacement;
|
1954
|
+
|
1955
|
+
if (widget) {
|
1956
|
+
hide();
|
1957
|
+
show();
|
1958
|
+
}
|
1959
|
+
return picker;
|
1960
|
+
};
|
1961
|
+
|
1962
|
+
picker.widgetPositioning = function (widgetPositioning) {
|
1963
|
+
if (arguments.length === 0) {
|
1964
|
+
return $.extend({}, options.widgetPositioning);
|
1965
|
+
}
|
1966
|
+
|
1967
|
+
if (({}).toString.call(widgetPositioning) !== '[object Object]') {
|
1968
|
+
throw new TypeError('widgetPositioning() expects an object variable');
|
1969
|
+
}
|
1970
|
+
if (widgetPositioning.horizontal) {
|
1971
|
+
if (typeof widgetPositioning.horizontal !== 'string') {
|
1972
|
+
throw new TypeError('widgetPositioning() horizontal variable must be a string');
|
1973
|
+
}
|
1974
|
+
widgetPositioning.horizontal = widgetPositioning.horizontal.toLowerCase();
|
1975
|
+
if (horizontalModes.indexOf(widgetPositioning.horizontal) === -1) {
|
1976
|
+
throw new TypeError('widgetPositioning() expects horizontal parameter to be one of (' + horizontalModes.join(', ') + ')');
|
1977
|
+
}
|
1978
|
+
options.widgetPositioning.horizontal = widgetPositioning.horizontal;
|
1979
|
+
}
|
1980
|
+
if (widgetPositioning.vertical) {
|
1981
|
+
if (typeof widgetPositioning.vertical !== 'string') {
|
1982
|
+
throw new TypeError('widgetPositioning() vertical variable must be a string');
|
1983
|
+
}
|
1984
|
+
widgetPositioning.vertical = widgetPositioning.vertical.toLowerCase();
|
1985
|
+
if (verticalModes.indexOf(widgetPositioning.vertical) === -1) {
|
1986
|
+
throw new TypeError('widgetPositioning() expects vertical parameter to be one of (' + verticalModes.join(', ') + ')');
|
1987
|
+
}
|
1988
|
+
options.widgetPositioning.vertical = widgetPositioning.vertical;
|
1989
|
+
}
|
1990
|
+
update();
|
1991
|
+
return picker;
|
1992
|
+
};
|
1993
|
+
|
1994
|
+
picker.calendarWeeks = function (calendarWeeks) {
|
1995
|
+
if (arguments.length === 0) {
|
1996
|
+
return options.calendarWeeks;
|
1997
|
+
}
|
1998
|
+
|
1999
|
+
if (typeof calendarWeeks !== 'boolean') {
|
2000
|
+
throw new TypeError('calendarWeeks() expects parameter to be a boolean value');
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
options.calendarWeeks = calendarWeeks;
|
2004
|
+
update();
|
2005
|
+
return picker;
|
2006
|
+
};
|
2007
|
+
|
2008
|
+
picker.showTodayButton = function (showTodayButton) {
|
2009
|
+
if (arguments.length === 0) {
|
2010
|
+
return options.showTodayButton;
|
2011
|
+
}
|
2012
|
+
|
2013
|
+
if (typeof showTodayButton !== 'boolean') {
|
2014
|
+
throw new TypeError('showTodayButton() expects a boolean parameter');
|
2015
|
+
}
|
2016
|
+
|
2017
|
+
options.showTodayButton = showTodayButton;
|
2018
|
+
if (widget) {
|
2019
|
+
hide();
|
2020
|
+
show();
|
2021
|
+
}
|
2022
|
+
return picker;
|
2023
|
+
};
|
2024
|
+
|
2025
|
+
picker.showClear = function (showClear) {
|
2026
|
+
if (arguments.length === 0) {
|
2027
|
+
return options.showClear;
|
2028
|
+
}
|
2029
|
+
|
2030
|
+
if (typeof showClear !== 'boolean') {
|
2031
|
+
throw new TypeError('showClear() expects a boolean parameter');
|
2032
|
+
}
|
2033
|
+
|
2034
|
+
options.showClear = showClear;
|
2035
|
+
if (widget) {
|
2036
|
+
hide();
|
2037
|
+
show();
|
2038
|
+
}
|
2039
|
+
return picker;
|
2040
|
+
};
|
2041
|
+
|
2042
|
+
picker.widgetParent = function (widgetParent) {
|
2043
|
+
if (arguments.length === 0) {
|
2044
|
+
return options.widgetParent;
|
2045
|
+
}
|
2046
|
+
|
2047
|
+
if (typeof widgetParent === 'string') {
|
2048
|
+
widgetParent = $(widgetParent);
|
2049
|
+
}
|
2050
|
+
|
2051
|
+
if (widgetParent !== null && (typeof widgetParent !== 'string' && !(widgetParent instanceof $))) {
|
2052
|
+
throw new TypeError('widgetParent() expects a string or a jQuery object parameter');
|
2053
|
+
}
|
2054
|
+
|
2055
|
+
options.widgetParent = widgetParent;
|
2056
|
+
if (widget) {
|
2057
|
+
hide();
|
2058
|
+
show();
|
2059
|
+
}
|
2060
|
+
return picker;
|
2061
|
+
};
|
2062
|
+
|
2063
|
+
picker.keepOpen = function (keepOpen) {
|
2064
|
+
if (arguments.length === 0) {
|
2065
|
+
return options.keepOpen;
|
2066
|
+
}
|
2067
|
+
|
2068
|
+
if (typeof keepOpen !== 'boolean') {
|
2069
|
+
throw new TypeError('keepOpen() expects a boolean parameter');
|
2070
|
+
}
|
2071
|
+
|
2072
|
+
options.keepOpen = keepOpen;
|
2073
|
+
return picker;
|
2074
|
+
};
|
2075
|
+
|
2076
|
+
picker.focusOnShow = function (focusOnShow) {
|
2077
|
+
if (arguments.length === 0) {
|
2078
|
+
return options.focusOnShow;
|
2079
|
+
}
|
2080
|
+
|
2081
|
+
if (typeof focusOnShow !== 'boolean') {
|
2082
|
+
throw new TypeError('focusOnShow() expects a boolean parameter');
|
2083
|
+
}
|
2084
|
+
|
2085
|
+
options.focusOnShow = focusOnShow;
|
2086
|
+
return picker;
|
2087
|
+
};
|
2088
|
+
|
2089
|
+
picker.inline = function (inline) {
|
2090
|
+
if (arguments.length === 0) {
|
2091
|
+
return options.inline;
|
2092
|
+
}
|
2093
|
+
|
2094
|
+
if (typeof inline !== 'boolean') {
|
2095
|
+
throw new TypeError('inline() expects a boolean parameter');
|
2096
|
+
}
|
2097
|
+
|
2098
|
+
options.inline = inline;
|
2099
|
+
return picker;
|
2100
|
+
};
|
2101
|
+
|
2102
|
+
picker.clear = function () {
|
2103
|
+
clear();
|
2104
|
+
return picker;
|
2105
|
+
};
|
2106
|
+
|
2107
|
+
picker.keyBinds = function (keyBinds) {
|
2108
|
+
options.keyBinds = keyBinds;
|
2109
|
+
return picker;
|
2110
|
+
};
|
2111
|
+
|
2112
|
+
picker.getMoment = function (d) {
|
2113
|
+
return getMoment(d);
|
2114
|
+
};
|
2115
|
+
|
2116
|
+
picker.debug = function (debug) {
|
2117
|
+
if (typeof debug !== 'boolean') {
|
2118
|
+
throw new TypeError('debug() expects a boolean parameter');
|
2119
|
+
}
|
2120
|
+
|
2121
|
+
options.debug = debug;
|
2122
|
+
return picker;
|
2123
|
+
};
|
2124
|
+
|
2125
|
+
picker.allowInputToggle = function (allowInputToggle) {
|
2126
|
+
if (arguments.length === 0) {
|
2127
|
+
return options.allowInputToggle;
|
2128
|
+
}
|
2129
|
+
|
2130
|
+
if (typeof allowInputToggle !== 'boolean') {
|
2131
|
+
throw new TypeError('allowInputToggle() expects a boolean parameter');
|
2132
|
+
}
|
2133
|
+
|
2134
|
+
options.allowInputToggle = allowInputToggle;
|
2135
|
+
return picker;
|
2136
|
+
};
|
2137
|
+
|
2138
|
+
picker.showClose = function (showClose) {
|
2139
|
+
if (arguments.length === 0) {
|
2140
|
+
return options.showClose;
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
if (typeof showClose !== 'boolean') {
|
2144
|
+
throw new TypeError('showClose() expects a boolean parameter');
|
2145
|
+
}
|
2146
|
+
|
2147
|
+
options.showClose = showClose;
|
2148
|
+
return picker;
|
2149
|
+
};
|
2150
|
+
|
2151
|
+
picker.keepInvalid = function (keepInvalid) {
|
2152
|
+
if (arguments.length === 0) {
|
2153
|
+
return options.keepInvalid;
|
2154
|
+
}
|
2155
|
+
|
2156
|
+
if (typeof keepInvalid !== 'boolean') {
|
2157
|
+
throw new TypeError('keepInvalid() expects a boolean parameter');
|
2158
|
+
}
|
2159
|
+
options.keepInvalid = keepInvalid;
|
2160
|
+
return picker;
|
2161
|
+
};
|
2162
|
+
|
2163
|
+
picker.datepickerInput = function (datepickerInput) {
|
2164
|
+
if (arguments.length === 0) {
|
2165
|
+
return options.datepickerInput;
|
2166
|
+
}
|
2167
|
+
|
2168
|
+
if (typeof datepickerInput !== 'string') {
|
2169
|
+
throw new TypeError('datepickerInput() expects a string parameter');
|
2170
|
+
}
|
2171
|
+
|
2172
|
+
options.datepickerInput = datepickerInput;
|
2173
|
+
return picker;
|
2174
|
+
};
|
2175
|
+
|
2176
|
+
picker.parseInputDate = function (parseInputDate) {
|
2177
|
+
if (arguments.length === 0) {
|
2178
|
+
return options.parseInputDate;
|
2179
|
+
}
|
2180
|
+
|
2181
|
+
if (typeof parseInputDate !== 'function') {
|
2182
|
+
throw new TypeError('parseInputDate() sholud be as function');
|
2183
|
+
}
|
2184
|
+
|
2185
|
+
options.parseInputDate = parseInputDate;
|
2186
|
+
|
2187
|
+
return picker;
|
2188
|
+
};
|
2189
|
+
|
2190
|
+
picker.disabledTimeIntervals = function (disabledTimeIntervals) {
|
2191
|
+
///<signature helpKeyword="$.fn.datetimepicker.disabledTimeIntervals">
|
2192
|
+
///<summary>Returns an array with the currently set disabled dates on the component.</summary>
|
2193
|
+
///<returns type="array">options.disabledTimeIntervals</returns>
|
2194
|
+
///</signature>
|
2195
|
+
///<signature>
|
2196
|
+
///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
|
2197
|
+
///options.enabledDates if such exist.</summary>
|
2198
|
+
///<param name="dates" locid="$.fn.datetimepicker.disabledTimeIntervals_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
|
2199
|
+
///</signature>
|
2200
|
+
if (arguments.length === 0) {
|
2201
|
+
return (options.disabledTimeIntervals ? $.extend({}, options.disabledTimeIntervals) : options.disabledTimeIntervals);
|
2202
|
+
}
|
2203
|
+
|
2204
|
+
if (!disabledTimeIntervals) {
|
2205
|
+
options.disabledTimeIntervals = false;
|
2206
|
+
update();
|
2207
|
+
return picker;
|
2208
|
+
}
|
2209
|
+
if (!(disabledTimeIntervals instanceof Array)) {
|
2210
|
+
throw new TypeError('disabledTimeIntervals() expects an array parameter');
|
2211
|
+
}
|
2212
|
+
options.disabledTimeIntervals = disabledTimeIntervals;
|
2213
|
+
update();
|
2214
|
+
return picker;
|
2215
|
+
};
|
2216
|
+
|
2217
|
+
picker.disabledHours = function (hours) {
|
2218
|
+
///<signature helpKeyword="$.fn.datetimepicker.disabledHours">
|
2219
|
+
///<summary>Returns an array with the currently set disabled hours on the component.</summary>
|
2220
|
+
///<returns type="array">options.disabledHours</returns>
|
2221
|
+
///</signature>
|
2222
|
+
///<signature>
|
2223
|
+
///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
|
2224
|
+
///options.enabledHours if such exist.</summary>
|
2225
|
+
///<param name="hours" locid="$.fn.datetimepicker.disabledHours_p:hours">Takes an [ int ] of values and disallows the user to select only from those hours.</param>
|
2226
|
+
///</signature>
|
2227
|
+
if (arguments.length === 0) {
|
2228
|
+
return (options.disabledHours ? $.extend({}, options.disabledHours) : options.disabledHours);
|
2229
|
+
}
|
2230
|
+
|
2231
|
+
if (!hours) {
|
2232
|
+
options.disabledHours = false;
|
2233
|
+
update();
|
2234
|
+
return picker;
|
2235
|
+
}
|
2236
|
+
if (!(hours instanceof Array)) {
|
2237
|
+
throw new TypeError('disabledHours() expects an array parameter');
|
2238
|
+
}
|
2239
|
+
options.disabledHours = indexGivenHours(hours);
|
2240
|
+
options.enabledHours = false;
|
2241
|
+
if (options.useCurrent && !options.keepInvalid) {
|
2242
|
+
var tries = 0;
|
2243
|
+
while (!isValid(date, 'h')) {
|
2244
|
+
date.add(1, 'h');
|
2245
|
+
if (tries === 24) {
|
2246
|
+
throw 'Tried 24 times to find a valid date';
|
2247
|
+
}
|
2248
|
+
tries++;
|
2249
|
+
}
|
2250
|
+
setValue(date);
|
2251
|
+
}
|
2252
|
+
update();
|
2253
|
+
return picker;
|
2254
|
+
};
|
2255
|
+
|
2256
|
+
picker.enabledHours = function (hours) {
|
2257
|
+
///<signature helpKeyword="$.fn.datetimepicker.enabledHours">
|
2258
|
+
///<summary>Returns an array with the currently set enabled hours on the component.</summary>
|
2259
|
+
///<returns type="array">options.enabledHours</returns>
|
2260
|
+
///</signature>
|
2261
|
+
///<signature>
|
2262
|
+
///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledHours if such exist.</summary>
|
2263
|
+
///<param name="hours" locid="$.fn.datetimepicker.enabledHours_p:hours">Takes an [ int ] of values and allows the user to select only from those hours.</param>
|
2264
|
+
///</signature>
|
2265
|
+
if (arguments.length === 0) {
|
2266
|
+
return (options.enabledHours ? $.extend({}, options.enabledHours) : options.enabledHours);
|
2267
|
+
}
|
2268
|
+
|
2269
|
+
if (!hours) {
|
2270
|
+
options.enabledHours = false;
|
2271
|
+
update();
|
2272
|
+
return picker;
|
2273
|
+
}
|
2274
|
+
if (!(hours instanceof Array)) {
|
2275
|
+
throw new TypeError('enabledHours() expects an array parameter');
|
2276
|
+
}
|
2277
|
+
options.enabledHours = indexGivenHours(hours);
|
2278
|
+
options.disabledHours = false;
|
2279
|
+
if (options.useCurrent && !options.keepInvalid) {
|
2280
|
+
var tries = 0;
|
2281
|
+
while (!isValid(date, 'h')) {
|
2282
|
+
date.add(1, 'h');
|
2283
|
+
if (tries === 24) {
|
2284
|
+
throw 'Tried 24 times to find a valid date';
|
2285
|
+
}
|
2286
|
+
tries++;
|
2287
|
+
}
|
2288
|
+
setValue(date);
|
2289
|
+
}
|
2290
|
+
update();
|
2291
|
+
return picker;
|
2292
|
+
};
|
2293
|
+
|
2294
|
+
picker.viewDate = function (newDate) {
|
2295
|
+
///<signature helpKeyword="$.fn.datetimepicker.viewDate">
|
2296
|
+
///<summary>Returns the component's model current viewDate, a moment object or null if not set.</summary>
|
2297
|
+
///<returns type="Moment">viewDate.clone()</returns>
|
2298
|
+
///</signature>
|
2299
|
+
///<signature>
|
2300
|
+
///<summary>Sets the components model current moment to it. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.</summary>
|
2301
|
+
///<param name="newDate" locid="$.fn.datetimepicker.date_p:newDate">Takes string, viewDate, moment, null parameter.</param>
|
2302
|
+
///</signature>
|
2303
|
+
if (arguments.length === 0) {
|
2304
|
+
return viewDate.clone();
|
2305
|
+
}
|
2306
|
+
|
2307
|
+
if (!newDate) {
|
2308
|
+
viewDate = date.clone();
|
2309
|
+
return picker;
|
2310
|
+
}
|
2311
|
+
|
2312
|
+
if (typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) {
|
2313
|
+
throw new TypeError('viewDate() parameter must be one of [string, moment or Date]');
|
2314
|
+
}
|
2315
|
+
|
2316
|
+
viewDate = parseInputDate(newDate);
|
2317
|
+
viewUpdate();
|
2318
|
+
return picker;
|
2319
|
+
};
|
2320
|
+
|
2321
|
+
// initializing element and component attributes
|
2322
|
+
if (element.is('input')) {
|
2323
|
+
input = element;
|
2324
|
+
} else {
|
2325
|
+
input = element.find(options.datepickerInput);
|
2326
|
+
if (input.size() === 0) {
|
2327
|
+
input = element.find('input');
|
2328
|
+
} else if (!input.is('input')) {
|
2329
|
+
throw new Error('CSS class "' + options.datepickerInput + '" cannot be applied to non input element');
|
2330
|
+
}
|
2331
|
+
}
|
2332
|
+
|
2333
|
+
if (element.hasClass('input-group')) {
|
2334
|
+
// in case there is more then one 'input-group-addon' Issue #48
|
2335
|
+
if (element.find('.datepickerbutton').size() === 0) {
|
2336
|
+
component = element.find('.input-group-addon');
|
2337
|
+
} else {
|
2338
|
+
component = element.find('.datepickerbutton');
|
2339
|
+
}
|
2340
|
+
}
|
2341
|
+
|
2342
|
+
if (!options.inline && !input.is('input')) {
|
2343
|
+
throw new Error('Could not initialize DateTimePicker without an input element');
|
2344
|
+
}
|
2345
|
+
|
2346
|
+
// Set defaults for date here now instead of in var declaration
|
2347
|
+
date = getMoment();
|
2348
|
+
viewDate = date.clone();
|
2349
|
+
|
2350
|
+
$.extend(true, options, dataToOptions());
|
2351
|
+
|
2352
|
+
picker.options(options);
|
2353
|
+
|
2354
|
+
initFormatting();
|
2355
|
+
|
2356
|
+
attachDatePickerElementEvents();
|
2357
|
+
|
2358
|
+
if (input.prop('disabled')) {
|
2359
|
+
picker.disable();
|
2360
|
+
}
|
2361
|
+
if (input.is('input') && input.val().trim().length !== 0) {
|
2362
|
+
setValue(parseInputDate(input.val().trim()));
|
2363
|
+
}
|
2364
|
+
else if (options.defaultDate && input.attr('placeholder') === undefined) {
|
2365
|
+
setValue(options.defaultDate);
|
2366
|
+
}
|
2367
|
+
if (options.inline) {
|
2368
|
+
show();
|
2369
|
+
}
|
2370
|
+
return picker;
|
2371
|
+
};
|
2372
|
+
|
2373
|
+
/********************************************************************************
|
2374
|
+
*
|
2375
|
+
* jQuery plugin constructor and defaults object
|
2376
|
+
*
|
2377
|
+
********************************************************************************/
|
2378
|
+
|
2379
|
+
$.fn.datetimepicker = function (options) {
|
2380
|
+
return this.each(function () {
|
2381
|
+
var $this = $(this);
|
2382
|
+
if (!$this.data('DateTimePicker')) {
|
2383
|
+
// create a private copy of the defaults object
|
2384
|
+
options = $.extend(true, {}, $.fn.datetimepicker.defaults, options);
|
2385
|
+
$this.data('DateTimePicker', dateTimePicker($this, options));
|
2386
|
+
}
|
2387
|
+
});
|
2388
|
+
};
|
2389
|
+
|
2390
|
+
$.fn.datetimepicker.defaults = {
|
2391
|
+
timeZone: 'Etc/UTC',
|
2392
|
+
format: false,
|
2393
|
+
dayViewHeaderFormat: 'MMMM YYYY',
|
2394
|
+
extraFormats: false,
|
2395
|
+
stepping: 1,
|
2396
|
+
minDate: false,
|
2397
|
+
maxDate: false,
|
2398
|
+
useCurrent: true,
|
2399
|
+
collapse: true,
|
2400
|
+
locale: moment.locale(),
|
2401
|
+
defaultDate: false,
|
2402
|
+
disabledDates: false,
|
2403
|
+
enabledDates: false,
|
2404
|
+
icons: {
|
2405
|
+
time: 'glyphicon glyphicon-time',
|
2406
|
+
date: 'glyphicon glyphicon-calendar',
|
2407
|
+
up: 'glyphicon glyphicon-chevron-up',
|
2408
|
+
down: 'glyphicon glyphicon-chevron-down',
|
2409
|
+
previous: 'glyphicon glyphicon-chevron-left',
|
2410
|
+
next: 'glyphicon glyphicon-chevron-right',
|
2411
|
+
today: 'glyphicon glyphicon-screenshot',
|
2412
|
+
clear: 'glyphicon glyphicon-trash',
|
2413
|
+
close: 'glyphicon glyphicon-remove'
|
2414
|
+
},
|
2415
|
+
tooltips: {
|
2416
|
+
today: 'Go to today',
|
2417
|
+
clear: 'Clear selection',
|
2418
|
+
close: 'Close the picker',
|
2419
|
+
selectMonth: 'Select Month',
|
2420
|
+
prevMonth: 'Previous Month',
|
2421
|
+
nextMonth: 'Next Month',
|
2422
|
+
selectYear: 'Select Year',
|
2423
|
+
prevYear: 'Previous Year',
|
2424
|
+
nextYear: 'Next Year',
|
2425
|
+
selectDecade: 'Select Decade',
|
2426
|
+
prevDecade: 'Previous Decade',
|
2427
|
+
nextDecade: 'Next Decade',
|
2428
|
+
prevCentury: 'Previous Century',
|
2429
|
+
nextCentury: 'Next Century',
|
2430
|
+
pickHour: 'Pick Hour',
|
2431
|
+
incrementHour: 'Increment Hour',
|
2432
|
+
decrementHour: 'Decrement Hour',
|
2433
|
+
pickMinute: 'Pick Minute',
|
2434
|
+
incrementMinute: 'Increment Minute',
|
2435
|
+
decrementMinute: 'Decrement Minute',
|
2436
|
+
pickSecond: 'Pick Second',
|
2437
|
+
incrementSecond: 'Increment Second',
|
2438
|
+
decrementSecond: 'Decrement Second',
|
2439
|
+
togglePeriod: 'Toggle Period',
|
2440
|
+
selectTime: 'Select Time'
|
2441
|
+
},
|
2442
|
+
useStrict: false,
|
2443
|
+
sideBySide: false,
|
2444
|
+
daysOfWeekDisabled: false,
|
2445
|
+
calendarWeeks: false,
|
2446
|
+
viewMode: 'days',
|
2447
|
+
toolbarPlacement: 'default',
|
2448
|
+
showTodayButton: false,
|
2449
|
+
showClear: false,
|
2450
|
+
showClose: false,
|
2451
|
+
widgetPositioning: {
|
2452
|
+
horizontal: 'auto',
|
2453
|
+
vertical: 'auto'
|
2454
|
+
},
|
2455
|
+
widgetParent: null,
|
2456
|
+
ignoreReadonly: false,
|
2457
|
+
keepOpen: false,
|
2458
|
+
focusOnShow: true,
|
2459
|
+
inline: false,
|
2460
|
+
keepInvalid: false,
|
2461
|
+
datepickerInput: '.datepickerinput',
|
2462
|
+
keyBinds: {
|
2463
|
+
up: function (widget) {
|
2464
|
+
if (!widget) {
|
2465
|
+
return;
|
2466
|
+
}
|
2467
|
+
var d = this.date() || this.getMoment();
|
2468
|
+
if (widget.find('.datepicker').is(':visible')) {
|
2469
|
+
this.date(d.clone().subtract(7, 'd'));
|
2470
|
+
} else {
|
2471
|
+
this.date(d.clone().add(this.stepping(), 'm'));
|
2472
|
+
}
|
2473
|
+
},
|
2474
|
+
down: function (widget) {
|
2475
|
+
if (!widget) {
|
2476
|
+
this.show();
|
2477
|
+
return;
|
2478
|
+
}
|
2479
|
+
var d = this.date() || this.getMoment();
|
2480
|
+
if (widget.find('.datepicker').is(':visible')) {
|
2481
|
+
this.date(d.clone().add(7, 'd'));
|
2482
|
+
} else {
|
2483
|
+
this.date(d.clone().subtract(this.stepping(), 'm'));
|
2484
|
+
}
|
2485
|
+
},
|
2486
|
+
'control up': function (widget) {
|
2487
|
+
if (!widget) {
|
2488
|
+
return;
|
2489
|
+
}
|
2490
|
+
var d = this.date() || this.getMoment();
|
2491
|
+
if (widget.find('.datepicker').is(':visible')) {
|
2492
|
+
this.date(d.clone().subtract(1, 'y'));
|
2493
|
+
} else {
|
2494
|
+
this.date(d.clone().add(1, 'h'));
|
2495
|
+
}
|
2496
|
+
},
|
2497
|
+
'control down': function (widget) {
|
2498
|
+
if (!widget) {
|
2499
|
+
return;
|
2500
|
+
}
|
2501
|
+
var d = this.date() || this.getMoment();
|
2502
|
+
if (widget.find('.datepicker').is(':visible')) {
|
2503
|
+
this.date(d.clone().add(1, 'y'));
|
2504
|
+
} else {
|
2505
|
+
this.date(d.clone().subtract(1, 'h'));
|
2506
|
+
}
|
2507
|
+
},
|
2508
|
+
left: function (widget) {
|
2509
|
+
if (!widget) {
|
2510
|
+
return;
|
2511
|
+
}
|
2512
|
+
var d = this.date() || this.getMoment();
|
2513
|
+
if (widget.find('.datepicker').is(':visible')) {
|
2514
|
+
this.date(d.clone().subtract(1, 'd'));
|
2515
|
+
}
|
2516
|
+
},
|
2517
|
+
right: function (widget) {
|
2518
|
+
if (!widget) {
|
2519
|
+
return;
|
2520
|
+
}
|
2521
|
+
var d = this.date() || this.getMoment();
|
2522
|
+
if (widget.find('.datepicker').is(':visible')) {
|
2523
|
+
this.date(d.clone().add(1, 'd'));
|
2524
|
+
}
|
2525
|
+
},
|
2526
|
+
pageUp: function (widget) {
|
2527
|
+
if (!widget) {
|
2528
|
+
return;
|
2529
|
+
}
|
2530
|
+
var d = this.date() || this.getMoment();
|
2531
|
+
if (widget.find('.datepicker').is(':visible')) {
|
2532
|
+
this.date(d.clone().subtract(1, 'M'));
|
2533
|
+
}
|
2534
|
+
},
|
2535
|
+
pageDown: function (widget) {
|
2536
|
+
if (!widget) {
|
2537
|
+
return;
|
2538
|
+
}
|
2539
|
+
var d = this.date() || this.getMoment();
|
2540
|
+
if (widget.find('.datepicker').is(':visible')) {
|
2541
|
+
this.date(d.clone().add(1, 'M'));
|
2542
|
+
}
|
2543
|
+
},
|
2544
|
+
enter: function () {
|
2545
|
+
this.hide();
|
2546
|
+
},
|
2547
|
+
escape: function () {
|
2548
|
+
this.hide();
|
2549
|
+
},
|
2550
|
+
//tab: function (widget) { //this break the flow of the form. disabling for now
|
2551
|
+
// var toggle = widget.find('.picker-switch a[data-action="togglePicker"]');
|
2552
|
+
// if(toggle.length > 0) toggle.click();
|
2553
|
+
//},
|
2554
|
+
'control space': function (widget) {
|
2555
|
+
if (widget.find('.timepicker').is(':visible')) {
|
2556
|
+
widget.find('.btn[data-action="togglePeriod"]').click();
|
2557
|
+
}
|
2558
|
+
},
|
2559
|
+
t: function () {
|
2560
|
+
this.date(this.getMoment());
|
2561
|
+
},
|
2562
|
+
'delete': function () {
|
2563
|
+
this.clear();
|
2564
|
+
}
|
2565
|
+
},
|
2566
|
+
debug: false,
|
2567
|
+
allowInputToggle: false,
|
2568
|
+
disabledTimeIntervals: false,
|
2569
|
+
disabledHours: false,
|
2570
|
+
enabledHours: false,
|
2571
|
+
viewDate: false
|
2572
|
+
};
|
2573
|
+
}));
|