dfish-widget 1.0.90 → 1.0.91

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/lib/index.esm.js CHANGED
@@ -195,7 +195,7 @@ var loc = {
195
195
  no_files: '<没有文件>',
196
196
  upload_error: '(上传失败)',
197
197
  upload_limit: '上传数量超过上限(最多{0}个)',
198
- upload_invalid_file_type: '无效的文件类型:<br>{0}',
198
+ upload_invalid_file_type: '无效的文件类型:<br>{0}<br><br>只能选择 {1} 格式文件',
199
199
  upload_invalid_data: '错误的文件数据格式:<br>{0}',
200
200
  upload_no_data: '缺少文件数据',
201
201
  upload_maxfilesize: '上传失败: {0}<br><br>文件大小不能超过{1}',
@@ -2381,7 +2381,7 @@ var script$1k = {
2381
2381
  props: ['data'],
2382
2382
  data() {
2383
2383
  return {
2384
- rotate: 0,
2384
+ rotate: {},
2385
2385
  current: $$1.lodash.get(this.data, 'options.current', 0),
2386
2386
  }
2387
2387
  },
@@ -2390,8 +2390,13 @@ var script$1k = {
2390
2390
  $$1.close(this);
2391
2391
  },
2392
2392
  rot(a) {
2393
- let r = this.rotate;
2394
- let b = $$1.bcr(this.$refs.swiper.el());
2393
+ let n = this.$refs.swiper.focusIndex;
2394
+ let r = this.rotate[n];
2395
+ if (r == null) {
2396
+ r = this.rotate[n] = 0;
2397
+ }
2398
+ let d = this.$refs.swiper.getCurrentItem().el();
2399
+ let b = $$1.bcr(d);
2395
2400
  let w = b.width - 40;
2396
2401
  let h = b.height - 80;
2397
2402
  if (a > 0) {
@@ -2400,12 +2405,12 @@ var script$1k = {
2400
2405
  r -= 90;
2401
2406
  }
2402
2407
  let t = (r / 90) % 2;
2403
- $$1.q('.w-swiper-item.z-on ._img', this.$refs.swiper.el()).css({
2408
+ $$1.q('._img', d).css({
2404
2409
  transform: 'rotate(' + r + 'deg)',
2405
2410
  maxWidth: t ? h : w,
2406
2411
  maxHeight: t ? w : h,
2407
2412
  });
2408
- this.rotate = r;
2413
+ this.rotate[n] = r;
2409
2414
  }
2410
2415
  },
2411
2416
  computed: {
@@ -6067,6 +6072,12 @@ var script$L = {
6067
6072
  let c = s.findIndex(v => this.isCurrentChild(a, v));
6068
6073
  this.focusIndex = c;
6069
6074
  },
6075
+ getCurrentItem() {
6076
+ if (this.el()) {
6077
+ let dom = $$1.q('>.w-swiper-cont>.w-swiper-item', this.el())[this.focusIndex];
6078
+ return dom && $$1(dom)
6079
+ }
6080
+ },
6070
6081
  clickArrow(a) {
6071
6082
  this.focusIndex += a;
6072
6083
  },
@@ -10444,7 +10455,7 @@ const suffixHooks = {
10444
10455
  name: 'w-fileupload',
10445
10456
  mixins: [script$A],
10446
10457
  props: ['uploadSrc', 'thumbnailSrc', 'downloadSrc', 'uploadLimit', 'sizeLimit', 'maxFileSize', 'minFileSize',
10447
- 'fileTypes', 'filter', 'success', 'error', 'itemWidth', 'align', 'vertical', 'gap'
10458
+ 'fileTypes', 'filter', 'success', 'error', 'itemWidth', 'align', 'vertical', 'gap', 'checkFile'
10448
10459
  ],
10449
10460
  data() {
10450
10461
  return {
@@ -10513,14 +10524,19 @@ const suffixHooks = {
10513
10524
  },
10514
10525
  fileSelected(e) {
10515
10526
  if (this.x.uploadLimit > 1 && e.target.files.length + this.list.length > this.x.uploadLimit) {
10527
+ e.target.value = '';
10516
10528
  return $$1.alert($$1.loc.ps($$1.loc.form.upload_limit, this.x.uploadLimit))
10517
10529
  }
10518
10530
  let xfs = this.x.maxFileSize && fileByte(this.x.maxFileSize);
10519
10531
  let nfs = this.x.minFileSize && fileByte(this.x.minFileSize);
10520
10532
  let ft = this.getFileTypes();
10533
+ let cf = this.x.checkFile;
10521
10534
  let xfs_names;
10522
10535
  let nfs_names;
10523
10536
  let ft_names;
10537
+ let cf_errors;
10538
+ let fileList = cf && this.list.filter(item => item.file).map(item => item.file);
10539
+ let valueList = cf && this.list.filter(item => item.value).map(item => item.value);
10524
10540
  $$1.lodash.each(e.target.files, file => {
10525
10541
  let sfx = '.' + $$1.strFrom(file.name, '.', true).toLowerCase();
10526
10542
  if (xfs && file.size > xfs) {
@@ -10530,7 +10546,12 @@ const suffixHooks = {
10530
10546
  } else if (ft && !$$1.idsAny(ft, sfx, ',')) {
10531
10547
  (ft_names || (ft_names = [])).push(file.name);
10532
10548
  } else {
10533
- this.list.push({file});
10549
+ let err = cf && cf(file, e.target.files, fileList, valueList);
10550
+ if (err) {
10551
+ (cf_errors || (cf_errors = [])).push(err);
10552
+ } else {
10553
+ this.list.push({file});
10554
+ }
10534
10555
  }
10535
10556
  });
10536
10557
  if (xfs_names) {
@@ -10538,11 +10559,12 @@ const suffixHooks = {
10538
10559
  } else if (nfs_names) {
10539
10560
  $$1.alert($$1.loc.ps($$1.loc.form.upload_minfilesize, nfs_names.join('<br>'), this.x.minFileSize));
10540
10561
  } else if (ft_names) {
10541
- $$1.alert($$1.loc.ps($$1.loc.form.upload_invalid_file_type, ft_names.join('<br>')));
10562
+ $$1.alert($$1.loc.ps($$1.loc.form.upload_invalid_file_type, ft_names.join('<br>'), ft));
10563
+ } else if (cf_errors) {
10564
+ $$1.alert(cf_errors.join('<br>'));
10542
10565
  }
10543
10566
  e.target.value = ''; // 获取文件后要设value为空,否则下一次选择同一个文件不会触发onchange
10544
10567
  this.nextUpload();
10545
-
10546
10568
  },
10547
10569
  upload(item) {
10548
10570
  if (this.x.uploadSrc && !item.loading) {