| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935 |
- exports.ids = [6];
- exports.modules = {
- /***/ 156:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // ESM COMPAT FLAG
- __webpack_require__.r(__webpack_exports__);
- // CONCATENATED MODULE: ./node_modules/_vue-loader@15.9.8@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_@nuxt_components@2.2.1@@nuxt/components/dist/loader.js??ref--0-0!./node_modules/_vue-loader@15.9.8@vue-loader/lib??vue-loader-options!./components/default/image-viewer.vue?vue&type=template&id=35230f64&
- var 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":_vm.hide}}),_vm._v(" "),_c('span',{staticClass:"el-image-viewer__btn el-image-viewer__close",on:{"click":function($event){$event.stopPropagation();return _vm.hide.apply(null, arguments)}}},[_c('i',{staticClass:"el-icon-circle-close",staticStyle:{"color":"white"}})]),_vm._v(" "),(!_vm.isSingle)?[_c('span',{staticClass:"el-image-viewer__btn el-image-viewer__prev",class:{ 'is-disabled': !_vm.infinite && _vm.isFirst },on:{"click":function($event){$event.stopPropagation();return _vm.prev.apply(null, arguments)}}},[_c('i',{staticClass:"el-icon-arrow-left"})]),_vm._v(" "),_c('span',{staticClass:"el-image-viewer__btn el-image-viewer__next",class:{ 'is-disabled': !_vm.infinite && _vm.isLast },on:{"click":function($event){$event.stopPropagation();return _vm.next.apply(null, arguments)}}},[_c('i',{staticClass:"el-icon-arrow-right"})])]:_vm._e(),_vm._v(" "),_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){$event.stopPropagation();return _vm.handleActions('zoomOut')}}}),_vm._v(" "),_c('i',{staticClass:"el-icon-zoom-in",on:{"click":function($event){$event.stopPropagation();return _vm.handleActions('zoomIn')}}}),_vm._v(" "),_c('i',{staticClass:"el-image-viewer__actions__divider"}),_vm._v(" "),_c('i',{class:_vm.mode.icon,on:{"click":function($event){$event.stopPropagation();return _vm.toggleMode.apply(null, arguments)}}}),_vm._v(" "),_c('i',{staticClass:"el-image-viewer__actions__divider"}),_vm._v(" "),_c('i',{staticClass:"el-icon-refresh-left",on:{"click":function($event){$event.stopPropagation();return _vm.handleActions('anticlocelise')}}}),_vm._v(" "),_c('i',{staticClass:"el-icon-refresh-right",on:{"click":function($event){$event.stopPropagation();return _vm.handleActions('clocelise')}}})])]),_vm._v(" "),_c('div',{staticClass:"el-image-viewer__canvas",on:{"click":_vm.hide}},_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 staticRenderFns = []
- // CONCATENATED MODULE: ./components/default/image-viewer.vue?vue&type=template&id=35230f64&
- // EXTERNAL MODULE: ./node_modules/_element-ui@2.14.1@element-ui/src/utils/dom.js
- var dom = __webpack_require__(159);
- // EXTERNAL MODULE: ./node_modules/_element-ui@2.14.1@element-ui/src/utils/util.js + 1 modules
- var util = __webpack_require__(160);
- // CONCATENATED MODULE: ./node_modules/_babel-loader@8.2.3@babel-loader/lib??ref--2-0!./node_modules/_@nuxt_components@2.2.1@@nuxt/components/dist/loader.js??ref--0-0!./node_modules/_vue-loader@15.9.8@vue-loader/lib??vue-loader-options!./components/default/image-viewer.vue?vue&type=script&lang=js&
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- const Mode = {
- CONTAIN: {
- name: 'contain',
- icon: 'el-icon-full-screen'
- },
- ORIGINAL: {
- name: 'original',
- icon: 'el-icon-c-scale-to-original'
- }
- };
- const mousewheelEventName = Object(util["a" /* isFirefox */])() ? 'DOMMouseScroll' : 'mousewheel';
- /* harmony default export */ var image_viewervue_type_script_lang_js_ = ({
- name: 'elImageViewer',
- props: {
- urlList: {
- type: Array,
- default: () => []
- },
- zIndex: {
- type: Number,
- default: 2000
- },
- onSwitch: {
- type: Function,
- default: () => {}
- },
- onClose: {
- type: Function,
- default: () => {}
- },
- initialIndex: {
- type: Number,
- default: 0
- }
- },
- 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() {
- return this.urlList.length <= 1;
- },
- isFirst() {
- return this.index === 0;
- },
- isLast() {
- return this.index === this.urlList.length - 1;
- },
- currentImg() {
- return this.urlList[this.index];
- },
- imgStyle() {
- const {
- scale,
- deg,
- offsetX,
- offsetY,
- enableTransition
- } = this.transform;
- const 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 (val) {
- this.reset();
- this.onSwitch(val);
- }
- },
- currentImg(val) {
- this.$nextTick(_ => {
- const $img = this.$refs.img[0];
- if (!$img.complete) {
- this.loading = true;
- }
- });
- }
- },
- methods: {
- hide() {
- this.deviceSupportUninstall(); // this.onClose();
- this.$emit('onClose');
- },
- deviceSupportInstall() {
- this._keyDownHandler = Object(util["b" /* rafThrottle */])(e => {
- const keyCode = e.keyCode;
- switch (keyCode) {
- // ESC
- case 27:
- this.hide();
- break;
- // SPACE
- case 32:
- this.toggleMode();
- break;
- // LEFT_ARROW
- case 37:
- this.prev();
- break;
- // UP_ARROW
- case 38:
- this.handleActions('zoomIn');
- break;
- // RIGHT_ARROW
- case 39:
- this.next();
- break;
- // DOWN_ARROW
- case 40:
- this.handleActions('zoomOut');
- break;
- }
- });
- this._mouseWheelHandler = Object(util["b" /* rafThrottle */])(e => {
- const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
- if (delta > 0) {
- this.handleActions('zoomIn', {
- zoomRate: 0.015,
- enableTransition: false
- });
- } else {
- this.handleActions('zoomOut', {
- zoomRate: 0.015,
- enableTransition: false
- });
- }
- });
- Object(dom["b" /* on */])(document, 'keydown', this._keyDownHandler);
- Object(dom["b" /* on */])(document, mousewheelEventName, this._mouseWheelHandler);
- },
- deviceSupportUninstall() {
- Object(dom["a" /* off */])(document, 'keydown', this._keyDownHandler);
- Object(dom["a" /* off */])(document, mousewheelEventName, this._mouseWheelHandler);
- this._keyDownHandler = null;
- this._mouseWheelHandler = null;
- },
- handleImgLoad(e) {
- this.loading = false;
- },
- handleImgError(e) {
- this.loading = false;
- e.target.alt = '加载失败';
- },
- handleMouseDown(e) {
- if (this.loading || e.button !== 0) return;
- const {
- offsetX,
- offsetY
- } = this.transform;
- const startX = e.pageX;
- const startY = e.pageY;
- this._dragHandler = Object(util["b" /* rafThrottle */])(ev => {
- this.transform.offsetX = offsetX + ev.pageX - startX;
- this.transform.offsetY = offsetY + ev.pageY - startY;
- });
- Object(dom["b" /* on */])(document, 'mousemove', this._dragHandler);
- Object(dom["b" /* on */])(document, 'mouseup', ev => {
- Object(dom["a" /* off */])(document, 'mousemove', this._dragHandler);
- });
- e.preventDefault();
- },
- reset() {
- this.transform = {
- scale: 1,
- deg: 0,
- offsetX: 0,
- offsetY: 0,
- enableTransition: false
- };
- },
- toggleMode() {
- if (this.loading) return;
- const modeNames = Object.keys(Mode);
- const modeValues = Object.values(Mode);
- const index = modeValues.indexOf(this.mode);
- const nextIndex = (index + 1) % modeNames.length;
- this.mode = Mode[modeNames[nextIndex]];
- this.reset();
- },
- prev() {
- if (this.isFirst && !this.infinite) return;
- const len = this.urlList.length;
- this.index = (this.index - 1 + len) % len;
- },
- next() {
- if (this.isLast && !this.infinite) return;
- const len = this.urlList.length;
- this.index = (this.index + 1) % len;
- },
- handleActions(action, options = {}) {
- if (this.loading) return;
- const {
- zoomRate,
- rotateDeg,
- enableTransition
- } = {
- zoomRate: 0.2,
- rotateDeg: 90,
- enableTransition: true,
- ...options
- };
- const {
- transform
- } = this;
- 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() {
- this.deviceSupportInstall(); // 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();
- }
- });
- // CONCATENATED MODULE: ./components/default/image-viewer.vue?vue&type=script&lang=js&
- /* harmony default export */ var default_image_viewervue_type_script_lang_js_ = (image_viewervue_type_script_lang_js_);
- // EXTERNAL MODULE: ./node_modules/_vue-loader@15.9.8@vue-loader/lib/runtime/componentNormalizer.js
- var componentNormalizer = __webpack_require__(2);
- // CONCATENATED MODULE: ./components/default/image-viewer.vue
- /* normalize component */
- var component = Object(componentNormalizer["a" /* default */])(
- default_image_viewervue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- null,
- null,
- "ef95725e"
-
- )
- /* harmony default export */ var image_viewer = __webpack_exports__["default"] = (component.exports);
- /***/ }),
- /***/ 159:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return on; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return off; });
- /* unused harmony export once */
- /* unused harmony export hasClass */
- /* unused harmony export addClass */
- /* unused harmony export removeClass */
- /* unused harmony export getStyle */
- /* unused harmony export setStyle */
- /* unused harmony export isScroll */
- /* unused harmony export getScrollContainer */
- /* unused harmony export isInContainer */
- /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
- /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
- /* istanbul ignore next */
- const isServer = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer;
- const SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
- const MOZ_HACK_REGEXP = /^moz([A-Z])/;
- const ieVersion = isServer ? 0 : Number(document.documentMode);
- /* istanbul ignore next */
- const trim = function(string) {
- return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
- };
- /* istanbul ignore next */
- const camelCase = function(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 */
- const 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 */
- const 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 */
- const once = function(el, event, fn) {
- var listener = function() {
- if (fn) {
- fn.apply(this, arguments);
- }
- off(el, event, listener);
- };
- on(el, event, listener);
- };
- /* istanbul ignore next */
- function hasClass(el, cls) {
- if (!el || !cls) return false;
- if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
- if (el.classList) {
- return el.classList.contains(cls);
- } else {
- return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
- }
- };
- /* istanbul ignore next */
- function addClass(el, cls) {
- if (!el) return;
- var curClass = el.className;
- var classes = (cls || '').split(' ');
- for (var i = 0, j = classes.length; i < j; i++) {
- var clsName = classes[i];
- if (!clsName) continue;
- if (el.classList) {
- el.classList.add(clsName);
- } else if (!hasClass(el, clsName)) {
- curClass += ' ' + clsName;
- }
- }
- if (!el.classList) {
- el.className = curClass;
- }
- };
- /* istanbul ignore next */
- function removeClass(el, cls) {
- if (!el || !cls) return;
- var classes = cls.split(' ');
- var curClass = ' ' + el.className + ' ';
- for (var i = 0, j = classes.length; i < j; i++) {
- var clsName = classes[i];
- if (!clsName) continue;
- if (el.classList) {
- el.classList.remove(clsName);
- } else if (hasClass(el, clsName)) {
- curClass = curClass.replace(' ' + clsName + ' ', ' ');
- }
- }
- if (!el.classList) {
- el.className = trim(curClass);
- }
- };
- /* istanbul ignore next */
- const getStyle = ieVersion < 9 ? function(element, styleName) {
- if (isServer) return;
- if (!element || !styleName) return null;
- styleName = camelCase(styleName);
- if (styleName === 'float') {
- styleName = 'styleFloat';
- }
- try {
- switch (styleName) {
- case 'opacity':
- try {
- return element.filters.item('alpha').opacity / 100;
- } catch (e) {
- return 1.0;
- }
- default:
- return (element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null);
- }
- } catch (e) {
- return element.style[styleName];
- }
- } : function(element, styleName) {
- if (isServer) return;
- if (!element || !styleName) return null;
- styleName = camelCase(styleName);
- if (styleName === 'float') {
- styleName = 'cssFloat';
- }
- try {
- var computed = document.defaultView.getComputedStyle(element, '');
- return element.style[styleName] || computed ? computed[styleName] : null;
- } catch (e) {
- return element.style[styleName];
- }
- };
- /* istanbul ignore next */
- function setStyle(element, styleName, value) {
- if (!element || !styleName) return;
- if (typeof styleName === 'object') {
- for (var prop in styleName) {
- if (styleName.hasOwnProperty(prop)) {
- setStyle(element, prop, styleName[prop]);
- }
- }
- } else {
- styleName = camelCase(styleName);
- if (styleName === 'opacity' && ieVersion < 9) {
- element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
- } else {
- element.style[styleName] = value;
- }
- }
- };
- const isScroll = (el, vertical) => {
- if (isServer) return;
- const determinedDirection = vertical !== null || vertical !== undefined;
- const overflow = determinedDirection
- ? vertical
- ? getStyle(el, 'overflow-y')
- : getStyle(el, 'overflow-x')
- : getStyle(el, 'overflow');
- return overflow.match(/(scroll|auto)/);
- };
- const getScrollContainer = (el, vertical) => {
- if (isServer) return;
- let parent = el;
- while (parent) {
- if ([window, document, document.documentElement].includes(parent)) {
- return window;
- }
- if (isScroll(parent, vertical)) {
- return parent;
- }
- parent = parent.parentNode;
- }
- return parent;
- };
- const isInContainer = (el, container) => {
- if (isServer || !el || !container) return false;
- const elRect = el.getBoundingClientRect();
- let containerRect;
- if ([window, document, document.documentElement, null, undefined].includes(container)) {
- containerRect = {
- top: 0,
- right: window.innerWidth,
- bottom: window.innerHeight,
- left: 0
- };
- } else {
- containerRect = container.getBoundingClientRect();
- }
- return elRect.top < containerRect.bottom &&
- elRect.bottom > containerRect.top &&
- elRect.right > containerRect.left &&
- elRect.left < containerRect.right;
- };
- /***/ }),
- /***/ 160:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ isFirefox; });
- __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ rafThrottle; });
- // UNUSED EXPORTS: noop, hasOwn, toObject, getValueByPath, getPropByPath, generateId, valueEquals, escapeRegexpString, arrayFindIndex, arrayFind, coerceTruthyValueToArray, isIE, isEdge, autoprefixer, kebabCase, capitalize, looseEqual, arrayEquals, isEqual, isEmpty, objToArray
- // EXTERNAL MODULE: external "vue"
- var external_vue_ = __webpack_require__(0);
- var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
- // CONCATENATED MODULE: ./node_modules/_element-ui@2.14.1@element-ui/src/utils/types.js
- 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;
- }
- const isFunction = (functionToCheck) => {
- var getType = {};
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
- };
- const isUndefined = (val)=> {
- return val === void 0;
- };
- const isDefined = (val) => {
- return val !== undefined && val !== null;
- };
- // CONCATENATED MODULE: ./node_modules/_element-ui@2.14.1@element-ui/src/utils/util.js
- const util_hasOwnProperty = Object.prototype.hasOwnProperty;
- function noop() {};
- function hasOwn(obj, key) {
- return util_hasOwnProperty.call(obj, key);
- };
- function extend(to, _from) {
- for (let key in _from) {
- to[key] = _from[key];
- }
- return to;
- };
- function toObject(arr) {
- var res = {};
- for (let i = 0; i < arr.length; i++) {
- if (arr[i]) {
- extend(res, arr[i]);
- }
- }
- return res;
- };
- const getValueByPath = function(object, prop) {
- prop = prop || '';
- const paths = prop.split('.');
- let current = object;
- let result = null;
- for (let i = 0, j = paths.length; i < j; i++) {
- const path = paths[i];
- if (!current) break;
- if (i === j - 1) {
- result = current[path];
- break;
- }
- current = current[path];
- }
- return result;
- };
- function getPropByPath(obj, path, strict) {
- let tempObj = obj;
- path = path.replace(/\[(\w+)\]/g, '.$1');
- path = path.replace(/^\./, '');
- let keyArr = path.split('.');
- let i = 0;
- for (let len = keyArr.length; i < len - 1; ++i) {
- if (!tempObj && !strict) break;
- let 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
- };
- };
- const generateId = function() {
- return Math.floor(Math.random() * 10000);
- };
- const 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 (let i = 0; i !== a.length; ++i) {
- if (a[i] !== b[i]) return false;
- }
- return true;
- };
- const escapeRegexpString = (value = '') => String(value).replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
- // TODO: use native Array.find, Array.findIndex when IE support is dropped
- const arrayFindIndex = function(arr, pred) {
- for (let i = 0; i !== arr.length; ++i) {
- if (pred(arr[i])) {
- return i;
- }
- }
- return -1;
- };
- const arrayFind = function(arr, pred) {
- const idx = arrayFindIndex(arr, pred);
- return idx !== -1 ? arr[idx] : undefined;
- };
- // coerce truthy value to array
- const coerceTruthyValueToArray = function(val) {
- if (Array.isArray(val)) {
- return val;
- } else if (val) {
- return [val];
- } else {
- return [];
- }
- };
- const isIE = function() {
- return !external_vue_default.a.prototype.$isServer && !isNaN(Number(document.documentMode));
- };
- const isEdge = function() {
- return !external_vue_default.a.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
- };
- const isFirefox = function() {
- return !external_vue_default.a.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
- };
- const autoprefixer = function(style) {
- if (typeof style !== 'object') return style;
- const rules = ['transform', 'transition', 'animation'];
- const prefixes = ['ms-', 'webkit-'];
- rules.forEach(rule => {
- const value = style[rule];
- if (rule && value) {
- prefixes.forEach(prefix => {
- style[prefix + rule] = value;
- });
- }
- });
- return style;
- };
- const kebabCase = function(str) {
- const hyphenateRE = /([^-])([A-Z])/g;
- return str
- .replace(hyphenateRE, '$1-$2')
- .replace(hyphenateRE, '$1-$2')
- .toLowerCase();
- };
- const capitalize = function(str) {
- if (!isString(str)) return str;
- return str.charAt(0).toUpperCase() + str.slice(1);
- };
- const looseEqual = function(a, b) {
- const isObjectA = isObject(a);
- const isObjectB = isObject(b);
- if (isObjectA && isObjectB) {
- return JSON.stringify(a) === JSON.stringify(b);
- } else if (!isObjectA && !isObjectB) {
- return String(a) === String(b);
- } else {
- return false;
- }
- };
- const arrayEquals = function(arrayA, arrayB) {
- arrayA = arrayA || [];
- arrayB = arrayB || [];
- if (arrayA.length !== arrayB.length) {
- return false;
- }
- for (let i = 0; i < arrayA.length; i++) {
- if (!looseEqual(arrayA[i], arrayB[i])) {
- return false;
- }
- }
- return true;
- };
- const isEqual = function(value1, value2) {
- if (Array.isArray(value1) && Array.isArray(value2)) {
- return arrayEquals(value1, value2);
- }
- return looseEqual(value1, value2);
- };
- const isEmpty = function(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) {
- let locked = false;
- return function(...args) {
- if (locked) return;
- locked = true;
- window.requestAnimationFrame(_ => {
- fn.apply(this, args);
- locked = false;
- });
- };
- }
- function objToArray(obj) {
- if (Array.isArray(obj)) {
- return obj;
- }
- return isEmpty(obj) ? [] : [obj];
- }
- /***/ })
- };;
- //# sourceMappingURL=default-image-viewer.js.map
|