time-picker.js 82 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931
  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 = 76);
  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. /***/ 10:
  184. /***/ (function(module, exports) {
  185. module.exports = require("element-ui/lib/input");
  186. /***/ }),
  187. /***/ 12:
  188. /***/ (function(module, exports) {
  189. module.exports = require("element-ui/lib/utils/clickoutside");
  190. /***/ }),
  191. /***/ 15:
  192. /***/ (function(module, exports) {
  193. module.exports = require("element-ui/lib/scrollbar");
  194. /***/ }),
  195. /***/ 2:
  196. /***/ (function(module, exports) {
  197. module.exports = require("element-ui/lib/utils/dom");
  198. /***/ }),
  199. /***/ 27:
  200. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  201. "use strict";
  202. // 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&
  203. var render = function() {
  204. var _vm = this
  205. var _h = _vm.$createElement
  206. var _c = _vm._self._c || _h
  207. return _c(
  208. "transition",
  209. {
  210. attrs: { name: "el-zoom-in-top" },
  211. on: {
  212. "after-leave": function($event) {
  213. _vm.$emit("dodestroy")
  214. }
  215. }
  216. },
  217. [
  218. _c(
  219. "div",
  220. {
  221. directives: [
  222. {
  223. name: "show",
  224. rawName: "v-show",
  225. value: _vm.visible,
  226. expression: "visible"
  227. }
  228. ],
  229. staticClass: "el-time-panel el-popper",
  230. class: _vm.popperClass
  231. },
  232. [
  233. _c(
  234. "div",
  235. {
  236. staticClass: "el-time-panel__content",
  237. class: { "has-seconds": _vm.showSeconds }
  238. },
  239. [
  240. _c("time-spinner", {
  241. ref: "spinner",
  242. attrs: {
  243. "arrow-control": _vm.useArrow,
  244. "show-seconds": _vm.showSeconds,
  245. "am-pm-mode": _vm.amPmMode,
  246. date: _vm.date
  247. },
  248. on: {
  249. change: _vm.handleChange,
  250. "select-range": _vm.setSelectionRange
  251. }
  252. })
  253. ],
  254. 1
  255. ),
  256. _c("div", { staticClass: "el-time-panel__footer" }, [
  257. _c(
  258. "button",
  259. {
  260. staticClass: "el-time-panel__btn cancel",
  261. attrs: { type: "button" },
  262. on: { click: _vm.handleCancel }
  263. },
  264. [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))]
  265. ),
  266. _c(
  267. "button",
  268. {
  269. staticClass: "el-time-panel__btn",
  270. class: { confirm: !_vm.disabled },
  271. attrs: { type: "button" },
  272. on: {
  273. click: function($event) {
  274. _vm.handleConfirm()
  275. }
  276. }
  277. },
  278. [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))]
  279. )
  280. ])
  281. ]
  282. )
  283. ]
  284. )
  285. }
  286. var staticRenderFns = []
  287. render._withStripped = true
  288. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=template&id=3d939089&
  289. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  290. var date_util_ = __webpack_require__(1);
  291. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  292. var locale_ = __webpack_require__(6);
  293. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  294. // EXTERNAL MODULE: ./packages/date-picker/src/basic/time-spinner.vue + 4 modules
  295. var time_spinner = __webpack_require__(34);
  296. // 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&
  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. //
  326. //
  327. //
  328. //
  329. /* harmony default export */ var timevue_type_script_lang_js_ = ({
  330. mixins: [locale_default.a],
  331. components: {
  332. TimeSpinner: time_spinner["a" /* default */]
  333. },
  334. props: {
  335. visible: Boolean,
  336. timeArrowControl: Boolean
  337. },
  338. watch: {
  339. visible: function visible(val) {
  340. var _this = this;
  341. if (val) {
  342. this.oldValue = this.value;
  343. this.$nextTick(function () {
  344. return _this.$refs.spinner.emitSelectRange('hours');
  345. });
  346. } else {
  347. this.needInitAdjust = true;
  348. }
  349. },
  350. value: function value(newVal) {
  351. var _this2 = this;
  352. var date = void 0;
  353. if (newVal instanceof Date) {
  354. date = Object(date_util_["limitTimeRange"])(newVal, this.selectableRange, this.format);
  355. } else if (!newVal) {
  356. date = this.defaultValue ? new Date(this.defaultValue) : new Date();
  357. }
  358. this.date = date;
  359. if (this.visible && this.needInitAdjust) {
  360. this.$nextTick(function (_) {
  361. return _this2.adjustSpinners();
  362. });
  363. this.needInitAdjust = false;
  364. }
  365. },
  366. selectableRange: function selectableRange(val) {
  367. this.$refs.spinner.selectableRange = val;
  368. },
  369. defaultValue: function defaultValue(val) {
  370. if (!Object(date_util_["isDate"])(this.value)) {
  371. this.date = val ? new Date(val) : new Date();
  372. }
  373. }
  374. },
  375. data: function data() {
  376. return {
  377. popperClass: '',
  378. format: 'HH:mm:ss',
  379. value: '',
  380. defaultValue: null,
  381. date: new Date(),
  382. oldValue: new Date(),
  383. selectableRange: [],
  384. selectionRange: [0, 2],
  385. disabled: false,
  386. arrowControl: false,
  387. needInitAdjust: true
  388. };
  389. },
  390. computed: {
  391. showSeconds: function showSeconds() {
  392. return (this.format || '').indexOf('ss') !== -1;
  393. },
  394. useArrow: function useArrow() {
  395. return this.arrowControl || this.timeArrowControl || false;
  396. },
  397. amPmMode: function amPmMode() {
  398. if ((this.format || '').indexOf('A') !== -1) return 'A';
  399. if ((this.format || '').indexOf('a') !== -1) return 'a';
  400. return '';
  401. }
  402. },
  403. methods: {
  404. handleCancel: function handleCancel() {
  405. this.$emit('pick', this.oldValue, false);
  406. },
  407. handleChange: function handleChange(date) {
  408. // this.visible avoids edge cases, when use scrolls during panel closing animation
  409. if (this.visible) {
  410. this.date = Object(date_util_["clearMilliseconds"])(date);
  411. // if date is out of range, do not emit
  412. if (this.isValidValue(this.date)) {
  413. this.$emit('pick', this.date, true);
  414. }
  415. }
  416. },
  417. setSelectionRange: function setSelectionRange(start, end) {
  418. this.$emit('select-range', start, end);
  419. this.selectionRange = [start, end];
  420. },
  421. handleConfirm: function handleConfirm() {
  422. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  423. var first = arguments[1];
  424. if (first) return;
  425. var date = Object(date_util_["clearMilliseconds"])(Object(date_util_["limitTimeRange"])(this.date, this.selectableRange, this.format));
  426. this.$emit('pick', date, visible, first);
  427. },
  428. handleKeydown: function handleKeydown(event) {
  429. var keyCode = event.keyCode;
  430. var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
  431. // Left or Right
  432. if (keyCode === 37 || keyCode === 39) {
  433. var step = mapping[keyCode];
  434. this.changeSelectionRange(step);
  435. event.preventDefault();
  436. return;
  437. }
  438. // Up or Down
  439. if (keyCode === 38 || keyCode === 40) {
  440. var _step = mapping[keyCode];
  441. this.$refs.spinner.scrollDown(_step);
  442. event.preventDefault();
  443. return;
  444. }
  445. },
  446. isValidValue: function isValidValue(date) {
  447. return Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format);
  448. },
  449. adjustSpinners: function adjustSpinners() {
  450. return this.$refs.spinner.adjustSpinners();
  451. },
  452. changeSelectionRange: function changeSelectionRange(step) {
  453. var list = [0, 3].concat(this.showSeconds ? [6] : []);
  454. var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
  455. var index = list.indexOf(this.selectionRange[0]);
  456. var next = (index + step + list.length) % list.length;
  457. this.$refs.spinner.emitSelectRange(mapping[next]);
  458. }
  459. },
  460. mounted: function mounted() {
  461. var _this3 = this;
  462. this.$nextTick(function () {
  463. return _this3.handleConfirm(true, true);
  464. });
  465. this.$emit('mounted');
  466. }
  467. });
  468. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=script&lang=js&
  469. /* harmony default export */ var panel_timevue_type_script_lang_js_ = (timevue_type_script_lang_js_);
  470. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  471. var componentNormalizer = __webpack_require__(0);
  472. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue
  473. /* normalize component */
  474. var component = Object(componentNormalizer["a" /* default */])(
  475. panel_timevue_type_script_lang_js_,
  476. render,
  477. staticRenderFns,
  478. false,
  479. null,
  480. null,
  481. null
  482. )
  483. /* hot reload */
  484. if (false) { var api; }
  485. component.options.__file = "packages/date-picker/src/panel/time.vue"
  486. /* harmony default export */ var time = __webpack_exports__["a"] = (component.exports);
  487. /***/ }),
  488. /***/ 30:
  489. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  490. "use strict";
  491. /* harmony import */ var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  492. /* 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__);
  493. /* harmony default export */ __webpack_exports__["a"] = ({
  494. bind: function bind(el, binding, vnode) {
  495. var interval = null;
  496. var startTime = void 0;
  497. var handler = function handler() {
  498. return vnode.context[binding.expression].apply();
  499. };
  500. var clear = function clear() {
  501. if (Date.now() - startTime < 100) {
  502. handler();
  503. }
  504. clearInterval(interval);
  505. interval = null;
  506. };
  507. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["on"])(el, 'mousedown', function (e) {
  508. if (e.button !== 0) return;
  509. startTime = Date.now();
  510. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["once"])(document, 'mouseup', clear);
  511. clearInterval(interval);
  512. interval = setInterval(handler, 100);
  513. });
  514. }
  515. });
  516. /***/ }),
  517. /***/ 32:
  518. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  519. "use strict";
  520. // 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&
  521. var render = function() {
  522. var _vm = this
  523. var _h = _vm.$createElement
  524. var _c = _vm._self._c || _h
  525. return !_vm.ranged
  526. ? _c(
  527. "el-input",
  528. _vm._b(
  529. {
  530. directives: [
  531. {
  532. name: "clickoutside",
  533. rawName: "v-clickoutside",
  534. value: _vm.handleClose,
  535. expression: "handleClose"
  536. }
  537. ],
  538. ref: "reference",
  539. staticClass: "el-date-editor",
  540. class: "el-date-editor--" + _vm.type,
  541. attrs: {
  542. readonly:
  543. !_vm.editable ||
  544. _vm.readonly ||
  545. _vm.type === "dates" ||
  546. _vm.type === "week",
  547. disabled: _vm.pickerDisabled,
  548. size: _vm.pickerSize,
  549. name: _vm.name,
  550. placeholder: _vm.placeholder,
  551. value: _vm.displayValue,
  552. validateEvent: false
  553. },
  554. on: {
  555. focus: _vm.handleFocus,
  556. input: function(value) {
  557. return (_vm.userInput = value)
  558. },
  559. change: _vm.handleChange
  560. },
  561. nativeOn: {
  562. keydown: function($event) {
  563. return _vm.handleKeydown($event)
  564. },
  565. mouseenter: function($event) {
  566. return _vm.handleMouseEnter($event)
  567. },
  568. mouseleave: function($event) {
  569. _vm.showClose = false
  570. }
  571. }
  572. },
  573. "el-input",
  574. _vm.firstInputId,
  575. false
  576. ),
  577. [
  578. _c("i", {
  579. staticClass: "el-input__icon",
  580. class: _vm.triggerClass,
  581. attrs: { slot: "prefix" },
  582. on: { click: _vm.handleFocus },
  583. slot: "prefix"
  584. }),
  585. _vm.haveTrigger
  586. ? _c("i", {
  587. staticClass: "el-input__icon",
  588. class: [_vm.showClose ? "" + _vm.clearIcon : ""],
  589. attrs: { slot: "suffix" },
  590. on: { click: _vm.handleClickIcon },
  591. slot: "suffix"
  592. })
  593. : _vm._e()
  594. ]
  595. )
  596. : _c(
  597. "div",
  598. {
  599. directives: [
  600. {
  601. name: "clickoutside",
  602. rawName: "v-clickoutside",
  603. value: _vm.handleClose,
  604. expression: "handleClose"
  605. }
  606. ],
  607. ref: "reference",
  608. staticClass: "el-date-editor el-range-editor el-input__inner",
  609. class: [
  610. "el-date-editor--" + _vm.type,
  611. _vm.pickerSize ? "el-range-editor--" + _vm.pickerSize : "",
  612. _vm.pickerDisabled ? "is-disabled" : "",
  613. _vm.pickerVisible ? "is-active" : ""
  614. ],
  615. on: {
  616. click: _vm.handleRangeClick,
  617. mouseenter: _vm.handleMouseEnter,
  618. mouseleave: function($event) {
  619. _vm.showClose = false
  620. },
  621. keydown: _vm.handleKeydown
  622. }
  623. },
  624. [
  625. _c("i", {
  626. class: ["el-input__icon", "el-range__icon", _vm.triggerClass]
  627. }),
  628. _c(
  629. "input",
  630. _vm._b(
  631. {
  632. staticClass: "el-range-input",
  633. attrs: {
  634. autocomplete: "off",
  635. placeholder: _vm.startPlaceholder,
  636. disabled: _vm.pickerDisabled,
  637. readonly: !_vm.editable || _vm.readonly,
  638. name: _vm.name && _vm.name[0]
  639. },
  640. domProps: { value: _vm.displayValue && _vm.displayValue[0] },
  641. on: {
  642. input: _vm.handleStartInput,
  643. change: _vm.handleStartChange,
  644. focus: _vm.handleFocus
  645. }
  646. },
  647. "input",
  648. _vm.firstInputId,
  649. false
  650. )
  651. ),
  652. _vm._t("range-separator", [
  653. _c("span", { staticClass: "el-range-separator" }, [
  654. _vm._v(_vm._s(_vm.rangeSeparator))
  655. ])
  656. ]),
  657. _c(
  658. "input",
  659. _vm._b(
  660. {
  661. staticClass: "el-range-input",
  662. attrs: {
  663. autocomplete: "off",
  664. placeholder: _vm.endPlaceholder,
  665. disabled: _vm.pickerDisabled,
  666. readonly: !_vm.editable || _vm.readonly,
  667. name: _vm.name && _vm.name[1]
  668. },
  669. domProps: { value: _vm.displayValue && _vm.displayValue[1] },
  670. on: {
  671. input: _vm.handleEndInput,
  672. change: _vm.handleEndChange,
  673. focus: _vm.handleFocus
  674. }
  675. },
  676. "input",
  677. _vm.secondInputId,
  678. false
  679. )
  680. ),
  681. _vm.haveTrigger
  682. ? _c("i", {
  683. staticClass: "el-input__icon el-range__close-icon",
  684. class: [_vm.showClose ? "" + _vm.clearIcon : ""],
  685. on: { click: _vm.handleClickIcon }
  686. })
  687. : _vm._e()
  688. ],
  689. 2
  690. )
  691. }
  692. var staticRenderFns = []
  693. render._withStripped = true
  694. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=template&id=79ae069f&
  695. // EXTERNAL MODULE: external "vue"
  696. var external_vue_ = __webpack_require__(7);
  697. var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
  698. // EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
  699. var clickoutside_ = __webpack_require__(12);
  700. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  701. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  702. var date_util_ = __webpack_require__(1);
  703. // EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
  704. var vue_popper_ = __webpack_require__(5);
  705. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  706. // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
  707. var emitter_ = __webpack_require__(4);
  708. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  709. // EXTERNAL MODULE: external "element-ui/lib/input"
  710. var input_ = __webpack_require__(10);
  711. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  712. // EXTERNAL MODULE: external "element-ui/lib/utils/merge"
  713. var merge_ = __webpack_require__(9);
  714. var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
  715. // 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&
  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. //
  798. //
  799. //
  800. //
  801. var NewPopper = {
  802. props: {
  803. appendToBody: vue_popper_default.a.props.appendToBody,
  804. offset: vue_popper_default.a.props.offset,
  805. boundariesPadding: vue_popper_default.a.props.boundariesPadding,
  806. arrowOffset: vue_popper_default.a.props.arrowOffset
  807. },
  808. methods: vue_popper_default.a.methods,
  809. data: function data() {
  810. return merge_default()({ visibleArrow: true }, vue_popper_default.a.data);
  811. },
  812. beforeDestroy: vue_popper_default.a.beforeDestroy
  813. };
  814. var DEFAULT_FORMATS = {
  815. date: 'yyyy-MM-dd',
  816. month: 'yyyy-MM',
  817. datetime: 'yyyy-MM-dd HH:mm:ss',
  818. time: 'HH:mm:ss',
  819. week: 'yyyywWW',
  820. timerange: 'HH:mm:ss',
  821. daterange: 'yyyy-MM-dd',
  822. monthrange: 'yyyy-MM',
  823. datetimerange: 'yyyy-MM-dd HH:mm:ss',
  824. year: 'yyyy'
  825. };
  826. var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'monthrange', 'timerange', 'datetimerange', 'dates'];
  827. var pickervue_type_script_lang_js_DATE_FORMATTER = function DATE_FORMATTER(value, format) {
  828. if (format === 'timestamp') return value.getTime();
  829. return Object(date_util_["formatDate"])(value, format);
  830. };
  831. var pickervue_type_script_lang_js_DATE_PARSER = function DATE_PARSER(text, format) {
  832. if (format === 'timestamp') return new Date(Number(text));
  833. return Object(date_util_["parseDate"])(text, format);
  834. };
  835. var RANGE_FORMATTER = function RANGE_FORMATTER(value, format) {
  836. if (Array.isArray(value) && value.length === 2) {
  837. var start = value[0];
  838. var end = value[1];
  839. if (start && end) {
  840. return [pickervue_type_script_lang_js_DATE_FORMATTER(start, format), pickervue_type_script_lang_js_DATE_FORMATTER(end, format)];
  841. }
  842. }
  843. return '';
  844. };
  845. var RANGE_PARSER = function RANGE_PARSER(array, format, separator) {
  846. if (!Array.isArray(array)) {
  847. array = array.split(separator);
  848. }
  849. if (array.length === 2) {
  850. var range1 = array[0];
  851. var range2 = array[1];
  852. return [pickervue_type_script_lang_js_DATE_PARSER(range1, format), pickervue_type_script_lang_js_DATE_PARSER(range2, format)];
  853. }
  854. return [];
  855. };
  856. var TYPE_VALUE_RESOLVER_MAP = {
  857. default: {
  858. formatter: function formatter(value) {
  859. if (!value) return '';
  860. return '' + value;
  861. },
  862. parser: function parser(text) {
  863. if (text === undefined || text === '') return null;
  864. return text;
  865. }
  866. },
  867. week: {
  868. formatter: function formatter(value, format) {
  869. var week = Object(date_util_["getWeekNumber"])(value);
  870. var month = value.getMonth();
  871. var trueDate = new Date(value);
  872. if (week === 1 && month === 11) {
  873. trueDate.setHours(0, 0, 0, 0);
  874. trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
  875. }
  876. var date = Object(date_util_["formatDate"])(trueDate, format);
  877. date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
  878. return date;
  879. },
  880. parser: function parser(text, format) {
  881. // parse as if a normal date
  882. return TYPE_VALUE_RESOLVER_MAP.date.parser(text, format);
  883. }
  884. },
  885. date: {
  886. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  887. parser: pickervue_type_script_lang_js_DATE_PARSER
  888. },
  889. datetime: {
  890. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  891. parser: pickervue_type_script_lang_js_DATE_PARSER
  892. },
  893. daterange: {
  894. formatter: RANGE_FORMATTER,
  895. parser: RANGE_PARSER
  896. },
  897. monthrange: {
  898. formatter: RANGE_FORMATTER,
  899. parser: RANGE_PARSER
  900. },
  901. datetimerange: {
  902. formatter: RANGE_FORMATTER,
  903. parser: RANGE_PARSER
  904. },
  905. timerange: {
  906. formatter: RANGE_FORMATTER,
  907. parser: RANGE_PARSER
  908. },
  909. time: {
  910. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  911. parser: pickervue_type_script_lang_js_DATE_PARSER
  912. },
  913. month: {
  914. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  915. parser: pickervue_type_script_lang_js_DATE_PARSER
  916. },
  917. year: {
  918. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  919. parser: pickervue_type_script_lang_js_DATE_PARSER
  920. },
  921. number: {
  922. formatter: function formatter(value) {
  923. if (!value) return '';
  924. return '' + value;
  925. },
  926. parser: function parser(text) {
  927. var result = Number(text);
  928. if (!isNaN(text)) {
  929. return result;
  930. } else {
  931. return null;
  932. }
  933. }
  934. },
  935. dates: {
  936. formatter: function formatter(value, format) {
  937. return value.map(function (date) {
  938. return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
  939. });
  940. },
  941. parser: function parser(value, format) {
  942. return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
  943. return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
  944. });
  945. }
  946. }
  947. };
  948. var PLACEMENT_MAP = {
  949. left: 'bottom-start',
  950. center: 'bottom',
  951. right: 'bottom-end'
  952. };
  953. var parseAsFormatAndType = function parseAsFormatAndType(value, customFormat, type) {
  954. var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
  955. if (!value) return null;
  956. var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
  957. var format = customFormat || DEFAULT_FORMATS[type];
  958. return parser(value, format, rangeSeparator);
  959. };
  960. var formatAsFormatAndType = function formatAsFormatAndType(value, customFormat, type) {
  961. if (!value) return null;
  962. var formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
  963. var format = customFormat || DEFAULT_FORMATS[type];
  964. return formatter(value, format);
  965. };
  966. /*
  967. * Considers:
  968. * 1. Date object
  969. * 2. date string
  970. * 3. array of 1 or 2
  971. */
  972. var valueEquals = function valueEquals(a, b) {
  973. // considers Date object and string
  974. var dateEquals = function dateEquals(a, b) {
  975. var aIsDate = a instanceof Date;
  976. var bIsDate = b instanceof Date;
  977. if (aIsDate && bIsDate) {
  978. return a.getTime() === b.getTime();
  979. }
  980. if (!aIsDate && !bIsDate) {
  981. return a === b;
  982. }
  983. return false;
  984. };
  985. var aIsArray = a instanceof Array;
  986. var bIsArray = b instanceof Array;
  987. if (aIsArray && bIsArray) {
  988. if (a.length !== b.length) {
  989. return false;
  990. }
  991. return a.every(function (item, index) {
  992. return dateEquals(item, b[index]);
  993. });
  994. }
  995. if (!aIsArray && !bIsArray) {
  996. return dateEquals(a, b);
  997. }
  998. return false;
  999. };
  1000. var isString = function isString(val) {
  1001. return typeof val === 'string' || val instanceof String;
  1002. };
  1003. var validator = function validator(val) {
  1004. // either: String, Array of String, null / undefined
  1005. return val === null || val === undefined || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
  1006. };
  1007. /* harmony default export */ var pickervue_type_script_lang_js_ = ({
  1008. mixins: [emitter_default.a, NewPopper],
  1009. inject: {
  1010. elForm: {
  1011. default: ''
  1012. },
  1013. elFormItem: {
  1014. default: ''
  1015. }
  1016. },
  1017. props: {
  1018. size: String,
  1019. format: String,
  1020. valueFormat: String,
  1021. readonly: Boolean,
  1022. placeholder: String,
  1023. startPlaceholder: String,
  1024. endPlaceholder: String,
  1025. prefixIcon: String,
  1026. clearIcon: {
  1027. type: String,
  1028. default: 'el-icon-circle-close'
  1029. },
  1030. name: {
  1031. default: '',
  1032. validator: validator
  1033. },
  1034. disabled: Boolean,
  1035. clearable: {
  1036. type: Boolean,
  1037. default: true
  1038. },
  1039. id: {
  1040. default: '',
  1041. validator: validator
  1042. },
  1043. popperClass: String,
  1044. editable: {
  1045. type: Boolean,
  1046. default: true
  1047. },
  1048. align: {
  1049. type: String,
  1050. default: 'left'
  1051. },
  1052. value: {},
  1053. defaultValue: {},
  1054. defaultTime: {},
  1055. rangeSeparator: {
  1056. default: '-'
  1057. },
  1058. pickerOptions: {},
  1059. unlinkPanels: Boolean,
  1060. validateEvent: {
  1061. type: Boolean,
  1062. default: true
  1063. }
  1064. },
  1065. components: { ElInput: input_default.a },
  1066. directives: { Clickoutside: clickoutside_default.a },
  1067. data: function data() {
  1068. return {
  1069. pickerVisible: false,
  1070. showClose: false,
  1071. userInput: null,
  1072. valueOnOpen: null, // value when picker opens, used to determine whether to emit change
  1073. unwatchPickerOptions: null
  1074. };
  1075. },
  1076. watch: {
  1077. pickerVisible: function pickerVisible(val) {
  1078. if (this.readonly || this.pickerDisabled) return;
  1079. if (val) {
  1080. this.showPicker();
  1081. this.valueOnOpen = Array.isArray(this.value) ? [].concat(this.value) : this.value;
  1082. } else {
  1083. this.hidePicker();
  1084. this.emitChange(this.value);
  1085. this.userInput = null;
  1086. if (this.validateEvent) {
  1087. this.dispatch('ElFormItem', 'el.form.blur');
  1088. }
  1089. this.$emit('blur', this);
  1090. this.blur();
  1091. }
  1092. },
  1093. parsedValue: {
  1094. immediate: true,
  1095. handler: function handler(val) {
  1096. if (this.picker) {
  1097. this.picker.value = val;
  1098. }
  1099. }
  1100. },
  1101. defaultValue: function defaultValue(val) {
  1102. // NOTE: should eventually move to jsx style picker + panel ?
  1103. if (this.picker) {
  1104. this.picker.defaultValue = val;
  1105. }
  1106. },
  1107. value: function value(val, oldVal) {
  1108. if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
  1109. this.dispatch('ElFormItem', 'el.form.change', val);
  1110. }
  1111. }
  1112. },
  1113. computed: {
  1114. ranged: function ranged() {
  1115. return this.type.indexOf('range') > -1;
  1116. },
  1117. reference: function reference() {
  1118. var reference = this.$refs.reference;
  1119. return reference.$el || reference;
  1120. },
  1121. refInput: function refInput() {
  1122. if (this.reference) {
  1123. return [].slice.call(this.reference.querySelectorAll('input'));
  1124. }
  1125. return [];
  1126. },
  1127. valueIsEmpty: function valueIsEmpty() {
  1128. var val = this.value;
  1129. if (Array.isArray(val)) {
  1130. for (var i = 0, len = val.length; i < len; i++) {
  1131. if (val[i]) {
  1132. return false;
  1133. }
  1134. }
  1135. } else {
  1136. if (val) {
  1137. return false;
  1138. }
  1139. }
  1140. return true;
  1141. },
  1142. triggerClass: function triggerClass() {
  1143. return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
  1144. },
  1145. selectionMode: function selectionMode() {
  1146. if (this.type === 'week') {
  1147. return 'week';
  1148. } else if (this.type === 'month') {
  1149. return 'month';
  1150. } else if (this.type === 'year') {
  1151. return 'year';
  1152. } else if (this.type === 'dates') {
  1153. return 'dates';
  1154. }
  1155. return 'day';
  1156. },
  1157. haveTrigger: function haveTrigger() {
  1158. if (typeof this.showTrigger !== 'undefined') {
  1159. return this.showTrigger;
  1160. }
  1161. return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
  1162. },
  1163. displayValue: function displayValue() {
  1164. var formattedValue = formatAsFormatAndType(this.parsedValue, this.format, this.type, this.rangeSeparator);
  1165. if (Array.isArray(this.userInput)) {
  1166. return [this.userInput[0] || formattedValue && formattedValue[0] || '', this.userInput[1] || formattedValue && formattedValue[1] || ''];
  1167. } else if (this.userInput !== null) {
  1168. return this.userInput;
  1169. } else if (formattedValue) {
  1170. return this.type === 'dates' ? formattedValue.join(', ') : formattedValue;
  1171. } else {
  1172. return '';
  1173. }
  1174. },
  1175. parsedValue: function parsedValue() {
  1176. if (!this.value) return this.value; // component value is not set
  1177. if (this.type === 'time-select') return this.value; // time-select does not require parsing, this might change in next major version
  1178. var valueIsDateObject = Object(date_util_["isDateObject"])(this.value) || Array.isArray(this.value) && this.value.every(date_util_["isDateObject"]);
  1179. if (valueIsDateObject) {
  1180. return this.value;
  1181. }
  1182. if (this.valueFormat) {
  1183. return parseAsFormatAndType(this.value, this.valueFormat, this.type, this.rangeSeparator) || this.value;
  1184. }
  1185. // NOTE: deal with common but incorrect usage, should remove in next major version
  1186. // user might provide string / timestamp without value-format, coerce them into date (or array of date)
  1187. return Array.isArray(this.value) ? this.value.map(function (val) {
  1188. return new Date(val);
  1189. }) : new Date(this.value);
  1190. },
  1191. _elFormItemSize: function _elFormItemSize() {
  1192. return (this.elFormItem || {}).elFormItemSize;
  1193. },
  1194. pickerSize: function pickerSize() {
  1195. return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  1196. },
  1197. pickerDisabled: function pickerDisabled() {
  1198. return this.disabled || (this.elForm || {}).disabled;
  1199. },
  1200. firstInputId: function firstInputId() {
  1201. var obj = {};
  1202. var id = void 0;
  1203. if (this.ranged) {
  1204. id = this.id && this.id[0];
  1205. } else {
  1206. id = this.id;
  1207. }
  1208. if (id) obj.id = id;
  1209. return obj;
  1210. },
  1211. secondInputId: function secondInputId() {
  1212. var obj = {};
  1213. var id = void 0;
  1214. if (this.ranged) {
  1215. id = this.id && this.id[1];
  1216. }
  1217. if (id) obj.id = id;
  1218. return obj;
  1219. }
  1220. },
  1221. created: function created() {
  1222. // vue-popper
  1223. this.popperOptions = {
  1224. boundariesPadding: 0,
  1225. gpuAcceleration: false
  1226. };
  1227. this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
  1228. this.$on('fieldReset', this.handleFieldReset);
  1229. },
  1230. methods: {
  1231. focus: function focus() {
  1232. if (!this.ranged) {
  1233. this.$refs.reference.focus();
  1234. } else {
  1235. this.handleFocus();
  1236. }
  1237. },
  1238. blur: function blur() {
  1239. this.refInput.forEach(function (input) {
  1240. return input.blur();
  1241. });
  1242. },
  1243. // {parse, formatTo} Value deals maps component value with internal Date
  1244. parseValue: function parseValue(value) {
  1245. var isParsed = Object(date_util_["isDateObject"])(value) || Array.isArray(value) && value.every(date_util_["isDateObject"]);
  1246. if (this.valueFormat && !isParsed) {
  1247. return parseAsFormatAndType(value, this.valueFormat, this.type, this.rangeSeparator) || value;
  1248. } else {
  1249. return value;
  1250. }
  1251. },
  1252. formatToValue: function formatToValue(date) {
  1253. var isFormattable = Object(date_util_["isDateObject"])(date) || Array.isArray(date) && date.every(date_util_["isDateObject"]);
  1254. if (this.valueFormat && isFormattable) {
  1255. return formatAsFormatAndType(date, this.valueFormat, this.type, this.rangeSeparator);
  1256. } else {
  1257. return date;
  1258. }
  1259. },
  1260. // {parse, formatTo} String deals with user input
  1261. parseString: function parseString(value) {
  1262. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1263. return parseAsFormatAndType(value, this.format, type);
  1264. },
  1265. formatToString: function formatToString(value) {
  1266. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1267. return formatAsFormatAndType(value, this.format, type);
  1268. },
  1269. handleMouseEnter: function handleMouseEnter() {
  1270. if (this.readonly || this.pickerDisabled) return;
  1271. if (!this.valueIsEmpty && this.clearable) {
  1272. this.showClose = true;
  1273. }
  1274. },
  1275. handleChange: function handleChange() {
  1276. if (this.userInput) {
  1277. var value = this.parseString(this.displayValue);
  1278. if (value) {
  1279. this.picker.value = value;
  1280. if (this.isValidValue(value)) {
  1281. this.emitInput(value);
  1282. this.userInput = null;
  1283. }
  1284. }
  1285. }
  1286. if (this.userInput === '') {
  1287. this.emitInput(null);
  1288. this.emitChange(null);
  1289. this.userInput = null;
  1290. }
  1291. },
  1292. handleStartInput: function handleStartInput(event) {
  1293. if (this.userInput) {
  1294. this.userInput = [event.target.value, this.userInput[1]];
  1295. } else {
  1296. this.userInput = [event.target.value, null];
  1297. }
  1298. },
  1299. handleEndInput: function handleEndInput(event) {
  1300. if (this.userInput) {
  1301. this.userInput = [this.userInput[0], event.target.value];
  1302. } else {
  1303. this.userInput = [null, event.target.value];
  1304. }
  1305. },
  1306. handleStartChange: function handleStartChange(event) {
  1307. var value = this.parseString(this.userInput && this.userInput[0]);
  1308. if (value) {
  1309. this.userInput = [this.formatToString(value), this.displayValue[1]];
  1310. var newValue = [value, this.picker.value && this.picker.value[1]];
  1311. this.picker.value = newValue;
  1312. if (this.isValidValue(newValue)) {
  1313. this.emitInput(newValue);
  1314. this.userInput = null;
  1315. }
  1316. }
  1317. },
  1318. handleEndChange: function handleEndChange(event) {
  1319. var value = this.parseString(this.userInput && this.userInput[1]);
  1320. if (value) {
  1321. this.userInput = [this.displayValue[0], this.formatToString(value)];
  1322. var newValue = [this.picker.value && this.picker.value[0], value];
  1323. this.picker.value = newValue;
  1324. if (this.isValidValue(newValue)) {
  1325. this.emitInput(newValue);
  1326. this.userInput = null;
  1327. }
  1328. }
  1329. },
  1330. handleClickIcon: function handleClickIcon(event) {
  1331. if (this.readonly || this.pickerDisabled) return;
  1332. if (this.showClose) {
  1333. this.valueOnOpen = this.value;
  1334. event.stopPropagation();
  1335. this.emitInput(null);
  1336. this.emitChange(null);
  1337. this.showClose = false;
  1338. if (this.picker && typeof this.picker.handleClear === 'function') {
  1339. this.picker.handleClear();
  1340. }
  1341. } else {
  1342. this.pickerVisible = !this.pickerVisible;
  1343. }
  1344. },
  1345. handleClose: function handleClose() {
  1346. if (!this.pickerVisible) return;
  1347. this.pickerVisible = false;
  1348. if (this.type === 'dates') {
  1349. // restore to former value
  1350. var oldValue = parseAsFormatAndType(this.valueOnOpen, this.valueFormat, this.type, this.rangeSeparator) || this.valueOnOpen;
  1351. this.emitInput(oldValue);
  1352. }
  1353. },
  1354. handleFieldReset: function handleFieldReset(initialValue) {
  1355. this.userInput = initialValue === '' ? null : initialValue;
  1356. },
  1357. handleFocus: function handleFocus() {
  1358. var type = this.type;
  1359. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1360. this.pickerVisible = true;
  1361. }
  1362. this.$emit('focus', this);
  1363. },
  1364. handleKeydown: function handleKeydown(event) {
  1365. var _this = this;
  1366. var keyCode = event.keyCode;
  1367. // ESC
  1368. if (keyCode === 27) {
  1369. this.pickerVisible = false;
  1370. event.stopPropagation();
  1371. return;
  1372. }
  1373. // Tab
  1374. if (keyCode === 9) {
  1375. if (!this.ranged) {
  1376. this.handleChange();
  1377. this.pickerVisible = this.picker.visible = false;
  1378. this.blur();
  1379. event.stopPropagation();
  1380. } else {
  1381. // user may change focus between two input
  1382. setTimeout(function () {
  1383. if (_this.refInput.indexOf(document.activeElement) === -1) {
  1384. _this.pickerVisible = false;
  1385. _this.blur();
  1386. event.stopPropagation();
  1387. }
  1388. }, 0);
  1389. }
  1390. return;
  1391. }
  1392. // Enter
  1393. if (keyCode === 13) {
  1394. if (this.userInput === '' || this.isValidValue(this.parseString(this.displayValue))) {
  1395. this.handleChange();
  1396. this.pickerVisible = this.picker.visible = false;
  1397. this.blur();
  1398. }
  1399. event.stopPropagation();
  1400. return;
  1401. }
  1402. // if user is typing, do not let picker handle key input
  1403. if (this.userInput) {
  1404. event.stopPropagation();
  1405. return;
  1406. }
  1407. // delegate other keys to panel
  1408. if (this.picker && this.picker.handleKeydown) {
  1409. this.picker.handleKeydown(event);
  1410. }
  1411. },
  1412. handleRangeClick: function handleRangeClick() {
  1413. var type = this.type;
  1414. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1415. this.pickerVisible = true;
  1416. }
  1417. this.$emit('focus', this);
  1418. },
  1419. hidePicker: function hidePicker() {
  1420. if (this.picker) {
  1421. this.picker.resetView && this.picker.resetView();
  1422. this.pickerVisible = this.picker.visible = false;
  1423. this.destroyPopper();
  1424. }
  1425. },
  1426. showPicker: function showPicker() {
  1427. var _this2 = this;
  1428. if (this.$isServer) return;
  1429. if (!this.picker) {
  1430. this.mountPicker();
  1431. }
  1432. this.pickerVisible = this.picker.visible = true;
  1433. this.updatePopper();
  1434. this.picker.value = this.parsedValue;
  1435. this.picker.resetView && this.picker.resetView();
  1436. this.$nextTick(function () {
  1437. _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
  1438. });
  1439. },
  1440. mountPicker: function mountPicker() {
  1441. var _this3 = this;
  1442. this.picker = new external_vue_default.a(this.panel).$mount();
  1443. this.picker.defaultValue = this.defaultValue;
  1444. this.picker.defaultTime = this.defaultTime;
  1445. this.picker.popperClass = this.popperClass;
  1446. this.popperElm = this.picker.$el;
  1447. this.picker.width = this.reference.getBoundingClientRect().width;
  1448. this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
  1449. this.picker.selectionMode = this.selectionMode;
  1450. this.picker.unlinkPanels = this.unlinkPanels;
  1451. this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
  1452. this.$watch('format', function (format) {
  1453. _this3.picker.format = format;
  1454. });
  1455. var updateOptions = function updateOptions() {
  1456. var options = _this3.pickerOptions;
  1457. if (options && options.selectableRange) {
  1458. var ranges = options.selectableRange;
  1459. var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
  1460. var format = DEFAULT_FORMATS.timerange;
  1461. ranges = Array.isArray(ranges) ? ranges : [ranges];
  1462. _this3.picker.selectableRange = ranges.map(function (range) {
  1463. return parser(range, format, _this3.rangeSeparator);
  1464. });
  1465. }
  1466. for (var option in options) {
  1467. if (options.hasOwnProperty(option) &&
  1468. // 忽略 time-picker 的该配置项
  1469. option !== 'selectableRange') {
  1470. _this3.picker[option] = options[option];
  1471. }
  1472. }
  1473. // main format must prevail over undocumented pickerOptions.format
  1474. if (_this3.format) {
  1475. _this3.picker.format = _this3.format;
  1476. }
  1477. };
  1478. updateOptions();
  1479. this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
  1480. return updateOptions();
  1481. }, { deep: true });
  1482. this.$el.appendChild(this.picker.$el);
  1483. this.picker.resetView && this.picker.resetView();
  1484. this.picker.$on('dodestroy', this.doDestroy);
  1485. this.picker.$on('pick', function () {
  1486. var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  1487. var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1488. _this3.userInput = null;
  1489. _this3.pickerVisible = _this3.picker.visible = visible;
  1490. _this3.emitInput(date);
  1491. _this3.picker.resetView && _this3.picker.resetView();
  1492. });
  1493. this.picker.$on('select-range', function (start, end, pos) {
  1494. if (_this3.refInput.length === 0) return;
  1495. if (!pos || pos === 'min') {
  1496. _this3.refInput[0].setSelectionRange(start, end);
  1497. _this3.refInput[0].focus();
  1498. } else if (pos === 'max') {
  1499. _this3.refInput[1].setSelectionRange(start, end);
  1500. _this3.refInput[1].focus();
  1501. }
  1502. });
  1503. },
  1504. unmountPicker: function unmountPicker() {
  1505. if (this.picker) {
  1506. this.picker.$destroy();
  1507. this.picker.$off();
  1508. if (typeof this.unwatchPickerOptions === 'function') {
  1509. this.unwatchPickerOptions();
  1510. }
  1511. this.picker.$el.parentNode.removeChild(this.picker.$el);
  1512. }
  1513. },
  1514. emitChange: function emitChange(val) {
  1515. // determine user real change only
  1516. if (!valueEquals(val, this.valueOnOpen)) {
  1517. this.$emit('change', val);
  1518. this.valueOnOpen = val;
  1519. if (this.validateEvent) {
  1520. this.dispatch('ElFormItem', 'el.form.change', val);
  1521. }
  1522. }
  1523. },
  1524. emitInput: function emitInput(val) {
  1525. var formatted = this.formatToValue(val);
  1526. if (!valueEquals(this.value, formatted)) {
  1527. this.$emit('input', formatted);
  1528. }
  1529. },
  1530. isValidValue: function isValidValue(value) {
  1531. if (!this.picker) {
  1532. this.mountPicker();
  1533. }
  1534. if (this.picker.isValidValue) {
  1535. return value && this.picker.isValidValue(value);
  1536. } else {
  1537. return true;
  1538. }
  1539. }
  1540. }
  1541. });
  1542. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=script&lang=js&
  1543. /* harmony default export */ var src_pickervue_type_script_lang_js_ = (pickervue_type_script_lang_js_);
  1544. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1545. var componentNormalizer = __webpack_require__(0);
  1546. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue
  1547. /* normalize component */
  1548. var component = Object(componentNormalizer["a" /* default */])(
  1549. src_pickervue_type_script_lang_js_,
  1550. render,
  1551. staticRenderFns,
  1552. false,
  1553. null,
  1554. null,
  1555. null
  1556. )
  1557. /* hot reload */
  1558. if (false) { var api; }
  1559. component.options.__file = "packages/date-picker/src/picker.vue"
  1560. /* harmony default export */ var picker = __webpack_exports__["a"] = (component.exports);
  1561. /***/ }),
  1562. /***/ 34:
  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__(15);
  1923. var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
  1924. // EXTERNAL MODULE: ./src/directives/repeat-click.js
  1925. var repeat_click = __webpack_require__(30);
  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 bindFunction = function bindFunction(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. bindFunction('hours');
  2134. bindFunction('minutes');
  2135. bindFunction('seconds');
  2136. },
  2137. handleScroll: function handleScroll(type) {
  2138. var value = Math.min(Math.round((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. var _this3 = this;
  2161. if (!this.currentScrollbar) {
  2162. this.emitSelectRange('hours');
  2163. }
  2164. var label = this.currentScrollbar;
  2165. var hoursList = this.hoursList;
  2166. var now = this[label];
  2167. if (this.currentScrollbar === 'hours') {
  2168. var total = Math.abs(step);
  2169. step = step > 0 ? 1 : -1;
  2170. var length = hoursList.length;
  2171. while (length-- && total) {
  2172. now = (now + step + hoursList.length) % hoursList.length;
  2173. if (hoursList[now]) {
  2174. continue;
  2175. }
  2176. total--;
  2177. }
  2178. if (hoursList[now]) return;
  2179. } else {
  2180. now = (now + step + 60) % 60;
  2181. }
  2182. this.modifyDateField(label, now);
  2183. this.adjustSpinner(label, now);
  2184. this.$nextTick(function () {
  2185. return _this3.emitSelectRange(_this3.currentScrollbar);
  2186. });
  2187. },
  2188. amPm: function amPm(hour) {
  2189. var shouldShowAmPm = this.amPmMode.toLowerCase() === 'a';
  2190. if (!shouldShowAmPm) return '';
  2191. var isCapital = this.amPmMode === 'A';
  2192. var content = hour < 12 ? ' am' : ' pm';
  2193. if (isCapital) content = content.toUpperCase();
  2194. return content;
  2195. },
  2196. typeItemHeight: function typeItemHeight(type) {
  2197. return this.$refs[type].$el.querySelector('li').offsetHeight;
  2198. },
  2199. scrollBarHeight: function scrollBarHeight(type) {
  2200. return this.$refs[type].$el.offsetHeight;
  2201. }
  2202. }
  2203. });
  2204. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=script&lang=js&
  2205. /* harmony default export */ var basic_time_spinnervue_type_script_lang_js_ = (time_spinnervue_type_script_lang_js_);
  2206. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2207. var componentNormalizer = __webpack_require__(0);
  2208. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue
  2209. /* normalize component */
  2210. var component = Object(componentNormalizer["a" /* default */])(
  2211. basic_time_spinnervue_type_script_lang_js_,
  2212. render,
  2213. staticRenderFns,
  2214. false,
  2215. null,
  2216. null,
  2217. null
  2218. )
  2219. /* hot reload */
  2220. if (false) { var api; }
  2221. component.options.__file = "packages/date-picker/src/basic/time-spinner.vue"
  2222. /* harmony default export */ var time_spinner = __webpack_exports__["a"] = (component.exports);
  2223. /***/ }),
  2224. /***/ 4:
  2225. /***/ (function(module, exports) {
  2226. module.exports = require("element-ui/lib/mixins/emitter");
  2227. /***/ }),
  2228. /***/ 5:
  2229. /***/ (function(module, exports) {
  2230. module.exports = require("element-ui/lib/utils/vue-popper");
  2231. /***/ }),
  2232. /***/ 6:
  2233. /***/ (function(module, exports) {
  2234. module.exports = require("element-ui/lib/mixins/locale");
  2235. /***/ }),
  2236. /***/ 7:
  2237. /***/ (function(module, exports) {
  2238. module.exports = require("vue");
  2239. /***/ }),
  2240. /***/ 76:
  2241. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2242. "use strict";
  2243. __webpack_require__.r(__webpack_exports__);
  2244. // EXTERNAL MODULE: ./packages/date-picker/src/picker.vue + 4 modules
  2245. var picker = __webpack_require__(32);
  2246. // EXTERNAL MODULE: ./packages/date-picker/src/panel/time.vue + 4 modules
  2247. var time = __webpack_require__(27);
  2248. // 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&
  2249. var render = function() {
  2250. var _vm = this
  2251. var _h = _vm.$createElement
  2252. var _c = _vm._self._c || _h
  2253. return _c(
  2254. "transition",
  2255. {
  2256. attrs: { name: "el-zoom-in-top" },
  2257. on: {
  2258. "after-leave": function($event) {
  2259. _vm.$emit("dodestroy")
  2260. }
  2261. }
  2262. },
  2263. [
  2264. _c(
  2265. "div",
  2266. {
  2267. directives: [
  2268. {
  2269. name: "show",
  2270. rawName: "v-show",
  2271. value: _vm.visible,
  2272. expression: "visible"
  2273. }
  2274. ],
  2275. staticClass: "el-time-range-picker el-picker-panel el-popper",
  2276. class: _vm.popperClass
  2277. },
  2278. [
  2279. _c("div", { staticClass: "el-time-range-picker__content" }, [
  2280. _c("div", { staticClass: "el-time-range-picker__cell" }, [
  2281. _c("div", { staticClass: "el-time-range-picker__header" }, [
  2282. _vm._v(_vm._s(_vm.t("el.datepicker.startTime")))
  2283. ]),
  2284. _c(
  2285. "div",
  2286. {
  2287. staticClass:
  2288. "el-time-range-picker__body el-time-panel__content",
  2289. class: {
  2290. "has-seconds": _vm.showSeconds,
  2291. "is-arrow": _vm.arrowControl
  2292. }
  2293. },
  2294. [
  2295. _c("time-spinner", {
  2296. ref: "minSpinner",
  2297. attrs: {
  2298. "show-seconds": _vm.showSeconds,
  2299. "am-pm-mode": _vm.amPmMode,
  2300. "arrow-control": _vm.arrowControl,
  2301. date: _vm.minDate
  2302. },
  2303. on: {
  2304. change: _vm.handleMinChange,
  2305. "select-range": _vm.setMinSelectionRange
  2306. }
  2307. })
  2308. ],
  2309. 1
  2310. )
  2311. ]),
  2312. _c("div", { staticClass: "el-time-range-picker__cell" }, [
  2313. _c("div", { staticClass: "el-time-range-picker__header" }, [
  2314. _vm._v(_vm._s(_vm.t("el.datepicker.endTime")))
  2315. ]),
  2316. _c(
  2317. "div",
  2318. {
  2319. staticClass:
  2320. "el-time-range-picker__body el-time-panel__content",
  2321. class: {
  2322. "has-seconds": _vm.showSeconds,
  2323. "is-arrow": _vm.arrowControl
  2324. }
  2325. },
  2326. [
  2327. _c("time-spinner", {
  2328. ref: "maxSpinner",
  2329. attrs: {
  2330. "show-seconds": _vm.showSeconds,
  2331. "am-pm-mode": _vm.amPmMode,
  2332. "arrow-control": _vm.arrowControl,
  2333. date: _vm.maxDate
  2334. },
  2335. on: {
  2336. change: _vm.handleMaxChange,
  2337. "select-range": _vm.setMaxSelectionRange
  2338. }
  2339. })
  2340. ],
  2341. 1
  2342. )
  2343. ])
  2344. ]),
  2345. _c("div", { staticClass: "el-time-panel__footer" }, [
  2346. _c(
  2347. "button",
  2348. {
  2349. staticClass: "el-time-panel__btn cancel",
  2350. attrs: { type: "button" },
  2351. on: {
  2352. click: function($event) {
  2353. _vm.handleCancel()
  2354. }
  2355. }
  2356. },
  2357. [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))]
  2358. ),
  2359. _c(
  2360. "button",
  2361. {
  2362. staticClass: "el-time-panel__btn confirm",
  2363. attrs: { type: "button", disabled: _vm.btnDisabled },
  2364. on: {
  2365. click: function($event) {
  2366. _vm.handleConfirm()
  2367. }
  2368. }
  2369. },
  2370. [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))]
  2371. )
  2372. ])
  2373. ]
  2374. )
  2375. ]
  2376. )
  2377. }
  2378. var staticRenderFns = []
  2379. render._withStripped = true
  2380. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue?vue&type=template&id=fb28660e&
  2381. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  2382. var date_util_ = __webpack_require__(1);
  2383. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  2384. var locale_ = __webpack_require__(6);
  2385. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  2386. // EXTERNAL MODULE: ./packages/date-picker/src/basic/time-spinner.vue + 4 modules
  2387. var time_spinner = __webpack_require__(34);
  2388. // 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&
  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. //
  2435. //
  2436. //
  2437. //
  2438. //
  2439. //
  2440. //
  2441. //
  2442. //
  2443. //
  2444. //
  2445. //
  2446. var MIN_TIME = Object(date_util_["parseDate"])('00:00:00', 'HH:mm:ss');
  2447. var MAX_TIME = Object(date_util_["parseDate"])('23:59:59', 'HH:mm:ss');
  2448. var time_rangevue_type_script_lang_js_minTimeOfDay = function minTimeOfDay(date) {
  2449. return Object(date_util_["modifyDate"])(MIN_TIME, date.getFullYear(), date.getMonth(), date.getDate());
  2450. };
  2451. var time_rangevue_type_script_lang_js_maxTimeOfDay = function maxTimeOfDay(date) {
  2452. return Object(date_util_["modifyDate"])(MAX_TIME, date.getFullYear(), date.getMonth(), date.getDate());
  2453. };
  2454. // increase time by amount of milliseconds, but within the range of day
  2455. var advanceTime = function advanceTime(date, amount) {
  2456. return new Date(Math.min(date.getTime() + amount, time_rangevue_type_script_lang_js_maxTimeOfDay(date).getTime()));
  2457. };
  2458. /* harmony default export */ var time_rangevue_type_script_lang_js_ = ({
  2459. mixins: [locale_default.a],
  2460. components: { TimeSpinner: time_spinner["a" /* default */] },
  2461. computed: {
  2462. showSeconds: function showSeconds() {
  2463. return (this.format || '').indexOf('ss') !== -1;
  2464. },
  2465. offset: function offset() {
  2466. return this.showSeconds ? 11 : 8;
  2467. },
  2468. spinner: function spinner() {
  2469. return this.selectionRange[0] < this.offset ? this.$refs.minSpinner : this.$refs.maxSpinner;
  2470. },
  2471. btnDisabled: function btnDisabled() {
  2472. return this.minDate.getTime() > this.maxDate.getTime();
  2473. },
  2474. amPmMode: function amPmMode() {
  2475. if ((this.format || '').indexOf('A') !== -1) return 'A';
  2476. if ((this.format || '').indexOf('a') !== -1) return 'a';
  2477. return '';
  2478. }
  2479. },
  2480. data: function data() {
  2481. return {
  2482. popperClass: '',
  2483. minDate: new Date(),
  2484. maxDate: new Date(),
  2485. value: [],
  2486. oldValue: [new Date(), new Date()],
  2487. defaultValue: null,
  2488. format: 'HH:mm:ss',
  2489. visible: false,
  2490. selectionRange: [0, 2],
  2491. arrowControl: false
  2492. };
  2493. },
  2494. watch: {
  2495. value: function value(_value) {
  2496. if (Array.isArray(_value)) {
  2497. this.minDate = new Date(_value[0]);
  2498. this.maxDate = new Date(_value[1]);
  2499. } else {
  2500. if (Array.isArray(this.defaultValue)) {
  2501. this.minDate = new Date(this.defaultValue[0]);
  2502. this.maxDate = new Date(this.defaultValue[1]);
  2503. } else if (this.defaultValue) {
  2504. this.minDate = new Date(this.defaultValue);
  2505. this.maxDate = advanceTime(new Date(this.defaultValue), 60 * 60 * 1000);
  2506. } else {
  2507. this.minDate = new Date();
  2508. this.maxDate = advanceTime(new Date(), 60 * 60 * 1000);
  2509. }
  2510. }
  2511. },
  2512. visible: function visible(val) {
  2513. var _this = this;
  2514. if (val) {
  2515. this.oldValue = this.value;
  2516. this.$nextTick(function () {
  2517. return _this.$refs.minSpinner.emitSelectRange('hours');
  2518. });
  2519. }
  2520. }
  2521. },
  2522. methods: {
  2523. handleClear: function handleClear() {
  2524. this.$emit('pick', null);
  2525. },
  2526. handleCancel: function handleCancel() {
  2527. this.$emit('pick', this.oldValue);
  2528. },
  2529. handleMinChange: function handleMinChange(date) {
  2530. this.minDate = Object(date_util_["clearMilliseconds"])(date);
  2531. this.handleChange();
  2532. },
  2533. handleMaxChange: function handleMaxChange(date) {
  2534. this.maxDate = Object(date_util_["clearMilliseconds"])(date);
  2535. this.handleChange();
  2536. },
  2537. handleChange: function handleChange() {
  2538. if (this.isValidValue([this.minDate, this.maxDate])) {
  2539. this.$refs.minSpinner.selectableRange = [[time_rangevue_type_script_lang_js_minTimeOfDay(this.minDate), this.maxDate]];
  2540. this.$refs.maxSpinner.selectableRange = [[this.minDate, time_rangevue_type_script_lang_js_maxTimeOfDay(this.maxDate)]];
  2541. this.$emit('pick', [this.minDate, this.maxDate], true);
  2542. }
  2543. },
  2544. setMinSelectionRange: function setMinSelectionRange(start, end) {
  2545. this.$emit('select-range', start, end, 'min');
  2546. this.selectionRange = [start, end];
  2547. },
  2548. setMaxSelectionRange: function setMaxSelectionRange(start, end) {
  2549. this.$emit('select-range', start, end, 'max');
  2550. this.selectionRange = [start + this.offset, end + this.offset];
  2551. },
  2552. handleConfirm: function handleConfirm() {
  2553. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2554. var minSelectableRange = this.$refs.minSpinner.selectableRange;
  2555. var maxSelectableRange = this.$refs.maxSpinner.selectableRange;
  2556. this.minDate = Object(date_util_["limitTimeRange"])(this.minDate, minSelectableRange, this.format);
  2557. this.maxDate = Object(date_util_["limitTimeRange"])(this.maxDate, maxSelectableRange, this.format);
  2558. this.$emit('pick', [this.minDate, this.maxDate], visible);
  2559. },
  2560. adjustSpinners: function adjustSpinners() {
  2561. this.$refs.minSpinner.adjustSpinners();
  2562. this.$refs.maxSpinner.adjustSpinners();
  2563. },
  2564. changeSelectionRange: function changeSelectionRange(step) {
  2565. var list = this.showSeconds ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  2566. var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
  2567. var index = list.indexOf(this.selectionRange[0]);
  2568. var next = (index + step + list.length) % list.length;
  2569. var half = list.length / 2;
  2570. if (next < half) {
  2571. this.$refs.minSpinner.emitSelectRange(mapping[next]);
  2572. } else {
  2573. this.$refs.maxSpinner.emitSelectRange(mapping[next - half]);
  2574. }
  2575. },
  2576. isValidValue: function isValidValue(date) {
  2577. return Array.isArray(date) && Object(date_util_["timeWithinRange"])(this.minDate, this.$refs.minSpinner.selectableRange) && Object(date_util_["timeWithinRange"])(this.maxDate, this.$refs.maxSpinner.selectableRange);
  2578. },
  2579. handleKeydown: function handleKeydown(event) {
  2580. var keyCode = event.keyCode;
  2581. var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
  2582. // Left or Right
  2583. if (keyCode === 37 || keyCode === 39) {
  2584. var step = mapping[keyCode];
  2585. this.changeSelectionRange(step);
  2586. event.preventDefault();
  2587. return;
  2588. }
  2589. // Up or Down
  2590. if (keyCode === 38 || keyCode === 40) {
  2591. var _step = mapping[keyCode];
  2592. this.spinner.scrollDown(_step);
  2593. event.preventDefault();
  2594. return;
  2595. }
  2596. }
  2597. }
  2598. });
  2599. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue?vue&type=script&lang=js&
  2600. /* harmony default export */ var panel_time_rangevue_type_script_lang_js_ = (time_rangevue_type_script_lang_js_);
  2601. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2602. var componentNormalizer = __webpack_require__(0);
  2603. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue
  2604. /* normalize component */
  2605. var component = Object(componentNormalizer["a" /* default */])(
  2606. panel_time_rangevue_type_script_lang_js_,
  2607. render,
  2608. staticRenderFns,
  2609. false,
  2610. null,
  2611. null,
  2612. null
  2613. )
  2614. /* hot reload */
  2615. if (false) { var api; }
  2616. component.options.__file = "packages/date-picker/src/panel/time-range.vue"
  2617. /* harmony default export */ var time_range = (component.exports);
  2618. // CONCATENATED MODULE: ./packages/date-picker/src/picker/time-picker.js
  2619. /* harmony default export */ var time_picker = ({
  2620. mixins: [picker["a" /* default */]],
  2621. name: 'ElTimePicker',
  2622. props: {
  2623. isRange: Boolean,
  2624. arrowControl: Boolean
  2625. },
  2626. data: function data() {
  2627. return {
  2628. type: ''
  2629. };
  2630. },
  2631. watch: {
  2632. isRange: function isRange(_isRange) {
  2633. if (this.picker) {
  2634. this.unmountPicker();
  2635. this.type = _isRange ? 'timerange' : 'time';
  2636. this.panel = _isRange ? time_range : time["a" /* default */];
  2637. this.mountPicker();
  2638. } else {
  2639. this.type = _isRange ? 'timerange' : 'time';
  2640. this.panel = _isRange ? time_range : time["a" /* default */];
  2641. }
  2642. }
  2643. },
  2644. created: function created() {
  2645. this.type = this.isRange ? 'timerange' : 'time';
  2646. this.panel = this.isRange ? time_range : time["a" /* default */];
  2647. }
  2648. });
  2649. // CONCATENATED MODULE: ./packages/time-picker/index.js
  2650. /* istanbul ignore next */
  2651. time_picker.install = function (Vue) {
  2652. Vue.component(time_picker.name, time_picker);
  2653. };
  2654. /* harmony default export */ var packages_time_picker = __webpack_exports__["default"] = (time_picker);
  2655. /***/ }),
  2656. /***/ 9:
  2657. /***/ (function(module, exports) {
  2658. module.exports = require("element-ui/lib/utils/merge");
  2659. /***/ })
  2660. /******/ });