zartui 3.0.3 → 3.0.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.
Files changed (220) hide show
  1. package/README.md +25 -0
  2. package/es/action-sheet/index.css +1 -1
  3. package/es/avatar/Avatar.d.ts +5 -1
  4. package/es/avatar/Avatar.mjs +9 -4
  5. package/es/avatar/index.css +1 -1
  6. package/es/avatar/index.d.ts +4 -1
  7. package/es/badge/Badge.d.ts +1 -1
  8. package/es/badge/index.d.ts +1 -1
  9. package/es/button/index.css +1 -1
  10. package/es/calendar/Calendar.mjs +2 -2
  11. package/es/calendar/index.css +1 -1
  12. package/es/cascader/index.css +1 -1
  13. package/es/cell/index.css +1 -1
  14. package/es/cell-group/CellGroup.d.ts +1 -1
  15. package/es/cell-group/index.d.ts +1 -1
  16. package/es/checkbox/index.css +1 -1
  17. package/es/col/Col.d.ts +1 -1
  18. package/es/col/index.d.ts +1 -1
  19. package/es/collapse-item/CollapseItem.d.ts +1 -1
  20. package/es/collapse-item/index.d.ts +1 -1
  21. package/es/config-provider/ConfigProvider.d.ts +1 -1
  22. package/es/config-provider/index.d.ts +2 -2
  23. package/es/dialog/index.css +1 -1
  24. package/es/divider/Divider.d.ts +1 -1
  25. package/es/divider/index.d.ts +1 -1
  26. package/es/dropdown-menu/DropdownMenu.d.ts +1 -1
  27. package/es/dropdown-menu/index.d.ts +1 -1
  28. package/es/empty/Empty.d.ts +1 -1
  29. package/es/empty/index.d.ts +1 -1
  30. package/es/field/index.css +1 -1
  31. package/es/grid/Grid.d.ts +1 -1
  32. package/es/grid/index.d.ts +1 -1
  33. package/es/grid-item/GridItem.d.ts +1 -1
  34. package/es/grid-item/index.css +1 -1
  35. package/es/grid-item/index.d.ts +1 -1
  36. package/es/icon/Icon.d.ts +1 -1
  37. package/es/icon/config.mjs +3 -2
  38. package/es/icon/index.css +1 -1
  39. package/es/icon/index.d.ts +1 -1
  40. package/es/image-preview/ImagePreview.d.ts +2 -1
  41. package/es/image-preview/ImagePreview.mjs +9 -4
  42. package/es/image-preview/ImagePreviewItem.d.ts +2 -1
  43. package/es/image-preview/ImagePreviewItem.mjs +22 -13
  44. package/es/image-preview/index.css +1 -1
  45. package/es/image-preview/index.d.ts +2 -1
  46. package/es/index.d.ts +1 -1
  47. package/es/index.mjs +1 -1
  48. package/es/lazyload/vue-lazyload/lazy-image.mjs +5 -5
  49. package/es/loading/Loading.d.ts +1 -1
  50. package/es/loading/index.d.ts +1 -1
  51. package/es/media-picker/MediaPicker.mjs +1 -1
  52. package/es/media-picker/image/DefaultAudioIcon.d.ts +1 -1
  53. package/es/media-picker/image/DefaultFileIcon.d.ts +1 -1
  54. package/es/media-picker/image/DefaultVideoIcon.d.ts +1 -1
  55. package/es/media-picker/image/DeleteIcon.d.ts +1 -1
  56. package/es/media-picker/image/PickFileIcon.d.ts +1 -1
  57. package/es/media-picker/image/PickPhotoIcon.d.ts +1 -1
  58. package/es/media-picker/image/TakeAudioIcon.d.ts +1 -1
  59. package/es/media-picker/image/TakePhotoIcon.d.ts +1 -1
  60. package/es/media-picker/image/TakeVideoIcon.d.ts +1 -1
  61. package/es/media-picker/util/media-util.d.ts +17 -2
  62. package/es/media-picker/util/media-util.mjs +137 -10
  63. package/es/media-picker/watermark/image-processor.mjs +28 -3
  64. package/es/media-picker/watermark/watermark.mjs +3 -3
  65. package/es/multiple-picker/MultiplePicker.mjs +1 -2
  66. package/es/multiple-picker/index.css +1 -1
  67. package/es/multiple-picker/types.d.ts +2 -1
  68. package/es/nav-bar/index.css +1 -1
  69. package/es/overlay/Overlay.d.ts +1 -1
  70. package/es/overlay/index.d.ts +1 -1
  71. package/es/picker/PickerColumn.mjs +5 -4
  72. package/es/picker/index.css +1 -1
  73. package/es/popup/Popup.d.ts +26 -0
  74. package/es/popup/Popup.mjs +12 -10
  75. package/es/popup/index.css +1 -1
  76. package/es/popup/index.d.ts +18 -0
  77. package/es/radio/index.css +1 -1
  78. package/es/row/Row.d.ts +1 -1
  79. package/es/row/index.d.ts +1 -1
  80. package/es/search/index.css +1 -1
  81. package/es/skeleton/Skeleton.d.ts +1 -1
  82. package/es/skeleton/index.d.ts +1 -1
  83. package/es/step/Step.d.ts +1 -1
  84. package/es/step/index.d.ts +1 -1
  85. package/es/stepper/Stepper.d.ts +1 -1
  86. package/es/stepper/Stepper.mjs +1 -2
  87. package/es/stepper/index.d.ts +1 -1
  88. package/es/style/base.css +1 -1
  89. package/es/style/css-variables.css +1 -1
  90. package/es/swipe/Swipe.mjs +1 -3
  91. package/es/swipe-item/SwipeItem.d.ts +1 -1
  92. package/es/swipe-item/index.d.ts +1 -1
  93. package/es/tab/Tab.d.ts +1 -1
  94. package/es/tab/index.d.ts +1 -1
  95. package/es/tabbar-item/index.css +1 -1
  96. package/es/tabs/TabsTitle.d.ts +1 -1
  97. package/es/tabs/index.css +1 -1
  98. package/es/time-picker/index.css +1 -1
  99. package/es/toast/index.css +1 -1
  100. package/es/utils/constant.d.ts +1 -0
  101. package/es/utils/constant.mjs +3 -1
  102. package/es/utils/mount-component.d.ts +1 -1
  103. package/lib/action-sheet/index.css +1 -1
  104. package/lib/avatar/Avatar.d.ts +5 -1
  105. package/lib/avatar/Avatar.js +9 -4
  106. package/lib/avatar/index.css +1 -1
  107. package/lib/avatar/index.d.ts +4 -1
  108. package/lib/badge/Badge.d.ts +1 -1
  109. package/lib/badge/index.d.ts +1 -1
  110. package/lib/button/index.css +1 -1
  111. package/lib/calendar/Calendar.js +2 -2
  112. package/lib/calendar/index.css +1 -1
  113. package/lib/cascader/index.css +1 -1
  114. package/lib/cell/index.css +1 -1
  115. package/lib/cell-group/CellGroup.d.ts +1 -1
  116. package/lib/cell-group/index.d.ts +1 -1
  117. package/lib/checkbox/index.css +1 -1
  118. package/lib/col/Col.d.ts +1 -1
  119. package/lib/col/index.d.ts +1 -1
  120. package/lib/collapse-item/CollapseItem.d.ts +1 -1
  121. package/lib/collapse-item/index.d.ts +1 -1
  122. package/lib/config-provider/ConfigProvider.d.ts +1 -1
  123. package/lib/config-provider/index.d.ts +2 -2
  124. package/lib/dialog/index.css +1 -1
  125. package/lib/divider/Divider.d.ts +1 -1
  126. package/lib/divider/index.d.ts +1 -1
  127. package/lib/dropdown-menu/DropdownMenu.d.ts +1 -1
  128. package/lib/dropdown-menu/index.d.ts +1 -1
  129. package/lib/empty/Empty.d.ts +1 -1
  130. package/lib/empty/index.d.ts +1 -1
  131. package/lib/field/index.css +1 -1
  132. package/lib/grid/Grid.d.ts +1 -1
  133. package/lib/grid/index.d.ts +1 -1
  134. package/lib/grid-item/GridItem.d.ts +1 -1
  135. package/lib/grid-item/index.css +1 -1
  136. package/lib/grid-item/index.d.ts +1 -1
  137. package/lib/icon/Icon.d.ts +1 -1
  138. package/lib/icon/config.js +3 -2
  139. package/lib/icon/index.css +1 -1
  140. package/lib/icon/index.d.ts +1 -1
  141. package/lib/image-preview/ImagePreview.d.ts +2 -1
  142. package/lib/image-preview/ImagePreview.js +9 -4
  143. package/lib/image-preview/ImagePreviewItem.d.ts +2 -1
  144. package/lib/image-preview/ImagePreviewItem.js +21 -12
  145. package/lib/image-preview/index.css +1 -1
  146. package/lib/image-preview/index.d.ts +2 -1
  147. package/lib/index.css +1 -1
  148. package/lib/index.d.ts +1 -1
  149. package/lib/index.js +1 -1
  150. package/lib/lazyload/vue-lazyload/lazy-image.js +6 -6
  151. package/lib/loading/Loading.d.ts +1 -1
  152. package/lib/loading/index.d.ts +1 -1
  153. package/lib/media-picker/MediaPicker.js +1 -1
  154. package/lib/media-picker/image/DefaultAudioIcon.d.ts +1 -1
  155. package/lib/media-picker/image/DefaultFileIcon.d.ts +1 -1
  156. package/lib/media-picker/image/DefaultVideoIcon.d.ts +1 -1
  157. package/lib/media-picker/image/DeleteIcon.d.ts +1 -1
  158. package/lib/media-picker/image/PickFileIcon.d.ts +1 -1
  159. package/lib/media-picker/image/PickPhotoIcon.d.ts +1 -1
  160. package/lib/media-picker/image/TakeAudioIcon.d.ts +1 -1
  161. package/lib/media-picker/image/TakePhotoIcon.d.ts +1 -1
  162. package/lib/media-picker/image/TakeVideoIcon.d.ts +1 -1
  163. package/lib/media-picker/util/media-util.d.ts +17 -2
  164. package/lib/media-picker/util/media-util.js +137 -10
  165. package/lib/media-picker/watermark/image-processor.js +22 -2
  166. package/lib/media-picker/watermark/watermark.js +5 -5
  167. package/lib/multiple-picker/MultiplePicker.js +1 -2
  168. package/lib/multiple-picker/index.css +1 -1
  169. package/lib/multiple-picker/types.d.ts +2 -1
  170. package/lib/nav-bar/index.css +1 -1
  171. package/lib/overlay/Overlay.d.ts +1 -1
  172. package/lib/overlay/index.d.ts +1 -1
  173. package/lib/picker/PickerColumn.js +5 -4
  174. package/lib/picker/index.css +1 -1
  175. package/lib/popup/Popup.d.ts +26 -0
  176. package/lib/popup/Popup.js +11 -9
  177. package/lib/popup/index.css +1 -1
  178. package/lib/popup/index.d.ts +18 -0
  179. package/lib/radio/index.css +1 -1
  180. package/lib/row/Row.d.ts +1 -1
  181. package/lib/row/index.d.ts +1 -1
  182. package/lib/search/index.css +1 -1
  183. package/lib/skeleton/Skeleton.d.ts +1 -1
  184. package/lib/skeleton/index.d.ts +1 -1
  185. package/lib/step/Step.d.ts +1 -1
  186. package/lib/step/index.d.ts +1 -1
  187. package/lib/stepper/Stepper.d.ts +1 -1
  188. package/lib/stepper/Stepper.js +1 -2
  189. package/lib/stepper/index.d.ts +1 -1
  190. package/lib/style/base.css +1 -1
  191. package/lib/style/css-variables.css +1 -1
  192. package/lib/swipe/Swipe.js +1 -3
  193. package/lib/swipe-item/SwipeItem.d.ts +1 -1
  194. package/lib/swipe-item/index.d.ts +1 -1
  195. package/lib/tab/Tab.d.ts +1 -1
  196. package/lib/tab/index.d.ts +1 -1
  197. package/lib/tabbar-item/index.css +1 -1
  198. package/lib/tabs/TabsTitle.d.ts +1 -1
  199. package/lib/tabs/index.css +1 -1
  200. package/lib/time-picker/index.css +1 -1
  201. package/lib/toast/index.css +1 -1
  202. package/lib/utils/constant.d.ts +1 -0
  203. package/lib/utils/constant.js +3 -1
  204. package/lib/utils/mount-component.d.ts +1 -1
  205. package/lib/web-types.json +1 -1
  206. package/lib/zartui.cjs.js +217 -144
  207. package/lib/zartui.es.js +215 -142
  208. package/lib/zartui.js +251 -112
  209. package/lib/zartui.min.js +1 -1
  210. package/package.json +4 -3
  211. package/es/media-picker/util/orientation-util.d.ts +0 -37
  212. package/es/media-picker/util/orientation-util.mjs +0 -118
  213. package/es/tabbar/image/common-normal.png +0 -0
  214. package/es/utils/date.d.ts +0 -29
  215. package/es/utils/date.mjs +0 -96
  216. package/lib/media-picker/util/orientation-util.d.ts +0 -37
  217. package/lib/media-picker/util/orientation-util.js +0 -137
  218. package/lib/tabbar/image/common-normal.png +0 -0
  219. package/lib/utils/date.d.ts +0 -29
  220. package/lib/utils/date.js +0 -115
package/lib/zartui.js CHANGED
@@ -628,6 +628,7 @@
628
628
  const HAPTICS_FEEDBACK = "zt-haptics-feedback";
629
629
  const ELLIPSIS = "zt-ellipsis";
630
630
  const FORM_KEY = Symbol("zt-form");
631
+ const LONG_PRESS_START_TIME = 500;
631
632
  function callInterceptor(interceptor, {
632
633
  args = [],
633
634
  done,
@@ -1075,6 +1076,8 @@
1075
1076
  safeAreaInsetTop: Boolean,
1076
1077
  safeAreaInsetBottom: Boolean,
1077
1078
  sliderContentHeight: makeNumberProp(60),
1079
+ minDragHeight: makeStringProp("40px"),
1080
+ maxDragHeight: makeStringProp("85vh"),
1078
1081
  slideable: Boolean
1079
1082
  });
1080
1083
  const [name$16, bem$13] = createNamespace("popup");
@@ -1092,15 +1095,13 @@
1092
1095
  let opened;
1093
1096
  let shouldReopen;
1094
1097
  const root = vue.ref();
1095
- const positionY = vue.ref(0);
1096
1098
  let timerId = setInterval(() => {
1097
1099
  }, 0);
1098
- const touchHeight = vue.ref(0);
1099
1100
  const contentStyle = vue.ref(`height:${props.sliderContentHeight}px;`);
1100
- const touchAreaHeight = vue.ref(40);
1101
1101
  const zIndex = vue.ref();
1102
- const touchPoint = vue.ref(0);
1103
1102
  const popupRef = vue.ref();
1103
+ let touchPoint = 0;
1104
+ const touchAreaHeight = unitToPx(props.minDragHeight);
1104
1105
  const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
1105
1106
  const style = vue.computed(() => {
1106
1107
  const style2 = {
@@ -1147,13 +1148,14 @@
1147
1148
  event.preventDefault();
1148
1149
  }
1149
1150
  const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
1150
- positionY.value = event.touches[0].clientY;
1151
+ const positionY = event.touches[0].clientY || 0;
1152
+ let touchHeight = 0;
1151
1153
  timerId = setTimeout(() => {
1152
- if (positionY.value === 0 || positionY.value < h * 0.15) {
1154
+ if (positionY === 0 || positionY < h - unitToPx(props.maxDragHeight)) {
1153
1155
  return;
1154
1156
  }
1155
- touchHeight.value = positionY.value - touchAreaHeight.value > h - touchAreaHeight.value ? h - touchAreaHeight.value + touchPoint.value : positionY.value;
1156
- contentStyle.value = `height:${h - touchHeight.value - touchAreaHeight.value + touchPoint.value}px;`;
1157
+ touchHeight = positionY - touchAreaHeight > h - touchAreaHeight ? h - touchAreaHeight + touchPoint : positionY;
1158
+ contentStyle.value = `height:${h - touchHeight - touchAreaHeight + touchPoint}px;`;
1157
1159
  }, 10);
1158
1160
  };
1159
1161
  const startMove = (event) => {
@@ -1161,7 +1163,7 @@
1161
1163
  if (timerId) {
1162
1164
  clearInterval(timerId);
1163
1165
  }
1164
- touchPoint.value = event.touches[0].clientY - (((_b = (_a = popupRef.value) == null ? void 0 : _a.getBoundingClientRect()) == null ? void 0 : _b.top) || 0);
1166
+ touchPoint = event.touches[0].clientY - (((_b = (_a = popupRef.value) == null ? void 0 : _a.getBoundingClientRect()) == null ? void 0 : _b.top) || 0);
1165
1167
  };
1166
1168
  const endMove = () => {
1167
1169
  clearInterval(timerId);
@@ -1238,6 +1240,7 @@
1238
1240
  "onKeydown": onKeydown
1239
1241
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon(), vue.createVNode("div", {
1240
1242
  "class": bem$13("slider-title"),
1243
+ "style": `height:${touchAreaHeight}px;`,
1241
1244
  "ref": root
1242
1245
  }, [vue.createVNode("div", {
1243
1246
  "class": bem$13("slider-bar")
@@ -1733,7 +1736,8 @@
1733
1736
  size: makeStringProp("medium"),
1734
1737
  shape: makeStringProp("square"),
1735
1738
  text: String,
1736
- textBgColor: String
1739
+ textBgColor: String,
1740
+ border: Boolean
1737
1741
  };
1738
1742
  var stdin_default$1p = vue.defineComponent({
1739
1743
  name: name$12,
@@ -1746,7 +1750,7 @@
1746
1750
  if (len === 1) {
1747
1751
  return props.text;
1748
1752
  } else if (len > 1) {
1749
- return props.text.substring(len - 2, 2);
1753
+ return props.text.substring(len - 2, len);
1750
1754
  }
1751
1755
  }
1752
1756
  return "";
@@ -1767,7 +1771,9 @@
1767
1771
  }
1768
1772
  });
1769
1773
  const renderText = () => vue.createVNode("div", {
1770
- "class": bem$$("img", classArr.value),
1774
+ "class": bem$$("img", [classArr.value, {
1775
+ border: props.border
1776
+ }]),
1771
1777
  "style": style.value
1772
1778
  }, [headText.value]);
1773
1779
  return () => {
@@ -1776,7 +1782,9 @@
1776
1782
  }
1777
1783
  return vue.createVNode(stdin_default$1q, {
1778
1784
  "round": props.shape === "round",
1779
- "class": bem$$("img", classArr.value),
1785
+ "class": bem$$("img", [classArr.value, {
1786
+ border: props.border
1787
+ }]),
1780
1788
  "style": style.value,
1781
1789
  "src": props.src
1782
1790
  }, {
@@ -2995,7 +3003,7 @@
2995
3003
  "onClick": onCancel,
2996
3004
  "style": {
2997
3005
  marginRight: "4px",
2998
- backgroundColor: "white"
3006
+ backgroundColor: "transparent"
2999
3007
  }
3000
3008
  }, {
3001
3009
  default: () => [text || "\u53D6\u6D88"]
@@ -3016,7 +3024,7 @@
3016
3024
  };
3017
3025
  const renderFooter = () => vue.createVNode("div", {
3018
3026
  "class": [bem$Z("footer"), {
3019
- "van-safe-area-bottom": props.safeAreaInsetBottom
3027
+ "zt-safe-area-bottom": props.safeAreaInsetBottom
3020
3028
  }]
3021
3029
  }, [renderFooterButton()]);
3022
3030
  const renderCalendar = () => vue.createVNode("div", {
@@ -3366,8 +3374,7 @@
3366
3374
  const touch = useTouch();
3367
3375
  const {
3368
3376
  children,
3369
- linkChildren,
3370
- unlinkChildren
3377
+ linkChildren
3371
3378
  } = useChildren(SWIPE_KEY);
3372
3379
  const count = vue.computed(() => children.length);
3373
3380
  const size = vue.computed(() => state[props.vertical ? "height" : "width"]);
@@ -3667,7 +3674,6 @@
3667
3674
  vue.onMounted(initialize);
3668
3675
  vue.onActivated(() => initialize(state.active));
3669
3676
  onPopupReopen(() => {
3670
- unlinkChildren();
3671
3677
  initialize(state.active);
3672
3678
  });
3673
3679
  vue.onDeactivated(stopAutoplay);
@@ -5490,8 +5496,9 @@
5490
5496
  }
5491
5497
  currentOffset.value = offset2;
5492
5498
  };
5499
+ const isReadonly = () => props.readonly || !props.options.length;
5493
5500
  const onClickOption = (index) => {
5494
- if (moving || props.readonly) {
5501
+ if (moving || isReadonly()) {
5495
5502
  return;
5496
5503
  }
5497
5504
  transitionEndTrigger = null;
@@ -5516,7 +5523,7 @@
5516
5523
  }
5517
5524
  };
5518
5525
  const onTouchStart = (event) => {
5519
- if (props.readonly) {
5526
+ if (isReadonly()) {
5520
5527
  return;
5521
5528
  }
5522
5529
  touch.start(event);
@@ -5531,7 +5538,7 @@
5531
5538
  transitionEndTrigger = null;
5532
5539
  };
5533
5540
  const onTouchMove = (event) => {
5534
- if (props.readonly) {
5541
+ if (isReadonly()) {
5535
5542
  return;
5536
5543
  }
5537
5544
  touch.move(event);
@@ -5547,7 +5554,7 @@
5547
5554
  }
5548
5555
  };
5549
5556
  const onTouchEnd = () => {
5550
- if (props.readonly) {
5557
+ if (isReadonly()) {
5551
5558
  return;
5552
5559
  }
5553
5560
  const distance = currentOffset.value - momentumOffset;
@@ -9429,9 +9436,10 @@
9429
9436
  rootWidth: makeRequiredProp(Number),
9430
9437
  rootHeight: makeRequiredProp(Number)
9431
9438
  },
9432
- emits: ["scale", "close"],
9439
+ emits: ["scale", "close", "longPress"],
9433
9440
  setup(props, {
9434
- emit
9441
+ emit,
9442
+ slots
9435
9443
  }) {
9436
9444
  const state = vue.reactive({
9437
9445
  scale: 1,
@@ -9575,16 +9583,20 @@
9575
9583
  const deltaTime = Date.now() - touchStartTime;
9576
9584
  const TAP_TIME = 250;
9577
9585
  const TAP_OFFSET = 5;
9578
- if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET && deltaTime < TAP_TIME) {
9579
- if (doubleTapTimer) {
9580
- clearTimeout(doubleTapTimer);
9581
- doubleTapTimer = null;
9582
- toggleScale();
9583
- } else {
9584
- doubleTapTimer = setTimeout(() => {
9585
- emit("close");
9586
+ if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
9587
+ if (deltaTime < TAP_TIME) {
9588
+ if (doubleTapTimer) {
9589
+ clearTimeout(doubleTapTimer);
9586
9590
  doubleTapTimer = null;
9587
- }, TAP_TIME);
9591
+ toggleScale();
9592
+ } else {
9593
+ doubleTapTimer = setTimeout(() => {
9594
+ emit("close");
9595
+ doubleTapTimer = null;
9596
+ }, TAP_TIME);
9597
+ }
9598
+ } else if (deltaTime > LONG_PRESS_START_TIME) {
9599
+ emit("longPress");
9588
9600
  }
9589
9601
  }
9590
9602
  };
@@ -9650,7 +9662,11 @@
9650
9662
  "onTouchend": onTouchEnd,
9651
9663
  "onTouchcancel": onTouchEnd
9652
9664
  }, {
9653
- default: () => [vue.createVNode(Image$1, {
9665
+ default: () => [slots.image ? vue.createVNode("div", {
9666
+ "class": bem$s("image-wrap")
9667
+ }, [slots.image({
9668
+ src: props.src
9669
+ })]) : vue.createVNode(Image$1, {
9654
9670
  "src": props.src,
9655
9671
  "fit": "contain",
9656
9672
  "class": bem$s("image", {
@@ -9689,7 +9705,7 @@
9689
9705
  var stdin_default$G = vue.defineComponent({
9690
9706
  name: name$r,
9691
9707
  props: imagePreviewProps,
9692
- emits: ["scale", "close", "closed", "change", "update:show"],
9708
+ emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
9693
9709
  setup(props, {
9694
9710
  emit,
9695
9711
  slots
@@ -9765,7 +9781,7 @@
9765
9781
  "indicatorColor": "white",
9766
9782
  "onChange": setActive
9767
9783
  }, {
9768
- default: () => [props.images.map((image) => vue.createVNode(stdin_default$H, {
9784
+ default: () => [props.images.map((image, index) => vue.createVNode(stdin_default$H, {
9769
9785
  "src": image.url,
9770
9786
  "show": props.show,
9771
9787
  "active": state.active,
@@ -9774,8 +9790,13 @@
9774
9790
  "rootWidth": state.rootWidth,
9775
9791
  "rootHeight": state.rootHeight,
9776
9792
  "onScale": emitScale,
9777
- "onClose": emitClose
9778
- }, null))]
9793
+ "onClose": emitClose,
9794
+ "onLongPress": () => emit("longPress", {
9795
+ index
9796
+ })
9797
+ }, {
9798
+ image: slots.image
9799
+ }))]
9779
9800
  });
9780
9801
  const renderClose = () => {
9781
9802
  if (props.closeable) {
@@ -10586,6 +10607,47 @@
10586
10607
  )}`;
10587
10608
  return suffix ? name2 + "." + suffix : name2;
10588
10609
  }
10610
+ function adjustImgOrientation(ctx, img, orientation, width2, height2) {
10611
+ switch (orientation) {
10612
+ case 3:
10613
+ ctx.rotate(180 * Math.PI / 180);
10614
+ ctx.drawImage(img, -width2, -height2, width2, height2);
10615
+ break;
10616
+ case 6:
10617
+ ctx.rotate(90 * Math.PI / 180);
10618
+ ctx.drawImage(img, 0, -width2, height2, width2);
10619
+ break;
10620
+ case 8:
10621
+ ctx.rotate(270 * Math.PI / 180);
10622
+ ctx.drawImage(img, -height2, 0, height2, width2);
10623
+ break;
10624
+ case 2:
10625
+ ctx.translate(width2, 0);
10626
+ ctx.scale(-1, 1);
10627
+ ctx.drawImage(img, 0, 0, width2, height2);
10628
+ break;
10629
+ case 4:
10630
+ ctx.translate(width2, 0);
10631
+ ctx.scale(-1, 1);
10632
+ ctx.rotate(180 * Math.PI / 180);
10633
+ ctx.drawImage(img, -width2, -height2, width2, height2);
10634
+ break;
10635
+ case 5:
10636
+ ctx.translate(width2, 0);
10637
+ ctx.scale(-1, 1);
10638
+ ctx.rotate(90 * Math.PI / 180);
10639
+ ctx.drawImage(img, 0, -width2, height2, width2);
10640
+ break;
10641
+ case 7:
10642
+ ctx.translate(width2, 0);
10643
+ ctx.scale(-1, 1);
10644
+ ctx.rotate(270 * Math.PI / 180);
10645
+ ctx.drawImage(img, -height2, 0, height2, width2);
10646
+ break;
10647
+ default:
10648
+ ctx.drawImage(img, 0, 0, width2, height2);
10649
+ }
10650
+ }
10589
10651
  function file2DataURL(file) {
10590
10652
  return new Promise((resolve, reject) => {
10591
10653
  const a = new FileReader();
@@ -10614,7 +10676,7 @@
10614
10676
  }).catch(reject);
10615
10677
  });
10616
10678
  }
10617
- function image2Canvas(img, width2, height2) {
10679
+ function image2Canvas(img, type, orientation, width2, height2) {
10618
10680
  const canvas = document.createElement("canvas");
10619
10681
  const _width = width2 || img.width;
10620
10682
  const _height = height2 || img.height;
@@ -10622,9 +10684,12 @@
10622
10684
  canvas.height = _height;
10623
10685
  const ctx = canvas.getContext("2d");
10624
10686
  if (ctx) {
10625
- ctx.fillStyle = "#fff";
10687
+ ctx.fillStyle = "transparent";
10688
+ if (type === "image/jpeg") {
10689
+ ctx.fillStyle = "#fff";
10690
+ }
10626
10691
  ctx.fillRect(0, 0, _width, _height);
10627
- ctx.drawImage(img, 0, 0, _width, _height);
10692
+ adjustImgOrientation(ctx, img, orientation, _width, _height);
10628
10693
  return Promise.resolve(canvas);
10629
10694
  }
10630
10695
  return Promise.reject(new Error("canvas getContext return null"));
@@ -10650,7 +10715,74 @@
10650
10715
  image.src = canvas.toDataURL(type, quality);
10651
10716
  return Promise.resolve(image);
10652
10717
  }
10718
+ function getStringFromCharCode(dataView, start2, length) {
10719
+ let str = "";
10720
+ let i;
10721
+ length += start2;
10722
+ for (i = start2; i < length; i += 1) {
10723
+ str += String.fromCharCode(dataView.getUint8(i));
10724
+ }
10725
+ return str;
10726
+ }
10727
+ function getOrientation(arrayBuffer) {
10728
+ const dataView = new DataView(arrayBuffer);
10729
+ let orientation;
10730
+ try {
10731
+ let littleEndian;
10732
+ let app1Start;
10733
+ let ifdStart;
10734
+ if (dataView.getUint8(0) === 255 && dataView.getUint8(1) === 216) {
10735
+ const length = dataView.byteLength;
10736
+ let offset2 = 2;
10737
+ while (offset2 + 1 < length) {
10738
+ if (dataView.getUint8(offset2) === 255 && dataView.getUint8(offset2 + 1) === 225) {
10739
+ app1Start = offset2;
10740
+ break;
10741
+ }
10742
+ offset2 += 1;
10743
+ }
10744
+ }
10745
+ if (app1Start) {
10746
+ const exifIDCode = app1Start + 4;
10747
+ const tiffOffset = app1Start + 10;
10748
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === "Exif") {
10749
+ const endianness = dataView.getUint16(tiffOffset);
10750
+ littleEndian = endianness === 18761;
10751
+ if (littleEndian || endianness === 19789) {
10752
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 42) {
10753
+ const firstIFDOffset = dataView.getUint32(
10754
+ tiffOffset + 4,
10755
+ littleEndian
10756
+ );
10757
+ if (firstIFDOffset >= 8) {
10758
+ ifdStart = tiffOffset + firstIFDOffset;
10759
+ }
10760
+ }
10761
+ }
10762
+ }
10763
+ }
10764
+ if (ifdStart) {
10765
+ const _length = dataView.getUint16(ifdStart, littleEndian);
10766
+ let _offset;
10767
+ let i;
10768
+ for (i = 0; i < _length; i += 1) {
10769
+ _offset = ifdStart + i * 12 + 2;
10770
+ if (dataView.getUint16(_offset, littleEndian) === 274) {
10771
+ _offset += 8;
10772
+ orientation = dataView.getUint16(_offset, littleEndian);
10773
+ dataView.setUint16(_offset, 1, littleEndian);
10774
+ break;
10775
+ }
10776
+ }
10777
+ }
10778
+ } catch (e) {
10779
+ orientation = 1;
10780
+ }
10781
+ return orientation;
10782
+ }
10653
10783
  function resize(img, {
10784
+ inputType = "image/jpeg",
10785
+ orientation = 1,
10654
10786
  imageWidth = -1,
10655
10787
  imageHeight = -1,
10656
10788
  sideLengthLimit = 640,
@@ -10668,14 +10800,18 @@
10668
10800
  } else {
10669
10801
  return Promise.reject(new Error("image width/height \u65E0\u6548"));
10670
10802
  }
10671
- const targetWidth = imageWidth * scale;
10672
- const targetHeight = imageHeight * scale;
10803
+ const targetWidth = scale > 1 ? imageWidth : imageWidth * scale;
10804
+ const targetHeight = scale > 1 ? imageHeight : imageHeight * scale;
10673
10805
  if (resultType === "image") {
10674
- return image2Canvas(img, targetWidth, targetHeight).then(
10675
- (canvas) => canvas2Image(canvas)
10676
- );
10677
- }
10678
- return image2Canvas(img, targetWidth, targetHeight);
10806
+ return image2Canvas(
10807
+ img,
10808
+ inputType,
10809
+ orientation,
10810
+ targetWidth,
10811
+ targetHeight
10812
+ ).then((canvas) => canvas2Image(canvas));
10813
+ }
10814
+ return image2Canvas(img, inputType, orientation, targetWidth, targetHeight);
10679
10815
  }
10680
10816
  class ResizeOptions {
10681
10817
  constructor(maxSideLength) {
@@ -10715,7 +10851,13 @@
10715
10851
  }
10716
10852
  return result;
10717
10853
  };
10718
- const FORMAT = {
10854
+ var __formatNumber__ = function(number) {
10855
+ if (number < 10) {
10856
+ return "0" + number;
10857
+ }
10858
+ return number + "";
10859
+ };
10860
+ var DATE_FORMAT = {
10719
10861
  FORMAT_HM: "HH:mm",
10720
10862
  FORMAT_MDHM: "MM-dd HH:mm",
10721
10863
  FORMAT_MD_CN: "MM\u6708dd\u65E5",
@@ -10733,16 +10875,7 @@
10733
10875
  FORMAT_YMDHM_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206",
10734
10876
  FORMAT_YMDHMS_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206ss\u79D2"
10735
10877
  };
10736
- const __formatNumber__ = function(number) {
10737
- if (number < 10) {
10738
- return "0" + number;
10739
- }
10740
- return number + "";
10741
- };
10742
10878
  function createDate(dateObj) {
10743
- if (!isDef(dateObj)) {
10744
- return null;
10745
- }
10746
10879
  if (typeof dateObj === "number") {
10747
10880
  return new Date(dateObj);
10748
10881
  }
@@ -10753,47 +10886,37 @@
10753
10886
  }
10754
10887
  return new Date(dateObj);
10755
10888
  }
10756
- if (isDate(dateObj)) {
10757
- return dateObj;
10758
- }
10759
- return null;
10889
+ return dateObj;
10760
10890
  }
10761
- function formatDate(dateObj, formatType = FORMAT.FORMAT_YMDHMS) {
10891
+ function formatDate(dateObj, formatType = DATE_FORMAT.FORMAT_YMDHMS) {
10762
10892
  const date = createDate(dateObj);
10763
- if (date) {
10764
- date.getFullYear();
10765
- let formatResult = formatType.replace(
10766
- "yyyy",
10767
- __formatNumber__(date.getFullYear())
10768
- );
10769
- formatResult = formatResult.replace(
10770
- "yy",
10771
- String(date.getFullYear()).substring(2)
10772
- );
10773
- formatResult = formatResult.replace(
10774
- "MM",
10775
- __formatNumber__(date.getMonth() + 1)
10776
- );
10777
- formatResult = formatResult.replace("dd", __formatNumber__(date.getDate()));
10778
- formatResult = formatResult.replace(
10779
- "HH",
10780
- __formatNumber__(date.getHours())
10781
- );
10782
- formatResult = formatResult.replace(
10783
- "mm",
10784
- __formatNumber__(date.getMinutes())
10785
- );
10786
- formatResult = formatResult.replace(
10787
- "ss",
10788
- __formatNumber__(date.getSeconds())
10789
- );
10790
- formatResult = formatResult.replace(
10791
- "msms",
10792
- __formatNumber__(date.getMilliseconds())
10793
- );
10794
- return formatResult;
10795
- }
10796
- return null;
10893
+ let formatResult = formatType.replace(
10894
+ "yyyy",
10895
+ __formatNumber__(date.getFullYear())
10896
+ );
10897
+ formatResult = formatResult.replace(
10898
+ "yy",
10899
+ String(date.getFullYear()).substring(2)
10900
+ );
10901
+ formatResult = formatResult.replace(
10902
+ "MM",
10903
+ __formatNumber__(date.getMonth() + 1)
10904
+ );
10905
+ formatResult = formatResult.replace("dd", __formatNumber__(date.getDate()));
10906
+ formatResult = formatResult.replace("HH", __formatNumber__(date.getHours()));
10907
+ formatResult = formatResult.replace(
10908
+ "mm",
10909
+ __formatNumber__(date.getMinutes())
10910
+ );
10911
+ formatResult = formatResult.replace(
10912
+ "ss",
10913
+ __formatNumber__(date.getSeconds())
10914
+ );
10915
+ formatResult = formatResult.replace(
10916
+ "msms",
10917
+ __formatNumber__(date.getMilliseconds())
10918
+ );
10919
+ return formatResult;
10797
10920
  }
10798
10921
  const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
10799
10922
  const subString = (str, startIndex, length) => {
@@ -11019,7 +11142,7 @@
11019
11142
  const regexResult = scanner.next(dateRegex);
11020
11143
  if (regexResult) {
11021
11144
  const matchResults = regexResult;
11022
- let format2 = FORMAT.FORMAT_YMD;
11145
+ let format2 = DATE_FORMAT.FORMAT_YMD;
11023
11146
  if (matchResults && matchResults.length >= 2) {
11024
11147
  if (isValidString(matchResults[1])) {
11025
11148
  format2 = matchResults[1];
@@ -11034,7 +11157,7 @@
11034
11157
  if (watermarkContext) {
11035
11158
  const value = formatDate(
11036
11159
  watermarkContext.watermarkTime,
11037
- FORMAT.FORMAT_HM
11160
+ DATE_FORMAT.FORMAT_HM
11038
11161
  );
11039
11162
  content += value;
11040
11163
  }
@@ -11388,7 +11511,6 @@
11388
11511
  }
11389
11512
  return true;
11390
11513
  }
11391
- const DEFAULT_IMAGE_TYPE = "image/jpeg";
11392
11514
  const DEFAULT_JPEG_QUALITY = 0.8;
11393
11515
  const MIN_JPEG_QUALITY = 0.1;
11394
11516
  const JPEG_QUALITY_STEP = 0.05;
@@ -11401,9 +11523,29 @@
11401
11523
  }
11402
11524
  process() {
11403
11525
  const filename = this.file.name;
11526
+ let fileType = this.file.type;
11404
11527
  const { lastModified } = this.file;
11528
+ let orientation = 1;
11529
+ if (this.file.size > this.compressOptions.photoFileSizeLimit * 1024) {
11530
+ fileType = "image/jpeg";
11531
+ }
11532
+ if (isIOS$1() && fileType === "image/jpeg") {
11533
+ const reader = new FileReader();
11534
+ reader.readAsArrayBuffer(this.file);
11535
+ reader.onload = function(_ref) {
11536
+ const { target } = _ref;
11537
+ if (target == null ? void 0 : target.result) {
11538
+ orientation = getOrientation(target == null ? void 0 : target.result);
11539
+ }
11540
+ };
11541
+ }
11542
+ if (fileType === "image/gif") {
11543
+ fileType = "image/png";
11544
+ }
11405
11545
  return file2Image(this.file).then(
11406
11546
  (img) => resize(img, {
11547
+ inputType: fileType,
11548
+ orientation,
11407
11549
  sideLengthLimit: this.resizeOptions.maxSideLength,
11408
11550
  resultType: "canvas"
11409
11551
  })
@@ -11416,7 +11558,7 @@
11416
11558
  canvas,
11417
11559
  exportFilename,
11418
11560
  lastModified,
11419
- DEFAULT_IMAGE_TYPE,
11561
+ fileType,
11420
11562
  DEFAULT_JPEG_QUALITY
11421
11563
  );
11422
11564
  });
@@ -11948,7 +12090,7 @@
11948
12090
  if (media.showSrc) {
11949
12091
  return vue.createVNode(stdin_default$1q, {
11950
12092
  "src": media.showSrc,
11951
- "fit": "fill",
12093
+ "fit": "cover",
11952
12094
  "radius": "4"
11953
12095
  }, null);
11954
12096
  } else if (media.type === "video") {
@@ -12243,8 +12385,7 @@
12243
12385
  "size": "normal",
12244
12386
  "block": true,
12245
12387
  "style": {
12246
- marginRigth: "4px",
12247
- backgroundColor: "white"
12388
+ marginRigth: "4px"
12248
12389
  },
12249
12390
  "onClick": onCancel
12250
12391
  }, {
@@ -15314,7 +15455,6 @@
15314
15455
  const Step = withInstall(stdin_default$b);
15315
15456
  const [name$5, bem$5] = createNamespace("stepper");
15316
15457
  const LONG_PRESS_INTERVAL = 200;
15317
- const LONG_PRESS_START_TIME = 600;
15318
15458
  const isEqual = (value1, value2) => String(value1) === String(value2);
15319
15459
  const stepperProps = {
15320
15460
  min: makeNumericProp(1),
@@ -17109,15 +17249,14 @@
17109
17249
  default: "img"
17110
17250
  }
17111
17251
  },
17112
- render(h) {
17113
- return h(
17252
+ render() {
17253
+ var _a, _b;
17254
+ return vue.h(
17114
17255
  this.tag,
17115
17256
  {
17116
- attrs: {
17117
- src: this.renderSrc
17118
- }
17257
+ src: this.renderSrc
17119
17258
  },
17120
- this.$slots.default
17259
+ (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
17121
17260
  );
17122
17261
  },
17123
17262
  data() {
@@ -17214,7 +17353,7 @@
17214
17353
  });
17215
17354
  }
17216
17355
  };
17217
- const version = "3.0.3";
17356
+ const version = "3.0.5";
17218
17357
  function install(app) {
17219
17358
  const components = [
17220
17359
  ActionSheet,