zartui 3.0.3 → 3.0.4

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 (219) hide show
  1. package/es/action-sheet/index.css +1 -1
  2. package/es/avatar/Avatar.d.ts +5 -1
  3. package/es/avatar/Avatar.mjs +9 -4
  4. package/es/avatar/index.css +1 -1
  5. package/es/avatar/index.d.ts +4 -1
  6. package/es/badge/Badge.d.ts +1 -1
  7. package/es/badge/index.d.ts +1 -1
  8. package/es/button/index.css +1 -1
  9. package/es/calendar/Calendar.mjs +2 -2
  10. package/es/calendar/index.css +1 -1
  11. package/es/cascader/index.css +1 -1
  12. package/es/cell/index.css +1 -1
  13. package/es/cell-group/CellGroup.d.ts +1 -1
  14. package/es/cell-group/index.d.ts +1 -1
  15. package/es/checkbox/index.css +1 -1
  16. package/es/col/Col.d.ts +1 -1
  17. package/es/col/index.d.ts +1 -1
  18. package/es/collapse-item/CollapseItem.d.ts +1 -1
  19. package/es/collapse-item/index.d.ts +1 -1
  20. package/es/config-provider/ConfigProvider.d.ts +1 -1
  21. package/es/config-provider/index.d.ts +2 -2
  22. package/es/dialog/index.css +1 -1
  23. package/es/divider/Divider.d.ts +1 -1
  24. package/es/divider/index.d.ts +1 -1
  25. package/es/dropdown-menu/DropdownMenu.d.ts +1 -1
  26. package/es/dropdown-menu/index.d.ts +1 -1
  27. package/es/empty/Empty.d.ts +1 -1
  28. package/es/empty/index.d.ts +1 -1
  29. package/es/field/index.css +1 -1
  30. package/es/grid/Grid.d.ts +1 -1
  31. package/es/grid/index.d.ts +1 -1
  32. package/es/grid-item/GridItem.d.ts +1 -1
  33. package/es/grid-item/index.css +1 -1
  34. package/es/grid-item/index.d.ts +1 -1
  35. package/es/icon/Icon.d.ts +1 -1
  36. package/es/icon/config.mjs +3 -2
  37. package/es/icon/index.css +1 -1
  38. package/es/icon/index.d.ts +1 -1
  39. package/es/image-preview/ImagePreview.d.ts +2 -1
  40. package/es/image-preview/ImagePreview.mjs +9 -4
  41. package/es/image-preview/ImagePreviewItem.d.ts +2 -1
  42. package/es/image-preview/ImagePreviewItem.mjs +22 -13
  43. package/es/image-preview/index.css +1 -1
  44. package/es/image-preview/index.d.ts +2 -1
  45. package/es/index.d.ts +1 -1
  46. package/es/index.mjs +1 -1
  47. package/es/lazyload/vue-lazyload/lazy-image.mjs +5 -5
  48. package/es/loading/Loading.d.ts +1 -1
  49. package/es/loading/index.d.ts +1 -1
  50. package/es/media-picker/MediaPicker.mjs +1 -1
  51. package/es/media-picker/image/DefaultAudioIcon.d.ts +1 -1
  52. package/es/media-picker/image/DefaultFileIcon.d.ts +1 -1
  53. package/es/media-picker/image/DefaultVideoIcon.d.ts +1 -1
  54. package/es/media-picker/image/DeleteIcon.d.ts +1 -1
  55. package/es/media-picker/image/PickFileIcon.d.ts +1 -1
  56. package/es/media-picker/image/PickPhotoIcon.d.ts +1 -1
  57. package/es/media-picker/image/TakeAudioIcon.d.ts +1 -1
  58. package/es/media-picker/image/TakePhotoIcon.d.ts +1 -1
  59. package/es/media-picker/image/TakeVideoIcon.d.ts +1 -1
  60. package/es/media-picker/util/media-util.d.ts +17 -2
  61. package/es/media-picker/util/media-util.mjs +137 -10
  62. package/es/media-picker/watermark/image-processor.mjs +28 -3
  63. package/es/media-picker/watermark/watermark.mjs +3 -3
  64. package/es/multiple-picker/MultiplePicker.mjs +1 -2
  65. package/es/multiple-picker/index.css +1 -1
  66. package/es/multiple-picker/types.d.ts +2 -1
  67. package/es/nav-bar/index.css +1 -1
  68. package/es/overlay/Overlay.d.ts +1 -1
  69. package/es/overlay/index.d.ts +1 -1
  70. package/es/picker/PickerColumn.mjs +5 -4
  71. package/es/picker/index.css +1 -1
  72. package/es/popup/Popup.d.ts +26 -0
  73. package/es/popup/Popup.mjs +12 -10
  74. package/es/popup/index.css +1 -1
  75. package/es/popup/index.d.ts +18 -0
  76. package/es/radio/index.css +1 -1
  77. package/es/row/Row.d.ts +1 -1
  78. package/es/row/index.d.ts +1 -1
  79. package/es/search/index.css +1 -1
  80. package/es/skeleton/Skeleton.d.ts +1 -1
  81. package/es/skeleton/index.d.ts +1 -1
  82. package/es/step/Step.d.ts +1 -1
  83. package/es/step/index.d.ts +1 -1
  84. package/es/stepper/Stepper.d.ts +1 -1
  85. package/es/stepper/Stepper.mjs +1 -2
  86. package/es/stepper/index.d.ts +1 -1
  87. package/es/style/base.css +1 -1
  88. package/es/style/css-variables.css +1 -1
  89. package/es/swipe/Swipe.mjs +1 -3
  90. package/es/swipe-item/SwipeItem.d.ts +1 -1
  91. package/es/swipe-item/index.d.ts +1 -1
  92. package/es/tab/Tab.d.ts +1 -1
  93. package/es/tab/index.d.ts +1 -1
  94. package/es/tabbar-item/index.css +1 -1
  95. package/es/tabs/TabsTitle.d.ts +1 -1
  96. package/es/tabs/index.css +1 -1
  97. package/es/time-picker/index.css +1 -1
  98. package/es/toast/index.css +1 -1
  99. package/es/utils/constant.d.ts +1 -0
  100. package/es/utils/constant.mjs +3 -1
  101. package/es/utils/mount-component.d.ts +1 -1
  102. package/lib/action-sheet/index.css +1 -1
  103. package/lib/avatar/Avatar.d.ts +5 -1
  104. package/lib/avatar/Avatar.js +9 -4
  105. package/lib/avatar/index.css +1 -1
  106. package/lib/avatar/index.d.ts +4 -1
  107. package/lib/badge/Badge.d.ts +1 -1
  108. package/lib/badge/index.d.ts +1 -1
  109. package/lib/button/index.css +1 -1
  110. package/lib/calendar/Calendar.js +2 -2
  111. package/lib/calendar/index.css +1 -1
  112. package/lib/cascader/index.css +1 -1
  113. package/lib/cell/index.css +1 -1
  114. package/lib/cell-group/CellGroup.d.ts +1 -1
  115. package/lib/cell-group/index.d.ts +1 -1
  116. package/lib/checkbox/index.css +1 -1
  117. package/lib/col/Col.d.ts +1 -1
  118. package/lib/col/index.d.ts +1 -1
  119. package/lib/collapse-item/CollapseItem.d.ts +1 -1
  120. package/lib/collapse-item/index.d.ts +1 -1
  121. package/lib/config-provider/ConfigProvider.d.ts +1 -1
  122. package/lib/config-provider/index.d.ts +2 -2
  123. package/lib/dialog/index.css +1 -1
  124. package/lib/divider/Divider.d.ts +1 -1
  125. package/lib/divider/index.d.ts +1 -1
  126. package/lib/dropdown-menu/DropdownMenu.d.ts +1 -1
  127. package/lib/dropdown-menu/index.d.ts +1 -1
  128. package/lib/empty/Empty.d.ts +1 -1
  129. package/lib/empty/index.d.ts +1 -1
  130. package/lib/field/index.css +1 -1
  131. package/lib/grid/Grid.d.ts +1 -1
  132. package/lib/grid/index.d.ts +1 -1
  133. package/lib/grid-item/GridItem.d.ts +1 -1
  134. package/lib/grid-item/index.css +1 -1
  135. package/lib/grid-item/index.d.ts +1 -1
  136. package/lib/icon/Icon.d.ts +1 -1
  137. package/lib/icon/config.js +3 -2
  138. package/lib/icon/index.css +1 -1
  139. package/lib/icon/index.d.ts +1 -1
  140. package/lib/image-preview/ImagePreview.d.ts +2 -1
  141. package/lib/image-preview/ImagePreview.js +9 -4
  142. package/lib/image-preview/ImagePreviewItem.d.ts +2 -1
  143. package/lib/image-preview/ImagePreviewItem.js +21 -12
  144. package/lib/image-preview/index.css +1 -1
  145. package/lib/image-preview/index.d.ts +2 -1
  146. package/lib/index.css +1 -1
  147. package/lib/index.d.ts +1 -1
  148. package/lib/index.js +1 -1
  149. package/lib/lazyload/vue-lazyload/lazy-image.js +6 -6
  150. package/lib/loading/Loading.d.ts +1 -1
  151. package/lib/loading/index.d.ts +1 -1
  152. package/lib/media-picker/MediaPicker.js +1 -1
  153. package/lib/media-picker/image/DefaultAudioIcon.d.ts +1 -1
  154. package/lib/media-picker/image/DefaultFileIcon.d.ts +1 -1
  155. package/lib/media-picker/image/DefaultVideoIcon.d.ts +1 -1
  156. package/lib/media-picker/image/DeleteIcon.d.ts +1 -1
  157. package/lib/media-picker/image/PickFileIcon.d.ts +1 -1
  158. package/lib/media-picker/image/PickPhotoIcon.d.ts +1 -1
  159. package/lib/media-picker/image/TakeAudioIcon.d.ts +1 -1
  160. package/lib/media-picker/image/TakePhotoIcon.d.ts +1 -1
  161. package/lib/media-picker/image/TakeVideoIcon.d.ts +1 -1
  162. package/lib/media-picker/util/media-util.d.ts +17 -2
  163. package/lib/media-picker/util/media-util.js +137 -10
  164. package/lib/media-picker/watermark/image-processor.js +22 -2
  165. package/lib/media-picker/watermark/watermark.js +5 -5
  166. package/lib/multiple-picker/MultiplePicker.js +1 -2
  167. package/lib/multiple-picker/index.css +1 -1
  168. package/lib/multiple-picker/types.d.ts +2 -1
  169. package/lib/nav-bar/index.css +1 -1
  170. package/lib/overlay/Overlay.d.ts +1 -1
  171. package/lib/overlay/index.d.ts +1 -1
  172. package/lib/picker/PickerColumn.js +5 -4
  173. package/lib/picker/index.css +1 -1
  174. package/lib/popup/Popup.d.ts +26 -0
  175. package/lib/popup/Popup.js +11 -9
  176. package/lib/popup/index.css +1 -1
  177. package/lib/popup/index.d.ts +18 -0
  178. package/lib/radio/index.css +1 -1
  179. package/lib/row/Row.d.ts +1 -1
  180. package/lib/row/index.d.ts +1 -1
  181. package/lib/search/index.css +1 -1
  182. package/lib/skeleton/Skeleton.d.ts +1 -1
  183. package/lib/skeleton/index.d.ts +1 -1
  184. package/lib/step/Step.d.ts +1 -1
  185. package/lib/step/index.d.ts +1 -1
  186. package/lib/stepper/Stepper.d.ts +1 -1
  187. package/lib/stepper/Stepper.js +1 -2
  188. package/lib/stepper/index.d.ts +1 -1
  189. package/lib/style/base.css +1 -1
  190. package/lib/style/css-variables.css +1 -1
  191. package/lib/swipe/Swipe.js +1 -3
  192. package/lib/swipe-item/SwipeItem.d.ts +1 -1
  193. package/lib/swipe-item/index.d.ts +1 -1
  194. package/lib/tab/Tab.d.ts +1 -1
  195. package/lib/tab/index.d.ts +1 -1
  196. package/lib/tabbar-item/index.css +1 -1
  197. package/lib/tabs/TabsTitle.d.ts +1 -1
  198. package/lib/tabs/index.css +1 -1
  199. package/lib/time-picker/index.css +1 -1
  200. package/lib/toast/index.css +1 -1
  201. package/lib/utils/constant.d.ts +1 -0
  202. package/lib/utils/constant.js +3 -1
  203. package/lib/utils/mount-component.d.ts +1 -1
  204. package/lib/web-types.json +1 -1
  205. package/lib/zartui.cjs.js +251 -112
  206. package/lib/zartui.es.js +251 -112
  207. package/lib/zartui.js +251 -112
  208. package/lib/zartui.min.js +1 -1
  209. package/package.json +21 -20
  210. package/es/media-picker/util/orientation-util.d.ts +0 -37
  211. package/es/media-picker/util/orientation-util.mjs +0 -118
  212. package/es/tabbar/image/common-normal.png +0 -0
  213. package/es/utils/date.d.ts +0 -29
  214. package/es/utils/date.mjs +0 -96
  215. package/lib/media-picker/util/orientation-util.d.ts +0 -37
  216. package/lib/media-picker/util/orientation-util.js +0 -137
  217. package/lib/tabbar/image/common-normal.png +0 -0
  218. package/lib/utils/date.d.ts +0 -29
  219. package/lib/utils/date.js +0 -115
package/lib/zartui.cjs.js CHANGED
@@ -369,6 +369,7 @@ const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
369
369
  const HAPTICS_FEEDBACK = "zt-haptics-feedback";
370
370
  const ELLIPSIS = "zt-ellipsis";
371
371
  const FORM_KEY = Symbol("zt-form");
372
+ const LONG_PRESS_START_TIME = 500;
372
373
  function callInterceptor(interceptor, {
373
374
  args = [],
374
375
  done,
@@ -816,6 +817,8 @@ const popupProps$2 = extend({}, popupSharedProps, {
816
817
  safeAreaInsetTop: Boolean,
817
818
  safeAreaInsetBottom: Boolean,
818
819
  sliderContentHeight: makeNumberProp(60),
820
+ minDragHeight: makeStringProp("40px"),
821
+ maxDragHeight: makeStringProp("85vh"),
819
822
  slideable: Boolean
820
823
  });
821
824
  const [name$16, bem$13] = createNamespace("popup");
@@ -833,15 +836,13 @@ var stdin_default$1x = vue.defineComponent({
833
836
  let opened;
834
837
  let shouldReopen;
835
838
  const root = vue.ref();
836
- const positionY = vue.ref(0);
837
839
  let timerId = setInterval(() => {
838
840
  }, 0);
839
- const touchHeight = vue.ref(0);
840
841
  const contentStyle = vue.ref(`height:${props.sliderContentHeight}px;`);
841
- const touchAreaHeight = vue.ref(40);
842
842
  const zIndex = vue.ref();
843
- const touchPoint = vue.ref(0);
844
843
  const popupRef = vue.ref();
844
+ let touchPoint = 0;
845
+ const touchAreaHeight = unitToPx(props.minDragHeight);
845
846
  const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
846
847
  const style = vue.computed(() => {
847
848
  const style2 = {
@@ -888,13 +889,14 @@ var stdin_default$1x = vue.defineComponent({
888
889
  event.preventDefault();
889
890
  }
890
891
  const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
891
- positionY.value = event.touches[0].clientY;
892
+ const positionY = event.touches[0].clientY || 0;
893
+ let touchHeight = 0;
892
894
  timerId = setTimeout(() => {
893
- if (positionY.value === 0 || positionY.value < h * 0.15) {
895
+ if (positionY === 0 || positionY < h - unitToPx(props.maxDragHeight)) {
894
896
  return;
895
897
  }
896
- touchHeight.value = positionY.value - touchAreaHeight.value > h - touchAreaHeight.value ? h - touchAreaHeight.value + touchPoint.value : positionY.value;
897
- contentStyle.value = `height:${h - touchHeight.value - touchAreaHeight.value + touchPoint.value}px;`;
898
+ touchHeight = positionY - touchAreaHeight > h - touchAreaHeight ? h - touchAreaHeight + touchPoint : positionY;
899
+ contentStyle.value = `height:${h - touchHeight - touchAreaHeight + touchPoint}px;`;
898
900
  }, 10);
899
901
  };
900
902
  const startMove = (event) => {
@@ -902,7 +904,7 @@ var stdin_default$1x = vue.defineComponent({
902
904
  if (timerId) {
903
905
  clearInterval(timerId);
904
906
  }
905
- touchPoint.value = event.touches[0].clientY - (((_b = (_a = popupRef.value) == null ? void 0 : _a.getBoundingClientRect()) == null ? void 0 : _b.top) || 0);
907
+ touchPoint = event.touches[0].clientY - (((_b = (_a = popupRef.value) == null ? void 0 : _a.getBoundingClientRect()) == null ? void 0 : _b.top) || 0);
906
908
  };
907
909
  const endMove = () => {
908
910
  clearInterval(timerId);
@@ -979,6 +981,7 @@ var stdin_default$1x = vue.defineComponent({
979
981
  "onKeydown": onKeydown
980
982
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon(), vue.createVNode("div", {
981
983
  "class": bem$13("slider-title"),
984
+ "style": `height:${touchAreaHeight}px;`,
982
985
  "ref": root
983
986
  }, [vue.createVNode("div", {
984
987
  "class": bem$13("slider-bar")
@@ -1474,7 +1477,8 @@ const avatarProps = {
1474
1477
  size: makeStringProp("medium"),
1475
1478
  shape: makeStringProp("square"),
1476
1479
  text: String,
1477
- textBgColor: String
1480
+ textBgColor: String,
1481
+ border: Boolean
1478
1482
  };
1479
1483
  var stdin_default$1p = vue.defineComponent({
1480
1484
  name: name$12,
@@ -1487,7 +1491,7 @@ var stdin_default$1p = vue.defineComponent({
1487
1491
  if (len === 1) {
1488
1492
  return props.text;
1489
1493
  } else if (len > 1) {
1490
- return props.text.substring(len - 2, 2);
1494
+ return props.text.substring(len - 2, len);
1491
1495
  }
1492
1496
  }
1493
1497
  return "";
@@ -1508,7 +1512,9 @@ var stdin_default$1p = vue.defineComponent({
1508
1512
  }
1509
1513
  });
1510
1514
  const renderText = () => vue.createVNode("div", {
1511
- "class": bem$$("img", classArr.value),
1515
+ "class": bem$$("img", [classArr.value, {
1516
+ border: props.border
1517
+ }]),
1512
1518
  "style": style.value
1513
1519
  }, [headText.value]);
1514
1520
  return () => {
@@ -1517,7 +1523,9 @@ var stdin_default$1p = vue.defineComponent({
1517
1523
  }
1518
1524
  return vue.createVNode(stdin_default$1q, {
1519
1525
  "round": props.shape === "round",
1520
- "class": bem$$("img", classArr.value),
1526
+ "class": bem$$("img", [classArr.value, {
1527
+ border: props.border
1528
+ }]),
1521
1529
  "style": style.value,
1522
1530
  "src": props.src
1523
1531
  }, {
@@ -2736,7 +2744,7 @@ var stdin_default$1i = vue.defineComponent({
2736
2744
  "onClick": onCancel,
2737
2745
  "style": {
2738
2746
  marginRight: "4px",
2739
- backgroundColor: "white"
2747
+ backgroundColor: "transparent"
2740
2748
  }
2741
2749
  }, {
2742
2750
  default: () => [text || "\u53D6\u6D88"]
@@ -2757,7 +2765,7 @@ var stdin_default$1i = vue.defineComponent({
2757
2765
  };
2758
2766
  const renderFooter = () => vue.createVNode("div", {
2759
2767
  "class": [bem$Z("footer"), {
2760
- "van-safe-area-bottom": props.safeAreaInsetBottom
2768
+ "zt-safe-area-bottom": props.safeAreaInsetBottom
2761
2769
  }]
2762
2770
  }, [renderFooterButton()]);
2763
2771
  const renderCalendar = () => vue.createVNode("div", {
@@ -3110,8 +3118,7 @@ var stdin_default$1f = vue.defineComponent({
3110
3118
  const touch = useTouch();
3111
3119
  const {
3112
3120
  children,
3113
- linkChildren,
3114
- unlinkChildren
3121
+ linkChildren
3115
3122
  } = use.useChildren(SWIPE_KEY);
3116
3123
  const count = vue.computed(() => children.length);
3117
3124
  const size = vue.computed(() => state[props.vertical ? "height" : "width"]);
@@ -3411,7 +3418,6 @@ var stdin_default$1f = vue.defineComponent({
3411
3418
  vue.onMounted(initialize);
3412
3419
  vue.onActivated(() => initialize(state.active));
3413
3420
  onPopupReopen(() => {
3414
- unlinkChildren();
3415
3421
  initialize(state.active);
3416
3422
  });
3417
3423
  vue.onDeactivated(stopAutoplay);
@@ -5257,8 +5263,9 @@ var stdin_default$$ = vue.defineComponent({
5257
5263
  }
5258
5264
  currentOffset.value = offset;
5259
5265
  };
5266
+ const isReadonly = () => props.readonly || !props.options.length;
5260
5267
  const onClickOption = (index) => {
5261
- if (moving || props.readonly) {
5268
+ if (moving || isReadonly()) {
5262
5269
  return;
5263
5270
  }
5264
5271
  transitionEndTrigger = null;
@@ -5283,7 +5290,7 @@ var stdin_default$$ = vue.defineComponent({
5283
5290
  }
5284
5291
  };
5285
5292
  const onTouchStart = (event) => {
5286
- if (props.readonly) {
5293
+ if (isReadonly()) {
5287
5294
  return;
5288
5295
  }
5289
5296
  touch.start(event);
@@ -5298,7 +5305,7 @@ var stdin_default$$ = vue.defineComponent({
5298
5305
  transitionEndTrigger = null;
5299
5306
  };
5300
5307
  const onTouchMove = (event) => {
5301
- if (props.readonly) {
5308
+ if (isReadonly()) {
5302
5309
  return;
5303
5310
  }
5304
5311
  touch.move(event);
@@ -5314,7 +5321,7 @@ var stdin_default$$ = vue.defineComponent({
5314
5321
  }
5315
5322
  };
5316
5323
  const onTouchEnd = () => {
5317
- if (props.readonly) {
5324
+ if (isReadonly()) {
5318
5325
  return;
5319
5326
  }
5320
5327
  const distance = currentOffset.value - momentumOffset;
@@ -9202,9 +9209,10 @@ var stdin_default$H = vue.defineComponent({
9202
9209
  rootWidth: makeRequiredProp(Number),
9203
9210
  rootHeight: makeRequiredProp(Number)
9204
9211
  },
9205
- emits: ["scale", "close"],
9212
+ emits: ["scale", "close", "longPress"],
9206
9213
  setup(props, {
9207
- emit
9214
+ emit,
9215
+ slots
9208
9216
  }) {
9209
9217
  const state = vue.reactive({
9210
9218
  scale: 1,
@@ -9348,16 +9356,20 @@ var stdin_default$H = vue.defineComponent({
9348
9356
  const deltaTime = Date.now() - touchStartTime;
9349
9357
  const TAP_TIME = 250;
9350
9358
  const TAP_OFFSET = 5;
9351
- if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET && deltaTime < TAP_TIME) {
9352
- if (doubleTapTimer) {
9353
- clearTimeout(doubleTapTimer);
9354
- doubleTapTimer = null;
9355
- toggleScale();
9356
- } else {
9357
- doubleTapTimer = setTimeout(() => {
9358
- emit("close");
9359
+ if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
9360
+ if (deltaTime < TAP_TIME) {
9361
+ if (doubleTapTimer) {
9362
+ clearTimeout(doubleTapTimer);
9359
9363
  doubleTapTimer = null;
9360
- }, TAP_TIME);
9364
+ toggleScale();
9365
+ } else {
9366
+ doubleTapTimer = setTimeout(() => {
9367
+ emit("close");
9368
+ doubleTapTimer = null;
9369
+ }, TAP_TIME);
9370
+ }
9371
+ } else if (deltaTime > LONG_PRESS_START_TIME) {
9372
+ emit("longPress");
9361
9373
  }
9362
9374
  }
9363
9375
  };
@@ -9423,7 +9435,11 @@ var stdin_default$H = vue.defineComponent({
9423
9435
  "onTouchend": onTouchEnd,
9424
9436
  "onTouchcancel": onTouchEnd
9425
9437
  }, {
9426
- default: () => [vue.createVNode(Image$1, {
9438
+ default: () => [slots.image ? vue.createVNode("div", {
9439
+ "class": bem$s("image-wrap")
9440
+ }, [slots.image({
9441
+ src: props.src
9442
+ })]) : vue.createVNode(Image$1, {
9427
9443
  "src": props.src,
9428
9444
  "fit": "contain",
9429
9445
  "class": bem$s("image", {
@@ -9462,7 +9478,7 @@ const imagePreviewProps = {
9462
9478
  var stdin_default$G = vue.defineComponent({
9463
9479
  name: name$r,
9464
9480
  props: imagePreviewProps,
9465
- emits: ["scale", "close", "closed", "change", "update:show"],
9481
+ emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
9466
9482
  setup(props, {
9467
9483
  emit,
9468
9484
  slots
@@ -9538,7 +9554,7 @@ var stdin_default$G = vue.defineComponent({
9538
9554
  "indicatorColor": "white",
9539
9555
  "onChange": setActive
9540
9556
  }, {
9541
- default: () => [props.images.map((image) => vue.createVNode(stdin_default$H, {
9557
+ default: () => [props.images.map((image, index) => vue.createVNode(stdin_default$H, {
9542
9558
  "src": image.url,
9543
9559
  "show": props.show,
9544
9560
  "active": state.active,
@@ -9547,8 +9563,13 @@ var stdin_default$G = vue.defineComponent({
9547
9563
  "rootWidth": state.rootWidth,
9548
9564
  "rootHeight": state.rootHeight,
9549
9565
  "onScale": emitScale,
9550
- "onClose": emitClose
9551
- }, null))]
9566
+ "onClose": emitClose,
9567
+ "onLongPress": () => emit("longPress", {
9568
+ index
9569
+ })
9570
+ }, {
9571
+ image: slots.image
9572
+ }))]
9552
9573
  });
9553
9574
  const renderClose = () => {
9554
9575
  if (props.closeable) {
@@ -10359,6 +10380,47 @@ function getUniqueFileName(file, suffix = "") {
10359
10380
  )}`;
10360
10381
  return suffix ? name2 + "." + suffix : name2;
10361
10382
  }
10383
+ function adjustImgOrientation(ctx, img, orientation, width, height) {
10384
+ switch (orientation) {
10385
+ case 3:
10386
+ ctx.rotate(180 * Math.PI / 180);
10387
+ ctx.drawImage(img, -width, -height, width, height);
10388
+ break;
10389
+ case 6:
10390
+ ctx.rotate(90 * Math.PI / 180);
10391
+ ctx.drawImage(img, 0, -width, height, width);
10392
+ break;
10393
+ case 8:
10394
+ ctx.rotate(270 * Math.PI / 180);
10395
+ ctx.drawImage(img, -height, 0, height, width);
10396
+ break;
10397
+ case 2:
10398
+ ctx.translate(width, 0);
10399
+ ctx.scale(-1, 1);
10400
+ ctx.drawImage(img, 0, 0, width, height);
10401
+ break;
10402
+ case 4:
10403
+ ctx.translate(width, 0);
10404
+ ctx.scale(-1, 1);
10405
+ ctx.rotate(180 * Math.PI / 180);
10406
+ ctx.drawImage(img, -width, -height, width, height);
10407
+ break;
10408
+ case 5:
10409
+ ctx.translate(width, 0);
10410
+ ctx.scale(-1, 1);
10411
+ ctx.rotate(90 * Math.PI / 180);
10412
+ ctx.drawImage(img, 0, -width, height, width);
10413
+ break;
10414
+ case 7:
10415
+ ctx.translate(width, 0);
10416
+ ctx.scale(-1, 1);
10417
+ ctx.rotate(270 * Math.PI / 180);
10418
+ ctx.drawImage(img, -height, 0, height, width);
10419
+ break;
10420
+ default:
10421
+ ctx.drawImage(img, 0, 0, width, height);
10422
+ }
10423
+ }
10362
10424
  function file2DataURL(file) {
10363
10425
  return new Promise((resolve, reject) => {
10364
10426
  const a = new FileReader();
@@ -10387,7 +10449,7 @@ function file2Image(file) {
10387
10449
  }).catch(reject);
10388
10450
  });
10389
10451
  }
10390
- function image2Canvas(img, width, height) {
10452
+ function image2Canvas(img, type, orientation, width, height) {
10391
10453
  const canvas = document.createElement("canvas");
10392
10454
  const _width = width || img.width;
10393
10455
  const _height = height || img.height;
@@ -10395,9 +10457,12 @@ function image2Canvas(img, width, height) {
10395
10457
  canvas.height = _height;
10396
10458
  const ctx = canvas.getContext("2d");
10397
10459
  if (ctx) {
10398
- ctx.fillStyle = "#fff";
10460
+ ctx.fillStyle = "transparent";
10461
+ if (type === "image/jpeg") {
10462
+ ctx.fillStyle = "#fff";
10463
+ }
10399
10464
  ctx.fillRect(0, 0, _width, _height);
10400
- ctx.drawImage(img, 0, 0, _width, _height);
10465
+ adjustImgOrientation(ctx, img, orientation, _width, _height);
10401
10466
  return Promise.resolve(canvas);
10402
10467
  }
10403
10468
  return Promise.reject(new Error("canvas getContext return null"));
@@ -10423,7 +10488,74 @@ function canvas2Image(canvas, type = "image/jpeg", quality = 0.8) {
10423
10488
  image.src = canvas.toDataURL(type, quality);
10424
10489
  return Promise.resolve(image);
10425
10490
  }
10491
+ function getStringFromCharCode(dataView, start, length) {
10492
+ let str = "";
10493
+ let i;
10494
+ length += start;
10495
+ for (i = start; i < length; i += 1) {
10496
+ str += String.fromCharCode(dataView.getUint8(i));
10497
+ }
10498
+ return str;
10499
+ }
10500
+ function getOrientation(arrayBuffer) {
10501
+ const dataView = new DataView(arrayBuffer);
10502
+ let orientation;
10503
+ try {
10504
+ let littleEndian;
10505
+ let app1Start;
10506
+ let ifdStart;
10507
+ if (dataView.getUint8(0) === 255 && dataView.getUint8(1) === 216) {
10508
+ const length = dataView.byteLength;
10509
+ let offset = 2;
10510
+ while (offset + 1 < length) {
10511
+ if (dataView.getUint8(offset) === 255 && dataView.getUint8(offset + 1) === 225) {
10512
+ app1Start = offset;
10513
+ break;
10514
+ }
10515
+ offset += 1;
10516
+ }
10517
+ }
10518
+ if (app1Start) {
10519
+ const exifIDCode = app1Start + 4;
10520
+ const tiffOffset = app1Start + 10;
10521
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === "Exif") {
10522
+ const endianness = dataView.getUint16(tiffOffset);
10523
+ littleEndian = endianness === 18761;
10524
+ if (littleEndian || endianness === 19789) {
10525
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 42) {
10526
+ const firstIFDOffset = dataView.getUint32(
10527
+ tiffOffset + 4,
10528
+ littleEndian
10529
+ );
10530
+ if (firstIFDOffset >= 8) {
10531
+ ifdStart = tiffOffset + firstIFDOffset;
10532
+ }
10533
+ }
10534
+ }
10535
+ }
10536
+ }
10537
+ if (ifdStart) {
10538
+ const _length = dataView.getUint16(ifdStart, littleEndian);
10539
+ let _offset;
10540
+ let i;
10541
+ for (i = 0; i < _length; i += 1) {
10542
+ _offset = ifdStart + i * 12 + 2;
10543
+ if (dataView.getUint16(_offset, littleEndian) === 274) {
10544
+ _offset += 8;
10545
+ orientation = dataView.getUint16(_offset, littleEndian);
10546
+ dataView.setUint16(_offset, 1, littleEndian);
10547
+ break;
10548
+ }
10549
+ }
10550
+ }
10551
+ } catch (e) {
10552
+ orientation = 1;
10553
+ }
10554
+ return orientation;
10555
+ }
10426
10556
  function resize(img, {
10557
+ inputType = "image/jpeg",
10558
+ orientation = 1,
10427
10559
  imageWidth = -1,
10428
10560
  imageHeight = -1,
10429
10561
  sideLengthLimit = 640,
@@ -10441,14 +10573,18 @@ function resize(img, {
10441
10573
  } else {
10442
10574
  return Promise.reject(new Error("image width/height \u65E0\u6548"));
10443
10575
  }
10444
- const targetWidth = imageWidth * scale;
10445
- const targetHeight = imageHeight * scale;
10576
+ const targetWidth = scale > 1 ? imageWidth : imageWidth * scale;
10577
+ const targetHeight = scale > 1 ? imageHeight : imageHeight * scale;
10446
10578
  if (resultType === "image") {
10447
- return image2Canvas(img, targetWidth, targetHeight).then(
10448
- (canvas) => canvas2Image(canvas)
10449
- );
10450
- }
10451
- return image2Canvas(img, targetWidth, targetHeight);
10579
+ return image2Canvas(
10580
+ img,
10581
+ inputType,
10582
+ orientation,
10583
+ targetWidth,
10584
+ targetHeight
10585
+ ).then((canvas) => canvas2Image(canvas));
10586
+ }
10587
+ return image2Canvas(img, inputType, orientation, targetWidth, targetHeight);
10452
10588
  }
10453
10589
  class ResizeOptions {
10454
10590
  constructor(maxSideLength) {
@@ -10488,7 +10624,13 @@ const parseDecimal = (obj, defaultValue) => {
10488
10624
  }
10489
10625
  return result;
10490
10626
  };
10491
- const FORMAT = {
10627
+ var __formatNumber__ = function(number) {
10628
+ if (number < 10) {
10629
+ return "0" + number;
10630
+ }
10631
+ return number + "";
10632
+ };
10633
+ var DATE_FORMAT = {
10492
10634
  FORMAT_HM: "HH:mm",
10493
10635
  FORMAT_MDHM: "MM-dd HH:mm",
10494
10636
  FORMAT_MD_CN: "MM\u6708dd\u65E5",
@@ -10506,16 +10648,7 @@ const FORMAT = {
10506
10648
  FORMAT_YMDHM_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206",
10507
10649
  FORMAT_YMDHMS_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206ss\u79D2"
10508
10650
  };
10509
- const __formatNumber__ = function(number) {
10510
- if (number < 10) {
10511
- return "0" + number;
10512
- }
10513
- return number + "";
10514
- };
10515
10651
  function createDate(dateObj) {
10516
- if (!isDef(dateObj)) {
10517
- return null;
10518
- }
10519
10652
  if (typeof dateObj === "number") {
10520
10653
  return new Date(dateObj);
10521
10654
  }
@@ -10526,47 +10659,37 @@ function createDate(dateObj) {
10526
10659
  }
10527
10660
  return new Date(dateObj);
10528
10661
  }
10529
- if (isDate(dateObj)) {
10530
- return dateObj;
10531
- }
10532
- return null;
10662
+ return dateObj;
10533
10663
  }
10534
- function formatDate(dateObj, formatType = FORMAT.FORMAT_YMDHMS) {
10664
+ function formatDate(dateObj, formatType = DATE_FORMAT.FORMAT_YMDHMS) {
10535
10665
  const date = createDate(dateObj);
10536
- if (date) {
10537
- date.getFullYear();
10538
- let formatResult = formatType.replace(
10539
- "yyyy",
10540
- __formatNumber__(date.getFullYear())
10541
- );
10542
- formatResult = formatResult.replace(
10543
- "yy",
10544
- String(date.getFullYear()).substring(2)
10545
- );
10546
- formatResult = formatResult.replace(
10547
- "MM",
10548
- __formatNumber__(date.getMonth() + 1)
10549
- );
10550
- formatResult = formatResult.replace("dd", __formatNumber__(date.getDate()));
10551
- formatResult = formatResult.replace(
10552
- "HH",
10553
- __formatNumber__(date.getHours())
10554
- );
10555
- formatResult = formatResult.replace(
10556
- "mm",
10557
- __formatNumber__(date.getMinutes())
10558
- );
10559
- formatResult = formatResult.replace(
10560
- "ss",
10561
- __formatNumber__(date.getSeconds())
10562
- );
10563
- formatResult = formatResult.replace(
10564
- "msms",
10565
- __formatNumber__(date.getMilliseconds())
10566
- );
10567
- return formatResult;
10568
- }
10569
- return null;
10666
+ let formatResult = formatType.replace(
10667
+ "yyyy",
10668
+ __formatNumber__(date.getFullYear())
10669
+ );
10670
+ formatResult = formatResult.replace(
10671
+ "yy",
10672
+ String(date.getFullYear()).substring(2)
10673
+ );
10674
+ formatResult = formatResult.replace(
10675
+ "MM",
10676
+ __formatNumber__(date.getMonth() + 1)
10677
+ );
10678
+ formatResult = formatResult.replace("dd", __formatNumber__(date.getDate()));
10679
+ formatResult = formatResult.replace("HH", __formatNumber__(date.getHours()));
10680
+ formatResult = formatResult.replace(
10681
+ "mm",
10682
+ __formatNumber__(date.getMinutes())
10683
+ );
10684
+ formatResult = formatResult.replace(
10685
+ "ss",
10686
+ __formatNumber__(date.getSeconds())
10687
+ );
10688
+ formatResult = formatResult.replace(
10689
+ "msms",
10690
+ __formatNumber__(date.getMilliseconds())
10691
+ );
10692
+ return formatResult;
10570
10693
  }
10571
10694
  const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
10572
10695
  const subString = (str, startIndex, length) => {
@@ -10792,7 +10915,7 @@ function buildContent(contentConfigString, watermarkContext) {
10792
10915
  const regexResult = scanner.next(dateRegex);
10793
10916
  if (regexResult) {
10794
10917
  const matchResults = regexResult;
10795
- let format = FORMAT.FORMAT_YMD;
10918
+ let format = DATE_FORMAT.FORMAT_YMD;
10796
10919
  if (matchResults && matchResults.length >= 2) {
10797
10920
  if (isValidString(matchResults[1])) {
10798
10921
  format = matchResults[1];
@@ -10807,7 +10930,7 @@ function buildContent(contentConfigString, watermarkContext) {
10807
10930
  if (watermarkContext) {
10808
10931
  const value = formatDate(
10809
10932
  watermarkContext.watermarkTime,
10810
- FORMAT.FORMAT_HM
10933
+ DATE_FORMAT.FORMAT_HM
10811
10934
  );
10812
10935
  content += value;
10813
10936
  }
@@ -11161,7 +11284,6 @@ function checkWatermarkConfigSupported(watermarkConfigString) {
11161
11284
  }
11162
11285
  return true;
11163
11286
  }
11164
- const DEFAULT_IMAGE_TYPE = "image/jpeg";
11165
11287
  const DEFAULT_JPEG_QUALITY = 0.8;
11166
11288
  const MIN_JPEG_QUALITY = 0.1;
11167
11289
  const JPEG_QUALITY_STEP = 0.05;
@@ -11174,9 +11296,29 @@ class ImageProcessor {
11174
11296
  }
11175
11297
  process() {
11176
11298
  const filename = this.file.name;
11299
+ let fileType = this.file.type;
11177
11300
  const { lastModified } = this.file;
11301
+ let orientation = 1;
11302
+ if (this.file.size > this.compressOptions.photoFileSizeLimit * 1024) {
11303
+ fileType = "image/jpeg";
11304
+ }
11305
+ if (isIOS$1() && fileType === "image/jpeg") {
11306
+ const reader = new FileReader();
11307
+ reader.readAsArrayBuffer(this.file);
11308
+ reader.onload = function(_ref) {
11309
+ const { target } = _ref;
11310
+ if (target == null ? void 0 : target.result) {
11311
+ orientation = getOrientation(target == null ? void 0 : target.result);
11312
+ }
11313
+ };
11314
+ }
11315
+ if (fileType === "image/gif") {
11316
+ fileType = "image/png";
11317
+ }
11178
11318
  return file2Image(this.file).then(
11179
11319
  (img) => resize(img, {
11320
+ inputType: fileType,
11321
+ orientation,
11180
11322
  sideLengthLimit: this.resizeOptions.maxSideLength,
11181
11323
  resultType: "canvas"
11182
11324
  })
@@ -11189,7 +11331,7 @@ class ImageProcessor {
11189
11331
  canvas,
11190
11332
  exportFilename,
11191
11333
  lastModified,
11192
- DEFAULT_IMAGE_TYPE,
11334
+ fileType,
11193
11335
  DEFAULT_JPEG_QUALITY
11194
11336
  );
11195
11337
  });
@@ -11721,7 +11863,7 @@ var stdin_default$t = vue.defineComponent({
11721
11863
  if (media.showSrc) {
11722
11864
  return vue.createVNode(stdin_default$1q, {
11723
11865
  "src": media.showSrc,
11724
- "fit": "fill",
11866
+ "fit": "cover",
11725
11867
  "radius": "4"
11726
11868
  }, null);
11727
11869
  } else if (media.type === "video") {
@@ -12016,8 +12158,7 @@ var stdin_default$r = vue.defineComponent({
12016
12158
  "size": "normal",
12017
12159
  "block": true,
12018
12160
  "style": {
12019
- marginRigth: "4px",
12020
- backgroundColor: "white"
12161
+ marginRigth: "4px"
12021
12162
  },
12022
12163
  "onClick": onCancel
12023
12164
  }, {
@@ -14181,7 +14322,6 @@ var stdin_default$b = vue.defineComponent({
14181
14322
  const Step = withInstall(stdin_default$b);
14182
14323
  const [name$5, bem$5] = createNamespace("stepper");
14183
14324
  const LONG_PRESS_INTERVAL = 200;
14184
- const LONG_PRESS_START_TIME = 600;
14185
14325
  const isEqual = (value1, value2) => String(value1) === String(value2);
14186
14326
  const stepperProps = {
14187
14327
  min: makeNumericProp(1),
@@ -15991,15 +16131,14 @@ var stdin_default$1 = (lazyManager) => ({
15991
16131
  default: "img"
15992
16132
  }
15993
16133
  },
15994
- render(h) {
15995
- return h(
16134
+ render() {
16135
+ var _a, _b;
16136
+ return vue.h(
15996
16137
  this.tag,
15997
16138
  {
15998
- attrs: {
15999
- src: this.renderSrc
16000
- }
16139
+ src: this.renderSrc
16001
16140
  },
16002
- this.$slots.default
16141
+ (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
16003
16142
  );
16004
16143
  },
16005
16144
  data() {
@@ -16101,7 +16240,7 @@ const Lazyload = {
16101
16240
  });
16102
16241
  }
16103
16242
  };
16104
- const version = "3.0.3";
16243
+ const version = "3.0.4";
16105
16244
  function install(app) {
16106
16245
  const components = [
16107
16246
  ActionSheet,