time-picker.js 82 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 65);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 0:
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  93. /* globals __VUE_SSR_CONTEXT__ */
  94. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  95. // This module is a runtime utility for cleaner component module output and will
  96. // be included in the final webpack user bundle.
  97. function normalizeComponent (
  98. scriptExports,
  99. render,
  100. staticRenderFns,
  101. functionalTemplate,
  102. injectStyles,
  103. scopeId,
  104. moduleIdentifier, /* server only */
  105. shadowMode /* vue-cli only */
  106. ) {
  107. // Vue.extend constructor export interop
  108. var options = typeof scriptExports === 'function'
  109. ? scriptExports.options
  110. : scriptExports
  111. // render functions
  112. if (render) {
  113. options.render = render
  114. options.staticRenderFns = staticRenderFns
  115. options._compiled = true
  116. }
  117. // functional template
  118. if (functionalTemplate) {
  119. options.functional = true
  120. }
  121. // scopedId
  122. if (scopeId) {
  123. options._scopeId = 'data-v-' + scopeId
  124. }
  125. var hook
  126. if (moduleIdentifier) { // server build
  127. hook = function (context) {
  128. // 2.3 injection
  129. context =
  130. context || // cached call
  131. (this.$vnode && this.$vnode.ssrContext) || // stateful
  132. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  133. // 2.2 with runInNewContext: true
  134. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  135. context = __VUE_SSR_CONTEXT__
  136. }
  137. // inject component styles
  138. if (injectStyles) {
  139. injectStyles.call(this, context)
  140. }
  141. // register component module identifier for async chunk inferrence
  142. if (context && context._registeredComponents) {
  143. context._registeredComponents.add(moduleIdentifier)
  144. }
  145. }
  146. // used by ssr in case component is cached and beforeCreate
  147. // never gets called
  148. options._ssrRegister = hook
  149. } else if (injectStyles) {
  150. hook = shadowMode
  151. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  152. : injectStyles
  153. }
  154. if (hook) {
  155. if (options.functional) {
  156. // for template-only hot-reload because in that case the render fn doesn't
  157. // go through the normalizer
  158. options._injectStyles = hook
  159. // register for functioal component in vue file
  160. var originalRender = options.render
  161. options.render = function renderWithStyleInjection (h, context) {
  162. hook.call(context)
  163. return originalRender(h, context)
  164. }
  165. } else {
  166. // inject component registration as beforeCreate hook
  167. var existing = options.beforeCreate
  168. options.beforeCreate = existing
  169. ? [].concat(existing, hook)
  170. : [hook]
  171. }
  172. }
  173. return {
  174. exports: scriptExports,
  175. options: options
  176. }
  177. }
  178. /***/ }),
  179. /***/ 1:
  180. /***/ (function(module, exports) {
  181. module.exports = require("element-ui/lib/utils/date-util");
  182. /***/ }),
  183. /***/ 11:
  184. /***/ (function(module, exports) {
  185. module.exports = require("element-ui/lib/utils/clickoutside");
  186. /***/ }),
  187. /***/ 17:
  188. /***/ (function(module, exports) {
  189. module.exports = require("element-ui/lib/scrollbar");
  190. /***/ }),
  191. /***/ 2:
  192. /***/ (function(module, exports) {
  193. module.exports = require("element-ui/lib/utils/dom");
  194. /***/ }),
  195. /***/ 22:
  196. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  197. "use strict";
  198. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time.vue?vue&type=template&id=3d939089&
  199. var render = function() {
  200. var _vm = this
  201. var _h = _vm.$createElement
  202. var _c = _vm._self._c || _h
  203. return _c(
  204. "transition",
  205. {
  206. attrs: { name: "el-zoom-in-top" },
  207. on: {
  208. "after-leave": function($event) {
  209. _vm.$emit("dodestroy")
  210. }
  211. }
  212. },
  213. [
  214. _c(
  215. "div",
  216. {
  217. directives: [
  218. {
  219. name: "show",
  220. rawName: "v-show",
  221. value: _vm.visible,
  222. expression: "visible"
  223. }
  224. ],
  225. staticClass: "el-time-panel el-popper",
  226. class: _vm.popperClass
  227. },
  228. [
  229. _c(
  230. "div",
  231. {
  232. staticClass: "el-time-panel__content",
  233. class: { "has-seconds": _vm.showSeconds }
  234. },
  235. [
  236. _c("time-spinner", {
  237. ref: "spinner",
  238. attrs: {
  239. "arrow-control": _vm.useArrow,
  240. "show-seconds": _vm.showSeconds,
  241. "am-pm-mode": _vm.amPmMode,
  242. date: _vm.date
  243. },
  244. on: {
  245. change: _vm.handleChange,
  246. "select-range": _vm.setSelectionRange
  247. }
  248. })
  249. ],
  250. 1
  251. ),
  252. _c("div", { staticClass: "el-time-panel__footer" }, [
  253. _c(
  254. "button",
  255. {
  256. staticClass: "el-time-panel__btn cancel",
  257. attrs: { type: "button" },
  258. on: { click: _vm.handleCancel }
  259. },
  260. [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))]
  261. ),
  262. _c(
  263. "button",
  264. {
  265. staticClass: "el-time-panel__btn",
  266. class: { confirm: !_vm.disabled },
  267. attrs: { type: "button" },
  268. on: {
  269. click: function($event) {
  270. _vm.handleConfirm()
  271. }
  272. }
  273. },
  274. [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))]
  275. )
  276. ])
  277. ]
  278. )
  279. ]
  280. )
  281. }
  282. var staticRenderFns = []
  283. render._withStripped = true
  284. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=template&id=3d939089&
  285. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  286. var date_util_ = __webpack_require__(1);
  287. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  288. var locale_ = __webpack_require__(7);
  289. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  290. // EXTERNAL MODULE: ./packages/date-picker/src/basic/time-spinner.vue + 4 modules
  291. var time_spinner = __webpack_require__(30);
  292. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time.vue?vue&type=script&lang=js&
  293. //
  294. //
  295. //
  296. //
  297. //
  298. //
  299. //
  300. //
  301. //
  302. //
  303. //
  304. //
  305. //
  306. //
  307. //
  308. //
  309. //
  310. //
  311. //
  312. //
  313. //
  314. //
  315. //
  316. //
  317. //
  318. //
  319. //
  320. //
  321. //
  322. //
  323. //
  324. //
  325. /* harmony default export */ var timevue_type_script_lang_js_ = ({
  326. mixins: [locale_default.a],
  327. components: {
  328. TimeSpinner: time_spinner["a" /* default */]
  329. },
  330. props: {
  331. visible: Boolean,
  332. timeArrowControl: Boolean
  333. },
  334. watch: {
  335. visible: function visible(val) {
  336. var _this = this;
  337. if (val) {
  338. this.oldValue = this.value;
  339. this.$nextTick(function () {
  340. return _this.$refs.spinner.emitSelectRange('hours');
  341. });
  342. } else {
  343. this.needInitAdjust = true;
  344. }
  345. },
  346. value: function value(newVal) {
  347. var _this2 = this;
  348. var date = void 0;
  349. if (newVal instanceof Date) {
  350. date = Object(date_util_["limitTimeRange"])(newVal, this.selectableRange, this.format);
  351. } else if (!newVal) {
  352. date = this.defaultValue ? new Date(this.defaultValue) : new Date();
  353. }
  354. this.date = date;
  355. if (this.visible && this.needInitAdjust) {
  356. this.$nextTick(function (_) {
  357. return _this2.adjustSpinners();
  358. });
  359. this.needInitAdjust = false;
  360. }
  361. },
  362. selectableRange: function selectableRange(val) {
  363. this.$refs.spinner.selectableRange = val;
  364. },
  365. defaultValue: function defaultValue(val) {
  366. if (!Object(date_util_["isDate"])(this.value)) {
  367. this.date = val ? new Date(val) : new Date();
  368. }
  369. }
  370. },
  371. data: function data() {
  372. return {
  373. popperClass: '',
  374. format: 'HH:mm:ss',
  375. value: '',
  376. defaultValue: null,
  377. date: new Date(),
  378. oldValue: new Date(),
  379. selectableRange: [],
  380. selectionRange: [0, 2],
  381. disabled: false,
  382. arrowControl: false,
  383. needInitAdjust: true
  384. };
  385. },
  386. computed: {
  387. showSeconds: function showSeconds() {
  388. return (this.format || '').indexOf('ss') !== -1;
  389. },
  390. useArrow: function useArrow() {
  391. return this.arrowControl || this.timeArrowControl || false;
  392. },
  393. amPmMode: function amPmMode() {
  394. if ((this.format || '').indexOf('A') !== -1) return 'A';
  395. if ((this.format || '').indexOf('a') !== -1) return 'a';
  396. return '';
  397. }
  398. },
  399. methods: {
  400. handleCancel: function handleCancel() {
  401. this.$emit('pick', this.oldValue, false);
  402. },
  403. handleChange: function handleChange(date) {
  404. // this.visible avoids edge cases, when use scrolls during panel closing animation
  405. if (this.visible) {
  406. this.date = Object(date_util_["clearMilliseconds"])(date);
  407. // if date is out of range, do not emit
  408. if (this.isValidValue(this.date)) {
  409. this.$emit('pick', this.date, true);
  410. }
  411. }
  412. },
  413. setSelectionRange: function setSelectionRange(start, end) {
  414. this.$emit('select-range', start, end);
  415. this.selectionRange = [start, end];
  416. },
  417. handleConfirm: function handleConfirm() {
  418. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  419. var first = arguments[1];
  420. if (first) return;
  421. var date = Object(date_util_["clearMilliseconds"])(Object(date_util_["limitTimeRange"])(this.date, this.selectableRange, this.format));
  422. this.$emit('pick', date, visible, first);
  423. },
  424. handleKeydown: function handleKeydown(event) {
  425. var keyCode = event.keyCode;
  426. var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
  427. // Left or Right
  428. if (keyCode === 37 || keyCode === 39) {
  429. var step = mapping[keyCode];
  430. this.changeSelectionRange(step);
  431. event.preventDefault();
  432. return;
  433. }
  434. // Up or Down
  435. if (keyCode === 38 || keyCode === 40) {
  436. var _step = mapping[keyCode];
  437. this.$refs.spinner.scrollDown(_step);
  438. event.preventDefault();
  439. return;
  440. }
  441. },
  442. isValidValue: function isValidValue(date) {
  443. return Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format);
  444. },
  445. adjustSpinners: function adjustSpinners() {
  446. return this.$refs.spinner.adjustSpinners();
  447. },
  448. changeSelectionRange: function changeSelectionRange(step) {
  449. var list = [0, 3].concat(this.showSeconds ? [6] : []);
  450. var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
  451. var index = list.indexOf(this.selectionRange[0]);
  452. var next = (index + step + list.length) % list.length;
  453. this.$refs.spinner.emitSelectRange(mapping[next]);
  454. }
  455. },
  456. mounted: function mounted() {
  457. var _this3 = this;
  458. this.$nextTick(function () {
  459. return _this3.handleConfirm(true, true);
  460. });
  461. this.$emit('mounted');
  462. }
  463. });
  464. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=script&lang=js&
  465. /* harmony default export */ var panel_timevue_type_script_lang_js_ = (timevue_type_script_lang_js_);
  466. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  467. var componentNormalizer = __webpack_require__(0);
  468. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue
  469. /* normalize component */
  470. var component = Object(componentNormalizer["a" /* default */])(
  471. panel_timevue_type_script_lang_js_,
  472. render,
  473. staticRenderFns,
  474. false,
  475. null,
  476. null,
  477. null
  478. )
  479. /* hot reload */
  480. if (false) { var api; }
  481. component.options.__file = "packages/date-picker/src/panel/time.vue"
  482. /* harmony default export */ var time = __webpack_exports__["a"] = (component.exports);
  483. /***/ }),
  484. /***/ 25:
  485. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  486. "use strict";
  487. /* harmony import */ var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  488. /* harmony import */ var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__);
  489. /* harmony default export */ __webpack_exports__["a"] = ({
  490. bind: function bind(el, binding, vnode) {
  491. var interval = null;
  492. var startTime = void 0;
  493. var handler = function handler() {
  494. return vnode.context[binding.expression].apply();
  495. };
  496. var clear = function clear() {
  497. if (Date.now() - startTime < 100) {
  498. handler();
  499. }
  500. clearInterval(interval);
  501. interval = null;
  502. };
  503. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["on"])(el, 'mousedown', function (e) {
  504. if (e.button !== 0) return;
  505. startTime = Date.now();
  506. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["once"])(document, 'mouseup', clear);
  507. clearInterval(interval);
  508. interval = setInterval(handler, 100);
  509. });
  510. }
  511. });
  512. /***/ }),
  513. /***/ 28:
  514. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  515. "use strict";
  516. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=template&id=79ae069f&
  517. var render = function() {
  518. var _vm = this
  519. var _h = _vm.$createElement
  520. var _c = _vm._self._c || _h
  521. return !_vm.ranged
  522. ? _c(
  523. "el-input",
  524. _vm._b(
  525. {
  526. directives: [
  527. {
  528. name: "clickoutside",
  529. rawName: "v-clickoutside",
  530. value: _vm.handleClose,
  531. expression: "handleClose"
  532. }
  533. ],
  534. ref: "reference",
  535. staticClass: "el-date-editor",
  536. class: "el-date-editor--" + _vm.type,
  537. attrs: {
  538. readonly:
  539. !_vm.editable ||
  540. _vm.readonly ||
  541. _vm.type === "dates" ||
  542. _vm.type === "week",
  543. disabled: _vm.pickerDisabled,
  544. size: _vm.pickerSize,
  545. name: _vm.name,
  546. placeholder: _vm.placeholder,
  547. value: _vm.displayValue,
  548. validateEvent: false
  549. },
  550. on: {
  551. focus: _vm.handleFocus,
  552. input: function(value) {
  553. return (_vm.userInput = value)
  554. },
  555. change: _vm.handleChange
  556. },
  557. nativeOn: {
  558. keydown: function($event) {
  559. return _vm.handleKeydown($event)
  560. },
  561. mouseenter: function($event) {
  562. return _vm.handleMouseEnter($event)
  563. },
  564. mouseleave: function($event) {
  565. _vm.showClose = false
  566. }
  567. }
  568. },
  569. "el-input",
  570. _vm.firstInputId,
  571. false
  572. ),
  573. [
  574. _c("i", {
  575. staticClass: "el-input__icon",
  576. class: _vm.triggerClass,
  577. attrs: { slot: "prefix" },
  578. on: { click: _vm.handleFocus },
  579. slot: "prefix"
  580. }),
  581. _vm.haveTrigger
  582. ? _c("i", {
  583. staticClass: "el-input__icon",
  584. class: [_vm.showClose ? "" + _vm.clearIcon : ""],
  585. attrs: { slot: "suffix" },
  586. on: { click: _vm.handleClickIcon },
  587. slot: "suffix"
  588. })
  589. : _vm._e()
  590. ]
  591. )
  592. : _c(
  593. "div",
  594. {
  595. directives: [
  596. {
  597. name: "clickoutside",
  598. rawName: "v-clickoutside",
  599. value: _vm.handleClose,
  600. expression: "handleClose"
  601. }
  602. ],
  603. ref: "reference",
  604. staticClass: "el-date-editor el-range-editor el-input__inner",
  605. class: [
  606. "el-date-editor--" + _vm.type,
  607. _vm.pickerSize ? "el-range-editor--" + _vm.pickerSize : "",
  608. _vm.pickerDisabled ? "is-disabled" : "",
  609. _vm.pickerVisible ? "is-active" : ""
  610. ],
  611. on: {
  612. click: _vm.handleRangeClick,
  613. mouseenter: _vm.handleMouseEnter,
  614. mouseleave: function($event) {
  615. _vm.showClose = false
  616. },
  617. keydown: _vm.handleKeydown
  618. }
  619. },
  620. [
  621. _c("i", {
  622. class: ["el-input__icon", "el-range__icon", _vm.triggerClass]
  623. }),
  624. _c(
  625. "input",
  626. _vm._b(
  627. {
  628. staticClass: "el-range-input",
  629. attrs: {
  630. autocomplete: "off",
  631. placeholder: _vm.startPlaceholder,
  632. disabled: _vm.pickerDisabled,
  633. readonly: !_vm.editable || _vm.readonly,
  634. name: _vm.name && _vm.name[0]
  635. },
  636. domProps: { value: _vm.displayValue && _vm.displayValue[0] },
  637. on: {
  638. input: _vm.handleStartInput,
  639. change: _vm.handleStartChange,
  640. focus: _vm.handleFocus
  641. }
  642. },
  643. "input",
  644. _vm.firstInputId,
  645. false
  646. )
  647. ),
  648. _vm._t("range-separator", [
  649. _c("span", { staticClass: "el-range-separator" }, [
  650. _vm._v(_vm._s(_vm.rangeSeparator))
  651. ])
  652. ]),
  653. _c(
  654. "input",
  655. _vm._b(
  656. {
  657. staticClass: "el-range-input",
  658. attrs: {
  659. autocomplete: "off",
  660. placeholder: _vm.endPlaceholder,
  661. disabled: _vm.pickerDisabled,
  662. readonly: !_vm.editable || _vm.readonly,
  663. name: _vm.name && _vm.name[1]
  664. },
  665. domProps: { value: _vm.displayValue && _vm.displayValue[1] },
  666. on: {
  667. input: _vm.handleEndInput,
  668. change: _vm.handleEndChange,
  669. focus: _vm.handleFocus
  670. }
  671. },
  672. "input",
  673. _vm.secondInputId,
  674. false
  675. )
  676. ),
  677. _vm.haveTrigger
  678. ? _c("i", {
  679. staticClass: "el-input__icon el-range__close-icon",
  680. class: [_vm.showClose ? "" + _vm.clearIcon : ""],
  681. on: { click: _vm.handleClickIcon }
  682. })
  683. : _vm._e()
  684. ],
  685. 2
  686. )
  687. }
  688. var staticRenderFns = []
  689. render._withStripped = true
  690. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=template&id=79ae069f&
  691. // EXTERNAL MODULE: external "vue"
  692. var external_vue_ = __webpack_require__(6);
  693. var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
  694. // EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
  695. var clickoutside_ = __webpack_require__(11);
  696. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  697. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  698. var date_util_ = __webpack_require__(1);
  699. // EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
  700. var vue_popper_ = __webpack_require__(5);
  701. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  702. // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
  703. var emitter_ = __webpack_require__(3);
  704. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  705. // EXTERNAL MODULE: external "element-ui/lib/input"
  706. var input_ = __webpack_require__(9);
  707. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  708. // EXTERNAL MODULE: external "element-ui/lib/utils/merge"
  709. var merge_ = __webpack_require__(8);
  710. var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
  711. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=script&lang=js&
  712. //
  713. //
  714. //
  715. //
  716. //
  717. //
  718. //
  719. //
  720. //
  721. //
  722. //
  723. //
  724. //
  725. //
  726. //
  727. //
  728. //
  729. //
  730. //
  731. //
  732. //
  733. //
  734. //
  735. //
  736. //
  737. //
  738. //
  739. //
  740. //
  741. //
  742. //
  743. //
  744. //
  745. //
  746. //
  747. //
  748. //
  749. //
  750. //
  751. //
  752. //
  753. //
  754. //
  755. //
  756. //
  757. //
  758. //
  759. //
  760. //
  761. //
  762. //
  763. //
  764. //
  765. //
  766. //
  767. //
  768. //
  769. //
  770. //
  771. //
  772. //
  773. //
  774. //
  775. //
  776. //
  777. //
  778. //
  779. //
  780. //
  781. //
  782. //
  783. //
  784. //
  785. //
  786. //
  787. //
  788. //
  789. //
  790. //
  791. //
  792. //
  793. //
  794. //
  795. //
  796. //
  797. var NewPopper = {
  798. props: {
  799. appendToBody: vue_popper_default.a.props.appendToBody,
  800. offset: vue_popper_default.a.props.offset,
  801. boundariesPadding: vue_popper_default.a.props.boundariesPadding,
  802. arrowOffset: vue_popper_default.a.props.arrowOffset
  803. },
  804. methods: vue_popper_default.a.methods,
  805. data: function data() {
  806. return merge_default()({ visibleArrow: true }, vue_popper_default.a.data);
  807. },
  808. beforeDestroy: vue_popper_default.a.beforeDestroy
  809. };
  810. var DEFAULT_FORMATS = {
  811. date: 'yyyy-MM-dd',
  812. month: 'yyyy-MM',
  813. datetime: 'yyyy-MM-dd HH:mm:ss',
  814. time: 'HH:mm:ss',
  815. week: 'yyyywWW',
  816. timerange: 'HH:mm:ss',
  817. daterange: 'yyyy-MM-dd',
  818. monthrange: 'yyyy-MM',
  819. datetimerange: 'yyyy-MM-dd HH:mm:ss',
  820. year: 'yyyy'
  821. };
  822. var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'monthrange', 'timerange', 'datetimerange', 'dates'];
  823. var pickervue_type_script_lang_js_DATE_FORMATTER = function DATE_FORMATTER(value, format) {
  824. if (format === 'timestamp') return value.getTime();
  825. return Object(date_util_["formatDate"])(value, format);
  826. };
  827. var pickervue_type_script_lang_js_DATE_PARSER = function DATE_PARSER(text, format) {
  828. if (format === 'timestamp') return new Date(Number(text));
  829. return Object(date_util_["parseDate"])(text, format);
  830. };
  831. var RANGE_FORMATTER = function RANGE_FORMATTER(value, format) {
  832. if (Array.isArray(value) && value.length === 2) {
  833. var start = value[0];
  834. var end = value[1];
  835. if (start && end) {
  836. return [pickervue_type_script_lang_js_DATE_FORMATTER(start, format), pickervue_type_script_lang_js_DATE_FORMATTER(end, format)];
  837. }
  838. }
  839. return '';
  840. };
  841. var RANGE_PARSER = function RANGE_PARSER(array, format, separator) {
  842. if (!Array.isArray(array)) {
  843. array = array.split(separator);
  844. }
  845. if (array.length === 2) {
  846. var range1 = array[0];
  847. var range2 = array[1];
  848. return [pickervue_type_script_lang_js_DATE_PARSER(range1, format), pickervue_type_script_lang_js_DATE_PARSER(range2, format)];
  849. }
  850. return [];
  851. };
  852. var TYPE_VALUE_RESOLVER_MAP = {
  853. default: {
  854. formatter: function formatter(value) {
  855. if (!value) return '';
  856. return '' + value;
  857. },
  858. parser: function parser(text) {
  859. if (text === undefined || text === '') return null;
  860. return text;
  861. }
  862. },
  863. week: {
  864. formatter: function formatter(value, format) {
  865. var week = Object(date_util_["getWeekNumber"])(value);
  866. var month = value.getMonth();
  867. var trueDate = new Date(value);
  868. if (week === 1 && month === 11) {
  869. trueDate.setHours(0, 0, 0, 0);
  870. trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
  871. }
  872. var date = Object(date_util_["formatDate"])(trueDate, format);
  873. date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
  874. return date;
  875. },
  876. parser: function parser(text, format) {
  877. // parse as if a normal date
  878. return TYPE_VALUE_RESOLVER_MAP.date.parser(text, format);
  879. }
  880. },
  881. date: {
  882. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  883. parser: pickervue_type_script_lang_js_DATE_PARSER
  884. },
  885. datetime: {
  886. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  887. parser: pickervue_type_script_lang_js_DATE_PARSER
  888. },
  889. daterange: {
  890. formatter: RANGE_FORMATTER,
  891. parser: RANGE_PARSER
  892. },
  893. monthrange: {
  894. formatter: RANGE_FORMATTER,
  895. parser: RANGE_PARSER
  896. },
  897. datetimerange: {
  898. formatter: RANGE_FORMATTER,
  899. parser: RANGE_PARSER
  900. },
  901. timerange: {
  902. formatter: RANGE_FORMATTER,
  903. parser: RANGE_PARSER
  904. },
  905. time: {
  906. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  907. parser: pickervue_type_script_lang_js_DATE_PARSER
  908. },
  909. month: {
  910. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  911. parser: pickervue_type_script_lang_js_DATE_PARSER
  912. },
  913. year: {
  914. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  915. parser: pickervue_type_script_lang_js_DATE_PARSER
  916. },
  917. number: {
  918. formatter: function formatter(value) {
  919. if (!value) return '';
  920. return '' + value;
  921. },
  922. parser: function parser(text) {
  923. var result = Number(text);
  924. if (!isNaN(text)) {
  925. return result;
  926. } else {
  927. return null;
  928. }
  929. }
  930. },
  931. dates: {
  932. formatter: function formatter(value, format) {
  933. return value.map(function (date) {
  934. return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
  935. });
  936. },
  937. parser: function parser(value, format) {
  938. return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
  939. return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
  940. });
  941. }
  942. }
  943. };
  944. var PLACEMENT_MAP = {
  945. left: 'bottom-start',
  946. center: 'bottom',
  947. right: 'bottom-end'
  948. };
  949. var parseAsFormatAndType = function parseAsFormatAndType(value, customFormat, type) {
  950. var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
  951. if (!value) return null;
  952. var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
  953. var format = customFormat || DEFAULT_FORMATS[type];
  954. return parser(value, format, rangeSeparator);
  955. };
  956. var formatAsFormatAndType = function formatAsFormatAndType(value, customFormat, type) {
  957. if (!value) return null;
  958. var formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
  959. var format = customFormat || DEFAULT_FORMATS[type];
  960. return formatter(value, format);
  961. };
  962. /*
  963. * Considers:
  964. * 1. Date object
  965. * 2. date string
  966. * 3. array of 1 or 2
  967. */
  968. var valueEquals = function valueEquals(a, b) {
  969. // considers Date object and string
  970. var dateEquals = function dateEquals(a, b) {
  971. var aIsDate = a instanceof Date;
  972. var bIsDate = b instanceof Date;
  973. if (aIsDate && bIsDate) {
  974. return a.getTime() === b.getTime();
  975. }
  976. if (!aIsDate && !bIsDate) {
  977. return a === b;
  978. }
  979. return false;
  980. };
  981. var aIsArray = a instanceof Array;
  982. var bIsArray = b instanceof Array;
  983. if (aIsArray && bIsArray) {
  984. if (a.length !== b.length) {
  985. return false;
  986. }
  987. return a.every(function (item, index) {
  988. return dateEquals(item, b[index]);
  989. });
  990. }
  991. if (!aIsArray && !bIsArray) {
  992. return dateEquals(a, b);
  993. }
  994. return false;
  995. };
  996. var isString = function isString(val) {
  997. return typeof val === 'string' || val instanceof String;
  998. };
  999. var validator = function validator(val) {
  1000. // either: String, Array of String, null / undefined
  1001. return val === null || val === undefined || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
  1002. };
  1003. /* harmony default export */ var pickervue_type_script_lang_js_ = ({
  1004. mixins: [emitter_default.a, NewPopper],
  1005. inject: {
  1006. elForm: {
  1007. default: ''
  1008. },
  1009. elFormItem: {
  1010. default: ''
  1011. }
  1012. },
  1013. props: {
  1014. size: String,
  1015. format: String,
  1016. valueFormat: String,
  1017. readonly: Boolean,
  1018. placeholder: String,
  1019. startPlaceholder: String,
  1020. endPlaceholder: String,
  1021. prefixIcon: String,
  1022. clearIcon: {
  1023. type: String,
  1024. default: 'el-icon-circle-close'
  1025. },
  1026. name: {
  1027. default: '',
  1028. validator: validator
  1029. },
  1030. disabled: Boolean,
  1031. clearable: {
  1032. type: Boolean,
  1033. default: true
  1034. },
  1035. id: {
  1036. default: '',
  1037. validator: validator
  1038. },
  1039. popperClass: String,
  1040. editable: {
  1041. type: Boolean,
  1042. default: true
  1043. },
  1044. align: {
  1045. type: String,
  1046. default: 'left'
  1047. },
  1048. value: {},
  1049. defaultValue: {},
  1050. defaultTime: {},
  1051. rangeSeparator: {
  1052. default: '-'
  1053. },
  1054. pickerOptions: {},
  1055. unlinkPanels: Boolean,
  1056. validateEvent: {
  1057. type: Boolean,
  1058. default: true
  1059. }
  1060. },
  1061. components: { ElInput: input_default.a },
  1062. directives: { Clickoutside: clickoutside_default.a },
  1063. data: function data() {
  1064. return {
  1065. pickerVisible: false,
  1066. showClose: false,
  1067. userInput: null,
  1068. valueOnOpen: null, // value when picker opens, used to determine whether to emit change
  1069. unwatchPickerOptions: null
  1070. };
  1071. },
  1072. watch: {
  1073. pickerVisible: function pickerVisible(val) {
  1074. if (this.readonly || this.pickerDisabled) return;
  1075. if (val) {
  1076. this.showPicker();
  1077. this.valueOnOpen = Array.isArray(this.value) ? [].concat(this.value) : this.value;
  1078. } else {
  1079. this.hidePicker();
  1080. this.emitChange(this.value);
  1081. this.userInput = null;
  1082. if (this.validateEvent) {
  1083. this.dispatch('ElFormItem', 'el.form.blur');
  1084. }
  1085. this.$emit('blur', this);
  1086. this.blur();
  1087. }
  1088. },
  1089. parsedValue: {
  1090. immediate: true,
  1091. handler: function handler(val) {
  1092. if (this.picker) {
  1093. this.picker.value = val;
  1094. }
  1095. }
  1096. },
  1097. defaultValue: function defaultValue(val) {
  1098. // NOTE: should eventually move to jsx style picker + panel ?
  1099. if (this.picker) {
  1100. this.picker.defaultValue = val;
  1101. }
  1102. },
  1103. value: function value(val, oldVal) {
  1104. if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
  1105. this.dispatch('ElFormItem', 'el.form.change', val);
  1106. }
  1107. }
  1108. },
  1109. computed: {
  1110. ranged: function ranged() {
  1111. return this.type.indexOf('range') > -1;
  1112. },
  1113. reference: function reference() {
  1114. var reference = this.$refs.reference;
  1115. return reference.$el || reference;
  1116. },
  1117. refInput: function refInput() {
  1118. if (this.reference) {
  1119. return [].slice.call(this.reference.querySelectorAll('input'));
  1120. }
  1121. return [];
  1122. },
  1123. valueIsEmpty: function valueIsEmpty() {
  1124. var val = this.value;
  1125. if (Array.isArray(val)) {
  1126. for (var i = 0, len = val.length; i < len; i++) {
  1127. if (val[i]) {
  1128. return false;
  1129. }
  1130. }
  1131. } else {
  1132. if (val) {
  1133. return false;
  1134. }
  1135. }
  1136. return true;
  1137. },
  1138. triggerClass: function triggerClass() {
  1139. return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
  1140. },
  1141. selectionMode: function selectionMode() {
  1142. if (this.type === 'week') {
  1143. return 'week';
  1144. } else if (this.type === 'month') {
  1145. return 'month';
  1146. } else if (this.type === 'year') {
  1147. return 'year';
  1148. } else if (this.type === 'dates') {
  1149. return 'dates';
  1150. }
  1151. return 'day';
  1152. },
  1153. haveTrigger: function haveTrigger() {
  1154. if (typeof this.showTrigger !== 'undefined') {
  1155. return this.showTrigger;
  1156. }
  1157. return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
  1158. },
  1159. displayValue: function displayValue() {
  1160. var formattedValue = formatAsFormatAndType(this.parsedValue, this.format, this.type, this.rangeSeparator);
  1161. if (Array.isArray(this.userInput)) {
  1162. return [this.userInput[0] || formattedValue && formattedValue[0] || '', this.userInput[1] || formattedValue && formattedValue[1] || ''];
  1163. } else if (this.userInput !== null) {
  1164. return this.userInput;
  1165. } else if (formattedValue) {
  1166. return this.type === 'dates' ? formattedValue.join(', ') : formattedValue;
  1167. } else {
  1168. return '';
  1169. }
  1170. },
  1171. parsedValue: function parsedValue() {
  1172. if (!this.value) return this.value; // component value is not set
  1173. if (this.type === 'time-select') return this.value; // time-select does not require parsing, this might change in next major version
  1174. var valueIsDateObject = Object(date_util_["isDateObject"])(this.value) || Array.isArray(this.value) && this.value.every(date_util_["isDateObject"]);
  1175. if (valueIsDateObject) {
  1176. return this.value;
  1177. }
  1178. if (this.valueFormat) {
  1179. return parseAsFormatAndType(this.value, this.valueFormat, this.type, this.rangeSeparator) || this.value;
  1180. }
  1181. // NOTE: deal with common but incorrect usage, should remove in next major version
  1182. // user might provide string / timestamp without value-format, coerce them into date (or array of date)
  1183. return Array.isArray(this.value) ? this.value.map(function (val) {
  1184. return new Date(val);
  1185. }) : new Date(this.value);
  1186. },
  1187. _elFormItemSize: function _elFormItemSize() {
  1188. return (this.elFormItem || {}).elFormItemSize;
  1189. },
  1190. pickerSize: function pickerSize() {
  1191. return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  1192. },
  1193. pickerDisabled: function pickerDisabled() {
  1194. return this.disabled || (this.elForm || {}).disabled;
  1195. },
  1196. firstInputId: function firstInputId() {
  1197. var obj = {};
  1198. var id = void 0;
  1199. if (this.ranged) {
  1200. id = this.id && this.id[0];
  1201. } else {
  1202. id = this.id;
  1203. }
  1204. if (id) obj.id = id;
  1205. return obj;
  1206. },
  1207. secondInputId: function secondInputId() {
  1208. var obj = {};
  1209. var id = void 0;
  1210. if (this.ranged) {
  1211. id = this.id && this.id[1];
  1212. }
  1213. if (id) obj.id = id;
  1214. return obj;
  1215. }
  1216. },
  1217. created: function created() {
  1218. // vue-popper
  1219. this.popperOptions = {
  1220. boundariesPadding: 0,
  1221. gpuAcceleration: false
  1222. };
  1223. this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
  1224. this.$on('fieldReset', this.handleFieldReset);
  1225. },
  1226. methods: {
  1227. focus: function focus() {
  1228. if (!this.ranged) {
  1229. this.$refs.reference.focus();
  1230. } else {
  1231. this.handleFocus();
  1232. }
  1233. },
  1234. blur: function blur() {
  1235. this.refInput.forEach(function (input) {
  1236. return input.blur();
  1237. });
  1238. },
  1239. // {parse, formatTo} Value deals maps component value with internal Date
  1240. parseValue: function parseValue(value) {
  1241. var isParsed = Object(date_util_["isDateObject"])(value) || Array.isArray(value) && value.every(date_util_["isDateObject"]);
  1242. if (this.valueFormat && !isParsed) {
  1243. return parseAsFormatAndType(value, this.valueFormat, this.type, this.rangeSeparator) || value;
  1244. } else {
  1245. return value;
  1246. }
  1247. },
  1248. formatToValue: function formatToValue(date) {
  1249. var isFormattable = Object(date_util_["isDateObject"])(date) || Array.isArray(date) && date.every(date_util_["isDateObject"]);
  1250. if (this.valueFormat && isFormattable) {
  1251. return formatAsFormatAndType(date, this.valueFormat, this.type, this.rangeSeparator);
  1252. } else {
  1253. return date;
  1254. }
  1255. },
  1256. // {parse, formatTo} String deals with user input
  1257. parseString: function parseString(value) {
  1258. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1259. return parseAsFormatAndType(value, this.format, type);
  1260. },
  1261. formatToString: function formatToString(value) {
  1262. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1263. return formatAsFormatAndType(value, this.format, type);
  1264. },
  1265. handleMouseEnter: function handleMouseEnter() {
  1266. if (this.readonly || this.pickerDisabled) return;
  1267. if (!this.valueIsEmpty && this.clearable) {
  1268. this.showClose = true;
  1269. }
  1270. },
  1271. handleChange: function handleChange() {
  1272. if (this.userInput) {
  1273. var value = this.parseString(this.displayValue);
  1274. if (value) {
  1275. this.picker.value = value;
  1276. if (this.isValidValue(value)) {
  1277. this.emitInput(value);
  1278. this.userInput = null;
  1279. }
  1280. }
  1281. }
  1282. if (this.userInput === '') {
  1283. this.emitInput(null);
  1284. this.emitChange(null);
  1285. this.userInput = null;
  1286. }
  1287. },
  1288. handleStartInput: function handleStartInput(event) {
  1289. if (this.userInput) {
  1290. this.userInput = [event.target.value, this.userInput[1]];
  1291. } else {
  1292. this.userInput = [event.target.value, null];
  1293. }
  1294. },
  1295. handleEndInput: function handleEndInput(event) {
  1296. if (this.userInput) {
  1297. this.userInput = [this.userInput[0], event.target.value];
  1298. } else {
  1299. this.userInput = [null, event.target.value];
  1300. }
  1301. },
  1302. handleStartChange: function handleStartChange(event) {
  1303. var value = this.parseString(this.userInput && this.userInput[0]);
  1304. if (value) {
  1305. this.userInput = [this.formatToString(value), this.displayValue[1]];
  1306. var newValue = [value, this.picker.value && this.picker.value[1]];
  1307. this.picker.value = newValue;
  1308. if (this.isValidValue(newValue)) {
  1309. this.emitInput(newValue);
  1310. this.userInput = null;
  1311. }
  1312. }
  1313. },
  1314. handleEndChange: function handleEndChange(event) {
  1315. var value = this.parseString(this.userInput && this.userInput[1]);
  1316. if (value) {
  1317. this.userInput = [this.displayValue[0], this.formatToString(value)];
  1318. var newValue = [this.picker.value && this.picker.value[0], value];
  1319. this.picker.value = newValue;
  1320. if (this.isValidValue(newValue)) {
  1321. this.emitInput(newValue);
  1322. this.userInput = null;
  1323. }
  1324. }
  1325. },
  1326. handleClickIcon: function handleClickIcon(event) {
  1327. if (this.readonly || this.pickerDisabled) return;
  1328. if (this.showClose) {
  1329. this.valueOnOpen = this.value;
  1330. event.stopPropagation();
  1331. this.emitInput(null);
  1332. this.emitChange(null);
  1333. this.showClose = false;
  1334. if (this.picker && typeof this.picker.handleClear === 'function') {
  1335. this.picker.handleClear();
  1336. }
  1337. } else {
  1338. this.pickerVisible = !this.pickerVisible;
  1339. }
  1340. },
  1341. handleClose: function handleClose() {
  1342. if (!this.pickerVisible) return;
  1343. this.pickerVisible = false;
  1344. if (this.type === 'dates') {
  1345. // restore to former value
  1346. var oldValue = parseAsFormatAndType(this.valueOnOpen, this.valueFormat, this.type, this.rangeSeparator) || this.valueOnOpen;
  1347. this.emitInput(oldValue);
  1348. }
  1349. },
  1350. handleFieldReset: function handleFieldReset(initialValue) {
  1351. this.userInput = initialValue === '' ? null : initialValue;
  1352. },
  1353. handleFocus: function handleFocus() {
  1354. var type = this.type;
  1355. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1356. this.pickerVisible = true;
  1357. }
  1358. this.$emit('focus', this);
  1359. },
  1360. handleKeydown: function handleKeydown(event) {
  1361. var _this = this;
  1362. var keyCode = event.keyCode;
  1363. // ESC
  1364. if (keyCode === 27) {
  1365. this.pickerVisible = false;
  1366. event.stopPropagation();
  1367. return;
  1368. }
  1369. // Tab
  1370. if (keyCode === 9) {
  1371. if (!this.ranged) {
  1372. this.handleChange();
  1373. this.pickerVisible = this.picker.visible = false;
  1374. this.blur();
  1375. event.stopPropagation();
  1376. } else {
  1377. // user may change focus between two input
  1378. setTimeout(function () {
  1379. if (_this.refInput.indexOf(document.activeElement) === -1) {
  1380. _this.pickerVisible = false;
  1381. _this.blur();
  1382. event.stopPropagation();
  1383. }
  1384. }, 0);
  1385. }
  1386. return;
  1387. }
  1388. // Enter
  1389. if (keyCode === 13) {
  1390. if (this.userInput === '' || this.isValidValue(this.parseString(this.displayValue))) {
  1391. this.handleChange();
  1392. this.pickerVisible = this.picker.visible = false;
  1393. this.blur();
  1394. }
  1395. event.stopPropagation();
  1396. return;
  1397. }
  1398. // if user is typing, do not let picker handle key input
  1399. if (this.userInput) {
  1400. event.stopPropagation();
  1401. return;
  1402. }
  1403. // delegate other keys to panel
  1404. if (this.picker && this.picker.handleKeydown) {
  1405. this.picker.handleKeydown(event);
  1406. }
  1407. },
  1408. handleRangeClick: function handleRangeClick() {
  1409. var type = this.type;
  1410. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1411. this.pickerVisible = true;
  1412. }
  1413. this.$emit('focus', this);
  1414. },
  1415. hidePicker: function hidePicker() {
  1416. if (this.picker) {
  1417. this.picker.resetView && this.picker.resetView();
  1418. this.pickerVisible = this.picker.visible = false;
  1419. this.destroyPopper();
  1420. }
  1421. },
  1422. showPicker: function showPicker() {
  1423. var _this2 = this;
  1424. if (this.$isServer) return;
  1425. if (!this.picker) {
  1426. this.mountPicker();
  1427. }
  1428. this.pickerVisible = this.picker.visible = true;
  1429. this.updatePopper();
  1430. this.picker.value = this.parsedValue;
  1431. this.picker.resetView && this.picker.resetView();
  1432. this.$nextTick(function () {
  1433. _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
  1434. });
  1435. },
  1436. mountPicker: function mountPicker() {
  1437. var _this3 = this;
  1438. this.picker = new external_vue_default.a(this.panel).$mount();
  1439. this.picker.defaultValue = this.defaultValue;
  1440. this.picker.defaultTime = this.defaultTime;
  1441. this.picker.popperClass = this.popperClass;
  1442. this.popperElm = this.picker.$el;
  1443. this.picker.width = this.reference.getBoundingClientRect().width;
  1444. this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
  1445. this.picker.selectionMode = this.selectionMode;
  1446. this.picker.unlinkPanels = this.unlinkPanels;
  1447. this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
  1448. this.$watch('format', function (format) {
  1449. _this3.picker.format = format;
  1450. });
  1451. var updateOptions = function updateOptions() {
  1452. var options = _this3.pickerOptions;
  1453. if (options && options.selectableRange) {
  1454. var ranges = options.selectableRange;
  1455. var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
  1456. var format = DEFAULT_FORMATS.timerange;
  1457. ranges = Array.isArray(ranges) ? ranges : [ranges];
  1458. _this3.picker.selectableRange = ranges.map(function (range) {
  1459. return parser(range, format, _this3.rangeSeparator);
  1460. });
  1461. }
  1462. for (var option in options) {
  1463. if (options.hasOwnProperty(option) &&
  1464. // 忽略 time-picker 的该配置项
  1465. option !== 'selectableRange') {
  1466. _this3.picker[option] = options[option];
  1467. }
  1468. }
  1469. // main format must prevail over undocumented pickerOptions.format
  1470. if (_this3.format) {
  1471. _this3.picker.format = _this3.format;
  1472. }
  1473. };
  1474. updateOptions();
  1475. this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
  1476. return updateOptions();
  1477. }, { deep: true });
  1478. this.$el.appendChild(this.picker.$el);
  1479. this.picker.resetView && this.picker.resetView();
  1480. this.picker.$on('dodestroy', this.doDestroy);
  1481. this.picker.$on('pick', function () {
  1482. var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  1483. var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1484. _this3.userInput = null;
  1485. _this3.pickerVisible = _this3.picker.visible = visible;
  1486. _this3.emitInput(date);
  1487. _this3.picker.resetView && _this3.picker.resetView();
  1488. });
  1489. this.picker.$on('select-range', function (start, end, pos) {
  1490. if (_this3.refInput.length === 0) return;
  1491. if (!pos || pos === 'min') {
  1492. _this3.refInput[0].setSelectionRange(start, end);
  1493. _this3.refInput[0].focus();
  1494. } else if (pos === 'max') {
  1495. _this3.refInput[1].setSelectionRange(start, end);
  1496. _this3.refInput[1].focus();
  1497. }
  1498. });
  1499. },
  1500. unmountPicker: function unmountPicker() {
  1501. if (this.picker) {
  1502. this.picker.$destroy();
  1503. this.picker.$off();
  1504. if (typeof this.unwatchPickerOptions === 'function') {
  1505. this.unwatchPickerOptions();
  1506. }
  1507. this.picker.$el.parentNode.removeChild(this.picker.$el);
  1508. }
  1509. },
  1510. emitChange: function emitChange(val) {
  1511. // determine user real change only
  1512. if (!valueEquals(val, this.valueOnOpen)) {
  1513. this.$emit('change', val);
  1514. this.valueOnOpen = val;
  1515. if (this.validateEvent) {
  1516. this.dispatch('ElFormItem', 'el.form.change', val);
  1517. }
  1518. }
  1519. },
  1520. emitInput: function emitInput(val) {
  1521. var formatted = this.formatToValue(val);
  1522. if (!valueEquals(this.value, formatted)) {
  1523. this.$emit('input', formatted);
  1524. }
  1525. },
  1526. isValidValue: function isValidValue(value) {
  1527. if (!this.picker) {
  1528. this.mountPicker();
  1529. }
  1530. if (this.picker.isValidValue) {
  1531. return value && this.picker.isValidValue(value);
  1532. } else {
  1533. return true;
  1534. }
  1535. }
  1536. }
  1537. });
  1538. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=script&lang=js&
  1539. /* harmony default export */ var src_pickervue_type_script_lang_js_ = (pickervue_type_script_lang_js_);
  1540. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1541. var componentNormalizer = __webpack_require__(0);
  1542. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue
  1543. /* normalize component */
  1544. var component = Object(componentNormalizer["a" /* default */])(
  1545. src_pickervue_type_script_lang_js_,
  1546. render,
  1547. staticRenderFns,
  1548. false,
  1549. null,
  1550. null,
  1551. null
  1552. )
  1553. /* hot reload */
  1554. if (false) { var api; }
  1555. component.options.__file = "packages/date-picker/src/picker.vue"
  1556. /* harmony default export */ var picker = __webpack_exports__["a"] = (component.exports);
  1557. /***/ }),
  1558. /***/ 3:
  1559. /***/ (function(module, exports) {
  1560. module.exports = require("element-ui/lib/mixins/emitter");
  1561. /***/ }),
  1562. /***/ 30:
  1563. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1564. "use strict";
  1565. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=1facadeb&
  1566. var render = function() {
  1567. var _vm = this
  1568. var _h = _vm.$createElement
  1569. var _c = _vm._self._c || _h
  1570. return _c(
  1571. "div",
  1572. {
  1573. staticClass: "el-time-spinner",
  1574. class: { "has-seconds": _vm.showSeconds }
  1575. },
  1576. [
  1577. !_vm.arrowControl
  1578. ? [
  1579. _c(
  1580. "el-scrollbar",
  1581. {
  1582. ref: "hours",
  1583. staticClass: "el-time-spinner__wrapper",
  1584. attrs: {
  1585. "wrap-style": "max-height: inherit;",
  1586. "view-class": "el-time-spinner__list",
  1587. noresize: "",
  1588. tag: "ul"
  1589. },
  1590. nativeOn: {
  1591. mouseenter: function($event) {
  1592. _vm.emitSelectRange("hours")
  1593. },
  1594. mousemove: function($event) {
  1595. _vm.adjustCurrentSpinner("hours")
  1596. }
  1597. }
  1598. },
  1599. _vm._l(_vm.hoursList, function(disabled, hour) {
  1600. return _c(
  1601. "li",
  1602. {
  1603. key: hour,
  1604. staticClass: "el-time-spinner__item",
  1605. class: { active: hour === _vm.hours, disabled: disabled },
  1606. on: {
  1607. click: function($event) {
  1608. _vm.handleClick("hours", {
  1609. value: hour,
  1610. disabled: disabled
  1611. })
  1612. }
  1613. }
  1614. },
  1615. [
  1616. _vm._v(
  1617. _vm._s(
  1618. ("0" + (_vm.amPmMode ? hour % 12 || 12 : hour)).slice(
  1619. -2
  1620. )
  1621. ) + _vm._s(_vm.amPm(hour))
  1622. )
  1623. ]
  1624. )
  1625. }),
  1626. 0
  1627. ),
  1628. _c(
  1629. "el-scrollbar",
  1630. {
  1631. ref: "minutes",
  1632. staticClass: "el-time-spinner__wrapper",
  1633. attrs: {
  1634. "wrap-style": "max-height: inherit;",
  1635. "view-class": "el-time-spinner__list",
  1636. noresize: "",
  1637. tag: "ul"
  1638. },
  1639. nativeOn: {
  1640. mouseenter: function($event) {
  1641. _vm.emitSelectRange("minutes")
  1642. },
  1643. mousemove: function($event) {
  1644. _vm.adjustCurrentSpinner("minutes")
  1645. }
  1646. }
  1647. },
  1648. _vm._l(_vm.minutesList, function(enabled, key) {
  1649. return _c(
  1650. "li",
  1651. {
  1652. key: key,
  1653. staticClass: "el-time-spinner__item",
  1654. class: { active: key === _vm.minutes, disabled: !enabled },
  1655. on: {
  1656. click: function($event) {
  1657. _vm.handleClick("minutes", {
  1658. value: key,
  1659. disabled: false
  1660. })
  1661. }
  1662. }
  1663. },
  1664. [_vm._v(_vm._s(("0" + key).slice(-2)))]
  1665. )
  1666. }),
  1667. 0
  1668. ),
  1669. _c(
  1670. "el-scrollbar",
  1671. {
  1672. directives: [
  1673. {
  1674. name: "show",
  1675. rawName: "v-show",
  1676. value: _vm.showSeconds,
  1677. expression: "showSeconds"
  1678. }
  1679. ],
  1680. ref: "seconds",
  1681. staticClass: "el-time-spinner__wrapper",
  1682. attrs: {
  1683. "wrap-style": "max-height: inherit;",
  1684. "view-class": "el-time-spinner__list",
  1685. noresize: "",
  1686. tag: "ul"
  1687. },
  1688. nativeOn: {
  1689. mouseenter: function($event) {
  1690. _vm.emitSelectRange("seconds")
  1691. },
  1692. mousemove: function($event) {
  1693. _vm.adjustCurrentSpinner("seconds")
  1694. }
  1695. }
  1696. },
  1697. _vm._l(60, function(second, key) {
  1698. return _c(
  1699. "li",
  1700. {
  1701. key: key,
  1702. staticClass: "el-time-spinner__item",
  1703. class: { active: key === _vm.seconds },
  1704. on: {
  1705. click: function($event) {
  1706. _vm.handleClick("seconds", {
  1707. value: key,
  1708. disabled: false
  1709. })
  1710. }
  1711. }
  1712. },
  1713. [_vm._v(_vm._s(("0" + key).slice(-2)))]
  1714. )
  1715. }),
  1716. 0
  1717. )
  1718. ]
  1719. : _vm._e(),
  1720. _vm.arrowControl
  1721. ? [
  1722. _c(
  1723. "div",
  1724. {
  1725. staticClass: "el-time-spinner__wrapper is-arrow",
  1726. on: {
  1727. mouseenter: function($event) {
  1728. _vm.emitSelectRange("hours")
  1729. }
  1730. }
  1731. },
  1732. [
  1733. _c("i", {
  1734. directives: [
  1735. {
  1736. name: "repeat-click",
  1737. rawName: "v-repeat-click",
  1738. value: _vm.decrease,
  1739. expression: "decrease"
  1740. }
  1741. ],
  1742. staticClass: "el-time-spinner__arrow el-icon-arrow-up"
  1743. }),
  1744. _c("i", {
  1745. directives: [
  1746. {
  1747. name: "repeat-click",
  1748. rawName: "v-repeat-click",
  1749. value: _vm.increase,
  1750. expression: "increase"
  1751. }
  1752. ],
  1753. staticClass: "el-time-spinner__arrow el-icon-arrow-down"
  1754. }),
  1755. _c(
  1756. "ul",
  1757. { ref: "hours", staticClass: "el-time-spinner__list" },
  1758. _vm._l(_vm.arrowHourList, function(hour, key) {
  1759. return _c(
  1760. "li",
  1761. {
  1762. key: key,
  1763. staticClass: "el-time-spinner__item",
  1764. class: {
  1765. active: hour === _vm.hours,
  1766. disabled: _vm.hoursList[hour]
  1767. }
  1768. },
  1769. [
  1770. _vm._v(
  1771. _vm._s(
  1772. hour === undefined
  1773. ? ""
  1774. : (
  1775. "0" + (_vm.amPmMode ? hour % 12 || 12 : hour)
  1776. ).slice(-2) + _vm.amPm(hour)
  1777. )
  1778. )
  1779. ]
  1780. )
  1781. }),
  1782. 0
  1783. )
  1784. ]
  1785. ),
  1786. _c(
  1787. "div",
  1788. {
  1789. staticClass: "el-time-spinner__wrapper is-arrow",
  1790. on: {
  1791. mouseenter: function($event) {
  1792. _vm.emitSelectRange("minutes")
  1793. }
  1794. }
  1795. },
  1796. [
  1797. _c("i", {
  1798. directives: [
  1799. {
  1800. name: "repeat-click",
  1801. rawName: "v-repeat-click",
  1802. value: _vm.decrease,
  1803. expression: "decrease"
  1804. }
  1805. ],
  1806. staticClass: "el-time-spinner__arrow el-icon-arrow-up"
  1807. }),
  1808. _c("i", {
  1809. directives: [
  1810. {
  1811. name: "repeat-click",
  1812. rawName: "v-repeat-click",
  1813. value: _vm.increase,
  1814. expression: "increase"
  1815. }
  1816. ],
  1817. staticClass: "el-time-spinner__arrow el-icon-arrow-down"
  1818. }),
  1819. _c(
  1820. "ul",
  1821. { ref: "minutes", staticClass: "el-time-spinner__list" },
  1822. _vm._l(_vm.arrowMinuteList, function(minute, key) {
  1823. return _c(
  1824. "li",
  1825. {
  1826. key: key,
  1827. staticClass: "el-time-spinner__item",
  1828. class: { active: minute === _vm.minutes }
  1829. },
  1830. [
  1831. _vm._v(
  1832. "\n " +
  1833. _vm._s(
  1834. minute === undefined
  1835. ? ""
  1836. : ("0" + minute).slice(-2)
  1837. ) +
  1838. "\n "
  1839. )
  1840. ]
  1841. )
  1842. }),
  1843. 0
  1844. )
  1845. ]
  1846. ),
  1847. _vm.showSeconds
  1848. ? _c(
  1849. "div",
  1850. {
  1851. staticClass: "el-time-spinner__wrapper is-arrow",
  1852. on: {
  1853. mouseenter: function($event) {
  1854. _vm.emitSelectRange("seconds")
  1855. }
  1856. }
  1857. },
  1858. [
  1859. _c("i", {
  1860. directives: [
  1861. {
  1862. name: "repeat-click",
  1863. rawName: "v-repeat-click",
  1864. value: _vm.decrease,
  1865. expression: "decrease"
  1866. }
  1867. ],
  1868. staticClass: "el-time-spinner__arrow el-icon-arrow-up"
  1869. }),
  1870. _c("i", {
  1871. directives: [
  1872. {
  1873. name: "repeat-click",
  1874. rawName: "v-repeat-click",
  1875. value: _vm.increase,
  1876. expression: "increase"
  1877. }
  1878. ],
  1879. staticClass: "el-time-spinner__arrow el-icon-arrow-down"
  1880. }),
  1881. _c(
  1882. "ul",
  1883. { ref: "seconds", staticClass: "el-time-spinner__list" },
  1884. _vm._l(_vm.arrowSecondList, function(second, key) {
  1885. return _c(
  1886. "li",
  1887. {
  1888. key: key,
  1889. staticClass: "el-time-spinner__item",
  1890. class: { active: second === _vm.seconds }
  1891. },
  1892. [
  1893. _vm._v(
  1894. "\n " +
  1895. _vm._s(
  1896. second === undefined
  1897. ? ""
  1898. : ("0" + second).slice(-2)
  1899. ) +
  1900. "\n "
  1901. )
  1902. ]
  1903. )
  1904. }),
  1905. 0
  1906. )
  1907. ]
  1908. )
  1909. : _vm._e()
  1910. ]
  1911. : _vm._e()
  1912. ],
  1913. 2
  1914. )
  1915. }
  1916. var staticRenderFns = []
  1917. render._withStripped = true
  1918. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=1facadeb&
  1919. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  1920. var date_util_ = __webpack_require__(1);
  1921. // EXTERNAL MODULE: external "element-ui/lib/scrollbar"
  1922. var scrollbar_ = __webpack_require__(17);
  1923. var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
  1924. // EXTERNAL MODULE: ./src/directives/repeat-click.js
  1925. var repeat_click = __webpack_require__(25);
  1926. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/time-spinner.vue?vue&type=script&lang=js&
  1927. //
  1928. //
  1929. //
  1930. //
  1931. //
  1932. //
  1933. //
  1934. //
  1935. //
  1936. //
  1937. //
  1938. //
  1939. //
  1940. //
  1941. //
  1942. //
  1943. //
  1944. //
  1945. //
  1946. //
  1947. //
  1948. //
  1949. //
  1950. //
  1951. //
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. //
  1962. //
  1963. //
  1964. //
  1965. //
  1966. //
  1967. //
  1968. //
  1969. //
  1970. //
  1971. //
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. //
  1995. //
  1996. //
  1997. //
  1998. //
  1999. //
  2000. //
  2001. //
  2002. //
  2003. //
  2004. //
  2005. //
  2006. //
  2007. //
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. //
  2016. //
  2017. //
  2018. //
  2019. //
  2020. //
  2021. //
  2022. //
  2023. //
  2024. //
  2025. //
  2026. //
  2027. //
  2028. //
  2029. /* harmony default export */ var time_spinnervue_type_script_lang_js_ = ({
  2030. components: { ElScrollbar: scrollbar_default.a },
  2031. directives: {
  2032. repeatClick: repeat_click["a" /* default */]
  2033. },
  2034. props: {
  2035. date: {},
  2036. defaultValue: {}, // reserved for future use
  2037. showSeconds: {
  2038. type: Boolean,
  2039. default: true
  2040. },
  2041. arrowControl: Boolean,
  2042. amPmMode: {
  2043. type: String,
  2044. default: '' // 'a': am/pm; 'A': AM/PM
  2045. }
  2046. },
  2047. computed: {
  2048. hours: function hours() {
  2049. return this.date.getHours();
  2050. },
  2051. minutes: function minutes() {
  2052. return this.date.getMinutes();
  2053. },
  2054. seconds: function seconds() {
  2055. return this.date.getSeconds();
  2056. },
  2057. hoursList: function hoursList() {
  2058. return Object(date_util_["getRangeHours"])(this.selectableRange);
  2059. },
  2060. minutesList: function minutesList() {
  2061. return Object(date_util_["getRangeMinutes"])(this.selectableRange, this.hours);
  2062. },
  2063. arrowHourList: function arrowHourList() {
  2064. var hours = this.hours;
  2065. return [hours > 0 ? hours - 1 : undefined, hours, hours < 23 ? hours + 1 : undefined];
  2066. },
  2067. arrowMinuteList: function arrowMinuteList() {
  2068. var minutes = this.minutes;
  2069. return [minutes > 0 ? minutes - 1 : undefined, minutes, minutes < 59 ? minutes + 1 : undefined];
  2070. },
  2071. arrowSecondList: function arrowSecondList() {
  2072. var seconds = this.seconds;
  2073. return [seconds > 0 ? seconds - 1 : undefined, seconds, seconds < 59 ? seconds + 1 : undefined];
  2074. }
  2075. },
  2076. data: function data() {
  2077. return {
  2078. selectableRange: [],
  2079. currentScrollbar: null
  2080. };
  2081. },
  2082. mounted: function mounted() {
  2083. var _this = this;
  2084. this.$nextTick(function () {
  2085. !_this.arrowControl && _this.bindScrollEvent();
  2086. });
  2087. },
  2088. methods: {
  2089. increase: function increase() {
  2090. this.scrollDown(1);
  2091. },
  2092. decrease: function decrease() {
  2093. this.scrollDown(-1);
  2094. },
  2095. modifyDateField: function modifyDateField(type, value) {
  2096. switch (type) {
  2097. case 'hours':
  2098. this.$emit('change', Object(date_util_["modifyTime"])(this.date, value, this.minutes, this.seconds));break;
  2099. case 'minutes':
  2100. this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, value, this.seconds));break;
  2101. case 'seconds':
  2102. this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, this.minutes, value));break;
  2103. }
  2104. },
  2105. handleClick: function handleClick(type, _ref) {
  2106. var value = _ref.value,
  2107. disabled = _ref.disabled;
  2108. if (!disabled) {
  2109. this.modifyDateField(type, value);
  2110. this.emitSelectRange(type);
  2111. this.adjustSpinner(type, value);
  2112. }
  2113. },
  2114. emitSelectRange: function emitSelectRange(type) {
  2115. if (type === 'hours') {
  2116. this.$emit('select-range', 0, 2);
  2117. } else if (type === 'minutes') {
  2118. this.$emit('select-range', 3, 5);
  2119. } else if (type === 'seconds') {
  2120. this.$emit('select-range', 6, 8);
  2121. }
  2122. this.currentScrollbar = type;
  2123. },
  2124. bindScrollEvent: function bindScrollEvent() {
  2125. var _this2 = this;
  2126. var bindFuntion = function bindFuntion(type) {
  2127. _this2.$refs[type].wrap.onscroll = function (e) {
  2128. // TODO: scroll is emitted when set scrollTop programatically
  2129. // should find better solutions in the future!
  2130. _this2.handleScroll(type, e);
  2131. };
  2132. };
  2133. bindFuntion('hours');
  2134. bindFuntion('minutes');
  2135. bindFuntion('seconds');
  2136. },
  2137. handleScroll: function handleScroll(type) {
  2138. var value = Math.min(Math.floor((this.$refs[type].wrap.scrollTop - (this.scrollBarHeight(type) * 0.5 - 10) / this.typeItemHeight(type) + 3) / this.typeItemHeight(type)), type === 'hours' ? 23 : 59);
  2139. this.modifyDateField(type, value);
  2140. },
  2141. // NOTE: used by datetime / date-range panel
  2142. // renamed from adjustScrollTop
  2143. // should try to refactory it
  2144. adjustSpinners: function adjustSpinners() {
  2145. this.adjustSpinner('hours', this.hours);
  2146. this.adjustSpinner('minutes', this.minutes);
  2147. this.adjustSpinner('seconds', this.seconds);
  2148. },
  2149. adjustCurrentSpinner: function adjustCurrentSpinner(type) {
  2150. this.adjustSpinner(type, this[type]);
  2151. },
  2152. adjustSpinner: function adjustSpinner(type, value) {
  2153. if (this.arrowControl) return;
  2154. var el = this.$refs[type].wrap;
  2155. if (el) {
  2156. el.scrollTop = Math.max(0, value * this.typeItemHeight(type));
  2157. }
  2158. },
  2159. scrollDown: function scrollDown(step) {
  2160. if (!this.currentScrollbar) {
  2161. this.emitSelectRange('hours');
  2162. }
  2163. var label = this.currentScrollbar;
  2164. var hoursList = this.hoursList;
  2165. var now = this[label];
  2166. if (this.currentScrollbar === 'hours') {
  2167. var total = Math.abs(step);
  2168. step = step > 0 ? 1 : -1;
  2169. var length = hoursList.length;
  2170. while (length-- && total) {
  2171. now = (now + step + hoursList.length) % hoursList.length;
  2172. if (hoursList[now]) {
  2173. continue;
  2174. }
  2175. total--;
  2176. }
  2177. if (hoursList[now]) return;
  2178. } else {
  2179. now = (now + step + 60) % 60;
  2180. }
  2181. this.modifyDateField(label, now);
  2182. this.adjustSpinner(label, now);
  2183. },
  2184. amPm: function amPm(hour) {
  2185. var shouldShowAmPm = this.amPmMode.toLowerCase() === 'a';
  2186. if (!shouldShowAmPm) return '';
  2187. var isCapital = this.amPmMode === 'A';
  2188. var content = hour < 12 ? ' am' : ' pm';
  2189. if (isCapital) content = content.toUpperCase();
  2190. return content;
  2191. },
  2192. typeItemHeight: function typeItemHeight(type) {
  2193. return this.$refs[type].$el.querySelector('li').offsetHeight;
  2194. },
  2195. scrollBarHeight: function scrollBarHeight(type) {
  2196. return this.$refs[type].$el.offsetHeight;
  2197. }
  2198. }
  2199. });
  2200. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=script&lang=js&
  2201. /* harmony default export */ var basic_time_spinnervue_type_script_lang_js_ = (time_spinnervue_type_script_lang_js_);
  2202. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2203. var componentNormalizer = __webpack_require__(0);
  2204. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue
  2205. /* normalize component */
  2206. var component = Object(componentNormalizer["a" /* default */])(
  2207. basic_time_spinnervue_type_script_lang_js_,
  2208. render,
  2209. staticRenderFns,
  2210. false,
  2211. null,
  2212. null,
  2213. null
  2214. )
  2215. /* hot reload */
  2216. if (false) { var api; }
  2217. component.options.__file = "packages/date-picker/src/basic/time-spinner.vue"
  2218. /* harmony default export */ var time_spinner = __webpack_exports__["a"] = (component.exports);
  2219. /***/ }),
  2220. /***/ 5:
  2221. /***/ (function(module, exports) {
  2222. module.exports = require("element-ui/lib/utils/vue-popper");
  2223. /***/ }),
  2224. /***/ 6:
  2225. /***/ (function(module, exports) {
  2226. module.exports = require("vue");
  2227. /***/ }),
  2228. /***/ 65:
  2229. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2230. "use strict";
  2231. __webpack_require__.r(__webpack_exports__);
  2232. // EXTERNAL MODULE: ./packages/date-picker/src/picker.vue + 4 modules
  2233. var picker = __webpack_require__(28);
  2234. // EXTERNAL MODULE: ./packages/date-picker/src/panel/time.vue + 4 modules
  2235. var time = __webpack_require__(22);
  2236. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time-range.vue?vue&type=template&id=fb28660e&
  2237. var render = function() {
  2238. var _vm = this
  2239. var _h = _vm.$createElement
  2240. var _c = _vm._self._c || _h
  2241. return _c(
  2242. "transition",
  2243. {
  2244. attrs: { name: "el-zoom-in-top" },
  2245. on: {
  2246. "after-leave": function($event) {
  2247. _vm.$emit("dodestroy")
  2248. }
  2249. }
  2250. },
  2251. [
  2252. _c(
  2253. "div",
  2254. {
  2255. directives: [
  2256. {
  2257. name: "show",
  2258. rawName: "v-show",
  2259. value: _vm.visible,
  2260. expression: "visible"
  2261. }
  2262. ],
  2263. staticClass: "el-time-range-picker el-picker-panel el-popper",
  2264. class: _vm.popperClass
  2265. },
  2266. [
  2267. _c("div", { staticClass: "el-time-range-picker__content" }, [
  2268. _c("div", { staticClass: "el-time-range-picker__cell" }, [
  2269. _c("div", { staticClass: "el-time-range-picker__header" }, [
  2270. _vm._v(_vm._s(_vm.t("el.datepicker.startTime")))
  2271. ]),
  2272. _c(
  2273. "div",
  2274. {
  2275. staticClass:
  2276. "el-time-range-picker__body el-time-panel__content",
  2277. class: {
  2278. "has-seconds": _vm.showSeconds,
  2279. "is-arrow": _vm.arrowControl
  2280. }
  2281. },
  2282. [
  2283. _c("time-spinner", {
  2284. ref: "minSpinner",
  2285. attrs: {
  2286. "show-seconds": _vm.showSeconds,
  2287. "am-pm-mode": _vm.amPmMode,
  2288. "arrow-control": _vm.arrowControl,
  2289. date: _vm.minDate
  2290. },
  2291. on: {
  2292. change: _vm.handleMinChange,
  2293. "select-range": _vm.setMinSelectionRange
  2294. }
  2295. })
  2296. ],
  2297. 1
  2298. )
  2299. ]),
  2300. _c("div", { staticClass: "el-time-range-picker__cell" }, [
  2301. _c("div", { staticClass: "el-time-range-picker__header" }, [
  2302. _vm._v(_vm._s(_vm.t("el.datepicker.endTime")))
  2303. ]),
  2304. _c(
  2305. "div",
  2306. {
  2307. staticClass:
  2308. "el-time-range-picker__body el-time-panel__content",
  2309. class: {
  2310. "has-seconds": _vm.showSeconds,
  2311. "is-arrow": _vm.arrowControl
  2312. }
  2313. },
  2314. [
  2315. _c("time-spinner", {
  2316. ref: "maxSpinner",
  2317. attrs: {
  2318. "show-seconds": _vm.showSeconds,
  2319. "am-pm-mode": _vm.amPmMode,
  2320. "arrow-control": _vm.arrowControl,
  2321. date: _vm.maxDate
  2322. },
  2323. on: {
  2324. change: _vm.handleMaxChange,
  2325. "select-range": _vm.setMaxSelectionRange
  2326. }
  2327. })
  2328. ],
  2329. 1
  2330. )
  2331. ])
  2332. ]),
  2333. _c("div", { staticClass: "el-time-panel__footer" }, [
  2334. _c(
  2335. "button",
  2336. {
  2337. staticClass: "el-time-panel__btn cancel",
  2338. attrs: { type: "button" },
  2339. on: {
  2340. click: function($event) {
  2341. _vm.handleCancel()
  2342. }
  2343. }
  2344. },
  2345. [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))]
  2346. ),
  2347. _c(
  2348. "button",
  2349. {
  2350. staticClass: "el-time-panel__btn confirm",
  2351. attrs: { type: "button", disabled: _vm.btnDisabled },
  2352. on: {
  2353. click: function($event) {
  2354. _vm.handleConfirm()
  2355. }
  2356. }
  2357. },
  2358. [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))]
  2359. )
  2360. ])
  2361. ]
  2362. )
  2363. ]
  2364. )
  2365. }
  2366. var staticRenderFns = []
  2367. render._withStripped = true
  2368. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue?vue&type=template&id=fb28660e&
  2369. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  2370. var date_util_ = __webpack_require__(1);
  2371. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  2372. var locale_ = __webpack_require__(7);
  2373. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  2374. // EXTERNAL MODULE: ./packages/date-picker/src/basic/time-spinner.vue + 4 modules
  2375. var time_spinner = __webpack_require__(30);
  2376. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time-range.vue?vue&type=script&lang=js&
  2377. //
  2378. //
  2379. //
  2380. //
  2381. //
  2382. //
  2383. //
  2384. //
  2385. //
  2386. //
  2387. //
  2388. //
  2389. //
  2390. //
  2391. //
  2392. //
  2393. //
  2394. //
  2395. //
  2396. //
  2397. //
  2398. //
  2399. //
  2400. //
  2401. //
  2402. //
  2403. //
  2404. //
  2405. //
  2406. //
  2407. //
  2408. //
  2409. //
  2410. //
  2411. //
  2412. //
  2413. //
  2414. //
  2415. //
  2416. //
  2417. //
  2418. //
  2419. //
  2420. //
  2421. //
  2422. //
  2423. //
  2424. //
  2425. //
  2426. //
  2427. //
  2428. //
  2429. //
  2430. //
  2431. //
  2432. //
  2433. //
  2434. var MIN_TIME = Object(date_util_["parseDate"])('00:00:00', 'HH:mm:ss');
  2435. var MAX_TIME = Object(date_util_["parseDate"])('23:59:59', 'HH:mm:ss');
  2436. var time_rangevue_type_script_lang_js_minTimeOfDay = function minTimeOfDay(date) {
  2437. return Object(date_util_["modifyDate"])(MIN_TIME, date.getFullYear(), date.getMonth(), date.getDate());
  2438. };
  2439. var time_rangevue_type_script_lang_js_maxTimeOfDay = function maxTimeOfDay(date) {
  2440. return Object(date_util_["modifyDate"])(MAX_TIME, date.getFullYear(), date.getMonth(), date.getDate());
  2441. };
  2442. // increase time by amount of milliseconds, but within the range of day
  2443. var advanceTime = function advanceTime(date, amount) {
  2444. return new Date(Math.min(date.getTime() + amount, time_rangevue_type_script_lang_js_maxTimeOfDay(date).getTime()));
  2445. };
  2446. /* harmony default export */ var time_rangevue_type_script_lang_js_ = ({
  2447. mixins: [locale_default.a],
  2448. components: { TimeSpinner: time_spinner["a" /* default */] },
  2449. computed: {
  2450. showSeconds: function showSeconds() {
  2451. return (this.format || '').indexOf('ss') !== -1;
  2452. },
  2453. offset: function offset() {
  2454. return this.showSeconds ? 11 : 8;
  2455. },
  2456. spinner: function spinner() {
  2457. return this.selectionRange[0] < this.offset ? this.$refs.minSpinner : this.$refs.maxSpinner;
  2458. },
  2459. btnDisabled: function btnDisabled() {
  2460. return this.minDate.getTime() > this.maxDate.getTime();
  2461. },
  2462. amPmMode: function amPmMode() {
  2463. if ((this.format || '').indexOf('A') !== -1) return 'A';
  2464. if ((this.format || '').indexOf('a') !== -1) return 'a';
  2465. return '';
  2466. }
  2467. },
  2468. data: function data() {
  2469. return {
  2470. popperClass: '',
  2471. minDate: new Date(),
  2472. maxDate: new Date(),
  2473. value: [],
  2474. oldValue: [new Date(), new Date()],
  2475. defaultValue: null,
  2476. format: 'HH:mm:ss',
  2477. visible: false,
  2478. selectionRange: [0, 2],
  2479. arrowControl: false
  2480. };
  2481. },
  2482. watch: {
  2483. value: function value(_value) {
  2484. if (Array.isArray(_value)) {
  2485. this.minDate = new Date(_value[0]);
  2486. this.maxDate = new Date(_value[1]);
  2487. } else {
  2488. if (Array.isArray(this.defaultValue)) {
  2489. this.minDate = new Date(this.defaultValue[0]);
  2490. this.maxDate = new Date(this.defaultValue[1]);
  2491. } else if (this.defaultValue) {
  2492. this.minDate = new Date(this.defaultValue);
  2493. this.maxDate = advanceTime(new Date(this.defaultValue), 60 * 60 * 1000);
  2494. } else {
  2495. this.minDate = new Date();
  2496. this.maxDate = advanceTime(new Date(), 60 * 60 * 1000);
  2497. }
  2498. }
  2499. },
  2500. visible: function visible(val) {
  2501. var _this = this;
  2502. if (val) {
  2503. this.oldValue = this.value;
  2504. this.$nextTick(function () {
  2505. return _this.$refs.minSpinner.emitSelectRange('hours');
  2506. });
  2507. }
  2508. }
  2509. },
  2510. methods: {
  2511. handleClear: function handleClear() {
  2512. this.$emit('pick', null);
  2513. },
  2514. handleCancel: function handleCancel() {
  2515. this.$emit('pick', this.oldValue);
  2516. },
  2517. handleMinChange: function handleMinChange(date) {
  2518. this.minDate = Object(date_util_["clearMilliseconds"])(date);
  2519. this.handleChange();
  2520. },
  2521. handleMaxChange: function handleMaxChange(date) {
  2522. this.maxDate = Object(date_util_["clearMilliseconds"])(date);
  2523. this.handleChange();
  2524. },
  2525. handleChange: function handleChange() {
  2526. if (this.isValidValue([this.minDate, this.maxDate])) {
  2527. this.$refs.minSpinner.selectableRange = [[time_rangevue_type_script_lang_js_minTimeOfDay(this.minDate), this.maxDate]];
  2528. this.$refs.maxSpinner.selectableRange = [[this.minDate, time_rangevue_type_script_lang_js_maxTimeOfDay(this.maxDate)]];
  2529. this.$emit('pick', [this.minDate, this.maxDate], true);
  2530. }
  2531. },
  2532. setMinSelectionRange: function setMinSelectionRange(start, end) {
  2533. this.$emit('select-range', start, end, 'min');
  2534. this.selectionRange = [start, end];
  2535. },
  2536. setMaxSelectionRange: function setMaxSelectionRange(start, end) {
  2537. this.$emit('select-range', start, end, 'max');
  2538. this.selectionRange = [start + this.offset, end + this.offset];
  2539. },
  2540. handleConfirm: function handleConfirm() {
  2541. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2542. var minSelectableRange = this.$refs.minSpinner.selectableRange;
  2543. var maxSelectableRange = this.$refs.maxSpinner.selectableRange;
  2544. this.minDate = Object(date_util_["limitTimeRange"])(this.minDate, minSelectableRange, this.format);
  2545. this.maxDate = Object(date_util_["limitTimeRange"])(this.maxDate, maxSelectableRange, this.format);
  2546. this.$emit('pick', [this.minDate, this.maxDate], visible);
  2547. },
  2548. adjustSpinners: function adjustSpinners() {
  2549. this.$refs.minSpinner.adjustSpinners();
  2550. this.$refs.maxSpinner.adjustSpinners();
  2551. },
  2552. changeSelectionRange: function changeSelectionRange(step) {
  2553. var list = this.showSeconds ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  2554. var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
  2555. var index = list.indexOf(this.selectionRange[0]);
  2556. var next = (index + step + list.length) % list.length;
  2557. var half = list.length / 2;
  2558. if (next < half) {
  2559. this.$refs.minSpinner.emitSelectRange(mapping[next]);
  2560. } else {
  2561. this.$refs.maxSpinner.emitSelectRange(mapping[next - half]);
  2562. }
  2563. },
  2564. isValidValue: function isValidValue(date) {
  2565. return Array.isArray(date) && Object(date_util_["timeWithinRange"])(this.minDate, this.$refs.minSpinner.selectableRange) && Object(date_util_["timeWithinRange"])(this.maxDate, this.$refs.maxSpinner.selectableRange);
  2566. },
  2567. handleKeydown: function handleKeydown(event) {
  2568. var keyCode = event.keyCode;
  2569. var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
  2570. // Left or Right
  2571. if (keyCode === 37 || keyCode === 39) {
  2572. var step = mapping[keyCode];
  2573. this.changeSelectionRange(step);
  2574. event.preventDefault();
  2575. return;
  2576. }
  2577. // Up or Down
  2578. if (keyCode === 38 || keyCode === 40) {
  2579. var _step = mapping[keyCode];
  2580. this.spinner.scrollDown(_step);
  2581. event.preventDefault();
  2582. return;
  2583. }
  2584. }
  2585. }
  2586. });
  2587. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue?vue&type=script&lang=js&
  2588. /* harmony default export */ var panel_time_rangevue_type_script_lang_js_ = (time_rangevue_type_script_lang_js_);
  2589. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2590. var componentNormalizer = __webpack_require__(0);
  2591. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue
  2592. /* normalize component */
  2593. var component = Object(componentNormalizer["a" /* default */])(
  2594. panel_time_rangevue_type_script_lang_js_,
  2595. render,
  2596. staticRenderFns,
  2597. false,
  2598. null,
  2599. null,
  2600. null
  2601. )
  2602. /* hot reload */
  2603. if (false) { var api; }
  2604. component.options.__file = "packages/date-picker/src/panel/time-range.vue"
  2605. /* harmony default export */ var time_range = (component.exports);
  2606. // CONCATENATED MODULE: ./packages/date-picker/src/picker/time-picker.js
  2607. /* harmony default export */ var time_picker = ({
  2608. mixins: [picker["a" /* default */]],
  2609. name: 'ElTimePicker',
  2610. props: {
  2611. isRange: Boolean,
  2612. arrowControl: Boolean
  2613. },
  2614. data: function data() {
  2615. return {
  2616. type: ''
  2617. };
  2618. },
  2619. watch: {
  2620. isRange: function isRange(_isRange) {
  2621. if (this.picker) {
  2622. this.unmountPicker();
  2623. this.type = _isRange ? 'timerange' : 'time';
  2624. this.panel = _isRange ? time_range : time["a" /* default */];
  2625. this.mountPicker();
  2626. } else {
  2627. this.type = _isRange ? 'timerange' : 'time';
  2628. this.panel = _isRange ? time_range : time["a" /* default */];
  2629. }
  2630. }
  2631. },
  2632. created: function created() {
  2633. this.type = this.isRange ? 'timerange' : 'time';
  2634. this.panel = this.isRange ? time_range : time["a" /* default */];
  2635. }
  2636. });
  2637. // CONCATENATED MODULE: ./packages/time-picker/index.js
  2638. /* istanbul ignore next */
  2639. time_picker.install = function (Vue) {
  2640. Vue.component(time_picker.name, time_picker);
  2641. };
  2642. /* harmony default export */ var packages_time_picker = __webpack_exports__["default"] = (time_picker);
  2643. /***/ }),
  2644. /***/ 7:
  2645. /***/ (function(module, exports) {
  2646. module.exports = require("element-ui/lib/mixins/locale");
  2647. /***/ }),
  2648. /***/ 8:
  2649. /***/ (function(module, exports) {
  2650. module.exports = require("element-ui/lib/utils/merge");
  2651. /***/ }),
  2652. /***/ 9:
  2653. /***/ (function(module, exports) {
  2654. module.exports = require("element-ui/lib/input");
  2655. /***/ })
  2656. /******/ });