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.cjs.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const use = require("@zartui/use");
4
4
  const vue = require("vue");
5
+ const dateUtils = require("@zartui/date-utils");
5
6
  const popperjs = require("@zartui/popperjs");
6
7
  const isDef = (val) => val !== void 0 && val !== null;
7
8
  const isFunction = (val) => typeof val === "function";
@@ -369,6 +370,7 @@ const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
369
370
  const HAPTICS_FEEDBACK = "zt-haptics-feedback";
370
371
  const ELLIPSIS = "zt-ellipsis";
371
372
  const FORM_KEY = Symbol("zt-form");
373
+ const LONG_PRESS_START_TIME = 500;
372
374
  function callInterceptor(interceptor, {
373
375
  args = [],
374
376
  done,
@@ -816,6 +818,8 @@ const popupProps$2 = extend({}, popupSharedProps, {
816
818
  safeAreaInsetTop: Boolean,
817
819
  safeAreaInsetBottom: Boolean,
818
820
  sliderContentHeight: makeNumberProp(60),
821
+ minDragHeight: makeStringProp("40px"),
822
+ maxDragHeight: makeStringProp("85vh"),
819
823
  slideable: Boolean
820
824
  });
821
825
  const [name$16, bem$13] = createNamespace("popup");
@@ -833,15 +837,13 @@ var stdin_default$1x = vue.defineComponent({
833
837
  let opened;
834
838
  let shouldReopen;
835
839
  const root = vue.ref();
836
- const positionY = vue.ref(0);
837
840
  let timerId = setInterval(() => {
838
841
  }, 0);
839
- const touchHeight = vue.ref(0);
840
842
  const contentStyle = vue.ref(`height:${props.sliderContentHeight}px;`);
841
- const touchAreaHeight = vue.ref(40);
842
843
  const zIndex = vue.ref();
843
- const touchPoint = vue.ref(0);
844
844
  const popupRef = vue.ref();
845
+ let touchPoint = 0;
846
+ const touchAreaHeight = unitToPx(props.minDragHeight);
845
847
  const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
846
848
  const style = vue.computed(() => {
847
849
  const style2 = {
@@ -888,13 +890,14 @@ var stdin_default$1x = vue.defineComponent({
888
890
  event.preventDefault();
889
891
  }
890
892
  const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
891
- positionY.value = event.touches[0].clientY;
893
+ const positionY = event.touches[0].clientY || 0;
894
+ let touchHeight = 0;
892
895
  timerId = setTimeout(() => {
893
- if (positionY.value === 0 || positionY.value < h * 0.15) {
896
+ if (positionY === 0 || positionY < h - unitToPx(props.maxDragHeight)) {
894
897
  return;
895
898
  }
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;`;
899
+ touchHeight = positionY - touchAreaHeight > h - touchAreaHeight ? h - touchAreaHeight + touchPoint : positionY;
900
+ contentStyle.value = `height:${h - touchHeight - touchAreaHeight + touchPoint}px;`;
898
901
  }, 10);
899
902
  };
900
903
  const startMove = (event) => {
@@ -902,7 +905,7 @@ var stdin_default$1x = vue.defineComponent({
902
905
  if (timerId) {
903
906
  clearInterval(timerId);
904
907
  }
905
- touchPoint.value = event.touches[0].clientY - (((_b = (_a = popupRef.value) == null ? void 0 : _a.getBoundingClientRect()) == null ? void 0 : _b.top) || 0);
908
+ touchPoint = event.touches[0].clientY - (((_b = (_a = popupRef.value) == null ? void 0 : _a.getBoundingClientRect()) == null ? void 0 : _b.top) || 0);
906
909
  };
907
910
  const endMove = () => {
908
911
  clearInterval(timerId);
@@ -979,6 +982,7 @@ var stdin_default$1x = vue.defineComponent({
979
982
  "onKeydown": onKeydown
980
983
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon(), vue.createVNode("div", {
981
984
  "class": bem$13("slider-title"),
985
+ "style": `height:${touchAreaHeight}px;`,
982
986
  "ref": root
983
987
  }, [vue.createVNode("div", {
984
988
  "class": bem$13("slider-bar")
@@ -1474,7 +1478,8 @@ const avatarProps = {
1474
1478
  size: makeStringProp("medium"),
1475
1479
  shape: makeStringProp("square"),
1476
1480
  text: String,
1477
- textBgColor: String
1481
+ textBgColor: String,
1482
+ border: Boolean
1478
1483
  };
1479
1484
  var stdin_default$1p = vue.defineComponent({
1480
1485
  name: name$12,
@@ -1487,7 +1492,7 @@ var stdin_default$1p = vue.defineComponent({
1487
1492
  if (len === 1) {
1488
1493
  return props.text;
1489
1494
  } else if (len > 1) {
1490
- return props.text.substring(len - 2, 2);
1495
+ return props.text.substring(len - 2, len);
1491
1496
  }
1492
1497
  }
1493
1498
  return "";
@@ -1508,7 +1513,9 @@ var stdin_default$1p = vue.defineComponent({
1508
1513
  }
1509
1514
  });
1510
1515
  const renderText = () => vue.createVNode("div", {
1511
- "class": bem$$("img", classArr.value),
1516
+ "class": bem$$("img", [classArr.value, {
1517
+ border: props.border
1518
+ }]),
1512
1519
  "style": style.value
1513
1520
  }, [headText.value]);
1514
1521
  return () => {
@@ -1517,7 +1524,9 @@ var stdin_default$1p = vue.defineComponent({
1517
1524
  }
1518
1525
  return vue.createVNode(stdin_default$1q, {
1519
1526
  "round": props.shape === "round",
1520
- "class": bem$$("img", classArr.value),
1527
+ "class": bem$$("img", [classArr.value, {
1528
+ border: props.border
1529
+ }]),
1521
1530
  "style": style.value,
1522
1531
  "src": props.src
1523
1532
  }, {
@@ -2736,7 +2745,7 @@ var stdin_default$1i = vue.defineComponent({
2736
2745
  "onClick": onCancel,
2737
2746
  "style": {
2738
2747
  marginRight: "4px",
2739
- backgroundColor: "white"
2748
+ backgroundColor: "transparent"
2740
2749
  }
2741
2750
  }, {
2742
2751
  default: () => [text || "\u53D6\u6D88"]
@@ -2757,7 +2766,7 @@ var stdin_default$1i = vue.defineComponent({
2757
2766
  };
2758
2767
  const renderFooter = () => vue.createVNode("div", {
2759
2768
  "class": [bem$Z("footer"), {
2760
- "van-safe-area-bottom": props.safeAreaInsetBottom
2769
+ "zt-safe-area-bottom": props.safeAreaInsetBottom
2761
2770
  }]
2762
2771
  }, [renderFooterButton()]);
2763
2772
  const renderCalendar = () => vue.createVNode("div", {
@@ -3110,8 +3119,7 @@ var stdin_default$1f = vue.defineComponent({
3110
3119
  const touch = useTouch();
3111
3120
  const {
3112
3121
  children,
3113
- linkChildren,
3114
- unlinkChildren
3122
+ linkChildren
3115
3123
  } = use.useChildren(SWIPE_KEY);
3116
3124
  const count = vue.computed(() => children.length);
3117
3125
  const size = vue.computed(() => state[props.vertical ? "height" : "width"]);
@@ -3411,7 +3419,6 @@ var stdin_default$1f = vue.defineComponent({
3411
3419
  vue.onMounted(initialize);
3412
3420
  vue.onActivated(() => initialize(state.active));
3413
3421
  onPopupReopen(() => {
3414
- unlinkChildren();
3415
3422
  initialize(state.active);
3416
3423
  });
3417
3424
  vue.onDeactivated(stopAutoplay);
@@ -5257,8 +5264,9 @@ var stdin_default$$ = vue.defineComponent({
5257
5264
  }
5258
5265
  currentOffset.value = offset;
5259
5266
  };
5267
+ const isReadonly = () => props.readonly || !props.options.length;
5260
5268
  const onClickOption = (index) => {
5261
- if (moving || props.readonly) {
5269
+ if (moving || isReadonly()) {
5262
5270
  return;
5263
5271
  }
5264
5272
  transitionEndTrigger = null;
@@ -5283,7 +5291,7 @@ var stdin_default$$ = vue.defineComponent({
5283
5291
  }
5284
5292
  };
5285
5293
  const onTouchStart = (event) => {
5286
- if (props.readonly) {
5294
+ if (isReadonly()) {
5287
5295
  return;
5288
5296
  }
5289
5297
  touch.start(event);
@@ -5298,7 +5306,7 @@ var stdin_default$$ = vue.defineComponent({
5298
5306
  transitionEndTrigger = null;
5299
5307
  };
5300
5308
  const onTouchMove = (event) => {
5301
- if (props.readonly) {
5309
+ if (isReadonly()) {
5302
5310
  return;
5303
5311
  }
5304
5312
  touch.move(event);
@@ -5314,7 +5322,7 @@ var stdin_default$$ = vue.defineComponent({
5314
5322
  }
5315
5323
  };
5316
5324
  const onTouchEnd = () => {
5317
- if (props.readonly) {
5325
+ if (isReadonly()) {
5318
5326
  return;
5319
5327
  }
5320
5328
  const distance = currentOffset.value - momentumOffset;
@@ -9202,9 +9210,10 @@ var stdin_default$H = vue.defineComponent({
9202
9210
  rootWidth: makeRequiredProp(Number),
9203
9211
  rootHeight: makeRequiredProp(Number)
9204
9212
  },
9205
- emits: ["scale", "close"],
9213
+ emits: ["scale", "close", "longPress"],
9206
9214
  setup(props, {
9207
- emit
9215
+ emit,
9216
+ slots
9208
9217
  }) {
9209
9218
  const state = vue.reactive({
9210
9219
  scale: 1,
@@ -9348,16 +9357,20 @@ var stdin_default$H = vue.defineComponent({
9348
9357
  const deltaTime = Date.now() - touchStartTime;
9349
9358
  const TAP_TIME = 250;
9350
9359
  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");
9360
+ if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
9361
+ if (deltaTime < TAP_TIME) {
9362
+ if (doubleTapTimer) {
9363
+ clearTimeout(doubleTapTimer);
9359
9364
  doubleTapTimer = null;
9360
- }, TAP_TIME);
9365
+ toggleScale();
9366
+ } else {
9367
+ doubleTapTimer = setTimeout(() => {
9368
+ emit("close");
9369
+ doubleTapTimer = null;
9370
+ }, TAP_TIME);
9371
+ }
9372
+ } else if (deltaTime > LONG_PRESS_START_TIME) {
9373
+ emit("longPress");
9361
9374
  }
9362
9375
  }
9363
9376
  };
@@ -9423,7 +9436,11 @@ var stdin_default$H = vue.defineComponent({
9423
9436
  "onTouchend": onTouchEnd,
9424
9437
  "onTouchcancel": onTouchEnd
9425
9438
  }, {
9426
- default: () => [vue.createVNode(Image$1, {
9439
+ default: () => [slots.image ? vue.createVNode("div", {
9440
+ "class": bem$s("image-wrap")
9441
+ }, [slots.image({
9442
+ src: props.src
9443
+ })]) : vue.createVNode(Image$1, {
9427
9444
  "src": props.src,
9428
9445
  "fit": "contain",
9429
9446
  "class": bem$s("image", {
@@ -9462,7 +9479,7 @@ const imagePreviewProps = {
9462
9479
  var stdin_default$G = vue.defineComponent({
9463
9480
  name: name$r,
9464
9481
  props: imagePreviewProps,
9465
- emits: ["scale", "close", "closed", "change", "update:show"],
9482
+ emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
9466
9483
  setup(props, {
9467
9484
  emit,
9468
9485
  slots
@@ -9538,7 +9555,7 @@ var stdin_default$G = vue.defineComponent({
9538
9555
  "indicatorColor": "white",
9539
9556
  "onChange": setActive
9540
9557
  }, {
9541
- default: () => [props.images.map((image) => vue.createVNode(stdin_default$H, {
9558
+ default: () => [props.images.map((image, index) => vue.createVNode(stdin_default$H, {
9542
9559
  "src": image.url,
9543
9560
  "show": props.show,
9544
9561
  "active": state.active,
@@ -9547,8 +9564,13 @@ var stdin_default$G = vue.defineComponent({
9547
9564
  "rootWidth": state.rootWidth,
9548
9565
  "rootHeight": state.rootHeight,
9549
9566
  "onScale": emitScale,
9550
- "onClose": emitClose
9551
- }, null))]
9567
+ "onClose": emitClose,
9568
+ "onLongPress": () => emit("longPress", {
9569
+ index
9570
+ })
9571
+ }, {
9572
+ image: slots.image
9573
+ }))]
9552
9574
  });
9553
9575
  const renderClose = () => {
9554
9576
  if (props.closeable) {
@@ -10359,6 +10381,47 @@ function getUniqueFileName(file, suffix = "") {
10359
10381
  )}`;
10360
10382
  return suffix ? name2 + "." + suffix : name2;
10361
10383
  }
10384
+ function adjustImgOrientation(ctx, img, orientation, width, height) {
10385
+ switch (orientation) {
10386
+ case 3:
10387
+ ctx.rotate(180 * Math.PI / 180);
10388
+ ctx.drawImage(img, -width, -height, width, height);
10389
+ break;
10390
+ case 6:
10391
+ ctx.rotate(90 * Math.PI / 180);
10392
+ ctx.drawImage(img, 0, -width, height, width);
10393
+ break;
10394
+ case 8:
10395
+ ctx.rotate(270 * Math.PI / 180);
10396
+ ctx.drawImage(img, -height, 0, height, width);
10397
+ break;
10398
+ case 2:
10399
+ ctx.translate(width, 0);
10400
+ ctx.scale(-1, 1);
10401
+ ctx.drawImage(img, 0, 0, width, height);
10402
+ break;
10403
+ case 4:
10404
+ ctx.translate(width, 0);
10405
+ ctx.scale(-1, 1);
10406
+ ctx.rotate(180 * Math.PI / 180);
10407
+ ctx.drawImage(img, -width, -height, width, height);
10408
+ break;
10409
+ case 5:
10410
+ ctx.translate(width, 0);
10411
+ ctx.scale(-1, 1);
10412
+ ctx.rotate(90 * Math.PI / 180);
10413
+ ctx.drawImage(img, 0, -width, height, width);
10414
+ break;
10415
+ case 7:
10416
+ ctx.translate(width, 0);
10417
+ ctx.scale(-1, 1);
10418
+ ctx.rotate(270 * Math.PI / 180);
10419
+ ctx.drawImage(img, -height, 0, height, width);
10420
+ break;
10421
+ default:
10422
+ ctx.drawImage(img, 0, 0, width, height);
10423
+ }
10424
+ }
10362
10425
  function file2DataURL(file) {
10363
10426
  return new Promise((resolve, reject) => {
10364
10427
  const a = new FileReader();
@@ -10387,7 +10450,7 @@ function file2Image(file) {
10387
10450
  }).catch(reject);
10388
10451
  });
10389
10452
  }
10390
- function image2Canvas(img, width, height) {
10453
+ function image2Canvas(img, type, orientation, width, height) {
10391
10454
  const canvas = document.createElement("canvas");
10392
10455
  const _width = width || img.width;
10393
10456
  const _height = height || img.height;
@@ -10395,9 +10458,12 @@ function image2Canvas(img, width, height) {
10395
10458
  canvas.height = _height;
10396
10459
  const ctx = canvas.getContext("2d");
10397
10460
  if (ctx) {
10398
- ctx.fillStyle = "#fff";
10461
+ ctx.fillStyle = "transparent";
10462
+ if (type === "image/jpeg") {
10463
+ ctx.fillStyle = "#fff";
10464
+ }
10399
10465
  ctx.fillRect(0, 0, _width, _height);
10400
- ctx.drawImage(img, 0, 0, _width, _height);
10466
+ adjustImgOrientation(ctx, img, orientation, _width, _height);
10401
10467
  return Promise.resolve(canvas);
10402
10468
  }
10403
10469
  return Promise.reject(new Error("canvas getContext return null"));
@@ -10423,7 +10489,74 @@ function canvas2Image(canvas, type = "image/jpeg", quality = 0.8) {
10423
10489
  image.src = canvas.toDataURL(type, quality);
10424
10490
  return Promise.resolve(image);
10425
10491
  }
10492
+ function getStringFromCharCode(dataView, start, length) {
10493
+ let str = "";
10494
+ let i;
10495
+ length += start;
10496
+ for (i = start; i < length; i += 1) {
10497
+ str += String.fromCharCode(dataView.getUint8(i));
10498
+ }
10499
+ return str;
10500
+ }
10501
+ function getOrientation(arrayBuffer) {
10502
+ const dataView = new DataView(arrayBuffer);
10503
+ let orientation;
10504
+ try {
10505
+ let littleEndian;
10506
+ let app1Start;
10507
+ let ifdStart;
10508
+ if (dataView.getUint8(0) === 255 && dataView.getUint8(1) === 216) {
10509
+ const length = dataView.byteLength;
10510
+ let offset = 2;
10511
+ while (offset + 1 < length) {
10512
+ if (dataView.getUint8(offset) === 255 && dataView.getUint8(offset + 1) === 225) {
10513
+ app1Start = offset;
10514
+ break;
10515
+ }
10516
+ offset += 1;
10517
+ }
10518
+ }
10519
+ if (app1Start) {
10520
+ const exifIDCode = app1Start + 4;
10521
+ const tiffOffset = app1Start + 10;
10522
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === "Exif") {
10523
+ const endianness = dataView.getUint16(tiffOffset);
10524
+ littleEndian = endianness === 18761;
10525
+ if (littleEndian || endianness === 19789) {
10526
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 42) {
10527
+ const firstIFDOffset = dataView.getUint32(
10528
+ tiffOffset + 4,
10529
+ littleEndian
10530
+ );
10531
+ if (firstIFDOffset >= 8) {
10532
+ ifdStart = tiffOffset + firstIFDOffset;
10533
+ }
10534
+ }
10535
+ }
10536
+ }
10537
+ }
10538
+ if (ifdStart) {
10539
+ const _length = dataView.getUint16(ifdStart, littleEndian);
10540
+ let _offset;
10541
+ let i;
10542
+ for (i = 0; i < _length; i += 1) {
10543
+ _offset = ifdStart + i * 12 + 2;
10544
+ if (dataView.getUint16(_offset, littleEndian) === 274) {
10545
+ _offset += 8;
10546
+ orientation = dataView.getUint16(_offset, littleEndian);
10547
+ dataView.setUint16(_offset, 1, littleEndian);
10548
+ break;
10549
+ }
10550
+ }
10551
+ }
10552
+ } catch (e) {
10553
+ orientation = 1;
10554
+ }
10555
+ return orientation;
10556
+ }
10426
10557
  function resize(img, {
10558
+ inputType = "image/jpeg",
10559
+ orientation = 1,
10427
10560
  imageWidth = -1,
10428
10561
  imageHeight = -1,
10429
10562
  sideLengthLimit = 640,
@@ -10441,14 +10574,18 @@ function resize(img, {
10441
10574
  } else {
10442
10575
  return Promise.reject(new Error("image width/height \u65E0\u6548"));
10443
10576
  }
10444
- const targetWidth = imageWidth * scale;
10445
- const targetHeight = imageHeight * scale;
10577
+ const targetWidth = scale > 1 ? imageWidth : imageWidth * scale;
10578
+ const targetHeight = scale > 1 ? imageHeight : imageHeight * scale;
10446
10579
  if (resultType === "image") {
10447
- return image2Canvas(img, targetWidth, targetHeight).then(
10448
- (canvas) => canvas2Image(canvas)
10449
- );
10580
+ return image2Canvas(
10581
+ img,
10582
+ inputType,
10583
+ orientation,
10584
+ targetWidth,
10585
+ targetHeight
10586
+ ).then((canvas) => canvas2Image(canvas));
10450
10587
  }
10451
- return image2Canvas(img, targetWidth, targetHeight);
10588
+ return image2Canvas(img, inputType, orientation, targetWidth, targetHeight);
10452
10589
  }
10453
10590
  class ResizeOptions {
10454
10591
  constructor(maxSideLength) {
@@ -10488,86 +10625,6 @@ const parseDecimal = (obj, defaultValue) => {
10488
10625
  }
10489
10626
  return result;
10490
10627
  };
10491
- const FORMAT = {
10492
- FORMAT_HM: "HH:mm",
10493
- FORMAT_MDHM: "MM-dd HH:mm",
10494
- FORMAT_MD_CN: "MM\u6708dd\u65E5",
10495
- FORMAT_MD: "MM-dd",
10496
- FORMAT_YMD: "yyyy-MM-dd",
10497
- FORMAT_YMD_SLASH: "yyyy/MM/dd",
10498
- FORMAT_YM: "yyyy-MM",
10499
- FORMAT_YMDHM: "yyyy-MM-dd HH:mm",
10500
- FORMAT_YMDHMS: "yyyy-MM-dd HH:mm:ss",
10501
- FORMAT_YMDHMSMS: "yyyy-MM-dd HH:mm:ss msms",
10502
- FORMAT_YM_CN: "yyyy\u5E74MM\u6708",
10503
- FORMAT_YMD_CN: "yyyy\u5E74MM\u6708dd\u65E5",
10504
- FORMAT_YMDH_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6",
10505
- FORMAT_MDH_CN: "MM\u6708dd\u65E5 HH\u65F6",
10506
- FORMAT_YMDHM_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206",
10507
- FORMAT_YMDHMS_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206ss\u79D2"
10508
- };
10509
- const __formatNumber__ = function(number) {
10510
- if (number < 10) {
10511
- return "0" + number;
10512
- }
10513
- return number + "";
10514
- };
10515
- function createDate(dateObj) {
10516
- if (!isDef(dateObj)) {
10517
- return null;
10518
- }
10519
- if (typeof dateObj === "number") {
10520
- return new Date(dateObj);
10521
- }
10522
- if (typeof dateObj === "string") {
10523
- dateObj = dateObj.replace(/-/g, "/");
10524
- if (dateObj.length === 7) {
10525
- dateObj += "/01";
10526
- }
10527
- return new Date(dateObj);
10528
- }
10529
- if (isDate(dateObj)) {
10530
- return dateObj;
10531
- }
10532
- return null;
10533
- }
10534
- function formatDate(dateObj, formatType = FORMAT.FORMAT_YMDHMS) {
10535
- 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;
10570
- }
10571
10628
  const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
10572
10629
  const subString = (str, startIndex, length) => {
10573
10630
  if (!isDef(length)) {
@@ -10792,22 +10849,22 @@ function buildContent(contentConfigString, watermarkContext) {
10792
10849
  const regexResult = scanner.next(dateRegex);
10793
10850
  if (regexResult) {
10794
10851
  const matchResults = regexResult;
10795
- let format = FORMAT.FORMAT_YMD;
10852
+ let format = dateUtils.DATE_FORMAT.FORMAT_YMD;
10796
10853
  if (matchResults && matchResults.length >= 2) {
10797
10854
  if (isValidString(matchResults[1])) {
10798
10855
  format = matchResults[1];
10799
10856
  }
10800
10857
  }
10801
10858
  if (watermarkContext) {
10802
- content += formatDate(watermarkContext.watermarkTime, format);
10859
+ content += dateUtils.formatDate(watermarkContext.watermarkTime, format);
10803
10860
  }
10804
10861
  scanner.skip(matchResults.input);
10805
10862
  }
10806
10863
  } else if (scanner.hasNext("time")) {
10807
10864
  if (watermarkContext) {
10808
- const value = formatDate(
10865
+ const value = dateUtils.formatDate(
10809
10866
  watermarkContext.watermarkTime,
10810
- FORMAT.FORMAT_HM
10867
+ dateUtils.DATE_FORMAT.FORMAT_HM
10811
10868
  );
10812
10869
  content += value;
10813
10870
  }
@@ -11161,7 +11218,6 @@ function checkWatermarkConfigSupported(watermarkConfigString) {
11161
11218
  }
11162
11219
  return true;
11163
11220
  }
11164
- const DEFAULT_IMAGE_TYPE = "image/jpeg";
11165
11221
  const DEFAULT_JPEG_QUALITY = 0.8;
11166
11222
  const MIN_JPEG_QUALITY = 0.1;
11167
11223
  const JPEG_QUALITY_STEP = 0.05;
@@ -11174,9 +11230,29 @@ class ImageProcessor {
11174
11230
  }
11175
11231
  process() {
11176
11232
  const filename = this.file.name;
11233
+ let fileType = this.file.type;
11177
11234
  const { lastModified } = this.file;
11235
+ let orientation = 1;
11236
+ if (this.file.size > this.compressOptions.photoFileSizeLimit * 1024) {
11237
+ fileType = "image/jpeg";
11238
+ }
11239
+ if (isIOS$1() && fileType === "image/jpeg") {
11240
+ const reader = new FileReader();
11241
+ reader.readAsArrayBuffer(this.file);
11242
+ reader.onload = function(_ref) {
11243
+ const { target } = _ref;
11244
+ if (target == null ? void 0 : target.result) {
11245
+ orientation = getOrientation(target == null ? void 0 : target.result);
11246
+ }
11247
+ };
11248
+ }
11249
+ if (fileType === "image/gif") {
11250
+ fileType = "image/png";
11251
+ }
11178
11252
  return file2Image(this.file).then(
11179
11253
  (img) => resize(img, {
11254
+ inputType: fileType,
11255
+ orientation,
11180
11256
  sideLengthLimit: this.resizeOptions.maxSideLength,
11181
11257
  resultType: "canvas"
11182
11258
  })
@@ -11189,7 +11265,7 @@ class ImageProcessor {
11189
11265
  canvas,
11190
11266
  exportFilename,
11191
11267
  lastModified,
11192
- DEFAULT_IMAGE_TYPE,
11268
+ fileType,
11193
11269
  DEFAULT_JPEG_QUALITY
11194
11270
  );
11195
11271
  });
@@ -11721,7 +11797,7 @@ var stdin_default$t = vue.defineComponent({
11721
11797
  if (media.showSrc) {
11722
11798
  return vue.createVNode(stdin_default$1q, {
11723
11799
  "src": media.showSrc,
11724
- "fit": "fill",
11800
+ "fit": "cover",
11725
11801
  "radius": "4"
11726
11802
  }, null);
11727
11803
  } else if (media.type === "video") {
@@ -12016,8 +12092,7 @@ var stdin_default$r = vue.defineComponent({
12016
12092
  "size": "normal",
12017
12093
  "block": true,
12018
12094
  "style": {
12019
- marginRigth: "4px",
12020
- backgroundColor: "white"
12095
+ marginRigth: "4px"
12021
12096
  },
12022
12097
  "onClick": onCancel
12023
12098
  }, {
@@ -14181,7 +14256,6 @@ var stdin_default$b = vue.defineComponent({
14181
14256
  const Step = withInstall(stdin_default$b);
14182
14257
  const [name$5, bem$5] = createNamespace("stepper");
14183
14258
  const LONG_PRESS_INTERVAL = 200;
14184
- const LONG_PRESS_START_TIME = 600;
14185
14259
  const isEqual = (value1, value2) => String(value1) === String(value2);
14186
14260
  const stepperProps = {
14187
14261
  min: makeNumericProp(1),
@@ -15991,15 +16065,14 @@ var stdin_default$1 = (lazyManager) => ({
15991
16065
  default: "img"
15992
16066
  }
15993
16067
  },
15994
- render(h) {
15995
- return h(
16068
+ render() {
16069
+ var _a, _b;
16070
+ return vue.h(
15996
16071
  this.tag,
15997
16072
  {
15998
- attrs: {
15999
- src: this.renderSrc
16000
- }
16073
+ src: this.renderSrc
16001
16074
  },
16002
- this.$slots.default
16075
+ (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
16003
16076
  );
16004
16077
  },
16005
16078
  data() {
@@ -16101,7 +16174,7 @@ const Lazyload = {
16101
16174
  });
16102
16175
  }
16103
16176
  };
16104
- const version = "3.0.3";
16177
+ const version = "3.0.5";
16105
16178
  function install(app) {
16106
16179
  const components = [
16107
16180
  ActionSheet,