@dcloudio/uni-app-plus 3.0.0-alpha-4070620250731002 → 3.0.0-alpha-4080120250820001

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
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, ON_EXIT, ON_LAST_PAGE_BACK_PRESS } from "@dcloudio/uni-shared";
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, watchEffect, watch, computed, camelize, reactive, provide, inject, nextTick } from "vue";
2
+ import { extend, isString, isPlainObject, isFunction as isFunction$1, isArray, isPromise, hasOwn, remove, invokeArrayFns as invokeArrayFns$1, capitalize, toTypeString, toRawType } from "@vue/shared";
3
+ import { createMountPage, unmountPage, ref, onMounted, onBeforeUnmount, getCurrentGenericInstance, injectHook, defineComponent, getCurrentInstance, camelize, createVNode, renderSlot } from "vue";
4
4
  function get$pageByPage(page) {
5
5
  return page.vm.$basePage;
6
6
  }
@@ -178,10 +178,35 @@ function dialogPageTriggerParentLifeCycle(dialogPage, lifeCycle) {
178
178
  invokeHook(currentPage.vm, lifeCycle);
179
179
  }
180
180
  function getSystemDialogPages(parentPage) {
181
+ if (!parentPage)
182
+ return [];
181
183
  {
182
- var _parentPage$vm$$syste;
183
- return ((_parentPage$vm$$syste = parentPage.vm.$systemDialogPages) === null || _parentPage$vm$$syste === void 0 ? void 0 : _parentPage$vm$$syste.value) || [];
184
+ return typeof parentPage.__$$getSystemDialogPages === "undefined" ? parentPage.$getSystemDialogPages() : parentPage.__$$getSystemDialogPages();
185
+ }
186
+ }
187
+ function dialogPageTriggerPrevDialogPageLifeCycle(parentPage, lifeCycle) {
188
+ if (!parentPage)
189
+ return;
190
+ var pages2 = getCurrentPages();
191
+ var currentPage = pages2[pages2.length - 1];
192
+ if (!currentPage || parentPage !== currentPage)
193
+ return;
194
+ var dialogPages = currentPage.getDialogPages();
195
+ var systemDialogPage = getSystemDialogPages(parentPage);
196
+ var lastSystemDialogPage = systemDialogPage[systemDialogPage.length - 1];
197
+ var lastDialogPage = dialogPages[dialogPages.length - 1];
198
+ var prevDialogPage;
199
+ if (!lastDialogPage) {
200
+ prevDialogPage = lastSystemDialogPage;
201
+ } else if (!lastSystemDialogPage) {
202
+ prevDialogPage = lastDialogPage;
203
+ } else {
204
+ var _lastSystemDialogPage, _lastDialogPage$vm;
205
+ var lastSystemDialogPageId = ((_lastSystemDialogPage = lastSystemDialogPage.vm) === null || _lastSystemDialogPage === void 0 || (_lastSystemDialogPage = _lastSystemDialogPage.$basePage) === null || _lastSystemDialogPage === void 0 ? void 0 : _lastSystemDialogPage.id) || Number.MAX_SAFE_INTEGER;
206
+ var lastDialogPageId = ((_lastDialogPage$vm = lastDialogPage.vm) === null || _lastDialogPage$vm === void 0 || (_lastDialogPage$vm = _lastDialogPage$vm.$basePage) === null || _lastDialogPage$vm === void 0 ? void 0 : _lastDialogPage$vm.id) || Number.MAX_SAFE_INTEGER;
207
+ prevDialogPage = lastSystemDialogPageId > lastDialogPageId ? lastSystemDialogPage : lastDialogPage;
184
208
  }
209
+ prevDialogPage && invokeHook(prevDialogPage.vm, lifeCycle);
185
210
  }
186
211
  function initPageVm(pageVm, page) {
187
212
  pageVm.route = page.route;
@@ -623,27 +648,13 @@ function initVueApp(appVm) {
623
648
  }
624
649
  });
625
650
  var appContext = internalInstance.appContext;
651
+ var mountPage = createMountPage(appContext);
626
652
  vueApp = extend(appContext.app, {
627
653
  mountPage(pageComponent, pageProps, pageContainer) {
628
- var vnode = createVNode(pageComponent, pageProps);
629
- vnode.appContext = appContext;
630
- vnode.__page_container__ = pageContainer;
631
- render(vnode, pageContainer);
632
- var publicThis = vnode.component.proxy;
633
- publicThis.__page_container__ = pageContainer;
634
- return publicThis;
654
+ return mountPage(pageComponent, pageProps, pageContainer);
635
655
  },
636
656
  unmountPage: (pageInstance) => {
637
- var {
638
- __page_container__
639
- } = pageInstance;
640
- if (__page_container__) {
641
- __page_container__.isUnmounted = true;
642
- render(null, __page_container__);
643
- delete pageInstance.__page_container__;
644
- var vnode = pageInstance.$.vnode;
645
- delete vnode.__page_container__;
646
- }
657
+ unmountPage(pageInstance);
647
658
  }
648
659
  });
649
660
  }
@@ -717,7 +728,9 @@ function initLaunchOptions(_ref2) {
717
728
  var {
718
729
  path,
719
730
  query,
720
- referrerInfo
731
+ referrerInfo,
732
+ appScheme,
733
+ appLink
721
734
  } = _ref2;
722
735
  extend(launchOptions$1, {
723
736
  path,
@@ -725,7 +738,9 @@ function initLaunchOptions(_ref2) {
725
738
  referrerInfo: referrerInfo || {},
726
739
  // TODO uni-app x
727
740
  channel: void 0,
728
- launcher: void 0
741
+ launcher: void 0,
742
+ appScheme,
743
+ appLink
729
744
  });
730
745
  extend(enterOptions$1, launchOptions$1);
731
746
  return enterOptions$1;
@@ -774,7 +789,7 @@ function setupXPage(instance, pageInstance, pageVm, pageId, pagePath) {
774
789
  });
775
790
  uniPage.getElementById = (id2) => {
776
791
  var _pageVm$$el;
777
- var containerNode = (_pageVm$$el = pageVm.$el) === null || _pageVm$$el === void 0 ? void 0 : _pageVm$$el._parent;
792
+ var containerNode = (_pageVm$$el = pageVm.$el) === null || _pageVm$$el === void 0 ? void 0 : _pageVm$$el.parentElement;
778
793
  if (containerNode == null) {
779
794
  console.warn("bodyNode is null");
780
795
  return null;
@@ -788,41 +803,46 @@ function setupXPage(instance, pageInstance, pageVm, pageId, pagePath) {
788
803
  }
789
804
  onMounted(() => {
790
805
  var _pageVm$$el2;
791
- var rootElement = (_pageVm$$el2 = pageVm.$el) === null || _pageVm$$el2 === void 0 ? void 0 : _pageVm$$el2._parent;
806
+ var rootElement = (_pageVm$$el2 = pageVm.$el) === null || _pageVm$$el2 === void 0 ? void 0 : _pageVm$$el2.parentElement;
792
807
  if (rootElement) {
793
808
  rootElement._page = pageVm.$page;
794
809
  }
795
810
  });
796
811
  onBeforeUnmount(() => {
797
812
  var _pageVm$$el3;
798
- var rootElement = (_pageVm$$el3 = pageVm.$el) === null || _pageVm$$el3 === void 0 ? void 0 : _pageVm$$el3._parent;
813
+ var rootElement = (_pageVm$$el3 = pageVm.$el) === null || _pageVm$$el3 === void 0 ? void 0 : _pageVm$$el3.parentElement;
799
814
  if (rootElement) {
800
815
  rootElement._page = null;
801
816
  }
802
817
  });
803
818
  }
819
+ var beforeSetupPage = (props, ctx) => {
820
+ var {
821
+ attrs: {
822
+ __pageId,
823
+ __pagePath,
824
+ /*__pageQuery,*/
825
+ __pageInstance
826
+ }
827
+ } = ctx;
828
+ var instance = getCurrentGenericInstance();
829
+ var pageVm = instance.proxy;
830
+ initPageVm(pageVm, __pageInstance);
831
+ {
832
+ setupXPage(instance, __pageInstance, pageVm, __pageId, __pagePath);
833
+ }
834
+ };
804
835
  function setupPage(component) {
805
- var oldSetup = component.setup;
806
- component.inheritAttrs = false;
807
- component.setup = (props, ctx) => {
808
- var {
809
- attrs: {
810
- __pageId,
811
- __pagePath,
812
- /*__pageQuery,*/
813
- __pageInstance
836
+ if (!component.__vapor) {
837
+ var oldSetup = component.setup;
838
+ component.inheritAttrs = false;
839
+ component.setup = (props, ctx) => {
840
+ beforeSetupPage(props, ctx);
841
+ if (oldSetup) {
842
+ return oldSetup(props, ctx);
814
843
  }
815
- } = ctx;
816
- var instance = getCurrentInstance();
817
- var pageVm = instance.proxy;
818
- initPageVm(pageVm, __pageInstance);
819
- {
820
- setupXPage(instance, __pageInstance, pageVm, __pageId, __pagePath);
821
- }
822
- if (oldSetup) {
823
- return oldSetup(props, ctx);
824
- }
825
- };
844
+ };
845
+ }
826
846
  return component;
827
847
  }
828
848
  function initScope(pageId, vm, pageInstance) {
@@ -864,7 +884,7 @@ function definePage(pagePath, asyncComponent) {
864
884
  function createPageFactory(component) {
865
885
  return () => {
866
886
  if (isVuePageAsyncComponent(component)) {
867
- return component().then((component2) => setupPage(clonedPageComponent(component2)));
887
+ return component().then((component2) => setupPage(clonedPageComponent(component2.default || component2)));
868
888
  }
869
889
  return setupPage(clonedPageComponent(component));
870
890
  };
@@ -1515,12 +1535,13 @@ function createTab(path, query, callback) {
1515
1535
  url: path,
1516
1536
  path,
1517
1537
  query,
1518
- openType: "switchTab"
1538
+ openType: "switchTab",
1539
+ onRegistered() {
1540
+ var page = getCurrentPage().vm;
1541
+ tabBar0.appendItem(page.$basePage.id.toString());
1542
+ callback(page);
1543
+ }
1519
1544
  });
1520
- callback === null || callback === void 0 || callback();
1521
- var page = getCurrentPage().vm;
1522
- tabBar0.appendItem(page.$basePage.id.toString());
1523
- return page;
1524
1545
  }
1525
1546
  function findTabPage(path) {
1526
1547
  var _tabs$get;
@@ -1559,10 +1580,13 @@ function getTabPage(path) {
1559
1580
  var isFirst = false;
1560
1581
  if (page === null || rebuild) {
1561
1582
  isFirst = true;
1562
- page = createTab(path, query, callback);
1563
- tabs.set(path, page);
1583
+ createTab(path, query, (page2) => {
1584
+ tabs.set(path, page2);
1585
+ callback(new TabPageInfo(page2, isFirst));
1586
+ });
1587
+ } else {
1588
+ callback(new TabPageInfo(page, isFirst));
1564
1589
  }
1565
- return new TabPageInfo(page, isFirst);
1566
1590
  }
1567
1591
  function switchSelect(selected, path) {
1568
1592
  var _getCurrentPage;
@@ -1576,20 +1600,22 @@ function switchSelect(selected, path) {
1576
1600
  var currentPage = (_getCurrentPage = getCurrentPage()) === null || _getCurrentPage === void 0 ? void 0 : _getCurrentPage.vm;
1577
1601
  var type = currentPage == null ? "appLaunch" : "switchTab";
1578
1602
  invokeBeforeRouteHooks(type);
1579
- var pageInfo = getTabPage(getRealPath(path, true), query, rebuild, callback);
1580
- var page = pageInfo.page;
1581
- if (currentPage !== page) {
1582
- shouldShow = true;
1583
- if (currentPage && isTabPage(currentPage)) {
1584
- invokeHook(currentPage, ON_HIDE);
1603
+ getTabPage(getRealPath(path, true), query, rebuild, (pageInfo) => {
1604
+ callback === null || callback === void 0 || callback();
1605
+ var page = pageInfo.page;
1606
+ if (currentPage !== page) {
1607
+ shouldShow = true;
1608
+ if (currentPage && isTabPage(currentPage)) {
1609
+ invokeHook(currentPage, ON_HIDE);
1610
+ }
1585
1611
  }
1586
- }
1587
- tabBar0.switchSelect(page.$basePage.id.toString(), selected);
1588
- if (shouldShow) {
1589
- invokeHook(page, ON_SHOW);
1590
- }
1591
- selected0 = selected;
1592
- invokeAfterRouteHooks(type);
1612
+ tabBar0.switchSelect(page.$basePage.id.toString(), selected);
1613
+ if (shouldShow) {
1614
+ invokeHook(page, ON_SHOW);
1615
+ }
1616
+ selected0 = selected;
1617
+ invokeAfterRouteHooks(type);
1618
+ });
1593
1619
  }
1594
1620
  var APP_THEME_AUTO = "auto";
1595
1621
  var THEME_KEY_PREFIX = "@";
@@ -1713,14 +1739,14 @@ function useTheme() {
1713
1739
  function setStatusBarStyle() {
1714
1740
  var page;
1715
1741
  {
1716
- var _currentPage$vm;
1717
1742
  var currentPage = getCurrentPage();
1718
1743
  var dialogPages = currentPage === null || currentPage === void 0 ? void 0 : currentPage.getDialogPages();
1719
- var systemDialogPages = currentPage === null || currentPage === void 0 || (_currentPage$vm = currentPage.vm) === null || _currentPage$vm === void 0 || (_currentPage$vm = _currentPage$vm.$systemDialogPages) === null || _currentPage$vm === void 0 ? void 0 : _currentPage$vm.value;
1744
+ var systemDialogPages = getSystemDialogPages(currentPage);
1720
1745
  if (systemDialogPages !== null && systemDialogPages !== void 0 && systemDialogPages.length && dialogPages !== null && dialogPages !== void 0 && dialogPages.length) {
1721
1746
  var lastSystemDialogPage = systemDialogPages[systemDialogPages.length - 1];
1722
1747
  var lastDialogPage = dialogPages[dialogPages.length - 1];
1723
- page = Number(lastSystemDialogPage.__nativePageId) > Number(lastDialogPage.__nativePageId) ? lastSystemDialogPage.vm : lastDialogPage.vm;
1748
+ page = // @ts-expect-error
1749
+ Number(lastSystemDialogPage.__nativePageId) > Number(lastDialogPage.__nativePageId) ? lastSystemDialogPage.vm : lastDialogPage.vm;
1724
1750
  } else if (dialogPages !== null && dialogPages !== void 0 && dialogPages.length) {
1725
1751
  page = dialogPages[dialogPages.length - 1].vm;
1726
1752
  } else if (systemDialogPages !== null && systemDialogPages !== void 0 && systemDialogPages.length) {
@@ -1762,26 +1788,28 @@ var closeDialogPage = (options) => {
1762
1788
  }
1763
1789
  var parentPage = dialogPage.getParentPage();
1764
1790
  if (!isSystemDialogPage(dialogPage)) {
1765
- if (parentPage && currentPages.indexOf(parentPage) !== -1) {
1791
+ if (parentPage && (isTabPage(parentPage.vm) || currentPages.indexOf(parentPage) !== -1)) {
1766
1792
  var parentDialogPages = parentPage.getDialogPages();
1767
1793
  var index2 = parentDialogPages.indexOf(dialogPage);
1768
1794
  closeNativeDialogPage(dialogPage, (options === null || options === void 0 ? void 0 : options.animationType) || "auto", (options === null || options === void 0 ? void 0 : options.animationDuration) || ANI_DURATION);
1769
1795
  parentDialogPages.splice(index2, 1);
1770
- if (index2 > 0 && index2 === parentDialogPages.length) {
1771
- invokeHook(parentDialogPages[parentDialogPages.length - 1].vm, ON_SHOW);
1796
+ if (index2 === parentDialogPages.length) {
1797
+ dialogPageTriggerPrevDialogPageLifeCycle(parentPage, ON_SHOW);
1772
1798
  }
1773
1799
  } else {
1774
1800
  triggerFailCallback$1(options, "dialogPage is not a valid page");
1775
1801
  return;
1776
1802
  }
1777
1803
  } else {
1778
- var _parentPage$vm;
1779
- var systemDialogPages = parentPage === null || parentPage === void 0 || (_parentPage$vm = parentPage.vm) === null || _parentPage$vm === void 0 || (_parentPage$vm = _parentPage$vm.$systemDialogPages) === null || _parentPage$vm === void 0 ? void 0 : _parentPage$vm.value;
1804
+ var systemDialogPages = getSystemDialogPages(parentPage);
1780
1805
  if (systemDialogPages) {
1781
1806
  var _index = systemDialogPages.indexOf(dialogPage);
1782
1807
  if (_index > -1) {
1783
- systemDialogPages.splice(_index, 1);
1784
1808
  closeNativeDialogPage(dialogPage, (options === null || options === void 0 ? void 0 : options.animationType) || "auto", (options === null || options === void 0 ? void 0 : options.animationDuration) || ANI_DURATION);
1809
+ systemDialogPages.splice(_index, 1);
1810
+ if (_index === systemDialogPages.length) {
1811
+ dialogPageTriggerPrevDialogPageLifeCycle(parentPage, ON_SHOW);
1812
+ }
1785
1813
  } else {
1786
1814
  triggerFailCallback$1(options, "dialogPage is not a valid page");
1787
1815
  }
@@ -1862,7 +1890,8 @@ function registerPage(_ref, onCreated) {
1862
1890
  openType,
1863
1891
  webview,
1864
1892
  nvuePageVm,
1865
- eventChannel
1893
+ eventChannel,
1894
+ onRegistered
1866
1895
  } = _ref;
1867
1896
  var delay = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
1868
1897
  var id2 = genWebviewId();
@@ -1886,73 +1915,73 @@ function registerPage(_ref, onCreated) {
1886
1915
  // TODO ThemeMode
1887
1916
  "light"
1888
1917
  );
1918
+ function handleHomeDialogPages(homePage, sourceDialogPages, targetDialogPages) {
1919
+ sourceDialogPages.forEach((dialogPage) => {
1920
+ dialogPage.getParentPage = () => homePage;
1921
+ targetDialogPages.push(dialogPage);
1922
+ });
1923
+ sourceDialogPages.length = 0;
1924
+ }
1889
1925
  function fn() {
1890
- var page = createVuePage(id2, route, query, pageInstance, {}, nativePage);
1891
- var pages2 = getCurrentPages();
1892
- if (pages2.length === 1) {
1893
- if (homeDialogPages.length) {
1926
+ createVuePage(id2, route, query, pageInstance, {}, nativePage).then((pageComponentPublicInstance) => {
1927
+ var pages2 = getCurrentPages();
1928
+ if (pages2.length === 1) {
1894
1929
  var homePage = pages2[0];
1895
- var dialogPages = homePage.getDialogPages();
1896
- homePage.vm.$.$dialogPages.value = homeDialogPages.map((dialogPage) => {
1897
- dialogPage.getParentPage = () => homePage;
1898
- dialogPages.push(dialogPage);
1899
- return dialogPage;
1900
- });
1901
- homeDialogPages.length = 0;
1902
- }
1903
- if (homeSystemDialogPages.length) {
1904
- var _homePage = pages2[0];
1905
- if (!_homePage.vm.$systemDialogPages) {
1906
- _homePage.vm.$systemDialogPages = ref([]);
1930
+ var sourceDialogPages = [];
1931
+ var targetDialogPages = [];
1932
+ if (homeDialogPages.length) {
1933
+ sourceDialogPages = homeDialogPages;
1934
+ targetDialogPages = homePage.getDialogPages();
1907
1935
  }
1908
- _homePage.vm.$systemDialogPages.value = homeSystemDialogPages.map((dialogPage) => {
1909
- dialogPage.getParentPage = () => _homePage;
1910
- return dialogPage;
1911
- });
1912
- homeDialogPages.length = 0;
1936
+ if (homeSystemDialogPages.length) {
1937
+ sourceDialogPages = homeSystemDialogPages;
1938
+ targetDialogPages = homePage.__$$getSystemDialogPages();
1939
+ }
1940
+ handleHomeDialogPages(homePage, sourceDialogPages, targetDialogPages);
1913
1941
  }
1914
- }
1915
- nativePage.addPageEventListener(ON_POP_GESTURE, function(e) {
1916
- uni.navigateBack({
1917
- from: "popGesture",
1918
- fail(e2) {
1919
- if (e2.errMsg.endsWith("cancel")) {
1920
- nativePage.show();
1942
+ nativePage.addPageEventListener(ON_POP_GESTURE, function(e) {
1943
+ uni.navigateBack({
1944
+ from: "popGesture",
1945
+ fail(e2) {
1946
+ if (e2.errMsg.endsWith("cancel")) {
1947
+ nativePage.show();
1948
+ }
1921
1949
  }
1922
- }
1950
+ });
1923
1951
  });
1924
- });
1925
- nativePage.addPageEventListener(ON_UNLOAD, (_) => {
1926
- invokeHook(page, ON_UNLOAD);
1927
- });
1928
- nativePage.addPageEventListener(ON_READY, (_) => {
1929
- invokePageReadyHooks(page);
1930
- invokeHook(page, ON_READY);
1931
- });
1932
- nativePage.addPageEventListener(ON_PAGE_SCROLL, (arg) => {
1933
- invokeHook(page, ON_PAGE_SCROLL, {
1934
- scrollTop: arg.scrollTop
1952
+ nativePage.addPageEventListener(ON_UNLOAD, (_) => {
1953
+ invokeHook(pageComponentPublicInstance, ON_UNLOAD);
1935
1954
  });
1955
+ nativePage.addPageEventListener(ON_READY, (_) => {
1956
+ invokePageReadyHooks(pageComponentPublicInstance);
1957
+ invokeHook(pageComponentPublicInstance, ON_READY);
1958
+ });
1959
+ nativePage.addPageEventListener(ON_PAGE_SCROLL, (arg) => {
1960
+ invokeHook(pageComponentPublicInstance, ON_PAGE_SCROLL, {
1961
+ scrollTop: arg.scrollTop
1962
+ });
1963
+ });
1964
+ nativePage.addPageEventListener(ON_PULL_DOWN_REFRESH, (_) => {
1965
+ invokeHook(pageComponentPublicInstance, ON_PULL_DOWN_REFRESH);
1966
+ });
1967
+ nativePage.addPageEventListener(ON_REACH_BOTTOM, (_) => {
1968
+ invokeHook(pageComponentPublicInstance, ON_REACH_BOTTOM);
1969
+ });
1970
+ nativePage.addPageEventListener(ON_RESIZE, (arg) => {
1971
+ var args = {
1972
+ deviceOrientation: arg.deviceOrientation,
1973
+ size: {
1974
+ windowWidth: arg.size.windowWidth,
1975
+ windowHeight: arg.size.windowHeight,
1976
+ screenWidth: arg.size.screenWidth,
1977
+ screenHeight: arg.size.screenHeight
1978
+ }
1979
+ };
1980
+ invokeHook(pageComponentPublicInstance, ON_RESIZE, args);
1981
+ });
1982
+ nativePage.startRender();
1983
+ onRegistered === null || onRegistered === void 0 || onRegistered();
1936
1984
  });
1937
- nativePage.addPageEventListener(ON_PULL_DOWN_REFRESH, (_) => {
1938
- invokeHook(page, ON_PULL_DOWN_REFRESH);
1939
- });
1940
- nativePage.addPageEventListener(ON_REACH_BOTTOM, (_) => {
1941
- invokeHook(page, ON_REACH_BOTTOM);
1942
- });
1943
- nativePage.addPageEventListener(ON_RESIZE, (arg) => {
1944
- var args = {
1945
- deviceOrientation: arg.deviceOrientation,
1946
- size: {
1947
- windowWidth: arg.size.windowWidth,
1948
- windowHeight: arg.size.windowHeight,
1949
- screenWidth: arg.size.screenWidth,
1950
- screenHeight: arg.size.screenHeight
1951
- }
1952
- };
1953
- invokeHook(page, ON_RESIZE, args);
1954
- });
1955
- nativePage.startRender();
1956
1985
  }
1957
1986
  if (delay) {
1958
1987
  setTimeout(fn, delay);
@@ -1968,7 +1997,8 @@ function registerDialogPage(_ref2, dialogPage, onCreated) {
1968
1997
  path,
1969
1998
  query,
1970
1999
  openType,
1971
- eventChannel
2000
+ eventChannel,
2001
+ onRegistered
1972
2002
  } = _ref2;
1973
2003
  var delay = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
1974
2004
  var id2 = genWebviewId();
@@ -2009,42 +2039,43 @@ function registerDialogPage(_ref2, dialogPage, onCreated) {
2009
2039
  "light"
2010
2040
  );
2011
2041
  function fn() {
2012
- var page = createVuePage(id2, route, query, pageInstance, {}, nativePage);
2013
- nativePage.addPageEventListener(ON_POP_GESTURE, function(e) {
2014
- closeDialogPage({
2015
- dialogPage
2042
+ createVuePage(id2, route, query, pageInstance, {}, nativePage).then((pageComponentPublicInstance) => {
2043
+ nativePage.addPageEventListener(ON_POP_GESTURE, function(e) {
2044
+ closeDialogPage({
2045
+ dialogPage
2046
+ });
2016
2047
  });
2048
+ nativePage.addPageEventListener(ON_UNLOAD, (_) => {
2049
+ invokeHook(pageComponentPublicInstance, ON_UNLOAD);
2050
+ dialogPageTriggerParentShow(dialogPage, isSystemDialogPage(dialogPage) ? 1 : 0);
2051
+ });
2052
+ nativePage.addPageEventListener(ON_READY, (_) => {
2053
+ invokePageReadyHooks(pageComponentPublicInstance);
2054
+ invokeHook(pageComponentPublicInstance, ON_READY);
2055
+ });
2056
+ nativePage.addPageEventListener(ON_PAGE_SCROLL, (arg) => {
2057
+ invokeHook(pageComponentPublicInstance, ON_PAGE_SCROLL, arg);
2058
+ });
2059
+ nativePage.addPageEventListener(ON_PULL_DOWN_REFRESH, (_) => {
2060
+ invokeHook(pageComponentPublicInstance, ON_PULL_DOWN_REFRESH);
2061
+ });
2062
+ nativePage.addPageEventListener(ON_REACH_BOTTOM, (_) => {
2063
+ invokeHook(pageComponentPublicInstance, ON_REACH_BOTTOM);
2064
+ });
2065
+ nativePage.addPageEventListener(ON_RESIZE, (arg) => {
2066
+ var args = {
2067
+ deviceOrientation: arg.deviceOrientation,
2068
+ size: {
2069
+ windowWidth: arg.size.windowWidth,
2070
+ windowHeight: arg.size.windowHeight,
2071
+ screenWidth: arg.size.screenWidth,
2072
+ screenHeight: arg.size.screenHeight
2073
+ }
2074
+ };
2075
+ invokeHook(pageComponentPublicInstance, ON_RESIZE, args);
2076
+ });
2077
+ nativePage.startRender();
2017
2078
  });
2018
- nativePage.addPageEventListener(ON_UNLOAD, (_) => {
2019
- invokeHook(page, ON_UNLOAD);
2020
- dialogPageTriggerParentShow(dialogPage, isSystemDialogPage(dialogPage) ? 1 : 0);
2021
- });
2022
- nativePage.addPageEventListener(ON_READY, (_) => {
2023
- invokePageReadyHooks(page);
2024
- invokeHook(page, ON_READY);
2025
- });
2026
- nativePage.addPageEventListener(ON_PAGE_SCROLL, (arg) => {
2027
- invokeHook(page, ON_PAGE_SCROLL, arg);
2028
- });
2029
- nativePage.addPageEventListener(ON_PULL_DOWN_REFRESH, (_) => {
2030
- invokeHook(page, ON_PULL_DOWN_REFRESH);
2031
- });
2032
- nativePage.addPageEventListener(ON_REACH_BOTTOM, (_) => {
2033
- invokeHook(page, ON_REACH_BOTTOM);
2034
- });
2035
- nativePage.addPageEventListener(ON_RESIZE, (arg) => {
2036
- var args = {
2037
- deviceOrientation: arg.deviceOrientation,
2038
- size: {
2039
- windowWidth: arg.size.windowWidth,
2040
- windowHeight: arg.size.windowHeight,
2041
- screenWidth: arg.size.screenWidth,
2042
- screenHeight: arg.size.screenHeight
2043
- }
2044
- };
2045
- invokeHook(page, ON_RESIZE, args);
2046
- });
2047
- nativePage.startRender();
2048
2079
  }
2049
2080
  if (delay) {
2050
2081
  setTimeout(fn, delay);
@@ -2066,13 +2097,17 @@ function createVuePage(__pageId, __pagePath, __pageQuery, __pageInstance, pageOp
2066
2097
  if (isPromise(component)) {
2067
2098
  return component.then((component2) => mountPage(component2));
2068
2099
  }
2069
- return mountPage(component);
2100
+ return {
2101
+ then(fn) {
2102
+ return fn(mountPage(component));
2103
+ }
2104
+ };
2070
2105
  }
2071
2106
  function initGlobalEvent(app) {
2072
2107
  app.addKeyEventListener(ON_BACK_BUTTON, () => {
2073
2108
  var currentPage = getCurrentPage();
2074
2109
  if (currentPage) {
2075
- var systemDialogPages = currentPage.vm && currentPage.vm.$systemDialogPages && currentPage.vm.$systemDialogPages.value || [];
2110
+ var systemDialogPages = getSystemDialogPages(currentPage);
2076
2111
  var dialogPages = currentPage.getDialogPages();
2077
2112
  if (systemDialogPages.length > 0 || dialogPages.length > 0) {
2078
2113
  var lastSystemDialog = systemDialogPages[systemDialogPages.length - 1];
@@ -2102,7 +2137,6 @@ function handleDialogPageBack(dialogPage) {
2102
2137
  });
2103
2138
  }
2104
2139
  }
2105
- var SOURCE_REG = /(.+\.((ttf)|(otf)|(woff2?))$)|(^(http|https):\/\/.+)|(^(data:font).+)/;
2106
2140
  function removeUrlWrap(source) {
2107
2141
  if (source.startsWith("url(")) {
2108
2142
  if (source.split("format(").length > 1) {
@@ -2115,14 +2149,6 @@ function removeUrlWrap(source) {
2115
2149
  }
2116
2150
  return source;
2117
2151
  }
2118
- function checkOptionSource(options, res) {
2119
- options.source = removeUrlWrap(options.source);
2120
- if (!SOURCE_REG.test(options.source)) {
2121
- res.reject("loadFontFace:fail, source is invalid.", 101);
2122
- return false;
2123
- }
2124
- return true;
2125
- }
2126
2152
  function getLoadFontFaceOptions(options, res) {
2127
2153
  return {
2128
2154
  family: options.family,
@@ -2141,12 +2167,11 @@ function getLoadFontFaceOptions(options, res) {
2141
2167
  };
2142
2168
  }
2143
2169
  var loadFontFace = /* @__PURE__ */ defineAsyncApi(API_LOAD_FONT_FACE, (options, res) => {
2170
+ options.source = removeUrlWrap(options.source);
2144
2171
  if (options.global === true) {
2145
- if (checkOptionSource(options, res)) {
2146
- var app = getNativeApp();
2147
- var fontInfo = getLoadFontFaceOptions(options, res);
2148
- app.loadFontFace(fontInfo);
2149
- }
2172
+ var app = getNativeApp();
2173
+ var fontInfo = getLoadFontFaceOptions(options, res);
2174
+ app.loadFontFace(fontInfo);
2150
2175
  } else {
2151
2176
  var page = getCurrentPage().vm;
2152
2177
  if (!page) {
@@ -2156,17 +2181,15 @@ var loadFontFace = /* @__PURE__ */ defineAsyncApi(API_LOAD_FONT_FACE, (options,
2156
2181
  if (page.$fontFamilySet.has(options.family)) {
2157
2182
  return;
2158
2183
  }
2159
- if (checkOptionSource(options, res)) {
2160
- page.$fontFamilySet.add(options.family);
2161
- var _fontInfo = getLoadFontFaceOptions(options, res);
2162
- page.$nativePage.loadFontFace(_fontInfo);
2163
- }
2184
+ page.$fontFamilySet.add(options.family);
2185
+ var _fontInfo = getLoadFontFaceOptions(options, res);
2186
+ page.$nativePage.loadFontFace(_fontInfo);
2164
2187
  }
2165
2188
  });
2166
- function loadFontFaceByStyles(styles2, global) {
2167
- styles2 = Array.isArray(styles2) ? styles2 : [styles2];
2189
+ function loadFontFaceByStyles(styles, global) {
2190
+ styles = Array.isArray(styles) ? styles : [styles];
2168
2191
  var fontFaceStyle = [];
2169
- styles2.forEach((style) => {
2192
+ styles.forEach((style) => {
2170
2193
  if (style["@FONT-FACE"]) {
2171
2194
  fontFaceStyle.push(...style["@FONT-FACE"]);
2172
2195
  }
@@ -2380,21 +2403,9 @@ function _reLaunch(_ref3) {
2380
2403
  }
2381
2404
  var reLaunch = /* @__PURE__ */ defineAsyncApi(API_RE_LAUNCH, $reLaunch, ReLaunchProtocol, ReLaunchOptions);
2382
2405
  function closePage(page, animationType, animationDuration) {
2383
- var dialogPages = page.$page.getDialogPages();
2384
- for (var i = dialogPages.length - 1; i >= 0; i--) {
2385
- closeNativeDialogPage(dialogPages[i]);
2386
- }
2387
- if (page.$systemDialogPages) {
2388
- var systemDialogPages = page.$systemDialogPages.value;
2389
- for (var _i = 0; _i < systemDialogPages.length; _i++) {
2390
- closeNativeDialogPage(systemDialogPages[_i]);
2391
- }
2392
- page.$systemDialogPages.value = [];
2393
- }
2394
- for (var _i2 = dialogPages.length - 1; _i2 >= 0; _i2--) {
2395
- closeNativeDialogPage(dialogPages[_i2]);
2396
- }
2397
- closeWebview(page.$nativePage, animationType, animationDuration);
2406
+ clearDialogPages(page.$page);
2407
+ var nativePage = page.$nativePage;
2408
+ nativePage && closeWebview(nativePage, animationType, animationDuration);
2398
2409
  removePage(page);
2399
2410
  removeTabBarPage(page);
2400
2411
  }
@@ -2445,6 +2456,29 @@ function handleBeforeEntryPageRoutes() {
2445
2456
  return $reLaunch(args, handler);
2446
2457
  });
2447
2458
  }
2459
+ function closePreSystemDialogPage(dialogPages, type) {
2460
+ var targetSystemDialogPages = dialogPages.filter((page) => page.route.startsWith(type));
2461
+ if (targetSystemDialogPages.length > 1) {
2462
+ setTimeout(() => {
2463
+ closeNativeDialogPage(targetSystemDialogPages[0]);
2464
+ dialogPages.splice(dialogPages.indexOf(targetSystemDialogPages[0]), 1);
2465
+ }, 150);
2466
+ }
2467
+ }
2468
+ function clearDialogPages(uniPage) {
2469
+ var dialogPages = uniPage.getDialogPages();
2470
+ for (var i = dialogPages.length - 1; i >= 0; i--) {
2471
+ closeNativeDialogPage(dialogPages[i]);
2472
+ if (i > 0) {
2473
+ invokeHook(dialogPages[i - 1].vm, ON_SHOW);
2474
+ }
2475
+ }
2476
+ var systemDialogPages = getSystemDialogPages(uniPage);
2477
+ for (var _i = 0; _i < systemDialogPages.length; _i++) {
2478
+ closeNativeDialogPage(systemDialogPages[_i]);
2479
+ }
2480
+ systemDialogPages.length = 0;
2481
+ }
2448
2482
  var $switchTab = (args, _ref) => {
2449
2483
  var {
2450
2484
  resolve,
@@ -2624,28 +2658,37 @@ function initOn(app, unregisterApp2) {
2624
2658
  function initService(app, unregisterApp2) {
2625
2659
  initOn(app, unregisterApp2);
2626
2660
  }
2661
+ function initNativePage(vm) {
2662
+ var instance = vm.$;
2663
+ if (instance.type.mpType === "app") {
2664
+ return;
2665
+ }
2666
+ var pageId = instance.root.attrs.__pageId;
2667
+ vm.$nativePage = getNativeApp().pageManager.findPageById(pageId + "");
2668
+ if (vm.$page) {
2669
+ vm.$page.__nativePageId = vm.$nativePage.pageId;
2670
+ }
2671
+ }
2672
+ function initFontFace(vm) {
2673
+ var _vm$$options$styles;
2674
+ var instance = vm.$;
2675
+ if (instance.type.mpType === "app") {
2676
+ return;
2677
+ }
2678
+ loadFontFaceByStyles((_vm$$options$styles = vm.$options.styles) !== null && _vm$$options$styles !== void 0 ? _vm$$options$styles : [], false);
2679
+ }
2627
2680
  function initComponentInstance(app) {
2681
+ app.config.uniX = {
2682
+ beforeSetupPage,
2683
+ initNativePage,
2684
+ initFontFace
2685
+ };
2628
2686
  app.mixin({
2629
2687
  beforeCreate() {
2630
- var vm = this;
2631
- var instance = vm.$;
2632
- if (instance.type.mpType === "app") {
2633
- return;
2634
- }
2635
- var pageId = instance.root.attrs.__pageId;
2636
- vm.$nativePage = getNativeApp().pageManager.findPageById(pageId + "");
2637
- if (vm.$page) {
2638
- vm.$page.__nativePageId = vm.$nativePage.pageId;
2639
- }
2688
+ initNativePage(this);
2640
2689
  },
2641
2690
  beforeMount() {
2642
- var _vm$$options$styles;
2643
- var vm = this;
2644
- var instance = vm.$;
2645
- if (instance.type.mpType === "app") {
2646
- return;
2647
- }
2648
- loadFontFaceByStyles((_vm$$options$styles = vm.$options.styles) !== null && _vm$$options$styles !== void 0 ? _vm$$options$styles : [], false);
2691
+ initFontFace(this);
2649
2692
  }
2650
2693
  });
2651
2694
  }
@@ -2886,12 +2929,11 @@ function back(delta, animationType, animationDuration) {
2886
2929
  var currentPage = pages2[len - 1];
2887
2930
  if (delta > 1) {
2888
2931
  pages2.slice(len - delta, len - 1).reverse().forEach((deltaPage) => {
2889
- var dialogPages2 = deltaPage.$page.getDialogPages();
2890
- for (var i2 = dialogPages2.length - 1; i2 >= 0; i2--) {
2891
- var dialogPage2 = dialogPages2[i2];
2892
- closeNativeDialogPage(dialogPage2);
2932
+ clearDialogPages(deltaPage.$page);
2933
+ var webview2 = getNativeApp().pageManager.findPageById(deltaPage.$basePage.id + "");
2934
+ if (webview2) {
2935
+ closeWebview(webview2, "none", 0);
2893
2936
  }
2894
- closeWebview(getNativeApp().pageManager.findPageById(deltaPage.$basePage.id + ""), "none", 0);
2895
2937
  });
2896
2938
  }
2897
2939
  var backPage = function(webview2) {
@@ -2912,22 +2954,8 @@ function back(delta, animationType, animationDuration) {
2912
2954
  });
2913
2955
  };
2914
2956
  var webview = getNativeApp().pageManager.findPageById(currentPage.$basePage.id + "");
2915
- var dialogPages = currentPage.$page.getDialogPages();
2916
- for (var i = dialogPages.length - 1; i >= 0; i--) {
2917
- var dialogPage = dialogPages[i];
2918
- closeNativeDialogPage(dialogPage);
2919
- if (i > 0) {
2920
- invokeHook(dialogPages[i - 1].vm, ON_SHOW);
2921
- }
2922
- }
2923
- if (currentPage.$systemDialogPages) {
2924
- var systemDialogPages = currentPage.$systemDialogPages.value;
2925
- for (var _i = 0; _i < systemDialogPages.length; _i++) {
2926
- closeNativeDialogPage(systemDialogPages[_i]);
2927
- }
2928
- currentPage.$systemDialogPages.value = [];
2929
- }
2930
- backPage(webview);
2957
+ clearDialogPages(currentPage.$page);
2958
+ webview && backPage(webview);
2931
2959
  }
2932
2960
  var openDialogPage = (options) => {
2933
2961
  var _options$success, _options$complete;
@@ -2974,26 +3002,21 @@ var openDialogPage = (options) => {
2974
3002
  homeDialogPages.push(dialogPage);
2975
3003
  } else {
2976
3004
  var dialogPages = parentPage.getDialogPages();
2977
- if (dialogPages.length) {
2978
- invokeHook(dialogPages[dialogPages.length - 1].$vm, ON_HIDE);
2979
- }
3005
+ dialogPageTriggerPrevDialogPageLifeCycle(parentPage, ON_HIDE);
2980
3006
  dialogPages.push(dialogPage);
2981
3007
  }
2982
3008
  setCurrentNormalDialogPage(dialogPage);
2983
3009
  } else {
3010
+ var targetSystemDialogPages = [];
2984
3011
  if (!parentPage) {
2985
- homeSystemDialogPages.push(dialogPage);
2986
- if (isSystemActionSheetDialogPage(dialogPage)) {
2987
- closePreActionSheet(homeSystemDialogPages);
2988
- }
3012
+ targetSystemDialogPages = homeSystemDialogPages;
2989
3013
  } else {
2990
- if (!parentPage.vm.$systemDialogPages) {
2991
- parentPage.vm.$systemDialogPages = ref([]);
2992
- }
2993
- parentPage.vm.$systemDialogPages.value.push(dialogPage);
2994
- if (isSystemActionSheetDialogPage(dialogPage)) {
2995
- closePreActionSheet(parentPage.vm.$systemDialogPages.value);
2996
- }
3014
+ dialogPageTriggerPrevDialogPageLifeCycle(parentPage, ON_HIDE);
3015
+ targetSystemDialogPages = getSystemDialogPages(parentPage);
3016
+ }
3017
+ targetSystemDialogPages.push(dialogPage);
3018
+ if (isSystemActionSheetDialogPage(dialogPage)) {
3019
+ closePreSystemDialogPage(targetSystemDialogPages, SYSTEM_DIALOG_ACTION_SHEET_PAGE_PATH);
2997
3020
  }
2998
3021
  setCurrentSystemDialogPage(dialogPage);
2999
3022
  }
@@ -3055,15 +3078,6 @@ function initAnimation(path, animationType, animationDuration) {
3055
3078
  }
3056
3079
  return [_animationType, animationDuration || meta.animationDuration || globalStyle.animationDuration || ANI_DURATION];
3057
3080
  }
3058
- function closePreActionSheet(dialogPages) {
3059
- var actionSheets = dialogPages.filter((page) => isSystemActionSheetDialogPage(page));
3060
- if (actionSheets.length > 1) {
3061
- setTimeout(() => {
3062
- closeNativeDialogPage(actionSheets[0]);
3063
- dialogPages.splice(dialogPages.indexOf(actionSheets[0]), 1);
3064
- }, 150);
3065
- }
3066
- }
3067
3081
  var setTabBarBadge = /* @__PURE__ */ defineAsyncApi(API_SET_TAB_BAR_BADGE, (_ref, _ref2) => {
3068
3082
  var {
3069
3083
  index: index2,
@@ -4636,54 +4650,10 @@ var defineSystemComponent = (options) => {
4636
4650
  };
4637
4651
  return defineComponent(options);
4638
4652
  };
4639
- function $dispatch(context, componentName, eventName) {
4640
- var _parent;
4641
- var parent = context.$parent;
4642
- var name = (_parent = parent) === null || _parent === void 0 || (_parent = _parent.$options) === null || _parent === void 0 ? void 0 : _parent.name;
4643
- while (parent != null && (name == null || componentName != name)) {
4644
- parent = parent.$parent;
4645
- if (parent != null) {
4646
- var _parent2;
4647
- name = (_parent2 = parent) === null || _parent2 === void 0 || (_parent2 = _parent2.$options) === null || _parent2 === void 0 ? void 0 : _parent2.name;
4648
- }
4649
- }
4650
- if (parent != null) {
4651
- if (typeof parent[eventName] === "function") {
4652
- for (var _len = arguments.length, do_not_transform_spread = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
4653
- do_not_transform_spread[_key - 3] = arguments[_key];
4654
- }
4655
- parent[eventName](...do_not_transform_spread);
4656
- } else {
4657
- warn("dispatch: ".concat(componentName, " has no method ").concat(eventName));
4658
- }
4659
- }
4660
- }
4661
- function $dispatchParent(context, componentName, eventName) {
4662
- var _parent$$options;
4663
- var parent = context.$parent;
4664
- var name = parent === null || parent === void 0 || (_parent$$options = parent.$options) === null || _parent$$options === void 0 ? void 0 : _parent$$options.name;
4665
- if (parent !== null && (name === null || componentName === name)) {
4666
- if (typeof parent[eventName] === "function") {
4667
- for (var _len2 = arguments.length, do_not_transform_spread = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
4668
- do_not_transform_spread[_key2 - 3] = arguments[_key2];
4669
- }
4670
- return parent[eventName](...do_not_transform_spread);
4671
- } else {
4672
- warn("dispatchParent: ".concat(componentName, " has no method ").concat(eventName));
4673
- }
4674
- }
4675
- }
4676
- function initUniCustomEvent(element, e) {
4677
- e.target = element;
4678
- e.currentTarget = element;
4679
- return e;
4680
- }
4681
- var CHECKBOX_NAME = "Checkbox";
4682
- var CHECKBOX_ROOT_ELEMENT = "uni-checkbox-element";
4683
- var UniCheckboxElement = /* @__PURE__ */ (() => class extends UniElementImpl {
4653
+ var UniNavigatorElement = /* @__PURE__ */ (() => class extends UniElementImpl {
4684
4654
  constructor(data, pageNode) {
4685
4655
  super(data, pageNode);
4686
- this.tagName = "CHECKBOX";
4656
+ this.tagName = "NAVIGATOR";
4687
4657
  this.nodeName = this.tagName;
4688
4658
  this._getAttribute = (key) => {
4689
4659
  return null;
@@ -4697,825 +4667,73 @@ var UniCheckboxElement = /* @__PURE__ */ (() => class extends UniElementImpl {
4697
4667
  return super.getAnyAttribute(key);
4698
4668
  }
4699
4669
  })();
4700
- var checkboxProps = {
4701
- checked: {
4702
- type: Boolean,
4703
- default: false
4704
- },
4705
- disabled: {
4706
- type: Boolean,
4707
- default: false
4708
- },
4709
- value: {
4710
- type: [Object, String],
4711
- default: ""
4712
- },
4713
- // 图标颜色
4714
- color: {
4670
+ var navigatorProps = {
4671
+ url: {
4715
4672
  type: String,
4716
- default: "#007aff"
4673
+ default: ""
4717
4674
  },
4718
- // 默认的背景颜色
4719
- backgroundColor: {
4675
+ openType: {
4720
4676
  type: String,
4721
- default: "#ffffff"
4677
+ default: "navigate"
4722
4678
  },
4723
- // 默认的边框颜色
4724
- borderColor: {
4725
- type: String,
4726
- default: "#d1d1d1"
4679
+ delta: {
4680
+ type: Number,
4681
+ default: 1
4727
4682
  },
4728
- // 选中时的背景颜色
4729
- activeBackgroundColor: {
4683
+ animationType: {
4730
4684
  type: String,
4731
- default: "#ffffff"
4685
+ default: ""
4732
4686
  },
4733
- // 选中时的边框颜色
4734
- activeBorderColor: {
4735
- type: String,
4736
- default: "#d1d1d1"
4687
+ animationDuration: {
4688
+ type: Number,
4689
+ default: 300
4737
4690
  },
4738
- // 图标颜色,同color,优先级大于color
4739
- iconColor: {
4691
+ hoverClass: {
4740
4692
  type: String,
4741
- default: ""
4693
+ default: "navigator-hover"
4742
4694
  },
4743
- // 图标颜色,同color,优先级大于iconColor
4744
- foreColor: {
4745
- type: String,
4746
- default: ""
4747
- }
4748
- };
4749
- var styles = {
4750
- ["uni-checkbox"]: {
4751
- "flex-direction": "row",
4752
- "align-items": "center"
4695
+ hoverStopPropagation: {
4696
+ type: Boolean,
4697
+ default: false
4753
4698
  },
4754
- ["uni-checkbox-input"]: {
4755
- "justify-content": "center",
4756
- "align-items": "center",
4757
- position: "relative",
4758
- "border-top-width": "1px",
4759
- "border-right-width": "1px",
4760
- "border-bottom-width": "1px",
4761
- "border-left-width": "1px",
4762
- "border-top-style": "solid",
4763
- "border-right-style": "solid",
4764
- "border-bottom-style": "solid",
4765
- "border-left-style": "solid",
4766
- "border-top-left-radius": "3px",
4767
- "border-top-right-radius": "3px",
4768
- "border-bottom-right-radius": "3px",
4769
- "border-bottom-left-radius": "3px",
4770
- width: "22px",
4771
- height: "22px",
4772
- "margin-right": "5px",
4773
- "box-sizing": "content-box"
4699
+ hoverStartTime: {
4700
+ type: Number,
4701
+ default: 50
4774
4702
  },
4775
- ["uni-icon"]: {
4776
- "font-family": "uni-icon",
4777
- "font-size": "16px",
4778
- width: "16px",
4779
- height: "16px"
4703
+ hoverStayTime: {
4704
+ type: Number,
4705
+ default: 600
4780
4706
  }
4781
4707
  };
4782
- const checkbox = /* @__PURE__ */ defineBuiltInComponent({
4783
- name: CHECKBOX_NAME,
4708
+ const navigator = /* @__PURE__ */ defineBuiltInComponent({
4709
+ name: "Navigator",
4784
4710
  rootElement: {
4785
- name: CHECKBOX_ROOT_ELEMENT,
4711
+ name: "uni-navigator-element",
4786
4712
  // @ts-expect-error not web element
4787
- class: UniCheckboxElement
4713
+ class: UniNavigatorElement
4788
4714
  },
4789
- props: checkboxProps,
4715
+ props: navigatorProps,
4790
4716
  emits: ["click"],
4791
4717
  setup(props, _ref) {
4792
4718
  var {
4793
4719
  emit,
4794
4720
  slots
4795
4721
  } = _ref;
4796
- var icon = "";
4722
+ var $uniNavigatorElement = ref();
4797
4723
  var instance = getCurrentInstance();
4798
- var elementRef = ref();
4799
- var checkboxChecked = ref(props.checked);
4800
- var checkboxValue = ref("");
4801
- var setCheckboxChecked = (checked) => {
4802
- checkboxChecked.value = checked;
4803
- };
4804
- watchEffect(() => {
4805
- checkboxChecked.value = props.checked;
4806
- });
4807
- watch(() => checkboxChecked.value, (val) => {
4808
- var ctx = instance === null || instance === void 0 ? void 0 : instance.proxy;
4809
- if (!ctx)
4810
- return;
4811
- $dispatch(ctx, "CheckboxGroup", "_changeHandler", {
4812
- name: checkboxValue.value,
4813
- checked: checkboxChecked.value,
4814
- setCheckboxChecked
4815
- });
4816
- });
4817
- watchEffect(() => {
4818
- checkboxValue.value = props.value.toString();
4819
- });
4820
- var iconStyle = computed(() => {
4821
- if (props.disabled) {
4822
- return Object.assign({}, styles["uni-icon"]);
4823
- }
4824
- var color = "";
4825
- if (props.foreColor.length > 0) {
4826
- color = props.foreColor;
4827
- } else if (props.iconColor.length > 0) {
4828
- color = props.iconColor;
4829
- } else {
4830
- color = props.color;
4831
- }
4832
- return Object.assign({}, styles["uni-icon"], {
4833
- color
4834
- });
4835
- });
4836
- var checkInputStyle = computed(() => {
4837
- var style = checkboxChecked.value ? checkedStyle.value : uncheckedStyle.value;
4838
- return Object.assign({}, styles["uni-checkbox-input"], style);
4839
- });
4840
- var checkedStyle = computed(() => {
4841
- if (props.disabled) {
4842
- return {
4843
- backgroundColor: "#e1e1e1",
4844
- borderColor: "#d1d1d1"
4845
- };
4846
- }
4847
- return {
4848
- backgroundColor: props.activeBackgroundColor,
4849
- borderColor: props.activeBorderColor
4850
- };
4851
- });
4852
- var uncheckedStyle = computed(() => {
4853
- if (props.disabled) {
4854
- return {
4855
- backgroundColor: "#e1e1e1",
4856
- borderColor: "#d1d1d1"
4857
- };
4858
- }
4859
- return {
4860
- backgroundColor: props.backgroundColor,
4861
- borderColor: props.borderColor
4862
- };
4863
- });
4864
4724
  onMounted(() => {
4865
- var ctx = instance === null || instance === void 0 ? void 0 : instance.proxy;
4866
- $dispatch(ctx, "CheckboxGroup", "_checkboxGroupUpdateHandler", {
4867
- setCheckboxChecked,
4868
- name: checkboxValue.value,
4869
- checked: checkboxChecked.value
4870
- }, "add");
4871
4725
  instance === null || instance === void 0 || instance.$waitNativeRender(() => {
4872
- var _instance$proxy;
4873
4726
  if (!instance)
4874
4727
  return;
4875
- elementRef.value = (_instance$proxy = instance.proxy) === null || _instance$proxy === void 0 ? void 0 : _instance$proxy.$el;
4876
- elementRef.value._getAttribute = (key) => {
4728
+ $uniNavigatorElement.value._getAttribute = (key) => {
4877
4729
  var _props$keyString$toSt, _props$keyString;
4878
4730
  var keyString = camelize(key);
4879
4731
  return props[keyString] !== null ? (_props$keyString$toSt = (_props$keyString = props[keyString]) === null || _props$keyString === void 0 ? void 0 : _props$keyString.toString()) !== null && _props$keyString$toSt !== void 0 ? _props$keyString$toSt : null : null;
4880
4732
  };
4881
4733
  });
4882
4734
  });
4883
- onBeforeUnmount(() => {
4884
- var ctx = instance === null || instance === void 0 ? void 0 : instance.proxy;
4885
- $dispatch(ctx, "CheckboxGroup", "_checkboxGroupUpdateHandler", {
4886
- setCheckboxChecked,
4887
- name: checkboxValue.value,
4888
- checked: checkboxChecked.value
4889
- }, "remove");
4890
- });
4891
4735
  var _onClick = ($event) => {
4892
- if (props.disabled)
4893
- return;
4894
- emit("click", $event);
4895
- checkboxChecked.value = !checkboxChecked.value;
4896
- };
4897
- return () => {
4898
- var _slots$default;
4899
- return createVNode("uni-checkbox-element", {
4900
- "dataUncType": "uni-checkbox",
4901
- "onClick": _onClick,
4902
- "class": "uni-checkbox",
4903
- "style": styles["uni-checkbox"]
4904
- }, [createVNode("view", {
4905
- "class": "uni-checkbox-input",
4906
- "style": checkInputStyle.value
4907
- }, [createVNode("text", {
4908
- "class": "uni-icon",
4909
- "style": iconStyle.value
4910
- }, [checkboxChecked.value ? icon : ""], 4)], 4), (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)], 12, ["onClick"]);
4911
- };
4912
- }
4913
- });
4914
- const checkbox$1 = /* @__PURE__ */ Object.defineProperty({
4915
- __proto__: null,
4916
- UniCheckboxElement,
4917
- default: checkbox
4918
- }, Symbol.toStringTag, { value: "Module" });
4919
- var CHECKBOX_GROUP_NAME = "CheckboxGroup";
4920
- var CHECKBOX_GROUP_ROOT_ELEMENT = "uni-checkbox-group-element";
4921
- var checkboxGroupProps = {
4922
- name: {
4923
- type: String,
4924
- default: ""
4925
- }
4926
- };
4927
- var UniCheckboxGroupElement = /* @__PURE__ */ (() => class extends UniFormControlElement {
4928
- constructor(data, pageNode) {
4929
- super(data, pageNode);
4930
- this._initialValue = [];
4931
- this.tagName = "CHECKBOX-GROUP";
4932
- this.nodeName = this.tagName;
4933
- this._getAttribute = (key) => {
4934
- return null;
4935
- };
4936
- this._getValue = () => {
4937
- return this._initialValue;
4938
- };
4939
- this._setValue = (value) => {
4940
- };
4941
- }
4942
- get value() {
4943
- return this._getValue();
4944
- }
4945
- set value(value) {
4946
- this._setValue(value);
4947
- }
4948
- getAnyAttribute(key) {
4949
- var value = this._getAttribute(key);
4950
- if (value != null) {
4951
- return value;
4952
- }
4953
- return super.getAnyAttribute(key);
4954
- }
4955
- reset() {
4956
- this.value = this._initialValue.slice(0);
4957
- }
4958
- })();
4959
- class UniCheckboxGroupChangeEventDetail {
4960
- constructor(value) {
4961
- this.value = value;
4962
- }
4963
- }
4964
- var UniCheckboxGroupChangeEvent = /* @__PURE__ */ (() => class extends UniCustomEvent {
4965
- constructor(value) {
4966
- super("change", {
4967
- detail: new UniCheckboxGroupChangeEventDetail(value)
4968
- });
4969
- }
4970
- })();
4971
- const checkboxGroup = /* @__PURE__ */ defineBuiltInComponent({
4972
- name: CHECKBOX_GROUP_NAME,
4973
- rootElement: {
4974
- name: CHECKBOX_GROUP_ROOT_ELEMENT,
4975
- // @ts-expect-error not web element
4976
- class: UniCheckboxGroupElement
4977
- },
4978
- props: checkboxGroupProps,
4979
- emits: ["change"],
4980
- setup(props, _ref) {
4981
- var {
4982
- emit,
4983
- expose,
4984
- slots
4985
- } = _ref;
4986
- var $checkboxList = ref([]);
4987
- var uniCheckboxGroupElementRef = ref();
4988
- var instance = getCurrentInstance();
4989
- var _checkboxGroupUpdateHandler = (info, type) => {
4990
- if (type == "add") {
4991
- $checkboxList.value.push(info);
4992
- } else {
4993
- var index2 = $checkboxList.value.findIndex((i) => i.name === info.name);
4994
- if (index2 !== -1) {
4995
- $checkboxList.value.splice(index2, 1);
4996
- }
4997
- }
4998
- };
4999
- var _changeHandler = (info) => {
5000
- $checkboxList.value.forEach((i) => {
5001
- if (i.name === info.name) {
5002
- i.checked = info.checked;
5003
- }
5004
- });
5005
- emit("change", initUniCustomEvent(uniCheckboxGroupElementRef.value, new UniCheckboxGroupChangeEvent(_getValue())));
5006
- };
5007
- var _getValue = () => {
5008
- var valueArray = [];
5009
- $checkboxList.value.forEach((info) => {
5010
- if (info.checked) {
5011
- valueArray.push(info.name);
5012
- }
5013
- });
5014
- return valueArray;
5015
- };
5016
- var _setValue = (valueArray) => {
5017
- $checkboxList.value.forEach((info) => {
5018
- info.setCheckboxChecked(valueArray.includes(info.name));
5019
- });
5020
- };
5021
- onMounted(() => {
5022
- instance === null || instance === void 0 || instance.$waitNativeRender(() => {
5023
- if (!instance)
5024
- return;
5025
- if (!uniCheckboxGroupElementRef.value)
5026
- return;
5027
- uniCheckboxGroupElementRef.value._getValue = _getValue;
5028
- uniCheckboxGroupElementRef.value._setValue = _setValue;
5029
- uniCheckboxGroupElementRef.value._initialValue = _getValue();
5030
- uniCheckboxGroupElementRef.value._getAttribute = (key) => {
5031
- var _props$keyString$toSt, _props$keyString;
5032
- var keyString = camelize(key);
5033
- return props[keyString] !== null ? (_props$keyString$toSt = (_props$keyString = props[keyString]) === null || _props$keyString === void 0 ? void 0 : _props$keyString.toString()) !== null && _props$keyString$toSt !== void 0 ? _props$keyString$toSt : null : null;
5034
- };
5035
- });
5036
- });
5037
- expose({
5038
- _checkboxGroupUpdateHandler,
5039
- _changeHandler,
5040
- _getValue,
5041
- _setValue
5042
- });
5043
- return () => {
5044
- var _slots$default;
5045
- return createVNode("uni-checkbox-group-element", {
5046
- "ref": uniCheckboxGroupElementRef
5047
- }, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)], 512);
5048
- };
5049
- }
5050
- });
5051
- const checkboxGroup$1 = /* @__PURE__ */ Object.defineProperty({
5052
- __proto__: null,
5053
- UniCheckboxGroupChangeEvent,
5054
- UniCheckboxGroupElement,
5055
- default: checkboxGroup
5056
- }, Symbol.toStringTag, { value: "Module" });
5057
- var RADIO_NAME = "Radio";
5058
- var RADIO_ROOT_ELEMENT = "uni-radio-element";
5059
- var UniRadioElement = /* @__PURE__ */ (() => class extends UniElementImpl {
5060
- constructor(data, pageNode) {
5061
- super(data, pageNode);
5062
- this.tagName = "RADIO";
5063
- this.nodeName = this.tagName;
5064
- this._getAttribute = (key) => {
5065
- return null;
5066
- };
5067
- }
5068
- getAnyAttribute(key) {
5069
- var value = this._getAttribute(key);
5070
- if (value != null) {
5071
- return value;
5072
- }
5073
- return super.getAnyAttribute(key);
5074
- }
5075
- })();
5076
- var radioProps = {
5077
- checked: {
5078
- type: Boolean,
5079
- default: false
5080
- },
5081
- disabled: {
5082
- type: Boolean,
5083
- default: false
5084
- },
5085
- value: {
5086
- type: [Object, String],
5087
- default: ""
5088
- },
5089
- // 选中时的背景颜色
5090
- color: {
5091
- type: String,
5092
- default: "#007AFF"
5093
- },
5094
- // 默认的背景颜色
5095
- backgroundColor: {
5096
- type: String,
5097
- default: "#ffffff"
5098
- },
5099
- // 默认的边框颜色
5100
- borderColor: {
5101
- type: String,
5102
- default: "#d1d1d1"
5103
- },
5104
- // 选中时的背景颜色,同color,优先级大于color
5105
- activeBackgroundColor: {
5106
- type: String,
5107
- default: ""
5108
- },
5109
- // 选中时的边框颜色,默认为选中时的背景颜色
5110
- activeBorderColor: {
5111
- type: String,
5112
- default: ""
5113
- },
5114
- // 图标颜色
5115
- iconColor: {
5116
- type: String,
5117
- default: "#ffffff"
5118
- },
5119
- // 高于 iconColor 和 color
5120
- foreColor: {
5121
- type: String,
5122
- default: ""
5123
- }
5124
- };
5125
- var _style_0$1 = {
5126
- "uni-radio": {
5127
- "": {
5128
- flexDirection: "row",
5129
- alignItems: "center"
5130
- }
5131
- },
5132
- "uni-radio-input": {
5133
- "": {
5134
- position: "relative",
5135
- alignItems: "center",
5136
- justifyContent: "center",
5137
- marginRight: "5px",
5138
- borderStyle: "solid",
5139
- borderWidth: "1px",
5140
- borderRadius: "50px",
5141
- width: "22px",
5142
- height: "22px",
5143
- boxSizing: "content-box"
5144
- }
5145
- },
5146
- "uni-radio-input-icon": {
5147
- "": {
5148
- fontFamily: "uni-icon",
5149
- fontSize: "14px",
5150
- width: "14px",
5151
- height: "14px"
5152
- }
5153
- }
5154
- };
5155
- var styleList = _style_0$1;
5156
- const radio = /* @__PURE__ */ defineBuiltInComponent({
5157
- name: RADIO_NAME,
5158
- rootElement: {
5159
- name: RADIO_ROOT_ELEMENT,
5160
- // @ts-expect-error not web element
5161
- class: UniRadioElement
5162
- },
5163
- props: radioProps,
5164
- setup(props, _ref) {
5165
- var {
5166
- slots,
5167
- expose
5168
- } = _ref;
5169
- var uniRadioElementRef = ref();
5170
- var styleUniRadio = computed(() => styleList["uni-radio"][""]);
5171
- var styleUniRadioInput = computed(() => {
5172
- return Object.assign({}, styleList["uni-radio-input"][""], radioChecked.value ? checkedStyle.value : uncheckedStyle.value);
5173
- });
5174
- var styleUniRadioInputIcon = computed(() => {
5175
- return Object.assign({}, styleList["uni-radio-input-icon"][""], iconStyle.value);
5176
- });
5177
- var checkedStyle = computed(() => {
5178
- if (props.disabled) {
5179
- return {
5180
- backgroundColor: "#e1e1e1",
5181
- borderColor: "#d1d1d1"
5182
- };
5183
- }
5184
- var backgroundColor = props.activeBackgroundColor.length > 0 ? props.activeBackgroundColor : props.color;
5185
- var borderColor = props.activeBorderColor.length > 0 ? props.activeBorderColor : backgroundColor;
5186
- return {
5187
- backgroundColor,
5188
- borderColor
5189
- };
5190
- });
5191
- var uncheckedStyle = computed(() => {
5192
- if (props.disabled) {
5193
- return {
5194
- backgroundColor: "#e1e1e1",
5195
- borderColor: "#d1d1d1"
5196
- };
5197
- }
5198
- return {
5199
- backgroundColor: props.backgroundColor,
5200
- borderColor: props.borderColor
5201
- };
5202
- });
5203
- var iconStyle = computed(() => {
5204
- var color = "";
5205
- if (props.foreColor.length > 0) {
5206
- color = props.foreColor;
5207
- } else if (props.iconColor.length > 0) {
5208
- color = props.iconColor;
5209
- }
5210
- return {
5211
- color: props.disabled ? "#adadad" : color
5212
- };
5213
- });
5214
- var icon = "";
5215
- var radioChecked = ref(props.checked);
5216
- var radioValue = ref(props.value.toString());
5217
- watchEffect(() => {
5218
- radioChecked.value = props.checked;
5219
- });
5220
- var setRadioChecked = (value) => {
5221
- radioChecked.value = value;
5222
- };
5223
- watchEffect(() => {
5224
- radioValue.value = props.value.toString();
5225
- });
5226
- watch(() => radioChecked.value, (val) => {
5227
- var ctx = instance === null || instance === void 0 ? void 0 : instance.proxy;
5228
- if (!ctx)
5229
- return;
5230
- if (val) {
5231
- $dispatch(ctx, "RadioGroup", "_changeHandler", {
5232
- name: radioValue.value,
5233
- checked: radioChecked.value,
5234
- setRadioChecked
5235
- });
5236
- }
5237
- });
5238
- expose({
5239
- radioValue
5240
- });
5241
- var instance = getCurrentInstance();
5242
- onMounted(() => {
5243
- instance === null || instance === void 0 || instance.$waitNativeRender(() => {
5244
- if (instance === null)
5245
- return;
5246
- uniRadioElementRef.value._getAttribute = (key) => {
5247
- var _props$keyString$toSt, _props$keyString;
5248
- var keyString = camelize(key);
5249
- return props[keyString] !== null ? (_props$keyString$toSt = (_props$keyString = props[keyString]) === null || _props$keyString === void 0 ? void 0 : _props$keyString.toString()) !== null && _props$keyString$toSt !== void 0 ? _props$keyString$toSt : null : null;
5250
- };
5251
- });
5252
- var ctx = instance === null || instance === void 0 ? void 0 : instance.proxy;
5253
- $dispatch(ctx, "RadioGroup", "_radioGroupUpdateHandler", {
5254
- name: radioValue.value,
5255
- checked: radioChecked.value,
5256
- setRadioChecked
5257
- }, "add");
5258
- });
5259
- onBeforeUnmount(() => {
5260
- var ctx = instance === null || instance === void 0 ? void 0 : instance.proxy;
5261
- $dispatch(ctx, "RadioGroup", "_radioGroupUpdateHandler", {
5262
- name: radioValue.value,
5263
- checked: radioChecked.value,
5264
- setRadioChecked
5265
- }, "remove");
5266
- });
5267
- var _onClick = () => {
5268
- if (props.disabled || radioChecked.value)
5269
- return;
5270
- radioChecked.value = !radioChecked.value;
5271
- };
5272
- return () => {
5273
- var _slots$default;
5274
- return createVNode("uni-radio-element", {
5275
- "dataUncType": "uni-radio",
5276
- "class": "uni-radio",
5277
- "style": styleUniRadio.value,
5278
- "ref": uniRadioElementRef,
5279
- "onClick": _onClick
5280
- }, [createVNode("view", {
5281
- "class": "uni-radio-input",
5282
- "style": styleUniRadioInput.value
5283
- }, [createVNode("text", {
5284
- "class": "uni-radio-input-icon",
5285
- "style": styleUniRadioInputIcon.value
5286
- }, [radioChecked.value ? icon : ""], 4)], 4), (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)], 12, ["onClick"]);
5287
- };
5288
- }
5289
- });
5290
- const radio$1 = /* @__PURE__ */ Object.defineProperty({
5291
- __proto__: null,
5292
- UniRadioElement,
5293
- default: radio
5294
- }, Symbol.toStringTag, { value: "Module" });
5295
- var RADIOGROUP_NAME = "RadioGroup";
5296
- var RADIOGROUP_ROOT_ELEMENT = "uni-radio-group-element";
5297
- var RadioProps = {
5298
- name: {
5299
- type: String,
5300
- default: ""
5301
- }
5302
- };
5303
- var UniRadioGroupElement = /* @__PURE__ */ (() => class extends UniFormControlElement {
5304
- constructor(data, pageNode) {
5305
- super(data, pageNode);
5306
- this._initialValue = "";
5307
- this.tagName = "RADIO-GROUP";
5308
- this.nodeName = this.tagName;
5309
- this._getAttribute = (key) => {
5310
- return null;
5311
- };
5312
- this._getValue = () => {
5313
- return this._initialValue;
5314
- };
5315
- this._setValue = (value) => {
5316
- };
5317
- }
5318
- getAnyAttribute(key) {
5319
- var value = this._getAttribute(key);
5320
- if (value != null) {
5321
- return value;
5322
- }
5323
- return super.getAnyAttribute(key);
5324
- }
5325
- get value() {
5326
- return this._getValue();
5327
- }
5328
- set value(value) {
5329
- this._setValue(value);
5330
- }
5331
- reset() {
5332
- this.value = this._initialValue;
5333
- }
5334
- })();
5335
- class UniRadioGroupChangeEventDetail {
5336
- constructor(value) {
5337
- this.value = value;
5338
- }
5339
- }
5340
- var UniRadioGroupChangeEvent = /* @__PURE__ */ (() => class extends UniCustomEvent {
5341
- constructor(value) {
5342
- super("change", {
5343
- detail: new UniRadioGroupChangeEventDetail(value)
5344
- });
5345
- }
5346
- })();
5347
- const radioGroup = /* @__PURE__ */ defineBuiltInComponent({
5348
- name: RADIOGROUP_NAME,
5349
- rootElement: {
5350
- name: RADIOGROUP_ROOT_ELEMENT,
5351
- // @ts-expect-error not web element
5352
- class: UniRadioGroupElement
5353
- },
5354
- props: RadioProps,
5355
- emits: ["change"],
5356
- setup(props, _ref) {
5357
- var {
5358
- emit,
5359
- slots,
5360
- expose
5361
- } = _ref;
5362
- var $radioList = ref([]);
5363
- var uniRadioGroupElementRef = ref();
5364
- var instance = getCurrentInstance();
5365
- var _radioGroupUpdateHandler = (info, type) => {
5366
- if (type == "add") {
5367
- $radioList.value.push(info);
5368
- } else {
5369
- var index2 = $radioList.value.findIndex((i) => i.name == info.name);
5370
- if (index2 !== -1) {
5371
- $radioList.value.splice(index2, 1);
5372
- }
5373
- }
5374
- };
5375
- var _changeHandler = (data) => {
5376
- _setValue(data.name);
5377
- emit("change", initUniCustomEvent(uniRadioGroupElementRef.value, new UniRadioGroupChangeEvent(data.name)));
5378
- };
5379
- var _getValue = () => {
5380
- var value = "";
5381
- $radioList.value.forEach((info) => {
5382
- if (info.checked) {
5383
- value = info.name;
5384
- }
5385
- });
5386
- return value;
5387
- };
5388
- var _setValue = (name) => {
5389
- $radioList.value.forEach((info) => {
5390
- if (info.name == name) {
5391
- info.checked = true;
5392
- info.setRadioChecked(true);
5393
- } else {
5394
- info.checked = false;
5395
- info.setRadioChecked(false);
5396
- }
5397
- });
5398
- };
5399
- onMounted(() => {
5400
- instance === null || instance === void 0 || instance.$waitNativeRender(() => {
5401
- if (!instance)
5402
- return;
5403
- if (!uniRadioGroupElementRef.value)
5404
- return;
5405
- uniRadioGroupElementRef.value._getValue = _getValue;
5406
- uniRadioGroupElementRef.value._setValue = _setValue;
5407
- uniRadioGroupElementRef.value._initialValue = _getValue();
5408
- uniRadioGroupElementRef.value._getAttribute = (key) => {
5409
- var _props$keyString$toSt, _props$keyString;
5410
- var keyString = camelize(key);
5411
- return props[keyString] !== null ? (_props$keyString$toSt = (_props$keyString = props[keyString]) === null || _props$keyString === void 0 ? void 0 : _props$keyString.toString()) !== null && _props$keyString$toSt !== void 0 ? _props$keyString$toSt : null : null;
5412
- };
5413
- });
5414
- });
5415
- expose({
5416
- _radioGroupUpdateHandler,
5417
- _getValue,
5418
- _setValue,
5419
- _changeHandler
5420
- });
5421
- return () => {
5422
- var _slots$default;
5423
- return createVNode("uni-radio-group-element", {
5424
- "ref": uniRadioGroupElementRef
5425
- }, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)], 512);
5426
- };
5427
- }
5428
- });
5429
- const radioGroup$1 = /* @__PURE__ */ Object.defineProperty({
5430
- __proto__: null,
5431
- UniRadioGroupChangeEvent,
5432
- UniRadioGroupElement,
5433
- default: radioGroup
5434
- }, Symbol.toStringTag, { value: "Module" });
5435
- var UniNavigatorElement = /* @__PURE__ */ (() => class extends UniElementImpl {
5436
- constructor(data, pageNode) {
5437
- super(data, pageNode);
5438
- this.tagName = "NAVIGATOR";
5439
- this.nodeName = this.tagName;
5440
- this._getAttribute = (key) => {
5441
- return null;
5442
- };
5443
- }
5444
- getAnyAttribute(key) {
5445
- var value = this._getAttribute(key);
5446
- if (value != null) {
5447
- return value;
5448
- }
5449
- return super.getAnyAttribute(key);
5450
- }
5451
- })();
5452
- var navigatorProps = {
5453
- url: {
5454
- type: String,
5455
- default: ""
5456
- },
5457
- openType: {
5458
- type: String,
5459
- default: "navigate"
5460
- },
5461
- delta: {
5462
- type: Number,
5463
- default: 1
5464
- },
5465
- animationType: {
5466
- type: String,
5467
- default: ""
5468
- },
5469
- animationDuration: {
5470
- type: Number,
5471
- default: 300
5472
- },
5473
- hoverClass: {
5474
- type: String,
5475
- default: "navigator-hover"
5476
- },
5477
- hoverStopPropagation: {
5478
- type: Boolean,
5479
- default: false
5480
- },
5481
- hoverStartTime: {
5482
- type: Number,
5483
- default: 50
5484
- },
5485
- hoverStayTime: {
5486
- type: Number,
5487
- default: 600
5488
- }
5489
- };
5490
- const navigator = /* @__PURE__ */ defineBuiltInComponent({
5491
- name: "Navigator",
5492
- rootElement: {
5493
- name: "uni-navigator-element",
5494
- // @ts-expect-error not web element
5495
- class: UniNavigatorElement
5496
- },
5497
- props: navigatorProps,
5498
- emits: ["click"],
5499
- setup(props, _ref) {
5500
- var {
5501
- emit,
5502
- slots
5503
- } = _ref;
5504
- var $uniNavigatorElement = ref();
5505
- var instance = getCurrentInstance();
5506
- onMounted(() => {
5507
- instance === null || instance === void 0 || instance.$waitNativeRender(() => {
5508
- if (!instance)
5509
- return;
5510
- $uniNavigatorElement.value._getAttribute = (key) => {
5511
- var _props$keyString$toSt, _props$keyString;
5512
- var keyString = camelize(key);
5513
- return props[keyString] !== null ? (_props$keyString$toSt = (_props$keyString = props[keyString]) === null || _props$keyString === void 0 ? void 0 : _props$keyString.toString()) !== null && _props$keyString$toSt !== void 0 ? _props$keyString$toSt : null : null;
5514
- };
5515
- });
5516
- });
5517
- var _onClick = ($event) => {
5518
- var url = props.url;
4736
+ var url = props.url;
5519
4737
  emit("click", $event);
5520
4738
  var animationDuration = props.animationDuration;
5521
4739
  switch (props.openType) {
@@ -5554,7 +4772,6 @@ const navigator = /* @__PURE__ */ defineBuiltInComponent({
5554
4772
  }
5555
4773
  };
5556
4774
  return () => {
5557
- var _slots$default;
5558
4775
  return createVNode("uni-navigator-element", {
5559
4776
  "ref": $uniNavigatorElement,
5560
4777
  "onClick": _onClick,
@@ -5562,7 +4779,7 @@ const navigator = /* @__PURE__ */ defineBuiltInComponent({
5562
4779
  "hoverStopPropagation": props.hoverStopPropagation,
5563
4780
  "hoverStartTime": props.hoverStartTime,
5564
4781
  "hoverStayTime": props.hoverStayTime
5565
- }, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)], 8, ["onClick", "hoverClass", "hoverStopPropagation", "hoverStartTime", "hoverStayTime"]);
4782
+ }, [renderSlot(slots, "default")], 8, ["onClick", "hoverClass", "hoverStopPropagation", "hoverStartTime", "hoverStayTime"]);
5566
4783
  };
5567
4784
  }
5568
4785
  });
@@ -5571,663 +4788,9 @@ const navigator$1 = /* @__PURE__ */ Object.defineProperty({
5571
4788
  UniNavigatorElement,
5572
4789
  default: navigator
5573
4790
  }, Symbol.toStringTag, { value: "Module" });
5574
- var BACKGROUND_COLOR = "#EBEBEB";
5575
- var PRIMARY_COLOR = "#007AFF";
5576
- var ANIMATE_INTERVAL_DEFAULT = 30;
5577
- var FONT_SIZE = 16;
5578
- var STROKE_WIDTH = 6;
5579
- class UniProgressActiveendEventDetail {
5580
- constructor(value) {
5581
- this.curPercent = value;
5582
- }
5583
- }
5584
- var UniProgressActiveendEvent = /* @__PURE__ */ (() => class extends UniCustomEvent {
5585
- constructor(value) {
5586
- super("activeend", {
5587
- detail: new UniProgressActiveendEventDetail(value)
5588
- });
5589
- }
5590
- })();
5591
- var UniProgressElement = /* @__PURE__ */ (() => class extends UniElementImpl {
5592
- constructor(data, pageNode) {
5593
- super(data, pageNode);
5594
- this.tagName = "PROGRESS";
5595
- this.nodeName = this.tagName;
5596
- this._getAttribute = (key) => {
5597
- return null;
5598
- };
5599
- }
5600
- getAnyAttribute(key) {
5601
- var value = this._getAttribute(key);
5602
- if (value != null) {
5603
- return value;
5604
- }
5605
- return super.getAnyAttribute(key);
5606
- }
5607
- })();
5608
- var progressProps = {
5609
- percent: {
5610
- type: Number,
5611
- default: 0
5612
- },
5613
- showInfo: {
5614
- type: Boolean,
5615
- default: false
5616
- },
5617
- borderRadius: {
5618
- type: Number,
5619
- default: 0
5620
- },
5621
- fontSize: {
5622
- type: Number,
5623
- default: FONT_SIZE
5624
- },
5625
- strokeWidth: {
5626
- type: Number,
5627
- default: STROKE_WIDTH
5628
- },
5629
- active: {
5630
- type: Boolean,
5631
- default: false
5632
- },
5633
- activeColor: {
5634
- type: String,
5635
- default: PRIMARY_COLOR
5636
- },
5637
- activeMode: {
5638
- type: String,
5639
- default: "backwards"
5640
- },
5641
- backgroundColor: {
5642
- type: String,
5643
- default: BACKGROUND_COLOR
5644
- },
5645
- duration: {
5646
- type: Number,
5647
- default: ANIMATE_INTERVAL_DEFAULT
5648
- }
5649
- };
5650
- var _style = {
5651
- "uni-progress": {
5652
- "": {
5653
- flexDirection: "row",
5654
- alignItems: "center"
5655
- }
5656
- },
5657
- "uni-progress-bar": {
5658
- "": {
5659
- flex: "1",
5660
- overflow: "hidden"
5661
- }
5662
- },
5663
- "uni-progress-info": {
5664
- "": {
5665
- marginLeft: "15px"
5666
- }
5667
- }
5668
- };
5669
- const progress = /* @__PURE__ */ defineBuiltInComponent({
5670
- name: "Progress",
5671
- rootElement: {
5672
- name: "uni-progress-element",
5673
- // @ts-expect-error not web element
5674
- class: UniProgressElement
5675
- },
5676
- emit: ["activeend"],
5677
- props: progressProps,
5678
- setup(props, _ref) {
5679
- var {
5680
- emit
5681
- } = _ref;
5682
- var data = reactive({
5683
- $uniProgressElement: null,
5684
- curPercent: 0,
5685
- _timerId: 0,
5686
- _lastPercent: 0
5687
- });
5688
- var textStr = computed(() => {
5689
- return "".concat(data.curPercent, "%");
5690
- });
5691
- var instance = getCurrentInstance();
5692
- var styleUniProgress = computed(() => _style["uni-progress"][""]);
5693
- var styleUniProgressBar = computed(() => _style["uni-progress-bar"][""]);
5694
- var barStyle = computed(() => {
5695
- var style = {
5696
- height: "".concat(props.strokeWidth, "px"),
5697
- borderRadius: "".concat(props.borderRadius, "px"),
5698
- backgroundColor: props.backgroundColor
5699
- };
5700
- return Object.assign({}, styleUniProgressBar.value, style);
5701
- });
5702
- var innerBarStyle = computed(() => {
5703
- var style = {
5704
- width: "".concat(data.curPercent, "%"),
5705
- height: "".concat(props.strokeWidth, "px"),
5706
- backgroundColor: "".concat(props.activeColor)
5707
- };
5708
- return Object.assign({}, style);
5709
- });
5710
- var textStyle = computed(() => {
5711
- var fontSize = props.fontSize;
5712
- var style = {
5713
- fontSize: "".concat(fontSize, "px"),
5714
- minWidth: "".concat(fontSize * 2, "px")
5715
- };
5716
- return Object.assign({}, _style["uni-progress-info"][""], style);
5717
- });
5718
- var finalPercent = computed(() => {
5719
- var percent = props.percent;
5720
- if (percent > 100)
5721
- percent = 100;
5722
- if (percent < 0)
5723
- percent = 0;
5724
- return percent;
5725
- });
5726
- watch(() => finalPercent.value, (_, oldVal) => {
5727
- data._lastPercent = oldVal;
5728
- clearTimer();
5729
- _animate();
5730
- });
5731
- var _animate = () => {
5732
- var percent = finalPercent.value;
5733
- if (!props.active) {
5734
- data.curPercent = percent;
5735
- return;
5736
- }
5737
- data.curPercent = props.activeMode === "forwards" ? data._lastPercent : 0;
5738
- data._timerId = setInterval(() => {
5739
- if (percent <= data.curPercent + 1) {
5740
- clearTimer();
5741
- data.curPercent = percent;
5742
- emit("activeend", initUniCustomEvent(data.$uniProgressElement, new UniProgressActiveendEvent(percent)));
5743
- } else {
5744
- ++data.curPercent;
5745
- }
5746
- }, props.duration);
5747
- };
5748
- var clearTimer = () => {
5749
- clearInterval(data._timerId);
5750
- };
5751
- onMounted(() => {
5752
- instance === null || instance === void 0 || instance.$waitNativeRender(() => {
5753
- var _instance$proxy;
5754
- if (!instance)
5755
- return;
5756
- data.$uniProgressElement = (_instance$proxy = instance.proxy) === null || _instance$proxy === void 0 ? void 0 : _instance$proxy.$el;
5757
- data.$uniProgressElement._getAttribute = (key) => {
5758
- var _props$keyString$toSt, _props$keyString;
5759
- var keyString = camelize(key);
5760
- return props[keyString] !== null ? (_props$keyString$toSt = (_props$keyString = props[keyString]) === null || _props$keyString === void 0 ? void 0 : _props$keyString.toString()) !== null && _props$keyString$toSt !== void 0 ? _props$keyString$toSt : null : null;
5761
- };
5762
- _animate();
5763
- });
5764
- });
5765
- onBeforeUnmount(() => {
5766
- clearTimer();
5767
- });
5768
- return () => {
5769
- return createVNode("uni-progress-element", {
5770
- "class": "uni-progress",
5771
- "style": styleUniProgress.value
5772
- }, [createVNode("view", {
5773
- "class": "uni-progress-bar",
5774
- "style": barStyle.value
5775
- }, [createVNode("view", {
5776
- "class": "uni-progress-inner-bar",
5777
- "style": innerBarStyle.value
5778
- }, null, 4)], 4), props.showInfo ? createVNode("view", {
5779
- "class": "uni-progress-info",
5780
- "style": textStyle.value
5781
- }, [textStr.value], 4) : null], 4);
5782
- };
5783
- }
5784
- });
5785
- const progress$1 = /* @__PURE__ */ Object.defineProperty({
5786
- __proto__: null,
5787
- UniProgressActiveendEvent,
5788
- UniProgressElement,
5789
- default: progress
5790
- }, Symbol.toStringTag, { value: "Module" });
5791
- var _style_picker_view = {
5792
- "uni-picker-view": {
5793
- "": {
5794
- position: "relative"
5795
- }
5796
- },
5797
- "uni-picker-view-wrapper": {
5798
- "": {
5799
- display: "flex",
5800
- flexDirection: "row",
5801
- position: "absolute",
5802
- top: "0",
5803
- left: "0",
5804
- right: "0",
5805
- bottom: "0",
5806
- overflow: "hidden"
5807
- }
5808
- }
5809
- };
5810
- var _style_picker_column = {
5811
- "uni-picker-view-column": {
5812
- "": {
5813
- flex: "1",
5814
- position: "relative",
5815
- alignItems: "stretch",
5816
- overflow: "hidden"
5817
- }
5818
- },
5819
- "uni-picker-view-mask": {
5820
- "": {
5821
- position: "absolute",
5822
- top: "0",
5823
- left: "0",
5824
- right: "0",
5825
- bottom: "0",
5826
- pointerEvents: "none"
5827
- }
5828
- },
5829
- "uni-picker-view-mask-top": {
5830
- "": {
5831
- bottom: "0",
5832
- backgroundImage: "linear-gradient(to bottom,rgba(255, 255, 255, 0.95),rgba(255, 255, 255, 0.6))"
5833
- }
5834
- },
5835
- "uni-picker-view-mask-bottom": {
5836
- "": {
5837
- top: "0",
5838
- backgroundImage: "linear-gradient(to top,rgba(255, 255, 255, 0.95),rgba(255, 255, 255, 0.6))"
5839
- }
5840
- },
5841
- "uni-picker-view-group": {
5842
- "": {
5843
- flexDirection: "column",
5844
- position: "absolute",
5845
- top: "0",
5846
- left: "0",
5847
- right: "0",
5848
- bottom: "0"
5849
- }
5850
- },
5851
- "uni-picker-view-content": {
5852
- "": {
5853
- flexDirection: "column",
5854
- paddingTop: "0",
5855
- paddingRight: "0",
5856
- paddingBottom: "0",
5857
- paddingLeft: "0"
5858
- }
5859
- },
5860
- "uni-picker-view-indicator": {
5861
- "": {
5862
- position: "absolute",
5863
- left: "0",
5864
- right: "0",
5865
- top: "0",
5866
- height: "34px",
5867
- borderColor: "#e5e5e5",
5868
- borderTopWidth: "1px",
5869
- borderBottomWidth: "1px",
5870
- pointerEvents: "none"
5871
- }
5872
- }
5873
- };
5874
- var UniPickerViewColumnElement = /* @__PURE__ */ (() => class extends UniElementImpl {
5875
- constructor(data, pageNode) {
5876
- super(data, pageNode);
5877
- this.tagName = "PICKER-VIEW-COLUMN";
5878
- this.nodeName = this.tagName;
5879
- this._getAttribute = (key) => {
5880
- return null;
5881
- };
5882
- }
5883
- getAnyAttribute(key) {
5884
- var value = this._getAttribute(key);
5885
- if (value != null) {
5886
- return value;
5887
- }
5888
- return super.getAnyAttribute(key);
5889
- }
5890
- })();
5891
- class UniPickerViewChangeEventDetail {
5892
- constructor(value) {
5893
- this.value = value;
5894
- }
5895
- }
5896
- var UniPickerViewChangeEvent = /* @__PURE__ */ (() => class extends UniCustomEvent {
5897
- constructor(value) {
5898
- super("change", {
5899
- detail: new UniPickerViewChangeEventDetail(value)
5900
- });
5901
- }
5902
- })();
5903
- var UniPickerViewElement = /* @__PURE__ */ (() => class extends UniElementImpl {
5904
- constructor(data, pageNode) {
5905
- super(data, pageNode);
5906
- this.tagName = "PICKER-VIEW";
5907
- this.nodeName = this.tagName;
5908
- this._getAttribute = (key) => {
5909
- return null;
5910
- };
5911
- }
5912
- getAnyAttribute(key) {
5913
- var value = this._getAttribute(key);
5914
- if (value != null) {
5915
- return value;
5916
- }
5917
- return super.getAnyAttribute(key);
5918
- }
5919
- })();
5920
- const pickerView = /* @__PURE__ */ defineBuiltInComponent({
5921
- name: "PickerView",
5922
- rootElement: {
5923
- name: "uni-picker-view-element",
5924
- // @ts-expect-error not web element
5925
- class: UniPickerViewElement
5926
- },
5927
- props: {
5928
- value: {
5929
- type: Array,
5930
- default: []
5931
- },
5932
- indicatorStyle: {
5933
- type: String,
5934
- default: ""
5935
- },
5936
- maskTopStyle: {
5937
- type: String,
5938
- default: ""
5939
- },
5940
- maskBottomStyle: {
5941
- type: String,
5942
- default: ""
5943
- }
5944
- },
5945
- emits: ["change"],
5946
- setup(props, _ref) {
5947
- var {
5948
- emit,
5949
- expose,
5950
- slots
5951
- } = _ref;
5952
- var data = reactive({
5953
- $uniPickerViewElement: null,
5954
- $items: [],
5955
- valueSync: []
5956
- });
5957
- watch(() => props.value, (val) => {
5958
- val.forEach((_val, index2) => {
5959
- if (data.$items.length > index2) {
5960
- var _data$$items$index$$$;
5961
- var fn = (_data$$items$index$$$ = data.$items[index2].$.exposed) === null || _data$$items$index$$$ === void 0 ? void 0 : _data$$items$index$$$.setCurrent;
5962
- fn(_val);
5963
- }
5964
- });
5965
- data.valueSync = [...val];
5966
- }, {
5967
- immediate: true
5968
- });
5969
- provide("pickerViewProps", props);
5970
- var pickerViewElementRef = ref();
5971
- var instance = getCurrentInstance();
5972
- var _pickerViewUpdateHandler = (vm, type) => {
5973
- if (type == "add") {
5974
- data.$items.push(vm);
5975
- if (data.$items.length > data.valueSync.length) {
5976
- data.valueSync.push(0);
5977
- }
5978
- } else {
5979
- var index2 = data.$items.indexOf(vm);
5980
- if (index2 != -1) {
5981
- data.$items.splice(index2, 1);
5982
- data.valueSync.splice(index2, 1);
5983
- }
5984
- }
5985
- };
5986
- var getItemValue = (vm) => {
5987
- var index2 = data.$items.indexOf(vm);
5988
- if (index2 != -1) {
5989
- if (props.value.length > index2) {
5990
- return props.value[index2];
5991
- }
5992
- }
5993
- return 0;
5994
- };
5995
- var setItemValue = (vm, val) => {
5996
- var index2 = data.$items.indexOf(vm);
5997
- if (index2 != -1) {
5998
- if (data.valueSync.length > index2) {
5999
- data.valueSync[index2] = val;
6000
- }
6001
- emit("change", initUniCustomEvent(pickerViewElementRef.value, new UniPickerViewChangeEvent([...data.valueSync])));
6002
- }
6003
- };
6004
- expose({
6005
- _pickerViewUpdateHandler,
6006
- getItemValue,
6007
- setItemValue
6008
- });
6009
- onMounted(() => {
6010
- instance === null || instance === void 0 || instance.$waitNativeRender(() => {
6011
- if (!instance || !pickerViewElementRef.value)
6012
- return;
6013
- pickerViewElementRef.value._getAttribute = (key) => {
6014
- var _props$keyString$toSt, _props$keyString;
6015
- var keyString = camelize(key);
6016
- return props[keyString] !== null ? (_props$keyString$toSt = (_props$keyString = props[keyString]) === null || _props$keyString === void 0 ? void 0 : _props$keyString.toString()) !== null && _props$keyString$toSt !== void 0 ? _props$keyString$toSt : null : null;
6017
- };
6018
- });
6019
- });
6020
- var styleUniPickerView = _style_picker_view["uni-picker-view"][""];
6021
- var styleUniPickerViewWrapper = _style_picker_view["uni-picker-view-wrapper"][""];
6022
- return () => {
6023
- var _slots$default;
6024
- return createVNode("uni-picker-view-element", {
6025
- "ref": pickerViewElementRef,
6026
- "class": "uni-picker-view",
6027
- "style": styleUniPickerView
6028
- }, [createVNode("view", {
6029
- "class": "uni-picker-view-wrapper",
6030
- "style": styleUniPickerViewWrapper
6031
- }, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)], 4)], 4);
6032
- };
6033
- }
6034
- });
6035
- const pickerView$1 = /* @__PURE__ */ Object.defineProperty({
6036
- __proto__: null,
6037
- UniPickerViewChangeEvent,
6038
- UniPickerViewElement,
6039
- default: pickerView
6040
- }, Symbol.toStringTag, { value: "Module" });
6041
- const pickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
6042
- name: "PickerViewColumn",
6043
- rootElement: {
6044
- name: "uni-picker-view-column-element",
6045
- // @ts-expect-error
6046
- class: UniPickerViewColumnElement
6047
- },
6048
- setup(_props, _ref) {
6049
- var {
6050
- slots,
6051
- expose
6052
- } = _ref;
6053
- var instance = getCurrentInstance();
6054
- var pickerColumnRef = ref();
6055
- var indicator = ref();
6056
- var scrollViewRef = ref();
6057
- var contentRef = ref();
6058
- var pickerViewProps = inject("pickerViewProps");
6059
- var data = reactive({
6060
- height: 0,
6061
- indicatorHeight: 0,
6062
- current: 0,
6063
- scrollToElementTime: 0,
6064
- maskTopStyle: "",
6065
- maskBottomStyle: "",
6066
- indicatorStyle: "",
6067
- contentStyle: "",
6068
- _isMounted: false
6069
- });
6070
- var formatUserStyle = (styleStr) => {
6071
- var formatUserStyle2 = parseStringStyle(styleStr);
6072
- if (isString(formatUserStyle2["background-color"]) || isString(formatUserStyle2["background"])) {
6073
- formatUserStyle2 = Object.assign({}, formatUserStyle2, {
6074
- backgroundImage: "",
6075
- background: formatUserStyle2["background-color"] || formatUserStyle2["background"]
6076
- });
6077
- }
6078
- return formatUserStyle2;
6079
- };
6080
- var contentStyle = computed(() => {
6081
- return Object.assign({}, _style_picker_column["uni-picker-view-content"][""], parseStringStyle(data.contentStyle));
6082
- });
6083
- var maskTopStyle = computed(() => {
6084
- var userStyle = formatUserStyle(pickerViewProps.maskTopStyle);
6085
- var style = Object.assign({}, _style_picker_column["uni-picker-view-mask"][""], _style_picker_column["uni-picker-view-mask-top"][""], parseStringStyle(data.maskTopStyle), userStyle);
6086
- return style;
6087
- });
6088
- var maskBottomStyle = computed(() => {
6089
- var userStyle = formatUserStyle(pickerViewProps.maskBottomStyle);
6090
- return Object.assign({}, _style_picker_column["uni-picker-view-mask"][""], _style_picker_column["uni-picker-view-mask-bottom"][""], parseStringStyle(data.maskBottomStyle), userStyle);
6091
- });
6092
- var indicatorStyle = computed(() => {
6093
- var val = Object.assign({}, _style_picker_column["uni-picker-view-indicator"][""], parseStringStyle(pickerViewProps.indicatorStyle), parseStringStyle(data.indicatorStyle));
6094
- return val;
6095
- });
6096
- var styleUniPickerViewColumn = computed(() => {
6097
- return Object.assign({}, _style_picker_column["uni-picker-view-column"][""]);
6098
- });
6099
- var styleUniPickerViewGroup = computed(() => {
6100
- return Object.assign({}, _style_picker_column["uni-picker-view-group"][""]);
6101
- });
6102
- var styleViewMask = computed(() => {
6103
- return Object.assign({}, _style_picker_column["uni-picker-view-mask"][""]);
6104
- });
6105
- var init2 = () => {
6106
- data.height = pickerColumnRef.value.offsetHeight;
6107
- data.indicatorHeight = indicator.value.offsetHeight;
6108
- var padding = (data.height - data.indicatorHeight) / 2;
6109
- var maskPosition = "".concat(data.height - padding, "px");
6110
- data.maskTopStyle += ";bottom:".concat(maskPosition);
6111
- data.maskBottomStyle += ";top:".concat(maskPosition);
6112
- data.indicatorStyle = ";top:".concat(padding, "px");
6113
- data.contentStyle = "padding-top:".concat(padding, "px;padding-bottom:").concat(padding, "px");
6114
- nextTick(() => {
6115
- if (data.current != 0) {
6116
- setCurrent(data.current);
6117
- }
6118
- });
6119
- };
6120
- var onScrollend = (e) => {
6121
- if (Date.now() - data.scrollToElementTime < 200) {
6122
- return;
6123
- }
6124
- var y = e.detail.scrollTop;
6125
- if (data.indicatorHeight === 0) {
6126
- return;
6127
- }
6128
- var current = Math.round(y / data.indicatorHeight);
6129
- if (y % data.indicatorHeight != 0) {
6130
- setCurrent(current);
6131
- } else {
6132
- data.current = current;
6133
- }
6134
- };
6135
- var setCurrent = (current) => {
6136
- var scrollTop = current * data.indicatorHeight;
6137
- scrollViewRef.value.setAnyAttribute("scroll-top", scrollTop);
6138
- data.current = current;
6139
- data.scrollToElementTime = Date.now();
6140
- };
6141
- var uniResizeObserver = new UniResizeObserver((entries) => {
6142
- init2();
6143
- });
6144
- var created = () => {
6145
- var _instance$parent;
6146
- var $parent = (instance === null || instance === void 0 || (_instance$parent = instance.parent) === null || _instance$parent === void 0 ? void 0 : _instance$parent.type.name) === "PickerView" ? instance === null || instance === void 0 ? void 0 : instance.parent : null;
6147
- if ($parent !== null) {
6148
- $dispatchParent(instance === null || instance === void 0 ? void 0 : instance.proxy, "PickerView", "_pickerViewUpdateHandler", instance === null || instance === void 0 ? void 0 : instance.proxy, "add");
6149
- data.current = $dispatchParent(instance === null || instance === void 0 ? void 0 : instance.proxy, "PickerView", "getItemValue", instance === null || instance === void 0 ? void 0 : instance.proxy);
6150
- }
6151
- };
6152
- created();
6153
- expose({
6154
- setCurrent
6155
- });
6156
- onMounted(() => {
6157
- instance === null || instance === void 0 || instance.$waitNativeRender(() => {
6158
- if (!instance || !pickerColumnRef.value)
6159
- return;
6160
- init2();
6161
- setTimeout(() => {
6162
- data._isMounted = true;
6163
- }, 1e3);
6164
- uniResizeObserver.observe(pickerColumnRef.value);
6165
- });
6166
- });
6167
- onBeforeUnmount(() => {
6168
- var ctx = instance === null || instance === void 0 ? void 0 : instance.proxy;
6169
- uniResizeObserver.disconnect();
6170
- $dispatch(ctx, "PickerView", "_pickerViewUpdateHandler", ctx, "remove");
6171
- });
6172
- watch(() => data.current, (val, oldVal) => {
6173
- if (data._isMounted && val != oldVal) {
6174
- var ctx = instance === null || instance === void 0 ? void 0 : instance.proxy;
6175
- $dispatch(ctx, "PickerView", "setItemValue", ctx, val);
6176
- }
6177
- });
6178
- return () => {
6179
- var _slots$default;
6180
- return createVNode("uni-picker-view-column-element", {
6181
- "class": "uni-picker-view-column",
6182
- "style": styleUniPickerViewColumn.value,
6183
- "ref": pickerColumnRef
6184
- }, [createVNode("scroll-view", {
6185
- "deceleration-rate": 0.3,
6186
- "onScrollend": onScrollend,
6187
- "class": "uni-picker-view-group",
6188
- "style": styleUniPickerViewGroup.value,
6189
- "scroll-with-animation": data._isMounted,
6190
- "direction": "vertical",
6191
- "show-scrollbar": false,
6192
- "ref": scrollViewRef
6193
- }, [createVNode("view", {
6194
- "class": "uni-picker-view-content",
6195
- "style": contentStyle.value,
6196
- "ref": contentRef
6197
- }, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)], 4)], 44, ["onScrollend", "scroll-with-animation"]), createVNode("view", {
6198
- "userInteractionEnabled": false,
6199
- "class": "uni-picker-view-mask",
6200
- "style": styleViewMask.value
6201
- }, [createVNode("view", {
6202
- "class": "uni-picker-view-mask uni-picker-view-mask-top",
6203
- "style": maskTopStyle.value
6204
- }, null, 4), createVNode("view", {
6205
- "class": "uni-picker-view-mask uni-picker-view-mask-bottom",
6206
- "style": maskBottomStyle.value
6207
- }, null, 4)], 4), createVNode("view", {
6208
- "ref": indicator,
6209
- "userInteractionEnabled": false,
6210
- "class": "uni-picker-view-indicator",
6211
- "style": indicatorStyle.value
6212
- }, null, 4)], 4);
6213
- };
6214
- }
6215
- });
6216
- const pickerViewColumn$1 = /* @__PURE__ */ Object.defineProperty({
6217
- __proto__: null,
6218
- UniPickerViewColumnElement,
6219
- default: pickerViewColumn
6220
- }, Symbol.toStringTag, { value: "Module" });
6221
4791
  const index = /* @__PURE__ */ Object.defineProperty({
6222
4792
  __proto__: null,
6223
- Checkbox: checkbox$1,
6224
- CheckboxGroup: checkboxGroup$1,
6225
- Navigator: navigator$1,
6226
- PickerView: pickerView$1,
6227
- PickerViewColumn: pickerViewColumn$1,
6228
- Progress: progress$1,
6229
- Radio: radio$1,
6230
- RadioGroup: radioGroup$1
4793
+ Navigator: navigator$1
6231
4794
  }, Symbol.toStringTag, { value: "Module" });
6232
4795
  export {
6233
4796
  definePage as __definePage,