UNPKG

element-ui-for-gov

Version:

element-ui for gov

1,740 lines (1,589 loc) 85.4 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 298); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/utils/date-util"); /***/ }), /***/ 1: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } } /***/ }), /***/ 11: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/utils/merge"); /***/ }), /***/ 12: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/utils/clickoutside"); /***/ }), /***/ 13: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/scrollbar"); /***/ }), /***/ 28: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // 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& var render = function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "transition", { attrs: { name: "el-zoom-in-top" }, on: { "after-leave": function($event) { _vm.$emit("dodestroy") } } }, [ _c( "div", { directives: [ { name: "show", rawName: "v-show", value: _vm.visible, expression: "visible" } ], staticClass: "el-time-panel el-popper", class: _vm.popperClass }, [ _c( "div", { staticClass: "el-time-panel__content", class: { "has-seconds": _vm.showSeconds } }, [ _c("time-spinner", { ref: "spinner", attrs: { "arrow-control": _vm.useArrow, "show-seconds": _vm.showSeconds, "am-pm-mode": _vm.amPmMode, date: _vm.date }, on: { change: _vm.handleChange, "select-range": _vm.setSelectionRange } }) ], 1 ), _c("div", { staticClass: "el-time-panel__footer" }, [ _c( "button", { staticClass: "el-time-panel__btn cancel", attrs: { type: "button" }, on: { click: _vm.handleCancel } }, [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))] ), _c( "button", { staticClass: "el-time-panel__btn", class: { confirm: !_vm.disabled }, attrs: { type: "button" }, on: { click: function($event) { _vm.handleConfirm() } } }, [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))] ) ]) ] ) ] ) } var staticRenderFns = [] render._withStripped = true // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=template&id=3d939089& // EXTERNAL MODULE: external "element-ui-for-gov/lib/utils/date-util" var date_util_ = __webpack_require__(0); // EXTERNAL MODULE: external "element-ui-for-gov/lib/mixins/locale" var locale_ = __webpack_require__(7); var locale_default = /*#__PURE__*/__webpack_require__.n(locale_); // EXTERNAL MODULE: ./packages/date-picker/src/basic/time-spinner.vue + 5 modules var time_spinner = __webpack_require__(37); // 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& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var timevue_type_script_lang_js_ = ({ mixins: [locale_default.a], components: { TimeSpinner: time_spinner["a" /* default */] }, props: { visible: Boolean, timeArrowControl: Boolean }, watch: { visible: function visible(val) { var _this = this; if (val) { this.oldValue = this.value; this.$nextTick(function () { return _this.$refs.spinner.emitSelectRange('hours'); }); } else { this.needInitAdjust = true; } }, value: function value(newVal) { var _this2 = this; var date = void 0; if (newVal instanceof Date) { date = Object(date_util_["limitTimeRange"])(newVal, this.selectableRange, this.format); } else if (!newVal) { date = this.defaultValue ? new Date(this.defaultValue) : new Date(); } this.date = date; if (this.visible && this.needInitAdjust) { this.$nextTick(function (_) { return _this2.adjustSpinners(); }); this.needInitAdjust = false; } }, selectableRange: function selectableRange(val) { this.$refs.spinner.selectableRange = val; }, defaultValue: function defaultValue(val) { if (!Object(date_util_["isDate"])(this.value)) { this.date = val ? new Date(val) : new Date(); } } }, data: function data() { return { popperClass: '', format: 'HH:mm:ss', value: '', defaultValue: null, date: new Date(), oldValue: new Date(), selectableRange: [], selectionRange: [0, 2], disabled: false, arrowControl: false, needInitAdjust: true }; }, computed: { showSeconds: function showSeconds() { return (this.format || '').indexOf('ss') !== -1; }, useArrow: function useArrow() { return this.arrowControl || this.timeArrowControl || false; }, amPmMode: function amPmMode() { if ((this.format || '').indexOf('A') !== -1) return 'A'; if ((this.format || '').indexOf('a') !== -1) return 'a'; return ''; } }, methods: { handleCancel: function handleCancel() { this.$emit('pick', this.oldValue, false); }, handleChange: function handleChange(date) { // this.visible avoids edge cases, when use scrolls during panel closing animation if (this.visible) { this.date = Object(date_util_["clearMilliseconds"])(date); // if date is out of range, do not emit if (this.isValidValue(this.date)) { this.$emit('pick', this.date, true); } } }, setSelectionRange: function setSelectionRange(start, end) { this.$emit('select-range', start, end); this.selectionRange = [start, end]; }, handleConfirm: function handleConfirm() { var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var first = arguments[1]; if (first) return; var date = Object(date_util_["clearMilliseconds"])(Object(date_util_["limitTimeRange"])(this.date, this.selectableRange, this.format)); this.$emit('pick', date, visible, first); }, handleKeydown: function handleKeydown(event) { var keyCode = event.keyCode; var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 }; // Left or Right if (keyCode === 37 || keyCode === 39) { var step = mapping[keyCode]; this.changeSelectionRange(step); event.preventDefault(); return; } // Up or Down if (keyCode === 38 || keyCode === 40) { var _step = mapping[keyCode]; this.$refs.spinner.scrollDown(_step); event.preventDefault(); return; } }, isValidValue: function isValidValue(date) { return Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format); }, adjustSpinners: function adjustSpinners() { return this.$refs.spinner.adjustSpinners(); }, changeSelectionRange: function changeSelectionRange(step) { var list = [0, 3].concat(this.showSeconds ? [6] : []); var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []); var index = list.indexOf(this.selectionRange[0]); var next = (index + step + list.length) % list.length; this.$refs.spinner.emitSelectRange(mapping[next]); } }, mounted: function mounted() { var _this3 = this; this.$nextTick(function () { return _this3.handleConfirm(true, true); }); this.$emit('mounted'); } }); // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=script&lang=js& /* harmony default export */ var panel_timevue_type_script_lang_js_ = (timevue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(1); // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( panel_timevue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var api; } component.options.__file = "packages/date-picker/src/panel/time.vue" /* harmony default export */ var time = __webpack_exports__["a"] = (component.exports); /***/ }), /***/ 298: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./packages/date-picker/src/picker.vue + 4 modules var picker = __webpack_require__(48); // EXTERNAL MODULE: ./packages/date-picker/src/panel/time.vue + 4 modules var time = __webpack_require__(28); // 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& var render = function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "transition", { attrs: { name: "el-zoom-in-top" }, on: { "after-leave": function($event) { _vm.$emit("dodestroy") } } }, [ _c( "div", { directives: [ { name: "show", rawName: "v-show", value: _vm.visible, expression: "visible" } ], staticClass: "el-time-range-picker el-picker-panel el-popper", class: _vm.popperClass }, [ _c("div", { staticClass: "el-time-range-picker__content" }, [ _c("div", { staticClass: "el-time-range-picker__cell" }, [ _c("div", { staticClass: "el-time-range-picker__header" }, [ _vm._v(_vm._s(_vm.t("el.datepicker.startTime"))) ]), _c( "div", { staticClass: "el-time-range-picker__body el-time-panel__content", class: { "has-seconds": _vm.showSeconds, "is-arrow": _vm.arrowControl } }, [ _c("time-spinner", { ref: "minSpinner", attrs: { "show-seconds": _vm.showSeconds, "am-pm-mode": _vm.amPmMode, "arrow-control": _vm.arrowControl, date: _vm.minDate }, on: { change: _vm.handleMinChange, "select-range": _vm.setMinSelectionRange } }) ], 1 ) ]), _c("div", { staticClass: "el-time-range-picker__cell" }, [ _c("div", { staticClass: "el-time-range-picker__header" }, [ _vm._v(_vm._s(_vm.t("el.datepicker.endTime"))) ]), _c( "div", { staticClass: "el-time-range-picker__body el-time-panel__content", class: { "has-seconds": _vm.showSeconds, "is-arrow": _vm.arrowControl } }, [ _c("time-spinner", { ref: "maxSpinner", attrs: { "show-seconds": _vm.showSeconds, "am-pm-mode": _vm.amPmMode, "arrow-control": _vm.arrowControl, date: _vm.maxDate }, on: { change: _vm.handleMaxChange, "select-range": _vm.setMaxSelectionRange } }) ], 1 ) ]) ]), _c("div", { staticClass: "el-time-panel__footer" }, [ _c( "button", { staticClass: "el-time-panel__btn cancel", attrs: { type: "button" }, on: { click: function($event) { _vm.handleCancel() } } }, [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))] ), _c( "button", { staticClass: "el-time-panel__btn confirm", attrs: { type: "button", disabled: _vm.btnDisabled }, on: { click: function($event) { _vm.handleConfirm() } } }, [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))] ) ]) ] ) ] ) } var staticRenderFns = [] render._withStripped = true // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue?vue&type=template&id=fb28660e& // EXTERNAL MODULE: external "element-ui-for-gov/lib/utils/date-util" var date_util_ = __webpack_require__(0); // EXTERNAL MODULE: external "element-ui-for-gov/lib/mixins/locale" var locale_ = __webpack_require__(7); var locale_default = /*#__PURE__*/__webpack_require__.n(locale_); // EXTERNAL MODULE: ./packages/date-picker/src/basic/time-spinner.vue + 5 modules var time_spinner = __webpack_require__(37); // 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& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // var MIN_TIME = Object(date_util_["parseDate"])('00:00:00', 'HH:mm:ss'); var MAX_TIME = Object(date_util_["parseDate"])('23:59:59', 'HH:mm:ss'); var time_rangevue_type_script_lang_js_minTimeOfDay = function minTimeOfDay(date) { return Object(date_util_["modifyDate"])(MIN_TIME, date.getFullYear(), date.getMonth(), date.getDate()); }; var time_rangevue_type_script_lang_js_maxTimeOfDay = function maxTimeOfDay(date) { return Object(date_util_["modifyDate"])(MAX_TIME, date.getFullYear(), date.getMonth(), date.getDate()); }; // increase time by amount of milliseconds, but within the range of day var advanceTime = function advanceTime(date, amount) { return new Date(Math.min(date.getTime() + amount, time_rangevue_type_script_lang_js_maxTimeOfDay(date).getTime())); }; /* harmony default export */ var time_rangevue_type_script_lang_js_ = ({ mixins: [locale_default.a], components: { TimeSpinner: time_spinner["a" /* default */] }, computed: { showSeconds: function showSeconds() { return (this.format || '').indexOf('ss') !== -1; }, offset: function offset() { return this.showSeconds ? 11 : 8; }, spinner: function spinner() { return this.selectionRange[0] < this.offset ? this.$refs.minSpinner : this.$refs.maxSpinner; }, btnDisabled: function btnDisabled() { return this.hasLimitRange ? this.minDate.getTime() > this.maxDate.getTime() : false; }, amPmMode: function amPmMode() { if ((this.format || '').indexOf('A') !== -1) return 'A'; if ((this.format || '').indexOf('a') !== -1) return 'a'; return ''; } }, data: function data() { return { popperClass: '', minDate: new Date(), maxDate: new Date(), value: [], oldValue: [new Date(), new Date()], defaultValue: null, format: 'HH:mm:ss', visible: false, selectionRange: [0, 2], arrowControl: false, hasLimitRange: true }; }, watch: { value: function value(_value) { if (Array.isArray(_value)) { this.minDate = new Date(_value[0]); if (!_value[1]) { this.maxDate = time_rangevue_type_script_lang_js_maxTimeOfDay(this.minDate); } else { this.maxDate = new Date(_value[1]); } } else { if (Array.isArray(this.defaultValue)) { this.minDate = new Date(this.defaultValue[0]); this.maxDate = new Date(this.defaultValue[1]); } else if (this.defaultValue) { this.minDate = new Date(this.defaultValue); this.maxDate = advanceTime(new Date(this.defaultValue), 60 * 60 * 1000); } else { this.minDate = new Date(); this.maxDate = advanceTime(new Date(), 60 * 60 * 1000); } } }, visible: function visible(val) { var _this = this; if (val) { this.oldValue = this.value; this.$nextTick(function () { return _this.$refs.minSpinner.emitSelectRange('hours'); }); } } }, methods: { handleClear: function handleClear() { this.$emit('pick', null); }, handleCancel: function handleCancel() { this.$emit('pick', this.oldValue); }, handleMinChange: function handleMinChange(date) { this.minDate = Object(date_util_["clearMilliseconds"])(date); this.handleChange(); }, handleMaxChange: function handleMaxChange(date) { this.maxDate = Object(date_util_["clearMilliseconds"])(date); this.handleChange(); }, handleChange: function handleChange() { if (this.hasLimitRange) { if (this.isValidValue([this.minDate, this.maxDate])) { this.$refs.minSpinner.selectableRange = [[time_rangevue_type_script_lang_js_minTimeOfDay(this.minDate), this.maxDate]]; this.$refs.maxSpinner.selectableRange = [[this.minDate, time_rangevue_type_script_lang_js_maxTimeOfDay(this.maxDate)]]; this.$emit('pick', [this.minDate, this.maxDate], true); } } else { this.$emit('pick', [this.minDate, this.maxDate], true); } }, setMinSelectionRange: function setMinSelectionRange(start, end) { this.$emit('select-range', start, end, 'min'); this.selectionRange = [start, end]; }, setMaxSelectionRange: function setMaxSelectionRange(start, end) { this.$emit('select-range', start, end, 'max'); this.selectionRange = [start + this.offset, end + this.offset]; }, handleConfirm: function handleConfirm() { var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var minSelectableRange = this.hasLimitRange ? this.$refs.minSpinner.selectableRange : []; var maxSelectableRange = this.hasLimitRange ? this.$refs.maxSpinner.selectableRange : []; this.minDate = Object(date_util_["limitTimeRange"])(this.minDate, minSelectableRange, this.format); this.maxDate = Object(date_util_["limitTimeRange"])(this.maxDate, maxSelectableRange, this.format); this.$emit('pick', [this.minDate, this.maxDate], visible); }, adjustSpinners: function adjustSpinners() { this.$refs.minSpinner.adjustSpinners(); this.$refs.maxSpinner.adjustSpinners(); }, changeSelectionRange: function changeSelectionRange(step) { var list = this.showSeconds ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11]; var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []); var index = list.indexOf(this.selectionRange[0]); var next = (index + step + list.length) % list.length; var half = list.length / 2; if (next < half) { this.$refs.minSpinner.emitSelectRange(mapping[next]); } else { this.$refs.maxSpinner.emitSelectRange(mapping[next - half]); } }, isValidValue: function isValidValue(date) { return Array.isArray(date) && Object(date_util_["timeWithinRange"])(this.minDate, this.$refs.minSpinner.selectableRange) && Object(date_util_["timeWithinRange"])(this.maxDate, this.$refs.maxSpinner.selectableRange); }, handleKeydown: function handleKeydown(event) { var keyCode = event.keyCode; var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 }; // Left or Right if (keyCode === 37 || keyCode === 39) { var step = mapping[keyCode]; this.changeSelectionRange(step); event.preventDefault(); return; } // Up or Down if (keyCode === 38 || keyCode === 40) { var _step = mapping[keyCode]; this.spinner.scrollDown(_step); event.preventDefault(); return; } } } }); // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue?vue&type=script&lang=js& /* harmony default export */ var panel_time_rangevue_type_script_lang_js_ = (time_rangevue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(1); // CONCATENATED MODULE: ./packages/date-picker/src/panel/time-range.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( panel_time_rangevue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var api; } component.options.__file = "packages/date-picker/src/panel/time-range.vue" /* harmony default export */ var time_range = (component.exports); // CONCATENATED MODULE: ./packages/date-picker/src/picker/time-picker.js /* harmony default export */ var time_picker = ({ mixins: [picker["a" /* default */]], name: 'ElTimePicker', props: { isRange: Boolean, arrowControl: Boolean, hasLimitRange: { type: Boolean, default: true } }, data: function data() { return { type: '' }; }, watch: { isRange: function isRange(_isRange) { if (this.picker) { this.unmountPicker(); this.type = _isRange ? 'timerange' : 'time'; this.panel = _isRange ? time_range : time["a" /* default */]; this.mountPicker(); } else { this.type = _isRange ? 'timerange' : 'time'; this.panel = _isRange ? time_range : time["a" /* default */]; } } }, created: function created() { this.type = this.isRange ? 'timerange' : 'time'; this.panel = this.isRange ? time_range : time["a" /* default */]; } }); // CONCATENATED MODULE: ./packages/time-picker/index.js /* istanbul ignore next */ time_picker.install = function (Vue) { Vue.component(time_picker.name, time_picker); }; /* harmony default export */ var packages_time_picker = __webpack_exports__["default"] = (time_picker); /***/ }), /***/ 3: /***/ (function(module, exports) { module.exports = require("element-ui-for-gov/lib/utils/dom"); /***/ }), /***/ 37: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // 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& var render = function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "div", { staticClass: "el-time-spinner", class: { "has-seconds": _vm.showSeconds } }, [ !_vm.arrowControl ? [ _c( "el-scrollbar", { ref: "hours", staticClass: "el-time-spinner__wrapper", attrs: { "wrap-style": "max-height: inherit;", "view-class": "el-time-spinner__list", noresize: "", tag: "ul" }, nativeOn: { mouseenter: function($event) { _vm.emitSelectRange("hours") }, mousemove: function($event) { _vm.adjustCurrentSpinner("hours") } } }, _vm._l(_vm.hoursList, function(disabled, hour) { return _c( "li", { key: hour, staticClass: "el-time-spinner__item", class: { active: hour === _vm.hours, disabled: disabled }, on: { click: function($event) { _vm.handleClick("hours", { value: hour, disabled: disabled }) } } }, [ _vm._v( _vm._s( ("0" + (_vm.amPmMode ? hour % 12 || 12 : hour)).slice( -2 ) ) + _vm._s(_vm.amPm(hour)) ) ] ) }), 0 ), _c( "el-scrollbar", { ref: "minutes", staticClass: "el-time-spinner__wrapper", attrs: { "wrap-style": "max-height: inherit;", "view-class": "el-time-spinner__list", noresize: "", tag: "ul" }, nativeOn: { mouseenter: function($event) { _vm.emitSelectRange("minutes") }, mousemove: function($event) { _vm.adjustCurrentSpinner("minutes") } } }, _vm._l(_vm.minutesList, function(enabled, key) { return _c( "li", { key: key, staticClass: "el-time-spinner__item", class: { active: key === _vm.minutes, disabled: !enabled }, on: { click: function($event) { _vm.handleClick("minutes", { value: key, disabled: false }) } } }, [_vm._v(_vm._s(("0" + key).slice(-2)))] ) }), 0 ), _c( "el-scrollbar", { directives: [ { name: "show", rawName: "v-show", value: _vm.showSeconds, expression: "showSeconds" } ], ref: "seconds", staticClass: "el-time-spinner__wrapper", attrs: { "wrap-style": "max-height: inherit;", "view-class": "el-time-spinner__list", noresize: "", tag: "ul" }, nativeOn: { mouseenter: function($event) { _vm.emitSelectRange("seconds") }, mousemove: function($event) { _vm.adjustCurrentSpinner("seconds") } } }, _vm._l(60, function(second, key) { return _c( "li", { key: key, staticClass: "el-time-spinner__item", class: { active: key === _vm.seconds }, on: { click: function($event) { _vm.handleClick("seconds", { value: key, disabled: false }) } } }, [_vm._v(_vm._s(("0" + key).slice(-2)))] ) }), 0 ) ] : _vm._e(), _vm.arrowControl ? [ _c( "div", { staticClass: "el-time-spinner__wrapper is-arrow", on: { mouseenter: function($event) { _vm.emitSelectRange("hours") } } }, [ _c("i", { directives: [ { name: "repeat-click", rawName: "v-repeat-click", value: _vm.decrease, expression: "decrease" } ], staticClass: "el-time-spinner__arrow el-icon-arrow-up" }), _c("i", { directives: [ { name: "repeat-click", rawName: "v-repeat-click", value: _vm.increase, expression: "increase" } ], staticClass: "el-time-spinner__arrow el-icon-arrow-down" }), _c( "ul", { ref: "hours", staticClass: "el-time-spinner__list" }, _vm._l(_vm.arrowHourList, function(hour, key) { return _c( "li", { key: key, staticClass: "el-time-spinner__item", class: { active: hour === _vm.hours, disabled: _vm.hoursList[hour] } }, [ _vm._v( _vm._s( hour === undefined ? "" : ( "0" + (_vm.amPmMode ? hour % 12 || 12 : hour) ).slice(-2) + _vm.amPm(hour) ) ) ] ) }), 0 ) ] ), _c( "div", { staticClass: "el-time-spinner__wrapper is-arrow", on: { mouseenter: function($event) { _vm.emitSelectRange("minutes") } } }, [ _c("i", { directives: [ { name: "repeat-click", rawName: "v-repeat-click", value: _vm.decrease, expression: "decrease" } ], staticClass: "el-time-spinner__arrow el-icon-arrow-up" }), _c("i", { directives: [ { name: "repeat-click", rawName: "v-repeat-click", value: _vm.increase, expression: "increase" } ], staticClass: "el-time-spinner__arrow el-icon-arrow-down" }), _c( "ul", { ref: "minutes", staticClass: "el-time-spinner__list" }, _vm._l(_vm.arrowMinuteList, function(minute, key) { return _c( "li", { key: key, staticClass: "el-time-spinner__item", class: { active: minute === _vm.minutes } }, [ _vm._v( "\n " + _vm._s( minute === undefined ? "" : ("0" + minute).slice(-2) ) + "\n " ) ] ) }), 0 ) ] ), _vm.showSeconds ? _c( "div", { staticClass: "el-time-spinner__wrapper is-arrow", on: { mouseenter: function($event) { _vm.emitSelectRange("seconds") } } }, [ _c("i", { directives: [ { name: "repeat-click", rawName: "v-repeat-click", value: _vm.decrease, expression: "decrease" } ], staticClass: "el-time-spinner__arrow el-icon-arrow-up" }), _c("i", { directives: [ { name: "repeat-click", rawName: "v-repeat-click", value: _vm.increase, expression: "increase" } ], staticClass: "el-time-spinner__arrow el-icon-arrow-down" }), _c( "ul", { ref: "seconds", staticClass: "el-time-spinner__list" }, _vm._l(_vm.arrowSecondList, function(second, key) { return _c( "li", { key: key, staticClass: "el-time-spinner__item", class: { active: second === _vm.seconds } }, [ _vm._v( "\n " + _vm._s( second === undefined ? "" : ("0" + second).slice(-2) ) + "\n " ) ] ) }), 0 ) ] ) : _vm._e() ] : _vm._e() ], 2 ) } var staticRenderFns = [] render._withStripped = true // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=1facadeb& // EXTERNAL MODULE: external "element-ui-for-gov/lib/utils/date-util" var date_util_ = __webpack_require__(0); // EXTERNAL MODULE: external "element-ui-for-gov/lib/scrollbar" var scrollbar_ = __webpack_require__(13); var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_); // EXTERNAL MODULE: external "element-ui-for-gov/lib/utils/dom" var dom_ = __webpack_require__(3); // CONCATENATED MODULE: ./src/directives/repeat-click.js /* harmony default export */ var repeat_click = ({ bind: function bind(el, binding, vnode) { var interval = null; var startTime = void 0; var handler = function handler() { return vnode.context[binding.expression].apply(); }; var clear = function clear() { if (Date.now() - startTime < 100) { handler(); } clearInterval(interval); interval = null; }; Object(dom_["on"])(el, 'mousedown', function (e) { if (e.button !== 0) return; startTime = Date.now(); Object(dom_["once"])(document, 'mouseup', clear); clearInterval(interval); interval = setInterval(handler, 100); }); } }); // 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& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var time_spinnervue_type_script_lang_js_ = ({ components: { ElScrollbar: scrollbar_default.a }, directives: { repeatClick: repeat_click }, props: { date: {}, defaultValue: {}, // reserved for future use showSeconds: { type: Boolean, default: true }, arrowControl: Boolean, amPmMode: { type: String, default: '' // 'a': am/pm; 'A': AM/PM } }, computed: { hours: function hours() { return this.date.getHours(); }, minutes: function minutes() { return this.date.getMinutes(); }, seconds: function seconds() { return this.date.getSeconds(); }, hoursList: function hoursList() { return Object(date_util_["getRangeHours"])(this.selectableRange); }, minutesList: function minutesList() { return Object(date_util_["getRangeMinutes"])(this.selectableRange, this.hours); }, arrowHourList: function arrowHourList() { var hours = this.hours; return [hours > 0 ? hours - 1 : undefined, hours, hours < 23 ? hours + 1 : undefined]; }, arrowMinuteList: function arrowMinuteList() { var minutes = this.minutes; return [minutes > 0 ? minutes - 1 : undefined, minutes, minutes < 59 ? minutes + 1 : undefined]; }, arrowSecondList: function arrowSecondList() { var seconds = this.seconds; return [seconds > 0 ? seconds - 1 : undefined, seconds, seconds < 59 ? seconds + 1 : undefined]; } }, data: function data() { return { selectableRange: [], currentScrollbar: null }; }, mounted: function mounted() { var _this = this; this.$nextTick(function () { !_this.arrowControl && _this.bindScrollEvent(); }); }, methods: { increase: function increase() { this.scrollDown(1); }, decrease: function decrease() { this.scrollDown(-1); }, modifyDateField: function modifyDateField(type, value) { switch (type) { case 'hours': this.$emit('change', Object(date_util_["modifyTime"])(this.date, value, this.minutes, this.seconds));break; case 'minutes': this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, value, this.seconds));break; case 'seconds': this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, this.minutes, value));break; } }, handleClick: function handleClick(type, _ref) { var value = _ref.value, disabled = _ref.disabled; if (!disabled) { this.modifyDateField(type, value); this.emitSelectRange(type); this.adjustSpinner(type, value); } }, emitSelectRange: function emitSelectRange(type) { if (type === 'hours') { this.$emit('select-range', 0, 2); } else if (type === 'minutes') { this.$emit('select-range', 3, 5); } else if (type === 'seconds') { this.$emit('select-range', 6, 8); } this.currentScrollbar = type; }, bindScrollEvent: function bindScrollEvent() { var _this2 = this; var bindFuntion = function bindFuntion(type) { _this2.$refs[type].wrap.onscroll = function (e) { // TODO: scroll is emitted when set scrollTop programatically // should find better solutions in the future! _this2.handleScroll(type, e); }; }; bindFuntion('hours'); bindFuntion('minutes'); bindFuntion('seconds'); }, handleScroll: function handleScroll(type) { 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); this.modifyDateField(type, value); }, // NOTE: used by datetime / date-range panel // renamed from adjustScrollTop // should try to refactory it adjustSpinners: function adjustSpinners() { this.adjustSpinner('hours', this.hours); this.adjustSpinner('minutes', this.minutes); this.adjustSpinner('seconds', this.seconds); }, adjustCurrentSpinner: function adjustCurrentSpinner(type) { this.adjustSpinner(type, this[type]); }, adjustSpinner: function adjustSpinner(type, value) { if (this.arrowControl) return; var el = this.$refs[type].wrap; if (el) { el.scrollTop = Math.max(0, value * this.typeItemHeight(type)); } }, scrollDown: function scrollDown(step) { var _this3 = this; if (!this.currentScrollbar) { this.emitSelectRange('hours'); } var label = this.currentScrollbar; var hoursList = this.hoursList; var now = this[label]; if (this.currentScrollbar === 'hours') { var total = Math.abs(step); step = step > 0 ? 1 : -1; var length = hoursList.length; while (length-- && total) { now = (now + step + hoursList.length) % hoursList.length; if (hoursList[now]) { continue; } total--; } if (hoursList[now]) return; } else { now = (now + step + 60) % 60; } this.modifyDateField(label, now); this.adjustSpinner(label, now); this.$nextTick(function () { return _this3.emitSelectRange(_this3.currentScrollbar); }); }, amPm: function amPm(hour) { var shouldShowAmPm = this.amPmMode.toLowerCase() === 'a'; if (!shouldShowAmPm) return ''; var isCapital = this.amPmMode === 'A'; var content = hour < 12 ? ' 上午' : ' 下午'; if (isCapital) content = content.toUpperCase(); return content; }, typeItemHeight: function typeItemHeight(type) { return this.$refs[type].$el.querySelector('li').offsetHeight; }, scrollBarHeight: function scrollBarHeight(type) { return this.$refs[type].$el.offsetHeight; } } }); // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.v