@dcloudio/uni-app-plus 3.0.0-alpha-4050320250224001 → 3.0.0-alpha-4060120250318001

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.
@@ -1,6 +1,6 @@
1
- import { normalizeStyles as normalizeStyles$1, addLeadingSlash, invokeArrayFns, ON_HIDE, ON_SHOW, parseQuery, EventChannel, once, parseUrl, Emitter, ON_UNHANDLE_REJECTION, ON_PAGE_NOT_FOUND, ON_ERROR, removeLeadingSlash, getLen, ON_UNLOAD, ON_READY, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_RESIZE, ON_LAUNCH, ON_BACK_PRESS } from "@dcloudio/uni-shared";
1
+ import { normalizeStyles as normalizeStyles$1, addLeadingSlash, invokeArrayFns, ON_HIDE, ON_SHOW, parseQuery, EventChannel, once, parseUrl, Emitter, ON_UNHANDLE_REJECTION, ON_PAGE_NOT_FOUND, ON_ERROR, removeLeadingSlash, getLen, ON_UNLOAD, ON_READY, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_RESIZE, ON_BACK_PRESS, ON_LAUNCH } from "@dcloudio/uni-shared";
2
2
  import { extend, isString, isPlainObject, isFunction as isFunction$1, isArray, isPromise, hasOwn, remove, invokeArrayFns as invokeArrayFns$1, capitalize, toTypeString, toRawType, parseStringStyle } from "@vue/shared";
3
- import { createVNode, render, ref, onMounted, onBeforeUnmount, getCurrentInstance, injectHook, defineComponent, warn, isInSSRComponentSetup, watchEffect, watch, computed, camelize, onUnmounted, reactive, provide, inject, nextTick, openBlock, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, toDisplayString, createCommentVNode, Fragment, renderList, resolveComponent, withDirectives, vModelText } from "vue";
3
+ import { createVNode, render, ref, onMounted, onBeforeUnmount, getCurrentInstance, injectHook, defineComponent, warn, isInSSRComponentSetup, watchEffect, watch, computed, camelize, onUnmounted, reactive, provide, inject, nextTick, openBlock, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, Fragment, toDisplayString, createCommentVNode, renderList, resolveComponent, withDirectives, vModelText, vShow } from "vue";
4
4
  function get$pageByPage(page) {
5
5
  return page.vm.$basePage;
6
6
  }
@@ -1966,7 +1966,9 @@ function registerDialogPage(_ref2, dialogPage, onCreated) {
1966
1966
  pageStyle.set("disableSwipeBack", true);
1967
1967
  }
1968
1968
  var parentPage = dialogPage.getParentPage();
1969
- var nativePage2 = getPageManager().createDialogPage(
1969
+ var createDialogPage = getPageManager().createDialogPage;
1970
+ var isHarmony = createDialogPage.length === 6;
1971
+ var nativePage2 = isHarmony ? createDialogPage(url, id2.toString(), pageStyle, parentPage === null || parentPage === void 0 ? void 0 : parentPage.getNativePage()) : createDialogPage(
1970
1972
  // @ts-expect-error
1971
1973
  parentPage ? parentPage.__nativePageId : "",
1972
1974
  id2.toString(),
@@ -2049,10 +2051,38 @@ function createVuePage(__pageId, __pagePath, __pageQuery, __pageInstance, pageOp
2049
2051
  }
2050
2052
  function initGlobalEvent(app) {
2051
2053
  app.addKeyEventListener(ON_BACK_BUTTON, () => {
2054
+ var currentPage = getCurrentPage();
2055
+ if (currentPage) {
2056
+ var systemDialogPages = currentPage.vm && currentPage.vm.$systemDialogPages && currentPage.vm.$systemDialogPages.value || [];
2057
+ var dialogPages = currentPage.getDialogPages();
2058
+ if (systemDialogPages.length > 0 || dialogPages.length > 0) {
2059
+ var lastSystemDialog = systemDialogPages[systemDialogPages.length - 1];
2060
+ var lastDialog = dialogPages[dialogPages.length - 1];
2061
+ if (!systemDialogPages.length) {
2062
+ handleDialogPageBack(lastDialog);
2063
+ } else if (!dialogPages.length) {
2064
+ handleDialogPageBack(lastSystemDialog);
2065
+ } else {
2066
+ handleDialogPageBack(parseInt(lastDialog.vm.$nativePage.pageId) > parseInt(lastSystemDialog.vm.$nativePage.pageId) ? lastDialog : lastSystemDialog);
2067
+ }
2068
+ return true;
2069
+ }
2070
+ }
2052
2071
  backbuttonListener();
2053
2072
  return true;
2054
2073
  });
2055
2074
  }
2075
+ function handleDialogPageBack(dialogPage) {
2076
+ var onBackPressRes = invokeHook(dialogPage.vm, ON_BACK_PRESS, {
2077
+ from: "navigateBack"
2078
+ });
2079
+ if (onBackPressRes !== true) {
2080
+ closeDialogPage({
2081
+ dialogPage,
2082
+ animationType: "auto"
2083
+ });
2084
+ }
2085
+ }
2056
2086
  var SOURCE_REG = /(.+\.((ttf)|(otf)|(woff2?))$)|(^(http|https):\/\/.+)|(^(data:font).+)/;
2057
2087
  function removeUrlWrap(source) {
2058
2088
  if (source.startsWith("url(")) {
@@ -2309,6 +2339,8 @@ function _reLaunch(_ref3) {
2309
2339
  var pages2 = getAllPages().slice(0);
2310
2340
  var selected = getTabIndex(path);
2311
2341
  function callback() {
2342
+ var _getPageManager$findP;
2343
+ (_getPageManager$findP = getPageManager().findPageById(getTabBar().pageId)) === null || _getPageManager$findP === void 0 || _getPageManager$findP.close();
2312
2344
  pages2.forEach((page) => closePage(page, "none"));
2313
2345
  resolve(void 0);
2314
2346
  setStatusBarStyle();
@@ -2896,6 +2928,7 @@ var openDialogPage = (options) => {
2896
2928
  if (dialogPages.length) {
2897
2929
  invokeHook(dialogPages[dialogPages.length - 1].$vm, ON_HIDE);
2898
2930
  }
2931
+ dialogPages.push(dialogPage);
2899
2932
  }
2900
2933
  setCurrentNormalDialogPage(dialogPage);
2901
2934
  } else {
@@ -6141,7 +6174,7 @@ const index = /* @__PURE__ */ Object.defineProperty({
6141
6174
  Radio: radio$1,
6142
6175
  RadioGroup: radioGroup$1
6143
6176
  }, Symbol.toStringTag, { value: "Module" });
6144
- const _sfc_main$1 = {
6177
+ const _sfc_main$5 = {
6145
6178
  data() {
6146
6179
  return {
6147
6180
  show: false,
@@ -6206,14 +6239,17 @@ const _sfc_main$1 = {
6206
6239
  }
6207
6240
  var osTheme = systemInfo.osTheme;
6208
6241
  var appTheme = systemInfo.appTheme;
6209
- if (appTheme != null) {
6242
+ if (appTheme != null && appTheme != "auto") {
6210
6243
  this.theme = appTheme;
6211
6244
  } else if (osTheme != null) {
6212
6245
  this.theme = osTheme;
6213
6246
  }
6214
6247
  this.isLandscape = systemInfo.deviceOrientation == "landscape";
6215
6248
  uni.onAppThemeChange((res) => {
6216
- this.theme = res.appTheme;
6249
+ var appTheme2 = res.appTheme;
6250
+ if (appTheme2 != null && appTheme2 != "auto") {
6251
+ this.theme = appTheme2;
6252
+ }
6217
6253
  });
6218
6254
  uni.onOsThemeChange((res) => {
6219
6255
  this.theme = res.osTheme;
@@ -6269,7 +6305,7 @@ const _sfc_main$1 = {
6269
6305
  uni.closeDialogPage({
6270
6306
  dialogPage: this.$page
6271
6307
  });
6272
- }, 300);
6308
+ }, 250);
6273
6309
  },
6274
6310
  handleMenuItemClick(tapIndex) {
6275
6311
  this.closeActionSheet();
@@ -6281,7 +6317,7 @@ const _sfc_main$1 = {
6281
6317
  }
6282
6318
  }
6283
6319
  };
6284
- const _style_0$1 = {
6320
+ const _style_0$5 = {
6285
6321
  "uni-action-sheet_dialog__mask": {
6286
6322
  "": {
6287
6323
  "position": "fixed",
@@ -6309,15 +6345,13 @@ const _style_0$1 = {
6309
6345
  "bottom": 0,
6310
6346
  "zIndex": 999,
6311
6347
  "transform": "translate(0, 100%)",
6312
- "opacity": 0,
6313
- "transitionProperty": "transform,opacity",
6314
- "transitionDuration": "0.3s",
6348
+ "transitionProperty": "transform",
6349
+ "transitionDuration": "0.25s",
6315
6350
  "backgroundColor": "#f7f7f7",
6316
6351
  "borderTopLeftRadius": 12,
6317
6352
  "borderTopRightRadius": 12
6318
6353
  },
6319
6354
  ".uni-action-sheet_dialog__show": {
6320
- "opacity": 1,
6321
6355
  "transform": "translate(0, 0)"
6322
6356
  },
6323
6357
  ".uni-action-sheet_dark__mode": {
@@ -6335,9 +6369,7 @@ const _style_0$1 = {
6335
6369
  "borderTopLeftRadius": 5,
6336
6370
  "borderTopRightRadius": 5,
6337
6371
  "borderBottomLeftRadius": 5,
6338
- "borderBottomRightRadius": 5,
6339
- "transitionProperty": "opacity",
6340
- "transitionDuration": "0.3s"
6372
+ "borderBottomRightRadius": 5
6341
6373
  }
6342
6374
  },
6343
6375
  "uni-action-sheet_dialog__menu": {
@@ -6363,15 +6395,7 @@ const _style_0$1 = {
6363
6395
  "paddingTop": 16,
6364
6396
  "paddingRight": 16,
6365
6397
  "paddingBottom": 16,
6366
- "paddingLeft": 16,
6367
- "borderBottomWidth": 1,
6368
- "borderBottomStyle": "solid",
6369
- "borderBottomColor": "#e5e5e5"
6370
- },
6371
- ".uni-action-sheet_dark__mode": {
6372
- "borderBottomWidth": 1,
6373
- "borderBottomStyle": "solid",
6374
- "borderBottomColor": "#2F3131"
6398
+ "paddingLeft": 16
6375
6399
  },
6376
6400
  ".uni-action-sheet_landscape__mode": {
6377
6401
  "paddingTop": 10,
@@ -6385,15 +6409,7 @@ const _style_0$1 = {
6385
6409
  "paddingTop": 16,
6386
6410
  "paddingRight": 16,
6387
6411
  "paddingBottom": 16,
6388
- "paddingLeft": 16,
6389
- "borderTopWidth": 1,
6390
- "borderTopStyle": "solid",
6391
- "borderTopColor": "#e5e5e5"
6392
- },
6393
- ".uni-action-sheet_dark__mode": {
6394
- "borderTopWidth": 1,
6395
- "borderTopStyle": "solid",
6396
- "borderTopColor": "#2F3131"
6412
+ "paddingLeft": 16
6397
6413
  },
6398
6414
  ".uni-action-sheet_landscape__mode": {
6399
6415
  "paddingTop": 10,
@@ -6469,14 +6485,24 @@ const _style_0$1 = {
6469
6485
  "maxHeight": 260
6470
6486
  }
6471
6487
  },
6488
+ "divider": {
6489
+ "": {
6490
+ "height": 1,
6491
+ "backgroundColor": "#e5e5e5",
6492
+ "transform": "scaleY(0.5)"
6493
+ },
6494
+ ".uni-action-sheet_dark__mode": {
6495
+ "backgroundColor": "#2F3131"
6496
+ }
6497
+ },
6472
6498
  "@TRANSITION": {
6473
6499
  "uni-action-sheet_dialog__mask": {
6474
6500
  "property": "opacity",
6475
6501
  "duration": "0.1s"
6476
6502
  },
6477
6503
  "uni-action-sheet_dialog__container": {
6478
- "property": "opacity",
6479
- "duration": "0.3s"
6504
+ "property": "transform",
6505
+ "duration": "0.25s"
6480
6506
  }
6481
6507
  }
6482
6508
  };
@@ -6487,8 +6513,8 @@ const _export_sfc = (sfc, props) => {
6487
6513
  }
6488
6514
  return target;
6489
6515
  };
6490
- var _hoisted_1$1 = ["onClick"];
6491
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6516
+ var _hoisted_1$4 = ["onClick"];
6517
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
6492
6518
  return openBlock(), createElementBlock("view", null, [createElementVNode("view", {
6493
6519
  class: normalizeClass(["uni-action-sheet_dialog__mask", {
6494
6520
  "uni-action-sheet_dialog__mask__show": $data.show
@@ -6510,8 +6536,9 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6510
6536
  "uni-action-sheet_dark__mode": $data.theme == "dark",
6511
6537
  "uni-action-sheet_landscape__mode": $data.isLandscape
6512
6538
  }])
6513
- }, [$data.title ? (openBlock(), createElementBlock("view", {
6514
- key: 0,
6539
+ }, [$data.title ? (openBlock(), createElementBlock(Fragment, {
6540
+ key: 0
6541
+ }, [createElementVNode("view", {
6515
6542
  class: normalizeClass(["uni-action-sheet_dialog__title", {
6516
6543
  "uni-action-sheet_dark__mode": $data.theme == "dark",
6517
6544
  "uni-action-sheet_landscape__mode": $data.isLandscape
@@ -6523,20 +6550,27 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6523
6550
  class: normalizeClass(["uni-action-sheet_dialog__title__text", {
6524
6551
  "uni-action-sheet_dark__mode": $data.theme == "dark"
6525
6552
  }])
6526
- }, toDisplayString($data.title), 7)], 2)) : createCommentVNode("", true), createElementVNode("scroll-view", {
6553
+ }, toDisplayString($data.title), 7)], 2), createElementVNode("view", {
6554
+ class: normalizeClass(["divider", {
6555
+ "uni-action-sheet_dark__mode": $data.theme == "dark"
6556
+ }])
6557
+ }, null, 2)], 64)) : createCommentVNode("", true), createElementVNode("scroll-view", {
6527
6558
  class: normalizeClass(["uni-action-sheet_dialog__cell__container", {
6528
6559
  "uni-action-sheet_landscape__mode": $data.isLandscape
6529
6560
  }])
6530
6561
  }, [(openBlock(true), createElementBlock(Fragment, null, renderList($data.itemList, (item, index2) => {
6531
6562
  return openBlock(), createElementBlock("view", {
6532
- style: normalizeStyle(index2 == 0 ? {
6533
- borderTop: "none"
6534
- } : {}),
6563
+ key: index2
6564
+ }, [index2 !== 0 ? (openBlock(), createElementBlock("view", {
6565
+ key: 0,
6566
+ class: normalizeClass(["divider", {
6567
+ "uni-action-sheet_dark__mode": $data.theme == "dark"
6568
+ }])
6569
+ }, null, 2)) : createCommentVNode("", true), createElementVNode("view", {
6535
6570
  class: normalizeClass(["uni-action-sheet_dialog__cell", {
6536
6571
  "uni-action-sheet_dark__mode": $data.theme == "dark",
6537
6572
  "uni-action-sheet_landscape__mode": $data.isLandscape
6538
6573
  }]),
6539
- key: index2,
6540
6574
  onClick: ($event) => $options.handleMenuItemClick(index2)
6541
6575
  }, [createElementVNode("text", {
6542
6576
  style: normalizeStyle({
@@ -6545,7 +6579,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6545
6579
  class: normalizeClass(["uni-action-sheet_dialog__cell__text", {
6546
6580
  "uni-action-sheet_dark__mode": $data.theme == "dark"
6547
6581
  }])
6548
- }, toDisplayString(item), 7)], 14, _hoisted_1$1);
6582
+ }, toDisplayString(item), 7)], 10, _hoisted_1$4)]);
6549
6583
  }), 128))], 2)], 6), createElementVNode("view", {
6550
6584
  style: normalizeStyle($data.backgroundColor != null ? {
6551
6585
  backgroundColor: $data.backgroundColor
@@ -6564,14 +6598,15 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6564
6598
  class: normalizeClass(["uni-action-sheet_dialog__action__text", {
6565
6599
  "uni-action-sheet_dark__mode": $data.theme == "dark"
6566
6600
  }])
6567
- }, toDisplayString($options.cancelText), 7)], 6), createElementVNode("view", {
6601
+ }, toDisplayString($options.cancelText), 7)], 6), !$data.isLandscape ? (openBlock(), createElementBlock("view", {
6602
+ key: 0,
6568
6603
  style: normalizeStyle({
6569
6604
  height: "".concat($data.bottomNavigationHeight, "px"),
6570
6605
  backgroundColor: $options.computedBackgroundColor
6571
6606
  })
6572
- }, null, 4)], 2)]);
6607
+ }, null, 4)) : createCommentVNode("", true)], 2)]);
6573
6608
  }
6574
- const UniActionSheetPage = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["styles", [_style_0$1]]]);
6609
+ const UniActionSheetPage = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["styles", [_style_0$5]]]);
6575
6610
  var defaultPoi = {
6576
6611
  latitude: 39.908823,
6577
6612
  longitude: 116.39747
@@ -6597,7 +6632,7 @@ var languageData = {
6597
6632
  }
6598
6633
  };
6599
6634
  var loadingPath = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c6QAAAXdJREFUSEvdVtFthTAMdAKD0E3oABixwWOSvk5SNkCYAcomZRFIZfSoUl6IQ14l2uYXnMtd7uwoOGmpk3AhGpiI3gEgQ8SnmMM/AmwAYPwfwG3bZkmS5IjY7MlIRCLjruuu8zw3VVWN232cUnOBUurFJ6UEfPNADgC1i4AT+Mb4DQC40HmPPmALdEDEZ5dqu+aSwPk7b7iVMQSU67yutsGNMa9lWV590SGiCwCwUrtM13oxTqvRpmkaXCaxD8L/aq0v0gFFxjGNIbRGZBy60dH/zge23GgfflRK1UVRDEcY9X2fG2O4l2/XVzQXxpZ7l4jY6wFgbkB3+629/Xypj0j5E//+bsY8NLTWg2SykKkW3LkstzeIWPtkDplqQcAW6F2smF2appmtgjRYvqXFM+g5h8tYdEWKiD64dvv0CQV3mstqALsNxDePN+CHHwK5byJJLxDJaNFxkoClrP9JYDYfN31vxPaYRzPmO5ReJD65o4GlO5S+fwJ6r+Yfw6D/nQAAAABJRU5ErkJggg==";
6600
- const _sfc_main = {
6635
+ const _sfc_main$4 = {
6601
6636
  data() {
6602
6637
  var id1 = "UniMap1_".concat((Math.random() * 1e6).toString(36));
6603
6638
  var id2 = "UniMap2_".concat((Math.random() * 1e6).toString(36));
@@ -7151,7 +7186,7 @@ const _sfc_main = {
7151
7186
  }
7152
7187
  }
7153
7188
  };
7154
- const _style_0 = {
7189
+ const _style_0$4 = {
7155
7190
  "uni-choose-location-icons": {
7156
7191
  "": {
7157
7192
  "fontFamily": "UniChooseLocationFontFamily",
@@ -7588,20 +7623,20 @@ const _style_0 = {
7588
7623
  }
7589
7624
  }
7590
7625
  };
7591
- var _hoisted_1 = ["id"];
7592
- var _hoisted_2 = {
7626
+ var _hoisted_1$3 = ["id"];
7627
+ var _hoisted_2$3 = {
7593
7628
  class: "uni-choose-location-icons uni-choose-location-map-target-icon"
7594
7629
  };
7595
- var _hoisted_3 = {
7630
+ var _hoisted_3$3 = {
7596
7631
  class: "uni-choose-location-icons uni-choose-location-map-reset-icon"
7597
7632
  };
7598
- var _hoisted_4 = {
7633
+ var _hoisted_4$2 = {
7599
7634
  class: "uni-choose-location-nav-text uni-choose-location-nav-confirm-text"
7600
7635
  };
7601
- var _hoisted_5 = {
7636
+ var _hoisted_5$1 = {
7602
7637
  class: "uni-choose-location-poi-search"
7603
7638
  };
7604
- var _hoisted_6 = {
7639
+ var _hoisted_6$1 = {
7605
7640
  class: "uni-choose-location-poi-search-box"
7606
7641
  };
7607
7642
  var _hoisted_7 = {
@@ -7647,7 +7682,7 @@ var _hoisted_21 = {
7647
7682
  class: "uni-choose-location-poi-search-loading"
7648
7683
  };
7649
7684
  var _hoisted_22 = ["src"];
7650
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7685
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
7651
7686
  var _component_map = resolveComponent("map");
7652
7687
  return openBlock(), createElementBlock("view", {
7653
7688
  class: normalizeClass(["uni-choose-location", $options.uniChooseLocationClassCom])
@@ -7672,13 +7707,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7672
7707
  class: "uni-choose-location-map-target",
7673
7708
  ref: $data.mapTargetId,
7674
7709
  id: $data.mapTargetId
7675
- }, [createElementVNode("text", _hoisted_2, toDisplayString($data.icon.target), 1)], 8, _hoisted_1), createElementVNode("view", {
7710
+ }, [createElementVNode("text", _hoisted_2$3, toDisplayString($data.icon.target), 1)], 8, _hoisted_1$3), createElementVNode("view", {
7676
7711
  class: normalizeClass(["uni-choose-location-map-reset", [$options.landscapeClassCom]]),
7677
7712
  onClick: _cache[0] || (_cache[0] = function() {
7678
7713
  return $options.mapReset && $options.mapReset(...arguments);
7679
7714
  }),
7680
7715
  style: normalizeStyle($options.resetStyleCom)
7681
- }, [createElementVNode("text", _hoisted_3, toDisplayString($data.icon.position), 1)], 6)], 6), createElementVNode("view", {
7716
+ }, [createElementVNode("text", _hoisted_3$3, toDisplayString($data.icon.position), 1)], 6)], 6), createElementVNode("view", {
7682
7717
  class: "uni-choose-location-nav",
7683
7718
  style: normalizeStyle("height:" + (60 + $data.safeArea.top) + "px;")
7684
7719
  }, [createElementVNode("view", {
@@ -7695,11 +7730,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7695
7730
  onClick: _cache[2] || (_cache[2] = function() {
7696
7731
  return $options.confirm && $options.confirm(...arguments);
7697
7732
  })
7698
- }, [createElementVNode("text", _hoisted_4, toDisplayString($options.languageCom["ok"]), 1)], 6)], 4), $data.useUniCloud ? (openBlock(), createElementBlock("view", {
7733
+ }, [createElementVNode("text", _hoisted_4$2, toDisplayString($options.languageCom["ok"]), 1)], 6)], 4), $data.useUniCloud ? (openBlock(), createElementBlock("view", {
7699
7734
  key: 0,
7700
7735
  class: normalizeClass(["uni-choose-location-poi", [$options.landscapeClassCom]]),
7701
7736
  style: normalizeStyle($options.poiBoxStyleCom)
7702
- }, [createElementVNode("view", _hoisted_5, [createElementVNode("view", _hoisted_6, [createElementVNode("text", _hoisted_7, toDisplayString($data.icon.search), 1), withDirectives(createElementVNode("input", {
7737
+ }, [createElementVNode("view", _hoisted_5$1, [createElementVNode("view", _hoisted_6$1, [createElementVNode("text", _hoisted_7, toDisplayString($data.icon.search), 1), withDirectives(createElementVNode("input", {
7703
7738
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.searchValue = $event),
7704
7739
  type: "text",
7705
7740
  placeholder: $options.languageCom["search"],
@@ -7744,12 +7779,1427 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7744
7779
  mode: "widthFix"
7745
7780
  }, null, 10, _hoisted_22)])) : createCommentVNode("", true)], 40, _hoisted_9)], 6)) : createCommentVNode("", true)], 2);
7746
7781
  }
7747
- const UniChooseLocationPage = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]]]);
7748
- function registerSystemPages() {
7749
- registerSystemRoute("uni:actionSheet", UniActionSheetPage, {
7750
- disableSwipeBack: false
7751
- });
7752
- registerSystemRoute("uni:chooseLocation", UniChooseLocationPage, {
7782
+ const UniChooseLocationPage = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["styles", [_style_0$4]]]);
7783
+ const _sfc_main$3 = {
7784
+ data() {
7785
+ return {
7786
+ inputLineHeight: 32,
7787
+ theme: "light",
7788
+ readyEventName: "",
7789
+ optionsEventName: "",
7790
+ successEventName: "",
7791
+ failEventName: "",
7792
+ title: "",
7793
+ content: "",
7794
+ showCancel: true,
7795
+ editable: false,
7796
+ placeholderText: null,
7797
+ confirmText: "确定",
7798
+ cancelText: "取消",
7799
+ cancelColor: "#000000",
7800
+ confirmColor: "#4A5E86",
7801
+ inputBottom: "0px",
7802
+ inputCancelColor: null,
7803
+ inputConfirmColor: null,
7804
+ hoverClassName: "uni-modal_dialog__content__bottom__button__hover",
7805
+ showAnim: false,
7806
+ isAutoHeight: true
7807
+ };
7808
+ },
7809
+ onReady() {
7810
+ setTimeout(() => {
7811
+ this.showAnim = true;
7812
+ }, 10);
7813
+ },
7814
+ onLoad(options) {
7815
+ var systemInfo = uni.getSystemInfoSync();
7816
+ var appTheme = systemInfo.appTheme;
7817
+ if (appTheme != null) {
7818
+ this.theme = appTheme;
7819
+ }
7820
+ uni.onAppThemeChange((res) => {
7821
+ this.theme = res.appTheme;
7822
+ this.updateUI();
7823
+ });
7824
+ this.readyEventName = options["readyEventName"];
7825
+ this.optionsEventName = options["optionsEventName"];
7826
+ this.successEventName = options["successEventName"];
7827
+ this.failEventName = options["failEventName"];
7828
+ uni.$on(this.optionsEventName, (data) => {
7829
+ if (data["title"] != null) {
7830
+ this.title = data["title"];
7831
+ }
7832
+ if (data["content"] != null) {
7833
+ this.content = data["content"];
7834
+ }
7835
+ if (data["showCancel"] != null) {
7836
+ this.showCancel = data["showCancel"];
7837
+ }
7838
+ if (data["editable"] != null) {
7839
+ this.editable = data["editable"];
7840
+ }
7841
+ if (data["placeholderText"] != null) {
7842
+ this.placeholderText = data["placeholderText"];
7843
+ }
7844
+ if (data["confirmText"] != null) {
7845
+ this.confirmText = data["confirmText"];
7846
+ }
7847
+ if (data["cancelText"] != null) {
7848
+ this.cancelText = data["cancelText"];
7849
+ }
7850
+ if (data["confirmColor"] != null) {
7851
+ this.inputConfirmColor = data["confirmColor"];
7852
+ }
7853
+ if (data["cancelColor"] != null) {
7854
+ this.inputCancelColor = data["cancelColor"];
7855
+ }
7856
+ this.updateUI();
7857
+ });
7858
+ uni.$emit(this.readyEventName, {});
7859
+ },
7860
+ onUnload() {
7861
+ uni.$off(this.optionsEventName, null);
7862
+ uni.$off(this.readyEventName, null);
7863
+ uni.$off(this.successEventName, null);
7864
+ uni.$off(this.failEventName, null);
7865
+ },
7866
+ methods: {
7867
+ onInputBlur(e) {
7868
+ setTimeout(() => {
7869
+ this.inputBottom = "0px";
7870
+ }, 220);
7871
+ },
7872
+ onInputKeyboardChange(e) {
7873
+ var keyBoardHeight = e.detail.height;
7874
+ if (keyBoardHeight > 0) {
7875
+ var calcBottom = keyBoardHeight / 2;
7876
+ this.inputBottom = "".concat(calcBottom, "px");
7877
+ }
7878
+ },
7879
+ isValidColor(inputColor) {
7880
+ var hexColorRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
7881
+ if (inputColor == null) {
7882
+ return false;
7883
+ }
7884
+ return hexColorRegex.test(inputColor);
7885
+ },
7886
+ /**
7887
+ * update ui when theme change.
7888
+ */
7889
+ updateUI() {
7890
+ if (this.isValidColor(this.inputConfirmColor)) {
7891
+ this.confirmColor = this.inputConfirmColor;
7892
+ } else {
7893
+ if (this.theme == "dark") {
7894
+ this.confirmColor = "#7388a2";
7895
+ } else {
7896
+ this.confirmColor = "#4A5E86";
7897
+ }
7898
+ }
7899
+ if (this.isValidColor(this.inputCancelColor)) {
7900
+ this.cancelColor = this.inputCancelColor;
7901
+ } else {
7902
+ if (this.theme == "dark") {
7903
+ this.cancelColor = "#a5a5a5";
7904
+ } else {
7905
+ this.cancelColor = "#000000";
7906
+ }
7907
+ }
7908
+ if (this.theme == "dark") {
7909
+ this.hoverClassName = "uni-modal_dialog__content__bottom__button__hover__uni-modal_dark__mode";
7910
+ } else {
7911
+ this.hoverClassName = "uni-modal_dialog__content__bottom__button__hover";
7912
+ }
7913
+ },
7914
+ closeModal() {
7915
+ this.showAnim = false;
7916
+ setTimeout(() => {
7917
+ uni.closeDialogPage({
7918
+ dialogPage: this.$page
7919
+ });
7920
+ }, 300);
7921
+ },
7922
+ handleCancel() {
7923
+ this.closeModal();
7924
+ uni.$emit(this.successEventName, null);
7925
+ },
7926
+ handleSure() {
7927
+ this.closeModal();
7928
+ uni.$emit(this.successEventName, this.content);
7929
+ }
7930
+ }
7931
+ };
7932
+ const _style_0$3 = {
7933
+ "uni-modal_dialog__mask": {
7934
+ "": {
7935
+ "display": "flex",
7936
+ "height": "100%",
7937
+ "width": "100%",
7938
+ "justifyContent": "center",
7939
+ "alignItems": "center",
7940
+ "backgroundColor": "rgba(0,0,0,0.5)",
7941
+ "transitionDuration": "0.1s",
7942
+ "transitionProperty": "opacity",
7943
+ "opacity": 0
7944
+ }
7945
+ },
7946
+ "uni-modal_dialog__mask__show": {
7947
+ "": {
7948
+ "opacity": 1
7949
+ }
7950
+ },
7951
+ "uni-modal_dialog__container": {
7952
+ "": {
7953
+ "width": 300,
7954
+ "backgroundColor": "#FFFFFF",
7955
+ "boxShadow": "0 0 10px rgba(0, 0, 0, 0.1)",
7956
+ "borderTopLeftRadius": 8,
7957
+ "borderTopRightRadius": 8,
7958
+ "borderBottomRightRadius": 8,
7959
+ "borderBottomLeftRadius": 8,
7960
+ "transitionDuration": "0.1s",
7961
+ "transitionProperty": "opacity,transform",
7962
+ "opacity": 0,
7963
+ "transform": "scale(0.9)"
7964
+ },
7965
+ ".uni-modal_dialog__show": {
7966
+ "opacity": 1,
7967
+ "transform": "scale(1)"
7968
+ },
7969
+ ".uni-modal_dark__mode": {
7970
+ "backgroundColor": "#272727"
7971
+ }
7972
+ },
7973
+ "uni-modal_dialog__container__wrapper": {
7974
+ "": {
7975
+ "width": "100%",
7976
+ "height": "100%",
7977
+ "paddingTop": 10,
7978
+ "backgroundColor": "#FFFFFF",
7979
+ "borderTopLeftRadius": 8,
7980
+ "borderTopRightRadius": 8,
7981
+ "borderBottomRightRadius": 8,
7982
+ "borderBottomLeftRadius": 8
7983
+ },
7984
+ ".uni-modal_dark__mode": {
7985
+ "backgroundColor": "#272727"
7986
+ }
7987
+ },
7988
+ "uni-modal_dialog__title__text": {
7989
+ "": {
7990
+ "fontSize": 16,
7991
+ "fontWeight": "bold",
7992
+ "textAlign": "center",
7993
+ "marginTop": 20,
7994
+ "textOverflow": "ellipsis",
7995
+ "paddingLeft": 20,
7996
+ "paddingRight": 20,
7997
+ "lines": 2
7998
+ },
7999
+ ".uni-modal_dark__mode": {
8000
+ "color": "#CFCFCF"
8001
+ }
8002
+ },
8003
+ "uni-modal_dialog__content": {
8004
+ "": {
8005
+ "justifyContent": "center",
8006
+ "alignItems": "center",
8007
+ "paddingTop": 20,
8008
+ "paddingRight": 20,
8009
+ "paddingBottom": 20,
8010
+ "paddingLeft": 20
8011
+ }
8012
+ },
8013
+ "uni-modal_dialog__content__text": {
8014
+ "": {
8015
+ "fontSize": 16,
8016
+ "fontWeight": "normal",
8017
+ "marginBottom": 10,
8018
+ "textAlign": "center",
8019
+ "color": "#747474",
8020
+ "lines": 6,
8021
+ "width": "100%",
8022
+ "textOverflow": "ellipsis"
8023
+ }
8024
+ },
8025
+ "uni-modal_dialog__content__textarea": {
8026
+ "": {
8027
+ "backgroundColor": "#F6F6F6",
8028
+ "color": "#000000",
8029
+ "width": "96%",
8030
+ "paddingTop": 5,
8031
+ "paddingRight": 5,
8032
+ "paddingBottom": 5,
8033
+ "paddingLeft": 5,
8034
+ "maxHeight": 192
8035
+ },
8036
+ ".uni-modal_dark__mode": {
8037
+ "backgroundColor": "#3d3d3d",
8038
+ "color": "#CFCFCF"
8039
+ }
8040
+ },
8041
+ "uni-modal_dialog__content__textarea__placeholder": {
8042
+ "": {
8043
+ "color": "#808080"
8044
+ },
8045
+ ".uni-modal_dark__mode": {
8046
+ "color": "#CFCFCF"
8047
+ }
8048
+ },
8049
+ "uni-modal_dialog__content__topline": {
8050
+ "": {
8051
+ "width": "100%",
8052
+ "height": 1,
8053
+ "backgroundColor": "#E0E0E0"
8054
+ },
8055
+ ".uni-modal_dark__mode": {
8056
+ "backgroundColor": "#303030"
8057
+ }
8058
+ },
8059
+ "uni-modal_dialog__content__bottom": {
8060
+ "": {
8061
+ "display": "flex",
8062
+ "width": "100%",
8063
+ "height": 50,
8064
+ "flexDirection": "row",
8065
+ "overflow": "hidden"
8066
+ }
8067
+ },
8068
+ "uni-modal_dialog__content__bottom__button": {
8069
+ "": {
8070
+ "width": "50%",
8071
+ "height": "100%",
8072
+ "display": "flex",
8073
+ "alignItems": "center",
8074
+ "justifyContent": "center",
8075
+ "flexGrow": 1
8076
+ }
8077
+ },
8078
+ "uni-modal_dialog__content__bottom__button__hover": {
8079
+ "": {
8080
+ "width": "50%",
8081
+ "height": "100%",
8082
+ "display": "flex",
8083
+ "alignItems": "center",
8084
+ "justifyContent": "center",
8085
+ "backgroundColor": "#efefef"
8086
+ }
8087
+ },
8088
+ "uni-modal_dialog__content__bottom__button__hover__uni-modal_dark__mode": {
8089
+ "": {
8090
+ "width": "50%",
8091
+ "height": "100%",
8092
+ "display": "flex",
8093
+ "alignItems": "center",
8094
+ "justifyContent": "center",
8095
+ "backgroundColor": "#1C1C1C"
8096
+ }
8097
+ },
8098
+ "uni-modal_dialog__content__bottom__button__text": {
8099
+ "": {
8100
+ "letterSpacing": 1,
8101
+ "fontSize": 16,
8102
+ "fontWeight": "bold",
8103
+ "textAlign": "center",
8104
+ "lines": 1,
8105
+ "whiteSpace": "nowrap"
8106
+ }
8107
+ },
8108
+ "uni-modal_dialog__content__bottom__button__text__sure": {
8109
+ "": {
8110
+ "letterSpacing": 1,
8111
+ "fontSize": 16,
8112
+ "fontWeight": "bold",
8113
+ "lines": 1,
8114
+ "whiteSpace": "nowrap",
8115
+ "textAlign": "center",
8116
+ "color": "#4A5E86"
8117
+ }
8118
+ },
8119
+ "uni-modal_dialog__content__bottom__splitline": {
8120
+ "": {
8121
+ "width": 1,
8122
+ "height": "100%",
8123
+ "backgroundColor": "#E3E3E3"
8124
+ },
8125
+ ".uni-modal_dark__mode": {
8126
+ "backgroundColor": "#303030"
8127
+ }
8128
+ },
8129
+ "@TRANSITION": {
8130
+ "uni-modal_dialog__mask": {
8131
+ "duration": "0.1s",
8132
+ "property": "opacity"
8133
+ },
8134
+ "uni-modal_dialog__container": {
8135
+ "duration": "0.1s",
8136
+ "property": "opacity,transform"
8137
+ }
8138
+ }
8139
+ };
8140
+ var _hoisted_1$2 = {
8141
+ class: "uni-modal_dialog__content"
8142
+ };
8143
+ var _hoisted_2$2 = ["auto-height", "placeholder"];
8144
+ var _hoisted_3$2 = {
8145
+ key: 1,
8146
+ class: "uni-modal_dialog__content__text"
8147
+ };
8148
+ var _hoisted_4$1 = {
8149
+ class: "uni-modal_dialog__content__bottom"
8150
+ };
8151
+ var _hoisted_5 = ["hover-class"];
8152
+ var _hoisted_6 = ["hover-class"];
8153
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
8154
+ return openBlock(), createElementBlock("view", {
8155
+ class: normalizeClass(["uni-modal_dialog__mask", {
8156
+ "uni-modal_dialog__mask__show": $data.showAnim
8157
+ }])
8158
+ }, [createElementVNode("view", {
8159
+ class: normalizeClass(["uni-modal_dialog__container", {
8160
+ "uni-modal_dialog__show": $data.showAnim,
8161
+ "uni-modal_dark__mode": $data.theme == "dark"
8162
+ }]),
8163
+ id: "modal_content",
8164
+ style: normalizeStyle({
8165
+ bottom: $data.inputBottom
8166
+ })
8167
+ }, [createElementVNode("view", {
8168
+ class: normalizeClass(["uni-modal_dialog__container__wrapper", {
8169
+ "uni-modal_dark__mode": $data.theme == "dark"
8170
+ }])
8171
+ }, [$data.title ? (openBlock(), createElementBlock("text", {
8172
+ key: 0,
8173
+ class: normalizeClass(["uni-modal_dialog__title__text", {
8174
+ "uni-modal_dark__mode": $data.theme == "dark"
8175
+ }])
8176
+ }, toDisplayString($data.title), 3)) : createCommentVNode("", true), createElementVNode("view", _hoisted_1$2, [$data.editable ? withDirectives((openBlock(), createElementBlock("textarea", {
8177
+ key: 0,
8178
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.content = $event),
8179
+ class: normalizeClass(["uni-modal_dialog__content__textarea", {
8180
+ "uni-modal_dark__mode": $data.theme == "dark"
8181
+ }]),
8182
+ "placeholder-class": "modalContent_content_edit_placeholder",
8183
+ "adjust-position": false,
8184
+ onBlur: _cache[1] || (_cache[1] = function() {
8185
+ return $options.onInputBlur && $options.onInputBlur(...arguments);
8186
+ }),
8187
+ onKeyboardheightchange: _cache[2] || (_cache[2] = function() {
8188
+ return $options.onInputKeyboardChange && $options.onInputKeyboardChange(...arguments);
8189
+ }),
8190
+ id: "textarea_content_input",
8191
+ ref: "ref_textarea_content_input",
8192
+ "auto-height": $data.isAutoHeight,
8193
+ placeholder: $data.placeholderText
8194
+ }, null, 42, _hoisted_2$2)), [[vModelText, $data.content]]) : (openBlock(), createElementBlock("text", _hoisted_3$2, toDisplayString($data.content), 1))]), createElementVNode("view", {
8195
+ class: normalizeClass(["uni-modal_dialog__content__topline", {
8196
+ "uni-modal_dark__mode": $data.theme == "dark"
8197
+ }])
8198
+ }, null, 2), createElementVNode("view", _hoisted_4$1, [$data.showCancel ? (openBlock(), createElementBlock("view", {
8199
+ key: 0,
8200
+ class: normalizeClass(["uni-modal_dialog__content__bottom__button", {
8201
+ "uni-modal_dark__mode": $data.theme == "dark"
8202
+ }]),
8203
+ "hover-class": $data.hoverClassName,
8204
+ onClick: _cache[3] || (_cache[3] = function() {
8205
+ return $options.handleCancel && $options.handleCancel(...arguments);
8206
+ })
8207
+ }, [createElementVNode("text", {
8208
+ style: normalizeStyle({
8209
+ color: $data.cancelColor
8210
+ }),
8211
+ class: "uni-modal_dialog__content__bottom__button__text"
8212
+ }, toDisplayString($data.cancelText), 5)], 10, _hoisted_5)) : createCommentVNode("", true), $data.showCancel ? (openBlock(), createElementBlock("view", {
8213
+ key: 1,
8214
+ class: normalizeClass(["uni-modal_dialog__content__bottom__splitline", {
8215
+ "uni-modal_dark__mode": $data.theme == "dark"
8216
+ }])
8217
+ }, null, 2)) : createCommentVNode("", true), createElementVNode("view", {
8218
+ class: normalizeClass(["uni-modal_dialog__content__bottom__button", {
8219
+ "uni-modal_dark__mode": $data.theme == "dark"
8220
+ }]),
8221
+ "hover-class": $data.hoverClassName,
8222
+ onClick: _cache[4] || (_cache[4] = function() {
8223
+ return $options.handleSure && $options.handleSure(...arguments);
8224
+ })
8225
+ }, [createElementVNode("text", {
8226
+ style: normalizeStyle({
8227
+ color: $data.confirmColor
8228
+ }),
8229
+ class: "uni-modal_dialog__content__bottom__button__text__sure"
8230
+ }, toDisplayString($data.confirmText), 5)], 10, _hoisted_6)])], 2)], 6)], 2);
8231
+ }
8232
+ const UniUniModalPage = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["styles", [_style_0$3]]]);
8233
+ class Friction {
8234
+ // 构造函数,初始化物体的质量(m)、摩擦力大小(f,这里假设是牛顿单位的力,但乘以1000可能是为了转换为某种特定单位)
8235
+ constructor(mass, frictionForce) {
8236
+ this.endPosition = null;
8237
+ this.lastTimeElapsed = null;
8238
+ this.totalTimeToStop = 0;
8239
+ this.mass = mass;
8240
+ this.frictionForce = 1e3 * frictionForce;
8241
+ this.startTime = 0;
8242
+ this.velocity = {
8243
+ x: 0,
8244
+ y: 0
8245
+ };
8246
+ this.acceleration = {
8247
+ x: 0,
8248
+ y: 0
8249
+ };
8250
+ this.startPosition = {
8251
+ x: 0,
8252
+ y: 0
8253
+ };
8254
+ this.endPosition = null;
8255
+ this.lastTimeElapsed = null;
8256
+ }
8257
+ // 设置物体的速度
8258
+ setVelocity(x, y) {
8259
+ var speed = Math.sqrt(x * x + y * y);
8260
+ this.velocity = {
8261
+ x,
8262
+ y
8263
+ };
8264
+ this.acceleration = {
8265
+ x: -this.frictionForce * x / speed,
8266
+ y: -this.frictionForce * y / speed
8267
+ };
8268
+ this.totalTimeToStop = Math.abs(x / this.acceleration.x);
8269
+ if (Number.isNaN(this.totalTimeToStop)) {
8270
+ this.totalTimeToStop = Math.abs(y / this.acceleration.y);
8271
+ }
8272
+ if (Number.isNaN(this.totalTimeToStop)) {
8273
+ this.totalTimeToStop = 0;
8274
+ }
8275
+ this.startTime = Date.now();
8276
+ this.lastTimeElapsed = null;
8277
+ }
8278
+ // 设置物体的起始位置
8279
+ setStartPosition(x, y) {
8280
+ this.startPosition = {
8281
+ x,
8282
+ y
8283
+ };
8284
+ }
8285
+ // 设置物体的结束位置
8286
+ setEndPosition(x, y) {
8287
+ this.endPosition = {
8288
+ x,
8289
+ y
8290
+ };
8291
+ }
8292
+ // 计算并返回物体在时间 t 时的位置
8293
+ positionAtTime(t) {
8294
+ if (t == null) {
8295
+ t = (Date.now() - this.startTime) / 1e3;
8296
+ }
8297
+ if (t > this.totalTimeToStop) {
8298
+ t = this.totalTimeToStop;
8299
+ this.lastTimeElapsed = t;
8300
+ }
8301
+ var x = this.velocity.x * t + 0.5 * this.acceleration.x * t * t + this.startPosition.x;
8302
+ var y = this.velocity.y * t + 0.5 * this.acceleration.y * t * t + this.startPosition.y;
8303
+ if (this.acceleration.x > 0 && x < this.endPosition.x || this.acceleration.x < 0 && x > this.endPosition.x) {
8304
+ x = this.endPosition.x;
8305
+ }
8306
+ if (this.acceleration.y > 0 && y < this.endPosition.y || this.acceleration.y < 0 && y > this.endPosition.y) {
8307
+ y = this.endPosition.y;
8308
+ }
8309
+ return {
8310
+ x,
8311
+ y
8312
+ };
8313
+ }
8314
+ // 计算并返回物体在时间 t 时的速度
8315
+ velocityAtTime(t) {
8316
+ if (t == null) {
8317
+ t = (Date.now() - this.startTime) / 1e3;
8318
+ }
8319
+ if (t > this.totalTimeToStop) {
8320
+ t = this.totalTimeToStop;
8321
+ }
8322
+ return {
8323
+ dx: this.velocity.x + this.acceleration.x * t,
8324
+ dy: this.velocity.y + this.acceleration.y * t
8325
+ };
8326
+ }
8327
+ // 计算物体停止前的位移量(这里的方法名可能不准确,因为 delta 通常表示变化量)
8328
+ // 注意:这个方法可能是错误的,因为它基于一个不准确的加速度公式
8329
+ displacement() {
8330
+ var tx = -1.5 * Math.pow(this.velocity.x, 2) / this.acceleration.x;
8331
+ if (Number.isNaN(tx)) {
8332
+ tx = 0;
8333
+ }
8334
+ var ty = -1.5 * Math.pow(this.velocity.y, 2) / this.acceleration.y;
8335
+ if (Number.isNaN(ty)) {
8336
+ ty = 0;
8337
+ }
8338
+ return {
8339
+ x: tx,
8340
+ y: ty
8341
+ };
8342
+ }
8343
+ // 计算物体停止所需的时间(这个方法实际上是多余的,因为已经在 setVelocity 中计算过了)
8344
+ timeToStop() {
8345
+ return -this.velocity.x / this.acceleration.x;
8346
+ }
8347
+ // 检查物体是否已经停止或到达结束位置
8348
+ isDone() {
8349
+ var currentPosition = this.positionAtTime(null);
8350
+ return currentPosition.x === this.endPosition.x && currentPosition.y === this.endPosition.y || this.lastTimeElapsed === this.totalTimeToStop;
8351
+ }
8352
+ // 重新配置物体的质量和摩擦力大小
8353
+ reconfigure(mass, frictionForce) {
8354
+ this.mass = mass;
8355
+ this.frictionForce = 1e3 * frictionForce;
8356
+ }
8357
+ }
8358
+ var easeInOutCubic = (t) => {
8359
+ return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
8360
+ };
8361
+ var elId = 0;
8362
+ const _sfc_main$2 = {
8363
+ name: "loading-circle",
8364
+ props: {
8365
+ speed: {
8366
+ type: Number,
8367
+ default: 16
8368
+ },
8369
+ size: {
8370
+ type: Number,
8371
+ default: 20
8372
+ },
8373
+ color: {
8374
+ type: String,
8375
+ default: "#666"
8376
+ }
8377
+ },
8378
+ data() {
8379
+ elId += 1;
8380
+ var elID = "Uni_Load_Circle_".concat(elId);
8381
+ return {
8382
+ elId: elID,
8383
+ timer: 0
8384
+ };
8385
+ },
8386
+ computed: {
8387
+ iconsSize() {
8388
+ return this.size / 10 - 3;
8389
+ }
8390
+ },
8391
+ mounted() {
8392
+ this.init();
8393
+ },
8394
+ unmounted() {
8395
+ cancelAnimationFrame(this.timer);
8396
+ },
8397
+ methods: {
8398
+ /**
8399
+ * 初始化圆环
8400
+ */
8401
+ init() {
8402
+ var refs = this.$refs[this.elId];
8403
+ var ctx = refs.getDrawableContext();
8404
+ this.build_circular(ctx);
8405
+ },
8406
+ /**
8407
+ * 构建圆环动画
8408
+ */
8409
+ build_circular(ctx) {
8410
+ var startAngle = 0;
8411
+ var rotate = 0;
8412
+ var ARC_LENGTH = 359;
8413
+ var center = this.size / 2;
8414
+ var lineWidth = Math.floor(this.size / 12);
8415
+ var duration = 1200;
8416
+ var ARC_MAX = 358;
8417
+ var startTime = 0;
8418
+ var foreward_end = 0;
8419
+ var reversal_end = ARC_MAX;
8420
+ function pogress_time() {
8421
+ var currentTime = Date.now();
8422
+ var elapsedTime = currentTime - startTime;
8423
+ var progress2 = elapsedTime / duration;
8424
+ var easedProgress = easeInOutCubic(progress2);
8425
+ return easedProgress;
8426
+ }
8427
+ var draw = () => {
8428
+ };
8429
+ draw = () => {
8430
+ this.timer = requestAnimationFrame(draw);
8431
+ ctx.reset();
8432
+ ctx.beginPath();
8433
+ if (reversal_end == ARC_MAX) {
8434
+ foreward_end = Math.min(pogress_time() * ARC_LENGTH, ARC_LENGTH);
8435
+ if (foreward_end >= ARC_MAX) {
8436
+ reversal_end = 0;
8437
+ foreward_end = ARC_MAX;
8438
+ startTime = Date.now();
8439
+ }
8440
+ }
8441
+ if (foreward_end == ARC_MAX) {
8442
+ reversal_end = Math.min(pogress_time() * ARC_LENGTH, ARC_LENGTH);
8443
+ if (reversal_end >= ARC_MAX) {
8444
+ reversal_end = ARC_MAX;
8445
+ foreward_end = 0;
8446
+ startTime = Date.now();
8447
+ }
8448
+ }
8449
+ ctx.arc(center, center, center - lineWidth, startAngle + rotate + reversal_end * Math.PI / 180, startAngle + rotate + foreward_end * Math.PI / 180);
8450
+ ctx.lineWidth = lineWidth;
8451
+ var fillColor = (this.color !== "" ? this.color : "#666").toString();
8452
+ ctx.strokeStyle = fillColor;
8453
+ ctx.stroke();
8454
+ ctx.update();
8455
+ rotate += 0.05;
8456
+ };
8457
+ this.timer = requestAnimationFrame(draw);
8458
+ }
8459
+ }
8460
+ };
8461
+ const _style_0$2 = {
8462
+ "uni-loading-block": {
8463
+ "": {
8464
+ "width": 50,
8465
+ "height": 50
8466
+ }
8467
+ }
8468
+ };
8469
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
8470
+ return openBlock(), createElementBlock("view", {
8471
+ ref: $data.elId,
8472
+ class: "uni-loading-block",
8473
+ style: normalizeStyle({
8474
+ width: $props.size + "px",
8475
+ height: $props.size + "px"
8476
+ })
8477
+ }, null, 4);
8478
+ }
8479
+ const loadingCircle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["styles", [_style_0$2]]]);
8480
+ var DEFAULT_DISTANCE = 4;
8481
+ var FAST_SLIDE_LENGTH = 10;
8482
+ const _sfc_main$1 = {
8483
+ components: {
8484
+ loadingCircle
8485
+ },
8486
+ data() {
8487
+ return {
8488
+ imageMode: "aspectFit",
8489
+ lastTouchEndTime: 0,
8490
+ srcPath: "",
8491
+ imageView: null,
8492
+ screenWidth: 0,
8493
+ screenHeight: 0,
8494
+ /* 放大系数 */
8495
+ scaleSize: 1,
8496
+ /* 上次触摸事件 */
8497
+ lastSlideTouch: null,
8498
+ /* 图片竖向滑动的距离 */
8499
+ imageTop: 0,
8500
+ /* 图片横向滑动的距离 */
8501
+ imageMarginTop: 0,
8502
+ imageLeft: 0,
8503
+ /* 是否需要动画 */
8504
+ withAnimation: false,
8505
+ imageHeight: 0,
8506
+ historyX: [0, 0],
8507
+ historyY: [0, 0],
8508
+ historyT: [0, 0],
8509
+ _friction: new Friction(1, 2),
8510
+ requestId: -1,
8511
+ needExecLongPress: false,
8512
+ androidView: null,
8513
+ downPoint: null,
8514
+ longPressActionTimeoutId: -1,
8515
+ inScaleMode: false,
8516
+ inDoubleTapMode: false,
8517
+ startTimestamp: 0,
8518
+ clickTimeoutId: -1,
8519
+ transformOrigin: [0, 0],
8520
+ loadingFinished: false
8521
+ };
8522
+ },
8523
+ props: {
8524
+ "src": {
8525
+ type: String,
8526
+ default: ""
8527
+ },
8528
+ "index": {
8529
+ type: Number,
8530
+ default: -1
8531
+ },
8532
+ "longPressAction": {
8533
+ type: Object
8534
+ }
8535
+ },
8536
+ watch: {
8537
+ "src": {
8538
+ handler(newValue, oldValue) {
8539
+ if (newValue != "")
8540
+ this.getSrcLocalPath(newValue);
8541
+ },
8542
+ immediate: true
8543
+ }
8544
+ },
8545
+ mounted() {
8546
+ this.imageView = this.$refs["imageView"];
8547
+ this.getImageBound();
8548
+ },
8549
+ methods: {
8550
+ previewImageError(e) {
8551
+ uni.showToast({
8552
+ title: e.detail.errMsg,
8553
+ position: "bottom"
8554
+ });
8555
+ this.loadingFinished = true;
8556
+ },
8557
+ isNetPath(url) {
8558
+ if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("rtmp://") || url.startsWith("rtsp://")) {
8559
+ return true;
8560
+ }
8561
+ return false;
8562
+ },
8563
+ getSrcLocalPath(url) {
8564
+ this.srcPath = url;
8565
+ },
8566
+ onstart(e) {
8567
+ this.inScaleMode = false;
8568
+ this.withAnimation = false;
8569
+ cancelAnimationFrame(this.requestId);
8570
+ clearTimeout(this.clickTimeoutId);
8571
+ this.lastSlideTouch = e.touches;
8572
+ this.historyX = [0, 0];
8573
+ this.historyY = [0, 0];
8574
+ this.historyT = [0, 0];
8575
+ this.downPoint = {
8576
+ x: e.touches[0].clientX,
8577
+ y: e.touches[0].clientY
8578
+ };
8579
+ this.inDoubleTapMode = false;
8580
+ this.startTimestamp = e.timeStamp;
8581
+ this.needExecLongPress = true;
8582
+ this.longPressActionTimeoutId = setTimeout(() => {
8583
+ if (this.needExecLongPress) {
8584
+ this.onLongPressAction();
8585
+ }
8586
+ }, 350);
8587
+ },
8588
+ onmove(e) {
8589
+ if (e.touches.length == 1) {
8590
+ var currentSlideTouch = e.touches[0];
8591
+ if (this.lastSlideTouch != null) {
8592
+ var slideX = currentSlideTouch.clientX - this.lastSlideTouch[0].clientX;
8593
+ var slideY = currentSlideTouch.clientY - this.lastSlideTouch[0].clientY;
8594
+ var downX = Math.abs(currentSlideTouch.clientX - this.downPoint.x);
8595
+ var downY = Math.abs(currentSlideTouch.clientY - this.downPoint.y);
8596
+ if (downX > DEFAULT_DISTANCE || downY > DEFAULT_DISTANCE) {
8597
+ if (this.scaleSize > 1 || this.imageHeight > this.screenHeight) {
8598
+ this.imageLeft = this.imageLeft + slideX;
8599
+ this.imageTop = this.imageTop + slideY;
8600
+ this.updateStyle(e, currentSlideTouch.clientX, currentSlideTouch.clientY);
8601
+ } else {
8602
+ this.needExecLongPress = true;
8603
+ this.onInterceptTouchEvent(e);
8604
+ }
8605
+ this.historyX.shift();
8606
+ this.historyX.push(this.imageLeft);
8607
+ this.historyY.shift();
8608
+ this.historyY.push(this.imageTop);
8609
+ this.historyT.shift();
8610
+ this.historyT.push(e.timeStamp);
8611
+ this.lastSlideTouch = e.touches;
8612
+ this.needExecLongPress = false;
8613
+ } else {
8614
+ this.needExecLongPress = true;
8615
+ }
8616
+ } else {
8617
+ this.lastSlideTouch = e.touches;
8618
+ }
8619
+ } else if (e.touches.length >= 2) {
8620
+ this.inScaleMode = true;
8621
+ var currentFirstTouch = e.touches[0];
8622
+ var currentSecondTouch = e.touches[1];
8623
+ var currentXSlideLength = currentFirstTouch.clientX - currentSecondTouch.clientX;
8624
+ var currentYSlideLength = currentFirstTouch.clientY - currentSecondTouch.clientY;
8625
+ var currentLongSideLength = Math.sqrt(currentXSlideLength * currentXSlideLength + currentYSlideLength * currentYSlideLength);
8626
+ if (this.lastSlideTouch != null && this.lastSlideTouch.length >= 2) {
8627
+ var lastFirstTouch = this.lastSlideTouch[0];
8628
+ var lastSecondTouch = this.lastSlideTouch[1];
8629
+ var lastXSlideLength = lastFirstTouch.clientX - lastSecondTouch.clientX;
8630
+ var lastYSlideLength = lastFirstTouch.clientY - lastSecondTouch.clientY;
8631
+ var lastLongSideLength = Math.sqrt(lastXSlideLength * lastXSlideLength + lastYSlideLength * lastYSlideLength);
8632
+ if (currentLongSideLength != lastLongSideLength) {
8633
+ this.scaleSize = this.scaleSize * (currentLongSideLength / lastLongSideLength);
8634
+ this.updateStyle(e, NaN, NaN);
8635
+ }
8636
+ }
8637
+ this.preventDefaultScall(e);
8638
+ this.needExecLongPress = false;
8639
+ this.lastSlideTouch = e.touches;
8640
+ }
8641
+ },
8642
+ onend(e) {
8643
+ this.needExecLongPress = false;
8644
+ clearTimeout(this.longPressActionTimeoutId);
8645
+ var current = Date.now();
8646
+ if (this.historyY[0] == 0 && this.historyY[1] == 0 && this.historyX[0] == 0 && this.historyX[1] == 0) {
8647
+ this.withAnimation = true;
8648
+ if (current - this.lastTouchEndTime < 350) {
8649
+ if (this.lastSlideTouch != null && this.lastSlideTouch.length > 0) {
8650
+ var downX = Math.abs(this.lastSlideTouch[0].clientX - this.downPoint.x);
8651
+ var downY = Math.abs(this.lastSlideTouch[0].clientY - this.downPoint.y);
8652
+ if (downX > FAST_SLIDE_LENGTH || downY > FAST_SLIDE_LENGTH) {
8653
+ this.lastSlideTouch = null;
8654
+ return;
8655
+ }
8656
+ }
8657
+ if (this.scaleSize > 1) {
8658
+ this.scaleSize = 1;
8659
+ this.imageLeft = 0;
8660
+ this.updateStyle(e, NaN, NaN);
8661
+ } else if (this.scaleSize == 1) {
8662
+ this.scaleSize = 2;
8663
+ this.inDoubleTapMode = true;
8664
+ this.updateStyle(e, NaN, NaN);
8665
+ }
8666
+ } else if (e.touches.length == 0) {
8667
+ if (this.lastSlideTouch != null && this.lastSlideTouch.length == 1) {
8668
+ if (e.timeStamp - this.startTimestamp < 160) {
8669
+ if (this.lastSlideTouch != null) {
8670
+ var downX = Math.abs(this.lastSlideTouch[0].clientX - this.downPoint.x);
8671
+ var downY = Math.abs(this.lastSlideTouch[0].clientY - this.downPoint.y);
8672
+ if (downX < FAST_SLIDE_LENGTH && downY < FAST_SLIDE_LENGTH) {
8673
+ this.clickTimeoutId = setTimeout(() => {
8674
+ uni.$emit("__UNIPREVIEWIMAGECLOSE");
8675
+ }, 200);
8676
+ }
8677
+ } else {
8678
+ this.clickTimeoutId = setTimeout(() => {
8679
+ uni.$emit("__UNIPREVIEWIMAGECLOSE");
8680
+ }, 200);
8681
+ }
8682
+ }
8683
+ }
8684
+ if (this.scaleSize > 3) {
8685
+ this.scaleSize = 3;
8686
+ this.updateStyle(e, NaN, NaN);
8687
+ } else if (this.scaleSize < 1) {
8688
+ this.scaleSize = 1;
8689
+ this.imageLeft = 0;
8690
+ this.updateStyle(e, NaN, NaN);
8691
+ }
8692
+ this.lastTouchEndTime = current;
8693
+ }
8694
+ } else {
8695
+ if (this.inScaleMode) {
8696
+ if (this.scaleSize > 3) {
8697
+ this.scaleSize = 3;
8698
+ this.updateStyle(e, NaN, NaN);
8699
+ } else if (this.scaleSize < 1) {
8700
+ this.scaleSize = 1;
8701
+ this.imageLeft = 0;
8702
+ this.updateStyle(e, NaN, NaN);
8703
+ }
8704
+ this.lastTouchEndTime = current;
8705
+ }
8706
+ var xv = 1e3 * (this.historyX[1] - this.historyX[0]) / (this.historyT[1] - this.historyT[0]);
8707
+ var yv = 1e3 * (this.historyY[1] - this.historyY[0]) / (this.historyT[1] - this.historyT[0]);
8708
+ this._friction.setVelocity(xv, yv);
8709
+ this._friction.setStartPosition(this.imageLeft, this.imageTop);
8710
+ var x0 = this._friction.displacement().x;
8711
+ var y0 = this._friction.displacement().y;
8712
+ var x = this.imageLeft;
8713
+ if (!Number.isNaN(x0))
8714
+ x = x0 + this.imageLeft;
8715
+ var y = this.imageTop;
8716
+ if (!Number.isNaN(y0))
8717
+ y = y0 + this.imageTop;
8718
+ this._friction.setEndPosition(x, y);
8719
+ this.doTransform(() => {
8720
+ var p = this._friction.positionAtTime(null);
8721
+ if (Number.isNaN(p.x) && Number.isNaN(p.y)) {
8722
+ cancelAnimationFrame(this.requestId);
8723
+ }
8724
+ if (!Number.isNaN(p.x))
8725
+ this.imageLeft = p.x;
8726
+ if (!Number.isNaN(p.y))
8727
+ this.imageTop = p.y;
8728
+ this.updateStyle(e, NaN, NaN);
8729
+ });
8730
+ }
8731
+ this.lastSlideTouch = null;
8732
+ },
8733
+ oncancel(e) {
8734
+ this.onend(e);
8735
+ clearTimeout(this.clickTimeoutId);
8736
+ },
8737
+ doTransform(callback) {
8738
+ this.requestId = requestAnimationFrame(() => {
8739
+ callback();
8740
+ if (!this._friction.isDone())
8741
+ this.doTransform(callback);
8742
+ });
8743
+ },
8744
+ updateStyle(e, xDistance, yDistance) {
8745
+ var _this$imageView, _this$imageView2, _this$imageView3;
8746
+ this.caculatorTransformOrigin(e);
8747
+ if (1 < this.scaleSize) {
8748
+ var scrollWidthLength = this.screenWidth * (this.scaleSize - 1);
8749
+ var scrollRadio = this.transformOrigin[0] / this.screenWidth;
8750
+ if (this.imageLeft > scrollWidthLength * scrollRadio) {
8751
+ this.imageLeft = scrollWidthLength * scrollRadio;
8752
+ this.onInterceptTouchEvent(e);
8753
+ } else if (this.imageLeft < -(scrollWidthLength * (1 - scrollRadio))) {
8754
+ this.imageLeft = -(scrollWidthLength * (1 - scrollRadio));
8755
+ this.onInterceptTouchEvent(e);
8756
+ } else {
8757
+ this.preventDefaultScall(e);
8758
+ }
8759
+ } else {
8760
+ this.imageLeft = 0;
8761
+ this.onInterceptTouchEvent(e);
8762
+ }
8763
+ if (this.screenHeight < this.imageHeight * this.scaleSize) {
8764
+ var topMargin = (this.transformOrigin[1] - (this.imageMarginTop > 0 ? this.imageMarginTop : 0)) * this.scaleSize - this.transformOrigin[1];
8765
+ var bottomMargin = (this.imageHeight + (this.imageMarginTop > 0 ? this.imageMarginTop : 0) - this.transformOrigin[1]) * this.scaleSize - (this.screenHeight - this.transformOrigin[1]);
8766
+ if (this.imageTop > topMargin) {
8767
+ this.imageTop = topMargin;
8768
+ } else if (this.imageTop < -bottomMargin) {
8769
+ this.imageTop = -bottomMargin;
8770
+ } else {
8771
+ if (!Number.isNaN(yDistance) && Math.abs(yDistance - this.downPoint.y) > DEFAULT_DISTANCE) {
8772
+ this.preventDefaultScall(e);
8773
+ }
8774
+ }
8775
+ } else {
8776
+ if (!this.inScaleMode) {
8777
+ this.imageTop = 0;
8778
+ if (!Number.isNaN(yDistance) && Math.abs(yDistance - this.downPoint.y) > DEFAULT_DISTANCE) {
8779
+ this.preventDefaultScall(e);
8780
+ }
8781
+ } else {
8782
+ this.preventDefaultScall(e);
8783
+ }
8784
+ }
8785
+ (_this$imageView = this.imageView) === null || _this$imageView === void 0 || _this$imageView.style.setProperty("transition-duration", this.withAnimation ? "200ms" : "0ms");
8786
+ (_this$imageView2 = this.imageView) === null || _this$imageView2 === void 0 || _this$imageView2.style.setProperty("transform-origin", this.transformOrigin[0] + "px " + this.transformOrigin[1] + "px");
8787
+ (_this$imageView3 = this.imageView) === null || _this$imageView3 === void 0 || _this$imageView3.style.setProperty("transform", "translate(" + this.imageLeft + "px," + this.imageTop + "px) scale(" + this.scaleSize + ")");
8788
+ },
8789
+ onLongPressAction() {
8790
+ if (this.longPressAction != null && this.longPressAction.itemList.length > 0) {
8791
+ uni.showActionSheet({
8792
+ itemList: this.longPressAction.itemList,
8793
+ itemColor: this.longPressAction.itemColor,
8794
+ success: (e) => {
8795
+ uni.$emit("__UNIPREVIEWLONGPRESS", {
8796
+ type: "success",
8797
+ tapIndex: e.tapIndex,
8798
+ index: this.index
8799
+ });
8800
+ },
8801
+ fail() {
8802
+ uni.$emit("__UNIPREVIEWLONGPRESS", {
8803
+ type: "fail",
8804
+ tapIndex: -1,
8805
+ index: -1
8806
+ });
8807
+ }
8808
+ });
8809
+ }
8810
+ },
8811
+ onImageLoad(e) {
8812
+ if (this.screenHeight > 0 && this.screenWidth > 0) {
8813
+ this.caculatorImageSize(e.detail.width, e.detail.height);
8814
+ }
8815
+ this.loadingFinished = true;
8816
+ },
8817
+ caculatorImageSize(imageWidth, imageHeight) {
8818
+ var scaleImageSize = imageHeight / (imageWidth / this.screenWidth);
8819
+ if (scaleImageSize > this.screenHeight) {
8820
+ var _this$imageView4;
8821
+ this.imageHeight = scaleImageSize;
8822
+ this.imageMode = "aspectFill";
8823
+ (_this$imageView4 = this.imageView) === null || _this$imageView4 === void 0 || _this$imageView4.style.setProperty("height", scaleImageSize + "px");
8824
+ } else {
8825
+ this.imageMode = "aspectFit";
8826
+ }
8827
+ this.imageMarginTop = (this.screenHeight - scaleImageSize) / 2;
8828
+ this.imageHeight = scaleImageSize;
8829
+ },
8830
+ getImageBound() {
8831
+ if (this.imageHeight > 0) {
8832
+ return;
8833
+ }
8834
+ uni.createSelectorQuery().in(this).select(".uni-preview-image-item").boundingClientRect().exec((ret) => {
8835
+ if (ret.length == 1) {
8836
+ var rect = this.imageView.getBoundingClientRect();
8837
+ this.screenHeight = rect.height;
8838
+ this.screenWidth = rect.width;
8839
+ if (this.srcPath != "") {
8840
+ uni.getImageInfo({
8841
+ src: this.srcPath,
8842
+ success: (e) => {
8843
+ this.caculatorImageSize(e.width, e.height);
8844
+ },
8845
+ fail: () => {
8846
+ }
8847
+ });
8848
+ }
8849
+ }
8850
+ });
8851
+ },
8852
+ preventDefaultScall(e) {
8853
+ e === null || e === void 0 || e.preventDefault();
8854
+ e === null || e === void 0 || e.stopPropagation();
8855
+ },
8856
+ onInterceptTouchEvent(e) {
8857
+ if (this.inScaleMode) {
8858
+ this.preventDefaultScall(e);
8859
+ return;
8860
+ }
8861
+ clearTimeout(this.clickTimeoutId);
8862
+ },
8863
+ // 计算transform-origin主要代码
8864
+ caculatorTransformOrigin(e) {
8865
+ var originalCenterX;
8866
+ var originalCenterY;
8867
+ if (e != null) {
8868
+ if (e.touches.length >= 2) {
8869
+ var point1 = e.touches[0];
8870
+ var point2 = e.touches[1];
8871
+ originalCenterX = (point1.clientX + point2.clientX) / 2;
8872
+ originalCenterY = (point1.clientY + point2.clientY) / 2;
8873
+ if (this.scaleSize * this.imageHeight < this.screenHeight) {
8874
+ originalCenterY = this.screenHeight / 2;
8875
+ }
8876
+ if (this.imageHeight > this.screenHeight && this.scaleSize >= 1) {
8877
+ originalCenterY = originalCenterY - this.imageTop / this.scaleSize;
8878
+ }
8879
+ var oldTransformOrigin = [this.transformOrigin[0], this.transformOrigin[1]];
8880
+ this.transformOrigin = [originalCenterX, originalCenterY];
8881
+ if (oldTransformOrigin[0] != 0 && oldTransformOrigin[1] != 1) {
8882
+ this.imageLeft = this.imageLeft + (this.scaleSize - 1) * (originalCenterX - oldTransformOrigin[0]);
8883
+ this.imageTop = this.imageTop + (this.scaleSize - 1) * (originalCenterY - oldTransformOrigin[1]);
8884
+ }
8885
+ } else if (e.type == "touchend") {
8886
+ if (this.inDoubleTapMode && this.scaleSize == 2 && this.lastSlideTouch != null && this.lastSlideTouch.length == 1) {
8887
+ originalCenterX = this.lastSlideTouch[0].clientX;
8888
+ originalCenterY = this.lastSlideTouch[0].clientY;
8889
+ if (this.scaleSize * this.imageHeight < this.screenHeight) {
8890
+ originalCenterY = this.screenHeight / 2;
8891
+ }
8892
+ if (this.imageHeight > this.screenHeight) {
8893
+ originalCenterY = originalCenterY - this.imageTop;
8894
+ }
8895
+ this.transformOrigin = [originalCenterX, originalCenterY];
8896
+ this.imageLeft = this.imageLeft + (this.scaleSize - 1) * (originalCenterX - this.transformOrigin[0]);
8897
+ this.imageTop = this.imageTop + (this.scaleSize - 1) * (originalCenterY - this.transformOrigin[1]);
8898
+ }
8899
+ }
8900
+ }
8901
+ }
8902
+ }
8903
+ };
8904
+ const _style_0$1 = {
8905
+ "uni-preview-image-item": {
8906
+ "": {
8907
+ "width": "100%",
8908
+ "height": "100%",
8909
+ "transitionProperty": "transform",
8910
+ "transitionDuration": "0ms"
8911
+ }
8912
+ },
8913
+ "uni-preview-image-patch": {
8914
+ "": {
8915
+ "width": "100%",
8916
+ "height": "100%",
8917
+ "backgroundColor": "rgba(0,0,0,0)",
8918
+ "position": "absolute"
8919
+ }
8920
+ },
8921
+ "uni-preview-image-loading": {
8922
+ "": {
8923
+ "position": "absolute",
8924
+ "top": 0,
8925
+ "bottom": 0,
8926
+ "left": 0,
8927
+ "right": 0,
8928
+ "pointerEvents": "none"
8929
+ }
8930
+ },
8931
+ "@TRANSITION": {
8932
+ "uni-preview-image-item": {
8933
+ "property": "transform",
8934
+ "duration": "0ms"
8935
+ }
8936
+ }
8937
+ };
8938
+ var _hoisted_1$1 = {
8939
+ style: {
8940
+ "flex": "1",
8941
+ "background-color": "black"
8942
+ }
8943
+ };
8944
+ var _hoisted_2$1 = ["mode", "src"];
8945
+ var _hoisted_3$1 = {
8946
+ key: 0,
8947
+ class: "uni-preview-image-loading"
8948
+ };
8949
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
8950
+ var _component_loadingCircle = resolveComponent("loadingCircle");
8951
+ return openBlock(), createElementBlock("view", _hoisted_1$1, [createElementVNode("image", {
8952
+ ref: "imageView",
8953
+ mode: $data.imageMode,
8954
+ class: "uni-preview-image-item",
8955
+ src: $data.srcPath,
8956
+ onError: _cache[0] || (_cache[0] = function() {
8957
+ return $options.previewImageError && $options.previewImageError(...arguments);
8958
+ }),
8959
+ onLoad: _cache[1] || (_cache[1] = function() {
8960
+ return $options.onImageLoad && $options.onImageLoad(...arguments);
8961
+ })
8962
+ }, null, 40, _hoisted_2$1), createElementVNode("view", {
8963
+ ref: "mask",
8964
+ class: "uni-preview-image-patch",
8965
+ onTouchstart: _cache[2] || (_cache[2] = function() {
8966
+ return $options.onstart && $options.onstart(...arguments);
8967
+ }),
8968
+ onTouchmove: _cache[3] || (_cache[3] = function() {
8969
+ return $options.onmove && $options.onmove(...arguments);
8970
+ }),
8971
+ onTouchend: _cache[4] || (_cache[4] = function() {
8972
+ return $options.onend && $options.onend(...arguments);
8973
+ }),
8974
+ onTouchcancel: _cache[5] || (_cache[5] = function() {
8975
+ return $options.oncancel && $options.oncancel(...arguments);
8976
+ })
8977
+ }, null, 544), !$data.loadingFinished ? (openBlock(), createElementBlock("view", _hoisted_3$1, [createVNode(_component_loadingCircle, {
8978
+ style: {
8979
+ "margin": "auto"
8980
+ },
8981
+ speed: 16,
8982
+ size: 54,
8983
+ color: "#d3d3d3"
8984
+ })])) : createCommentVNode("", true)]);
8985
+ }
8986
+ const uniPreviewImageItem = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["styles", [_style_0$1]]]);
8987
+ const _sfc_main = {
8988
+ components: {
8989
+ uniPreviewImageItem
8990
+ },
8991
+ data() {
8992
+ return {
8993
+ urls: null,
8994
+ current: 0,
8995
+ loop: false,
8996
+ disableTouch: false,
8997
+ numberIndicator: "",
8998
+ indicator: "number",
8999
+ longPressAction: null
9000
+ };
9001
+ },
9002
+ onLoad() {
9003
+ uni.$once("__onPreviewLoadCallback", this.__onPreviewLoadCallback);
9004
+ uni.$emit("__onPreviewLoad", null);
9005
+ uni.$on("__UNIPREVIEWIMAGE", this.setDisableTouch);
9006
+ uni.$on("__UNIPREVIEWIMAGECLOSE", this.closePreviewPage);
9007
+ uni.$on("__CLOSEPREVIEWIMAGE", () => {
9008
+ this.closePreviewPage();
9009
+ });
9010
+ },
9011
+ onReady() {
9012
+ var _this$$refs$numberInd, _this$$refs$defaultIn;
9013
+ var windowInfo = uni.getWindowInfo();
9014
+ (_this$$refs$numberInd = this.$refs["numberIndicator"]) === null || _this$$refs$numberInd === void 0 || _this$$refs$numberInd.style.setProperty("top", windowInfo.statusBarHeight + 8 + "px");
9015
+ (_this$$refs$defaultIn = this.$refs["defaultIndicator"]) === null || _this$$refs$defaultIn === void 0 || _this$$refs$defaultIn.style.setProperty("bottom", windowInfo.screenHeight - windowInfo.safeArea.bottom + 8 + "px");
9016
+ },
9017
+ onUnload() {
9018
+ uni.$off("__UNIPREVIEWIMAGE");
9019
+ uni.$off("__UNIPREVIEWIMAGECLOSE");
9020
+ uni.$off("__UNIPREVIEWLONGPRESS");
9021
+ uni.$off("__CLOSEPREVIEWIMAGE");
9022
+ },
9023
+ onBackPress(options) {
9024
+ return false;
9025
+ },
9026
+ methods: {
9027
+ __onPreviewLoadCallback(result) {
9028
+ this.urls = result["urls"];
9029
+ if (result["current"] != null) {
9030
+ var c = result["current"];
9031
+ if (typeof c == "number") {
9032
+ var d = c;
9033
+ if (d < 0 || d > this.urls.length)
9034
+ d = 0;
9035
+ this.current = d;
9036
+ } else if (typeof c == "string") {
9037
+ var index2 = this.urls.indexOf(c);
9038
+ if (index2 < 0) {
9039
+ index2 = 0;
9040
+ }
9041
+ this.current = index2;
9042
+ }
9043
+ }
9044
+ if (result["indicator"] != null) {
9045
+ this.indicator = result["indicator"];
9046
+ }
9047
+ if (result["longPressActions"] != null) {
9048
+ this.longPressAction = {
9049
+ itemList: result["longPressActions"]["itemList"],
9050
+ itemColor: result["longPressActions"]["itemColor"]
9051
+ };
9052
+ }
9053
+ if (result["loop"] != null) {
9054
+ this.loop = result["loop"];
9055
+ }
9056
+ this.numberIndicator = this.current + 1 + " / " + this.urls.length;
9057
+ },
9058
+ onPreviewImageChanged(e) {
9059
+ var _this$urls;
9060
+ this.numberIndicator = e.detail.current + 1 + " / " + ((_this$urls = this.urls) === null || _this$urls === void 0 ? void 0 : _this$urls.length);
9061
+ this.current = e.detail.current;
9062
+ },
9063
+ setDisableTouch(isDisable) {
9064
+ },
9065
+ closePreviewPage() {
9066
+ uni.closeDialogPage({
9067
+ dialogPage: this.$page,
9068
+ animationType: "fade-out"
9069
+ });
9070
+ }
9071
+ }
9072
+ };
9073
+ const _style_0 = {
9074
+ "uni-preview-image-indicator-style": {
9075
+ "": {
9076
+ "width": 9,
9077
+ "height": 9,
9078
+ "borderTopStyle": "solid",
9079
+ "borderRightStyle": "solid",
9080
+ "borderBottomStyle": "solid",
9081
+ "borderLeftStyle": "solid",
9082
+ "borderTopLeftRadius": 9,
9083
+ "borderTopRightRadius": 9,
9084
+ "borderBottomRightRadius": 9,
9085
+ "borderBottomLeftRadius": 9,
9086
+ "marginTop": 2,
9087
+ "marginRight": 3,
9088
+ "marginBottom": 2,
9089
+ "marginLeft": 3,
9090
+ "borderTopWidth": 0.1,
9091
+ "borderRightWidth": 0.1,
9092
+ "borderBottomWidth": 0.1,
9093
+ "borderLeftWidth": 0.1,
9094
+ "borderTopColor": "#AAAAAA",
9095
+ "borderRightColor": "#AAAAAA",
9096
+ "borderBottomColor": "#AAAAAA",
9097
+ "borderLeftColor": "#AAAAAA"
9098
+ }
9099
+ },
9100
+ "uni-preview-image-default-indicator": {
9101
+ "": {
9102
+ "flexDirection": "row",
9103
+ "position": "absolute",
9104
+ "bottom": 0,
9105
+ "left": 0,
9106
+ "right": 0,
9107
+ "justifyContent": "center"
9108
+ }
9109
+ },
9110
+ "uni-preview-image-number-indicator": {
9111
+ "": {
9112
+ "position": "absolute",
9113
+ "left": 0,
9114
+ "right": 0
9115
+ }
9116
+ },
9117
+ "uni-preview-image-number-indicator-text": {
9118
+ "": {
9119
+ "color": "#FFFFFF",
9120
+ "fontSize": 16,
9121
+ "marginTop": "auto",
9122
+ "marginRight": "auto",
9123
+ "marginBottom": "auto",
9124
+ "marginLeft": "auto",
9125
+ "paddingTop": 8,
9126
+ "paddingRight": 20,
9127
+ "paddingBottom": 8,
9128
+ "paddingLeft": 20,
9129
+ "backgroundColor": "rgba(0,0,0,0.3)",
9130
+ "lineHeight": 1,
9131
+ "borderTopStyle": "solid",
9132
+ "borderRightStyle": "solid",
9133
+ "borderBottomStyle": "solid",
9134
+ "borderLeftStyle": "solid",
9135
+ "borderTopWidth": 0,
9136
+ "borderRightWidth": 0,
9137
+ "borderBottomWidth": 0,
9138
+ "borderLeftWidth": 0,
9139
+ "borderTopLeftRadius": 32,
9140
+ "borderTopRightRadius": 32,
9141
+ "borderBottomRightRadius": 32,
9142
+ "borderBottomLeftRadius": 32
9143
+ }
9144
+ }
9145
+ };
9146
+ var _hoisted_1 = ["circular", "current", "disable-touch"];
9147
+ var _hoisted_2 = {
9148
+ key: 0,
9149
+ ref: "numberIndicator",
9150
+ class: "uni-preview-image-number-indicator"
9151
+ };
9152
+ var _hoisted_3 = {
9153
+ class: "uni-preview-image-number-indicator-text"
9154
+ };
9155
+ var _hoisted_4 = {
9156
+ key: 1,
9157
+ ref: "defaultIndicator",
9158
+ class: "uni-preview-image-default-indicator"
9159
+ };
9160
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
9161
+ var _component_uniPreviewImageItem = resolveComponent("uniPreviewImageItem");
9162
+ return openBlock(), createElementBlock(Fragment, null, [createElementVNode("swiper", {
9163
+ style: {
9164
+ "flex": "1",
9165
+ "background-color": "black"
9166
+ },
9167
+ "indicator-dots": false,
9168
+ circular: $data.loop,
9169
+ current: $data.current,
9170
+ onChange: _cache[0] || (_cache[0] = function() {
9171
+ return $options.onPreviewImageChanged && $options.onPreviewImageChanged(...arguments);
9172
+ }),
9173
+ "disable-touch": $data.disableTouch
9174
+ }, [$data.urls != null ? (openBlock(true), createElementBlock(Fragment, {
9175
+ key: 0
9176
+ }, renderList($data.urls, (item, index2) => {
9177
+ return openBlock(), createElementBlock("swiper-item", null, [createVNode(_component_uniPreviewImageItem, {
9178
+ index: index2,
9179
+ src: item,
9180
+ longPressAction: $data.longPressAction
9181
+ }, null, 8, ["index", "src", "longPressAction"])]);
9182
+ }), 256)) : createCommentVNode("", true)], 40, _hoisted_1), $data.indicator == "number" ? (openBlock(), createElementBlock("view", _hoisted_2, [createElementVNode("text", _hoisted_3, toDisplayString($data.numberIndicator), 1)], 512)) : createCommentVNode("", true), $data.indicator == "default" ? withDirectives((openBlock(), createElementBlock("view", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList($data.urls.length, (i) => {
9183
+ return openBlock(), createElementBlock("view", {
9184
+ class: "uni-preview-image-indicator-style",
9185
+ style: normalizeStyle({
9186
+ backgroundColor: $data.current + 1 == i ? "#ffffff" : "#AAAAAA"
9187
+ })
9188
+ }, null, 4);
9189
+ }), 256))], 512)), [[vShow, $data.urls != null]]) : createCommentVNode("", true)], 64);
9190
+ }
9191
+ const UniPreviewImagePage = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]]]);
9192
+ function registerSystemPages() {
9193
+ registerSystemRoute("uni:actionSheet", UniActionSheetPage, {
9194
+ disableSwipeBack: false
9195
+ });
9196
+ registerSystemRoute("uni:chooseLocation", UniChooseLocationPage, {
9197
+ disableSwipeBack: false
9198
+ });
9199
+ registerSystemRoute("uni:uniModal", UniUniModalPage, {
9200
+ disableSwipeBack: false
9201
+ });
9202
+ registerSystemRoute("uni:previewImage", UniPreviewImagePage, {
7753
9203
  disableSwipeBack: false
7754
9204
  });
7755
9205
  }