dpzvc-ui 1.2.3 → 1.2.5

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/dist/dpzvc.js CHANGED
@@ -11,244 +11,6 @@
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
14
- /***/ 37
15
- (module, __webpack_exports__, __webpack_require__) {
16
-
17
- "use strict";
18
- __webpack_require__.r(__webpack_exports__);
19
- /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(284);
20
- /* module decorator */ module = __webpack_require__.hmd(module);
21
-
22
- // MegaPixImage.js
23
- (function (global, factory) {
24
- if (( false ? 0 : (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(module)) === 'object' && (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(module.exports) === 'object') {
25
- module.exports = factory(); // CommonJS
26
- } else if (typeof define === 'function' && __webpack_require__.amdO) {
27
- define([], factory); // AMD
28
- } else {
29
- global.MegaPixImage = factory(); // Browser global
30
- }
31
- })(typeof window !== 'undefined' ? window : undefined, function () {
32
- // -------------------------
33
- // Helper functions
34
- // -------------------------
35
- function detectSubsampling(img) {
36
- var iw = img.naturalWidth,
37
- ih = img.naturalHeight;
38
- if (iw * ih > 1024 * 1024) {
39
- var canvas = document.createElement('canvas');
40
- canvas.width = canvas.height = 1;
41
- var ctx = canvas.getContext('2d');
42
- ctx.drawImage(img, -iw + 1, 0);
43
- return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
44
- } else {
45
- return false;
46
- }
47
- }
48
- function detectVerticalSquash(img, iw, ih) {
49
- var canvas = document.createElement('canvas');
50
- canvas.width = 1;
51
- canvas.height = ih;
52
- var ctx = canvas.getContext('2d');
53
- ctx.drawImage(img, 0, 0);
54
- var data = ctx.getImageData(0, 0, 1, ih).data;
55
- var sy = 0,
56
- ey = ih,
57
- py = ih;
58
- while (py > sy) {
59
- var alpha = data[(py - 1) * 4 + 3];
60
- if (alpha === 0) {
61
- ey = py;
62
- } else {
63
- sy = py;
64
- }
65
- py = ey + sy >> 1;
66
- }
67
- var ratio = py / ih;
68
- return ratio === 0 ? 1 : ratio;
69
- }
70
- function renderImageToDataURL(img, options, doSquash) {
71
- var canvas = document.createElement('canvas');
72
- renderImageToCanvas(img, canvas, options, doSquash);
73
- return canvas.toDataURL("image/jpeg", options.quality || 0.8);
74
- }
75
- function renderImageToCanvas(img, canvas, options, doSquash) {
76
- var iw = img.naturalWidth,
77
- ih = img.naturalHeight;
78
- if (!(iw + ih)) return;
79
- var width = options.width,
80
- height = options.height;
81
- var ctx = canvas.getContext('2d');
82
- ctx.save();
83
- transformCoordinate(canvas, ctx, width, height, options.orientation);
84
- var subsampled = detectSubsampling(img);
85
- if (subsampled) {
86
- iw /= 2;
87
- ih /= 2;
88
- }
89
- var d = 1024;
90
- var tmpCanvas = document.createElement('canvas');
91
- tmpCanvas.width = tmpCanvas.height = d;
92
- var tmpCtx = tmpCanvas.getContext('2d');
93
- var vertSquashRatio = doSquash ? detectVerticalSquash(img, iw, ih) : 1;
94
- var dw = Math.ceil(d * width / iw);
95
- var dh = Math.ceil(d * height / ih / vertSquashRatio);
96
- var sy = 0,
97
- dy = 0;
98
- while (sy < ih) {
99
- var sx = 0,
100
- dx = 0;
101
- while (sx < iw) {
102
- tmpCtx.clearRect(0, 0, d, d);
103
- tmpCtx.drawImage(img, -sx, -sy);
104
- ctx.drawImage(tmpCanvas, 0, 0, d, d, dx, dy, dw, dh);
105
- sx += d;
106
- dx += dw;
107
- }
108
- sy += d;
109
- dy += dh;
110
- }
111
- ctx.restore();
112
- tmpCanvas = tmpCtx = null;
113
- }
114
- function transformCoordinate(canvas, ctx, width, height, orientation) {
115
- switch (orientation) {
116
- case 5:
117
- case 6:
118
- case 7:
119
- case 8:
120
- canvas.width = height;
121
- canvas.height = width;
122
- break;
123
- default:
124
- canvas.width = width;
125
- canvas.height = height;
126
- }
127
- switch (orientation) {
128
- case 2:
129
- ctx.translate(width, 0);
130
- ctx.scale(-1, 1);
131
- break;
132
- case 3:
133
- ctx.translate(width, height);
134
- ctx.rotate(Math.PI);
135
- break;
136
- case 4:
137
- ctx.translate(0, height);
138
- ctx.scale(1, -1);
139
- break;
140
- case 5:
141
- ctx.rotate(0.5 * Math.PI);
142
- ctx.scale(1, -1);
143
- break;
144
- case 6:
145
- ctx.rotate(0.5 * Math.PI);
146
- ctx.translate(0, -height);
147
- break;
148
- case 7:
149
- ctx.rotate(0.5 * Math.PI);
150
- ctx.translate(width, -height);
151
- ctx.scale(-1, 1);
152
- break;
153
- case 8:
154
- ctx.rotate(-0.5 * Math.PI);
155
- ctx.translate(-width, 0);
156
- break;
157
- }
158
- }
159
- var URL = window.URL && window.URL.createObjectURL ? window.URL : window.webkitURL && window.webkitURL.createObjectURL ? window.webkitURL : null;
160
-
161
- // -------------------------
162
- // MegaPixImage class
163
- // -------------------------
164
- function MegaPixImage(srcImage) {
165
- if (window.Blob && srcImage instanceof Blob) {
166
- if (!URL) {
167
- throw Error("No createObjectURL function found");
168
- }
169
- var img = new Image();
170
- img.src = URL.createObjectURL(srcImage);
171
- this.blob = srcImage;
172
- srcImage = img;
173
- }
174
- if (!srcImage.naturalWidth && !srcImage.naturalHeight) {
175
- var _this = this;
176
- srcImage.onload = srcImage.onerror = function () {
177
- var listeners = _this.imageLoadListeners;
178
- if (listeners) {
179
- _this.imageLoadListeners = null;
180
- for (var i = 0; i < listeners.length; i++) {
181
- listeners[i]();
182
- }
183
- }
184
- };
185
- this.imageLoadListeners = [];
186
- }
187
- this.srcImage = srcImage;
188
- }
189
- MegaPixImage.prototype.render = function (target, options, callback) {
190
- if (this.imageLoadListeners) {
191
- var _this = this;
192
- this.imageLoadListeners.push(function () {
193
- _this.render(target, options, callback);
194
- });
195
- return;
196
- }
197
- options = options || {};
198
- var imgWidth = this.srcImage.naturalWidth,
199
- imgHeight = this.srcImage.naturalHeight,
200
- width = options.width,
201
- height = options.height,
202
- maxWidth = options.maxWidth,
203
- maxHeight = options.maxHeight,
204
- doSquash = !this.blob || this.blob.type === 'image/jpeg';
205
- if (width && !height) {
206
- height = imgHeight * width / imgWidth << 0;
207
- } else if (height && !width) {
208
- width = imgWidth * height / imgHeight << 0;
209
- } else {
210
- width = imgWidth;
211
- height = imgHeight;
212
- }
213
- if (maxWidth && width > maxWidth) {
214
- width = maxWidth;
215
- height = imgHeight * width / imgWidth << 0;
216
- }
217
- if (maxHeight && height > maxHeight) {
218
- height = maxHeight;
219
- width = imgWidth * height / imgHeight << 0;
220
- }
221
- var opt = {
222
- width: width,
223
- height: height
224
- };
225
- for (var k in options) opt[k] = options[k];
226
- var tagName = target.tagName.toLowerCase();
227
- if (tagName === 'img') {
228
- target.src = renderImageToDataURL(this.srcImage, opt, doSquash);
229
- } else if (tagName === 'canvas') {
230
- renderImageToCanvas(this.srcImage, target, opt, doSquash);
231
- }
232
- if (typeof this.onrender === 'function') {
233
- this.onrender(target);
234
- }
235
- if (callback) {
236
- callback();
237
- }
238
- if (this.blob) {
239
- this.blob = null;
240
- URL.revokeObjectURL(this.srcImage.src);
241
- }
242
- };
243
-
244
- // -------------------------
245
- // Export as ESM default
246
- // -------------------------
247
- return MegaPixImage;
248
- });
249
-
250
- /***/ },
251
-
252
14
  /***/ 49
253
15
  (module) {
254
16
 
@@ -4281,26 +4043,6 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.dpzvc-rater-star {
4281
4043
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
4282
4044
 
4283
4045
 
4284
- /***/ },
4285
-
4286
- /***/ 284
4287
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
4288
-
4289
- "use strict";
4290
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4291
- /* harmony export */ A: () => (/* binding */ _typeof)
4292
- /* harmony export */ });
4293
- function _typeof(o) {
4294
- "@babel/helpers - typeof";
4295
-
4296
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
4297
- return typeof o;
4298
- } : function (o) {
4299
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
4300
- }, _typeof(o);
4301
- }
4302
-
4303
-
4304
4046
  /***/ },
4305
4047
 
4306
4048
  /***/ 314
@@ -5508,7 +5250,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, `
5508
5250
  justify-content: center;
5509
5251
  flex-direction: column;
5510
5252
  }
5511
- `, "",{"version":3,"sources":["webpack://./checkbox-group.vue"],"names":[],"mappings":";AA4EA;IACA,aAAA;IACA,uBAAA;IACA,sBAAA;AACA","sourcesContent":["<template>\n <div :class=\"['dpzvc-checkBoxGroup',vertical?'dpzvc-checkBoxGroup-vertical':'']\" >\n <slot></slot>\n </div>\n</template>\n\n<script>\n\n import {findComponentsDownward} from '../../utils/util'\n import Emitter from '../../mixin/emitter'\n export default {\n name:'checkBoxGroup',\n mixins:[Emitter],\n props:{\n value:{\n type:Array,\n default:()=>[]\n },\n single:{\n type:Boolean,\n default:false\n },\n vertical:{\n type:Boolean,\n default:false\n }\n\n },\n data(){\n return {\n currentValue:this.value,\n childrens:[]\n }\n },\n methods:{\n change(data){\n console.log(data)\n this.currentValue = data;\n this.$emit('input', data);\n this.$emit('on-change',data);\n this.dispatch('on-form-change',data)\n },\n updateModel(){\n let model = this.value;\n this.childrens = findComponentsDownward(this,'checkBox');\n if(this.childrens) {\n this.childrens.forEach((child)=>{\n\n child.model = model;\n child.currentValue = model.indexOf(child.label) >= 0;\n child.isGroup = true;\n })\n }\n\n }\n },\n mounted(){\n\n this.updateModel()\n },\n watch:{\n value(){\n this.updateModel()\n }\n }\n }\n</script>\n\n\n<style scoped>\n .dpzvc-checkBoxGroup-vertical {\n display: flex;\n justify-content: center;\n flex-direction: column;\n }\n</style>"],"sourceRoot":""}]);
5253
+ `, "",{"version":3,"sources":["webpack://./src/components/checkBox/checkbox-group.vue"],"names":[],"mappings":";AA4EA;IACA,aAAA;IACA,uBAAA;IACA,sBAAA;AACA","sourcesContent":["<template>\n <div :class=\"['dpzvc-checkBoxGroup',vertical?'dpzvc-checkBoxGroup-vertical':'']\" >\n <slot></slot>\n </div>\n</template>\n\n<script>\n\n import {findComponentsDownward} from '../../utils/util'\n import Emitter from '../../mixin/emitter'\n export default {\n name:'checkBoxGroup',\n mixins:[Emitter],\n props:{\n value:{\n type:Array,\n default:()=>[]\n },\n single:{\n type:Boolean,\n default:false\n },\n vertical:{\n type:Boolean,\n default:false\n }\n\n },\n data(){\n return {\n currentValue:this.value,\n childrens:[]\n }\n },\n methods:{\n change(data){\n console.log(data)\n this.currentValue = data;\n this.$emit('input', data);\n this.$emit('on-change',data);\n this.dispatch('on-form-change',data)\n },\n updateModel(){\n let model = this.value;\n this.childrens = findComponentsDownward(this,'checkBox');\n if(this.childrens) {\n this.childrens.forEach((child)=>{\n\n child.model = model;\n child.currentValue = model.indexOf(child.label) >= 0;\n child.isGroup = true;\n })\n }\n\n }\n },\n mounted(){\n\n this.updateModel()\n },\n watch:{\n value(){\n this.updateModel()\n }\n }\n }\n</script>\n\n\n<style scoped>\n .dpzvc-checkBoxGroup-vertical {\n display: flex;\n justify-content: center;\n flex-direction: column;\n }\n</style>"],"sourceRoot":""}]);
5512
5254
  // Exports
5513
5255
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
5514
5256
 
@@ -5804,7 +5546,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, `
5804
5546
  justify-content: center;
5805
5547
  flex-direction: column;
5806
5548
  }
5807
- `, "",{"version":3,"sources":["webpack://./radiobox-group.vue"],"names":[],"mappings":";AA0EA;IACA,aAAA;IACA,uBAAA;IACA,sBAAA;AACA","sourcesContent":["<template>\n <div :class=\"classes\">\n <slot></slot>\n </div>\n</template>\n\n<script>\n\n import {findComponentsDownward} from \"../../utils/util\"\n const prefixCls = 'dpzvc-radioBoxGroup'\n export default {\n name:'radioBoxGroup',\n props:{\n value:{\n type:[String,Boolean,Number]\n },\n vertical:{\n type:Boolean,\n default:false\n }\n },\n mounted(){\n this.updateModel()\n },\n data(){\n return {\n currentValue:this.value,\n children:findComponentsDownward(this,'radioBox')\n }\n },\n computed:{\n classes(){\n return [\n `${prefixCls}`,\n {\n [`${prefixCls}-vertical`]:this.vertical\n }\n ]\n\n }\n },\n methods:{\n change(data){\n this.currentValue = data.value;\n this.updateModel();\n this.$emit('input',data.value);\n this.$emit('on-change',data.value);\n this.$emit('on-form-change',data.value)\n },\n updateModel(){\n let value = this.value;\n this.children = findComponentsDownward(this,'radioBox');\n this.children.forEach((child)=>{\n child.model = value == child.label;\n child.isGroup = true;\n\n })\n }\n },\n watch:{\n value(){\n this.updateModel();\n },\n }\n }\n</script>\n\n<style scoped >\n .dpzvc-radioBoxGroup-vertical {\n display: flex;\n justify-content: center;\n flex-direction: column;\n }\n</style>"],"sourceRoot":""}]);
5549
+ `, "",{"version":3,"sources":["webpack://./src/components/radioBox/radiobox-group.vue"],"names":[],"mappings":";AA0EA;IACA,aAAA;IACA,uBAAA;IACA,sBAAA;AACA","sourcesContent":["<template>\n <div :class=\"classes\">\n <slot></slot>\n </div>\n</template>\n\n<script>\n\n import {findComponentsDownward} from \"../../utils/util\"\n const prefixCls = 'dpzvc-radioBoxGroup'\n export default {\n name:'radioBoxGroup',\n props:{\n value:{\n type:[String,Boolean,Number]\n },\n vertical:{\n type:Boolean,\n default:false\n }\n },\n mounted(){\n this.updateModel()\n },\n data(){\n return {\n currentValue:this.value,\n children:findComponentsDownward(this,'radioBox')\n }\n },\n computed:{\n classes(){\n return [\n `${prefixCls}`,\n {\n [`${prefixCls}-vertical`]:this.vertical\n }\n ]\n\n }\n },\n methods:{\n change(data){\n this.currentValue = data.value;\n this.updateModel();\n this.$emit('input',data.value);\n this.$emit('on-change',data.value);\n this.$emit('on-form-change',data.value)\n },\n updateModel(){\n let value = this.value;\n this.children = findComponentsDownward(this,'radioBox');\n this.children.forEach((child)=>{\n child.model = value == child.label;\n child.isGroup = true;\n\n })\n }\n },\n watch:{\n value(){\n this.updateModel();\n },\n }\n }\n</script>\n\n<style scoped >\n .dpzvc-radioBoxGroup-vertical {\n display: flex;\n justify-content: center;\n flex-direction: column;\n }\n</style>"],"sourceRoot":""}]);
5808
5550
  // Exports
5809
5551
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
5810
5552
 
@@ -5874,26 +5616,18 @@ var update = add("7918d0f5", content, true, {});
5874
5616
  /******/ // Create a new module (and put it into the cache)
5875
5617
  /******/ var module = __webpack_module_cache__[moduleId] = {
5876
5618
  /******/ id: moduleId,
5877
- /******/ loaded: false,
5619
+ /******/ // no module.loaded needed
5878
5620
  /******/ exports: {}
5879
5621
  /******/ };
5880
5622
  /******/
5881
5623
  /******/ // Execute the module function
5882
5624
  /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
5883
5625
  /******/
5884
- /******/ // Flag the module as loaded
5885
- /******/ module.loaded = true;
5886
- /******/
5887
5626
  /******/ // Return the exports of the module
5888
5627
  /******/ return module.exports;
5889
5628
  /******/ }
5890
5629
  /******/
5891
5630
  /************************************************************************/
5892
- /******/ /* webpack/runtime/amd options */
5893
- /******/ (() => {
5894
- /******/ __webpack_require__.amdO = {};
5895
- /******/ })();
5896
- /******/
5897
5631
  /******/ /* webpack/runtime/compat get default export */
5898
5632
  /******/ (() => {
5899
5633
  /******/ // getDefaultExport function for compatibility with non-harmony modules
@@ -5918,21 +5652,6 @@ var update = add("7918d0f5", content, true, {});
5918
5652
  /******/ };
5919
5653
  /******/ })();
5920
5654
  /******/
5921
- /******/ /* webpack/runtime/harmony module decorator */
5922
- /******/ (() => {
5923
- /******/ __webpack_require__.hmd = (module) => {
5924
- /******/ module = Object.create(module);
5925
- /******/ if (!module.children) module.children = [];
5926
- /******/ Object.defineProperty(module, 'exports', {
5927
- /******/ enumerable: true,
5928
- /******/ set: () => {
5929
- /******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);
5930
- /******/ }
5931
- /******/ });
5932
- /******/ return module;
5933
- /******/ };
5934
- /******/ })();
5935
- /******/
5936
5655
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
5937
5656
  /******/ (() => {
5938
5657
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
@@ -6026,16 +5745,25 @@ var render = function render() {
6026
5745
  };
6027
5746
  var staticRenderFns = [];
6028
5747
 
6029
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
6030
- var esm_typeof = __webpack_require__(284);
5748
+ ;// ./node_modules/@babel/runtime/helpers/esm/typeof.js
5749
+ function _typeof(o) {
5750
+ "@babel/helpers - typeof";
5751
+
5752
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
5753
+ return typeof o;
5754
+ } : function (o) {
5755
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
5756
+ }, _typeof(o);
5757
+ }
5758
+
6031
5759
  ;// ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
6032
5760
 
6033
5761
  function toPrimitive(t, r) {
6034
- if ("object" != (0,esm_typeof/* default */.A)(t) || !t) return t;
5762
+ if ("object" != _typeof(t) || !t) return t;
6035
5763
  var e = t[Symbol.toPrimitive];
6036
5764
  if (void 0 !== e) {
6037
5765
  var i = e.call(t, r || "default");
6038
- if ("object" != (0,esm_typeof/* default */.A)(i)) return i;
5766
+ if ("object" != _typeof(i)) return i;
6039
5767
  throw new TypeError("@@toPrimitive must return a primitive value.");
6040
5768
  }
6041
5769
  return ("string" === r ? String : Number)(t);
@@ -6046,7 +5774,7 @@ function toPrimitive(t, r) {
6046
5774
 
6047
5775
  function toPropertyKey(t) {
6048
5776
  var i = toPrimitive(t, "string");
6049
- return "symbol" == (0,esm_typeof/* default */.A)(i) ? i : i + "";
5777
+ return "symbol" == _typeof(i) ? i : i + "";
6050
5778
  }
6051
5779
 
6052
5780
  ;// ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
@@ -11453,8 +11181,8 @@ var Number_component = normalizeComponent(
11453
11181
 
11454
11182
  textBar.Number = Text_Number;
11455
11183
  /* harmony default export */ const Text = (textBar);
11456
- ;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/upload/upload.vue?vue&type=template&id=b2513a8a
11457
- var uploadvue_type_template_id_b2513a8a_render = function render() {
11184
+ ;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/upload/upload.vue?vue&type=template&id=23492f0b
11185
+ var uploadvue_type_template_id_23492f0b_render = function render() {
11458
11186
  var _vm = this,
11459
11187
  _c = _vm._self._c;
11460
11188
  return _c('div', {
@@ -11476,13 +11204,238 @@ var uploadvue_type_template_id_b2513a8a_render = function render() {
11476
11204
  }
11477
11205
  })], 2);
11478
11206
  };
11479
- var uploadvue_type_template_id_b2513a8a_staticRenderFns = [];
11207
+ var uploadvue_type_template_id_23492f0b_staticRenderFns = [];
11480
11208
 
11481
11209
  // EXTERNAL MODULE: ./node_modules/exif-js/exif.js
11482
11210
  var exif = __webpack_require__(335);
11483
11211
  var exif_default = /*#__PURE__*/__webpack_require__.n(exif);
11484
- // EXTERNAL MODULE: ./src/lib/MegaPixImage.js
11485
- var MegaPixImage = __webpack_require__(37);
11212
+ ;// ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
11213
+ function _classCallCheck(a, n) {
11214
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
11215
+ }
11216
+
11217
+ ;// ./node_modules/@babel/runtime/helpers/esm/createClass.js
11218
+
11219
+ function _defineProperties(e, r) {
11220
+ for (var t = 0; t < r.length; t++) {
11221
+ var o = r[t];
11222
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
11223
+ }
11224
+ }
11225
+ function _createClass(e, r, t) {
11226
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
11227
+ writable: !1
11228
+ }), e;
11229
+ }
11230
+
11231
+ ;// ./src/lib/MegaPixImage.js
11232
+
11233
+
11234
+
11235
+ function MegaPixImage_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11236
+ function MegaPixImage_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? MegaPixImage_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : MegaPixImage_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11237
+ // MegaPixImage.js
11238
+ // 将原先的 UMD/CommonJS 改为 ESM export default
11239
+
11240
+ // -------------------------
11241
+ // Helper functions
11242
+ // -------------------------
11243
+ function detectSubsampling(img) {
11244
+ var iw = img.naturalWidth,
11245
+ ih = img.naturalHeight;
11246
+ if (iw * ih > 1024 * 1024) {
11247
+ var canvas = document.createElement('canvas');
11248
+ canvas.width = canvas.height = 1;
11249
+ var ctx = canvas.getContext('2d');
11250
+ ctx.drawImage(img, -iw + 1, 0);
11251
+ return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
11252
+ }
11253
+ return false;
11254
+ }
11255
+ function detectVerticalSquash(img, iw, ih) {
11256
+ var canvas = document.createElement('canvas');
11257
+ canvas.width = 1;
11258
+ canvas.height = ih;
11259
+ var ctx = canvas.getContext('2d');
11260
+ ctx.drawImage(img, 0, 0);
11261
+ var data = ctx.getImageData(0, 0, 1, ih).data;
11262
+ var sy = 0,
11263
+ ey = ih,
11264
+ py = ih;
11265
+ while (py > sy) {
11266
+ var alpha = data[(py - 1) * 4 + 3];
11267
+ if (alpha === 0) ey = py;else sy = py;
11268
+ py = ey + sy >> 1;
11269
+ }
11270
+ var ratio = py / ih;
11271
+ return ratio === 0 ? 1 : ratio;
11272
+ }
11273
+ function renderImageToDataURL(img, options, doSquash) {
11274
+ var canvas = document.createElement('canvas');
11275
+ renderImageToCanvas(img, canvas, options, doSquash);
11276
+ return canvas.toDataURL("image/jpeg", options.quality || 0.8);
11277
+ }
11278
+ function renderImageToCanvas(img, canvas, options, doSquash) {
11279
+ var iw = img.naturalWidth,
11280
+ ih = img.naturalHeight;
11281
+ if (!(iw + ih)) return;
11282
+ var width = options.width,
11283
+ height = options.height;
11284
+ var ctx = canvas.getContext('2d');
11285
+ ctx.save();
11286
+ transformCoordinate(canvas, ctx, width, height, options.orientation);
11287
+ var subsampled = detectSubsampling(img);
11288
+ if (subsampled) {
11289
+ iw /= 2;
11290
+ ih /= 2;
11291
+ }
11292
+ var d = 1024;
11293
+ var tmpCanvas = document.createElement('canvas');
11294
+ tmpCanvas.width = tmpCanvas.height = d;
11295
+ var tmpCtx = tmpCanvas.getContext('2d');
11296
+ var vertSquashRatio = doSquash ? detectVerticalSquash(img, iw, ih) : 1;
11297
+ var dw = Math.ceil(d * width / iw);
11298
+ var dh = Math.ceil(d * height / ih / vertSquashRatio);
11299
+ var sy = 0,
11300
+ dy = 0;
11301
+ while (sy < ih) {
11302
+ var sx = 0,
11303
+ dx = 0;
11304
+ while (sx < iw) {
11305
+ tmpCtx.clearRect(0, 0, d, d);
11306
+ tmpCtx.drawImage(img, -sx, -sy);
11307
+ ctx.drawImage(tmpCanvas, 0, 0, d, d, dx, dy, dw, dh);
11308
+ sx += d;
11309
+ dx += dw;
11310
+ }
11311
+ sy += d;
11312
+ dy += dh;
11313
+ }
11314
+ ctx.restore();
11315
+ }
11316
+ function transformCoordinate(canvas, ctx, width, height, orientation) {
11317
+ switch (orientation) {
11318
+ case 5:
11319
+ case 6:
11320
+ case 7:
11321
+ case 8:
11322
+ canvas.width = height;
11323
+ canvas.height = width;
11324
+ break;
11325
+ default:
11326
+ canvas.width = width;
11327
+ canvas.height = height;
11328
+ }
11329
+ switch (orientation) {
11330
+ case 2:
11331
+ ctx.translate(width, 0);
11332
+ ctx.scale(-1, 1);
11333
+ break;
11334
+ case 3:
11335
+ ctx.translate(width, height);
11336
+ ctx.rotate(Math.PI);
11337
+ break;
11338
+ case 4:
11339
+ ctx.translate(0, height);
11340
+ ctx.scale(1, -1);
11341
+ break;
11342
+ case 5:
11343
+ ctx.rotate(0.5 * Math.PI);
11344
+ ctx.scale(1, -1);
11345
+ break;
11346
+ case 6:
11347
+ ctx.rotate(0.5 * Math.PI);
11348
+ ctx.translate(0, -height);
11349
+ break;
11350
+ case 7:
11351
+ ctx.rotate(0.5 * Math.PI);
11352
+ ctx.translate(width, -height);
11353
+ ctx.scale(-1, 1);
11354
+ break;
11355
+ case 8:
11356
+ ctx.rotate(-0.5 * Math.PI);
11357
+ ctx.translate(-width, 0);
11358
+ break;
11359
+ }
11360
+ }
11361
+ var URL = window.URL && window.URL.createObjectURL ? window.URL : window.webkitURL && window.webkitURL.createObjectURL ? window.webkitURL : null;
11362
+
11363
+ // -------------------------
11364
+ // MegaPixImage class
11365
+ // -------------------------
11366
+ var MegaPixImage = /*#__PURE__*/function () {
11367
+ function MegaPixImage(srcImage) {
11368
+ _classCallCheck(this, MegaPixImage);
11369
+ if (window.Blob && srcImage instanceof Blob) {
11370
+ if (!URL) throw Error("No createObjectURL function found");
11371
+ var img = new Image();
11372
+ img.src = URL.createObjectURL(srcImage);
11373
+ this.blob = srcImage;
11374
+ srcImage = img;
11375
+ }
11376
+ if (!srcImage.naturalWidth && !srcImage.naturalHeight) {
11377
+ this.imageLoadListeners = [];
11378
+ var _this = this;
11379
+ srcImage.onload = srcImage.onerror = function () {
11380
+ var listeners = _this.imageLoadListeners;
11381
+ if (listeners) {
11382
+ _this.imageLoadListeners = null;
11383
+ listeners.forEach(function (fn) {
11384
+ return fn();
11385
+ });
11386
+ }
11387
+ };
11388
+ }
11389
+ this.srcImage = srcImage;
11390
+ }
11391
+ return _createClass(MegaPixImage, [{
11392
+ key: "render",
11393
+ value: function render(target, options, callback) {
11394
+ var _this2 = this;
11395
+ if (this.imageLoadListeners) {
11396
+ this.imageLoadListeners.push(function () {
11397
+ _this2.render(target, options, callback);
11398
+ });
11399
+ return;
11400
+ }
11401
+ options = options || {};
11402
+ var imgWidth = this.srcImage.naturalWidth,
11403
+ imgHeight = this.srcImage.naturalHeight;
11404
+ var width = options.width,
11405
+ height = options.height;
11406
+ var maxWidth = options.maxWidth,
11407
+ maxHeight = options.maxHeight;
11408
+ var doSquash = !this.blob || this.blob.type === 'image/jpeg';
11409
+ if (width && !height) height = imgHeight * width / imgWidth << 0;else if (height && !width) width = imgWidth * height / imgHeight << 0;else {
11410
+ width = imgWidth;
11411
+ height = imgHeight;
11412
+ }
11413
+ if (maxWidth && width > maxWidth) {
11414
+ width = maxWidth;
11415
+ height = imgHeight * width / imgWidth << 0;
11416
+ }
11417
+ if (maxHeight && height > maxHeight) {
11418
+ height = maxHeight;
11419
+ width = imgWidth * height / imgHeight << 0;
11420
+ }
11421
+ var opt = MegaPixImage_objectSpread({
11422
+ width: width,
11423
+ height: height
11424
+ }, options);
11425
+ var tagName = target.tagName.toLowerCase();
11426
+ if (tagName === 'img') target.src = renderImageToDataURL(this.srcImage, opt, doSquash);else if (tagName === 'canvas') renderImageToCanvas(this.srcImage, target, opt, doSquash);
11427
+ if (typeof this.onrender === 'function') this.onrender(target);
11428
+ if (callback) callback();
11429
+ if (this.blob) {
11430
+ this.blob = null;
11431
+ URL.revokeObjectURL(this.srcImage.src);
11432
+ }
11433
+ }
11434
+ }]);
11435
+ }(); // -------------------------
11436
+ // ESM export default
11437
+ // -------------------------
11438
+ /* harmony default export */ const lib_MegaPixImage = (MegaPixImage);
11486
11439
  ;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/upload/upload.vue?vue&type=script&lang=js
11487
11440
 
11488
11441
  // import MegaPixImage from '../../lib/MegaPixImage'
@@ -11555,7 +11508,7 @@ var uploadvue_type_script_lang_js_prefixCls = 'dpzvc-upload';
11555
11508
  var _this = this;
11556
11509
  var data = null;
11557
11510
  var img = new Image();
11558
- var mpImg = new MegaPixImage(file);
11511
+ var mpImg = new lib_MegaPixImage(file);
11559
11512
  mpImg.render(img, {
11560
11513
  maxWidth: 600,
11561
11514
  quality: 0.8
@@ -11662,8 +11615,8 @@ var uploadvue_type_script_lang_js_prefixCls = 'dpzvc-upload';
11662
11615
  ;
11663
11616
  var upload_component = normalizeComponent(
11664
11617
  upload_uploadvue_type_script_lang_js,
11665
- uploadvue_type_template_id_b2513a8a_render,
11666
- uploadvue_type_template_id_b2513a8a_staticRenderFns,
11618
+ uploadvue_type_template_id_23492f0b_render,
11619
+ uploadvue_type_template_id_23492f0b_staticRenderFns,
11667
11620
  false,
11668
11621
  null,
11669
11622
  null,