zartui 2.0.39 → 2.0.41
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.
- package/es/index.js +1 -1
- package/es/timeline/index.css +1 -1
- package/es/timeline/index.js +9 -1
- package/es/timeline/index.less +7 -0
- package/lib/index.css +1 -1
- package/lib/index.js +1 -1
- package/lib/timeline/index.css +1 -1
- package/lib/timeline/index.js +9 -1
- package/lib/timeline/index.less +7 -0
- package/lib/zart.js +1363 -1642
- package/lib/zart.min.js +1 -1
- package/package.json +1 -1
package/lib/zart.js
CHANGED
|
@@ -380,54 +380,9 @@ function resetObject(target, source) {
|
|
|
380
380
|
/***/ (function(module, exports, __webpack_require__) {
|
|
381
381
|
|
|
382
382
|
"use strict";
|
|
383
|
+
function _extends(){return _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}var normalMerge=["attrs","props","domProps"],toArrayMerge=["class","style","directives"],functionalMerge=["on","nativeOn"],mergeJsxProps=function(a){return a.reduce(function(c,a){for(var b in a)if(!c[b])c[b]=a[b];else if(-1!==normalMerge.indexOf(b))c[b]=_extends({},c[b],a[b]);else if(-1!==toArrayMerge.indexOf(b)){var d=c[b]instanceof Array?c[b]:[c[b]],e=a[b]instanceof Array?a[b]:[a[b]];c[b]=d.concat(e)}else if(-1!==functionalMerge.indexOf(b)){for(var f in a[b])if(c[b][f]){var g=c[b][f]instanceof Array?c[b][f]:[c[b][f]],h=a[b][f]instanceof Array?a[b][f]:[a[b][f]];c[b][f]=g.concat(h)}else c[b][f]=a[b][f];}else if("hook"==b)for(var i in a[b])c[b][i]=c[b][i]?mergeFn(c[b][i],a[b][i]):a[b][i];else c[b]=a[b];return c},{})},mergeFn=function(a,b){return function(){a&&a.apply(this,arguments),b&&b.apply(this,arguments)}};module.exports=mergeJsxProps;
|
|
383
384
|
|
|
384
385
|
|
|
385
|
-
function _extends() {
|
|
386
|
-
return _extends = Object.assign || function (a) {
|
|
387
|
-
for (var b, c = 1; c < arguments.length; c++) {
|
|
388
|
-
for (var d in b = arguments[c], b) {
|
|
389
|
-
Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d]);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
return a;
|
|
394
|
-
}, _extends.apply(this, arguments);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
var normalMerge = ["attrs", "props", "domProps"],
|
|
398
|
-
toArrayMerge = ["class", "style", "directives"],
|
|
399
|
-
functionalMerge = ["on", "nativeOn"],
|
|
400
|
-
mergeJsxProps = function mergeJsxProps(a) {
|
|
401
|
-
return a.reduce(function (c, a) {
|
|
402
|
-
for (var b in a) {
|
|
403
|
-
if (!c[b]) c[b] = a[b];else if (-1 !== normalMerge.indexOf(b)) c[b] = _extends({}, c[b], a[b]);else if (-1 !== toArrayMerge.indexOf(b)) {
|
|
404
|
-
var d = c[b] instanceof Array ? c[b] : [c[b]],
|
|
405
|
-
e = a[b] instanceof Array ? a[b] : [a[b]];
|
|
406
|
-
c[b] = d.concat(e);
|
|
407
|
-
} else if (-1 !== functionalMerge.indexOf(b)) {
|
|
408
|
-
for (var f in a[b]) {
|
|
409
|
-
if (c[b][f]) {
|
|
410
|
-
var g = c[b][f] instanceof Array ? c[b][f] : [c[b][f]],
|
|
411
|
-
h = a[b][f] instanceof Array ? a[b][f] : [a[b][f]];
|
|
412
|
-
c[b][f] = g.concat(h);
|
|
413
|
-
} else c[b][f] = a[b][f];
|
|
414
|
-
}
|
|
415
|
-
} else if ("hook" == b) for (var i in a[b]) {
|
|
416
|
-
c[b][i] = c[b][i] ? mergeFn(c[b][i], a[b][i]) : a[b][i];
|
|
417
|
-
} else c[b] = a[b];
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return c;
|
|
421
|
-
}, {});
|
|
422
|
-
},
|
|
423
|
-
mergeFn = function mergeFn(a, b) {
|
|
424
|
-
return function () {
|
|
425
|
-
a && a.apply(this, arguments), b && b.apply(this, arguments);
|
|
426
|
-
};
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
module.exports = mergeJsxProps;
|
|
430
|
-
|
|
431
386
|
/***/ }),
|
|
432
387
|
/* 2 */
|
|
433
388
|
/***/ (function(module, exports) {
|
|
@@ -858,25 +813,28 @@ module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABE
|
|
|
858
813
|
/* 10 */
|
|
859
814
|
/***/ (function(module, exports) {
|
|
860
815
|
|
|
861
|
-
var g;
|
|
816
|
+
var g;
|
|
862
817
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
818
|
+
// This works in non-strict mode
|
|
819
|
+
g = (function() {
|
|
820
|
+
return this;
|
|
821
|
+
})();
|
|
866
822
|
|
|
867
823
|
try {
|
|
868
|
-
|
|
869
|
-
|
|
824
|
+
// This works if eval is allowed (see CSP)
|
|
825
|
+
g = g || new Function("return this")();
|
|
870
826
|
} catch (e) {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
}
|
|
827
|
+
// This works if the window reference is available
|
|
828
|
+
if (typeof window === "object") g = window;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// g can still be undefined, but nothing to do about it...
|
|
874
832
|
// We return undefined, instead of nothing here, so it's
|
|
875
833
|
// easier to handle this case. if(!global) { ...}
|
|
876
834
|
|
|
877
|
-
|
|
878
835
|
module.exports = g;
|
|
879
836
|
|
|
837
|
+
|
|
880
838
|
/***/ }),
|
|
881
839
|
/* 11 */
|
|
882
840
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
@@ -4778,7 +4736,7 @@ var Toast_createNamespace = Object(utils["b" /* createNamespace */])('toast'),
|
|
|
4778
4736
|
|
|
4779
4737
|
|
|
4780
4738
|
|
|
4781
|
-
var
|
|
4739
|
+
var defaultOptions = {
|
|
4782
4740
|
icon: '',
|
|
4783
4741
|
type: 'text',
|
|
4784
4742
|
// @deprecated
|
|
@@ -4805,7 +4763,7 @@ var defaultOptionsMap = {};
|
|
|
4805
4763
|
var queue = [];
|
|
4806
4764
|
var multiple = false;
|
|
4807
4765
|
|
|
4808
|
-
var currentOptions = _extends({},
|
|
4766
|
+
var currentOptions = _extends({}, defaultOptions);
|
|
4809
4767
|
|
|
4810
4768
|
function parseOptions(message) {
|
|
4811
4769
|
if (Object(utils["g" /* isObject */])(message)) {
|
|
@@ -4941,7 +4899,7 @@ toast_Toast.resetDefaultOptions = function (type) {
|
|
|
4941
4899
|
if (typeof type === 'string') {
|
|
4942
4900
|
defaultOptionsMap[type] = null;
|
|
4943
4901
|
} else {
|
|
4944
|
-
currentOptions = _extends({},
|
|
4902
|
+
currentOptions = _extends({}, defaultOptions);
|
|
4945
4903
|
defaultOptionsMap = {};
|
|
4946
4904
|
}
|
|
4947
4905
|
};
|
|
@@ -16436,7 +16394,17 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
|
|
|
16436
16394
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
16437
16395
|
};
|
|
16438
16396
|
|
|
16439
|
-
|
|
16397
|
+
|
|
16398
|
+
|
|
16399
|
+
|
|
16400
|
+
|
|
16401
|
+
|
|
16402
|
+
|
|
16403
|
+
|
|
16404
|
+
|
|
16405
|
+
|
|
16406
|
+
|
|
16407
|
+
var classCallCheck = function (instance, Constructor) {
|
|
16440
16408
|
if (!(instance instanceof Constructor)) {
|
|
16441
16409
|
throw new TypeError("Cannot call a class as a function");
|
|
16442
16410
|
}
|
|
@@ -16459,18 +16427,20 @@ var createClass = function () {
|
|
|
16459
16427
|
return Constructor;
|
|
16460
16428
|
};
|
|
16461
16429
|
}();
|
|
16430
|
+
|
|
16462
16431
|
/*!
|
|
16463
16432
|
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
16464
16433
|
*
|
|
16465
16434
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|
16466
16435
|
* Licensed under the MIT License.
|
|
16467
16436
|
*/
|
|
16468
|
-
// see http://jsperf.com/testing-value-is-primitive/7
|
|
16469
16437
|
|
|
16438
|
+
// see http://jsperf.com/testing-value-is-primitive/7
|
|
16470
16439
|
|
|
16471
16440
|
var isPrimitive = function isPrimitive(value) {
|
|
16472
16441
|
return value == null || typeof value !== 'function' && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object';
|
|
16473
16442
|
};
|
|
16443
|
+
|
|
16474
16444
|
/*!
|
|
16475
16445
|
* assign-symbols <https://github.com/jonschlinkert/assign-symbols>
|
|
16476
16446
|
*
|
|
@@ -16478,7 +16448,6 @@ var isPrimitive = function isPrimitive(value) {
|
|
|
16478
16448
|
* Licensed under the MIT License.
|
|
16479
16449
|
*/
|
|
16480
16450
|
|
|
16481
|
-
|
|
16482
16451
|
var assignSymbols = function assignSymbols(receiver, objects) {
|
|
16483
16452
|
if (receiver === null || typeof receiver === 'undefined') {
|
|
16484
16453
|
throw new TypeError('expected first argument to be an object.');
|
|
@@ -16509,11 +16478,11 @@ var assignSymbols = function assignSymbols(receiver, objects) {
|
|
|
16509
16478
|
}
|
|
16510
16479
|
}
|
|
16511
16480
|
}
|
|
16512
|
-
|
|
16513
16481
|
return target;
|
|
16514
16482
|
};
|
|
16515
16483
|
|
|
16516
16484
|
var vue_lazyload_esm_toString = Object.prototype.toString;
|
|
16485
|
+
|
|
16517
16486
|
/**
|
|
16518
16487
|
* Get the native `typeof` a value.
|
|
16519
16488
|
*
|
|
@@ -16522,96 +16491,83 @@ var vue_lazyload_esm_toString = Object.prototype.toString;
|
|
|
16522
16491
|
*/
|
|
16523
16492
|
|
|
16524
16493
|
var kindOf = function kindOf(val) {
|
|
16525
|
-
var type = typeof val === 'undefined' ? 'undefined' : _typeof(val);
|
|
16494
|
+
var type = typeof val === 'undefined' ? 'undefined' : _typeof(val);
|
|
16526
16495
|
|
|
16496
|
+
// primitivies
|
|
16527
16497
|
if (type === 'undefined') {
|
|
16528
16498
|
return 'undefined';
|
|
16529
16499
|
}
|
|
16530
|
-
|
|
16531
16500
|
if (val === null) {
|
|
16532
16501
|
return 'null';
|
|
16533
16502
|
}
|
|
16534
|
-
|
|
16535
16503
|
if (val === true || val === false || val instanceof Boolean) {
|
|
16536
16504
|
return 'boolean';
|
|
16537
16505
|
}
|
|
16538
|
-
|
|
16539
16506
|
if (type === 'string' || val instanceof String) {
|
|
16540
16507
|
return 'string';
|
|
16541
16508
|
}
|
|
16542
|
-
|
|
16543
16509
|
if (type === 'number' || val instanceof Number) {
|
|
16544
16510
|
return 'number';
|
|
16545
|
-
}
|
|
16546
|
-
|
|
16511
|
+
}
|
|
16547
16512
|
|
|
16513
|
+
// functions
|
|
16548
16514
|
if (type === 'function' || val instanceof Function) {
|
|
16549
16515
|
if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') {
|
|
16550
16516
|
return 'generatorfunction';
|
|
16551
16517
|
}
|
|
16552
|
-
|
|
16553
16518
|
return 'function';
|
|
16554
|
-
}
|
|
16555
|
-
|
|
16519
|
+
}
|
|
16556
16520
|
|
|
16521
|
+
// array
|
|
16557
16522
|
if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
|
|
16558
16523
|
return 'array';
|
|
16559
|
-
}
|
|
16560
|
-
|
|
16524
|
+
}
|
|
16561
16525
|
|
|
16526
|
+
// check for instances of RegExp and Date before calling `toString`
|
|
16562
16527
|
if (val instanceof RegExp) {
|
|
16563
16528
|
return 'regexp';
|
|
16564
16529
|
}
|
|
16565
|
-
|
|
16566
16530
|
if (val instanceof Date) {
|
|
16567
16531
|
return 'date';
|
|
16568
|
-
}
|
|
16569
|
-
|
|
16532
|
+
}
|
|
16570
16533
|
|
|
16534
|
+
// other objects
|
|
16571
16535
|
type = vue_lazyload_esm_toString.call(val);
|
|
16572
16536
|
|
|
16573
16537
|
if (type === '[object RegExp]') {
|
|
16574
16538
|
return 'regexp';
|
|
16575
16539
|
}
|
|
16576
|
-
|
|
16577
16540
|
if (type === '[object Date]') {
|
|
16578
16541
|
return 'date';
|
|
16579
16542
|
}
|
|
16580
|
-
|
|
16581
16543
|
if (type === '[object Arguments]') {
|
|
16582
16544
|
return 'arguments';
|
|
16583
16545
|
}
|
|
16584
|
-
|
|
16585
16546
|
if (type === '[object Error]') {
|
|
16586
16547
|
return 'error';
|
|
16587
16548
|
}
|
|
16588
|
-
|
|
16589
16549
|
if (type === '[object Promise]') {
|
|
16590
16550
|
return 'promise';
|
|
16591
|
-
}
|
|
16592
|
-
|
|
16551
|
+
}
|
|
16593
16552
|
|
|
16553
|
+
// buffer
|
|
16594
16554
|
if (isBuffer(val)) {
|
|
16595
16555
|
return 'buffer';
|
|
16596
|
-
}
|
|
16597
|
-
|
|
16556
|
+
}
|
|
16598
16557
|
|
|
16558
|
+
// es6: Map, WeakMap, Set, WeakSet
|
|
16599
16559
|
if (type === '[object Set]') {
|
|
16600
16560
|
return 'set';
|
|
16601
16561
|
}
|
|
16602
|
-
|
|
16603
16562
|
if (type === '[object WeakSet]') {
|
|
16604
16563
|
return 'weakset';
|
|
16605
16564
|
}
|
|
16606
|
-
|
|
16607
16565
|
if (type === '[object Map]') {
|
|
16608
16566
|
return 'map';
|
|
16609
16567
|
}
|
|
16610
|
-
|
|
16611
16568
|
if (type === '[object WeakMap]') {
|
|
16612
16569
|
return 'weakmap';
|
|
16613
16570
|
}
|
|
16614
|
-
|
|
16615
16571
|
if (type === '[object Symbol]') {
|
|
16616
16572
|
return 'symbol';
|
|
16617
16573
|
}
|
|
@@ -16619,142 +16575,122 @@ var kindOf = function kindOf(val) {
|
|
|
16619
16575
|
if (type === '[object Map Iterator]') {
|
|
16620
16576
|
return 'mapiterator';
|
|
16621
16577
|
}
|
|
16622
|
-
|
|
16623
16578
|
if (type === '[object Set Iterator]') {
|
|
16624
16579
|
return 'setiterator';
|
|
16625
16580
|
}
|
|
16626
|
-
|
|
16627
16581
|
if (type === '[object String Iterator]') {
|
|
16628
16582
|
return 'stringiterator';
|
|
16629
16583
|
}
|
|
16630
|
-
|
|
16631
16584
|
if (type === '[object Array Iterator]') {
|
|
16632
16585
|
return 'arrayiterator';
|
|
16633
|
-
}
|
|
16634
|
-
|
|
16586
|
+
}
|
|
16635
16587
|
|
|
16588
|
+
// typed arrays
|
|
16636
16589
|
if (type === '[object Int8Array]') {
|
|
16637
16590
|
return 'int8array';
|
|
16638
16591
|
}
|
|
16639
|
-
|
|
16640
16592
|
if (type === '[object Uint8Array]') {
|
|
16641
16593
|
return 'uint8array';
|
|
16642
16594
|
}
|
|
16643
|
-
|
|
16644
16595
|
if (type === '[object Uint8ClampedArray]') {
|
|
16645
16596
|
return 'uint8clampedarray';
|
|
16646
16597
|
}
|
|
16647
|
-
|
|
16648
16598
|
if (type === '[object Int16Array]') {
|
|
16649
16599
|
return 'int16array';
|
|
16650
16600
|
}
|
|
16651
|
-
|
|
16652
16601
|
if (type === '[object Uint16Array]') {
|
|
16653
16602
|
return 'uint16array';
|
|
16654
16603
|
}
|
|
16655
|
-
|
|
16656
16604
|
if (type === '[object Int32Array]') {
|
|
16657
16605
|
return 'int32array';
|
|
16658
16606
|
}
|
|
16659
|
-
|
|
16660
16607
|
if (type === '[object Uint32Array]') {
|
|
16661
16608
|
return 'uint32array';
|
|
16662
16609
|
}
|
|
16663
|
-
|
|
16664
16610
|
if (type === '[object Float32Array]') {
|
|
16665
16611
|
return 'float32array';
|
|
16666
16612
|
}
|
|
16667
|
-
|
|
16668
16613
|
if (type === '[object Float64Array]') {
|
|
16669
16614
|
return 'float64array';
|
|
16670
|
-
}
|
|
16671
|
-
|
|
16615
|
+
}
|
|
16672
16616
|
|
|
16617
|
+
// must be a plain object
|
|
16673
16618
|
return 'object';
|
|
16674
16619
|
};
|
|
16620
|
+
|
|
16675
16621
|
/**
|
|
16676
16622
|
* If you need to support Safari 5-7 (8-10 yr-old browser),
|
|
16677
16623
|
* take a look at https://github.com/feross/is-buffer
|
|
16678
16624
|
*/
|
|
16679
16625
|
|
|
16680
|
-
|
|
16681
16626
|
function isBuffer(val) {
|
|
16682
16627
|
return val.constructor && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
|
16683
16628
|
}
|
|
16684
16629
|
|
|
16685
|
-
function vue_lazyload_esm_assign(target
|
|
16686
|
-
/*, objects*/
|
|
16687
|
-
) {
|
|
16630
|
+
function vue_lazyload_esm_assign(target /*, objects*/) {
|
|
16688
16631
|
target = target || {};
|
|
16689
16632
|
var len = arguments.length,
|
|
16690
16633
|
i = 0;
|
|
16691
|
-
|
|
16692
16634
|
if (len === 1) {
|
|
16693
16635
|
return target;
|
|
16694
16636
|
}
|
|
16695
|
-
|
|
16696
16637
|
while (++i < len) {
|
|
16697
16638
|
var val = arguments[i];
|
|
16698
|
-
|
|
16699
16639
|
if (isPrimitive(target)) {
|
|
16700
16640
|
target = val;
|
|
16701
16641
|
}
|
|
16702
|
-
|
|
16703
16642
|
if (isObject$1(val)) {
|
|
16704
16643
|
extend(target, val);
|
|
16705
16644
|
}
|
|
16706
16645
|
}
|
|
16707
|
-
|
|
16708
16646
|
return target;
|
|
16709
16647
|
}
|
|
16648
|
+
|
|
16710
16649
|
/**
|
|
16711
16650
|
* Shallow extend
|
|
16712
16651
|
*/
|
|
16713
16652
|
|
|
16714
|
-
|
|
16715
16653
|
function extend(target, obj) {
|
|
16716
16654
|
assignSymbols(target, obj);
|
|
16717
16655
|
|
|
16718
16656
|
for (var key in obj) {
|
|
16719
16657
|
if (key !== '__proto__' && hasOwn(obj, key)) {
|
|
16720
16658
|
var val = obj[key];
|
|
16721
|
-
|
|
16722
16659
|
if (isObject$1(val)) {
|
|
16723
16660
|
if (kindOf(target[key]) === 'undefined' && kindOf(val) === 'function') {
|
|
16724
16661
|
target[key] = val;
|
|
16725
16662
|
}
|
|
16726
|
-
|
|
16727
16663
|
target[key] = vue_lazyload_esm_assign(target[key] || {}, val);
|
|
16728
16664
|
} else {
|
|
16729
16665
|
target[key] = val;
|
|
16730
16666
|
}
|
|
16731
16667
|
}
|
|
16732
16668
|
}
|
|
16733
|
-
|
|
16734
16669
|
return target;
|
|
16735
16670
|
}
|
|
16671
|
+
|
|
16736
16672
|
/**
|
|
16737
16673
|
* Returns true if the object is a plain object or a function.
|
|
16738
16674
|
*/
|
|
16739
16675
|
|
|
16740
|
-
|
|
16741
16676
|
function isObject$1(obj) {
|
|
16742
16677
|
return kindOf(obj) === 'object' || kindOf(obj) === 'function';
|
|
16743
16678
|
}
|
|
16679
|
+
|
|
16744
16680
|
/**
|
|
16745
16681
|
* Returns true if the given `key` is an own property of `obj`.
|
|
16746
16682
|
*/
|
|
16747
16683
|
|
|
16748
|
-
|
|
16749
16684
|
function hasOwn(obj, key) {
|
|
16750
16685
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
16751
16686
|
}
|
|
16687
|
+
|
|
16752
16688
|
/**
|
|
16753
16689
|
* Expose `assign`
|
|
16754
16690
|
*/
|
|
16755
16691
|
|
|
16756
|
-
|
|
16757
16692
|
var assignDeep = vue_lazyload_esm_assign;
|
|
16693
|
+
|
|
16758
16694
|
var inBrowser = typeof window !== 'undefined';
|
|
16759
16695
|
var hasIntersectionObserver = checkIntersectionObserver();
|
|
16760
16696
|
|
|
@@ -16769,34 +16705,25 @@ function checkIntersectionObserver() {
|
|
|
16769
16705
|
}
|
|
16770
16706
|
});
|
|
16771
16707
|
}
|
|
16772
|
-
|
|
16773
16708
|
return true;
|
|
16774
16709
|
}
|
|
16775
|
-
|
|
16776
16710
|
return false;
|
|
16777
16711
|
}
|
|
16778
16712
|
|
|
16779
16713
|
var modeType = {
|
|
16780
16714
|
event: 'event',
|
|
16781
|
-
observer: 'observer'
|
|
16715
|
+
observer: 'observer'
|
|
16782
16716
|
|
|
16783
|
-
|
|
16784
|
-
|
|
16785
|
-
var CustomEvent = function () {
|
|
16717
|
+
// CustomEvent polyfill
|
|
16718
|
+
};var CustomEvent = function () {
|
|
16786
16719
|
if (!inBrowser) return;
|
|
16787
16720
|
if (typeof window.CustomEvent === 'function') return window.CustomEvent;
|
|
16788
|
-
|
|
16789
16721
|
function CustomEvent(event, params) {
|
|
16790
|
-
params = params || {
|
|
16791
|
-
bubbles: false,
|
|
16792
|
-
cancelable: false,
|
|
16793
|
-
detail: undefined
|
|
16794
|
-
};
|
|
16722
|
+
params = params || { bubbles: false, cancelable: false, detail: undefined };
|
|
16795
16723
|
var evt = document.createEvent('CustomEvent');
|
|
16796
16724
|
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
16797
16725
|
return evt;
|
|
16798
16726
|
}
|
|
16799
|
-
|
|
16800
16727
|
CustomEvent.prototype = window.Event.prototype;
|
|
16801
16728
|
return CustomEvent;
|
|
16802
16729
|
}();
|
|
@@ -16809,31 +16736,32 @@ function remove(arr, item) {
|
|
|
16809
16736
|
|
|
16810
16737
|
function some(arr, fn) {
|
|
16811
16738
|
var has = false;
|
|
16812
|
-
|
|
16813
16739
|
for (var i = 0, len = arr.length; i < len; i++) {
|
|
16814
16740
|
if (fn(arr[i])) {
|
|
16815
16741
|
has = true;
|
|
16816
16742
|
break;
|
|
16817
16743
|
}
|
|
16818
16744
|
}
|
|
16819
|
-
|
|
16820
16745
|
return has;
|
|
16821
16746
|
}
|
|
16822
16747
|
|
|
16823
16748
|
function getBestSelectionFromSrcset(el, scale) {
|
|
16824
16749
|
if (el.tagName !== 'IMG' || !el.getAttribute('data-srcset')) return;
|
|
16750
|
+
|
|
16825
16751
|
var options = el.getAttribute('data-srcset');
|
|
16826
16752
|
var result = [];
|
|
16827
16753
|
var container = el.parentNode;
|
|
16828
16754
|
var containerWidth = container.offsetWidth * scale;
|
|
16755
|
+
|
|
16829
16756
|
var spaceIndex = void 0;
|
|
16830
16757
|
var tmpSrc = void 0;
|
|
16831
16758
|
var tmpWidth = void 0;
|
|
16759
|
+
|
|
16832
16760
|
options = options.trim().split(',');
|
|
16761
|
+
|
|
16833
16762
|
options.map(function (item) {
|
|
16834
16763
|
item = item.trim();
|
|
16835
16764
|
spaceIndex = item.lastIndexOf(' ');
|
|
16836
|
-
|
|
16837
16765
|
if (spaceIndex === -1) {
|
|
16838
16766
|
tmpSrc = item;
|
|
16839
16767
|
tmpWidth = 999998;
|
|
@@ -16841,28 +16769,24 @@ function getBestSelectionFromSrcset(el, scale) {
|
|
|
16841
16769
|
tmpSrc = item.substr(0, spaceIndex);
|
|
16842
16770
|
tmpWidth = parseInt(item.substr(spaceIndex + 1, item.length - spaceIndex - 2), 10);
|
|
16843
16771
|
}
|
|
16844
|
-
|
|
16845
16772
|
result.push([tmpWidth, tmpSrc]);
|
|
16846
16773
|
});
|
|
16774
|
+
|
|
16847
16775
|
result.sort(function (a, b) {
|
|
16848
16776
|
if (a[0] < b[0]) {
|
|
16849
16777
|
return 1;
|
|
16850
16778
|
}
|
|
16851
|
-
|
|
16852
16779
|
if (a[0] > b[0]) {
|
|
16853
16780
|
return -1;
|
|
16854
16781
|
}
|
|
16855
|
-
|
|
16856
16782
|
if (a[0] === b[0]) {
|
|
16857
16783
|
if (b[1].indexOf('.webp', b[1].length - 5) !== -1) {
|
|
16858
16784
|
return 1;
|
|
16859
16785
|
}
|
|
16860
|
-
|
|
16861
16786
|
if (a[1].indexOf('.webp', a[1].length - 5) !== -1) {
|
|
16862
16787
|
return -1;
|
|
16863
16788
|
}
|
|
16864
16789
|
}
|
|
16865
|
-
|
|
16866
16790
|
return 0;
|
|
16867
16791
|
});
|
|
16868
16792
|
var bestSelectedSrc = '';
|
|
@@ -16872,7 +16796,6 @@ function getBestSelectionFromSrcset(el, scale) {
|
|
|
16872
16796
|
tmpOption = result[i];
|
|
16873
16797
|
bestSelectedSrc = tmpOption[1];
|
|
16874
16798
|
var next = result[i + 1];
|
|
16875
|
-
|
|
16876
16799
|
if (next && next[0] < containerWidth) {
|
|
16877
16800
|
bestSelectedSrc = tmpOption[1];
|
|
16878
16801
|
break;
|
|
@@ -16887,14 +16810,12 @@ function getBestSelectionFromSrcset(el, scale) {
|
|
|
16887
16810
|
|
|
16888
16811
|
function find(arr, fn) {
|
|
16889
16812
|
var item = void 0;
|
|
16890
|
-
|
|
16891
16813
|
for (var i = 0, len = arr.length; i < len; i++) {
|
|
16892
16814
|
if (fn(arr[i])) {
|
|
16893
16815
|
item = arr[i];
|
|
16894
16816
|
break;
|
|
16895
16817
|
}
|
|
16896
16818
|
}
|
|
16897
|
-
|
|
16898
16819
|
return item;
|
|
16899
16820
|
}
|
|
16900
16821
|
|
|
@@ -16905,6 +16826,7 @@ var getDPR = function getDPR() {
|
|
|
16905
16826
|
|
|
16906
16827
|
function supportWebp() {
|
|
16907
16828
|
if (!inBrowser) return false;
|
|
16829
|
+
|
|
16908
16830
|
var support = true;
|
|
16909
16831
|
var d = document;
|
|
16910
16832
|
|
|
@@ -16930,17 +16852,14 @@ function throttle(action, delay) {
|
|
|
16930
16852
|
if (timeout) {
|
|
16931
16853
|
return;
|
|
16932
16854
|
}
|
|
16933
|
-
|
|
16934
16855
|
var elapsed = Date.now() - lastRun;
|
|
16935
16856
|
var context = this;
|
|
16936
16857
|
var args = arguments;
|
|
16937
|
-
|
|
16938
16858
|
var runCallback = function runCallback() {
|
|
16939
16859
|
lastRun = Date.now();
|
|
16940
16860
|
timeout = false;
|
|
16941
16861
|
action.apply(context, args);
|
|
16942
16862
|
};
|
|
16943
|
-
|
|
16944
16863
|
if (elapsed >= delay) {
|
|
16945
16864
|
runCallback();
|
|
16946
16865
|
} else {
|
|
@@ -16952,7 +16871,6 @@ function throttle(action, delay) {
|
|
|
16952
16871
|
function testSupportsPassive() {
|
|
16953
16872
|
if (!inBrowser) return;
|
|
16954
16873
|
var support = false;
|
|
16955
|
-
|
|
16956
16874
|
try {
|
|
16957
16875
|
var opts = Object.defineProperty({}, 'passive', {
|
|
16958
16876
|
get: function get$$1() {
|
|
@@ -16961,11 +16879,11 @@ function testSupportsPassive() {
|
|
|
16961
16879
|
});
|
|
16962
16880
|
window.addEventListener('test', null, opts);
|
|
16963
16881
|
} catch (e) {}
|
|
16964
|
-
|
|
16965
16882
|
return support;
|
|
16966
16883
|
}
|
|
16967
16884
|
|
|
16968
16885
|
var vue_lazyload_esm_supportsPassive = testSupportsPassive();
|
|
16886
|
+
|
|
16969
16887
|
var _ = {
|
|
16970
16888
|
on: function on(el, type, func) {
|
|
16971
16889
|
var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
@@ -16981,13 +16899,13 @@ var _ = {
|
|
|
16981
16899
|
},
|
|
16982
16900
|
off: function off(el, type, func) {
|
|
16983
16901
|
var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
16902
|
+
|
|
16984
16903
|
el.removeEventListener(type, func, capture);
|
|
16985
16904
|
}
|
|
16986
16905
|
};
|
|
16987
16906
|
|
|
16988
16907
|
var loadImageAsync = function loadImageAsync(item, resolve, reject) {
|
|
16989
16908
|
var image = new Image();
|
|
16990
|
-
|
|
16991
16909
|
if (!item || !item.src) {
|
|
16992
16910
|
var err = new Error('image src is required');
|
|
16993
16911
|
return reject(err);
|
|
@@ -17018,7 +16936,6 @@ var overflow = function overflow(el) {
|
|
|
17018
16936
|
|
|
17019
16937
|
var scrollParent = function scrollParent(el) {
|
|
17020
16938
|
if (!inBrowser) return;
|
|
17021
|
-
|
|
17022
16939
|
if (!(el instanceof HTMLElement)) {
|
|
17023
16940
|
return window;
|
|
17024
16941
|
}
|
|
@@ -17050,18 +16967,15 @@ function isObject(obj) {
|
|
|
17050
16967
|
|
|
17051
16968
|
function ObjectKeys(obj) {
|
|
17052
16969
|
if (!(obj instanceof Object)) return [];
|
|
17053
|
-
|
|
17054
16970
|
if (Object.keys) {
|
|
17055
16971
|
return Object.keys(obj);
|
|
17056
16972
|
} else {
|
|
17057
16973
|
var keys = [];
|
|
17058
|
-
|
|
17059
16974
|
for (var key in obj) {
|
|
17060
16975
|
if (obj.hasOwnProperty(key)) {
|
|
17061
16976
|
keys.push(key);
|
|
17062
16977
|
}
|
|
17063
16978
|
}
|
|
17064
|
-
|
|
17065
16979
|
return keys;
|
|
17066
16980
|
}
|
|
17067
16981
|
}
|
|
@@ -17069,11 +16983,9 @@ function ObjectKeys(obj) {
|
|
|
17069
16983
|
function ArrayFrom(arrLike) {
|
|
17070
16984
|
var len = arrLike.length;
|
|
17071
16985
|
var list = [];
|
|
17072
|
-
|
|
17073
16986
|
for (var i = 0; i < len; i++) {
|
|
17074
16987
|
list.push(arrLike[i]);
|
|
17075
16988
|
}
|
|
17076
|
-
|
|
17077
16989
|
return list;
|
|
17078
16990
|
}
|
|
17079
16991
|
|
|
@@ -17083,6 +16995,7 @@ var ImageCache = function () {
|
|
|
17083
16995
|
function ImageCache(_ref) {
|
|
17084
16996
|
var max = _ref.max;
|
|
17085
16997
|
classCallCheck(this, ImageCache);
|
|
16998
|
+
|
|
17086
16999
|
this.options = {
|
|
17087
17000
|
max: max || 100
|
|
17088
17001
|
};
|
|
@@ -17098,9 +17011,7 @@ var ImageCache = function () {
|
|
|
17098
17011
|
key: 'add',
|
|
17099
17012
|
value: function add(key) {
|
|
17100
17013
|
if (this.has(key)) return;
|
|
17101
|
-
|
|
17102
17014
|
this._caches.push(key);
|
|
17103
|
-
|
|
17104
17015
|
if (this._caches.length > this.options.max) {
|
|
17105
17016
|
this.free();
|
|
17106
17017
|
}
|
|
@@ -17112,14 +17023,15 @@ var ImageCache = function () {
|
|
|
17112
17023
|
}
|
|
17113
17024
|
}]);
|
|
17114
17025
|
return ImageCache;
|
|
17115
|
-
}();
|
|
17026
|
+
}();
|
|
17027
|
+
|
|
17028
|
+
// el: {
|
|
17116
17029
|
// state,
|
|
17117
17030
|
// src,
|
|
17118
17031
|
// error,
|
|
17119
17032
|
// loading
|
|
17120
17033
|
// }
|
|
17121
17034
|
|
|
17122
|
-
|
|
17123
17035
|
var ReactiveListener = function () {
|
|
17124
17036
|
function ReactiveListener(_ref) {
|
|
17125
17037
|
var el = _ref.el,
|
|
@@ -17132,16 +17044,21 @@ var ReactiveListener = function () {
|
|
|
17132
17044
|
elRenderer = _ref.elRenderer,
|
|
17133
17045
|
imageCache = _ref.imageCache;
|
|
17134
17046
|
classCallCheck(this, ReactiveListener);
|
|
17047
|
+
|
|
17135
17048
|
this.el = el;
|
|
17136
17049
|
this.src = src;
|
|
17137
17050
|
this.error = error;
|
|
17138
17051
|
this.loading = loading;
|
|
17139
17052
|
this.bindType = bindType;
|
|
17140
17053
|
this.attempt = 0;
|
|
17054
|
+
|
|
17141
17055
|
this.naturalHeight = 0;
|
|
17142
17056
|
this.naturalWidth = 0;
|
|
17057
|
+
|
|
17143
17058
|
this.options = options;
|
|
17059
|
+
|
|
17144
17060
|
this.rect = null;
|
|
17061
|
+
|
|
17145
17062
|
this.$parent = $parent;
|
|
17146
17063
|
this.elRenderer = elRenderer;
|
|
17147
17064
|
this._imageCache = imageCache;
|
|
@@ -17150,10 +17067,12 @@ var ReactiveListener = function () {
|
|
|
17150
17067
|
loadStart: 0,
|
|
17151
17068
|
loadEnd: 0
|
|
17152
17069
|
};
|
|
17070
|
+
|
|
17153
17071
|
this.filter();
|
|
17154
17072
|
this.initState();
|
|
17155
17073
|
this.render('loading', false);
|
|
17156
17074
|
}
|
|
17075
|
+
|
|
17157
17076
|
/*
|
|
17158
17077
|
* init listener state
|
|
17159
17078
|
* @return
|
|
@@ -17176,6 +17095,7 @@ var ReactiveListener = function () {
|
|
|
17176
17095
|
rendered: false
|
|
17177
17096
|
};
|
|
17178
17097
|
}
|
|
17098
|
+
|
|
17179
17099
|
/*
|
|
17180
17100
|
* record performance
|
|
17181
17101
|
* @return
|
|
@@ -17186,6 +17106,7 @@ var ReactiveListener = function () {
|
|
|
17186
17106
|
value: function record(event) {
|
|
17187
17107
|
this.performanceData[event] = Date.now();
|
|
17188
17108
|
}
|
|
17109
|
+
|
|
17189
17110
|
/*
|
|
17190
17111
|
* update image listener data
|
|
17191
17112
|
* @param {String} image uri
|
|
@@ -17200,17 +17121,18 @@ var ReactiveListener = function () {
|
|
|
17200
17121
|
var src = _ref2.src,
|
|
17201
17122
|
loading = _ref2.loading,
|
|
17202
17123
|
error = _ref2.error;
|
|
17124
|
+
|
|
17203
17125
|
var oldSrc = this.src;
|
|
17204
17126
|
this.src = src;
|
|
17205
17127
|
this.loading = loading;
|
|
17206
17128
|
this.error = error;
|
|
17207
17129
|
this.filter();
|
|
17208
|
-
|
|
17209
17130
|
if (oldSrc !== this.src) {
|
|
17210
17131
|
this.attempt = 0;
|
|
17211
17132
|
this.initState();
|
|
17212
17133
|
}
|
|
17213
17134
|
}
|
|
17135
|
+
|
|
17214
17136
|
/*
|
|
17215
17137
|
* get el node rect
|
|
17216
17138
|
* @return
|
|
@@ -17221,6 +17143,7 @@ var ReactiveListener = function () {
|
|
|
17221
17143
|
value: function getRect() {
|
|
17222
17144
|
this.rect = this.el.getBoundingClientRect();
|
|
17223
17145
|
}
|
|
17146
|
+
|
|
17224
17147
|
/*
|
|
17225
17148
|
* check el is in view
|
|
17226
17149
|
* @return {Boolean} el is in view
|
|
@@ -17232,6 +17155,7 @@ var ReactiveListener = function () {
|
|
|
17232
17155
|
this.getRect();
|
|
17233
17156
|
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;
|
|
17234
17157
|
}
|
|
17158
|
+
|
|
17235
17159
|
/*
|
|
17236
17160
|
* listener filter
|
|
17237
17161
|
*/
|
|
@@ -17245,6 +17169,7 @@ var ReactiveListener = function () {
|
|
|
17245
17169
|
_this.options.filter[key](_this, _this.options);
|
|
17246
17170
|
});
|
|
17247
17171
|
}
|
|
17172
|
+
|
|
17248
17173
|
/*
|
|
17249
17174
|
* render loading first
|
|
17250
17175
|
* @params cb:Function
|
|
@@ -17261,7 +17186,6 @@ var ReactiveListener = function () {
|
|
|
17261
17186
|
src: this.loading
|
|
17262
17187
|
}, function (data) {
|
|
17263
17188
|
_this2.render('loading', false);
|
|
17264
|
-
|
|
17265
17189
|
_this2.state.loading = false;
|
|
17266
17190
|
cb();
|
|
17267
17191
|
}, function () {
|
|
@@ -17271,6 +17195,7 @@ var ReactiveListener = function () {
|
|
|
17271
17195
|
if (!_this2.options.silent) console.warn('VueLazyload log: load failed with loading image(' + _this2.loading + ')');
|
|
17272
17196
|
});
|
|
17273
17197
|
}
|
|
17198
|
+
|
|
17274
17199
|
/*
|
|
17275
17200
|
* try load image and render it
|
|
17276
17201
|
* @return
|
|
@@ -17288,9 +17213,7 @@ var ReactiveListener = function () {
|
|
|
17288
17213
|
onFinish();
|
|
17289
17214
|
return;
|
|
17290
17215
|
}
|
|
17291
|
-
|
|
17292
17216
|
if (this.state.rendered && this.state.loaded) return;
|
|
17293
|
-
|
|
17294
17217
|
if (this._imageCache.has(this.src)) {
|
|
17295
17218
|
this.state.loaded = true;
|
|
17296
17219
|
this.render('loaded', true);
|
|
@@ -17300,8 +17223,8 @@ var ReactiveListener = function () {
|
|
|
17300
17223
|
|
|
17301
17224
|
this.renderLoading(function () {
|
|
17302
17225
|
_this3.attempt++;
|
|
17303
|
-
_this3.options.adapter['beforeLoad'] && _this3.options.adapter['beforeLoad'](_this3, _this3.options);
|
|
17304
17226
|
|
|
17227
|
+
_this3.options.adapter['beforeLoad'] && _this3.options.adapter['beforeLoad'](_this3, _this3.options);
|
|
17305
17228
|
_this3.record('loadStart');
|
|
17306
17229
|
|
|
17307
17230
|
loadImageAsync({
|
|
@@ -17311,25 +17234,20 @@ var ReactiveListener = function () {
|
|
|
17311
17234
|
_this3.naturalWidth = data.naturalWidth;
|
|
17312
17235
|
_this3.state.loaded = true;
|
|
17313
17236
|
_this3.state.error = false;
|
|
17314
|
-
|
|
17315
17237
|
_this3.record('loadEnd');
|
|
17316
|
-
|
|
17317
17238
|
_this3.render('loaded', false);
|
|
17318
|
-
|
|
17319
17239
|
_this3.state.rendered = true;
|
|
17320
|
-
|
|
17321
17240
|
_this3._imageCache.add(_this3.src);
|
|
17322
|
-
|
|
17323
17241
|
onFinish();
|
|
17324
17242
|
}, function (err) {
|
|
17325
17243
|
!_this3.options.silent && console.error(err);
|
|
17326
17244
|
_this3.state.error = true;
|
|
17327
17245
|
_this3.state.loaded = false;
|
|
17328
|
-
|
|
17329
17246
|
_this3.render('error', false);
|
|
17330
17247
|
});
|
|
17331
17248
|
});
|
|
17332
17249
|
}
|
|
17250
|
+
|
|
17333
17251
|
/*
|
|
17334
17252
|
* render image
|
|
17335
17253
|
* @param {String} state to render // ['loading', 'src', 'error']
|
|
@@ -17342,6 +17260,7 @@ var ReactiveListener = function () {
|
|
|
17342
17260
|
value: function render(state, cache) {
|
|
17343
17261
|
this.elRenderer(this, state, cache);
|
|
17344
17262
|
}
|
|
17263
|
+
|
|
17345
17264
|
/*
|
|
17346
17265
|
* output performance data
|
|
17347
17266
|
* @return {Object} performance data
|
|
@@ -17359,12 +17278,14 @@ var ReactiveListener = function () {
|
|
|
17359
17278
|
}
|
|
17360
17279
|
|
|
17361
17280
|
if (this.state.error) state = 'error';
|
|
17281
|
+
|
|
17362
17282
|
return {
|
|
17363
17283
|
src: this.src,
|
|
17364
17284
|
state: state,
|
|
17365
17285
|
time: time
|
|
17366
17286
|
};
|
|
17367
17287
|
}
|
|
17288
|
+
|
|
17368
17289
|
/*
|
|
17369
17290
|
* $destroy
|
|
17370
17291
|
* @return
|
|
@@ -17391,7 +17312,7 @@ var DEFAULT_OBSERVER_OPTIONS = {
|
|
|
17391
17312
|
threshold: 0
|
|
17392
17313
|
};
|
|
17393
17314
|
|
|
17394
|
-
var Lazy = function
|
|
17315
|
+
var Lazy = function (Vue) {
|
|
17395
17316
|
return function () {
|
|
17396
17317
|
function Lazy(_ref) {
|
|
17397
17318
|
var preLoad = _ref.preLoad,
|
|
@@ -17411,6 +17332,7 @@ var Lazy = function Lazy(Vue) {
|
|
|
17411
17332
|
observer = _ref.observer,
|
|
17412
17333
|
observerOptions = _ref.observerOptions;
|
|
17413
17334
|
classCallCheck(this, Lazy);
|
|
17335
|
+
|
|
17414
17336
|
this.version = '1.3.3';
|
|
17415
17337
|
this.mode = modeType.event;
|
|
17416
17338
|
this.ListenerQueue = [];
|
|
@@ -17434,15 +17356,13 @@ var Lazy = function Lazy(Vue) {
|
|
|
17434
17356
|
observer: !!observer,
|
|
17435
17357
|
observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
|
|
17436
17358
|
};
|
|
17437
|
-
|
|
17438
17359
|
this._initEvent();
|
|
17439
|
-
|
|
17440
|
-
this._imageCache = new ImageCache({
|
|
17441
|
-
max: 200
|
|
17442
|
-
});
|
|
17360
|
+
this._imageCache = new ImageCache({ max: 200 });
|
|
17443
17361
|
this.lazyLoadHandler = throttle(this._lazyLoadHandler.bind(this), this.options.throttleWait);
|
|
17362
|
+
|
|
17444
17363
|
this.setMode(this.options.observer ? modeType.observer : modeType.event);
|
|
17445
17364
|
}
|
|
17365
|
+
|
|
17446
17366
|
/**
|
|
17447
17367
|
* update config
|
|
17448
17368
|
* @param {Object} config params
|
|
@@ -17454,8 +17374,10 @@ var Lazy = function Lazy(Vue) {
|
|
|
17454
17374
|
key: 'config',
|
|
17455
17375
|
value: function config() {
|
|
17456
17376
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17377
|
+
|
|
17457
17378
|
assignDeep(this.options, options);
|
|
17458
17379
|
}
|
|
17380
|
+
|
|
17459
17381
|
/**
|
|
17460
17382
|
* output listener's load performance
|
|
17461
17383
|
* @return {Array}
|
|
@@ -17465,11 +17387,14 @@ var Lazy = function Lazy(Vue) {
|
|
|
17465
17387
|
key: 'performance',
|
|
17466
17388
|
value: function performance() {
|
|
17467
17389
|
var list = [];
|
|
17390
|
+
|
|
17468
17391
|
this.ListenerQueue.map(function (item) {
|
|
17469
17392
|
list.push(item.performance());
|
|
17470
17393
|
});
|
|
17394
|
+
|
|
17471
17395
|
return list;
|
|
17472
17396
|
}
|
|
17397
|
+
|
|
17473
17398
|
/*
|
|
17474
17399
|
* add lazy component to queue
|
|
17475
17400
|
* @param {Vue} vm lazy component instance
|
|
@@ -17480,17 +17405,15 @@ var Lazy = function Lazy(Vue) {
|
|
|
17480
17405
|
key: 'addLazyBox',
|
|
17481
17406
|
value: function addLazyBox(vm) {
|
|
17482
17407
|
this.ListenerQueue.push(vm);
|
|
17483
|
-
|
|
17484
17408
|
if (inBrowser) {
|
|
17485
17409
|
this._addListenerTarget(window);
|
|
17486
|
-
|
|
17487
17410
|
this._observer && this._observer.observe(vm.el);
|
|
17488
|
-
|
|
17489
17411
|
if (vm.$el && vm.$el.parentNode) {
|
|
17490
17412
|
this._addListenerTarget(vm.$el.parentNode);
|
|
17491
17413
|
}
|
|
17492
17414
|
}
|
|
17493
17415
|
}
|
|
17416
|
+
|
|
17494
17417
|
/*
|
|
17495
17418
|
* add image listener to queue
|
|
17496
17419
|
* @param {DOM} el
|
|
@@ -17519,12 +17442,13 @@ var Lazy = function Lazy(Vue) {
|
|
|
17519
17442
|
Vue.nextTick(function () {
|
|
17520
17443
|
src = getBestSelectionFromSrcset(el, _this.options.scale) || src;
|
|
17521
17444
|
_this._observer && _this._observer.observe(el);
|
|
17445
|
+
|
|
17522
17446
|
var container = Object.keys(binding.modifiers)[0];
|
|
17523
17447
|
var $parent = void 0;
|
|
17524
17448
|
|
|
17525
17449
|
if (container) {
|
|
17526
|
-
$parent = vnode.context.$refs[container];
|
|
17527
|
-
|
|
17450
|
+
$parent = vnode.context.$refs[container];
|
|
17451
|
+
// if there is container passed in, try ref first, then fallback to getElementById to support the original usage
|
|
17528
17452
|
$parent = $parent ? $parent.$el || $parent : document.getElementById(container);
|
|
17529
17453
|
}
|
|
17530
17454
|
|
|
@@ -17548,17 +17472,16 @@ var Lazy = function Lazy(Vue) {
|
|
|
17548
17472
|
|
|
17549
17473
|
if (inBrowser) {
|
|
17550
17474
|
_this._addListenerTarget(window);
|
|
17551
|
-
|
|
17552
17475
|
_this._addListenerTarget($parent);
|
|
17553
17476
|
}
|
|
17554
17477
|
|
|
17555
17478
|
_this.lazyLoadHandler();
|
|
17556
|
-
|
|
17557
17479
|
Vue.nextTick(function () {
|
|
17558
17480
|
return _this.lazyLoadHandler();
|
|
17559
17481
|
});
|
|
17560
17482
|
});
|
|
17561
17483
|
}
|
|
17484
|
+
|
|
17562
17485
|
/**
|
|
17563
17486
|
* update image src
|
|
17564
17487
|
* @param {DOM} el
|
|
@@ -17577,10 +17500,10 @@ var Lazy = function Lazy(Vue) {
|
|
|
17577
17500
|
error = _valueFormatter3.error;
|
|
17578
17501
|
|
|
17579
17502
|
src = getBestSelectionFromSrcset(el, this.options.scale) || src;
|
|
17503
|
+
|
|
17580
17504
|
var exist = find(this.ListenerQueue, function (item) {
|
|
17581
17505
|
return item.el === el;
|
|
17582
17506
|
});
|
|
17583
|
-
|
|
17584
17507
|
if (!exist) {
|
|
17585
17508
|
this.add(el, binding, vnode);
|
|
17586
17509
|
} else {
|
|
@@ -17590,18 +17513,16 @@ var Lazy = function Lazy(Vue) {
|
|
|
17590
17513
|
error: error
|
|
17591
17514
|
});
|
|
17592
17515
|
}
|
|
17593
|
-
|
|
17594
17516
|
if (this._observer) {
|
|
17595
17517
|
this._observer.unobserve(el);
|
|
17596
|
-
|
|
17597
17518
|
this._observer.observe(el);
|
|
17598
17519
|
}
|
|
17599
|
-
|
|
17600
17520
|
this.lazyLoadHandler();
|
|
17601
17521
|
Vue.nextTick(function () {
|
|
17602
17522
|
return _this2.lazyLoadHandler();
|
|
17603
17523
|
});
|
|
17604
17524
|
}
|
|
17525
|
+
|
|
17605
17526
|
/**
|
|
17606
17527
|
* remove listener form list
|
|
17607
17528
|
* @param {DOM} el
|
|
@@ -17616,16 +17537,14 @@ var Lazy = function Lazy(Vue) {
|
|
|
17616
17537
|
var existItem = find(this.ListenerQueue, function (item) {
|
|
17617
17538
|
return item.el === el;
|
|
17618
17539
|
});
|
|
17619
|
-
|
|
17620
17540
|
if (existItem) {
|
|
17621
17541
|
this._removeListenerTarget(existItem.$parent);
|
|
17622
|
-
|
|
17623
17542
|
this._removeListenerTarget(window);
|
|
17624
|
-
|
|
17625
17543
|
remove(this.ListenerQueue, existItem);
|
|
17626
17544
|
existItem.$destroy();
|
|
17627
17545
|
}
|
|
17628
17546
|
}
|
|
17547
|
+
|
|
17629
17548
|
/*
|
|
17630
17549
|
* remove lazy components form list
|
|
17631
17550
|
* @param {Vue} vm Vue instance
|
|
@@ -17638,11 +17557,9 @@ var Lazy = function Lazy(Vue) {
|
|
|
17638
17557
|
if (!vm) return;
|
|
17639
17558
|
remove(this.ListenerQueue, vm);
|
|
17640
17559
|
this._observer && this._observer.unobserve(vm.el);
|
|
17641
|
-
|
|
17642
17560
|
if (vm.$parent && vm.$el.parentNode) {
|
|
17643
17561
|
this._removeListenerTarget(vm.$el.parentNode);
|
|
17644
17562
|
}
|
|
17645
|
-
|
|
17646
17563
|
this._removeListenerTarget(window);
|
|
17647
17564
|
}
|
|
17648
17565
|
}, {
|
|
@@ -17671,10 +17588,10 @@ var Lazy = function Lazy(Vue) {
|
|
|
17671
17588
|
this.TargetQueue.forEach(function (target) {
|
|
17672
17589
|
_this3._initListen(target.el, false);
|
|
17673
17590
|
});
|
|
17674
|
-
|
|
17675
17591
|
this._initIntersectionObserver();
|
|
17676
17592
|
}
|
|
17677
17593
|
}
|
|
17594
|
+
|
|
17678
17595
|
/*
|
|
17679
17596
|
*** Private functions ***
|
|
17680
17597
|
*/
|
|
@@ -17692,7 +17609,6 @@ var Lazy = function Lazy(Vue) {
|
|
|
17692
17609
|
var target = find(this.TargetQueue, function (target) {
|
|
17693
17610
|
return target.el === el;
|
|
17694
17611
|
});
|
|
17695
|
-
|
|
17696
17612
|
if (!target) {
|
|
17697
17613
|
target = {
|
|
17698
17614
|
el: el,
|
|
@@ -17705,9 +17621,9 @@ var Lazy = function Lazy(Vue) {
|
|
|
17705
17621
|
} else {
|
|
17706
17622
|
target.childrenCount++;
|
|
17707
17623
|
}
|
|
17708
|
-
|
|
17709
17624
|
return this.TargetIndex;
|
|
17710
17625
|
}
|
|
17626
|
+
|
|
17711
17627
|
/*
|
|
17712
17628
|
* remove listener target or reduce target childrenCount
|
|
17713
17629
|
* @param {DOM} el or window
|
|
@@ -17722,17 +17638,15 @@ var Lazy = function Lazy(Vue) {
|
|
|
17722
17638
|
this.TargetQueue.forEach(function (target, index) {
|
|
17723
17639
|
if (target.el === el) {
|
|
17724
17640
|
target.childrenCount--;
|
|
17725
|
-
|
|
17726
17641
|
if (!target.childrenCount) {
|
|
17727
17642
|
_this4._initListen(target.el, false);
|
|
17728
|
-
|
|
17729
17643
|
_this4.TargetQueue.splice(index, 1);
|
|
17730
|
-
|
|
17731
17644
|
target = null;
|
|
17732
17645
|
}
|
|
17733
17646
|
}
|
|
17734
17647
|
});
|
|
17735
17648
|
}
|
|
17649
|
+
|
|
17736
17650
|
/*
|
|
17737
17651
|
* add or remove eventlistener
|
|
17738
17652
|
* @param {DOM} el DOM or Window
|
|
@@ -17764,18 +17678,15 @@ var Lazy = function Lazy(Vue) {
|
|
|
17764
17678
|
|
|
17765
17679
|
this.$on = function (event, func) {
|
|
17766
17680
|
if (!_this6.Event.listeners[event]) _this6.Event.listeners[event] = [];
|
|
17767
|
-
|
|
17768
17681
|
_this6.Event.listeners[event].push(func);
|
|
17769
17682
|
};
|
|
17770
17683
|
|
|
17771
17684
|
this.$once = function (event, func) {
|
|
17772
17685
|
var vm = _this6;
|
|
17773
|
-
|
|
17774
17686
|
function on() {
|
|
17775
17687
|
vm.$off(event, on);
|
|
17776
17688
|
func.apply(vm, arguments);
|
|
17777
17689
|
}
|
|
17778
|
-
|
|
17779
17690
|
_this6.$on(event, on);
|
|
17780
17691
|
};
|
|
17781
17692
|
|
|
@@ -17785,18 +17696,17 @@ var Lazy = function Lazy(Vue) {
|
|
|
17785
17696
|
_this6.Event.listeners[event].length = 0;
|
|
17786
17697
|
return;
|
|
17787
17698
|
}
|
|
17788
|
-
|
|
17789
17699
|
remove(_this6.Event.listeners[event], func);
|
|
17790
17700
|
};
|
|
17791
17701
|
|
|
17792
17702
|
this.$emit = function (event, context, inCache) {
|
|
17793
17703
|
if (!_this6.Event.listeners[event]) return;
|
|
17794
|
-
|
|
17795
17704
|
_this6.Event.listeners[event].forEach(function (func) {
|
|
17796
17705
|
return func(context, inCache);
|
|
17797
17706
|
});
|
|
17798
17707
|
};
|
|
17799
17708
|
}
|
|
17709
|
+
|
|
17800
17710
|
/**
|
|
17801
17711
|
* find nodes which in viewport and trigger load
|
|
17802
17712
|
* @return
|
|
@@ -17812,7 +17722,6 @@ var Lazy = function Lazy(Vue) {
|
|
|
17812
17722
|
if (!listener.el || !listener.el.parentNode) {
|
|
17813
17723
|
freeList.push(listener);
|
|
17814
17724
|
}
|
|
17815
|
-
|
|
17816
17725
|
var catIn = listener.checkInView();
|
|
17817
17726
|
if (!catIn) return;
|
|
17818
17727
|
listener.load();
|
|
@@ -17835,13 +17744,13 @@ var Lazy = function Lazy(Vue) {
|
|
|
17835
17744
|
|
|
17836
17745
|
if (!hasIntersectionObserver) return;
|
|
17837
17746
|
this._observer = new IntersectionObserver(this._observerHandler.bind(this), this.options.observerOptions);
|
|
17838
|
-
|
|
17839
17747
|
if (this.ListenerQueue.length) {
|
|
17840
17748
|
this.ListenerQueue.forEach(function (listener) {
|
|
17841
17749
|
_this8._observer.observe(listener.el);
|
|
17842
17750
|
});
|
|
17843
17751
|
}
|
|
17844
17752
|
}
|
|
17753
|
+
|
|
17845
17754
|
/**
|
|
17846
17755
|
* init IntersectionObserver
|
|
17847
17756
|
* @return
|
|
@@ -17863,6 +17772,7 @@ var Lazy = function Lazy(Vue) {
|
|
|
17863
17772
|
}
|
|
17864
17773
|
});
|
|
17865
17774
|
}
|
|
17775
|
+
|
|
17866
17776
|
/**
|
|
17867
17777
|
* set element attribute with image'url and state
|
|
17868
17778
|
* @param {object} lazyload listener object
|
|
@@ -17877,17 +17787,16 @@ var Lazy = function Lazy(Vue) {
|
|
|
17877
17787
|
if (!listener.el) return;
|
|
17878
17788
|
var el = listener.el,
|
|
17879
17789
|
bindType = listener.bindType;
|
|
17880
|
-
var src = void 0;
|
|
17881
17790
|
|
|
17791
|
+
|
|
17792
|
+
var src = void 0;
|
|
17882
17793
|
switch (state) {
|
|
17883
17794
|
case 'loading':
|
|
17884
17795
|
src = listener.loading;
|
|
17885
17796
|
break;
|
|
17886
|
-
|
|
17887
17797
|
case 'error':
|
|
17888
17798
|
src = listener.error;
|
|
17889
17799
|
break;
|
|
17890
|
-
|
|
17891
17800
|
default:
|
|
17892
17801
|
src = listener.src;
|
|
17893
17802
|
break;
|
|
@@ -17900,6 +17809,7 @@ var Lazy = function Lazy(Vue) {
|
|
|
17900
17809
|
}
|
|
17901
17810
|
|
|
17902
17811
|
el.setAttribute('lazy', state);
|
|
17812
|
+
|
|
17903
17813
|
this.$emit(state, listener, cache);
|
|
17904
17814
|
this.options.adapter[state] && this.options.adapter[state](listener, this.options);
|
|
17905
17815
|
|
|
@@ -17910,6 +17820,7 @@ var Lazy = function Lazy(Vue) {
|
|
|
17910
17820
|
el.dispatchEvent(event);
|
|
17911
17821
|
}
|
|
17912
17822
|
}
|
|
17823
|
+
|
|
17913
17824
|
/**
|
|
17914
17825
|
* generate loading loaded error image url
|
|
17915
17826
|
* @param {string} image's src
|
|
@@ -17921,15 +17832,15 @@ var Lazy = function Lazy(Vue) {
|
|
|
17921
17832
|
value: function _valueFormatter(value) {
|
|
17922
17833
|
var src = value;
|
|
17923
17834
|
var loading = this.options.loading;
|
|
17924
|
-
var error = this.options.error;
|
|
17835
|
+
var error = this.options.error;
|
|
17925
17836
|
|
|
17837
|
+
// value is object
|
|
17926
17838
|
if (isObject(value)) {
|
|
17927
17839
|
if (!value.src && !this.options.silent) console.error('Vue Lazyload warning: miss src with ' + value);
|
|
17928
17840
|
src = value.src;
|
|
17929
17841
|
loading = value.loading || this.options.loading;
|
|
17930
17842
|
error = value.error || this.options.error;
|
|
17931
17843
|
}
|
|
17932
|
-
|
|
17933
17844
|
return {
|
|
17934
17845
|
src: src,
|
|
17935
17846
|
loading: loading,
|
|
@@ -17941,7 +17852,7 @@ var Lazy = function Lazy(Vue) {
|
|
|
17941
17852
|
}();
|
|
17942
17853
|
};
|
|
17943
17854
|
|
|
17944
|
-
var LazyComponent = function
|
|
17855
|
+
var LazyComponent = (function (lazy) {
|
|
17945
17856
|
return {
|
|
17946
17857
|
props: {
|
|
17947
17858
|
tag: {
|
|
@@ -17953,7 +17864,6 @@ var LazyComponent = function LazyComponent(lazy) {
|
|
|
17953
17864
|
if (this.show === false) {
|
|
17954
17865
|
return h(this.tag);
|
|
17955
17866
|
}
|
|
17956
|
-
|
|
17957
17867
|
return h(this.tag, null, this.$slots.default);
|
|
17958
17868
|
},
|
|
17959
17869
|
data: function data() {
|
|
@@ -17974,6 +17884,7 @@ var LazyComponent = function LazyComponent(lazy) {
|
|
|
17974
17884
|
beforeDestroy: function beforeDestroy() {
|
|
17975
17885
|
lazy.removeComponent(this);
|
|
17976
17886
|
},
|
|
17887
|
+
|
|
17977
17888
|
methods: {
|
|
17978
17889
|
getRect: function getRect() {
|
|
17979
17890
|
this.rect = this.$el.getBoundingClientRect();
|
|
@@ -17992,12 +17903,13 @@ var LazyComponent = function LazyComponent(lazy) {
|
|
|
17992
17903
|
}
|
|
17993
17904
|
}
|
|
17994
17905
|
};
|
|
17995
|
-
};
|
|
17906
|
+
});
|
|
17996
17907
|
|
|
17997
17908
|
var LazyContainerMananger = function () {
|
|
17998
17909
|
function LazyContainerMananger(_ref) {
|
|
17999
17910
|
var lazy = _ref.lazy;
|
|
18000
17911
|
classCallCheck(this, LazyContainerMananger);
|
|
17912
|
+
|
|
18001
17913
|
this.lazy = lazy;
|
|
18002
17914
|
lazy.lazyContainerMananger = this;
|
|
18003
17915
|
this._queue = [];
|
|
@@ -18006,13 +17918,7 @@ var LazyContainerMananger = function () {
|
|
|
18006
17918
|
createClass(LazyContainerMananger, [{
|
|
18007
17919
|
key: 'bind',
|
|
18008
17920
|
value: function bind(el, binding, vnode) {
|
|
18009
|
-
var container = new LazyContainer$1({
|
|
18010
|
-
el: el,
|
|
18011
|
-
binding: binding,
|
|
18012
|
-
vnode: vnode,
|
|
18013
|
-
lazy: this.lazy
|
|
18014
|
-
});
|
|
18015
|
-
|
|
17921
|
+
var container = new LazyContainer$1({ el: el, binding: binding, vnode: vnode, lazy: this.lazy });
|
|
18016
17922
|
this._queue.push(container);
|
|
18017
17923
|
}
|
|
18018
17924
|
}, {
|
|
@@ -18022,11 +17928,7 @@ var LazyContainerMananger = function () {
|
|
|
18022
17928
|
return item.el === el;
|
|
18023
17929
|
});
|
|
18024
17930
|
if (!container) return;
|
|
18025
|
-
container.update({
|
|
18026
|
-
el: el,
|
|
18027
|
-
binding: binding,
|
|
18028
|
-
vnode: vnode
|
|
18029
|
-
});
|
|
17931
|
+
container.update({ el: el, binding: binding, vnode: vnode });
|
|
18030
17932
|
}
|
|
18031
17933
|
}, {
|
|
18032
17934
|
key: 'unbind',
|
|
@@ -18053,16 +17955,15 @@ var LazyContainer$1 = function () {
|
|
|
18053
17955
|
vnode = _ref2.vnode,
|
|
18054
17956
|
lazy = _ref2.lazy;
|
|
18055
17957
|
classCallCheck(this, LazyContainer);
|
|
17958
|
+
|
|
18056
17959
|
this.el = null;
|
|
18057
17960
|
this.vnode = vnode;
|
|
18058
17961
|
this.binding = binding;
|
|
18059
17962
|
this.options = {};
|
|
18060
17963
|
this.lazy = lazy;
|
|
17964
|
+
|
|
18061
17965
|
this._queue = [];
|
|
18062
|
-
this.update({
|
|
18063
|
-
el: el,
|
|
18064
|
-
binding: binding
|
|
18065
|
-
});
|
|
17966
|
+
this.update({ el: el, binding: binding });
|
|
18066
17967
|
}
|
|
18067
17968
|
|
|
18068
17969
|
createClass(LazyContainer, [{
|
|
@@ -18072,8 +17973,10 @@ var LazyContainer$1 = function () {
|
|
|
18072
17973
|
|
|
18073
17974
|
var el = _ref3.el,
|
|
18074
17975
|
binding = _ref3.binding;
|
|
17976
|
+
|
|
18075
17977
|
this.el = el;
|
|
18076
17978
|
this.options = assignDeep({}, vue_lazyload_esm_defaultOptions, binding.value);
|
|
17979
|
+
|
|
18077
17980
|
var imgs = this.getImgs();
|
|
18078
17981
|
imgs.forEach(function (el) {
|
|
18079
17982
|
_this.lazy.add(el, assignDeep({}, _this.binding, {
|
|
@@ -18099,6 +18002,7 @@ var LazyContainer$1 = function () {
|
|
|
18099
18002
|
imgs.forEach(function (el) {
|
|
18100
18003
|
return _this2.lazy.remove(el);
|
|
18101
18004
|
});
|
|
18005
|
+
|
|
18102
18006
|
this.vnode = null;
|
|
18103
18007
|
this.binding = null;
|
|
18104
18008
|
this.lazy = null;
|
|
@@ -18107,7 +18011,7 @@ var LazyContainer$1 = function () {
|
|
|
18107
18011
|
return LazyContainer;
|
|
18108
18012
|
}();
|
|
18109
18013
|
|
|
18110
|
-
var LazyImage = function
|
|
18014
|
+
var LazyImage = (function (lazyManager) {
|
|
18111
18015
|
return {
|
|
18112
18016
|
props: {
|
|
18113
18017
|
src: [String, Object],
|
|
@@ -18141,6 +18045,7 @@ var LazyImage = function LazyImage(lazyManager) {
|
|
|
18141
18045
|
renderSrc: ''
|
|
18142
18046
|
};
|
|
18143
18047
|
},
|
|
18048
|
+
|
|
18144
18049
|
watch: {
|
|
18145
18050
|
src: function src() {
|
|
18146
18051
|
this.init();
|
|
@@ -18160,6 +18065,7 @@ var LazyImage = function LazyImage(lazyManager) {
|
|
|
18160
18065
|
beforeDestroy: function beforeDestroy() {
|
|
18161
18066
|
lazyManager.removeComponent(this);
|
|
18162
18067
|
},
|
|
18068
|
+
|
|
18163
18069
|
methods: {
|
|
18164
18070
|
init: function init() {
|
|
18165
18071
|
var _lazyManager$_valueFo = lazyManager._valueFormatter(this.src),
|
|
@@ -18190,12 +18096,10 @@ var LazyImage = function LazyImage(lazyManager) {
|
|
|
18190
18096
|
onFinish();
|
|
18191
18097
|
return;
|
|
18192
18098
|
}
|
|
18193
|
-
|
|
18194
18099
|
var src = this.options.src;
|
|
18195
|
-
loadImageAsync({
|
|
18196
|
-
src: src
|
|
18197
|
-
}, function (_ref) {
|
|
18100
|
+
loadImageAsync({ src: src }, function (_ref) {
|
|
18198
18101
|
var src = _ref.src;
|
|
18102
|
+
|
|
18199
18103
|
_this.renderSrc = src;
|
|
18200
18104
|
_this.state.loaded = true;
|
|
18201
18105
|
}, function (e) {
|
|
@@ -18206,7 +18110,7 @@ var LazyImage = function LazyImage(lazyManager) {
|
|
|
18206
18110
|
}
|
|
18207
18111
|
}
|
|
18208
18112
|
};
|
|
18209
|
-
};
|
|
18113
|
+
});
|
|
18210
18114
|
|
|
18211
18115
|
var vue_lazyload_esm_index = {
|
|
18212
18116
|
/*
|
|
@@ -18216,12 +18120,13 @@ var vue_lazyload_esm_index = {
|
|
|
18216
18120
|
*/
|
|
18217
18121
|
install: function install(Vue) {
|
|
18218
18122
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18123
|
+
|
|
18219
18124
|
var LazyClass = Lazy(Vue);
|
|
18220
18125
|
var lazy = new LazyClass(options);
|
|
18221
|
-
var lazyContainer = new LazyContainerMananger({
|
|
18222
|
-
|
|
18223
|
-
});
|
|
18126
|
+
var lazyContainer = new LazyContainerMananger({ lazy: lazy });
|
|
18127
|
+
|
|
18224
18128
|
var isVue2 = Vue.version.split('.')[0] === '2';
|
|
18129
|
+
|
|
18225
18130
|
Vue.prototype.$Lazyload = lazy;
|
|
18226
18131
|
|
|
18227
18132
|
if (options.lazyComponent) {
|
|
@@ -18262,6 +18167,7 @@ var vue_lazyload_esm_index = {
|
|
|
18262
18167
|
lazy.remove(this.el);
|
|
18263
18168
|
}
|
|
18264
18169
|
});
|
|
18170
|
+
|
|
18265
18171
|
Vue.directive('lazy-container', {
|
|
18266
18172
|
update: function update(newValue, oldValue) {
|
|
18267
18173
|
lazyContainer.update(this.el, {
|
|
@@ -18280,7 +18186,9 @@ var vue_lazyload_esm_index = {
|
|
|
18280
18186
|
}
|
|
18281
18187
|
}
|
|
18282
18188
|
};
|
|
18189
|
+
|
|
18283
18190
|
/* harmony default export */ var vue_lazyload_esm = (vue_lazyload_esm_index);
|
|
18191
|
+
|
|
18284
18192
|
// CONCATENATED MODULE: ./es/lazyload/index.js
|
|
18285
18193
|
|
|
18286
18194
|
/* harmony default export */ var lazyload = (vue_lazyload_esm);
|
|
@@ -18662,1226 +18570,1063 @@ var media_player_createNamespace = Object(utils["b" /* createNamespace */])('med
|
|
|
18662
18570
|
}
|
|
18663
18571
|
}));
|
|
18664
18572
|
// CONCATENATED MODULE: ./node_modules/@egova/util/lib/type-check.js
|
|
18665
|
-
// code from: https://segmentfault.com/a/1190000022221464
|
|
18666
|
-
function checkDataType(tgt, type) {
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
}
|
|
18670
|
-
function checkIsUndefined(tgt) {
|
|
18671
|
-
|
|
18672
|
-
}
|
|
18673
|
-
function checkIsNull(tgt) {
|
|
18674
|
-
|
|
18675
|
-
}
|
|
18676
|
-
function checkIsUndefinedOrNull(tgt) {
|
|
18677
|
-
|
|
18678
|
-
}
|
|
18679
|
-
function checkIsNumber(tgt) {
|
|
18680
|
-
|
|
18681
|
-
}
|
|
18682
|
-
function checkIsString(tgt) {
|
|
18683
|
-
|
|
18684
|
-
}
|
|
18685
|
-
function checkIsStringValid(tgt) {
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
}
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
|
|
18715
|
-
|
|
18573
|
+
// code from: https://segmentfault.com/a/1190000022221464
|
|
18574
|
+
function checkDataType(tgt, type) {
|
|
18575
|
+
var dataType = Object.prototype.toString.call(tgt).replace(/\[object (\w+)\]/, "$1").toLowerCase();
|
|
18576
|
+
return type ? dataType === type : dataType;
|
|
18577
|
+
}
|
|
18578
|
+
function checkIsUndefined(tgt) {
|
|
18579
|
+
return checkDataType(tgt, 'undefined');
|
|
18580
|
+
}
|
|
18581
|
+
function checkIsNull(tgt) {
|
|
18582
|
+
return checkDataType(tgt, 'null');
|
|
18583
|
+
}
|
|
18584
|
+
function checkIsUndefinedOrNull(tgt) {
|
|
18585
|
+
return checkIsUndefined(tgt) || checkIsNull(tgt);
|
|
18586
|
+
}
|
|
18587
|
+
function checkIsNumber(tgt) {
|
|
18588
|
+
return checkDataType(tgt, 'number');
|
|
18589
|
+
}
|
|
18590
|
+
function checkIsString(tgt) {
|
|
18591
|
+
return checkDataType(tgt, 'string');
|
|
18592
|
+
}
|
|
18593
|
+
function checkIsStringValid(tgt) {
|
|
18594
|
+
if (checkDataType(tgt, 'string')) {
|
|
18595
|
+
return tgt !== '';
|
|
18596
|
+
}
|
|
18597
|
+
else {
|
|
18598
|
+
return false;
|
|
18599
|
+
}
|
|
18600
|
+
}
|
|
18601
|
+
function checkIsBoolean(tgt) {
|
|
18602
|
+
return checkDataType(tgt, 'boolean');
|
|
18603
|
+
}
|
|
18604
|
+
function checkIsSymbol(tgt) {
|
|
18605
|
+
return checkDataType(tgt, 'symbol');
|
|
18606
|
+
}
|
|
18607
|
+
function checkIsObject(tgt) {
|
|
18608
|
+
return checkDataType(tgt, 'object');
|
|
18609
|
+
}
|
|
18610
|
+
function checkIsArray(tgt) {
|
|
18611
|
+
return checkDataType(tgt, 'array');
|
|
18612
|
+
}
|
|
18613
|
+
function checkIsFunction(tgt) {
|
|
18614
|
+
return checkDataType(tgt, 'function');
|
|
18615
|
+
}
|
|
18616
|
+
function checkIsDate(tgt) {
|
|
18617
|
+
return checkDataType(tgt, 'date');
|
|
18618
|
+
}
|
|
18619
|
+
function checkIsRegExp(tgt) {
|
|
18620
|
+
return checkDataType(tgt, 'regexp');
|
|
18621
|
+
}
|
|
18622
|
+
function checkIsError(tgt) {
|
|
18623
|
+
return checkDataType(tgt, 'error');
|
|
18624
|
+
}
|
|
18625
|
+
//# sourceMappingURL=type-check.js.map
|
|
18716
18626
|
// CONCATENATED MODULE: ./node_modules/@egova/util/lib/type-parse.js
|
|
18717
18627
|
/**
|
|
18718
18628
|
* 解析整数
|
|
18719
18629
|
* @param obj, 输入字符串
|
|
18720
18630
|
* @param defaultValue,默认值
|
|
18721
|
-
*/
|
|
18722
|
-
function parseInteger(obj, defaultValue) {
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
return result;
|
|
18730
|
-
}
|
|
18731
|
-
/**
|
|
18732
|
-
* 解析小数
|
|
18733
|
-
* @param obj, 输入字符串
|
|
18734
|
-
* @param defaultValue,默认值
|
|
18735
|
-
*/
|
|
18736
|
-
|
|
18737
|
-
function parseDecimal(obj, defaultValue) {
|
|
18738
|
-
var result = parseFloat(obj);
|
|
18739
|
-
|
|
18740
|
-
if (isNaN(result)) {
|
|
18741
|
-
result = defaultValue || 0;
|
|
18742
|
-
}
|
|
18743
|
-
|
|
18744
|
-
return result;
|
|
18745
|
-
}
|
|
18746
|
-
// CONCATENATED MODULE: ./node_modules/@egova/util/lib/date.js
|
|
18747
|
-
|
|
18748
|
-
var date_weekList = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
|
|
18749
|
-
var date_FORMAT = {
|
|
18750
|
-
//英文简写如:12:01
|
|
18751
|
-
FORMAT_HM: "HH:mm",
|
|
18752
|
-
//英文简写如:1-12 12:01
|
|
18753
|
-
FORMAT_MDHM: "MM-dd HH:mm",
|
|
18754
|
-
//中文简写如:1月12日
|
|
18755
|
-
FORMAT_MD_CN: "MM月dd日",
|
|
18756
|
-
//中文简写如:1月12日
|
|
18757
|
-
FORMAT_MD: "MM-dd",
|
|
18758
|
-
//英文简写(默认)如:2010-12-01
|
|
18759
|
-
FORMAT_YMD: "yyyy-MM-dd",
|
|
18760
|
-
FORMAT_YMD_SLASH: "yyyy/MM/dd",
|
|
18761
|
-
//英文简写(默认)如:2010-12
|
|
18762
|
-
FORMAT_YM: "yyyy-MM",
|
|
18763
|
-
//英文全称 如:2010-12-01 23:15
|
|
18764
|
-
FORMAT_YMDHM: "yyyy-MM-dd HH:mm",
|
|
18765
|
-
//英文全称 如:2010-12-01 23:15:06
|
|
18766
|
-
FORMAT_YMDHMS: "yyyy-MM-dd HH:mm:ss",
|
|
18767
|
-
//英文全称 如:2010-12-01 23:15:06
|
|
18768
|
-
FORMAT_YMDHMSMS: "yyyy-MM-dd HH:mm:ss msms",
|
|
18769
|
-
//中文简写 如:2010年12月
|
|
18770
|
-
FORMAT_YM_CN: "yyyy年MM月",
|
|
18771
|
-
//中文简写 如:2010年12月01日
|
|
18772
|
-
FORMAT_YMD_CN: "yyyy年MM月dd日",
|
|
18773
|
-
//中文简写 如:2010年12月01日 12时
|
|
18774
|
-
FORMAT_YMDH_CN: "yyyy年MM月dd日 HH时",
|
|
18775
|
-
//中文简写 如:12月01日 12时
|
|
18776
|
-
FORMAT_MDH_CN: "MM月dd日 HH时",
|
|
18777
|
-
//中文简写 如:2010年12月01日 12时12分
|
|
18778
|
-
FORMAT_YMDHM_CN: "yyyy年MM月dd日 HH时mm分",
|
|
18779
|
-
//中文全称 如:2010年12月01日 23时15分06秒
|
|
18780
|
-
FORMAT_YMDHMS_CN: "yyyy年MM月dd日 HH时mm分ss秒"
|
|
18781
|
-
};
|
|
18782
|
-
|
|
18783
|
-
var date_formatNumber_ = function __formatNumber__(number) {
|
|
18784
|
-
if (number < 10) {
|
|
18785
|
-
return "0" + number;
|
|
18786
|
-
}
|
|
18787
|
-
|
|
18788
|
-
return number + "";
|
|
18789
|
-
};
|
|
18790
|
-
/**
|
|
18791
|
-
* 创建 Date对象
|
|
18792
|
-
* @param dateObj 可传入:
|
|
18793
|
-
* 1. number格式的timestamp;
|
|
18794
|
-
* 2. string格式的日期字符串
|
|
18795
|
-
* 3. Date对象将原封不动的返回
|
|
18796
|
-
* @returns {null|Date|*}
|
|
18797
|
-
*/
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
function createDate(dateObj) {
|
|
18801
|
-
if (checkIsUndefinedOrNull(dateObj)) {
|
|
18802
|
-
return null;
|
|
18803
|
-
}
|
|
18804
|
-
|
|
18805
|
-
if (typeof dateObj === 'number') {
|
|
18806
|
-
return new Date(dateObj);
|
|
18807
|
-
} // IOS无法解析'2018-01-02'这种格式,需要替换为'2018/01/02'
|
|
18808
|
-
|
|
18809
|
-
|
|
18810
|
-
if (typeof dateObj === 'string') {
|
|
18811
|
-
dateObj = dateObj.replace(/-/g, '/');
|
|
18812
|
-
|
|
18813
|
-
if (dateObj.length === 7) {
|
|
18814
|
-
// 只有月份的日期ios无法解析,例如 2021/06 , 需转换成2021/06/01
|
|
18815
|
-
dateObj += "/01";
|
|
18816
|
-
}
|
|
18817
|
-
|
|
18818
|
-
return new Date(dateObj);
|
|
18819
|
-
}
|
|
18820
|
-
|
|
18821
|
-
if (checkIsDate(dateObj)) {
|
|
18822
|
-
return dateObj;
|
|
18823
|
-
}
|
|
18824
|
-
|
|
18825
|
-
return null;
|
|
18826
|
-
}
|
|
18827
|
-
function date_formatDate(dateObj, formatType) {
|
|
18828
|
-
if (formatType === void 0) {
|
|
18829
|
-
formatType = date_FORMAT.FORMAT_YMDHMS;
|
|
18830
|
-
}
|
|
18831
|
-
|
|
18832
|
-
var date = createDate(dateObj);
|
|
18833
|
-
|
|
18834
|
-
if (date) {
|
|
18835
|
-
date.getFullYear();
|
|
18836
|
-
var formatResult = formatType.replace("yyyy", date_formatNumber_(date.getFullYear()));
|
|
18837
|
-
formatResult = formatResult.replace("yy", String(date.getFullYear()).substring(2));
|
|
18838
|
-
formatResult = formatResult.replace("MM", date_formatNumber_(date.getMonth() + 1));
|
|
18839
|
-
formatResult = formatResult.replace("dd", date_formatNumber_(date.getDate()));
|
|
18840
|
-
formatResult = formatResult.replace("HH", date_formatNumber_(date.getHours()));
|
|
18841
|
-
formatResult = formatResult.replace("mm", date_formatNumber_(date.getMinutes()));
|
|
18842
|
-
formatResult = formatResult.replace("ss", date_formatNumber_(date.getSeconds()));
|
|
18843
|
-
formatResult = formatResult.replace("msms", date_formatNumber_(date.getMilliseconds()));
|
|
18844
|
-
return formatResult;
|
|
18845
|
-
} else {
|
|
18846
|
-
return null;
|
|
18847
|
-
}
|
|
18848
|
-
}
|
|
18849
|
-
// CONCATENATED MODULE: ./node_modules/@egova/util/lib/system-check.js
|
|
18850
|
-
function checkIsAndroid() {
|
|
18851
|
-
/* istanbul ignore next */
|
|
18852
|
-
return /android/.test(navigator.userAgent.toLowerCase());
|
|
18853
|
-
}
|
|
18854
|
-
function checkIsIOS() {
|
|
18855
|
-
/* istanbul ignore next */
|
|
18856
|
-
return /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase());
|
|
18857
|
-
}
|
|
18858
|
-
function checkIsMacOS() {
|
|
18859
|
-
return navigator.platform.indexOf('Mac') > -1;
|
|
18860
|
-
}
|
|
18861
|
-
function checkIsWindows() {
|
|
18862
|
-
return navigator.platform.indexOf('Win') > -1;
|
|
18863
|
-
}
|
|
18864
|
-
// CONCATENATED MODULE: ./node_modules/@egova/util/lib/index.js
|
|
18865
|
-
// Replace the contents of this file with your own exported values.
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
// CONCATENATED MODULE: ./node_modules/@egova/media/lib/watermark.js
|
|
18631
|
+
*/
|
|
18632
|
+
function parseInteger(obj, defaultValue) {
|
|
18633
|
+
var result = parseInt(obj, 10);
|
|
18634
|
+
if (isNaN(result)) {
|
|
18635
|
+
result = defaultValue || 0;
|
|
18636
|
+
}
|
|
18637
|
+
return result;
|
|
18638
|
+
}
|
|
18871
18639
|
/**
|
|
18872
|
-
*
|
|
18873
|
-
* @
|
|
18874
|
-
* @
|
|
18875
|
-
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
|
|
18896
|
-
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
}
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
|
|
18930
|
-
|
|
18931
|
-
|
|
18932
|
-
|
|
18933
|
-
|
|
18934
|
-
|
|
18935
|
-
|
|
18936
|
-
|
|
18937
|
-
|
|
18938
|
-
(
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
18942
|
-
|
|
18943
|
-
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
|
|
18960
|
-
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
|
|
18968
|
-
|
|
18969
|
-
|
|
18970
|
-
|
|
18971
|
-
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
18976
|
-
function
|
|
18977
|
-
|
|
18978
|
-
|
|
18979
|
-
|
|
18980
|
-
|
|
18981
|
-
|
|
18982
|
-
|
|
18983
|
-
|
|
18984
|
-
|
|
18985
|
-
|
|
18986
|
-
}
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
18990
|
-
|
|
18991
|
-
|
|
18992
|
-
|
|
18993
|
-
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
|
|
19005
|
-
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
|
|
19009
|
-
|
|
19010
|
-
|
|
19011
|
-
|
|
19012
|
-
|
|
19013
|
-
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
}
|
|
19025
|
-
|
|
19026
|
-
|
|
19027
|
-
|
|
19028
|
-
|
|
19029
|
-
|
|
19030
|
-
|
|
19031
|
-
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
|
|
19040
|
-
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
|
|
19044
|
-
|
|
19045
|
-
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
|
|
19050
|
-
|
|
19051
|
-
|
|
19052
|
-
|
|
19053
|
-
|
|
19054
|
-
|
|
19055
|
-
|
|
19056
|
-
|
|
19057
|
-
|
|
19058
|
-
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
function
|
|
19089
|
-
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
}
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
}
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
|
|
19199
|
-
|
|
19200
|
-
|
|
19201
|
-
|
|
19202
|
-
|
|
19203
|
-
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
|
|
19208
|
-
|
|
19209
|
-
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19216
|
-
|
|
19217
|
-
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19232
|
-
|
|
19233
|
-
|
|
19234
|
-
|
|
19235
|
-
|
|
19236
|
-
|
|
19237
|
-
|
|
19238
|
-
|
|
19239
|
-
|
|
19240
|
-
|
|
19241
|
-
|
|
19242
|
-
|
|
19243
|
-
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19248
|
-
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
|
|
19252
|
-
|
|
19253
|
-
|
|
19254
|
-
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
|
|
19267
|
-
|
|
19268
|
-
|
|
19269
|
-
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
|
|
19287
|
-
|
|
19288
|
-
|
|
19289
|
-
|
|
19290
|
-
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
}
|
|
19299
|
-
|
|
19300
|
-
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
|
-
|
|
19319
|
-
|
|
19320
|
-
|
|
19321
|
-
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
}
|
|
19335
|
-
|
|
19336
|
-
function
|
|
19337
|
-
|
|
19338
|
-
|
|
19339
|
-
|
|
19340
|
-
|
|
19341
|
-
|
|
19342
|
-
|
|
19343
|
-
|
|
19344
|
-
|
|
19345
|
-
|
|
19346
|
-
|
|
19347
|
-
|
|
19348
|
-
|
|
19349
|
-
|
|
19350
|
-
|
|
19351
|
-
|
|
19352
|
-
|
|
19353
|
-
|
|
19354
|
-
|
|
19355
|
-
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19373
|
-
|
|
19374
|
-
}
|
|
19375
|
-
|
|
19376
|
-
|
|
19377
|
-
|
|
19378
|
-
|
|
19379
|
-
|
|
19380
|
-
var
|
|
19381
|
-
|
|
19382
|
-
|
|
19383
|
-
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
|
|
19389
|
-
|
|
19390
|
-
|
|
19391
|
-
}
|
|
19392
|
-
|
|
19393
|
-
|
|
19394
|
-
|
|
19395
|
-
|
|
19396
|
-
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19407
|
-
|
|
19408
|
-
|
|
19409
|
-
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
|
|
19418
|
-
|
|
19419
|
-
|
|
19420
|
-
}
|
|
19421
|
-
|
|
19422
|
-
|
|
19423
|
-
|
|
19424
|
-
|
|
19425
|
-
|
|
19426
|
-
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
|
|
19430
|
-
|
|
19431
|
-
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19437
|
-
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
19443
|
-
|
|
19444
|
-
|
|
19445
|
-
|
|
19446
|
-
|
|
19447
|
-
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
//
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
//
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
|
|
19471
|
-
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
//
|
|
19481
|
-
//
|
|
19482
|
-
//
|
|
19483
|
-
//
|
|
19484
|
-
// ctx
|
|
19485
|
-
// ctx
|
|
19486
|
-
//
|
|
19487
|
-
//
|
|
19488
|
-
//
|
|
19489
|
-
//
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
|
|
19524
|
-
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
|
|
19528
|
-
|
|
19529
|
-
|
|
19530
|
-
|
|
19531
|
-
ctx.
|
|
19532
|
-
|
|
19533
|
-
|
|
19534
|
-
|
|
19535
|
-
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
|
|
19543
|
-
|
|
19544
|
-
|
|
19545
|
-
|
|
19546
|
-
|
|
19547
|
-
|
|
19548
|
-
|
|
19549
|
-
|
|
19550
|
-
|
|
19551
|
-
|
|
19552
|
-
|
|
19553
|
-
|
|
19554
|
-
|
|
19555
|
-
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
|
|
19589
|
-
|
|
19590
|
-
|
|
19591
|
-
|
|
19592
|
-
|
|
19593
|
-
|
|
19594
|
-
|
|
19595
|
-
|
|
19596
|
-
|
|
19597
|
-
|
|
19598
|
-
|
|
19599
|
-
|
|
19600
|
-
|
|
19601
|
-
|
|
19602
|
-
|
|
19603
|
-
|
|
19604
|
-
|
|
19605
|
-
|
|
19606
|
-
|
|
19607
|
-
|
|
19608
|
-
|
|
19609
|
-
|
|
19610
|
-
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
|
|
19616
|
-
|
|
19617
|
-
|
|
19618
|
-
|
|
19619
|
-
|
|
19620
|
-
|
|
19621
|
-
|
|
19622
|
-
|
|
19623
|
-
|
|
19624
|
-
|
|
19625
|
-
|
|
19626
|
-
|
|
19627
|
-
|
|
19628
|
-
|
|
19629
|
-
|
|
19630
|
-
|
|
19631
|
-
|
|
19632
|
-
|
|
19633
|
-
|
|
19634
|
-
|
|
19635
|
-
|
|
19636
|
-
}
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
|
|
19640
|
-
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
|
|
19644
|
-
|
|
19645
|
-
|
|
19646
|
-
|
|
19647
|
-
|
|
19648
|
-
|
|
19649
|
-
|
|
19650
|
-
|
|
19651
|
-
|
|
19652
|
-
|
|
19653
|
-
|
|
19654
|
-
|
|
19655
|
-
|
|
19656
|
-
|
|
19657
|
-
|
|
19658
|
-
|
|
19659
|
-
if (
|
|
19660
|
-
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
|
|
19664
|
-
|
|
19665
|
-
|
|
19666
|
-
|
|
19667
|
-
|
|
19668
|
-
|
|
19669
|
-
|
|
19670
|
-
|
|
19671
|
-
|
|
19672
|
-
|
|
19673
|
-
|
|
19674
|
-
|
|
19675
|
-
|
|
19676
|
-
|
|
19677
|
-
|
|
19678
|
-
|
|
19679
|
-
|
|
19680
|
-
baseOrigin = new Point(contentPadding, contentPadding);
|
|
19681
|
-
|
|
19682
|
-
|
|
19683
|
-
|
|
19684
|
-
|
|
19685
|
-
|
|
19686
|
-
|
|
19687
|
-
|
|
19688
|
-
|
|
19689
|
-
|
|
19690
|
-
|
|
19691
|
-
lastMarginTop
|
|
19692
|
-
|
|
19693
|
-
|
|
19694
|
-
|
|
19695
|
-
|
|
19696
|
-
|
|
19697
|
-
|
|
19698
|
-
|
|
19699
|
-
|
|
18640
|
+
* 解析小数
|
|
18641
|
+
* @param obj, 输入字符串
|
|
18642
|
+
* @param defaultValue,默认值
|
|
18643
|
+
*/
|
|
18644
|
+
function parseDecimal(obj, defaultValue) {
|
|
18645
|
+
var result = parseFloat(obj);
|
|
18646
|
+
if (isNaN(result)) {
|
|
18647
|
+
result = defaultValue || 0;
|
|
18648
|
+
}
|
|
18649
|
+
return result;
|
|
18650
|
+
}
|
|
18651
|
+
//# sourceMappingURL=type-parse.js.map
|
|
18652
|
+
// CONCATENATED MODULE: ./node_modules/@egova/util/lib/date.js
|
|
18653
|
+
|
|
18654
|
+
var date_weekList = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
|
|
18655
|
+
var date_FORMAT = {
|
|
18656
|
+
//英文简写如:12:01
|
|
18657
|
+
FORMAT_HM: "HH:mm",
|
|
18658
|
+
//英文简写如:1-12 12:01
|
|
18659
|
+
FORMAT_MDHM: "MM-dd HH:mm",
|
|
18660
|
+
//中文简写如:1月12日
|
|
18661
|
+
FORMAT_MD_CN: "MM月dd日",
|
|
18662
|
+
//中文简写如:1月12日
|
|
18663
|
+
FORMAT_MD: "MM-dd",
|
|
18664
|
+
//英文简写(默认)如:2010-12-01
|
|
18665
|
+
FORMAT_YMD: "yyyy-MM-dd",
|
|
18666
|
+
FORMAT_YMD_SLASH: "yyyy/MM/dd",
|
|
18667
|
+
//英文简写(默认)如:2010-12
|
|
18668
|
+
FORMAT_YM: "yyyy-MM",
|
|
18669
|
+
//英文全称 如:2010-12-01 23:15
|
|
18670
|
+
FORMAT_YMDHM: "yyyy-MM-dd HH:mm",
|
|
18671
|
+
//英文全称 如:2010-12-01 23:15:06
|
|
18672
|
+
FORMAT_YMDHMS: "yyyy-MM-dd HH:mm:ss",
|
|
18673
|
+
//英文全称 如:2010-12-01 23:15:06
|
|
18674
|
+
FORMAT_YMDHMSMS: "yyyy-MM-dd HH:mm:ss msms",
|
|
18675
|
+
//中文简写 如:2010年12月
|
|
18676
|
+
FORMAT_YM_CN: "yyyy年MM月",
|
|
18677
|
+
//中文简写 如:2010年12月01日
|
|
18678
|
+
FORMAT_YMD_CN: "yyyy年MM月dd日",
|
|
18679
|
+
//中文简写 如:2010年12月01日 12时
|
|
18680
|
+
FORMAT_YMDH_CN: "yyyy年MM月dd日 HH时",
|
|
18681
|
+
//中文简写 如:12月01日 12时
|
|
18682
|
+
FORMAT_MDH_CN: "MM月dd日 HH时",
|
|
18683
|
+
//中文简写 如:2010年12月01日 12时12分
|
|
18684
|
+
FORMAT_YMDHM_CN: "yyyy年MM月dd日 HH时mm分",
|
|
18685
|
+
//中文全称 如:2010年12月01日 23时15分06秒
|
|
18686
|
+
FORMAT_YMDHMS_CN: "yyyy年MM月dd日 HH时mm分ss秒"
|
|
18687
|
+
};
|
|
18688
|
+
var date_formatNumber_ = function (number) {
|
|
18689
|
+
if (number < 10) {
|
|
18690
|
+
return "0" + number;
|
|
18691
|
+
}
|
|
18692
|
+
return number + "";
|
|
18693
|
+
};
|
|
18694
|
+
/**
|
|
18695
|
+
* 创建 Date对象
|
|
18696
|
+
* @param dateObj 可传入:
|
|
18697
|
+
* 1. number格式的timestamp;
|
|
18698
|
+
* 2. string格式的日期字符串
|
|
18699
|
+
* 3. Date对象将原封不动的返回
|
|
18700
|
+
* @returns {null|Date|*}
|
|
18701
|
+
*/
|
|
18702
|
+
function createDate(dateObj) {
|
|
18703
|
+
if (checkIsUndefinedOrNull(dateObj)) {
|
|
18704
|
+
return null;
|
|
18705
|
+
}
|
|
18706
|
+
if (typeof dateObj === 'number') {
|
|
18707
|
+
return new Date(dateObj);
|
|
18708
|
+
}
|
|
18709
|
+
// IOS无法解析'2018-01-02'这种格式,需要替换为'2018/01/02'
|
|
18710
|
+
if (typeof dateObj === 'string') {
|
|
18711
|
+
dateObj = dateObj.replace(/-/g, '/');
|
|
18712
|
+
if (dateObj.length === 7) {
|
|
18713
|
+
// 只有月份的日期ios无法解析,例如 2021/06 , 需转换成2021/06/01
|
|
18714
|
+
dateObj += "/01";
|
|
18715
|
+
}
|
|
18716
|
+
return new Date(dateObj);
|
|
18717
|
+
}
|
|
18718
|
+
if (checkIsDate(dateObj)) {
|
|
18719
|
+
return dateObj;
|
|
18720
|
+
}
|
|
18721
|
+
return null;
|
|
18722
|
+
}
|
|
18723
|
+
function date_formatDate(dateObj, formatType) {
|
|
18724
|
+
if (formatType === void 0) { formatType = date_FORMAT.FORMAT_YMDHMS; }
|
|
18725
|
+
var date = createDate(dateObj);
|
|
18726
|
+
if (date) {
|
|
18727
|
+
date.getFullYear();
|
|
18728
|
+
var formatResult = formatType.replace("yyyy", date_formatNumber_(date.getFullYear()));
|
|
18729
|
+
formatResult = formatResult.replace("yy", String(date.getFullYear()).substring(2));
|
|
18730
|
+
formatResult = formatResult.replace("MM", date_formatNumber_(date.getMonth() + 1));
|
|
18731
|
+
formatResult = formatResult.replace("dd", date_formatNumber_(date.getDate()));
|
|
18732
|
+
formatResult = formatResult.replace("HH", date_formatNumber_(date.getHours()));
|
|
18733
|
+
formatResult = formatResult.replace("mm", date_formatNumber_(date.getMinutes()));
|
|
18734
|
+
formatResult = formatResult.replace("ss", date_formatNumber_(date.getSeconds()));
|
|
18735
|
+
formatResult = formatResult.replace("msms", date_formatNumber_(date.getMilliseconds()));
|
|
18736
|
+
return formatResult;
|
|
18737
|
+
}
|
|
18738
|
+
else {
|
|
18739
|
+
return null;
|
|
18740
|
+
}
|
|
18741
|
+
}
|
|
18742
|
+
//# sourceMappingURL=date.js.map
|
|
18743
|
+
// CONCATENATED MODULE: ./node_modules/@egova/util/lib/system-check.js
|
|
18744
|
+
function checkIsAndroid() {
|
|
18745
|
+
/* istanbul ignore next */
|
|
18746
|
+
return /android/.test(navigator.userAgent.toLowerCase());
|
|
18747
|
+
}
|
|
18748
|
+
function checkIsIOS() {
|
|
18749
|
+
/* istanbul ignore next */
|
|
18750
|
+
return /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase());
|
|
18751
|
+
}
|
|
18752
|
+
function checkIsMacOS() {
|
|
18753
|
+
return navigator.platform.indexOf('Mac') > -1;
|
|
18754
|
+
}
|
|
18755
|
+
function checkIsWindows() {
|
|
18756
|
+
return navigator.platform.indexOf('Win') > -1;
|
|
18757
|
+
}
|
|
18758
|
+
//# sourceMappingURL=system-check.js.map
|
|
18759
|
+
// CONCATENATED MODULE: ./node_modules/@egova/util/lib/index.js
|
|
18760
|
+
// Replace the contents of this file with your own exported values.
|
|
18761
|
+
|
|
18762
|
+
|
|
18763
|
+
|
|
18764
|
+
|
|
18765
|
+
//# sourceMappingURL=index.js.map
|
|
18766
|
+
// CONCATENATED MODULE: ./node_modules/@egova/media/lib/watermark.js
|
|
18767
|
+
/**
|
|
18768
|
+
* 水印配置 {@link http://faq.egova.com.cn:7777/projects/redmine/wiki/%E6%8B%8D%E7%85%A7%E6%B0%B4%E5%8D%B0%E9%85%8D%E7%BD%AE|文档}
|
|
18769
|
+
* @description 水印渲染类
|
|
18770
|
+
* @author Jiaji Yin
|
|
18771
|
+
* @date 2021-11-05
|
|
18772
|
+
*/
|
|
18773
|
+
|
|
18774
|
+
var Point = /** @class */ (function () {
|
|
18775
|
+
function Point(x, y) {
|
|
18776
|
+
this.x = x;
|
|
18777
|
+
this.y = y;
|
|
18778
|
+
}
|
|
18779
|
+
return Point;
|
|
18780
|
+
}());
|
|
18781
|
+
var Size = /** @class */ (function () {
|
|
18782
|
+
function Size(width, height) {
|
|
18783
|
+
this.width = width;
|
|
18784
|
+
this.height = height;
|
|
18785
|
+
}
|
|
18786
|
+
return Size;
|
|
18787
|
+
}());
|
|
18788
|
+
var clamp = function (value, min, max) { return Math.min(Math.max(value, min), max); };
|
|
18789
|
+
var subString = function (str, startIndex, length) {
|
|
18790
|
+
if (checkIsUndefinedOrNull(length)) {
|
|
18791
|
+
return str.substring(startIndex);
|
|
18792
|
+
}
|
|
18793
|
+
else {
|
|
18794
|
+
return str.substring(startIndex, startIndex + length);
|
|
18795
|
+
}
|
|
18796
|
+
};
|
|
18797
|
+
/**
|
|
18798
|
+
* {@link http://faq.egova.com.cn:7777/files/ueditor/image/20180621/1529574697677847.png|水印位置图}
|
|
18799
|
+
*/
|
|
18800
|
+
var WatermarkPosition;
|
|
18801
|
+
(function (WatermarkPosition) {
|
|
18802
|
+
WatermarkPosition["LeftTop"] = "lefttop";
|
|
18803
|
+
WatermarkPosition["CenterTop"] = "centertop";
|
|
18804
|
+
WatermarkPosition["RightTop"] = "righttop";
|
|
18805
|
+
WatermarkPosition["LeftCenter"] = "leftcenter";
|
|
18806
|
+
WatermarkPosition["Center"] = "center";
|
|
18807
|
+
WatermarkPosition["RightCenter"] = "rightcenter";
|
|
18808
|
+
WatermarkPosition["LeftBottom"] = "leftbottom";
|
|
18809
|
+
WatermarkPosition["CenterBottom"] = "centerbottom";
|
|
18810
|
+
WatermarkPosition["RightBottom"] = "rightbottom";
|
|
18811
|
+
})(WatermarkPosition || (WatermarkPosition = {}));
|
|
18812
|
+
var WatermarkFontWeight;
|
|
18813
|
+
(function (WatermarkFontWeight) {
|
|
18814
|
+
WatermarkFontWeight["Normal"] = "normal";
|
|
18815
|
+
WatermarkFontWeight["Bold"] = "bold";
|
|
18816
|
+
})(WatermarkFontWeight || (WatermarkFontWeight = {}));
|
|
18817
|
+
var DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
|
|
18818
|
+
var DEFAULT_TIME_FORMAT = "HH:mm";
|
|
18819
|
+
var WatermarkContent;
|
|
18820
|
+
(function (WatermarkContent) {
|
|
18821
|
+
WatermarkContent["Raw"] = "";
|
|
18822
|
+
WatermarkContent["Date"] = "date{(.*?)}|date";
|
|
18823
|
+
WatermarkContent["Time"] = "time";
|
|
18824
|
+
WatermarkContent["Address"] = "address";
|
|
18825
|
+
WatermarkContent["HumanName"] = "humanname";
|
|
18826
|
+
WatermarkContent["ProjectName"] = "projectName";
|
|
18827
|
+
WatermarkContent["Logo"] = "{logo}";
|
|
18828
|
+
})(WatermarkContent || (WatermarkContent = {}));
|
|
18829
|
+
var ColorMap = {
|
|
18830
|
+
"transparent": "#00000000",
|
|
18831
|
+
"white": "#FFFFFF",
|
|
18832
|
+
"black": "#000000",
|
|
18833
|
+
"darkgray": "#444444",
|
|
18834
|
+
"gray": "#888888",
|
|
18835
|
+
"lightgray": "#CCCCCC",
|
|
18836
|
+
"darkgrey": "#444444",
|
|
18837
|
+
"grey": "#888888",
|
|
18838
|
+
"lightgrey": "#CCCCCC",
|
|
18839
|
+
"red": "#FF0000",
|
|
18840
|
+
"green": "#00FF00",
|
|
18841
|
+
"blue": "#0000FF",
|
|
18842
|
+
"yellow": "#FFFF00",
|
|
18843
|
+
"cyan": "#00FFFF",
|
|
18844
|
+
"magenta": "#FF00FF",
|
|
18845
|
+
"aqua": "#00FFFF",
|
|
18846
|
+
"fuchsia": "#FF00FF",
|
|
18847
|
+
"lime": "#00FF00",
|
|
18848
|
+
"maroon": "#800000",
|
|
18849
|
+
"navy": "#000080",
|
|
18850
|
+
"olive": "#808000",
|
|
18851
|
+
"purple": "#800080",
|
|
18852
|
+
"silver": "#C0C0C0",
|
|
18853
|
+
"teal": "#008080",
|
|
18854
|
+
"orange": "#FF9933",
|
|
18855
|
+
};
|
|
18856
|
+
function getColorValue(key) {
|
|
18857
|
+
for (var _i = 0, _a = Object.getOwnPropertyNames(ColorMap); _i < _a.length; _i++) {
|
|
18858
|
+
var k = _a[_i];
|
|
18859
|
+
if (k === key) {
|
|
18860
|
+
return ColorMap[k];
|
|
18861
|
+
}
|
|
18862
|
+
}
|
|
18863
|
+
return null;
|
|
18864
|
+
}
|
|
18865
|
+
var CONTENT_PADDING = 10;
|
|
18866
|
+
var DEFAULT_PADDING = 2;
|
|
18867
|
+
var DEFAULT_FONT_SIZE = 25.0;
|
|
18868
|
+
var DEFAULT_CANVAS_SIZE = 480.0;
|
|
18869
|
+
var DEFAULT_BACKGROUND_OPACITY = 128;
|
|
18870
|
+
var WatermarkStyle = /** @class */ (function () {
|
|
18871
|
+
/**
|
|
18872
|
+
* Watermark Style
|
|
18873
|
+
* @param fontName
|
|
18874
|
+
* @param fontWeight
|
|
18875
|
+
* @param fontColor
|
|
18876
|
+
* @param fontSize
|
|
18877
|
+
* @param backgroundColor
|
|
18878
|
+
* @param backgroundOpacity
|
|
18879
|
+
* @param paddingTop
|
|
18880
|
+
* @param paddingBottom
|
|
18881
|
+
* @param position
|
|
18882
|
+
* @param scale
|
|
18883
|
+
* @param simplified
|
|
18884
|
+
*/
|
|
18885
|
+
function WatermarkStyle(fontName, fontWeight, fontColor, fontSize, backgroundColor, backgroundOpacity, paddingTop, paddingBottom, position, scale, simplified) {
|
|
18886
|
+
this.fontName = fontName;
|
|
18887
|
+
this.fontWeight = fontWeight;
|
|
18888
|
+
this.fontColor = fontColor;
|
|
18889
|
+
this.fontSize = fontSize;
|
|
18890
|
+
this.backgroundColor = backgroundColor;
|
|
18891
|
+
this.backgroundOpacity = backgroundOpacity;
|
|
18892
|
+
this.paddingTop = paddingTop;
|
|
18893
|
+
this.paddingBottom = paddingBottom;
|
|
18894
|
+
this.position = position;
|
|
18895
|
+
this.scale = scale;
|
|
18896
|
+
this.simplified = simplified;
|
|
18897
|
+
}
|
|
18898
|
+
return WatermarkStyle;
|
|
18899
|
+
}());
|
|
18900
|
+
var WatermarkImage = /** @class */ (function () {
|
|
18901
|
+
function WatermarkImage(image) {
|
|
18902
|
+
this.image = image;
|
|
18903
|
+
}
|
|
18904
|
+
return WatermarkImage;
|
|
18905
|
+
}());
|
|
18906
|
+
var Watermark = /** @class */ (function () {
|
|
18907
|
+
/**
|
|
18908
|
+
* 水印对象,包含需要渲染的文本、图像,以及相应的style
|
|
18909
|
+
* @param content
|
|
18910
|
+
* @param watermarkStyle
|
|
18911
|
+
*/
|
|
18912
|
+
function Watermark(content, watermarkStyle) {
|
|
18913
|
+
this.content = content;
|
|
18914
|
+
this.style = watermarkStyle;
|
|
18915
|
+
}
|
|
18916
|
+
return Watermark;
|
|
18917
|
+
}());
|
|
18918
|
+
var WatermarkContext = /** @class */ (function () {
|
|
18919
|
+
/**
|
|
18920
|
+
* 打水印需要的环境信息
|
|
18921
|
+
* @param address
|
|
18922
|
+
* @param watermarkTime
|
|
18923
|
+
* @param humanName
|
|
18924
|
+
* @param projectName
|
|
18925
|
+
* @param logo
|
|
18926
|
+
*/
|
|
18927
|
+
function WatermarkContext(params) {
|
|
18928
|
+
this.address = params.address;
|
|
18929
|
+
this.watermarkTime = params.watermarkTime;
|
|
18930
|
+
this.humanName = params.humanName;
|
|
18931
|
+
this.projectName = params.projectName;
|
|
18932
|
+
this.logo = params.logo;
|
|
18933
|
+
}
|
|
18934
|
+
return WatermarkContext;
|
|
18935
|
+
}());
|
|
18936
|
+
|
|
18937
|
+
var WatermarkOptions = /** @class */ (function () {
|
|
18938
|
+
/**
|
|
18939
|
+
* 水印配置项
|
|
18940
|
+
* @param enabled, 是否开启水印
|
|
18941
|
+
* @param watermarkConfigString,水印配置的字符串
|
|
18942
|
+
* @param context,打水印需要的环境信息
|
|
18943
|
+
*/
|
|
18944
|
+
function WatermarkOptions(params) {
|
|
18945
|
+
this.enabled = params.enabled;
|
|
18946
|
+
this.watermarkConfigString = params.watermarkConfigString;
|
|
18947
|
+
this.context = params.context;
|
|
18948
|
+
}
|
|
18949
|
+
return WatermarkOptions;
|
|
18950
|
+
}());
|
|
18951
|
+
|
|
18952
|
+
function parseWatermarkStyle(styleString, canvasSize) {
|
|
18953
|
+
if (!checkIsStringValid(styleString)) {
|
|
18954
|
+
return null;
|
|
18955
|
+
}
|
|
18956
|
+
var styleParts = styleString.split("$");
|
|
18957
|
+
if (styleParts.length <= 0) {
|
|
18958
|
+
return null;
|
|
18959
|
+
}
|
|
18960
|
+
var scale = Math.min(canvasSize.width, canvasSize.height) / DEFAULT_CANVAS_SIZE;
|
|
18961
|
+
/**
|
|
18962
|
+
1. 20190314版本开始可以使用简化版配置,格式为[文字大小]$[水印位置]$[上下padding]*#*[水印内容] 其中[上下padding]一般不设置,如需设置,格式为"上padding_下padding",下padding可省略
|
|
18963
|
+
2. 简化版配置使用条件:字体(黑体)、字体样式(normal)、文字颜色(transparent)、背景颜色(transparent)、背景不透明度(128)全部使用默认值(括号中的值)
|
|
18964
|
+
*/
|
|
18965
|
+
if (parseInteger(styleParts[0], -1) !== -1) { // 第一项为数字,则为新的简化配置
|
|
18966
|
+
var fontSize = Math.round(parseDecimal(styleParts[0], DEFAULT_FONT_SIZE) * scale);
|
|
18967
|
+
var position = WatermarkPosition.LeftTop;
|
|
18968
|
+
if (styleParts[1]) {
|
|
18969
|
+
position = styleParts[1];
|
|
18970
|
+
}
|
|
18971
|
+
var paddingTop = DEFAULT_PADDING * scale;
|
|
18972
|
+
var paddingBottom = DEFAULT_PADDING * scale;
|
|
18973
|
+
if (styleParts[2]) {
|
|
18974
|
+
var paddingParts = styleParts[2].split("_");
|
|
18975
|
+
paddingTop = parseInteger(paddingParts[0], DEFAULT_PADDING) * scale;
|
|
18976
|
+
if (paddingParts[1]) {
|
|
18977
|
+
paddingBottom = parseInteger(paddingParts[1], DEFAULT_PADDING) * scale;
|
|
18978
|
+
}
|
|
18979
|
+
}
|
|
18980
|
+
var fontName = getHeitiFontFamily();
|
|
18981
|
+
var fontWeight = WatermarkFontWeight.Normal;
|
|
18982
|
+
var fontColor = ColorMap.transparent;
|
|
18983
|
+
var backgroundColor = ColorMap.transparent;
|
|
18984
|
+
var backgroundOpacity = 128;
|
|
18985
|
+
return new WatermarkStyle(fontName, fontWeight, fontColor, fontSize, backgroundColor, backgroundOpacity, paddingTop, paddingBottom, position, scale, true);
|
|
18986
|
+
}
|
|
18987
|
+
else { // [字体]$[文字样式]$[文字颜色]$[文字大小]$[背景颜色]$[水印位置]$[背景不透明度]$[上下padding]*#*[水印内容]
|
|
18988
|
+
var fontName = styleParts[0] + ', ' + getHeitiFontFamily();
|
|
18989
|
+
var fontWeight = WatermarkFontWeight.Normal;
|
|
18990
|
+
if (styleParts[1]) {
|
|
18991
|
+
fontWeight = styleParts[1];
|
|
18992
|
+
}
|
|
18993
|
+
var fontColor = ColorMap.white;
|
|
18994
|
+
if (styleParts[2]) {
|
|
18995
|
+
var color = getColorValue(styleParts[2]);
|
|
18996
|
+
if (color) {
|
|
18997
|
+
fontColor = color;
|
|
18998
|
+
}
|
|
18999
|
+
}
|
|
19000
|
+
var fontSize = Math.round(DEFAULT_FONT_SIZE * scale);
|
|
19001
|
+
if (styleParts[3]) {
|
|
19002
|
+
fontSize = Math.round(parseDecimal(styleParts[3], DEFAULT_FONT_SIZE) * scale);
|
|
19003
|
+
}
|
|
19004
|
+
var backgroundColor = ColorMap.blue;
|
|
19005
|
+
if (styleParts[4]) {
|
|
19006
|
+
var color = getColorValue(styleParts[4]);
|
|
19007
|
+
if (color) {
|
|
19008
|
+
backgroundColor = color;
|
|
19009
|
+
}
|
|
19010
|
+
}
|
|
19011
|
+
var position = WatermarkPosition.LeftTop;
|
|
19012
|
+
if (styleParts[5]) {
|
|
19013
|
+
position = styleParts[5];
|
|
19014
|
+
}
|
|
19015
|
+
var backgroundOpacity = 255;
|
|
19016
|
+
if (styleParts[6]) {
|
|
19017
|
+
var opacity = parseInteger(styleParts[6], DEFAULT_BACKGROUND_OPACITY);
|
|
19018
|
+
opacity = clamp(opacity, 0, 255);
|
|
19019
|
+
backgroundOpacity = opacity;
|
|
19020
|
+
}
|
|
19021
|
+
var paddingTop = DEFAULT_PADDING * scale;
|
|
19022
|
+
var paddingBottom = DEFAULT_PADDING * scale;
|
|
19023
|
+
if (styleParts[7]) {
|
|
19024
|
+
var paddingParts = styleParts[7].split("_");
|
|
19025
|
+
paddingTop = parseInteger(paddingParts[0], DEFAULT_PADDING) * scale;
|
|
19026
|
+
if (paddingParts[1]) {
|
|
19027
|
+
paddingBottom = parseInteger(paddingParts[1], DEFAULT_PADDING) * scale;
|
|
19028
|
+
}
|
|
19029
|
+
}
|
|
19030
|
+
return new WatermarkStyle(fontName, fontWeight, fontColor, fontSize, backgroundColor, backgroundOpacity, paddingTop, paddingBottom, position, scale, false);
|
|
19031
|
+
}
|
|
19032
|
+
}
|
|
19033
|
+
/**
|
|
19034
|
+
* A JavaScript Scanner like Java's
|
|
19035
|
+
* @see java.util.Scanner
|
|
19036
|
+
*/
|
|
19037
|
+
var watermark_TextScanner = /** @class */ (function () {
|
|
19038
|
+
/**
|
|
19039
|
+
* The content to scan
|
|
19040
|
+
* @param text
|
|
19041
|
+
*/
|
|
19042
|
+
function TextScanner(text) {
|
|
19043
|
+
this.text = text;
|
|
19044
|
+
this.cursor = 0;
|
|
19045
|
+
}
|
|
19046
|
+
TextScanner.prototype.hasNext = function (obj) {
|
|
19047
|
+
if (checkIsUndefinedOrNull(obj)) {
|
|
19048
|
+
return this.cursor < this.text.length;
|
|
19049
|
+
}
|
|
19050
|
+
else if (checkIsString(obj)) {
|
|
19051
|
+
var str = obj;
|
|
19052
|
+
var current = subString(this.text, this.cursor, str.length);
|
|
19053
|
+
if (current === str) {
|
|
19054
|
+
return true;
|
|
19055
|
+
}
|
|
19056
|
+
}
|
|
19057
|
+
else if (checkIsRegExp(obj)) {
|
|
19058
|
+
var regex = obj;
|
|
19059
|
+
var subText = subString(this.text, this.cursor);
|
|
19060
|
+
var matchResults = subText.match(regex);
|
|
19061
|
+
if (matchResults) {
|
|
19062
|
+
if (matchResults.index === 0) {
|
|
19063
|
+
return true;
|
|
19064
|
+
}
|
|
19065
|
+
}
|
|
19066
|
+
}
|
|
19067
|
+
return false;
|
|
19068
|
+
};
|
|
19069
|
+
TextScanner.prototype.next = function (obj) {
|
|
19070
|
+
if (checkIsUndefinedOrNull(obj)) {
|
|
19071
|
+
return subString(this.text, this.cursor, 1);
|
|
19072
|
+
}
|
|
19073
|
+
else if (checkIsString(obj)) {
|
|
19074
|
+
var str = obj;
|
|
19075
|
+
if (subString(this.text, this.cursor, str.length) === str) {
|
|
19076
|
+
return str;
|
|
19077
|
+
}
|
|
19078
|
+
}
|
|
19079
|
+
else if (checkIsRegExp(obj)) {
|
|
19080
|
+
var regex = obj;
|
|
19081
|
+
var subText = subString(this.text, this.cursor);
|
|
19082
|
+
var matchResults = subText.match(regex);
|
|
19083
|
+
if (matchResults) {
|
|
19084
|
+
if (matchResults.index === 0) {
|
|
19085
|
+
return matchResults;
|
|
19086
|
+
}
|
|
19087
|
+
}
|
|
19088
|
+
}
|
|
19089
|
+
return null;
|
|
19090
|
+
};
|
|
19091
|
+
TextScanner.prototype.skip = function (obj) {
|
|
19092
|
+
if (checkIsUndefinedOrNull(obj)) {
|
|
19093
|
+
this.cursor += 1;
|
|
19094
|
+
}
|
|
19095
|
+
else if (checkIsStringValid(obj)) {
|
|
19096
|
+
var str = obj;
|
|
19097
|
+
this.cursor += str.length;
|
|
19098
|
+
}
|
|
19099
|
+
return this;
|
|
19100
|
+
};
|
|
19101
|
+
return TextScanner;
|
|
19102
|
+
}());
|
|
19103
|
+
|
|
19104
|
+
function buildContent(contentConfigString, watermarkContext) {
|
|
19105
|
+
var content = "";
|
|
19106
|
+
var scanner = new watermark_TextScanner(contentConfigString);
|
|
19107
|
+
var steps = 0;
|
|
19108
|
+
while (scanner.hasNext() &&
|
|
19109
|
+
/* 防止scanner代码错误产生无限循环,设置一个最大scan步数*/
|
|
19110
|
+
steps < contentConfigString.length) {
|
|
19111
|
+
var dateRegex = new RegExp(WatermarkContent.Date);
|
|
19112
|
+
if (scanner.hasNext(dateRegex)) {
|
|
19113
|
+
var regexResult = scanner.next(dateRegex);
|
|
19114
|
+
if (regexResult) {
|
|
19115
|
+
var matchResults = regexResult;
|
|
19116
|
+
var format = date_FORMAT.FORMAT_YMD;
|
|
19117
|
+
if (matchResults && matchResults.length >= 2) {
|
|
19118
|
+
if (checkIsStringValid(matchResults[1])) {
|
|
19119
|
+
format = matchResults[1];
|
|
19120
|
+
}
|
|
19121
|
+
}
|
|
19122
|
+
content += date_formatDate(watermarkContext.watermarkTime, format);
|
|
19123
|
+
scanner.skip(matchResults.input);
|
|
19124
|
+
}
|
|
19125
|
+
}
|
|
19126
|
+
else if (scanner.hasNext(WatermarkContent.Time)) {
|
|
19127
|
+
var value = date_formatDate(watermarkContext.watermarkTime, date_FORMAT.FORMAT_HM);
|
|
19128
|
+
content += value;
|
|
19129
|
+
scanner.skip(WatermarkContent.Time);
|
|
19130
|
+
}
|
|
19131
|
+
else if (scanner.hasNext(WatermarkContent.Address)) {
|
|
19132
|
+
content += watermarkContext.address;
|
|
19133
|
+
scanner.skip(WatermarkContent.Address);
|
|
19134
|
+
}
|
|
19135
|
+
else if (scanner.hasNext(WatermarkContent.HumanName)) {
|
|
19136
|
+
content += watermarkContext.humanName;
|
|
19137
|
+
scanner.skip(WatermarkContent.HumanName);
|
|
19138
|
+
}
|
|
19139
|
+
else if (scanner.hasNext(WatermarkContent.ProjectName)) {
|
|
19140
|
+
content += watermarkContext.projectName;
|
|
19141
|
+
scanner.skip(WatermarkContent.ProjectName);
|
|
19142
|
+
}
|
|
19143
|
+
else if (scanner.hasNext(WatermarkContent.Logo)) {
|
|
19144
|
+
console.error("watermark logo ignored");
|
|
19145
|
+
scanner.skip(WatermarkContent.Logo);
|
|
19146
|
+
}
|
|
19147
|
+
else {
|
|
19148
|
+
var nextChar = scanner.next();
|
|
19149
|
+
// console.log(`next out "${nextChar}"`)
|
|
19150
|
+
if (checkIsString(nextChar)) {
|
|
19151
|
+
// console.log(`next in "${nextChar}"`)
|
|
19152
|
+
content += nextChar;
|
|
19153
|
+
}
|
|
19154
|
+
scanner.skip();
|
|
19155
|
+
}
|
|
19156
|
+
steps++;
|
|
19157
|
+
}
|
|
19158
|
+
return content;
|
|
19159
|
+
}
|
|
19160
|
+
function parseWatermarks(watermarkConfigString, canvasSize, watermarkContext) {
|
|
19161
|
+
var watermarks = [];
|
|
19162
|
+
var configStringArray = watermarkConfigString.split("###");
|
|
19163
|
+
for (var i = 0; i < configStringArray.length; i++) {
|
|
19164
|
+
var configString = configStringArray[i];
|
|
19165
|
+
//console.log('config string ' + configString);
|
|
19166
|
+
var configParts = configString.split("*#*");
|
|
19167
|
+
//console.log(JSON.stringify(configParts));
|
|
19168
|
+
if (configParts.length === 2) {
|
|
19169
|
+
var styleString = configParts[0];
|
|
19170
|
+
var contentString = configParts[1];
|
|
19171
|
+
var style = parseWatermarkStyle(styleString, canvasSize);
|
|
19172
|
+
var content = buildContent(contentString, watermarkContext);
|
|
19173
|
+
if (style && content) {
|
|
19174
|
+
var watermark = new Watermark(content, style);
|
|
19175
|
+
watermarks.push(watermark);
|
|
19176
|
+
}
|
|
19177
|
+
}
|
|
19178
|
+
}
|
|
19179
|
+
return watermarks;
|
|
19180
|
+
}
|
|
19181
|
+
/**
|
|
19182
|
+
* 画水印默认使用黑体
|
|
19183
|
+
* @see {@link https://www.zhihu.com/question/19911793|使用黑体}
|
|
19184
|
+
*/
|
|
19185
|
+
function getHeitiFontFamily() {
|
|
19186
|
+
if (checkIsAndroid()) {
|
|
19187
|
+
return "'Roboto Black', 'Droid Sans'";
|
|
19188
|
+
}
|
|
19189
|
+
else if (checkIsIOS()) {
|
|
19190
|
+
return "'PingFang SC Medium'";
|
|
19191
|
+
}
|
|
19192
|
+
else {
|
|
19193
|
+
return '"PingFang SC Medium", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';
|
|
19194
|
+
}
|
|
19195
|
+
}
|
|
19196
|
+
/**
|
|
19197
|
+
* 可以渲染的内容
|
|
19198
|
+
*/
|
|
19199
|
+
var Tile = /** @class */ (function () {
|
|
19200
|
+
function Tile(origin, size, lineHeight, lineWidths, lines, style) {
|
|
19201
|
+
this.origin = origin;
|
|
19202
|
+
this.size = size;
|
|
19203
|
+
this.lineHeight = lineHeight;
|
|
19204
|
+
this.lineWidths = lineWidths;
|
|
19205
|
+
this.lines = lines;
|
|
19206
|
+
this.style = style;
|
|
19207
|
+
}
|
|
19208
|
+
return Tile;
|
|
19209
|
+
}());
|
|
19210
|
+
function buildTile(canvas, content, style) {
|
|
19211
|
+
var origin = new Point(0, 0);
|
|
19212
|
+
var size = new Size(0, 0);
|
|
19213
|
+
var lines = [];
|
|
19214
|
+
var ctx = canvas.getContext("2d");
|
|
19215
|
+
if (!ctx) {
|
|
19216
|
+
return null;
|
|
19217
|
+
}
|
|
19218
|
+
ctx.font = style.fontWeight + " " + style.fontSize + "px " + style.fontName;
|
|
19219
|
+
var contentPadding = getCanvasScale(canvas, CONTENT_PADDING);
|
|
19220
|
+
var contentWidth = canvas.width - contentPadding * 2;
|
|
19221
|
+
// @see {@link https://stackoverflow.com/questions/1134586/how-can-you-find-the-height-of-text-on-an-html-canvas}
|
|
19222
|
+
var lineHeight = ctx.measureText('M').width;
|
|
19223
|
+
var lineWidths = [];
|
|
19224
|
+
// content超过宽度就换行
|
|
19225
|
+
var temp = "";
|
|
19226
|
+
var lastWidth = 0;
|
|
19227
|
+
for (var i = 0; i < content.length; i++) {
|
|
19228
|
+
var lineWidth = ctx.measureText(temp).width;
|
|
19229
|
+
if (lineWidth >= contentWidth) {
|
|
19230
|
+
lines.push(temp);
|
|
19231
|
+
lineWidths.push(lineWidth);
|
|
19232
|
+
temp = "";
|
|
19233
|
+
}
|
|
19234
|
+
lastWidth = lineWidth;
|
|
19235
|
+
temp += content[i];
|
|
19236
|
+
}
|
|
19237
|
+
lines.push(temp);
|
|
19238
|
+
lineWidths.push(lastWidth);
|
|
19239
|
+
size.width = contentWidth;
|
|
19240
|
+
size.height = lines.length * lineHeight;
|
|
19241
|
+
return new Tile(origin, size, lineHeight, lineWidths, lines, style);
|
|
19242
|
+
}
|
|
19243
|
+
/**
|
|
19244
|
+
* 画文字,默认{@link https://stackoverflow.com/questions/43242709/how-can-i-draw-text-that-looks-embossed-using-kinetic-js-and-canvas|浮雕效果}
|
|
19245
|
+
* @param canvas
|
|
19246
|
+
* @param text
|
|
19247
|
+
*/
|
|
19248
|
+
// function getEmbossTextImageData(text: string, size: Size): ImageData | null {
|
|
19249
|
+
// // constants
|
|
19250
|
+
// const canvas = document.createElement('canvas');
|
|
19251
|
+
// document.body.appendChild(canvas);
|
|
19252
|
+
// const ctx = canvas.getContext("2d");
|
|
19253
|
+
// if (!ctx) {
|
|
19254
|
+
// return null
|
|
19255
|
+
// }
|
|
19256
|
+
//
|
|
19257
|
+
// canvas.width = size.width;
|
|
19258
|
+
// canvas.height = size.height;
|
|
19259
|
+
//
|
|
19260
|
+
// // constants
|
|
19261
|
+
// const blur = 2;
|
|
19262
|
+
// const highLight = "rgba(100,190,256,0.75)";
|
|
19263
|
+
// const shadow = "rgba(0,0,0,0.65)";
|
|
19264
|
+
// const font = "84px arial black";
|
|
19265
|
+
// const background = "linear-gradient(to right, #1e5799 0%,#3096e5 100%)";
|
|
19266
|
+
// const border = "2px solid #6CF"
|
|
19267
|
+
//
|
|
19268
|
+
// // create canvas add styles and put on page
|
|
19269
|
+
//
|
|
19270
|
+
// const w = (canvas.width = innerWidth - 24) / 2; // set size and get centers
|
|
19271
|
+
// const h = (canvas.height = innerHeight - 24) / 2;
|
|
19272
|
+
// canvas.style.background = background;
|
|
19273
|
+
// canvas.style.border = border;
|
|
19274
|
+
//
|
|
19275
|
+
//
|
|
19276
|
+
// // set up font and font rendering alignment
|
|
19277
|
+
// ctx.font = font;
|
|
19278
|
+
// ctx.textAlign = "center";
|
|
19279
|
+
// ctx.textBaseline = "middle";
|
|
19280
|
+
//
|
|
19281
|
+
// // draw dark shadow
|
|
19282
|
+
// ctx.shadowBlur = blur; // shadow
|
|
19283
|
+
// ctx.fillStyle = ctx.shadowColor = shadow;
|
|
19284
|
+
// ctx.shadowOffsetY = ctx.shadowOffsetX = blur;
|
|
19285
|
+
// ctx.fillText(text, w, h);
|
|
19286
|
+
//
|
|
19287
|
+
// // draw highLight
|
|
19288
|
+
// ctx.fillStyle = ctx.shadowColor = highLight;
|
|
19289
|
+
// ctx.shadowOffsetY = ctx.shadowOffsetX = -blur;
|
|
19290
|
+
// ctx.fillText(text, w, h);
|
|
19291
|
+
//
|
|
19292
|
+
// // draw center text that removes pixels
|
|
19293
|
+
// ctx.shadowColor = "rgba(0,0,0,0.0)"; // turn off shadow
|
|
19294
|
+
// ctx.fillStyle = "black";
|
|
19295
|
+
// ctx.globalCompositeOperation = "destination-out"; // New pixels will remove old pixels making them transparent
|
|
19296
|
+
// ctx.fillText(text, w, h);
|
|
19297
|
+
// ctx.globalCompositeOperation = "source-over"; // restore default composite operation.
|
|
19298
|
+
//
|
|
19299
|
+
// return ctx.getImageData(0, 0, size.width, size.height)
|
|
19300
|
+
// }
|
|
19301
|
+
function getAxisPoint(canvasWidth, origin, style) {
|
|
19302
|
+
var padding = (CONTENT_PADDING + DEFAULT_PADDING) * style.scale;
|
|
19303
|
+
var axisPoint = new Point(padding, origin.y);
|
|
19304
|
+
if (style.position.startsWith("center")) {
|
|
19305
|
+
axisPoint = new Point(canvasWidth / 2, origin.y);
|
|
19306
|
+
}
|
|
19307
|
+
else if (style.position.startsWith("right")) {
|
|
19308
|
+
axisPoint = new Point(canvasWidth - padding, origin.y);
|
|
19309
|
+
}
|
|
19310
|
+
return axisPoint;
|
|
19311
|
+
}
|
|
19312
|
+
function getTextAlign(style) {
|
|
19313
|
+
var align = "left";
|
|
19314
|
+
if (style.position.startsWith("center")) {
|
|
19315
|
+
align = "center";
|
|
19316
|
+
}
|
|
19317
|
+
else if (style.position.startsWith("right")) {
|
|
19318
|
+
align = "right";
|
|
19319
|
+
}
|
|
19320
|
+
return align;
|
|
19321
|
+
}
|
|
19322
|
+
function drawLine(canvas, line, origin, style) {
|
|
19323
|
+
var ctx = canvas.getContext("2d");
|
|
19324
|
+
if (!ctx) {
|
|
19325
|
+
return;
|
|
19326
|
+
}
|
|
19327
|
+
/**
|
|
19328
|
+
* The fillText's second argument is the Y coordinate for the baseline of the text (the default textBaseline is "alphabetic") ,
|
|
19329
|
+
* so the text is being drawn above the visible canvas element when you use 0.
|
|
19330
|
+
* @see {@link https://stackoverflow.com/questions/14289331/html5-canvas-doesnt-fill-text-at-coordinates-0-0}
|
|
19331
|
+
*/
|
|
19332
|
+
ctx.textBaseline = "top";
|
|
19333
|
+
ctx.font = style.fontWeight + " " + style.fontSize + "px " + style.fontName;
|
|
19334
|
+
var axisPoint = getAxisPoint(canvas.width, origin, style);
|
|
19335
|
+
ctx.textAlign = getTextAlign(style);
|
|
19336
|
+
if (style.simplified) {
|
|
19337
|
+
ctx.shadowBlur = 4; // shadow
|
|
19338
|
+
// ctx.shadowColor = "rgba(220,220,220,0.75)";
|
|
19339
|
+
ctx.shadowColor = "rgba(0, 0, 0, 0.5)";
|
|
19340
|
+
var offset = clamp(style.fontSize / 40, 2, 4);
|
|
19341
|
+
ctx.shadowOffsetY = offset;
|
|
19342
|
+
ctx.shadowOffsetX = offset;
|
|
19343
|
+
ctx.fillStyle = "rgba(255,255,255, 0.5)";
|
|
19344
|
+
}
|
|
19345
|
+
else {
|
|
19346
|
+
ctx.fillStyle = style.fontColor;
|
|
19347
|
+
}
|
|
19348
|
+
ctx.fillText(line, Math.round(axisPoint.x), Math.round(axisPoint.y));
|
|
19349
|
+
}
|
|
19350
|
+
function hexToRGB(hex, alpha) {
|
|
19351
|
+
var r = parseInt(hex.slice(1, 3), 16), g = parseInt(hex.slice(3, 5), 16), b = parseInt(hex.slice(5, 7), 16);
|
|
19352
|
+
if (alpha) {
|
|
19353
|
+
return "rgba(" + r + ", " + g + ", " + b + ", " + alpha + ")";
|
|
19354
|
+
}
|
|
19355
|
+
else {
|
|
19356
|
+
return "rgb(" + r + ", " + g + ", " + b + ")";
|
|
19357
|
+
}
|
|
19358
|
+
}
|
|
19359
|
+
function drawBackground(canvas, tile) {
|
|
19360
|
+
var ctx = canvas.getContext("2d");
|
|
19361
|
+
if (!ctx) {
|
|
19362
|
+
return;
|
|
19363
|
+
}
|
|
19364
|
+
var backgroundColor = tile.style.backgroundColor;
|
|
19365
|
+
var backgroundOpacity = parseDecimal(String(tile.style.backgroundOpacity), -1);
|
|
19366
|
+
if (backgroundOpacity > 255) {
|
|
19367
|
+
backgroundOpacity = 255;
|
|
19368
|
+
}
|
|
19369
|
+
var paddingTop = 2;
|
|
19370
|
+
var paddingBottom = 10;
|
|
19371
|
+
if (backgroundColor !== 'transparent') {
|
|
19372
|
+
if (backgroundColor.startsWith("#") && backgroundOpacity >= 0) {
|
|
19373
|
+
backgroundColor = hexToRGB(backgroundColor, backgroundOpacity / 255.0);
|
|
19374
|
+
}
|
|
19375
|
+
ctx.fillStyle = backgroundColor;
|
|
19376
|
+
var style = tile.style;
|
|
19377
|
+
var padding = (CONTENT_PADDING + DEFAULT_PADDING) * style.scale;
|
|
19378
|
+
var paddingScale = tile.style.fontSize / DEFAULT_FONT_SIZE;
|
|
19379
|
+
for (var j = 0; j < tile.lineWidths.length; j++) {
|
|
19380
|
+
var lineHeight = tile.lineHeight;
|
|
19381
|
+
var lineWidth = tile.lineWidths[j];
|
|
19382
|
+
var paddingRight = 30 * paddingScale;
|
|
19383
|
+
var paddingLeft = 10 * paddingScale;
|
|
19384
|
+
var axisPoint = new Point(padding - paddingLeft, tile.origin.y);
|
|
19385
|
+
if (style.position.startsWith("center")) {
|
|
19386
|
+
paddingLeft = 20 * paddingScale;
|
|
19387
|
+
paddingRight = 20 * paddingScale;
|
|
19388
|
+
axisPoint = new Point((canvas.width - lineWidth) / 2 - paddingLeft, tile.origin.y);
|
|
19389
|
+
}
|
|
19390
|
+
else if (style.position.startsWith("right")) {
|
|
19391
|
+
paddingLeft = 30 * paddingScale;
|
|
19392
|
+
paddingRight = 10 * paddingScale;
|
|
19393
|
+
axisPoint = new Point(canvas.width - lineWidth - padding - paddingLeft, tile.origin.y);
|
|
19394
|
+
}
|
|
19395
|
+
// padding top
|
|
19396
|
+
if (j === 0) {
|
|
19397
|
+
ctx.fillRect(axisPoint.x, (axisPoint.y - paddingTop > 0) ? (axisPoint.y - paddingTop) : 0, paddingLeft + lineWidth + paddingRight, paddingTop);
|
|
19398
|
+
}
|
|
19399
|
+
ctx.fillRect(axisPoint.x, axisPoint.y + j * lineHeight, paddingLeft + lineWidth + paddingRight, lineHeight);
|
|
19400
|
+
// padding bottom
|
|
19401
|
+
if (j === tile.lineWidths.length - 1) {
|
|
19402
|
+
ctx.fillRect(axisPoint.x, axisPoint.y + (j + 1) * lineHeight, paddingLeft + lineWidth + paddingRight, paddingBottom);
|
|
19403
|
+
}
|
|
19404
|
+
}
|
|
19405
|
+
}
|
|
19406
|
+
}
|
|
19407
|
+
function drawTile(canvas, tile) {
|
|
19408
|
+
if (!tile.style.simplified) { // 复杂配置绘制背景颜色
|
|
19409
|
+
drawBackground(canvas, tile);
|
|
19410
|
+
}
|
|
19411
|
+
for (var i = 0; i < tile.lines.length; i++) {
|
|
19412
|
+
var origin_1 = new Point(tile.origin.x, i * tile.lineHeight + tile.origin.y);
|
|
19413
|
+
drawLine(canvas, tile.lines[i], origin_1, tile.style);
|
|
19414
|
+
}
|
|
19415
|
+
}
|
|
19416
|
+
function getCanvasScale(canvas, len) {
|
|
19417
|
+
var min = Math.min(canvas.width, canvas.height);
|
|
19418
|
+
return min / DEFAULT_CANVAS_SIZE * len;
|
|
19419
|
+
}
|
|
19420
|
+
var GroupPosition;
|
|
19421
|
+
(function (GroupPosition) {
|
|
19422
|
+
GroupPosition["Top"] = "top";
|
|
19423
|
+
GroupPosition["Center"] = "center";
|
|
19424
|
+
GroupPosition["Bottom"] = "bottom";
|
|
19425
|
+
})(GroupPosition || (GroupPosition = {}));
|
|
19426
|
+
function drawGroupedWatermarks(canvas, watermarks, groupPosition) {
|
|
19427
|
+
if (!watermarks || watermarks.length === 0) {
|
|
19428
|
+
return;
|
|
19429
|
+
}
|
|
19430
|
+
var tiles = [];
|
|
19431
|
+
//NOTE: 每个watermark 都占满整个宽度,一行只放一个watermark
|
|
19432
|
+
var totalHeight = 0;
|
|
19433
|
+
for (var i = 0; i < watermarks.length; i++) {
|
|
19434
|
+
var watermark = watermarks[i];
|
|
19435
|
+
var tile = buildTile(canvas, watermark.content, watermark.style);
|
|
19436
|
+
if (tile) {
|
|
19437
|
+
tiles.push(tile);
|
|
19438
|
+
totalHeight += tile.size.height;
|
|
19439
|
+
}
|
|
19440
|
+
}
|
|
19441
|
+
if (totalHeight <= 0) {
|
|
19442
|
+
// no need draw
|
|
19443
|
+
console.error('watermarks height ' + totalHeight);
|
|
19444
|
+
console.error(JSON.stringify(watermarks));
|
|
19445
|
+
return;
|
|
19446
|
+
}
|
|
19447
|
+
var contentPadding = getCanvasScale(canvas, CONTENT_PADDING);
|
|
19448
|
+
var baseOrigin = new Point(contentPadding, contentPadding);
|
|
19449
|
+
if (groupPosition === GroupPosition.Center) {
|
|
19450
|
+
baseOrigin = new Point(contentPadding, Math.round((canvas.height - totalHeight) / 2));
|
|
19451
|
+
}
|
|
19452
|
+
else if (groupPosition === GroupPosition.Bottom) {
|
|
19453
|
+
baseOrigin = new Point(contentPadding, canvas.height - totalHeight - contentPadding);
|
|
19454
|
+
}
|
|
19455
|
+
else if (groupPosition === GroupPosition.Top) {
|
|
19456
|
+
baseOrigin = new Point(contentPadding, contentPadding);
|
|
19457
|
+
}
|
|
19458
|
+
// update all the tiles' origin
|
|
19459
|
+
var lastMarginTop = 0;
|
|
19460
|
+
for (var i = 0; i < tiles.length; i++) {
|
|
19461
|
+
var tile = tiles[i];
|
|
19462
|
+
lastMarginTop += tile.style.paddingTop;
|
|
19463
|
+
tile.origin = new Point(tile.origin.x + baseOrigin.x, lastMarginTop + baseOrigin.y);
|
|
19464
|
+
lastMarginTop += tile.size.height;
|
|
19465
|
+
lastMarginTop += tile.style.paddingBottom;
|
|
19466
|
+
}
|
|
19467
|
+
// draw all tiles
|
|
19468
|
+
for (var i = 0; i < tiles.length; i++) {
|
|
19469
|
+
var tile = tiles[i];
|
|
19470
|
+
drawTile(canvas, tile);
|
|
19471
|
+
}
|
|
19472
|
+
}
|
|
19700
19473
|
/**
|
|
19701
19474
|
* 把watermark 分为 上、中、三组
|
|
19702
19475
|
* @param watermarks
|
|
19703
|
-
*/
|
|
19704
|
-
|
|
19705
|
-
|
|
19706
|
-
|
|
19707
|
-
|
|
19708
|
-
|
|
19709
|
-
|
|
19710
|
-
|
|
19711
|
-
|
|
19712
|
-
|
|
19713
|
-
|
|
19714
|
-
|
|
19715
|
-
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
|
|
19719
|
-
|
|
19720
|
-
}
|
|
19721
|
-
|
|
19722
|
-
|
|
19723
|
-
|
|
19724
|
-
|
|
19725
|
-
|
|
19726
|
-
}
|
|
19727
|
-
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
|
|
19733
|
-
|
|
19734
|
-
|
|
19735
|
-
|
|
19736
|
-
|
|
19737
|
-
|
|
19738
|
-
|
|
19739
|
-
|
|
19740
|
-
|
|
19741
|
-
|
|
19742
|
-
|
|
19743
|
-
|
|
19744
|
-
|
|
19745
|
-
|
|
19746
|
-
|
|
19747
|
-
|
|
19748
|
-
|
|
19749
|
-
|
|
19750
|
-
|
|
19751
|
-
|
|
19752
|
-
|
|
19753
|
-
|
|
19754
|
-
|
|
19755
|
-
|
|
19756
|
-
|
|
19757
|
-
|
|
19758
|
-
|
|
19759
|
-
|
|
19760
|
-
|
|
19761
|
-
|
|
19762
|
-
|
|
19763
|
-
|
|
19764
|
-
|
|
19765
|
-
|
|
19766
|
-
|
|
19767
|
-
return false;
|
|
19768
|
-
}
|
|
19769
|
-
}
|
|
19770
|
-
}
|
|
19771
|
-
|
|
19772
|
-
return true;
|
|
19773
|
-
}
|
|
19476
|
+
*/
|
|
19477
|
+
function groupingWatermarks(watermarks) {
|
|
19478
|
+
var _a;
|
|
19479
|
+
var topList = [];
|
|
19480
|
+
var centerList = [];
|
|
19481
|
+
var bottomList = [];
|
|
19482
|
+
for (var i = 0; i < watermarks.length; i++) {
|
|
19483
|
+
var watermark = watermarks[i];
|
|
19484
|
+
if (watermark.style.position.endsWith("top")) {
|
|
19485
|
+
topList.push(watermark);
|
|
19486
|
+
}
|
|
19487
|
+
else if (watermark.style.position.endsWith("center")) {
|
|
19488
|
+
centerList.push(watermark);
|
|
19489
|
+
}
|
|
19490
|
+
else if (watermark.style.position.endsWith("bottom")) {
|
|
19491
|
+
bottomList.push(watermark);
|
|
19492
|
+
}
|
|
19493
|
+
}
|
|
19494
|
+
return _a = {},
|
|
19495
|
+
_a[GroupPosition.Top] = topList,
|
|
19496
|
+
_a[GroupPosition.Center] = centerList,
|
|
19497
|
+
_a[GroupPosition.Bottom] = bottomList,
|
|
19498
|
+
_a;
|
|
19499
|
+
}
|
|
19500
|
+
function renderWatermark(canvas, options) {
|
|
19501
|
+
// console.log("canvas width " + canvas.width);
|
|
19502
|
+
// console.log("canvas height " + canvas.height);
|
|
19503
|
+
if (!options.enabled || options.watermarkConfigString === "no") {
|
|
19504
|
+
return Promise.resolve(canvas);
|
|
19505
|
+
}
|
|
19506
|
+
var watermarkConfigString = options.watermarkConfigString;
|
|
19507
|
+
if (watermarkConfigString === "default") {
|
|
19508
|
+
watermarkConfigString = "50$lefttop$50*#*time###25$lefttop*#*date";
|
|
19509
|
+
}
|
|
19510
|
+
var watermarks = parseWatermarks(watermarkConfigString, new Size(canvas.width, canvas.height), options.context);
|
|
19511
|
+
var groupedWatermarks = groupingWatermarks(watermarks);
|
|
19512
|
+
drawGroupedWatermarks(canvas, groupedWatermarks[GroupPosition.Top], GroupPosition.Top);
|
|
19513
|
+
drawGroupedWatermarks(canvas, groupedWatermarks[GroupPosition.Center], GroupPosition.Center);
|
|
19514
|
+
drawGroupedWatermarks(canvas, groupedWatermarks[GroupPosition.Bottom], GroupPosition.Bottom);
|
|
19515
|
+
return Promise.resolve(canvas);
|
|
19516
|
+
}
|
|
19517
|
+
function checkWatermarkConfigSupported(watermarkConfigString) {
|
|
19518
|
+
if (watermarkConfigString.indexOf("{logo}") > -1) {
|
|
19519
|
+
console.error("水印不支持logo");
|
|
19520
|
+
return false;
|
|
19521
|
+
}
|
|
19522
|
+
var configStringArray = watermarkConfigString.split("###");
|
|
19523
|
+
for (var i = 0; i < configStringArray.length; i++) {
|
|
19524
|
+
var configString = configStringArray[i];
|
|
19525
|
+
//console.log('config string ' + configString);
|
|
19526
|
+
var configParts = configString.split("*#*");
|
|
19527
|
+
//console.log(JSON.stringify(configParts));
|
|
19528
|
+
if (configParts.length === 2) {
|
|
19529
|
+
var styleString = configParts[0];
|
|
19530
|
+
var styleParts = styleString.split("$");
|
|
19531
|
+
if (styleParts.length <= 0) {
|
|
19532
|
+
console.error("水印配置不合法");
|
|
19533
|
+
return false;
|
|
19534
|
+
}
|
|
19535
|
+
}
|
|
19536
|
+
}
|
|
19537
|
+
return true;
|
|
19538
|
+
}
|
|
19539
|
+
//# sourceMappingURL=watermark.js.map
|
|
19774
19540
|
// CONCATENATED MODULE: ./node_modules/@egova/media/lib/image-util.js
|
|
19775
19541
|
/**
|
|
19776
19542
|
* Convert File to data schema url
|
|
19777
19543
|
* @param file
|
|
19778
|
-
*/
|
|
19779
|
-
function file2DataURL(file) {
|
|
19780
|
-
|
|
19781
|
-
|
|
19782
|
-
|
|
19783
|
-
|
|
19784
|
-
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
|
|
19792
|
-
|
|
19793
|
-
}
|
|
19544
|
+
*/
|
|
19545
|
+
function file2DataURL(file) {
|
|
19546
|
+
return new Promise(function (resolve, reject) {
|
|
19547
|
+
var a = new FileReader();
|
|
19548
|
+
a.onload = function (res) {
|
|
19549
|
+
if (res && res.target) {
|
|
19550
|
+
resolve(res.target.result);
|
|
19551
|
+
}
|
|
19552
|
+
else {
|
|
19553
|
+
reject(new Error('读取文件url失败'));
|
|
19554
|
+
}
|
|
19555
|
+
};
|
|
19556
|
+
a.readAsDataURL(file);
|
|
19557
|
+
});
|
|
19558
|
+
}
|
|
19794
19559
|
/**
|
|
19795
19560
|
* Convert file to image
|
|
19796
19561
|
* @param file
|
|
19797
|
-
*/
|
|
19798
|
-
|
|
19799
|
-
function
|
|
19800
|
-
|
|
19801
|
-
|
|
19802
|
-
|
|
19803
|
-
|
|
19804
|
-
|
|
19805
|
-
|
|
19806
|
-
|
|
19807
|
-
|
|
19808
|
-
|
|
19809
|
-
|
|
19810
|
-
|
|
19811
|
-
|
|
19812
|
-
})
|
|
19813
|
-
|
|
19814
|
-
|
|
19815
|
-
|
|
19816
|
-
|
|
19817
|
-
type
|
|
19818
|
-
|
|
19819
|
-
|
|
19820
|
-
|
|
19821
|
-
quality = 0.8;
|
|
19822
|
-
}
|
|
19823
|
-
|
|
19824
|
-
return image2Canvas(img, type).then(function (canvas) {
|
|
19825
|
-
return canvas2File(canvas, fileName, lastModified, type, quality);
|
|
19826
|
-
});
|
|
19827
|
-
}
|
|
19562
|
+
*/
|
|
19563
|
+
function file2Image(file) {
|
|
19564
|
+
return new Promise(function (resolve, reject) {
|
|
19565
|
+
file2DataURL(file).then(function (url) {
|
|
19566
|
+
var img = new Image();
|
|
19567
|
+
img.src = url;
|
|
19568
|
+
img.onload = function (e) {
|
|
19569
|
+
if (img.complete) {
|
|
19570
|
+
resolve(img);
|
|
19571
|
+
}
|
|
19572
|
+
else {
|
|
19573
|
+
reject(new Error('文件加载失败'));
|
|
19574
|
+
}
|
|
19575
|
+
};
|
|
19576
|
+
}).catch(reject);
|
|
19577
|
+
});
|
|
19578
|
+
}
|
|
19579
|
+
function image2file(img, fileName, lastModified, type, quality) {
|
|
19580
|
+
if (type === void 0) { type = "image/jpeg"; }
|
|
19581
|
+
if (quality === void 0) { quality = 0.8; }
|
|
19582
|
+
return image2Canvas(img, type).then(function (canvas) {
|
|
19583
|
+
return canvas2File(canvas, fileName, lastModified, type, quality);
|
|
19584
|
+
});
|
|
19585
|
+
}
|
|
19828
19586
|
/**
|
|
19829
19587
|
* Draw image on canvas
|
|
19830
19588
|
* @param img
|
|
19831
19589
|
* @param width
|
|
19832
19590
|
* @param height
|
|
19833
|
-
*/
|
|
19834
|
-
|
|
19835
|
-
|
|
19836
|
-
|
|
19837
|
-
|
|
19838
|
-
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
|
|
19842
|
-
|
|
19843
|
-
height =
|
|
19844
|
-
|
|
19845
|
-
|
|
19846
|
-
|
|
19847
|
-
|
|
19848
|
-
|
|
19849
|
-
|
|
19850
|
-
|
|
19851
|
-
|
|
19852
|
-
|
|
19853
|
-
|
|
19854
|
-
|
|
19855
|
-
|
|
19856
|
-
}
|
|
19857
|
-
|
|
19858
|
-
ctx.drawImage(img, 0, 0, width, height);
|
|
19859
|
-
return Promise.resolve(canvas);
|
|
19860
|
-
} else {
|
|
19861
|
-
return Promise.reject(null);
|
|
19862
|
-
}
|
|
19863
|
-
}
|
|
19591
|
+
*/
|
|
19592
|
+
function image2Canvas(img, type, width, height) {
|
|
19593
|
+
var canvas = document.createElement('canvas');
|
|
19594
|
+
if (!width) {
|
|
19595
|
+
width = img.width;
|
|
19596
|
+
}
|
|
19597
|
+
if (!height) {
|
|
19598
|
+
height = img.height;
|
|
19599
|
+
}
|
|
19600
|
+
canvas.width = width;
|
|
19601
|
+
canvas.height = height;
|
|
19602
|
+
var ctx = canvas.getContext('2d');
|
|
19603
|
+
if (ctx) {
|
|
19604
|
+
// png经canvas.toDataURL转换后背景变成黑色,这里提前填充白色
|
|
19605
|
+
ctx.fillStyle = 'transparent';
|
|
19606
|
+
if (type === 'image/jpeg') {
|
|
19607
|
+
ctx.fillStyle = '#fff';
|
|
19608
|
+
}
|
|
19609
|
+
ctx.drawImage(img, 0, 0, width, height);
|
|
19610
|
+
return Promise.resolve(canvas);
|
|
19611
|
+
}
|
|
19612
|
+
else {
|
|
19613
|
+
return Promise.reject(null);
|
|
19614
|
+
}
|
|
19615
|
+
}
|
|
19864
19616
|
/**
|
|
19865
19617
|
* Export Image from canvas
|
|
19866
19618
|
* @param canvas
|
|
19867
19619
|
* @param type
|
|
19868
19620
|
* @param quality
|
|
19869
19621
|
* @see {@link https://meshworld.in/convert-canvas-to-an-image-using-javascript/}
|
|
19870
|
-
*/
|
|
19871
|
-
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19876
|
-
|
|
19877
|
-
|
|
19878
|
-
quality = 0.8;
|
|
19879
|
-
}
|
|
19880
|
-
|
|
19881
|
-
var image = new Image();
|
|
19882
|
-
image.src = canvas.toDataURL(type, quality);
|
|
19883
|
-
return Promise.resolve(image);
|
|
19884
|
-
}
|
|
19622
|
+
*/
|
|
19623
|
+
function canvas2Image(canvas, type, quality) {
|
|
19624
|
+
if (type === void 0) { type = "image/jpeg"; }
|
|
19625
|
+
if (quality === void 0) { quality = 0.8; }
|
|
19626
|
+
var image = new Image();
|
|
19627
|
+
image.src = canvas.toDataURL(type, quality);
|
|
19628
|
+
return Promise.resolve(image);
|
|
19629
|
+
}
|
|
19885
19630
|
/**
|
|
19886
19631
|
* Export File from canvas
|
|
19887
19632
|
* @param canvas
|
|
@@ -19890,33 +19635,24 @@ function canvas2Image(canvas, type, quality) {
|
|
|
19890
19635
|
* @param type
|
|
19891
19636
|
* @param quality
|
|
19892
19637
|
* @see {@link https://meshworld.in/convert-canvas-to-an-image-using-javascript/}
|
|
19893
|
-
*/
|
|
19894
|
-
|
|
19895
|
-
|
|
19896
|
-
|
|
19897
|
-
|
|
19898
|
-
|
|
19899
|
-
|
|
19900
|
-
|
|
19901
|
-
|
|
19902
|
-
|
|
19903
|
-
|
|
19904
|
-
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
-
|
|
19908
|
-
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
type: type
|
|
19912
|
-
}); // console.log("file size " + file.size / 1024 + "kb");
|
|
19913
|
-
// console.log(file)
|
|
19914
|
-
|
|
19915
|
-
resolve(file);
|
|
19916
|
-
}
|
|
19917
|
-
}, type, quality);
|
|
19918
|
-
});
|
|
19919
|
-
}
|
|
19638
|
+
*/
|
|
19639
|
+
function canvas2File(canvas, fileName, lastModified, type, quality) {
|
|
19640
|
+
if (type === void 0) { type = "image/jpeg"; }
|
|
19641
|
+
if (quality === void 0) { quality = 0.8; }
|
|
19642
|
+
return new Promise(function (resolve, reject) {
|
|
19643
|
+
canvas.toBlob(function (blob) {
|
|
19644
|
+
if (!blob) {
|
|
19645
|
+
reject(new Error('canvas文件导出失败'));
|
|
19646
|
+
}
|
|
19647
|
+
else {
|
|
19648
|
+
var file = new File([blob], fileName, { lastModified: lastModified, type: type });
|
|
19649
|
+
// console.log("file size " + file.size / 1024 + "kb");
|
|
19650
|
+
// console.log(file)
|
|
19651
|
+
resolve(file);
|
|
19652
|
+
}
|
|
19653
|
+
}, type, quality);
|
|
19654
|
+
});
|
|
19655
|
+
}
|
|
19920
19656
|
/**
|
|
19921
19657
|
* 缩放图片
|
|
19922
19658
|
* @param img:HTMLImageElement 图片对象
|
|
@@ -19927,162 +19663,138 @@ function canvas2File(canvas, fileName, lastModified, type, quality) {
|
|
|
19927
19663
|
* @param sideLengthLimit 图片边长限制
|
|
19928
19664
|
* @param baseOnShortSide 是否以短边为限制
|
|
19929
19665
|
* @param resultType: ResizeResultType, "image" | "canvas"
|
|
19930
|
-
*/
|
|
19931
|
-
|
|
19932
|
-
|
|
19933
|
-
|
|
19934
|
-
|
|
19935
|
-
|
|
19936
|
-
|
|
19937
|
-
|
|
19938
|
-
|
|
19939
|
-
|
|
19940
|
-
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19947
|
-
|
|
19948
|
-
|
|
19949
|
-
|
|
19950
|
-
|
|
19951
|
-
|
|
19952
|
-
|
|
19953
|
-
|
|
19954
|
-
|
|
19955
|
-
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
|
|
19959
|
-
|
|
19960
|
-
|
|
19961
|
-
|
|
19962
|
-
}
|
|
19963
|
-
|
|
19964
|
-
var targetWidth = scale > 1 ? imageWidth : imageWidth * scale;
|
|
19965
|
-
var targetHeight = scale > 1 ? imageHeight : imageHeight * scale;
|
|
19966
|
-
|
|
19967
|
-
if (resultType === "image") {
|
|
19968
|
-
return image2Canvas(img, inputType, targetWidth, targetHeight).then(function (canvas) {
|
|
19969
|
-
return canvas2Image(canvas);
|
|
19970
|
-
});
|
|
19971
|
-
} else {
|
|
19972
|
-
return image2Canvas(img, inputType, targetWidth, targetHeight);
|
|
19973
|
-
}
|
|
19974
|
-
}
|
|
19666
|
+
*/
|
|
19667
|
+
function resize(img, _a) {
|
|
19668
|
+
var _b = _a.inputType, inputType = _b === void 0 ? 'image/jpeg' : _b, _c = _a.imageWidth, imageWidth = _c === void 0 ? -1 : _c, _d = _a.imageHeight, imageHeight = _d === void 0 ? -1 : _d, _e = _a.equalProportion, equalProportion = _e === void 0 ? true : _e, //等比例拉伸
|
|
19669
|
+
_f = _a.sideLengthLimit, //等比例拉伸
|
|
19670
|
+
sideLengthLimit = _f === void 0 ? 640 : _f, _g = _a.baseOnShortSide, baseOnShortSide = _g === void 0 ? true : _g, // 是否以短边为基准缩放
|
|
19671
|
+
_h = _a.resultType, // 是否以短边为基准缩放
|
|
19672
|
+
resultType = _h === void 0 ? "image" : _h;
|
|
19673
|
+
var scale = 1;
|
|
19674
|
+
var scaleBaseFunc = baseOnShortSide ? Math.min : Math.max;
|
|
19675
|
+
if (imageWidth > 0 && imageHeight > 0) {
|
|
19676
|
+
scale = sideLengthLimit / scaleBaseFunc(imageWidth, imageHeight);
|
|
19677
|
+
}
|
|
19678
|
+
else if (img.width > 0 && img.height > 0) {
|
|
19679
|
+
scale = sideLengthLimit / scaleBaseFunc(img.width, img.height);
|
|
19680
|
+
imageWidth = img.width;
|
|
19681
|
+
imageHeight = img.height;
|
|
19682
|
+
}
|
|
19683
|
+
else {
|
|
19684
|
+
return Promise.reject(new Error('image width/height 无效'));
|
|
19685
|
+
}
|
|
19686
|
+
var targetWidth = scale > 1 ? imageWidth : imageWidth * scale;
|
|
19687
|
+
var targetHeight = scale > 1 ? imageHeight : imageHeight * scale;
|
|
19688
|
+
if (resultType === "image") {
|
|
19689
|
+
return image2Canvas(img, inputType, targetWidth, targetHeight).then(function (canvas) {
|
|
19690
|
+
return canvas2Image(canvas);
|
|
19691
|
+
});
|
|
19692
|
+
}
|
|
19693
|
+
else {
|
|
19694
|
+
return image2Canvas(img, inputType, targetWidth, targetHeight);
|
|
19695
|
+
}
|
|
19696
|
+
}
|
|
19697
|
+
//# sourceMappingURL=image-util.js.map
|
|
19975
19698
|
// CONCATENATED MODULE: ./node_modules/@egova/media/lib/image-processor.js
|
|
19976
|
-
|
|
19977
|
-
|
|
19978
|
-
|
|
19979
|
-
var MAX_SIDE_LENGTH = 1920;
|
|
19980
|
-
var MIN_SIDE_LEnGTH = 480;
|
|
19981
|
-
var PHOTO_FILE_SIZE_LIMIT = 1000; // 1000kb
|
|
19982
|
-
|
|
19983
|
-
var
|
|
19984
|
-
var
|
|
19985
|
-
var
|
|
19986
|
-
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
|
|
19994
|
-
|
|
19995
|
-
|
|
19996
|
-
|
|
19997
|
-
|
|
19998
|
-
|
|
19999
|
-
}
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
|
|
20004
|
-
|
|
20005
|
-
|
|
20006
|
-
|
|
20007
|
-
|
|
20008
|
-
|
|
20009
|
-
|
|
20010
|
-
|
|
20011
|
-
}
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20019
|
-
|
|
20020
|
-
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20027
|
-
|
|
20028
|
-
|
|
20029
|
-
|
|
20030
|
-
|
|
20031
|
-
|
|
20032
|
-
|
|
20033
|
-
|
|
20034
|
-
|
|
20035
|
-
|
|
20036
|
-
|
|
20037
|
-
|
|
20038
|
-
|
|
20039
|
-
|
|
20040
|
-
|
|
20041
|
-
|
|
20042
|
-
|
|
20043
|
-
|
|
20044
|
-
|
|
20045
|
-
|
|
20046
|
-
|
|
20047
|
-
|
|
20048
|
-
|
|
20049
|
-
|
|
20050
|
-
|
|
20051
|
-
|
|
20052
|
-
|
|
20053
|
-
|
|
20054
|
-
|
|
20055
|
-
|
|
20056
|
-
|
|
20057
|
-
|
|
20058
|
-
|
|
20059
|
-
|
|
20060
|
-
|
|
20061
|
-
|
|
20062
|
-
|
|
20063
|
-
|
|
20064
|
-
|
|
20065
|
-
if (file.size > _this.compressOptions.photoFileSizeLimit * 1024 && quality - JPEG_QUALITY_STEP > MIN_JPEG_QUALITY) {
|
|
20066
|
-
return _this.compress(canvas, filename, lastModified, type, quality - JPEG_QUALITY_STEP);
|
|
20067
|
-
} else {
|
|
20068
|
-
return Promise.resolve(file);
|
|
20069
|
-
}
|
|
20070
|
-
});
|
|
20071
|
-
};
|
|
20072
|
-
|
|
20073
|
-
return ImageProcessor;
|
|
20074
|
-
}();
|
|
20075
|
-
|
|
20076
|
-
|
|
19699
|
+
|
|
19700
|
+
|
|
19701
|
+
|
|
19702
|
+
var MAX_SIDE_LENGTH = 1920;
|
|
19703
|
+
var MIN_SIDE_LEnGTH = 480;
|
|
19704
|
+
var PHOTO_FILE_SIZE_LIMIT = 1000; // 1000kb
|
|
19705
|
+
var DEFAULT_JPEG_QUALITY = 0.8;
|
|
19706
|
+
var MIN_JPEG_QUALITY = 0.1;
|
|
19707
|
+
var JPEG_QUALITY_STEP = 0.05;
|
|
19708
|
+
var image_processor_ResizeOptions = /** @class */ (function () {
|
|
19709
|
+
function ResizeOptions(maxSideLength) {
|
|
19710
|
+
if (checkIsUndefinedOrNull(maxSideLength)) {
|
|
19711
|
+
this.maxSideLength = MAX_SIDE_LENGTH;
|
|
19712
|
+
}
|
|
19713
|
+
else {
|
|
19714
|
+
this.maxSideLength = maxSideLength;
|
|
19715
|
+
if (this.maxSideLength > MAX_SIDE_LENGTH) {
|
|
19716
|
+
this.maxSideLength = MAX_SIDE_LENGTH;
|
|
19717
|
+
}
|
|
19718
|
+
else if (this.maxSideLength < MIN_SIDE_LEnGTH) {
|
|
19719
|
+
this.maxSideLength = MIN_SIDE_LEnGTH;
|
|
19720
|
+
}
|
|
19721
|
+
}
|
|
19722
|
+
}
|
|
19723
|
+
return ResizeOptions;
|
|
19724
|
+
}());
|
|
19725
|
+
|
|
19726
|
+
var image_processor_CompressOptions = /** @class */ (function () {
|
|
19727
|
+
function CompressOptions(photoFileSizeLimit) {
|
|
19728
|
+
if (checkIsUndefinedOrNull(photoFileSizeLimit)) {
|
|
19729
|
+
this.photoFileSizeLimit = PHOTO_FILE_SIZE_LIMIT;
|
|
19730
|
+
}
|
|
19731
|
+
else {
|
|
19732
|
+
this.photoFileSizeLimit = photoFileSizeLimit;
|
|
19733
|
+
}
|
|
19734
|
+
}
|
|
19735
|
+
return CompressOptions;
|
|
19736
|
+
}());
|
|
19737
|
+
|
|
19738
|
+
var image_processor_ImageProcessor = /** @class */ (function () {
|
|
19739
|
+
function ImageProcessor(file, resizeOptions, watermarkOptions, compressOptions) {
|
|
19740
|
+
this.file = file;
|
|
19741
|
+
this.resizeOptions = resizeOptions;
|
|
19742
|
+
this.watermarkOptions = watermarkOptions;
|
|
19743
|
+
this.compressOptions = compressOptions;
|
|
19744
|
+
}
|
|
19745
|
+
ImageProcessor.prototype.process = function () {
|
|
19746
|
+
var _this = this;
|
|
19747
|
+
var filename = this.file.name;
|
|
19748
|
+
var lastModified = this.file.lastModified;
|
|
19749
|
+
var fileType = this.file.type;
|
|
19750
|
+
if (this.file.size > this.compressOptions.photoFileSizeLimit * 1024) {
|
|
19751
|
+
fileType = 'image/jpeg';
|
|
19752
|
+
}
|
|
19753
|
+
if (fileType === 'image/gif') {
|
|
19754
|
+
fileType = 'image/png';
|
|
19755
|
+
}
|
|
19756
|
+
return file2Image(this.file).then(function (img) {
|
|
19757
|
+
//第一步 resize image
|
|
19758
|
+
return resize(img, {
|
|
19759
|
+
inputType: fileType,
|
|
19760
|
+
sideLengthLimit: _this.resizeOptions.maxSideLength,
|
|
19761
|
+
resultType: "canvas"
|
|
19762
|
+
});
|
|
19763
|
+
}).then(function (result) {
|
|
19764
|
+
var canvas = result;
|
|
19765
|
+
//第二步 打水印
|
|
19766
|
+
return renderWatermark(canvas, _this.watermarkOptions);
|
|
19767
|
+
}).then(function (canvas) {
|
|
19768
|
+
var exportFilename = filename.replace(/\./g, "-") + '.jpg';
|
|
19769
|
+
return _this.compress(canvas, exportFilename, lastModified, fileType, DEFAULT_JPEG_QUALITY);
|
|
19770
|
+
});
|
|
19771
|
+
};
|
|
19772
|
+
ImageProcessor.prototype.compress = function (canvas, filename, lastModified, type, quality) {
|
|
19773
|
+
var _this = this;
|
|
19774
|
+
return canvas2File(canvas, filename, lastModified, type, quality).then(function (file) {
|
|
19775
|
+
if (file.size > _this.compressOptions.photoFileSizeLimit * 1024 &&
|
|
19776
|
+
quality - JPEG_QUALITY_STEP > MIN_JPEG_QUALITY) {
|
|
19777
|
+
return _this.compress(canvas, filename, lastModified, type, quality - JPEG_QUALITY_STEP);
|
|
19778
|
+
}
|
|
19779
|
+
else {
|
|
19780
|
+
return Promise.resolve(file);
|
|
19781
|
+
}
|
|
19782
|
+
});
|
|
19783
|
+
};
|
|
19784
|
+
return ImageProcessor;
|
|
19785
|
+
}());
|
|
19786
|
+
|
|
19787
|
+
//# sourceMappingURL=image-processor.js.map
|
|
20077
19788
|
// CONCATENATED MODULE: ./node_modules/@egova/media/lib/index.js
|
|
20078
19789
|
/**
|
|
20079
19790
|
* @description 水印渲染类
|
|
20080
19791
|
* @author Jiaji Yin
|
|
20081
19792
|
* @date 2021-11-05
|
|
20082
|
-
*/
|
|
20083
|
-
|
|
20084
|
-
|
|
20085
|
-
|
|
19793
|
+
*/
|
|
19794
|
+
|
|
19795
|
+
|
|
19796
|
+
|
|
19797
|
+
//# sourceMappingURL=index.js.map
|
|
20086
19798
|
// CONCATENATED MODULE: ./es/media-picker/image/TakePhotoIcon.js
|
|
20087
19799
|
/* harmony default export */ var TakePhotoIcon = ({
|
|
20088
19800
|
methods: {
|
|
@@ -23868,8 +23580,6 @@ PasswordInput.props = {
|
|
|
23868
23580
|
};
|
|
23869
23581
|
/* harmony default export */ var password_input = (password_input_createComponent(PasswordInput));
|
|
23870
23582
|
// CONCATENATED MODULE: ./node_modules/@vant/popperjs/dist/esm/index.js
|
|
23871
|
-
|
|
23872
|
-
|
|
23873
23583
|
function getBoundingClientRect(element) {
|
|
23874
23584
|
var rect = element.getBoundingClientRect();
|
|
23875
23585
|
return {
|
|
@@ -23975,8 +23685,9 @@ function isScrollParent(element) {
|
|
|
23975
23685
|
overflowY = _getComputedStyle.overflowY;
|
|
23976
23686
|
|
|
23977
23687
|
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
23978
|
-
}
|
|
23688
|
+
}
|
|
23979
23689
|
|
|
23690
|
+
// Composite means it takes into account transforms as well as layout.
|
|
23980
23691
|
|
|
23981
23692
|
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
23982
23693
|
if (isFixed === void 0) {
|
|
@@ -24016,8 +23727,9 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
24016
23727
|
width: rect.width,
|
|
24017
23728
|
height: rect.height
|
|
24018
23729
|
};
|
|
24019
|
-
}
|
|
23730
|
+
}
|
|
24020
23731
|
|
|
23732
|
+
// means it doesn't take into account transforms.
|
|
24021
23733
|
|
|
24022
23734
|
function getLayoutRect(element) {
|
|
24023
23735
|
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
|
@@ -24071,6 +23783,7 @@ function getScrollParent(node) {
|
|
|
24071
23783
|
|
|
24072
23784
|
return getScrollParent(getParentNode(node));
|
|
24073
23785
|
}
|
|
23786
|
+
|
|
24074
23787
|
/*
|
|
24075
23788
|
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
|
24076
23789
|
until we get to the top window object. This list is what we attach scroll listeners
|
|
@@ -24078,7 +23791,6 @@ to, because if any of these parent elements scroll, we'll need to re-calculate t
|
|
|
24078
23791
|
reference element's position.
|
|
24079
23792
|
*/
|
|
24080
23793
|
|
|
24081
|
-
|
|
24082
23794
|
function listScrollParents(element, list) {
|
|
24083
23795
|
var _element$ownerDocumen;
|
|
24084
23796
|
|
|
@@ -24254,7 +23966,6 @@ function esm_format(str) {
|
|
|
24254
23966
|
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
|
24255
23967
|
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
|
24256
23968
|
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
|
|
24257
|
-
|
|
24258
23969
|
function validateModifiers(modifiers) {
|
|
24259
23970
|
modifiers.forEach(function (modifier) {
|
|
24260
23971
|
Object.keys(modifier).forEach(function (key) {
|
|
@@ -24346,9 +24057,9 @@ function getBasePlacement(placement) {
|
|
|
24346
24057
|
function mergeByName(modifiers) {
|
|
24347
24058
|
var merged = modifiers.reduce(function (merged, current) {
|
|
24348
24059
|
var existing = merged[current.name];
|
|
24349
|
-
merged[current.name] = existing ?
|
|
24350
|
-
options:
|
|
24351
|
-
data:
|
|
24060
|
+
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
|
24061
|
+
options: Object.assign({}, existing.options, current.options),
|
|
24062
|
+
data: Object.assign({}, existing.data, current.data)
|
|
24352
24063
|
}) : current;
|
|
24353
24064
|
return merged;
|
|
24354
24065
|
}, {}); // IE11 does not support Object.values
|
|
@@ -24469,7 +24180,7 @@ function popperGenerator(generatorOptions) {
|
|
|
24469
24180
|
var state = {
|
|
24470
24181
|
placement: 'bottom',
|
|
24471
24182
|
orderedModifiers: [],
|
|
24472
|
-
options:
|
|
24183
|
+
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
|
24473
24184
|
modifiersData: {},
|
|
24474
24185
|
elements: {
|
|
24475
24186
|
reference: reference,
|
|
@@ -24484,7 +24195,7 @@ function popperGenerator(generatorOptions) {
|
|
|
24484
24195
|
state: state,
|
|
24485
24196
|
setOptions: function setOptions(options) {
|
|
24486
24197
|
cleanupModifierEffects();
|
|
24487
|
-
state.options =
|
|
24198
|
+
state.options = Object.assign({}, defaultOptions, state.options, options);
|
|
24488
24199
|
state.scrollParents = {
|
|
24489
24200
|
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
|
24490
24201
|
popper: listScrollParents(popper)
|
|
@@ -24541,7 +24252,7 @@ function popperGenerator(generatorOptions) {
|
|
|
24541
24252
|
// To ensure persistent data, use `${name}#persistent`
|
|
24542
24253
|
|
|
24543
24254
|
state.orderedModifiers.forEach(function (modifier) {
|
|
24544
|
-
return state.modifiersData[modifier.name] =
|
|
24255
|
+
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
24545
24256
|
});
|
|
24546
24257
|
var __debug_loops__ = 0;
|
|
24547
24258
|
|
|
@@ -24704,6 +24415,7 @@ var popperOffsets$1 = {
|
|
|
24704
24415
|
fn: popperOffsets,
|
|
24705
24416
|
data: {}
|
|
24706
24417
|
};
|
|
24418
|
+
|
|
24707
24419
|
var unsetSides = {
|
|
24708
24420
|
top: 'auto',
|
|
24709
24421
|
right: 'auto',
|
|
@@ -24780,17 +24492,17 @@ function mapToStyles(_ref2) {
|
|
|
24780
24492
|
}
|
|
24781
24493
|
}
|
|
24782
24494
|
|
|
24783
|
-
var commonStyles =
|
|
24495
|
+
var commonStyles = Object.assign({
|
|
24784
24496
|
position: position
|
|
24785
24497
|
}, adaptive && unsetSides);
|
|
24786
24498
|
|
|
24787
24499
|
if (gpuAcceleration) {
|
|
24788
24500
|
var _Object$assign;
|
|
24789
24501
|
|
|
24790
|
-
return
|
|
24502
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
24791
24503
|
}
|
|
24792
24504
|
|
|
24793
|
-
return
|
|
24505
|
+
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
24794
24506
|
}
|
|
24795
24507
|
|
|
24796
24508
|
function computeStyles(_ref4) {
|
|
@@ -24813,7 +24525,7 @@ function computeStyles(_ref4) {
|
|
|
24813
24525
|
};
|
|
24814
24526
|
|
|
24815
24527
|
if (state.modifiersData.popperOffsets != null) {
|
|
24816
|
-
state.styles.popper =
|
|
24528
|
+
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
|
24817
24529
|
offsets: state.modifiersData.popperOffsets,
|
|
24818
24530
|
position: state.options.strategy,
|
|
24819
24531
|
adaptive: adaptive,
|
|
@@ -24822,7 +24534,7 @@ function computeStyles(_ref4) {
|
|
|
24822
24534
|
}
|
|
24823
24535
|
|
|
24824
24536
|
if (state.modifiersData.arrow != null) {
|
|
24825
|
-
state.styles.arrow =
|
|
24537
|
+
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
|
24826
24538
|
offsets: state.modifiersData.arrow,
|
|
24827
24539
|
position: 'absolute',
|
|
24828
24540
|
adaptive: false,
|
|
@@ -24830,7 +24542,7 @@ function computeStyles(_ref4) {
|
|
|
24830
24542
|
})));
|
|
24831
24543
|
}
|
|
24832
24544
|
|
|
24833
|
-
state.attributes.popper =
|
|
24545
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
24834
24546
|
'data-popper-placement': state.placement
|
|
24835
24547
|
});
|
|
24836
24548
|
} // eslint-disable-next-line import/no-unused-modules
|
|
@@ -24842,7 +24554,9 @@ var computeStyles$1 = {
|
|
|
24842
24554
|
phase: 'beforeWrite',
|
|
24843
24555
|
fn: computeStyles,
|
|
24844
24556
|
data: {}
|
|
24845
|
-
};
|
|
24557
|
+
};
|
|
24558
|
+
|
|
24559
|
+
// and applies them to the HTMLElements such as popper and arrow
|
|
24846
24560
|
|
|
24847
24561
|
function applyStyles(_ref) {
|
|
24848
24562
|
var state = _ref.state;
|
|
@@ -24858,8 +24572,7 @@ function applyStyles(_ref) {
|
|
|
24858
24572
|
// $FlowFixMe[cannot-write]
|
|
24859
24573
|
|
|
24860
24574
|
|
|
24861
|
-
|
|
24862
|
-
|
|
24575
|
+
Object.assign(element.style, style);
|
|
24863
24576
|
Object.keys(attributes).forEach(function (name) {
|
|
24864
24577
|
var value = attributes[name];
|
|
24865
24578
|
|
|
@@ -24886,13 +24599,11 @@ function effect$1(_ref2) {
|
|
|
24886
24599
|
},
|
|
24887
24600
|
reference: {}
|
|
24888
24601
|
};
|
|
24889
|
-
|
|
24890
|
-
_extends(state.elements.popper.style, initialStyles.popper);
|
|
24891
|
-
|
|
24602
|
+
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
24892
24603
|
state.styles = initialStyles;
|
|
24893
24604
|
|
|
24894
24605
|
if (state.elements.arrow) {
|
|
24895
|
-
|
|
24606
|
+
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
24896
24607
|
}
|
|
24897
24608
|
|
|
24898
24609
|
return function () {
|
|
@@ -24910,8 +24621,7 @@ function effect$1(_ref2) {
|
|
|
24910
24621
|
return;
|
|
24911
24622
|
}
|
|
24912
24623
|
|
|
24913
|
-
|
|
24914
|
-
|
|
24624
|
+
Object.assign(element.style, style);
|
|
24915
24625
|
Object.keys(attributes).forEach(function (attribute) {
|
|
24916
24626
|
element.removeAttribute(attribute);
|
|
24917
24627
|
});
|
|
@@ -24928,16 +24638,17 @@ var applyStyles$1 = {
|
|
|
24928
24638
|
effect: effect$1,
|
|
24929
24639
|
requires: ['computeStyles']
|
|
24930
24640
|
};
|
|
24931
|
-
|
|
24641
|
+
|
|
24642
|
+
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
|
|
24932
24643
|
var esm_createPopper = /*#__PURE__*/popperGenerator({
|
|
24933
|
-
defaultModifiers:
|
|
24644
|
+
defaultModifiers: defaultModifiers
|
|
24934
24645
|
}); // eslint-disable-next-line import/no-unused-modules
|
|
24935
24646
|
|
|
24936
24647
|
function distanceAndSkiddingToXY(placement, rects, offset) {
|
|
24937
24648
|
var basePlacement = getBasePlacement(placement);
|
|
24938
24649
|
var invertDistance = [esm_left, esm_top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
|
24939
24650
|
|
|
24940
|
-
var _ref = typeof offset === 'function' ? offset(
|
|
24651
|
+
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
|
|
24941
24652
|
placement: placement
|
|
24942
24653
|
})) : offset,
|
|
24943
24654
|
skidding = _ref[0],
|
|
@@ -24985,6 +24696,8 @@ var offset$1 = {
|
|
|
24985
24696
|
fn: esm_offset
|
|
24986
24697
|
};
|
|
24987
24698
|
|
|
24699
|
+
|
|
24700
|
+
|
|
24988
24701
|
// CONCATENATED MODULE: ./es/popover/index.js
|
|
24989
24702
|
|
|
24990
24703
|
|
|
@@ -28516,6 +28229,10 @@ var timeline_defaultData = function defaultData() {
|
|
|
28516
28229
|
enableSingleFold: {
|
|
28517
28230
|
type: Boolean,
|
|
28518
28231
|
default: true
|
|
28232
|
+
},
|
|
28233
|
+
showFold: {
|
|
28234
|
+
type: Boolean,
|
|
28235
|
+
default: true
|
|
28519
28236
|
}
|
|
28520
28237
|
},
|
|
28521
28238
|
data: function data() {
|
|
@@ -28703,8 +28420,12 @@ var timeline_defaultData = function defaultData() {
|
|
|
28703
28420
|
}, [h("div", {
|
|
28704
28421
|
"class": timeline_bem("bar")
|
|
28705
28422
|
}), h("div", {
|
|
28706
|
-
"class": timeline_bem("title")
|
|
28423
|
+
"class": timeline_bem("main-title")
|
|
28707
28424
|
}, [this.title])]), h("div", {
|
|
28425
|
+
"directives": [{
|
|
28426
|
+
name: "show",
|
|
28427
|
+
value: this.showFold
|
|
28428
|
+
}],
|
|
28708
28429
|
"class": timeline_bem("top-right")
|
|
28709
28430
|
}, [h("span", {
|
|
28710
28431
|
"class": timeline_bem("fold-text")
|
|
@@ -29424,7 +29145,7 @@ var uploader_createNamespace = Object(utils["b" /* createNamespace */])('uploade
|
|
|
29424
29145
|
|
|
29425
29146
|
|
|
29426
29147
|
|
|
29427
|
-
var version = '2.0.
|
|
29148
|
+
var version = '2.0.41';
|
|
29428
29149
|
|
|
29429
29150
|
function install(Vue) {
|
|
29430
29151
|
var components = [action_sheet, es_area, avatar, back_top, badge, es_button, calendar, cascader, cell, cell_group, es_checkbox, checkbox_group, col, collapse, collapse_item, count_down, datetime_picker, dialog, divider, dropdown_item, dropdown_menu, empty, es_field, fold_dialog, es_form, grid, grid_item, hierarchy_select, es_icon, es_image, image_preview, index_anchor, index_bar, es_info, lazyload, es_list, es_loading, locale["a" /* default */], media_picker, media_player, multiple_picker, nav_bar, notice_bar, number_keyboard, es_overlay, password_input, es_picker, popover, popup, pull_refresh, es_radio, radio_group, rate, row, search, signature, skeleton, slider, es_step, stepper, es_steps, es_sticky, swipe, swipe_cell, swipe_item, es_switch, switch_cell, tab, tabbar, tabbar_item, table, tabs, es_tag, timeline, es_toast, uploader];
|