ext_yarn 0.4.0 → 0.5.0

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