element-ui-for-gov
Version:
element-ui for gov
1,749 lines (1,515 loc) • 64 kB
JavaScript
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 = 240);
/******/ })
/************************************************************************/
/******/ ({
/***/ 100:
/***/ (function(module, exports, __webpack_require__) {
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 = 64);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (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, 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 functioal 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
}
}
/***/ }),
/***/ 19:
/***/ (function(module, exports) {
module.exports = __webpack_require__(19);
/***/ }),
/***/ 2:
/***/ (function(module, exports) {
module.exports = __webpack_require__(29);
/***/ }),
/***/ 25:
/***/ (function(module, exports) {
module.exports = __webpack_require__(17);
/***/ }),
/***/ 3:
/***/ (function(module, exports) {
module.exports = __webpack_require__(21);
/***/ }),
/***/ 6:
/***/ (function(module, exports) {
module.exports = __webpack_require__(241);
/***/ }),
/***/ 64:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/image/src/main.vue?vue&type=template&id=44d84a7c&
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{ staticClass: "el-image" },
[
_vm.loading
? _vm._t("placeholder", [
_c("div", { staticClass: "el-image__placeholder" })
])
: _vm.error
? _vm._t("error", [
_c("div", { staticClass: "el-image__error" }, [
_vm._v(_vm._s(_vm.t("el.image.error")))
])
])
: _c(
"img",
_vm._g(
_vm._b(
{
staticClass: "el-image__inner",
class: {
"el-image__inner--center": _vm.alignCenter,
"el-image__preview": _vm.preview
},
style: _vm.imageStyle,
attrs: { src: _vm.src },
on: { click: _vm.clickHandler }
},
"img",
_vm.$attrs,
false
),
_vm.$listeners
)
),
_vm.preview
? [
_vm.showViewer
? _c("image-viewer", {
attrs: {
"z-index": _vm.zIndex,
"initial-index": _vm.imageIndex,
"on-close": _vm.closeViewer,
"url-list": _vm.previewSrcList
}
})
: _vm._e()
]
: _vm._e()
],
2
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/image/src/main.vue?vue&type=template&id=44d84a7c&
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/image/src/image-viewer.vue?vue&type=template&id=5e73b307&
var image_viewervue_type_template_id_5e73b307_render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("transition", { attrs: { name: "viewer-fade" } }, [
_c(
"div",
{
ref: "el-image-viewer__wrapper",
staticClass: "el-image-viewer__wrapper",
style: { "z-index": _vm.zIndex },
attrs: { tabindex: "-1" }
},
[
_c("div", {
staticClass: "el-image-viewer__mask",
on: {
click: function($event) {
if ($event.target !== $event.currentTarget) {
return null
}
return _vm.handleMaskClick($event)
}
}
}),
_c(
"span",
{
staticClass: "el-image-viewer__btn el-image-viewer__close",
on: { click: _vm.hide }
},
[_c("i", { staticClass: "el-icon-close" })]
),
!_vm.isSingle
? [
_c(
"span",
{
staticClass: "el-image-viewer__btn el-image-viewer__prev",
class: { "is-disabled": !_vm.infinite && _vm.isFirst },
on: { click: _vm.prev }
},
[_c("i", { staticClass: "el-icon-arrow-left" })]
),
_c(
"span",
{
staticClass: "el-image-viewer__btn el-image-viewer__next",
class: { "is-disabled": !_vm.infinite && _vm.isLast },
on: { click: _vm.next }
},
[_c("i", { staticClass: "el-icon-arrow-right" })]
)
]
: _vm._e(),
_c(
"div",
{ staticClass: "el-image-viewer__btn el-image-viewer__actions" },
[
_c("div", { staticClass: "el-image-viewer__actions__inner" }, [
_c("i", {
staticClass: "el-icon-zoom-out",
on: {
click: function($event) {
_vm.handleActions("zoomOut")
}
}
}),
_c("i", {
staticClass: "el-icon-zoom-in",
on: {
click: function($event) {
_vm.handleActions("zoomIn")
}
}
}),
_c("i", { staticClass: "el-image-viewer__actions__divider" }),
_c("i", { class: _vm.mode.icon, on: { click: _vm.toggleMode } }),
_c("i", { staticClass: "el-image-viewer__actions__divider" }),
_c("i", {
staticClass: "el-icon-refresh-left",
on: {
click: function($event) {
_vm.handleActions("anticlocelise")
}
}
}),
_c("i", {
staticClass: "el-icon-refresh-right",
on: {
click: function($event) {
_vm.handleActions("clocelise")
}
}
})
])
]
),
_c(
"div",
{ staticClass: "el-image-viewer__canvas" },
_vm._l(_vm.urlList, function(url, i) {
return i === _vm.index
? _c("img", {
key: url,
ref: "img",
refInFor: true,
staticClass: "el-image-viewer__img",
style: _vm.imgStyle,
attrs: { src: _vm.currentImg },
on: {
load: _vm.handleImgLoad,
error: _vm.handleImgError,
mousedown: _vm.handleMouseDown
}
})
: _vm._e()
}),
0
)
],
2
)
])
}
var image_viewervue_type_template_id_5e73b307_staticRenderFns = []
image_viewervue_type_template_id_5e73b307_render._withStripped = true
// CONCATENATED MODULE: ./packages/image/src/image-viewer.vue?vue&type=template&id=5e73b307&
// EXTERNAL MODULE: external "element-ui/lib/utils/dom"
var dom_ = __webpack_require__(2);
// EXTERNAL MODULE: external "element-ui/lib/utils/util"
var util_ = __webpack_require__(3);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/image/src/image-viewer.vue?vue&type=script&lang=js&
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var Mode = {
CONTAIN: {
name: 'contain',
icon: 'el-icon-full-screen'
},
ORIGINAL: {
name: 'original',
icon: 'el-icon-c-scale-to-original'
}
};
var mousewheelEventName = Object(util_["isFirefox"])() ? 'DOMMouseScroll' : 'mousewheel';
/* harmony default export */ var image_viewervue_type_script_lang_js_ = ({
name: 'elImageViewer',
props: {
urlList: {
type: Array,
default: function _default() {
return [];
}
},
zIndex: {
type: Number,
default: 2000
},
onSwitch: {
type: Function,
default: function _default() {}
},
onClose: {
type: Function,
default: function _default() {}
},
initialIndex: {
type: Number,
default: 0
},
appendToBody: {
type: Boolean,
default: true
},
maskClosable: {
type: Boolean,
default: true
}
},
data: function data() {
return {
index: this.initialIndex,
isShow: false,
infinite: true,
loading: false,
mode: Mode.CONTAIN,
transform: {
scale: 1,
deg: 0,
offsetX: 0,
offsetY: 0,
enableTransition: false
}
};
},
computed: {
isSingle: function isSingle() {
return this.urlList.length <= 1;
},
isFirst: function isFirst() {
return this.index === 0;
},
isLast: function isLast() {
return this.index === this.urlList.length - 1;
},
currentImg: function currentImg() {
return this.urlList[this.index];
},
imgStyle: function imgStyle() {
var _transform = this.transform,
scale = _transform.scale,
deg = _transform.deg,
offsetX = _transform.offsetX,
offsetY = _transform.offsetY,
enableTransition = _transform.enableTransition;
var style = {
transform: 'scale(' + scale + ') rotate(' + deg + 'deg)',
transition: enableTransition ? 'transform .3s' : '',
'margin-left': offsetX + 'px',
'margin-top': offsetY + 'px'
};
if (this.mode === Mode.CONTAIN) {
style.maxWidth = style.maxHeight = '100%';
}
return style;
}
},
watch: {
index: {
handler: function handler(val) {
this.reset();
this.onSwitch(val);
}
},
currentImg: function currentImg(val) {
var _this = this;
this.$nextTick(function (_) {
var $img = _this.$refs.img[0];
if (!$img.complete) {
_this.loading = true;
}
});
}
},
methods: {
hide: function hide() {
this.deviceSupportUninstall();
this.onClose();
},
deviceSupportInstall: function deviceSupportInstall() {
var _this2 = this;
this._keyDownHandler = Object(util_["rafThrottle"])(function (e) {
var keyCode = e.keyCode;
switch (keyCode) {
// ESC
case 27:
_this2.hide();
break;
// SPACE
case 32:
_this2.toggleMode();
break;
// LEFT_ARROW
case 37:
_this2.prev();
break;
// UP_ARROW
case 38:
_this2.handleActions('zoomIn');
break;
// RIGHT_ARROW
case 39:
_this2.next();
break;
// DOWN_ARROW
case 40:
_this2.handleActions('zoomOut');
break;
}
});
this._mouseWheelHandler = Object(util_["rafThrottle"])(function (e) {
var delta = e.wheelDelta ? e.wheelDelta : -e.detail;
if (delta > 0) {
_this2.handleActions('zoomIn', {
zoomRate: 0.015,
enableTransition: false
});
} else {
_this2.handleActions('zoomOut', {
zoomRate: 0.015,
enableTransition: false
});
}
});
Object(dom_["on"])(document, 'keydown', this._keyDownHandler);
Object(dom_["on"])(document, mousewheelEventName, this._mouseWheelHandler);
},
deviceSupportUninstall: function deviceSupportUninstall() {
Object(dom_["off"])(document, 'keydown', this._keyDownHandler);
Object(dom_["off"])(document, mousewheelEventName, this._mouseWheelHandler);
this._keyDownHandler = null;
this._mouseWheelHandler = null;
},
handleImgLoad: function handleImgLoad(e) {
this.loading = false;
},
handleImgError: function handleImgError(e) {
this.loading = false;
e.target.alt = '加载失败';
},
handleMouseDown: function handleMouseDown(e) {
var _this3 = this;
if (this.loading || e.button !== 0) return;
var _transform2 = this.transform,
offsetX = _transform2.offsetX,
offsetY = _transform2.offsetY;
var startX = e.pageX;
var startY = e.pageY;
this._dragHandler = Object(util_["rafThrottle"])(function (ev) {
_this3.transform.offsetX = offsetX + ev.pageX - startX;
_this3.transform.offsetY = offsetY + ev.pageY - startY;
});
Object(dom_["on"])(document, 'mousemove', this._dragHandler);
Object(dom_["on"])(document, 'mouseup', function (ev) {
Object(dom_["off"])(document, 'mousemove', _this3._dragHandler);
});
e.preventDefault();
},
handleMaskClick: function handleMaskClick() {
if (this.maskClosable) {
this.hide();
}
},
reset: function reset() {
this.transform = {
scale: 1,
deg: 0,
offsetX: 0,
offsetY: 0,
enableTransition: false
};
},
toggleMode: function toggleMode() {
if (this.loading) return;
var modeNames = Object.keys(Mode);
var modeValues = Object.values(Mode);
var index = modeValues.indexOf(this.mode);
var nextIndex = (index + 1) % modeNames.length;
this.mode = Mode[modeNames[nextIndex]];
this.reset();
},
prev: function prev() {
if (this.isFirst && !this.infinite) return;
var len = this.urlList.length;
this.index = (this.index - 1 + len) % len;
},
next: function next() {
if (this.isLast && !this.infinite) return;
var len = this.urlList.length;
this.index = (this.index + 1) % len;
},
handleActions: function handleActions(action) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (this.loading) return;
var _zoomRate$rotateDeg$e = _extends({
zoomRate: 0.2,
rotateDeg: 90,
enableTransition: true
}, options),
zoomRate = _zoomRate$rotateDeg$e.zoomRate,
rotateDeg = _zoomRate$rotateDeg$e.rotateDeg,
enableTransition = _zoomRate$rotateDeg$e.enableTransition;
var transform = this.transform;
switch (action) {
case 'zoomOut':
if (transform.scale > 0.2) {
transform.scale = parseFloat((transform.scale - zoomRate).toFixed(3));
}
break;
case 'zoomIn':
transform.scale = parseFloat((transform.scale + zoomRate).toFixed(3));
break;
case 'clocelise':
transform.deg += rotateDeg;
break;
case 'anticlocelise':
transform.deg -= rotateDeg;
break;
}
transform.enableTransition = enableTransition;
}
},
mounted: function mounted() {
this.deviceSupportInstall();
if (this.appendToBody) {
document.body.appendChild(this.$el);
}
// add tabindex then wrapper can be focusable via Javascript
// focus wrapper so arrow key can't cause inner scroll behavior underneath
this.$refs['el-image-viewer__wrapper'].focus();
},
destroyed: function destroyed() {
// if appendToBody is true, remove DOM node after destroy
if (this.appendToBody && this.$el && this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el);
}
}
});
// CONCATENATED MODULE: ./packages/image/src/image-viewer.vue?vue&type=script&lang=js&
/* harmony default export */ var src_image_viewervue_type_script_lang_js_ = (image_viewervue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./packages/image/src/image-viewer.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
src_image_viewervue_type_script_lang_js_,
image_viewervue_type_template_id_5e73b307_render,
image_viewervue_type_template_id_5e73b307_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "packages/image/src/image-viewer.vue"
/* harmony default export */ var image_viewer = (component.exports);
// EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
var locale_ = __webpack_require__(6);
var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
// EXTERNAL MODULE: external "element-ui/lib/utils/types"
var types_ = __webpack_require__(19);
// EXTERNAL MODULE: external "throttle-debounce/throttle"
var throttle_ = __webpack_require__(25);
var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle_);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/image/src/main.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var isSupportObjectFit = function isSupportObjectFit() {
return document.documentElement.style.objectFit !== undefined;
};
var ObjectFit = {
NONE: 'none',
CONTAIN: 'contain',
COVER: 'cover',
FILL: 'fill',
SCALE_DOWN: 'scale-down'
};
var prevOverflow = '';
/* harmony default export */ var mainvue_type_script_lang_js_ = ({
name: 'ElImage',
mixins: [locale_default.a],
inheritAttrs: false,
components: {
ImageViewer: image_viewer
},
props: {
src: String,
fit: String,
lazy: Boolean,
scrollContainer: {},
previewSrcList: {
type: Array,
default: function _default() {
return [];
}
},
zIndex: {
type: Number,
default: 2000
}
},
data: function data() {
return {
loading: true,
error: false,
show: !this.lazy,
imageWidth: 0,
imageHeight: 0,
showViewer: false
};
},
computed: {
imageStyle: function imageStyle() {
var fit = this.fit;
if (!this.$isServer && fit) {
return isSupportObjectFit() ? { 'object-fit': fit } : this.getImageStyle(fit);
}
return {};
},
alignCenter: function alignCenter() {
return !this.$isServer && !isSupportObjectFit() && this.fit !== ObjectFit.FILL;
},
preview: function preview() {
var previewSrcList = this.previewSrcList;
return Array.isArray(previewSrcList) && previewSrcList.length > 0;
},
imageIndex: function imageIndex() {
var previewIndex = 0;
var srcIndex = this.previewSrcList.indexOf(this.src);
if (srcIndex >= 0) {
previewIndex = srcIndex;
}
return previewIndex;
}
},
watch: {
src: function src(val) {
this.show && this.loadImage();
},
show: function show(val) {
val && this.loadImage();
}
},
mounted: function mounted() {
if (this.lazy) {
this.addLazyLoadListener();
} else {
this.loadImage();
}
},
beforeDestroy: function beforeDestroy() {
this.lazy && this.removeLazyLoadListener();
},
methods: {
loadImage: function loadImage() {
var _this = this;
if (this.$isServer) return;
// reset status
this.loading = true;
this.error = false;
var img = new Image();
img.onload = function (e) {
return _this.handleLoad(e, img);
};
img.onerror = this.handleError.bind(this);
// bind html attrs
// so it can behave consistently
Object.keys(this.$attrs).forEach(function (key) {
var value = _this.$attrs[key];
img.setAttribute(key, value);
});
img.src = this.src;
},
handleLoad: function handleLoad(e, img) {
this.imageWidth = img.width;
this.imageHeight = img.height;
this.loading = false;
this.error = false;
},
handleError: function handleError(e) {
this.loading = false;
this.error = true;
this.$emit('error', e);
},
handleLazyLoad: function handleLazyLoad() {
if (Object(dom_["isInContainer"])(this.$el, this._scrollContainer)) {
this.show = true;
this.removeLazyLoadListener();
}
},
addLazyLoadListener: function addLazyLoadListener() {
if (this.$isServer) return;
var scrollContainer = this.scrollContainer;
var _scrollContainer = null;
if (Object(types_["isHtmlElement"])(scrollContainer)) {
_scrollContainer = scrollContainer;
} else if (Object(types_["isString"])(scrollContainer)) {
_scrollContainer = document.querySelector(scrollContainer);
} else {
_scrollContainer = Object(dom_["getScrollContainer"])(this.$el);
}
if (_scrollContainer) {
this._scrollContainer = _scrollContainer;
this._lazyLoadHandler = throttle_default()(200, this.handleLazyLoad);
Object(dom_["on"])(_scrollContainer, 'scroll', this._lazyLoadHandler);
this.handleLazyLoad();
}
},
removeLazyLoadListener: function removeLazyLoadListener() {
var _scrollContainer = this._scrollContainer,
_lazyLoadHandler = this._lazyLoadHandler;
if (this.$isServer || !_scrollContainer || !_lazyLoadHandler) return;
Object(dom_["off"])(_scrollContainer, 'scroll', _lazyLoadHandler);
this._scrollContainer = null;
this._lazyLoadHandler = null;
},
/**
* simulate object-fit behavior to compatible with IE11 and other browsers which not support object-fit
*/
getImageStyle: function getImageStyle(fit) {
var imageWidth = this.imageWidth,
imageHeight = this.imageHeight;
var _$el = this.$el,
containerWidth = _$el.clientWidth,
containerHeight = _$el.clientHeight;
if (!imageWidth || !imageHeight || !containerWidth || !containerHeight) return {};
var imageAspectRatio = imageWidth / imageHeight;
var containerAspectRatio = containerWidth / containerHeight;
if (fit === ObjectFit.SCALE_DOWN) {
var isSmaller = imageWidth < containerWidth && imageHeight < containerHeight;
fit = isSmaller ? ObjectFit.NONE : ObjectFit.CONTAIN;
}
switch (fit) {
case ObjectFit.NONE:
return { width: 'auto', height: 'auto' };
case ObjectFit.CONTAIN:
return imageAspectRatio < containerAspectRatio ? { width: 'auto' } : { height: 'auto' };
case ObjectFit.COVER:
return imageAspectRatio < containerAspectRatio ? { height: 'auto' } : { width: 'auto' };
default:
return {};
}
},
clickHandler: function clickHandler() {
// don't show viewer when preview is false
if (!this.preview) {
return;
}
// prevent body scroll
prevOverflow = document.body.style.overflow;
document.body.style.overflow = 'hidden';
this.showViewer = true;
},
closeViewer: function closeViewer() {
document.body.style.overflow = prevOverflow;
this.showViewer = false;
}
}
});
// CONCATENATED MODULE: ./packages/image/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/image/src/main.vue
/* normalize component */
var main_component = Object(componentNormalizer["a" /* default */])(
src_mainvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var main_api; }
main_component.options.__file = "packages/image/src/main.vue"
/* harmony default export */ var main = (main_component.exports);
// CONCATENATED MODULE: ./packages/image/index.js
/* istanbul ignore next */
main.install = function (Vue) {
Vue.component(main.name, main);
};
/* harmony default export */ var packages_image = __webpack_exports__["default"] = (main);
/***/ })
/******/ });
/***/ }),
/***/ 17:
/***/ (function(module, exports) {
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
/**
* Throttle execution of a function. Especially useful for rate limiting
* execution of handlers on events like resize and scroll.
*
* @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {Boolean} [noTrailing] Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
* the internal counter is reset)
* @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the throttled-function is executed.
* @param {Boolean} [debounceMode] If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
* schedule `callback` to execute after `delay` ms.
*
* @return {Function} A new, throttled, function.
*/
module.exports = function ( delay, noTrailing, callback, debounceMode ) {
// After wrapper has stopped being called, this timeout ensures that
// `callback` is executed at the proper times in `throttle` and `end`
// debounce modes.
var timeoutID;
// Keep track of the last time `callback` was executed.
var lastExec = 0;
// `noTrailing` defaults to falsy.
if ( typeof noTrailing !== 'boolean' ) {
debounceMode = callback;
callback = noTrailing;
noTrailing = undefined;
}
// The `wrapper` function encapsulates all of the throttling / debouncing
// functionality and when executed will limit the rate at which `callback`
// is executed.
function wrapper () {
var self = this;
var elapsed = Number(new Date()) - lastExec;
var args = arguments;
// Execute `callback` and update the `lastExec` timestamp.
function exec () {
lastExec = Number(new Date());
callback.apply(self, args);
}
// If `debounceMode` is true (at begin) this is used to clear the flag
// to allow future `callback` executions.
function clear () {
timeoutID = undefined;
}
if ( debounceMode && !timeoutID ) {
// Since `wrapper` is being called for the first time and
// `debounceMode` is true (at begin), execute `callback`.
exec();
}
// Clear any existing timeout.
if ( timeoutID ) {
clearTimeout(timeoutID);
}
if ( debounceMode === undefined && elapsed > delay ) {
// In throttle mode, if `delay` time has been exceeded, execute
// `callback`.
exec();
} else if ( noTrailing !== true ) {
// In trailing throttle mode, since `delay` time has not been
// exceeded, schedule `callback` to execute `delay` ms after most
// recent execution.
//
// If `debounceMode` is true (at begin), schedule `clear` to execute
// after `delay` ms.
//
// If `debounceMode` is false (at end), schedule `callback` to
// execute after `delay` ms.
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
}
}
// Return the wrapper function.
return wrapper;
};
/***/ }),
/***/ 19:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.isString = isString;
exports.isObject = isObject;
exports.isHtmlElement = isHtmlElement;
function isString(obj) {
return Object.prototype.toString.call(obj) === '[object String]';
}
function isObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]';
}
function isHtmlElement(node) {
return node && node.nodeType === Node.ELEMENT_NODE;
}
var isFunction = exports.isFunction = function isFunction(functionToCheck) {
var getType = {};
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
};
var isUndefined = exports.isUndefined = function isUndefined(val) {
return val === void 0;
};
var isDefined = exports.isDefined = function isDefined(val) {
return val !== undefined && val !== null;
};
/***/ }),
/***/ 21:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.isEmpty = exports.isEqual = exports.arrayEquals = exports.looseEqual = exports.capitalize = exports.kebabCase = exports.autoprefixer = exports.isFirefox = exports.isEdge = exports.isIE = exports.coerceTruthyValueToArray = exports.arrayFind = exports.arrayFindIndex = exports.escapeRegexpString = exports.valueEquals = exports.generateId = exports.getValueByPath = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.noop = noop;
exports.hasOwn = hasOwn;
exports.toObject = toObject;
exports.getPropByPath = getPropByPath;
exports.rafThrottle = rafThrottle;
exports.objToArray = objToArray;
var _vue = __webpack_require__(4);
var _vue2 = _interopRequireDefault(_vue);
var _types = __webpack_require__(19);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var hasOwnProperty = Object.prototype.hasOwnProperty;
function noop() {};
function hasOwn(obj, key) {
return hasOwnProperty.call(obj, key);
};
function extend(to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to;
};
function toObject(arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res;
};
var getValueByPath = exports.getValueByPath = function getValueByPath(object, prop) {
prop = prop || '';
var paths = prop.split('.');
var current = object;
var result = null;
for (var i = 0, j = paths.length; i < j; i++) {
var path = paths[i];
if (!current) break;
if (i === j - 1) {
result = current[path];
break;
}
current = current[path];
}
return result;
};
function getPropByPath(obj, path, strict) {
var tempObj = obj;
path = path.replace(/\[(\w+)\]/g, '.$1');
path = path.replace(/^\./, '');
var keyArr = path.split('.');
var i = 0;
for (var len = keyArr.length; i < len - 1; ++i) {
if (!tempObj && !strict) break;
var key = keyArr[i];
if (key in tempObj) {
tempObj = tempObj[key];
} else {
if (strict) {
throw new Error('please transfer a valid prop path to form item!');
}
break;
}
}
return {
o: tempObj,
k: keyArr[i],
v: tempObj ? tempObj[keyArr[i]] : null
};
};
var generateId = exports.generateId = function generateId() {
return Math.floor(Math.random() * 10000);
};
var valueEquals = exports.valueEquals = function valueEquals(a, b) {
// see: https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript
if (a === b) return true;
if (!(a instanceof Array)) return false;
if (!(b instanceof Array)) return false;
if (a.length !== b.length) return false;
for (var i = 0; i !== a.length; ++i) {
if (a[i] !== b[i]) return false;
}
return true;
};
var escapeRegexpString = exports.escapeRegexpString = function escapeRegexpString() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return String(value).replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
};
// TODO: use native Array.find, Array.findIndex when IE support is dropped
var arrayFindIndex = exports.arrayFindIndex = function arrayFindIndex(arr, pred) {
for (var i = 0; i !== arr.length; ++i) {
if (pred(arr[i])) {
return i;
}
}
return -1;
};
var arrayFind = exports.arrayFind = function arrayFind(arr, pred) {
var idx = arrayFindIndex(arr, pred);
return idx !== -1 ? arr[idx] : undefined;
};
// coerce truthy value to array
var coerceTruthyValueToArray = exports.coerceTruthyValueToArray = function coerceTruthyValueToArray(val) {
if (Array.isArray(val)) {
return val;
} else if (val) {
return [val];
} else {
return [];
}
};
var isIE = exports.isIE = function isIE() {
return !_vue2.default.prototype.$isServer && !isNaN(Number(document.documentMode));
};
var isEdge = exports.isEdge = function isEdge() {
return !_vue2.default.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
};
var isFirefox = exports.isFirefox = function isFirefox() {
return !_vue2.default.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
};
var autoprefixer = exports.autoprefixer = function autoprefixer(style) {
if ((typeof style === 'undefined' ? 'undefined' : _typeof(style)) !== 'object') return style;
var rules = ['transform', 'transition', 'animation'];
var prefixes = ['ms-', 'webkit-'];
rules.forEach(function (rule) {
var value = style[rule];
if (rule && value) {
prefixes.forEach(function (prefix) {
style[prefix + rule] = value;
});
}
});
return style;
};
var kebabCase = exports.kebabCase = function kebabCase(str) {
var hyphenateRE = /([^-])([A-Z])/g;
return str.replace(hyphenateRE, '$1-$2').replace(hyphenateRE, '$1-$2').toLowerCase();
};
var capitalize = exports.capitalize = function capitalize(str) {
if (!(0, _types.isString)(str)) return str;
return str.charAt(0).toUpperCase() + str.slice(1);
};
var looseEqual = exports.looseEqual = function looseEqual(a, b) {
var isObjectA = (0, _types.isObject)(a);
var isObjectB = (0, _types.isObject)(b);
if (isObjectA && isObjectB) {
return JSON.stringify(a) === JSON.stringify(b);
} else if (!isObjectA && !isObjectB) {
return String(a) === String(b);
} else {
return false;
}
};
var arrayEquals = exports.arrayEquals = function arrayEquals(arrayA, arrayB) {
arrayA = arrayA || [];
arrayB = arrayB || [];
if (arrayA.length !== arrayB.length) {
return false;
}
for (var i = 0; i < arrayA.length; i++) {
if (!looseEqual(arrayA[i], arrayB[i])) {
return false;
}
}
return true;
};
var isEqual = exports.isEqual = function isEqual(value1, value2) {
if (Array.isArray(value1) && Array.isArray(value2)) {
return arrayEquals(value1, value2);
}
return looseEqual(value1, value2);
};
var isEmpty = exports.isEmpty = function isEmpty(val) {
// null or undefined
if (val == null) return true;
if (typeof val === 'boolean') return false;
if (typeof val === 'number') return !val;
if (val instanceof Error) return val.message === '';
switch (Object.prototype.toString.call(val)) {
// String or Array
case '[object String]':
case '[object Array]':
return !val.length;
// Map or Set or File
case '[object File]':
case '[object Map]':
case '[object Set]':
{
return !val.size;
}
// Plain Object
case '[object Object]':
{
return !Object.keys(val).length;
}
}
return false;
};
function rafThrottle(fn) {
var locked = false;
return function () {
var _this = this;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (locked) return;
locked = true;
window.requestAnimationFrame(function (_) {
fn.apply(_this, args);
locked = false;
});
};
}
function objToArray(obj) {
if (Array.isArray(obj)) {
return obj;
}
return isEmpty(obj) ? [] : [obj];
}
/***/ }),
/***/ 240:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var element_ui_lib_image__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(100);
/* harmony import */ var element_ui_lib_image__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(element_ui_lib_image__WEBPACK_IMPORTED_MODULE_0__);
/* istanbul ignore next */
element_ui_lib_image__WEBPACK_IMPORTED_MODULE_0___default.a.install = function (Vue) {
Vue.component(element_ui_lib_image__WEBPACK_IMPORTED_MODULE_0___default.a.name, element_ui_lib_image__WEBPACK_IMPORTED_MODULE_0___default.a);
};
/* harmony default export */ __webpack_exports__["default"] = (element_ui_lib_image__WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ 241:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _locale = __webpack_require__(71);
exports.default = {
methods: {
t: function t() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _locale.t.apply(this, args);
}
}
};
/***/ }),
/***/ 29:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.isInContainer = exports.getScrollContainer = exports.isScroll = exports.getStyle = exports.once = exports.off = exports.on = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* istanbul ignore next */
exports.hasClass = hasClass;
exports.addClass = addClass;
exports.removeClass = removeClass;
exports.setStyle = setStyle;
var _vue = __webpack_require__(4);
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var isServer = _vue2.default.prototype.$isServer;
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
var ieVersion = isServer ? 0 : Number(document.documentMode);
/* istanbul ignore next */
var trim = function trim(string) {
return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
};
/* istanbul ignore next */
var camelCase = function camelCase(name) {
return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
return offset ? letter.toUpperCase() : letter;
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
};
/* istanbul ignore next */
var on = exports.on = function () {
if (!isServer && document.addEventListener) {
return function (element, event, handler) {
if (element && event && handler) {
element.addEventListener(event, handler, false);
}
};
} else {
return function (element, event, handler) {
if (element && event && handler) {
element.attachEvent('on' + event, handler);
}
};
}
}();
/* istanbul ignore next */
var off = exports.off = function () {
if (!isServer && document.removeEventListener) {
return function (element, event, handler) {
if (element && event) {
element.removeEventListener(event, handler, false);
}
};
} else {
return function (element, event, handler) {
if (element && event) {
element.detachEvent('on' + event, handler);
}
};
}
}();
/* istanbul ignore next */
var once = exports.once = function once(el, event, fn) {
var listener = function listener() {
if (fn) {
fn.apply(this, arguments);
}
off(el, event, listener);
};
on(el, event, listener);
};
/* istanbul ignore next */
function hasClass(el, c