zartui 3.1.28 → 3.1.30

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/zartui.cjs.js CHANGED
@@ -11884,15 +11884,24 @@ var stdin_default$S = vue.defineComponent({
11884
11884
  const chooseSenior = (index) => {
11885
11885
  updateSelectParent(index);
11886
11886
  breadcrumbData.value.splice(index + 1);
11887
- dataList.value = historyLayers.value[index + 1];
11887
+ if (historyLayers.value.length > 0) {
11888
+ dataList.value = historyLayers.value[index + 1];
11889
+ } else {
11890
+ dataList.value = deepClone(props.treeData);
11891
+ }
11888
11892
  historyLayers.value.splice(index + 1);
11889
11893
  };
11890
11894
  const showRadio = (item) => {
11891
11895
  return !showSub(item) || showSub(item) && props.showParentChecked;
11892
11896
  };
11893
11897
  adapterHierarchTree(props.treeData, false);
11898
+ const reset = () => {
11899
+ checkedList.value = [];
11900
+ chooseSenior(-1);
11901
+ };
11894
11902
  useExpose({
11895
- toNodeLevel
11903
+ toNodeLevel,
11904
+ reset
11896
11905
  });
11897
11906
  return () => vue.createVNode("div", {
11898
11907
  "class": bem$A()
@@ -20545,7 +20554,7 @@ const Lazyload = {
20545
20554
  });
20546
20555
  }
20547
20556
  };
20548
- const version = "3.1.28";
20557
+ const version = "3.1.30";
20549
20558
  function install(app) {
20550
20559
  const components = [
20551
20560
  ActionSheet,
package/lib/zartui.es.js CHANGED
@@ -11882,15 +11882,24 @@ var stdin_default$S = defineComponent({
11882
11882
  const chooseSenior = (index) => {
11883
11883
  updateSelectParent(index);
11884
11884
  breadcrumbData.value.splice(index + 1);
11885
- dataList.value = historyLayers.value[index + 1];
11885
+ if (historyLayers.value.length > 0) {
11886
+ dataList.value = historyLayers.value[index + 1];
11887
+ } else {
11888
+ dataList.value = deepClone(props.treeData);
11889
+ }
11886
11890
  historyLayers.value.splice(index + 1);
11887
11891
  };
11888
11892
  const showRadio = (item) => {
11889
11893
  return !showSub(item) || showSub(item) && props.showParentChecked;
11890
11894
  };
11891
11895
  adapterHierarchTree(props.treeData, false);
11896
+ const reset = () => {
11897
+ checkedList.value = [];
11898
+ chooseSenior(-1);
11899
+ };
11892
11900
  useExpose({
11893
- toNodeLevel
11901
+ toNodeLevel,
11902
+ reset
11894
11903
  });
11895
11904
  return () => createVNode("div", {
11896
11905
  "class": bem$A()
@@ -20543,7 +20552,7 @@ const Lazyload = {
20543
20552
  });
20544
20553
  }
20545
20554
  };
20546
- const version = "3.1.28";
20555
+ const version = "3.1.30";
20547
20556
  function install(app) {
20548
20557
  const components = [
20549
20558
  ActionSheet,
package/lib/zartui.js CHANGED
@@ -12122,15 +12122,24 @@
12122
12122
  const chooseSenior = (index) => {
12123
12123
  updateSelectParent(index);
12124
12124
  breadcrumbData.value.splice(index + 1);
12125
- dataList.value = historyLayers.value[index + 1];
12125
+ if (historyLayers.value.length > 0) {
12126
+ dataList.value = historyLayers.value[index + 1];
12127
+ } else {
12128
+ dataList.value = deepClone(props.treeData);
12129
+ }
12126
12130
  historyLayers.value.splice(index + 1);
12127
12131
  };
12128
12132
  const showRadio = (item) => {
12129
12133
  return !showSub(item) || showSub(item) && props.showParentChecked;
12130
12134
  };
12131
12135
  adapterHierarchTree(props.treeData, false);
12136
+ const reset = () => {
12137
+ checkedList.value = [];
12138
+ chooseSenior(-1);
12139
+ };
12132
12140
  useExpose({
12133
- toNodeLevel
12141
+ toNodeLevel,
12142
+ reset
12134
12143
  });
12135
12144
  return () => vue.createVNode("div", {
12136
12145
  "class": bem$A()
@@ -15375,16 +15384,28 @@
15375
15384
  );
15376
15385
  });
15377
15386
  }
15378
- compress(canvas, filename, lastModified, type, quality) {
15387
+ compress(canvas, filename, lastModified, type, quality, lastCompressFileSize = -1) {
15379
15388
  return canvas2File(canvas, filename, lastModified, type, quality).then(
15380
15389
  (file) => {
15381
- if (file.size > this.compressOptions.photoFileSizeLimit * 1024 && quality - JPEG_QUALITY_STEP > MIN_JPEG_QUALITY) {
15390
+ let qualityStep = JPEG_QUALITY_STEP;
15391
+ if (file.size > this.compressOptions.photoFileSizeLimit * 1024) {
15392
+ let factor = Math.floor(file.size / (1024 * this.compressOptions.photoFileSizeLimit));
15393
+ if (factor > 1 && quality > MIN_JPEG_QUALITY) {
15394
+ qualityStep = this.roundToDecimalPlace(JPEG_QUALITY_STEP * factor, 2);
15395
+ let maxQualityStep = this.roundToDecimalPlace(quality - MIN_JPEG_QUALITY, 2);
15396
+ qualityStep = Math.min(qualityStep, maxQualityStep);
15397
+ }
15398
+ }
15399
+ let compressFileSizeChanged = lastCompressFileSize === -1 || file.size < lastCompressFileSize;
15400
+ let nextCompressQuality = this.roundToDecimalPlace(quality - qualityStep, 2);
15401
+ if (compressFileSizeChanged && file.size > this.compressOptions.photoFileSizeLimit * 1024 && this.compareFloats(nextCompressQuality, MIN_JPEG_QUALITY) >= 0) {
15382
15402
  return this.compress(
15383
15403
  canvas,
15384
15404
  filename,
15385
15405
  lastModified,
15386
15406
  type,
15387
- quality - JPEG_QUALITY_STEP
15407
+ this.roundToDecimalPlace(nextCompressQuality, 2),
15408
+ file.size
15388
15409
  );
15389
15410
  } else {
15390
15411
  return Promise.resolve(file);
@@ -15392,6 +15413,25 @@
15392
15413
  }
15393
15414
  );
15394
15415
  }
15416
+ /**
15417
+ * 浮点型数据比较大小
15418
+ */
15419
+ compareFloats(a, b) {
15420
+ const diff = Math.abs(a - b);
15421
+ if (diff < Number.EPSILON) {
15422
+ return 0;
15423
+ }
15424
+ return a - b > 0 ? 1 : -1;
15425
+ }
15426
+ /**
15427
+ * 浮点型数据保留小数(四舍五入)
15428
+ * @param num 浮点型数据
15429
+ * @param decimalPlaces 保留的小数位数
15430
+ */
15431
+ roundToDecimalPlace(num, decimalPlaces) {
15432
+ const factor = Math.pow(10, decimalPlaces);
15433
+ return Math.round(num * factor) / factor;
15434
+ }
15395
15435
  };
15396
15436
  const chooseImage = (type) => {
15397
15437
  return new Promise((resolve, reject) => {
@@ -24543,7 +24583,7 @@
24543
24583
  });
24544
24584
  }
24545
24585
  };
24546
- const version = "3.1.28";
24586
+ const version = "3.1.30";
24547
24587
  function install(app) {
24548
24588
  const components = [
24549
24589
  ActionSheet,