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.es.js CHANGED
@@ -367,6 +367,7 @@ const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
367
367
  const HAPTICS_FEEDBACK = "zt-haptics-feedback";
368
368
  const ELLIPSIS = "zt-ellipsis";
369
369
  const FORM_KEY = Symbol("zt-form");
370
+ const LONG_PRESS_START_TIME = 500;
370
371
  function callInterceptor(interceptor, {
371
372
  args = [],
372
373
  done,
@@ -814,6 +815,8 @@ const popupProps$2 = extend({}, popupSharedProps, {
814
815
  safeAreaInsetTop: Boolean,
815
816
  safeAreaInsetBottom: Boolean,
816
817
  sliderContentHeight: makeNumberProp(60),
818
+ minDragHeight: makeStringProp("40px"),
819
+ maxDragHeight: makeStringProp("85vh"),
817
820
  slideable: Boolean
818
821
  });
819
822
  const [name$16, bem$13] = createNamespace("popup");
@@ -831,15 +834,13 @@ var stdin_default$1x = defineComponent({
831
834
  let opened;
832
835
  let shouldReopen;
833
836
  const root = ref();
834
- const positionY = ref(0);
835
837
  let timerId = setInterval(() => {
836
838
  }, 0);
837
- const touchHeight = ref(0);
838
839
  const contentStyle = ref(`height:${props.sliderContentHeight}px;`);
839
- const touchAreaHeight = ref(40);
840
840
  const zIndex = ref();
841
- const touchPoint = ref(0);
842
841
  const popupRef = ref();
842
+ let touchPoint = 0;
843
+ const touchAreaHeight = unitToPx(props.minDragHeight);
843
844
  const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
844
845
  const style = computed(() => {
845
846
  const style2 = {
@@ -886,13 +887,14 @@ var stdin_default$1x = defineComponent({
886
887
  event.preventDefault();
887
888
  }
888
889
  const h2 = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
889
- positionY.value = event.touches[0].clientY;
890
+ const positionY = event.touches[0].clientY || 0;
891
+ let touchHeight = 0;
890
892
  timerId = setTimeout(() => {
891
- if (positionY.value === 0 || positionY.value < h2 * 0.15) {
893
+ if (positionY === 0 || positionY < h2 - unitToPx(props.maxDragHeight)) {
892
894
  return;
893
895
  }
894
- touchHeight.value = positionY.value - touchAreaHeight.value > h2 - touchAreaHeight.value ? h2 - touchAreaHeight.value + touchPoint.value : positionY.value;
895
- contentStyle.value = `height:${h2 - touchHeight.value - touchAreaHeight.value + touchPoint.value}px;`;
896
+ touchHeight = positionY - touchAreaHeight > h2 - touchAreaHeight ? h2 - touchAreaHeight + touchPoint : positionY;
897
+ contentStyle.value = `height:${h2 - touchHeight - touchAreaHeight + touchPoint}px;`;
896
898
  }, 10);
897
899
  };
898
900
  const startMove = (event) => {
@@ -900,7 +902,7 @@ var stdin_default$1x = defineComponent({
900
902
  if (timerId) {
901
903
  clearInterval(timerId);
902
904
  }
903
- touchPoint.value = event.touches[0].clientY - (((_b = (_a = popupRef.value) == null ? void 0 : _a.getBoundingClientRect()) == null ? void 0 : _b.top) || 0);
905
+ touchPoint = event.touches[0].clientY - (((_b = (_a = popupRef.value) == null ? void 0 : _a.getBoundingClientRect()) == null ? void 0 : _b.top) || 0);
904
906
  };
905
907
  const endMove = () => {
906
908
  clearInterval(timerId);
@@ -977,6 +979,7 @@ var stdin_default$1x = defineComponent({
977
979
  "onKeydown": onKeydown
978
980
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon(), createVNode("div", {
979
981
  "class": bem$13("slider-title"),
982
+ "style": `height:${touchAreaHeight}px;`,
980
983
  "ref": root
981
984
  }, [createVNode("div", {
982
985
  "class": bem$13("slider-bar")
@@ -1472,7 +1475,8 @@ const avatarProps = {
1472
1475
  size: makeStringProp("medium"),
1473
1476
  shape: makeStringProp("square"),
1474
1477
  text: String,
1475
- textBgColor: String
1478
+ textBgColor: String,
1479
+ border: Boolean
1476
1480
  };
1477
1481
  var stdin_default$1p = defineComponent({
1478
1482
  name: name$12,
@@ -1485,7 +1489,7 @@ var stdin_default$1p = defineComponent({
1485
1489
  if (len === 1) {
1486
1490
  return props.text;
1487
1491
  } else if (len > 1) {
1488
- return props.text.substring(len - 2, 2);
1492
+ return props.text.substring(len - 2, len);
1489
1493
  }
1490
1494
  }
1491
1495
  return "";
@@ -1506,7 +1510,9 @@ var stdin_default$1p = defineComponent({
1506
1510
  }
1507
1511
  });
1508
1512
  const renderText = () => createVNode("div", {
1509
- "class": bem$$("img", classArr.value),
1513
+ "class": bem$$("img", [classArr.value, {
1514
+ border: props.border
1515
+ }]),
1510
1516
  "style": style.value
1511
1517
  }, [headText.value]);
1512
1518
  return () => {
@@ -1515,7 +1521,9 @@ var stdin_default$1p = defineComponent({
1515
1521
  }
1516
1522
  return createVNode(stdin_default$1q, {
1517
1523
  "round": props.shape === "round",
1518
- "class": bem$$("img", classArr.value),
1524
+ "class": bem$$("img", [classArr.value, {
1525
+ border: props.border
1526
+ }]),
1519
1527
  "style": style.value,
1520
1528
  "src": props.src
1521
1529
  }, {
@@ -2734,7 +2742,7 @@ var stdin_default$1i = defineComponent({
2734
2742
  "onClick": onCancel,
2735
2743
  "style": {
2736
2744
  marginRight: "4px",
2737
- backgroundColor: "white"
2745
+ backgroundColor: "transparent"
2738
2746
  }
2739
2747
  }, {
2740
2748
  default: () => [text || "\u53D6\u6D88"]
@@ -2755,7 +2763,7 @@ var stdin_default$1i = defineComponent({
2755
2763
  };
2756
2764
  const renderFooter = () => createVNode("div", {
2757
2765
  "class": [bem$Z("footer"), {
2758
- "van-safe-area-bottom": props.safeAreaInsetBottom
2766
+ "zt-safe-area-bottom": props.safeAreaInsetBottom
2759
2767
  }]
2760
2768
  }, [renderFooterButton()]);
2761
2769
  const renderCalendar = () => createVNode("div", {
@@ -3108,8 +3116,7 @@ var stdin_default$1f = defineComponent({
3108
3116
  const touch = useTouch();
3109
3117
  const {
3110
3118
  children,
3111
- linkChildren,
3112
- unlinkChildren
3119
+ linkChildren
3113
3120
  } = useChildren(SWIPE_KEY);
3114
3121
  const count = computed(() => children.length);
3115
3122
  const size = computed(() => state[props.vertical ? "height" : "width"]);
@@ -3409,7 +3416,6 @@ var stdin_default$1f = defineComponent({
3409
3416
  onMounted(initialize);
3410
3417
  onActivated(() => initialize(state.active));
3411
3418
  onPopupReopen(() => {
3412
- unlinkChildren();
3413
3419
  initialize(state.active);
3414
3420
  });
3415
3421
  onDeactivated(stopAutoplay);
@@ -5255,8 +5261,9 @@ var stdin_default$$ = defineComponent({
5255
5261
  }
5256
5262
  currentOffset.value = offset;
5257
5263
  };
5264
+ const isReadonly = () => props.readonly || !props.options.length;
5258
5265
  const onClickOption = (index) => {
5259
- if (moving || props.readonly) {
5266
+ if (moving || isReadonly()) {
5260
5267
  return;
5261
5268
  }
5262
5269
  transitionEndTrigger = null;
@@ -5281,7 +5288,7 @@ var stdin_default$$ = defineComponent({
5281
5288
  }
5282
5289
  };
5283
5290
  const onTouchStart = (event) => {
5284
- if (props.readonly) {
5291
+ if (isReadonly()) {
5285
5292
  return;
5286
5293
  }
5287
5294
  touch.start(event);
@@ -5296,7 +5303,7 @@ var stdin_default$$ = defineComponent({
5296
5303
  transitionEndTrigger = null;
5297
5304
  };
5298
5305
  const onTouchMove = (event) => {
5299
- if (props.readonly) {
5306
+ if (isReadonly()) {
5300
5307
  return;
5301
5308
  }
5302
5309
  touch.move(event);
@@ -5312,7 +5319,7 @@ var stdin_default$$ = defineComponent({
5312
5319
  }
5313
5320
  };
5314
5321
  const onTouchEnd = () => {
5315
- if (props.readonly) {
5322
+ if (isReadonly()) {
5316
5323
  return;
5317
5324
  }
5318
5325
  const distance = currentOffset.value - momentumOffset;
@@ -9200,9 +9207,10 @@ var stdin_default$H = defineComponent({
9200
9207
  rootWidth: makeRequiredProp(Number),
9201
9208
  rootHeight: makeRequiredProp(Number)
9202
9209
  },
9203
- emits: ["scale", "close"],
9210
+ emits: ["scale", "close", "longPress"],
9204
9211
  setup(props, {
9205
- emit
9212
+ emit,
9213
+ slots
9206
9214
  }) {
9207
9215
  const state = reactive({
9208
9216
  scale: 1,
@@ -9346,16 +9354,20 @@ var stdin_default$H = defineComponent({
9346
9354
  const deltaTime = Date.now() - touchStartTime;
9347
9355
  const TAP_TIME = 250;
9348
9356
  const TAP_OFFSET = 5;
9349
- if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET && deltaTime < TAP_TIME) {
9350
- if (doubleTapTimer) {
9351
- clearTimeout(doubleTapTimer);
9352
- doubleTapTimer = null;
9353
- toggleScale();
9354
- } else {
9355
- doubleTapTimer = setTimeout(() => {
9356
- emit("close");
9357
+ if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
9358
+ if (deltaTime < TAP_TIME) {
9359
+ if (doubleTapTimer) {
9360
+ clearTimeout(doubleTapTimer);
9357
9361
  doubleTapTimer = null;
9358
- }, TAP_TIME);
9362
+ toggleScale();
9363
+ } else {
9364
+ doubleTapTimer = setTimeout(() => {
9365
+ emit("close");
9366
+ doubleTapTimer = null;
9367
+ }, TAP_TIME);
9368
+ }
9369
+ } else if (deltaTime > LONG_PRESS_START_TIME) {
9370
+ emit("longPress");
9359
9371
  }
9360
9372
  }
9361
9373
  };
@@ -9421,7 +9433,11 @@ var stdin_default$H = defineComponent({
9421
9433
  "onTouchend": onTouchEnd,
9422
9434
  "onTouchcancel": onTouchEnd
9423
9435
  }, {
9424
- default: () => [createVNode(Image$1, {
9436
+ default: () => [slots.image ? createVNode("div", {
9437
+ "class": bem$s("image-wrap")
9438
+ }, [slots.image({
9439
+ src: props.src
9440
+ })]) : createVNode(Image$1, {
9425
9441
  "src": props.src,
9426
9442
  "fit": "contain",
9427
9443
  "class": bem$s("image", {
@@ -9460,7 +9476,7 @@ const imagePreviewProps = {
9460
9476
  var stdin_default$G = defineComponent({
9461
9477
  name: name$r,
9462
9478
  props: imagePreviewProps,
9463
- emits: ["scale", "close", "closed", "change", "update:show"],
9479
+ emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
9464
9480
  setup(props, {
9465
9481
  emit,
9466
9482
  slots
@@ -9536,7 +9552,7 @@ var stdin_default$G = defineComponent({
9536
9552
  "indicatorColor": "white",
9537
9553
  "onChange": setActive
9538
9554
  }, {
9539
- default: () => [props.images.map((image) => createVNode(stdin_default$H, {
9555
+ default: () => [props.images.map((image, index) => createVNode(stdin_default$H, {
9540
9556
  "src": image.url,
9541
9557
  "show": props.show,
9542
9558
  "active": state.active,
@@ -9545,8 +9561,13 @@ var stdin_default$G = defineComponent({
9545
9561
  "rootWidth": state.rootWidth,
9546
9562
  "rootHeight": state.rootHeight,
9547
9563
  "onScale": emitScale,
9548
- "onClose": emitClose
9549
- }, null))]
9564
+ "onClose": emitClose,
9565
+ "onLongPress": () => emit("longPress", {
9566
+ index
9567
+ })
9568
+ }, {
9569
+ image: slots.image
9570
+ }))]
9550
9571
  });
9551
9572
  const renderClose = () => {
9552
9573
  if (props.closeable) {
@@ -10357,6 +10378,47 @@ function getUniqueFileName(file, suffix = "") {
10357
10378
  )}`;
10358
10379
  return suffix ? name2 + "." + suffix : name2;
10359
10380
  }
10381
+ function adjustImgOrientation(ctx, img, orientation, width, height) {
10382
+ switch (orientation) {
10383
+ case 3:
10384
+ ctx.rotate(180 * Math.PI / 180);
10385
+ ctx.drawImage(img, -width, -height, width, height);
10386
+ break;
10387
+ case 6:
10388
+ ctx.rotate(90 * Math.PI / 180);
10389
+ ctx.drawImage(img, 0, -width, height, width);
10390
+ break;
10391
+ case 8:
10392
+ ctx.rotate(270 * Math.PI / 180);
10393
+ ctx.drawImage(img, -height, 0, height, width);
10394
+ break;
10395
+ case 2:
10396
+ ctx.translate(width, 0);
10397
+ ctx.scale(-1, 1);
10398
+ ctx.drawImage(img, 0, 0, width, height);
10399
+ break;
10400
+ case 4:
10401
+ ctx.translate(width, 0);
10402
+ ctx.scale(-1, 1);
10403
+ ctx.rotate(180 * Math.PI / 180);
10404
+ ctx.drawImage(img, -width, -height, width, height);
10405
+ break;
10406
+ case 5:
10407
+ ctx.translate(width, 0);
10408
+ ctx.scale(-1, 1);
10409
+ ctx.rotate(90 * Math.PI / 180);
10410
+ ctx.drawImage(img, 0, -width, height, width);
10411
+ break;
10412
+ case 7:
10413
+ ctx.translate(width, 0);
10414
+ ctx.scale(-1, 1);
10415
+ ctx.rotate(270 * Math.PI / 180);
10416
+ ctx.drawImage(img, -height, 0, height, width);
10417
+ break;
10418
+ default:
10419
+ ctx.drawImage(img, 0, 0, width, height);
10420
+ }
10421
+ }
10360
10422
  function file2DataURL(file) {
10361
10423
  return new Promise((resolve, reject) => {
10362
10424
  const a = new FileReader();
@@ -10385,7 +10447,7 @@ function file2Image(file) {
10385
10447
  }).catch(reject);
10386
10448
  });
10387
10449
  }
10388
- function image2Canvas(img, width, height) {
10450
+ function image2Canvas(img, type, orientation, width, height) {
10389
10451
  const canvas = document.createElement("canvas");
10390
10452
  const _width = width || img.width;
10391
10453
  const _height = height || img.height;
@@ -10393,9 +10455,12 @@ function image2Canvas(img, width, height) {
10393
10455
  canvas.height = _height;
10394
10456
  const ctx = canvas.getContext("2d");
10395
10457
  if (ctx) {
10396
- ctx.fillStyle = "#fff";
10458
+ ctx.fillStyle = "transparent";
10459
+ if (type === "image/jpeg") {
10460
+ ctx.fillStyle = "#fff";
10461
+ }
10397
10462
  ctx.fillRect(0, 0, _width, _height);
10398
- ctx.drawImage(img, 0, 0, _width, _height);
10463
+ adjustImgOrientation(ctx, img, orientation, _width, _height);
10399
10464
  return Promise.resolve(canvas);
10400
10465
  }
10401
10466
  return Promise.reject(new Error("canvas getContext return null"));
@@ -10421,7 +10486,74 @@ function canvas2Image(canvas, type = "image/jpeg", quality = 0.8) {
10421
10486
  image.src = canvas.toDataURL(type, quality);
10422
10487
  return Promise.resolve(image);
10423
10488
  }
10489
+ function getStringFromCharCode(dataView, start, length) {
10490
+ let str = "";
10491
+ let i;
10492
+ length += start;
10493
+ for (i = start; i < length; i += 1) {
10494
+ str += String.fromCharCode(dataView.getUint8(i));
10495
+ }
10496
+ return str;
10497
+ }
10498
+ function getOrientation(arrayBuffer) {
10499
+ const dataView = new DataView(arrayBuffer);
10500
+ let orientation;
10501
+ try {
10502
+ let littleEndian;
10503
+ let app1Start;
10504
+ let ifdStart;
10505
+ if (dataView.getUint8(0) === 255 && dataView.getUint8(1) === 216) {
10506
+ const length = dataView.byteLength;
10507
+ let offset = 2;
10508
+ while (offset + 1 < length) {
10509
+ if (dataView.getUint8(offset) === 255 && dataView.getUint8(offset + 1) === 225) {
10510
+ app1Start = offset;
10511
+ break;
10512
+ }
10513
+ offset += 1;
10514
+ }
10515
+ }
10516
+ if (app1Start) {
10517
+ const exifIDCode = app1Start + 4;
10518
+ const tiffOffset = app1Start + 10;
10519
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === "Exif") {
10520
+ const endianness = dataView.getUint16(tiffOffset);
10521
+ littleEndian = endianness === 18761;
10522
+ if (littleEndian || endianness === 19789) {
10523
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 42) {
10524
+ const firstIFDOffset = dataView.getUint32(
10525
+ tiffOffset + 4,
10526
+ littleEndian
10527
+ );
10528
+ if (firstIFDOffset >= 8) {
10529
+ ifdStart = tiffOffset + firstIFDOffset;
10530
+ }
10531
+ }
10532
+ }
10533
+ }
10534
+ }
10535
+ if (ifdStart) {
10536
+ const _length = dataView.getUint16(ifdStart, littleEndian);
10537
+ let _offset;
10538
+ let i;
10539
+ for (i = 0; i < _length; i += 1) {
10540
+ _offset = ifdStart + i * 12 + 2;
10541
+ if (dataView.getUint16(_offset, littleEndian) === 274) {
10542
+ _offset += 8;
10543
+ orientation = dataView.getUint16(_offset, littleEndian);
10544
+ dataView.setUint16(_offset, 1, littleEndian);
10545
+ break;
10546
+ }
10547
+ }
10548
+ }
10549
+ } catch (e) {
10550
+ orientation = 1;
10551
+ }
10552
+ return orientation;
10553
+ }
10424
10554
  function resize(img, {
10555
+ inputType = "image/jpeg",
10556
+ orientation = 1,
10425
10557
  imageWidth = -1,
10426
10558
  imageHeight = -1,
10427
10559
  sideLengthLimit = 640,
@@ -10439,14 +10571,18 @@ function resize(img, {
10439
10571
  } else {
10440
10572
  return Promise.reject(new Error("image width/height \u65E0\u6548"));
10441
10573
  }
10442
- const targetWidth = imageWidth * scale;
10443
- const targetHeight = imageHeight * scale;
10574
+ const targetWidth = scale > 1 ? imageWidth : imageWidth * scale;
10575
+ const targetHeight = scale > 1 ? imageHeight : imageHeight * scale;
10444
10576
  if (resultType === "image") {
10445
- return image2Canvas(img, targetWidth, targetHeight).then(
10446
- (canvas) => canvas2Image(canvas)
10447
- );
10448
- }
10449
- return image2Canvas(img, targetWidth, targetHeight);
10577
+ return image2Canvas(
10578
+ img,
10579
+ inputType,
10580
+ orientation,
10581
+ targetWidth,
10582
+ targetHeight
10583
+ ).then((canvas) => canvas2Image(canvas));
10584
+ }
10585
+ return image2Canvas(img, inputType, orientation, targetWidth, targetHeight);
10450
10586
  }
10451
10587
  class ResizeOptions {
10452
10588
  constructor(maxSideLength) {
@@ -10486,7 +10622,13 @@ const parseDecimal = (obj, defaultValue) => {
10486
10622
  }
10487
10623
  return result;
10488
10624
  };
10489
- const FORMAT = {
10625
+ var __formatNumber__ = function(number) {
10626
+ if (number < 10) {
10627
+ return "0" + number;
10628
+ }
10629
+ return number + "";
10630
+ };
10631
+ var DATE_FORMAT = {
10490
10632
  FORMAT_HM: "HH:mm",
10491
10633
  FORMAT_MDHM: "MM-dd HH:mm",
10492
10634
  FORMAT_MD_CN: "MM\u6708dd\u65E5",
@@ -10504,16 +10646,7 @@ const FORMAT = {
10504
10646
  FORMAT_YMDHM_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206",
10505
10647
  FORMAT_YMDHMS_CN: "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206ss\u79D2"
10506
10648
  };
10507
- const __formatNumber__ = function(number) {
10508
- if (number < 10) {
10509
- return "0" + number;
10510
- }
10511
- return number + "";
10512
- };
10513
10649
  function createDate(dateObj) {
10514
- if (!isDef(dateObj)) {
10515
- return null;
10516
- }
10517
10650
  if (typeof dateObj === "number") {
10518
10651
  return new Date(dateObj);
10519
10652
  }
@@ -10524,47 +10657,37 @@ function createDate(dateObj) {
10524
10657
  }
10525
10658
  return new Date(dateObj);
10526
10659
  }
10527
- if (isDate(dateObj)) {
10528
- return dateObj;
10529
- }
10530
- return null;
10660
+ return dateObj;
10531
10661
  }
10532
- function formatDate(dateObj, formatType = FORMAT.FORMAT_YMDHMS) {
10662
+ function formatDate(dateObj, formatType = DATE_FORMAT.FORMAT_YMDHMS) {
10533
10663
  const date = createDate(dateObj);
10534
- if (date) {
10535
- date.getFullYear();
10536
- let formatResult = formatType.replace(
10537
- "yyyy",
10538
- __formatNumber__(date.getFullYear())
10539
- );
10540
- formatResult = formatResult.replace(
10541
- "yy",
10542
- String(date.getFullYear()).substring(2)
10543
- );
10544
- formatResult = formatResult.replace(
10545
- "MM",
10546
- __formatNumber__(date.getMonth() + 1)
10547
- );
10548
- formatResult = formatResult.replace("dd", __formatNumber__(date.getDate()));
10549
- formatResult = formatResult.replace(
10550
- "HH",
10551
- __formatNumber__(date.getHours())
10552
- );
10553
- formatResult = formatResult.replace(
10554
- "mm",
10555
- __formatNumber__(date.getMinutes())
10556
- );
10557
- formatResult = formatResult.replace(
10558
- "ss",
10559
- __formatNumber__(date.getSeconds())
10560
- );
10561
- formatResult = formatResult.replace(
10562
- "msms",
10563
- __formatNumber__(date.getMilliseconds())
10564
- );
10565
- return formatResult;
10566
- }
10567
- return null;
10664
+ let formatResult = formatType.replace(
10665
+ "yyyy",
10666
+ __formatNumber__(date.getFullYear())
10667
+ );
10668
+ formatResult = formatResult.replace(
10669
+ "yy",
10670
+ String(date.getFullYear()).substring(2)
10671
+ );
10672
+ formatResult = formatResult.replace(
10673
+ "MM",
10674
+ __formatNumber__(date.getMonth() + 1)
10675
+ );
10676
+ formatResult = formatResult.replace("dd", __formatNumber__(date.getDate()));
10677
+ formatResult = formatResult.replace("HH", __formatNumber__(date.getHours()));
10678
+ formatResult = formatResult.replace(
10679
+ "mm",
10680
+ __formatNumber__(date.getMinutes())
10681
+ );
10682
+ formatResult = formatResult.replace(
10683
+ "ss",
10684
+ __formatNumber__(date.getSeconds())
10685
+ );
10686
+ formatResult = formatResult.replace(
10687
+ "msms",
10688
+ __formatNumber__(date.getMilliseconds())
10689
+ );
10690
+ return formatResult;
10568
10691
  }
10569
10692
  const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
10570
10693
  const subString = (str, startIndex, length) => {
@@ -10790,7 +10913,7 @@ function buildContent(contentConfigString, watermarkContext) {
10790
10913
  const regexResult = scanner.next(dateRegex);
10791
10914
  if (regexResult) {
10792
10915
  const matchResults = regexResult;
10793
- let format = FORMAT.FORMAT_YMD;
10916
+ let format = DATE_FORMAT.FORMAT_YMD;
10794
10917
  if (matchResults && matchResults.length >= 2) {
10795
10918
  if (isValidString(matchResults[1])) {
10796
10919
  format = matchResults[1];
@@ -10805,7 +10928,7 @@ function buildContent(contentConfigString, watermarkContext) {
10805
10928
  if (watermarkContext) {
10806
10929
  const value = formatDate(
10807
10930
  watermarkContext.watermarkTime,
10808
- FORMAT.FORMAT_HM
10931
+ DATE_FORMAT.FORMAT_HM
10809
10932
  );
10810
10933
  content += value;
10811
10934
  }
@@ -11159,7 +11282,6 @@ function checkWatermarkConfigSupported(watermarkConfigString) {
11159
11282
  }
11160
11283
  return true;
11161
11284
  }
11162
- const DEFAULT_IMAGE_TYPE = "image/jpeg";
11163
11285
  const DEFAULT_JPEG_QUALITY = 0.8;
11164
11286
  const MIN_JPEG_QUALITY = 0.1;
11165
11287
  const JPEG_QUALITY_STEP = 0.05;
@@ -11172,9 +11294,29 @@ class ImageProcessor {
11172
11294
  }
11173
11295
  process() {
11174
11296
  const filename = this.file.name;
11297
+ let fileType = this.file.type;
11175
11298
  const { lastModified } = this.file;
11299
+ let orientation = 1;
11300
+ if (this.file.size > this.compressOptions.photoFileSizeLimit * 1024) {
11301
+ fileType = "image/jpeg";
11302
+ }
11303
+ if (isIOS$1() && fileType === "image/jpeg") {
11304
+ const reader = new FileReader();
11305
+ reader.readAsArrayBuffer(this.file);
11306
+ reader.onload = function(_ref) {
11307
+ const { target } = _ref;
11308
+ if (target == null ? void 0 : target.result) {
11309
+ orientation = getOrientation(target == null ? void 0 : target.result);
11310
+ }
11311
+ };
11312
+ }
11313
+ if (fileType === "image/gif") {
11314
+ fileType = "image/png";
11315
+ }
11176
11316
  return file2Image(this.file).then(
11177
11317
  (img) => resize(img, {
11318
+ inputType: fileType,
11319
+ orientation,
11178
11320
  sideLengthLimit: this.resizeOptions.maxSideLength,
11179
11321
  resultType: "canvas"
11180
11322
  })
@@ -11187,7 +11329,7 @@ class ImageProcessor {
11187
11329
  canvas,
11188
11330
  exportFilename,
11189
11331
  lastModified,
11190
- DEFAULT_IMAGE_TYPE,
11332
+ fileType,
11191
11333
  DEFAULT_JPEG_QUALITY
11192
11334
  );
11193
11335
  });
@@ -11719,7 +11861,7 @@ var stdin_default$t = defineComponent({
11719
11861
  if (media.showSrc) {
11720
11862
  return createVNode(stdin_default$1q, {
11721
11863
  "src": media.showSrc,
11722
- "fit": "fill",
11864
+ "fit": "cover",
11723
11865
  "radius": "4"
11724
11866
  }, null);
11725
11867
  } else if (media.type === "video") {
@@ -12014,8 +12156,7 @@ var stdin_default$r = defineComponent({
12014
12156
  "size": "normal",
12015
12157
  "block": true,
12016
12158
  "style": {
12017
- marginRigth: "4px",
12018
- backgroundColor: "white"
12159
+ marginRigth: "4px"
12019
12160
  },
12020
12161
  "onClick": onCancel
12021
12162
  }, {
@@ -14179,7 +14320,6 @@ var stdin_default$b = defineComponent({
14179
14320
  const Step = withInstall(stdin_default$b);
14180
14321
  const [name$5, bem$5] = createNamespace("stepper");
14181
14322
  const LONG_PRESS_INTERVAL = 200;
14182
- const LONG_PRESS_START_TIME = 600;
14183
14323
  const isEqual = (value1, value2) => String(value1) === String(value2);
14184
14324
  const stepperProps = {
14185
14325
  min: makeNumericProp(1),
@@ -15989,15 +16129,14 @@ var stdin_default$1 = (lazyManager) => ({
15989
16129
  default: "img"
15990
16130
  }
15991
16131
  },
15992
- render(h2) {
15993
- return h2(
16132
+ render() {
16133
+ var _a, _b;
16134
+ return h(
15994
16135
  this.tag,
15995
16136
  {
15996
- attrs: {
15997
- src: this.renderSrc
15998
- }
16137
+ src: this.renderSrc
15999
16138
  },
16000
- this.$slots.default
16139
+ (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
16001
16140
  );
16002
16141
  },
16003
16142
  data() {
@@ -16099,7 +16238,7 @@ const Lazyload = {
16099
16238
  });
16100
16239
  }
16101
16240
  };
16102
- const version = "3.0.3";
16241
+ const version = "3.0.4";
16103
16242
  function install(app) {
16104
16243
  const components = [
16105
16244
  ActionSheet,