zartui 2.1.33 → 2.1.34

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 CHANGED
@@ -76,7 +76,7 @@ import TextEllipsis from './text-ellipsis';
76
76
  import Timeline from './timeline';
77
77
  import Toast from './toast';
78
78
  import Uploader from './uploader';
79
- var version = '2.1.33';
79
+ var version = '2.1.34';
80
80
  function install(Vue) {
81
81
  var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, SpeechRecognizer, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, TextEllipsis, Timeline, Toast, Uploader];
82
82
  components.forEach(function (item) {
@@ -1,6 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
7
  // Utils
5
8
  import { createNamespace, isDef } from '../utils';
6
9
  import Icon from "../icon";
@@ -12,6 +15,7 @@ import ZtActionSheet from "../action-sheet";
12
15
  import ZtGrid from "../grid";
13
16
  // Types
14
17
  import { MediaAddType, MediaType, MediaUploadStatus } from "./type";
18
+ import { fromBuffer as fileTypeFromBuffer } from 'file-type/browser';
15
19
  import { checkWatermarkConfigSupported, CompressOptions, file2DataURL, ImageProcessor, ResizeOptions, WatermarkOptions } from "@egova-mobile/app-media-utils";
16
20
 
17
21
  // import components
@@ -42,6 +46,19 @@ import Sortable from "sortablejs";
42
46
 
43
47
  // 单个文件最大限制,单位为M(目前限制是100M)
44
48
  var FILE_SIZE_LIMIT = 100;
49
+
50
+ // 兼容的文件类型映射(与后端保持一致)
51
+ var COMPATIBLE_TYPE_MAPPINGS = {
52
+ 'mp3': new Set(['mpga']),
53
+ 'mp4': new Set(['qt']),
54
+ 'html': new Set(['txt']),
55
+ 'json': new Set(['txt']),
56
+ 'xml': new Set(['txt']),
57
+ 'gif': new Set(['png']),
58
+ 'jpeg': new Set(['jpg']),
59
+ 'jpg': new Set(['jpeg']),
60
+ 'm4a': new Set(['mp4', 'mp4a', 'x-m4a'])
61
+ };
45
62
  var _createNamespace = createNamespace('media-picker'),
46
63
  createComponent = _createNamespace[0],
47
64
  bem = _createNamespace[1];
@@ -389,7 +406,7 @@ export default createComponent({
389
406
  handleInputFiles: function handleInputFiles(event) {
390
407
  var _this4 = this;
391
408
  return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
392
- var files, response, data;
409
+ var files, _iterator, _step, file, buffer, fileType, fileName, extensionMatch, extension, compatibleTypes, isCompatible, response, data;
393
410
  return _regeneratorRuntime.wrap(function _callee$(_context) {
394
411
  while (1) switch (_context.prev = _context.next) {
395
412
  case 0:
@@ -416,21 +433,77 @@ export default createComponent({
416
433
  }
417
434
  return _context.abrupt("return");
418
435
  case 9:
419
- if (!_this4.beforeRead) {
420
- _context.next = 24;
436
+ if (!_this4.keepFileType) {
437
+ _context.next = 37;
421
438
  break;
422
439
  }
423
440
  _context.prev = 10;
424
- _context.next = 13;
441
+ _iterator = _createForOfIteratorHelperLoose(files);
442
+ case 12:
443
+ if ((_step = _iterator()).done) {
444
+ _context.next = 32;
445
+ break;
446
+ }
447
+ file = _step.value;
448
+ _context.next = 16;
449
+ return file.slice(0, 4100).arrayBuffer();
450
+ case 16:
451
+ buffer = _context.sent;
452
+ _context.next = 19;
453
+ return fileTypeFromBuffer(new Uint8Array(buffer));
454
+ case 19:
455
+ fileType = _context.sent;
456
+ // 获取文件扩展名
457
+ fileName = file.name.toLowerCase();
458
+ extensionMatch = fileName.match(/\.([^.]+)$/);
459
+ extension = extensionMatch ? extensionMatch[1] : ''; // 校验文件类型
460
+ if (!(fileType && extension)) {
461
+ _context.next = 30;
462
+ break;
463
+ }
464
+ if (!(fileType.ext !== extension)) {
465
+ _context.next = 30;
466
+ break;
467
+ }
468
+ // 检查是否为兼容类型
469
+ compatibleTypes = COMPATIBLE_TYPE_MAPPINGS[extension];
470
+ isCompatible = compatibleTypes && compatibleTypes.has(fileType.ext);
471
+ if (isCompatible) {
472
+ _context.next = 30;
473
+ break;
474
+ }
475
+ Toast.fail({
476
+ message: "\u6587\u4EF6\u540E\u7F00\u4E0E\u5B9E\u9645\u6587\u4EF6\u7C7B\u578B\u4E0D\u5339\u914D\uFF1A" + file.name,
477
+ duration: 5000
478
+ });
479
+ return _context.abrupt("return");
480
+ case 30:
481
+ _context.next = 12;
482
+ break;
483
+ case 32:
484
+ _context.next = 37;
485
+ break;
486
+ case 34:
487
+ _context.prev = 34;
488
+ _context.t0 = _context["catch"](10);
489
+ console.error('文件类型校验失败:', _context.t0);
490
+ // 校验失败时继续处理,不阻止文件上传
491
+ case 37:
492
+ if (!_this4.beforeRead) {
493
+ _context.next = 52;
494
+ break;
495
+ }
496
+ _context.prev = 38;
497
+ _context.next = 41;
425
498
  return _this4.beforeRead(files);
426
- case 13:
499
+ case 41:
427
500
  response = _context.sent;
428
501
  if (response) {
429
- _context.next = 16;
502
+ _context.next = 44;
430
503
  break;
431
504
  }
432
505
  return _context.abrupt("return");
433
- case 16:
506
+ case 44:
434
507
  if (Array.isArray(response)) {
435
508
  data = response.filter(function (item) {
436
509
  return !!item;
@@ -439,22 +512,22 @@ export default createComponent({
439
512
  } else {
440
513
  _this4.readFiles(files);
441
514
  }
442
- _context.next = 22;
515
+ _context.next = 50;
443
516
  break;
444
- case 19:
445
- _context.prev = 19;
446
- _context.t0 = _context["catch"](10);
447
- Toast.fail(_context.t0.message);
448
- case 22:
449
- _context.next = 25;
517
+ case 47:
518
+ _context.prev = 47;
519
+ _context.t1 = _context["catch"](38);
520
+ Toast.fail(_context.t1.message);
521
+ case 50:
522
+ _context.next = 53;
450
523
  break;
451
- case 24:
524
+ case 52:
452
525
  _this4.readFiles(files);
453
- case 25:
526
+ case 53:
454
527
  case "end":
455
528
  return _context.stop();
456
529
  }
457
- }, _callee, null, [[10, 19]]);
530
+ }, _callee, null, [[10, 34], [38, 47]]);
458
531
  }))();
459
532
  },
460
533
  readFiles: function readFiles(files) {
package/lib/1.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (typeof self !== 'undefined' ? self : this["webpackJsonpzart"] = typeof self !== 'undefined' ? self : this["webpackJsonpzart"] || []).push([[1],{
2
2
 
3
- /***/ 14:
3
+ /***/ 62:
4
4
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5
5
 
6
6
  "use strict";
@@ -52,202 +52,11 @@ var isWindVane = /.+AliApp\((\w+)\/((?:\d+\.)+\d+)\).* .*(WindVane)(?:\/((?:\d+\
52
52
  isWindVane: isWindVane,
53
53
  isFRM: isFRM
54
54
  });
55
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(16), __webpack_require__(10)))
55
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15), __webpack_require__(30)))
56
56
 
57
57
  /***/ }),
58
58
 
59
- /***/ 16:
60
- /***/ (function(module, exports) {
61
-
62
- // shim for using process in browser
63
- var process = module.exports = {};
64
-
65
- // cached from whatever global is present so that test runners that stub it
66
- // don't break things. But we need to wrap it in a try catch in case it is
67
- // wrapped in strict mode code which doesn't define any globals. It's inside a
68
- // function because try/catches deoptimize in certain engines.
69
-
70
- var cachedSetTimeout;
71
- var cachedClearTimeout;
72
-
73
- function defaultSetTimout() {
74
- throw new Error('setTimeout has not been defined');
75
- }
76
- function defaultClearTimeout () {
77
- throw new Error('clearTimeout has not been defined');
78
- }
79
- (function () {
80
- try {
81
- if (typeof setTimeout === 'function') {
82
- cachedSetTimeout = setTimeout;
83
- } else {
84
- cachedSetTimeout = defaultSetTimout;
85
- }
86
- } catch (e) {
87
- cachedSetTimeout = defaultSetTimout;
88
- }
89
- try {
90
- if (typeof clearTimeout === 'function') {
91
- cachedClearTimeout = clearTimeout;
92
- } else {
93
- cachedClearTimeout = defaultClearTimeout;
94
- }
95
- } catch (e) {
96
- cachedClearTimeout = defaultClearTimeout;
97
- }
98
- } ())
99
- function runTimeout(fun) {
100
- if (cachedSetTimeout === setTimeout) {
101
- //normal enviroments in sane situations
102
- return setTimeout(fun, 0);
103
- }
104
- // if setTimeout wasn't available but was latter defined
105
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
106
- cachedSetTimeout = setTimeout;
107
- return setTimeout(fun, 0);
108
- }
109
- try {
110
- // when when somebody has screwed with setTimeout but no I.E. maddness
111
- return cachedSetTimeout(fun, 0);
112
- } catch(e){
113
- try {
114
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
115
- return cachedSetTimeout.call(null, fun, 0);
116
- } catch(e){
117
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
118
- return cachedSetTimeout.call(this, fun, 0);
119
- }
120
- }
121
-
122
-
123
- }
124
- function runClearTimeout(marker) {
125
- if (cachedClearTimeout === clearTimeout) {
126
- //normal enviroments in sane situations
127
- return clearTimeout(marker);
128
- }
129
- // if clearTimeout wasn't available but was latter defined
130
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
131
- cachedClearTimeout = clearTimeout;
132
- return clearTimeout(marker);
133
- }
134
- try {
135
- // when when somebody has screwed with setTimeout but no I.E. maddness
136
- return cachedClearTimeout(marker);
137
- } catch (e){
138
- try {
139
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
140
- return cachedClearTimeout.call(null, marker);
141
- } catch (e){
142
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
143
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
144
- return cachedClearTimeout.call(this, marker);
145
- }
146
- }
147
-
148
-
149
-
150
- }
151
- var queue = [];
152
- var draining = false;
153
- var currentQueue;
154
- var queueIndex = -1;
155
-
156
- function cleanUpNextTick() {
157
- if (!draining || !currentQueue) {
158
- return;
159
- }
160
- draining = false;
161
- if (currentQueue.length) {
162
- queue = currentQueue.concat(queue);
163
- } else {
164
- queueIndex = -1;
165
- }
166
- if (queue.length) {
167
- drainQueue();
168
- }
169
- }
170
-
171
- function drainQueue() {
172
- if (draining) {
173
- return;
174
- }
175
- var timeout = runTimeout(cleanUpNextTick);
176
- draining = true;
177
-
178
- var len = queue.length;
179
- while(len) {
180
- currentQueue = queue;
181
- queue = [];
182
- while (++queueIndex < len) {
183
- if (currentQueue) {
184
- currentQueue[queueIndex].run();
185
- }
186
- }
187
- queueIndex = -1;
188
- len = queue.length;
189
- }
190
- currentQueue = null;
191
- draining = false;
192
- runClearTimeout(timeout);
193
- }
194
-
195
- process.nextTick = function (fun) {
196
- var args = new Array(arguments.length - 1);
197
- if (arguments.length > 1) {
198
- for (var i = 1; i < arguments.length; i++) {
199
- args[i - 1] = arguments[i];
200
- }
201
- }
202
- queue.push(new Item(fun, args));
203
- if (queue.length === 1 && !draining) {
204
- runTimeout(drainQueue);
205
- }
206
- };
207
-
208
- // v8 likes predictible objects
209
- function Item(fun, array) {
210
- this.fun = fun;
211
- this.array = array;
212
- }
213
- Item.prototype.run = function () {
214
- this.fun.apply(null, this.array);
215
- };
216
- process.title = 'browser';
217
- process.browser = true;
218
- process.env = {};
219
- process.argv = [];
220
- process.version = ''; // empty string to avoid regexp issues
221
- process.versions = {};
222
-
223
- function noop() {}
224
-
225
- process.on = noop;
226
- process.addListener = noop;
227
- process.once = noop;
228
- process.off = noop;
229
- process.removeListener = noop;
230
- process.removeAllListeners = noop;
231
- process.emit = noop;
232
- process.prependListener = noop;
233
- process.prependOnceListener = noop;
234
-
235
- process.listeners = function (name) { return [] }
236
-
237
- process.binding = function (name) {
238
- throw new Error('process.binding is not supported');
239
- };
240
-
241
- process.cwd = function () { return '/' };
242
- process.chdir = function (dir) {
243
- throw new Error('process.chdir is not supported');
244
- };
245
- process.umask = function() { return 0; };
246
-
247
-
248
- /***/ }),
249
-
250
- /***/ 24:
59
+ /***/ 71:
251
60
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
252
61
 
253
62
  "use strict";
@@ -1789,7 +1598,7 @@ var egova_EgovaJsInterface = /** @class */ (function (_super) {
1789
1598
  /* harmony default export */ var egova = (egova_EgovaJsInterface);
1790
1599
  //# sourceMappingURL=index.js.map
1791
1600
  // EXTERNAL MODULE: ./node_modules/@uni/apis/es/packages/base/env/src/index.js
1792
- var src = __webpack_require__(14);
1601
+ var src = __webpack_require__(62);
1793
1602
 
1794
1603
  // CONCATENATED MODULE: ./node_modules/@uni/apis/es/utils/promisify.js
1795
1604
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }