icve-urc 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103510,13 +103510,6 @@ module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADg
103510
103510
  module.exports = true;
103511
103511
 
103512
103512
 
103513
- /***/ }),
103514
-
103515
- /***/ "b948":
103516
- /***/ (function(module, exports, __webpack_require__) {
103517
-
103518
- module.exports = __webpack_require__.p + "img/error.00e84664.png";
103519
-
103520
103513
  /***/ }),
103521
103514
 
103522
103515
  /***/ "bc3a":
@@ -110890,13 +110883,6 @@ module.exports = { "default": __webpack_require__("f921"), __esModule: true };
110890
110883
 
110891
110884
  /***/ }),
110892
110885
 
110893
- /***/ "f8b2":
110894
- /***/ (function(module, exports, __webpack_require__) {
110895
-
110896
- module.exports = __webpack_require__.p + "img/loading.cf538c14.gif";
110897
-
110898
- /***/ }),
110899
-
110900
110886
  /***/ "f921":
110901
110887
  /***/ (function(module, exports, __webpack_require__) {
110902
110888
 
@@ -114097,1839 +114083,26 @@ var fileUpload_component = normalizeComponent(
114097
114083
  )
114098
114084
 
114099
114085
  /* harmony default export */ var components_fileUpload = (fileUpload_component.exports);
114100
- // CONCATENATED MODULE: ./node_modules/vue-lazyload/vue-lazyload.esm.js
114101
- /*!
114102
- * Vue-Lazyload.js v1.3.3
114103
- * (c) 2019 Awe <hilongjw@gmail.com>
114104
- * Released under the MIT License.
114105
- */
114106
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
114107
- return typeof obj;
114108
- } : function (obj) {
114109
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
114110
- };
114111
-
114112
-
114113
-
114114
-
114115
-
114116
-
114117
-
114118
-
114119
-
114120
-
114121
-
114122
- var classCallCheck = function (instance, Constructor) {
114123
- if (!(instance instanceof Constructor)) {
114124
- throw new TypeError("Cannot call a class as a function");
114125
- }
114126
- };
114127
-
114128
- var createClass = function () {
114129
- function defineProperties(target, props) {
114130
- for (var i = 0; i < props.length; i++) {
114131
- var descriptor = props[i];
114132
- descriptor.enumerable = descriptor.enumerable || false;
114133
- descriptor.configurable = true;
114134
- if ("value" in descriptor) descriptor.writable = true;
114135
- Object.defineProperty(target, descriptor.key, descriptor);
114136
- }
114137
- }
114138
-
114139
- return function (Constructor, protoProps, staticProps) {
114140
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
114141
- if (staticProps) defineProperties(Constructor, staticProps);
114142
- return Constructor;
114143
- };
114144
- }();
114145
-
114146
- /*!
114147
- * is-primitive <https://github.com/jonschlinkert/is-primitive>
114148
- *
114149
- * Copyright (c) 2014-2015, Jon Schlinkert.
114150
- * Licensed under the MIT License.
114151
- */
114152
-
114153
- // see http://jsperf.com/testing-value-is-primitive/7
114154
-
114155
- var isPrimitive = function isPrimitive(value) {
114156
- return value == null || typeof value !== 'function' && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object';
114157
- };
114158
-
114159
- /*!
114160
- * assign-symbols <https://github.com/jonschlinkert/assign-symbols>
114161
- *
114162
- * Copyright (c) 2015, Jon Schlinkert.
114163
- * Licensed under the MIT License.
114164
- */
114165
-
114166
- var assignSymbols = function assignSymbols(receiver, objects) {
114167
- if (receiver === null || typeof receiver === 'undefined') {
114168
- throw new TypeError('expected first argument to be an object.');
114169
- }
114170
-
114171
- if (typeof objects === 'undefined' || typeof Symbol === 'undefined') {
114172
- return receiver;
114173
- }
114174
-
114175
- if (typeof Object.getOwnPropertySymbols !== 'function') {
114176
- return receiver;
114177
- }
114178
-
114179
- var isEnumerable = Object.prototype.propertyIsEnumerable;
114180
- var target = Object(receiver);
114181
- var len = arguments.length,
114182
- i = 0;
114183
-
114184
- while (++i < len) {
114185
- var provider = Object(arguments[i]);
114186
- var names = Object.getOwnPropertySymbols(provider);
114187
-
114188
- for (var j = 0; j < names.length; j++) {
114189
- var key = names[j];
114190
-
114191
- if (isEnumerable.call(provider, key)) {
114192
- target[key] = provider[key];
114193
- }
114194
- }
114195
- }
114196
- return target;
114197
- };
114198
-
114199
- var vue_lazyload_esm_toString = Object.prototype.toString;
114200
-
114201
- /**
114202
- * Get the native `typeof` a value.
114203
- *
114204
- * @param {*} `val`
114205
- * @return {*} Native javascript type
114206
- */
114207
-
114208
- var kindOf = function kindOf(val) {
114209
- var type = typeof val === 'undefined' ? 'undefined' : _typeof(val);
114210
-
114211
- // primitivies
114212
- if (type === 'undefined') {
114213
- return 'undefined';
114214
- }
114215
- if (val === null) {
114216
- return 'null';
114217
- }
114218
- if (val === true || val === false || val instanceof Boolean) {
114219
- return 'boolean';
114220
- }
114221
- if (type === 'string' || val instanceof String) {
114222
- return 'string';
114223
- }
114224
- if (type === 'number' || val instanceof Number) {
114225
- return 'number';
114226
- }
114227
-
114228
- // functions
114229
- if (type === 'function' || val instanceof Function) {
114230
- if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') {
114231
- return 'generatorfunction';
114232
- }
114233
- return 'function';
114234
- }
114235
-
114236
- // array
114237
- if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
114238
- return 'array';
114239
- }
114240
-
114241
- // check for instances of RegExp and Date before calling `toString`
114242
- if (val instanceof RegExp) {
114243
- return 'regexp';
114244
- }
114245
- if (val instanceof Date) {
114246
- return 'date';
114247
- }
114248
-
114249
- // other objects
114250
- type = vue_lazyload_esm_toString.call(val);
114251
-
114252
- if (type === '[object RegExp]') {
114253
- return 'regexp';
114254
- }
114255
- if (type === '[object Date]') {
114256
- return 'date';
114257
- }
114258
- if (type === '[object Arguments]') {
114259
- return 'arguments';
114260
- }
114261
- if (type === '[object Error]') {
114262
- return 'error';
114263
- }
114264
- if (type === '[object Promise]') {
114265
- return 'promise';
114266
- }
114267
-
114268
- // buffer
114269
- if (isBuffer(val)) {
114270
- return 'buffer';
114271
- }
114272
-
114273
- // es6: Map, WeakMap, Set, WeakSet
114274
- if (type === '[object Set]') {
114275
- return 'set';
114276
- }
114277
- if (type === '[object WeakSet]') {
114278
- return 'weakset';
114279
- }
114280
- if (type === '[object Map]') {
114281
- return 'map';
114282
- }
114283
- if (type === '[object WeakMap]') {
114284
- return 'weakmap';
114285
- }
114286
- if (type === '[object Symbol]') {
114287
- return 'symbol';
114288
- }
114289
-
114290
- if (type === '[object Map Iterator]') {
114291
- return 'mapiterator';
114292
- }
114293
- if (type === '[object Set Iterator]') {
114294
- return 'setiterator';
114295
- }
114296
- if (type === '[object String Iterator]') {
114297
- return 'stringiterator';
114298
- }
114299
- if (type === '[object Array Iterator]') {
114300
- return 'arrayiterator';
114301
- }
114302
-
114303
- // typed arrays
114304
- if (type === '[object Int8Array]') {
114305
- return 'int8array';
114306
- }
114307
- if (type === '[object Uint8Array]') {
114308
- return 'uint8array';
114309
- }
114310
- if (type === '[object Uint8ClampedArray]') {
114311
- return 'uint8clampedarray';
114312
- }
114313
- if (type === '[object Int16Array]') {
114314
- return 'int16array';
114315
- }
114316
- if (type === '[object Uint16Array]') {
114317
- return 'uint16array';
114318
- }
114319
- if (type === '[object Int32Array]') {
114320
- return 'int32array';
114321
- }
114322
- if (type === '[object Uint32Array]') {
114323
- return 'uint32array';
114324
- }
114325
- if (type === '[object Float32Array]') {
114326
- return 'float32array';
114327
- }
114328
- if (type === '[object Float64Array]') {
114329
- return 'float64array';
114330
- }
114331
-
114332
- // must be a plain object
114333
- return 'object';
114334
- };
114335
-
114336
- /**
114337
- * If you need to support Safari 5-7 (8-10 yr-old browser),
114338
- * take a look at https://github.com/feross/is-buffer
114339
- */
114340
-
114341
- function isBuffer(val) {
114342
- return val.constructor && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
114343
- }
114344
-
114345
- function vue_lazyload_esm_assign(target /*, objects*/) {
114346
- target = target || {};
114347
- var len = arguments.length,
114348
- i = 0;
114349
- if (len === 1) {
114350
- return target;
114351
- }
114352
- while (++i < len) {
114353
- var val = arguments[i];
114354
- if (isPrimitive(target)) {
114355
- target = val;
114356
- }
114357
- if (isObject$1(val)) {
114358
- vue_lazyload_esm_extend(target, val);
114359
- }
114360
- }
114361
- return target;
114362
- }
114363
-
114364
- /**
114365
- * Shallow extend
114366
- */
114367
-
114368
- function vue_lazyload_esm_extend(target, obj) {
114369
- assignSymbols(target, obj);
114370
-
114371
- for (var key in obj) {
114372
- if (key !== '__proto__' && vue_lazyload_esm_hasOwn(obj, key)) {
114373
- var val = obj[key];
114374
- if (isObject$1(val)) {
114375
- if (kindOf(target[key]) === 'undefined' && kindOf(val) === 'function') {
114376
- target[key] = val;
114377
- }
114378
- target[key] = vue_lazyload_esm_assign(target[key] || {}, val);
114379
- } else {
114380
- target[key] = val;
114381
- }
114382
- }
114383
- }
114384
- return target;
114385
- }
114386
-
114387
- /**
114388
- * Returns true if the object is a plain object or a function.
114389
- */
114390
-
114391
- function isObject$1(obj) {
114392
- return kindOf(obj) === 'object' || kindOf(obj) === 'function';
114393
- }
114394
-
114395
- /**
114396
- * Returns true if the given `key` is an own property of `obj`.
114397
- */
114398
-
114399
- function vue_lazyload_esm_hasOwn(obj, key) {
114400
- return Object.prototype.hasOwnProperty.call(obj, key);
114401
- }
114402
-
114403
- /**
114404
- * Expose `assign`
114405
- */
114406
-
114407
- var assignDeep = vue_lazyload_esm_assign;
114408
-
114409
- var inBrowser = typeof window !== 'undefined';
114410
- var hasIntersectionObserver = checkIntersectionObserver();
114411
-
114412
- function checkIntersectionObserver() {
114413
- if (inBrowser && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
114414
- // Minimal polyfill for Edge 15's lack of `isIntersecting`
114415
- // See: https://github.com/w3c/IntersectionObserver/issues/211
114416
- if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) {
114417
- Object.defineProperty(window.IntersectionObserverEntry.prototype, 'isIntersecting', {
114418
- get: function get$$1() {
114419
- return this.intersectionRatio > 0;
114420
- }
114421
- });
114422
- }
114423
- return true;
114424
- }
114425
- return false;
114426
- }
114427
-
114428
- var modeType = {
114429
- event: 'event',
114430
- observer: 'observer'
114431
-
114432
- // CustomEvent polyfill
114433
- };var CustomEvent = function () {
114434
- if (!inBrowser) return;
114435
- if (typeof window.CustomEvent === 'function') return window.CustomEvent;
114436
- function CustomEvent(event, params) {
114437
- params = params || { bubbles: false, cancelable: false, detail: undefined };
114438
- var evt = document.createEvent('CustomEvent');
114439
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
114440
- return evt;
114441
- }
114442
- CustomEvent.prototype = window.Event.prototype;
114443
- return CustomEvent;
114444
- }();
114445
-
114446
- function remove(arr, item) {
114447
- if (!arr.length) return;
114448
- var index = arr.indexOf(item);
114449
- if (index > -1) return arr.splice(index, 1);
114450
- }
114451
-
114452
- function some(arr, fn) {
114453
- var has = false;
114454
- for (var i = 0, len = arr.length; i < len; i++) {
114455
- if (fn(arr[i])) {
114456
- has = true;
114457
- break;
114458
- }
114459
- }
114460
- return has;
114461
- }
114462
-
114463
- function getBestSelectionFromSrcset(el, scale) {
114464
- if (el.tagName !== 'IMG' || !el.getAttribute('data-srcset')) return;
114465
-
114466
- var options = el.getAttribute('data-srcset');
114467
- var result = [];
114468
- var container = el.parentNode;
114469
- var containerWidth = container.offsetWidth * scale;
114470
-
114471
- var spaceIndex = void 0;
114472
- var tmpSrc = void 0;
114473
- var tmpWidth = void 0;
114474
-
114475
- options = options.trim().split(',');
114476
-
114477
- options.map(function (item) {
114478
- item = item.trim();
114479
- spaceIndex = item.lastIndexOf(' ');
114480
- if (spaceIndex === -1) {
114481
- tmpSrc = item;
114482
- tmpWidth = 999998;
114483
- } else {
114484
- tmpSrc = item.substr(0, spaceIndex);
114485
- tmpWidth = parseInt(item.substr(spaceIndex + 1, item.length - spaceIndex - 2), 10);
114486
- }
114487
- result.push([tmpWidth, tmpSrc]);
114488
- });
114489
-
114490
- result.sort(function (a, b) {
114491
- if (a[0] < b[0]) {
114492
- return 1;
114493
- }
114494
- if (a[0] > b[0]) {
114495
- return -1;
114496
- }
114497
- if (a[0] === b[0]) {
114498
- if (b[1].indexOf('.webp', b[1].length - 5) !== -1) {
114499
- return 1;
114500
- }
114501
- if (a[1].indexOf('.webp', a[1].length - 5) !== -1) {
114502
- return -1;
114503
- }
114504
- }
114505
- return 0;
114506
- });
114507
- var bestSelectedSrc = '';
114508
- var tmpOption = void 0;
114509
-
114510
- for (var i = 0; i < result.length; i++) {
114511
- tmpOption = result[i];
114512
- bestSelectedSrc = tmpOption[1];
114513
- var next = result[i + 1];
114514
- if (next && next[0] < containerWidth) {
114515
- bestSelectedSrc = tmpOption[1];
114516
- break;
114517
- } else if (!next) {
114518
- bestSelectedSrc = tmpOption[1];
114519
- break;
114520
- }
114521
- }
114522
-
114523
- return bestSelectedSrc;
114524
- }
114525
-
114526
- function find(arr, fn) {
114527
- var item = void 0;
114528
- for (var i = 0, len = arr.length; i < len; i++) {
114529
- if (fn(arr[i])) {
114530
- item = arr[i];
114531
- break;
114532
- }
114533
- }
114534
- return item;
114535
- }
114536
-
114537
- var getDPR = function getDPR() {
114538
- var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
114539
- return inBrowser ? window.devicePixelRatio || scale : scale;
114540
- };
114541
-
114542
- function supportWebp() {
114543
- if (!inBrowser) return false;
114544
-
114545
- var support = true;
114546
- var d = document;
114547
-
114548
- try {
114549
- var el = d.createElement('object');
114550
- el.type = 'image/webp';
114551
- el.style.visibility = 'hidden';
114552
- el.innerHTML = '!';
114553
- d.body.appendChild(el);
114554
- support = !el.offsetWidth;
114555
- d.body.removeChild(el);
114556
- } catch (err) {
114557
- support = false;
114558
- }
114559
-
114560
- return support;
114561
- }
114562
-
114563
- function throttle(action, delay) {
114564
- var timeout = null;
114565
- var lastRun = 0;
114566
- return function () {
114567
- if (timeout) {
114568
- return;
114569
- }
114570
- var elapsed = Date.now() - lastRun;
114571
- var context = this;
114572
- var args = arguments;
114573
- var runCallback = function runCallback() {
114574
- lastRun = Date.now();
114575
- timeout = false;
114576
- action.apply(context, args);
114577
- };
114578
- if (elapsed >= delay) {
114579
- runCallback();
114580
- } else {
114581
- timeout = setTimeout(runCallback, delay);
114582
- }
114583
- };
114584
- }
114585
-
114586
- function testSupportsPassive() {
114587
- if (!inBrowser) return;
114588
- var support = false;
114589
- try {
114590
- var opts = Object.defineProperty({}, 'passive', {
114591
- get: function get$$1() {
114592
- support = true;
114593
- }
114594
- });
114595
- window.addEventListener('test', null, opts);
114596
- } catch (e) {}
114597
- return support;
114598
- }
114599
-
114600
- var supportsPassive = testSupportsPassive();
114601
-
114602
- var _ = {
114603
- on: function on(el, type, func) {
114604
- var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
114605
-
114606
- if (supportsPassive) {
114607
- el.addEventListener(type, func, {
114608
- capture: capture,
114609
- passive: true
114610
- });
114611
- } else {
114612
- el.addEventListener(type, func, capture);
114613
- }
114614
- },
114615
- off: function off(el, type, func) {
114616
- var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
114617
-
114618
- el.removeEventListener(type, func, capture);
114619
- }
114620
- };
114621
-
114622
- var loadImageAsync = function loadImageAsync(item, resolve, reject) {
114623
- var image = new Image();
114624
- if (!item || !item.src) {
114625
- var err = new Error('image src is required');
114626
- return reject(err);
114627
- }
114628
-
114629
- image.src = item.src;
114630
-
114631
- image.onload = function () {
114632
- resolve({
114633
- naturalHeight: image.naturalHeight,
114634
- naturalWidth: image.naturalWidth,
114635
- src: image.src
114636
- });
114637
- };
114638
-
114639
- image.onerror = function (e) {
114640
- reject(e);
114641
- };
114642
- };
114643
-
114644
- var style = function style(el, prop) {
114645
- return typeof getComputedStyle !== 'undefined' ? getComputedStyle(el, null).getPropertyValue(prop) : el.style[prop];
114646
- };
114647
-
114648
- var overflow = function overflow(el) {
114649
- return style(el, 'overflow') + style(el, 'overflow-y') + style(el, 'overflow-x');
114650
- };
114651
-
114652
- var scrollParent = function scrollParent(el) {
114653
- if (!inBrowser) return;
114654
- if (!(el instanceof HTMLElement)) {
114655
- return window;
114656
- }
114657
-
114658
- var parent = el;
114659
-
114660
- while (parent) {
114661
- if (parent === document.body || parent === document.documentElement) {
114662
- break;
114663
- }
114664
-
114665
- if (!parent.parentNode) {
114666
- break;
114667
- }
114668
-
114669
- if (/(scroll|auto)/.test(overflow(parent))) {
114670
- return parent;
114671
- }
114672
-
114673
- parent = parent.parentNode;
114674
- }
114675
-
114676
- return window;
114677
- };
114678
-
114679
- function vue_lazyload_esm_isObject(obj) {
114680
- return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
114681
- }
114682
-
114683
- function ObjectKeys(obj) {
114684
- if (!(obj instanceof Object)) return [];
114685
- if (Object.keys) {
114686
- return Object.keys(obj);
114687
- } else {
114688
- var keys = [];
114689
- for (var key in obj) {
114690
- if (obj.hasOwnProperty(key)) {
114691
- keys.push(key);
114692
- }
114693
- }
114694
- return keys;
114695
- }
114696
- }
114697
-
114698
- function ArrayFrom(arrLike) {
114699
- var len = arrLike.length;
114700
- var list = [];
114701
- for (var i = 0; i < len; i++) {
114702
- list.push(arrLike[i]);
114703
- }
114704
- return list;
114705
- }
114706
-
114707
- function vue_lazyload_esm_noop() {}
114708
-
114709
- var ImageCache = function () {
114710
- function ImageCache(_ref) {
114711
- var max = _ref.max;
114712
- classCallCheck(this, ImageCache);
114713
-
114714
- this.options = {
114715
- max: max || 100
114716
- };
114717
- this._caches = [];
114718
- }
114719
-
114720
- createClass(ImageCache, [{
114721
- key: 'has',
114722
- value: function has(key) {
114723
- return this._caches.indexOf(key) > -1;
114724
- }
114725
- }, {
114726
- key: 'add',
114727
- value: function add(key) {
114728
- if (this.has(key)) return;
114729
- this._caches.push(key);
114730
- if (this._caches.length > this.options.max) {
114731
- this.free();
114732
- }
114733
- }
114734
- }, {
114735
- key: 'free',
114736
- value: function free() {
114737
- this._caches.shift();
114738
- }
114739
- }]);
114740
- return ImageCache;
114741
- }();
114742
-
114743
- // el: {
114744
- // state,
114745
- // src,
114746
- // error,
114747
- // loading
114748
- // }
114749
-
114750
- var ReactiveListener = function () {
114751
- function ReactiveListener(_ref) {
114752
- var el = _ref.el,
114753
- src = _ref.src,
114754
- error = _ref.error,
114755
- loading = _ref.loading,
114756
- bindType = _ref.bindType,
114757
- $parent = _ref.$parent,
114758
- options = _ref.options,
114759
- elRenderer = _ref.elRenderer,
114760
- imageCache = _ref.imageCache;
114761
- classCallCheck(this, ReactiveListener);
114762
-
114763
- this.el = el;
114764
- this.src = src;
114765
- this.error = error;
114766
- this.loading = loading;
114767
- this.bindType = bindType;
114768
- this.attempt = 0;
114769
-
114770
- this.naturalHeight = 0;
114771
- this.naturalWidth = 0;
114772
-
114773
- this.options = options;
114774
-
114775
- this.rect = null;
114776
-
114777
- this.$parent = $parent;
114778
- this.elRenderer = elRenderer;
114779
- this._imageCache = imageCache;
114780
- this.performanceData = {
114781
- init: Date.now(),
114782
- loadStart: 0,
114783
- loadEnd: 0
114784
- };
114785
-
114786
- this.filter();
114787
- this.initState();
114788
- this.render('loading', false);
114789
- }
114790
-
114791
- /*
114792
- * init listener state
114793
- * @return
114794
- */
114795
-
114796
-
114797
- createClass(ReactiveListener, [{
114798
- key: 'initState',
114799
- value: function initState() {
114800
- if ('dataset' in this.el) {
114801
- this.el.dataset.src = this.src;
114802
- } else {
114803
- this.el.setAttribute('data-src', this.src);
114804
- }
114805
-
114806
- this.state = {
114807
- loading: false,
114808
- error: false,
114809
- loaded: false,
114810
- rendered: false
114811
- };
114812
- }
114813
-
114814
- /*
114815
- * record performance
114816
- * @return
114817
- */
114818
-
114819
- }, {
114820
- key: 'record',
114821
- value: function record(event) {
114822
- this.performanceData[event] = Date.now();
114823
- }
114824
-
114825
- /*
114826
- * update image listener data
114827
- * @param {String} image uri
114828
- * @param {String} loading image uri
114829
- * @param {String} error image uri
114830
- * @return
114831
- */
114832
-
114833
- }, {
114834
- key: 'update',
114835
- value: function update(_ref2) {
114836
- var src = _ref2.src,
114837
- loading = _ref2.loading,
114838
- error = _ref2.error;
114839
-
114840
- var oldSrc = this.src;
114841
- this.src = src;
114842
- this.loading = loading;
114843
- this.error = error;
114844
- this.filter();
114845
- if (oldSrc !== this.src) {
114846
- this.attempt = 0;
114847
- this.initState();
114848
- }
114849
- }
114850
-
114851
- /*
114852
- * get el node rect
114853
- * @return
114854
- */
114855
-
114856
- }, {
114857
- key: 'getRect',
114858
- value: function getRect() {
114859
- this.rect = this.el.getBoundingClientRect();
114860
- }
114861
-
114862
- /*
114863
- * check el is in view
114864
- * @return {Boolean} el is in view
114865
- */
114866
-
114867
- }, {
114868
- key: 'checkInView',
114869
- value: function checkInView() {
114870
- this.getRect();
114871
- return this.rect.top < window.innerHeight * this.options.preLoad && this.rect.bottom > this.options.preLoadTop && this.rect.left < window.innerWidth * this.options.preLoad && this.rect.right > 0;
114872
- }
114873
-
114874
- /*
114875
- * listener filter
114876
- */
114877
-
114878
- }, {
114879
- key: 'filter',
114880
- value: function filter() {
114881
- var _this = this;
114882
-
114883
- ObjectKeys(this.options.filter).map(function (key) {
114884
- _this.options.filter[key](_this, _this.options);
114885
- });
114886
- }
114887
-
114888
- /*
114889
- * render loading first
114890
- * @params cb:Function
114891
- * @return
114892
- */
114893
-
114894
- }, {
114895
- key: 'renderLoading',
114896
- value: function renderLoading(cb) {
114897
- var _this2 = this;
114898
-
114899
- this.state.loading = true;
114900
- loadImageAsync({
114901
- src: this.loading
114902
- }, function (data) {
114903
- _this2.render('loading', false);
114904
- _this2.state.loading = false;
114905
- cb();
114906
- }, function () {
114907
- // handler `loading image` load failed
114908
- cb();
114909
- _this2.state.loading = false;
114910
- if (!_this2.options.silent) console.warn('VueLazyload log: load failed with loading image(' + _this2.loading + ')');
114911
- });
114912
- }
114913
-
114914
- /*
114915
- * try load image and render it
114916
- * @return
114917
- */
114918
-
114919
- }, {
114920
- key: 'load',
114921
- value: function load() {
114922
- var _this3 = this;
114923
-
114924
- var onFinish = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : vue_lazyload_esm_noop;
114925
-
114926
- if (this.attempt > this.options.attempt - 1 && this.state.error) {
114927
- if (!this.options.silent) console.log('VueLazyload log: ' + this.src + ' tried too more than ' + this.options.attempt + ' times');
114928
- onFinish();
114929
- return;
114930
- }
114931
- if (this.state.rendered && this.state.loaded) return;
114932
- if (this._imageCache.has(this.src)) {
114933
- this.state.loaded = true;
114934
- this.render('loaded', true);
114935
- this.state.rendered = true;
114936
- return onFinish();
114937
- }
114938
-
114939
- this.renderLoading(function () {
114940
- _this3.attempt++;
114941
-
114942
- _this3.options.adapter['beforeLoad'] && _this3.options.adapter['beforeLoad'](_this3, _this3.options);
114943
- _this3.record('loadStart');
114944
-
114945
- loadImageAsync({
114946
- src: _this3.src
114947
- }, function (data) {
114948
- _this3.naturalHeight = data.naturalHeight;
114949
- _this3.naturalWidth = data.naturalWidth;
114950
- _this3.state.loaded = true;
114951
- _this3.state.error = false;
114952
- _this3.record('loadEnd');
114953
- _this3.render('loaded', false);
114954
- _this3.state.rendered = true;
114955
- _this3._imageCache.add(_this3.src);
114956
- onFinish();
114957
- }, function (err) {
114958
- !_this3.options.silent && console.error(err);
114959
- _this3.state.error = true;
114960
- _this3.state.loaded = false;
114961
- _this3.render('error', false);
114962
- });
114963
- });
114964
- }
114965
-
114966
- /*
114967
- * render image
114968
- * @param {String} state to render // ['loading', 'src', 'error']
114969
- * @param {String} is form cache
114970
- * @return
114971
- */
114972
-
114973
- }, {
114974
- key: 'render',
114975
- value: function render(state, cache) {
114976
- this.elRenderer(this, state, cache);
114977
- }
114978
-
114979
- /*
114980
- * output performance data
114981
- * @return {Object} performance data
114982
- */
114983
-
114984
- }, {
114985
- key: 'performance',
114986
- value: function performance() {
114987
- var state = 'loading';
114988
- var time = 0;
114989
-
114990
- if (this.state.loaded) {
114991
- state = 'loaded';
114992
- time = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1000;
114993
- }
114994
-
114995
- if (this.state.error) state = 'error';
114996
-
114997
- return {
114998
- src: this.src,
114999
- state: state,
115000
- time: time
115001
- };
115002
- }
115003
-
115004
- /*
115005
- * $destroy
115006
- * @return
115007
- */
115008
-
115009
- }, {
115010
- key: '$destroy',
115011
- value: function $destroy() {
115012
- this.el = null;
115013
- this.src = null;
115014
- this.error = null;
115015
- this.loading = null;
115016
- this.bindType = null;
115017
- this.attempt = 0;
115018
- }
115019
- }]);
115020
- return ReactiveListener;
115021
- }();
115022
-
115023
- var DEFAULT_URL = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
115024
- var DEFAULT_EVENTS = ['scroll', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove'];
115025
- var DEFAULT_OBSERVER_OPTIONS = {
115026
- rootMargin: '0px',
115027
- threshold: 0
115028
- };
115029
-
115030
- var Lazy = function (Vue) {
115031
- return function () {
115032
- function Lazy(_ref) {
115033
- var preLoad = _ref.preLoad,
115034
- error = _ref.error,
115035
- throttleWait = _ref.throttleWait,
115036
- preLoadTop = _ref.preLoadTop,
115037
- dispatchEvent = _ref.dispatchEvent,
115038
- loading = _ref.loading,
115039
- attempt = _ref.attempt,
115040
- _ref$silent = _ref.silent,
115041
- silent = _ref$silent === undefined ? true : _ref$silent,
115042
- scale = _ref.scale,
115043
- listenEvents = _ref.listenEvents,
115044
- hasbind = _ref.hasbind,
115045
- filter = _ref.filter,
115046
- adapter = _ref.adapter,
115047
- observer = _ref.observer,
115048
- observerOptions = _ref.observerOptions;
115049
- classCallCheck(this, Lazy);
115050
-
115051
- this.version = '1.3.3';
115052
- this.mode = modeType.event;
115053
- this.ListenerQueue = [];
115054
- this.TargetIndex = 0;
115055
- this.TargetQueue = [];
115056
- this.options = {
115057
- silent: silent,
115058
- dispatchEvent: !!dispatchEvent,
115059
- throttleWait: throttleWait || 200,
115060
- preLoad: preLoad || 1.3,
115061
- preLoadTop: preLoadTop || 0,
115062
- error: error || DEFAULT_URL,
115063
- loading: loading || DEFAULT_URL,
115064
- attempt: attempt || 3,
115065
- scale: scale || getDPR(scale),
115066
- ListenEvents: listenEvents || DEFAULT_EVENTS,
115067
- hasbind: false,
115068
- supportWebp: supportWebp(),
115069
- filter: filter || {},
115070
- adapter: adapter || {},
115071
- observer: !!observer,
115072
- observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
115073
- };
115074
- this._initEvent();
115075
- this._imageCache = new ImageCache({ max: 200 });
115076
- this.lazyLoadHandler = throttle(this._lazyLoadHandler.bind(this), this.options.throttleWait);
115077
-
115078
- this.setMode(this.options.observer ? modeType.observer : modeType.event);
115079
- }
115080
-
115081
- /**
115082
- * update config
115083
- * @param {Object} config params
115084
- * @return
115085
- */
115086
-
115087
-
115088
- createClass(Lazy, [{
115089
- key: 'config',
115090
- value: function config() {
115091
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
115092
-
115093
- assignDeep(this.options, options);
115094
- }
115095
-
115096
- /**
115097
- * output listener's load performance
115098
- * @return {Array}
115099
- */
115100
-
115101
- }, {
115102
- key: 'performance',
115103
- value: function performance() {
115104
- var list = [];
115105
-
115106
- this.ListenerQueue.map(function (item) {
115107
- list.push(item.performance());
115108
- });
115109
-
115110
- return list;
115111
- }
115112
-
115113
- /*
115114
- * add lazy component to queue
115115
- * @param {Vue} vm lazy component instance
115116
- * @return
115117
- */
115118
-
115119
- }, {
115120
- key: 'addLazyBox',
115121
- value: function addLazyBox(vm) {
115122
- this.ListenerQueue.push(vm);
115123
- if (inBrowser) {
115124
- this._addListenerTarget(window);
115125
- this._observer && this._observer.observe(vm.el);
115126
- if (vm.$el && vm.$el.parentNode) {
115127
- this._addListenerTarget(vm.$el.parentNode);
115128
- }
115129
- }
115130
- }
115131
-
115132
- /*
115133
- * add image listener to queue
115134
- * @param {DOM} el
115135
- * @param {object} binding vue directive binding
115136
- * @param {vnode} vnode vue directive vnode
115137
- * @return
115138
- */
115139
-
115140
- }, {
115141
- key: 'add',
115142
- value: function add(el, binding, vnode) {
115143
- var _this = this;
115144
-
115145
- if (some(this.ListenerQueue, function (item) {
115146
- return item.el === el;
115147
- })) {
115148
- this.update(el, binding);
115149
- return Vue.nextTick(this.lazyLoadHandler);
115150
- }
115151
-
115152
- var _valueFormatter2 = this._valueFormatter(binding.value),
115153
- src = _valueFormatter2.src,
115154
- loading = _valueFormatter2.loading,
115155
- error = _valueFormatter2.error;
115156
-
115157
- Vue.nextTick(function () {
115158
- src = getBestSelectionFromSrcset(el, _this.options.scale) || src;
115159
- _this._observer && _this._observer.observe(el);
115160
-
115161
- var container = Object.keys(binding.modifiers)[0];
115162
- var $parent = void 0;
115163
-
115164
- if (container) {
115165
- $parent = vnode.context.$refs[container];
115166
- // if there is container passed in, try ref first, then fallback to getElementById to support the original usage
115167
- $parent = $parent ? $parent.$el || $parent : document.getElementById(container);
115168
- }
115169
-
115170
- if (!$parent) {
115171
- $parent = scrollParent(el);
115172
- }
115173
-
115174
- var newListener = new ReactiveListener({
115175
- bindType: binding.arg,
115176
- $parent: $parent,
115177
- el: el,
115178
- loading: loading,
115179
- error: error,
115180
- src: src,
115181
- elRenderer: _this._elRenderer.bind(_this),
115182
- options: _this.options,
115183
- imageCache: _this._imageCache
115184
- });
115185
-
115186
- _this.ListenerQueue.push(newListener);
115187
-
115188
- if (inBrowser) {
115189
- _this._addListenerTarget(window);
115190
- _this._addListenerTarget($parent);
115191
- }
115192
-
115193
- _this.lazyLoadHandler();
115194
- Vue.nextTick(function () {
115195
- return _this.lazyLoadHandler();
115196
- });
115197
- });
115198
- }
115199
-
115200
- /**
115201
- * update image src
115202
- * @param {DOM} el
115203
- * @param {object} vue directive binding
115204
- * @return
115205
- */
115206
-
115207
- }, {
115208
- key: 'update',
115209
- value: function update(el, binding, vnode) {
115210
- var _this2 = this;
115211
-
115212
- var _valueFormatter3 = this._valueFormatter(binding.value),
115213
- src = _valueFormatter3.src,
115214
- loading = _valueFormatter3.loading,
115215
- error = _valueFormatter3.error;
115216
-
115217
- src = getBestSelectionFromSrcset(el, this.options.scale) || src;
115218
-
115219
- var exist = find(this.ListenerQueue, function (item) {
115220
- return item.el === el;
115221
- });
115222
- if (!exist) {
115223
- this.add(el, binding, vnode);
115224
- } else {
115225
- exist.update({
115226
- src: src,
115227
- loading: loading,
115228
- error: error
115229
- });
115230
- }
115231
- if (this._observer) {
115232
- this._observer.unobserve(el);
115233
- this._observer.observe(el);
115234
- }
115235
- this.lazyLoadHandler();
115236
- Vue.nextTick(function () {
115237
- return _this2.lazyLoadHandler();
115238
- });
115239
- }
115240
-
115241
- /**
115242
- * remove listener form list
115243
- * @param {DOM} el
115244
- * @return
115245
- */
115246
-
115247
- }, {
115248
- key: 'remove',
115249
- value: function remove$$1(el) {
115250
- if (!el) return;
115251
- this._observer && this._observer.unobserve(el);
115252
- var existItem = find(this.ListenerQueue, function (item) {
115253
- return item.el === el;
115254
- });
115255
- if (existItem) {
115256
- this._removeListenerTarget(existItem.$parent);
115257
- this._removeListenerTarget(window);
115258
- remove(this.ListenerQueue, existItem);
115259
- existItem.$destroy();
115260
- }
115261
- }
115262
-
115263
- /*
115264
- * remove lazy components form list
115265
- * @param {Vue} vm Vue instance
115266
- * @return
115267
- */
115268
-
115269
- }, {
115270
- key: 'removeComponent',
115271
- value: function removeComponent(vm) {
115272
- if (!vm) return;
115273
- remove(this.ListenerQueue, vm);
115274
- this._observer && this._observer.unobserve(vm.el);
115275
- if (vm.$parent && vm.$el.parentNode) {
115276
- this._removeListenerTarget(vm.$el.parentNode);
115277
- }
115278
- this._removeListenerTarget(window);
115279
- }
115280
- }, {
115281
- key: 'setMode',
115282
- value: function setMode(mode) {
115283
- var _this3 = this;
115284
-
115285
- if (!hasIntersectionObserver && mode === modeType.observer) {
115286
- mode = modeType.event;
115287
- }
115288
-
115289
- this.mode = mode; // event or observer
115290
-
115291
- if (mode === modeType.event) {
115292
- if (this._observer) {
115293
- this.ListenerQueue.forEach(function (listener) {
115294
- _this3._observer.unobserve(listener.el);
115295
- });
115296
- this._observer = null;
115297
- }
115298
-
115299
- this.TargetQueue.forEach(function (target) {
115300
- _this3._initListen(target.el, true);
115301
- });
115302
- } else {
115303
- this.TargetQueue.forEach(function (target) {
115304
- _this3._initListen(target.el, false);
115305
- });
115306
- this._initIntersectionObserver();
115307
- }
115308
- }
115309
-
115310
- /*
115311
- *** Private functions ***
115312
- */
115313
-
115314
- /*
115315
- * add listener target
115316
- * @param {DOM} el listener target
115317
- * @return
115318
- */
115319
-
115320
- }, {
115321
- key: '_addListenerTarget',
115322
- value: function _addListenerTarget(el) {
115323
- if (!el) return;
115324
- var target = find(this.TargetQueue, function (target) {
115325
- return target.el === el;
115326
- });
115327
- if (!target) {
115328
- target = {
115329
- el: el,
115330
- id: ++this.TargetIndex,
115331
- childrenCount: 1,
115332
- listened: true
115333
- };
115334
- this.mode === modeType.event && this._initListen(target.el, true);
115335
- this.TargetQueue.push(target);
115336
- } else {
115337
- target.childrenCount++;
115338
- }
115339
- return this.TargetIndex;
115340
- }
115341
-
115342
- /*
115343
- * remove listener target or reduce target childrenCount
115344
- * @param {DOM} el or window
115345
- * @return
115346
- */
115347
-
115348
- }, {
115349
- key: '_removeListenerTarget',
115350
- value: function _removeListenerTarget(el) {
115351
- var _this4 = this;
115352
-
115353
- this.TargetQueue.forEach(function (target, index) {
115354
- if (target.el === el) {
115355
- target.childrenCount--;
115356
- if (!target.childrenCount) {
115357
- _this4._initListen(target.el, false);
115358
- _this4.TargetQueue.splice(index, 1);
115359
- target = null;
115360
- }
115361
- }
115362
- });
115363
- }
115364
-
115365
- /*
115366
- * add or remove eventlistener
115367
- * @param {DOM} el DOM or Window
115368
- * @param {boolean} start flag
115369
- * @return
115370
- */
115371
-
115372
- }, {
115373
- key: '_initListen',
115374
- value: function _initListen(el, start) {
115375
- var _this5 = this;
115376
-
115377
- this.options.ListenEvents.forEach(function (evt) {
115378
- return _[start ? 'on' : 'off'](el, evt, _this5.lazyLoadHandler);
115379
- });
115380
- }
115381
- }, {
115382
- key: '_initEvent',
115383
- value: function _initEvent() {
115384
- var _this6 = this;
115385
-
115386
- this.Event = {
115387
- listeners: {
115388
- loading: [],
115389
- loaded: [],
115390
- error: []
115391
- }
115392
- };
115393
-
115394
- this.$on = function (event, func) {
115395
- if (!_this6.Event.listeners[event]) _this6.Event.listeners[event] = [];
115396
- _this6.Event.listeners[event].push(func);
115397
- };
115398
-
115399
- this.$once = function (event, func) {
115400
- var vm = _this6;
115401
- function on() {
115402
- vm.$off(event, on);
115403
- func.apply(vm, arguments);
115404
- }
115405
- _this6.$on(event, on);
115406
- };
115407
-
115408
- this.$off = function (event, func) {
115409
- if (!func) {
115410
- if (!_this6.Event.listeners[event]) return;
115411
- _this6.Event.listeners[event].length = 0;
115412
- return;
115413
- }
115414
- remove(_this6.Event.listeners[event], func);
115415
- };
115416
-
115417
- this.$emit = function (event, context, inCache) {
115418
- if (!_this6.Event.listeners[event]) return;
115419
- _this6.Event.listeners[event].forEach(function (func) {
115420
- return func(context, inCache);
115421
- });
115422
- };
115423
- }
115424
-
115425
- /**
115426
- * find nodes which in viewport and trigger load
115427
- * @return
115428
- */
115429
-
115430
- }, {
115431
- key: '_lazyLoadHandler',
115432
- value: function _lazyLoadHandler() {
115433
- var _this7 = this;
115434
-
115435
- var freeList = [];
115436
- this.ListenerQueue.forEach(function (listener, index) {
115437
- if (!listener.el || !listener.el.parentNode) {
115438
- freeList.push(listener);
115439
- }
115440
- var catIn = listener.checkInView();
115441
- if (!catIn) return;
115442
- listener.load();
115443
- });
115444
- freeList.forEach(function (item) {
115445
- remove(_this7.ListenerQueue, item);
115446
- item.$destroy();
115447
- });
115448
- }
115449
- /**
115450
- * init IntersectionObserver
115451
- * set mode to observer
115452
- * @return
115453
- */
115454
-
115455
- }, {
115456
- key: '_initIntersectionObserver',
115457
- value: function _initIntersectionObserver() {
115458
- var _this8 = this;
115459
-
115460
- if (!hasIntersectionObserver) return;
115461
- this._observer = new IntersectionObserver(this._observerHandler.bind(this), this.options.observerOptions);
115462
- if (this.ListenerQueue.length) {
115463
- this.ListenerQueue.forEach(function (listener) {
115464
- _this8._observer.observe(listener.el);
115465
- });
115466
- }
115467
- }
115468
-
115469
- /**
115470
- * init IntersectionObserver
115471
- * @return
115472
- */
115473
-
115474
- }, {
115475
- key: '_observerHandler',
115476
- value: function _observerHandler(entries, observer) {
115477
- var _this9 = this;
115478
-
115479
- entries.forEach(function (entry) {
115480
- if (entry.isIntersecting) {
115481
- _this9.ListenerQueue.forEach(function (listener) {
115482
- if (listener.el === entry.target) {
115483
- if (listener.state.loaded) return _this9._observer.unobserve(listener.el);
115484
- listener.load();
115485
- }
115486
- });
115487
- }
115488
- });
115489
- }
115490
-
115491
- /**
115492
- * set element attribute with image'url and state
115493
- * @param {object} lazyload listener object
115494
- * @param {string} state will be rendered
115495
- * @param {bool} inCache is rendered from cache
115496
- * @return
115497
- */
115498
-
115499
- }, {
115500
- key: '_elRenderer',
115501
- value: function _elRenderer(listener, state, cache) {
115502
- if (!listener.el) return;
115503
- var el = listener.el,
115504
- bindType = listener.bindType;
115505
-
115506
-
115507
- var src = void 0;
115508
- switch (state) {
115509
- case 'loading':
115510
- src = listener.loading;
115511
- break;
115512
- case 'error':
115513
- src = listener.error;
115514
- break;
115515
- default:
115516
- src = listener.src;
115517
- break;
115518
- }
115519
-
115520
- if (bindType) {
115521
- el.style[bindType] = 'url("' + src + '")';
115522
- } else if (el.getAttribute('src') !== src) {
115523
- el.setAttribute('src', src);
115524
- }
115525
-
115526
- el.setAttribute('lazy', state);
115527
-
115528
- this.$emit(state, listener, cache);
115529
- this.options.adapter[state] && this.options.adapter[state](listener, this.options);
115530
-
115531
- if (this.options.dispatchEvent) {
115532
- var event = new CustomEvent(state, {
115533
- detail: listener
115534
- });
115535
- el.dispatchEvent(event);
115536
- }
115537
- }
115538
-
115539
- /**
115540
- * generate loading loaded error image url
115541
- * @param {string} image's src
115542
- * @return {object} image's loading, loaded, error url
115543
- */
115544
-
115545
- }, {
115546
- key: '_valueFormatter',
115547
- value: function _valueFormatter(value) {
115548
- var src = value;
115549
- var loading = this.options.loading;
115550
- var error = this.options.error;
115551
-
115552
- // value is object
115553
- if (vue_lazyload_esm_isObject(value)) {
115554
- if (!value.src && !this.options.silent) console.error('Vue Lazyload warning: miss src with ' + value);
115555
- src = value.src;
115556
- loading = value.loading || this.options.loading;
115557
- error = value.error || this.options.error;
115558
- }
115559
- return {
115560
- src: src,
115561
- loading: loading,
115562
- error: error
115563
- };
115564
- }
115565
- }]);
115566
- return Lazy;
115567
- }();
115568
- };
115569
-
115570
- var LazyComponent = (function (lazy) {
115571
- return {
115572
- props: {
115573
- tag: {
115574
- type: String,
115575
- default: 'div'
115576
- }
115577
- },
115578
- render: function render(h) {
115579
- if (this.show === false) {
115580
- return h(this.tag);
115581
- }
115582
- return h(this.tag, null, this.$slots.default);
115583
- },
115584
- data: function data() {
115585
- return {
115586
- el: null,
115587
- state: {
115588
- loaded: false
115589
- },
115590
- rect: {},
115591
- show: false
115592
- };
115593
- },
115594
- mounted: function mounted() {
115595
- this.el = this.$el;
115596
- lazy.addLazyBox(this);
115597
- lazy.lazyLoadHandler();
115598
- },
115599
- beforeDestroy: function beforeDestroy() {
115600
- lazy.removeComponent(this);
115601
- },
115602
-
115603
- methods: {
115604
- getRect: function getRect() {
115605
- this.rect = this.$el.getBoundingClientRect();
115606
- },
115607
- checkInView: function checkInView() {
115608
- this.getRect();
115609
- return inBrowser && this.rect.top < window.innerHeight * lazy.options.preLoad && this.rect.bottom > 0 && this.rect.left < window.innerWidth * lazy.options.preLoad && this.rect.right > 0;
115610
- },
115611
- load: function load() {
115612
- this.show = true;
115613
- this.state.loaded = true;
115614
- this.$emit('show', this);
115615
- },
115616
- destroy: function destroy() {
115617
- return this.$destroy;
115618
- }
115619
- }
115620
- };
115621
- });
115622
-
115623
- var LazyContainerMananger = function () {
115624
- function LazyContainerMananger(_ref) {
115625
- var lazy = _ref.lazy;
115626
- classCallCheck(this, LazyContainerMananger);
115627
-
115628
- this.lazy = lazy;
115629
- lazy.lazyContainerMananger = this;
115630
- this._queue = [];
115631
- }
115632
-
115633
- createClass(LazyContainerMananger, [{
115634
- key: 'bind',
115635
- value: function bind(el, binding, vnode) {
115636
- var container = new LazyContainer$1({ el: el, binding: binding, vnode: vnode, lazy: this.lazy });
115637
- this._queue.push(container);
115638
- }
115639
- }, {
115640
- key: 'update',
115641
- value: function update(el, binding, vnode) {
115642
- var container = find(this._queue, function (item) {
115643
- return item.el === el;
115644
- });
115645
- if (!container) return;
115646
- container.update({ el: el, binding: binding, vnode: vnode });
115647
- }
115648
- }, {
115649
- key: 'unbind',
115650
- value: function unbind(el, binding, vnode) {
115651
- var container = find(this._queue, function (item) {
115652
- return item.el === el;
115653
- });
115654
- if (!container) return;
115655
- container.clear();
115656
- remove(this._queue, container);
115657
- }
115658
- }]);
115659
- return LazyContainerMananger;
115660
- }();
115661
-
115662
- var defaultOptions = {
115663
- selector: 'img'
115664
- };
115665
-
115666
- var LazyContainer$1 = function () {
115667
- function LazyContainer(_ref2) {
115668
- var el = _ref2.el,
115669
- binding = _ref2.binding,
115670
- vnode = _ref2.vnode,
115671
- lazy = _ref2.lazy;
115672
- classCallCheck(this, LazyContainer);
115673
-
115674
- this.el = null;
115675
- this.vnode = vnode;
115676
- this.binding = binding;
115677
- this.options = {};
115678
- this.lazy = lazy;
115679
-
115680
- this._queue = [];
115681
- this.update({ el: el, binding: binding });
115682
- }
115683
-
115684
- createClass(LazyContainer, [{
115685
- key: 'update',
115686
- value: function update(_ref3) {
115687
- var _this = this;
115688
-
115689
- var el = _ref3.el,
115690
- binding = _ref3.binding;
115691
-
115692
- this.el = el;
115693
- this.options = assignDeep({}, defaultOptions, binding.value);
115694
-
115695
- var imgs = this.getImgs();
115696
- imgs.forEach(function (el) {
115697
- _this.lazy.add(el, assignDeep({}, _this.binding, {
115698
- value: {
115699
- src: 'dataset' in el ? el.dataset.src : el.getAttribute('data-src'),
115700
- error: ('dataset' in el ? el.dataset.error : el.getAttribute('data-error')) || _this.options.error,
115701
- loading: ('dataset' in el ? el.dataset.loading : el.getAttribute('data-loading')) || _this.options.loading
115702
- }
115703
- }), _this.vnode);
115704
- });
115705
- }
115706
- }, {
115707
- key: 'getImgs',
115708
- value: function getImgs() {
115709
- return ArrayFrom(this.el.querySelectorAll(this.options.selector));
115710
- }
115711
- }, {
115712
- key: 'clear',
115713
- value: function clear() {
115714
- var _this2 = this;
115715
-
115716
- var imgs = this.getImgs();
115717
- imgs.forEach(function (el) {
115718
- return _this2.lazy.remove(el);
115719
- });
115720
-
115721
- this.vnode = null;
115722
- this.binding = null;
115723
- this.lazy = null;
115724
- }
115725
- }]);
115726
- return LazyContainer;
115727
- }();
115728
-
115729
- var LazyImage = (function (lazyManager) {
115730
- return {
115731
- props: {
115732
- src: [String, Object],
115733
- tag: {
115734
- type: String,
115735
- default: 'img'
115736
- }
115737
- },
115738
- render: function render(h) {
115739
- return h(this.tag, {
115740
- attrs: {
115741
- src: this.renderSrc
115742
- }
115743
- }, this.$slots.default);
115744
- },
115745
- data: function data() {
115746
- return {
115747
- el: null,
115748
- options: {
115749
- src: '',
115750
- error: '',
115751
- loading: '',
115752
- attempt: lazyManager.options.attempt
115753
- },
115754
- state: {
115755
- loaded: false,
115756
- error: false,
115757
- attempt: 0
115758
- },
115759
- rect: {},
115760
- renderSrc: ''
115761
- };
115762
- },
115763
-
115764
- watch: {
115765
- src: function src() {
115766
- this.init();
115767
- lazyManager.addLazyBox(this);
115768
- lazyManager.lazyLoadHandler();
115769
- }
115770
- },
115771
- created: function created() {
115772
- this.init();
115773
- this.renderSrc = this.options.loading;
115774
- },
115775
- mounted: function mounted() {
115776
- this.el = this.$el;
115777
- lazyManager.addLazyBox(this);
115778
- lazyManager.lazyLoadHandler();
115779
- },
115780
- beforeDestroy: function beforeDestroy() {
115781
- lazyManager.removeComponent(this);
115782
- },
115783
-
115784
- methods: {
115785
- init: function init() {
115786
- var _lazyManager$_valueFo = lazyManager._valueFormatter(this.src),
115787
- src = _lazyManager$_valueFo.src,
115788
- loading = _lazyManager$_valueFo.loading,
115789
- error = _lazyManager$_valueFo.error;
115790
-
115791
- this.state.loaded = false;
115792
- this.options.src = src;
115793
- this.options.error = error;
115794
- this.options.loading = loading;
115795
- this.renderSrc = this.options.loading;
115796
- },
115797
- getRect: function getRect() {
115798
- this.rect = this.$el.getBoundingClientRect();
115799
- },
115800
- checkInView: function checkInView() {
115801
- this.getRect();
115802
- return inBrowser && this.rect.top < window.innerHeight * lazyManager.options.preLoad && this.rect.bottom > 0 && this.rect.left < window.innerWidth * lazyManager.options.preLoad && this.rect.right > 0;
115803
- },
115804
- load: function load() {
115805
- var _this = this;
115806
-
115807
- var onFinish = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : vue_lazyload_esm_noop;
115808
-
115809
- if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
115810
- if (!lazyManager.options.silent) console.log('VueLazyload log: ' + this.options.src + ' tried too more than ' + this.options.attempt + ' times');
115811
- onFinish();
115812
- return;
115813
- }
115814
- var src = this.options.src;
115815
- loadImageAsync({ src: src }, function (_ref) {
115816
- var src = _ref.src;
115817
-
115818
- _this.renderSrc = src;
115819
- _this.state.loaded = true;
115820
- }, function (e) {
115821
- _this.state.attempt++;
115822
- _this.renderSrc = _this.options.error;
115823
- _this.state.error = true;
115824
- });
115825
- }
115826
- }
115827
- };
115828
- });
115829
-
115830
- var index = {
115831
- /*
115832
- * install function
115833
- * @param {Vue} Vue
115834
- * @param {object} options lazyload options
115835
- */
115836
- install: function install(Vue) {
115837
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
115838
-
115839
- var LazyClass = Lazy(Vue);
115840
- var lazy = new LazyClass(options);
115841
- var lazyContainer = new LazyContainerMananger({ lazy: lazy });
115842
-
115843
- var isVue2 = Vue.version.split('.')[0] === '2';
115844
-
115845
- Vue.prototype.$Lazyload = lazy;
115846
-
115847
- if (options.lazyComponent) {
115848
- Vue.component('lazy-component', LazyComponent(lazy));
115849
- }
115850
-
115851
- if (options.lazyImage) {
115852
- Vue.component('lazy-image', LazyImage(lazy));
115853
- }
115854
-
115855
- if (isVue2) {
115856
- Vue.directive('lazy', {
115857
- bind: lazy.add.bind(lazy),
115858
- update: lazy.update.bind(lazy),
115859
- componentUpdated: lazy.lazyLoadHandler.bind(lazy),
115860
- unbind: lazy.remove.bind(lazy)
115861
- });
115862
- Vue.directive('lazy-container', {
115863
- bind: lazyContainer.bind.bind(lazyContainer),
115864
- componentUpdated: lazyContainer.update.bind(lazyContainer),
115865
- unbind: lazyContainer.unbind.bind(lazyContainer)
115866
- });
115867
- } else {
115868
- Vue.directive('lazy', {
115869
- bind: lazy.lazyLoadHandler.bind(lazy),
115870
- update: function update(newValue, oldValue) {
115871
- assignDeep(this.vm.$refs, this.vm.$els);
115872
- lazy.add(this.el, {
115873
- modifiers: this.modifiers || {},
115874
- arg: this.arg,
115875
- value: newValue,
115876
- oldValue: oldValue
115877
- }, {
115878
- context: this.vm
115879
- });
115880
- },
115881
- unbind: function unbind() {
115882
- lazy.remove(this.el);
115883
- }
115884
- });
115885
-
115886
- Vue.directive('lazy-container', {
115887
- update: function update(newValue, oldValue) {
115888
- lazyContainer.update(this.el, {
115889
- modifiers: this.modifiers || {},
115890
- arg: this.arg,
115891
- value: newValue,
115892
- oldValue: oldValue
115893
- }, {
115894
- context: this.vm
115895
- });
115896
- },
115897
- unbind: function unbind() {
115898
- lazyContainer.unbind(this.el);
115899
- }
115900
- });
115901
- }
115902
- }
115903
- };
115904
-
115905
- /* harmony default export */ var vue_lazyload_esm = (index);
115906
-
115907
114086
  // CONCATENATED MODULE: ./index.js
115908
114087
 
115909
114088
 
115910
114089
 
115911
- // 新增:导入vue-lazyload插件
115912
114090
  // 导出组件
115913
114091
 
115914
114092
 
115915
114093
  // 添加 install 方法以支持 Vue.use()
115916
- /* harmony default export */ var index_0 = ({
114094
+ /* harmony default export */ var index = ({
115917
114095
  install(Vue) {
115918
- Vue.component('FileImport', fileImport)
115919
- Vue.component('FilePreview', components_filePreview)
115920
- Vue.component('FileUpload', components_fileUpload)
115921
- // 新增:安装vue-lazyload插件(使用与原项目一致的配置)
115922
- Vue.use(vue_lazyload_esm, {
115923
- loading: __webpack_require__("f8b2"),
115924
- error: __webpack_require__("b948")
115925
- })
114096
+ Vue.component("FileImport", fileImport);
114097
+ Vue.component("FilePreview", components_filePreview);
114098
+ Vue.component("FileUpload", components_fileUpload);
115926
114099
  },
115927
114100
  });
115928
114101
 
115929
114102
  // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
115930
114103
 
115931
114104
 
115932
- /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (index_0);
114105
+ /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (index);
115933
114106
 
115934
114107
 
115935
114108