@tarojs/components 3.5.0-beta.1 → 3.5.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/taro-rich-text-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-swiper-core_2.cjs.entry.js +8 -3
- package/dist/cjs/taro-tabbar.cjs.entry.js +1 -1
- package/dist/cjs/taro-video-control_3.cjs.entry.js +19 -13
- package/dist/collection/components/rich-text/rich-text.js +1 -1
- package/dist/collection/components/swiper/swiper.js +8 -3
- package/dist/collection/components/tabbar/tabbar.js +1 -1
- package/dist/collection/components/video/style/index.css +0 -1
- package/dist/collection/components/video/utils.js +6 -7
- package/dist/collection/components/video/video-control.js +3 -3
- package/dist/collection/components/video/video.js +10 -3
- package/dist/esm/taro-rich-text-core.entry.js +1 -1
- package/dist/esm/taro-swiper-core_2.entry.js +8 -3
- package/dist/esm/taro-tabbar.entry.js +1 -1
- package/dist/esm/taro-video-control_3.entry.js +19 -13
- package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-tabbar.entry.js +1 -1
- package/dist/esm-es5/taro-video-control_3.entry.js +2 -2
- package/dist/taro-components/{p-64f6f87c.system.entry.js → p-12615394.system.entry.js} +2 -2
- package/dist/taro-components/p-1b11a8d4.system.entry.js +1 -0
- package/dist/taro-components/p-1d5fa0f3.entry.js +1 -0
- package/dist/taro-components/{p-bb3d337d.entry.js → p-9eb01395.entry.js} +2 -2
- package/dist/taro-components/p-a2fd3c03.system.js +1 -1
- package/dist/taro-components/{p-49df1b65.system.entry.js → p-c59f3780.system.entry.js} +1 -1
- package/dist/taro-components/{p-7419e765.entry.js → p-f980e090.entry.js} +1 -1
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/types/components/video/utils.d.ts +1 -3
- package/dist/types/components/video/video-control.d.ts +1 -1
- package/dist-h5/react/utils/reactify-wc.js +5 -2
- package/package.json +7 -3
- package/types/ScrollView.d.ts +3 -3
- package/dist/taro-components/p-97af3986.system.entry.js +0 -1
- package/dist/taro-components/p-fc28dbdd.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as o}from"./p-8c7cf814.js";(()=>{const o=import.meta.url,r={};return""!==o&&(r.resourcesUrl=new URL(".",o).href),e(r)})().then((e=>o([["p-de726095",[[4,"taro-checkbox-core",{name:[1],value:[1],color:[1],id:[1025],checked:[4],disabled:[4],nativeProps:[16],isWillLoadCalled:[32]}],[0,"taro-checkbox-group-core",{name:[8]},[[0,"checkboxchange","function"]]]]],["p-8a2b7701",[[4,"taro-radio-core",{name:[1],value:[1],id:[1025],checked:[1028],disabled:[4],nativeProps:[16],isWillLoadCalled:[32]}],[0,"taro-radio-group-core",{name:[8]},[[0,"radiochange","function"]]]]],["p-
|
|
1
|
+
import{p as e,b as o}from"./p-8c7cf814.js";(()=>{const o=import.meta.url,r={};return""!==o&&(r.resourcesUrl=new URL(".",o).href),e(r)})().then((e=>o([["p-de726095",[[4,"taro-checkbox-core",{name:[1],value:[1],color:[1],id:[1025],checked:[4],disabled:[4],nativeProps:[16],isWillLoadCalled:[32]}],[0,"taro-checkbox-group-core",{name:[8]},[[0,"checkboxchange","function"]]]]],["p-8a2b7701",[[4,"taro-radio-core",{name:[1],value:[1],id:[1025],checked:[1028],disabled:[4],nativeProps:[16],isWillLoadCalled:[32]}],[0,"taro-radio-group-core",{name:[8]},[[0,"radiochange","function"]]]]],["p-f980e090",[[4,"taro-swiper-core",{indicatorDots:[4,"indicator-dots"],indicatorColor:[1,"indicator-color"],indicatorActiveColor:[1,"indicator-active-color"],autoplay:[4],current:[2],interval:[2],duration:[2],circular:[4],vertical:[4],previousMargin:[1,"previous-margin"],nextMargin:[1,"next-margin"],displayMultipleItems:[2,"display-multiple-items"],full:[4],swiperWrapper:[32],swiper:[32],isWillLoadCalled:[32],observer:[32],observerFirst:[32],observerLast:[32]}],[0,"taro-swiper-item-core",{itemId:[1,"item-id"]}]]],["p-8c6d8802",[[0,"taro-ad-core"]]],["p-e6ec7abc",[[0,"taro-ad-custom-core"]]],["p-884e6eab",[[0,"taro-audio-core",{src:[1],controls:[4],autoplay:[4],loop:[4],muted:[4],nativeProps:[16]}]]],["p-549636ca",[[0,"taro-block-core"]]],["p-17b78ad7",[[4,"taro-button-core",{disabled:[4],hoverClass:[1,"hover-class"],type:[1],hoverStartTime:[2,"hover-start-time"],hoverStayTime:[2,"hover-stay-time"],size:[1],plain:[4],loading:[4],formType:[1,"form-type"],hover:[32],touch:[32]},[[1,"touchstart","onTouchStart"],[1,"touchend","onTouchEnd"]]]]],["p-fee2ad82",[[0,"taro-camera-core"]]],["p-7d457a6a",[[0,"taro-canvas-core",{canvasId:[1,"canvas-id"],nativeProps:[16]}]]],["p-880791ee",[[0,"taro-cover-image-core",{src:[1],nativeProps:[16]}]]],["p-c1642977",[[4,"taro-cover-view-core",{animation:[1],hoverClass:[1,"hover-class"],hoverStartTime:[2,"hover-start-time"],hoverStayTime:[2,"hover-stay-time"],hover:[32],touch:[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]]]]],["p-b31e6cf0",[[0,"taro-custom-wrapper-core"]]],["p-13d03572",[[0,"taro-editor-core"]]],["p-aca73ca4",[[4,"taro-form-core",{slotParent:[32]},[[0,"tarobuttonsubmit","onButtonSubmit"],[0,"tarobuttonreset","onButtonReset"]]]]],["p-087d704b",[[0,"taro-functional-page-navigator-core"]]],["p-c995a3aa",[[0,"taro-icon-core",{type:[1],size:[8],color:[1]}]]],["p-92f26e22",[[0,"taro-image-core",{src:[1],mode:[1],lazyLoad:[4,"lazy-load"],nativeProps:[16],aspectFillMode:[32]}]]],["p-a9c3e575",[[0,"taro-input-core",{value:[1],type:[1],password:[4],placeholder:[1],disabled:[4],maxlength:[2],autoFocus:[4,"auto-focus"],confirmType:[1,"confirm-type"],name:[1],nativeProps:[16]}]]],["p-c33b552b",[[0,"taro-keyboard-accessory-core"]]],["p-7f726d39",[[4,"taro-label-core",{for:[1]}]]],["p-615b87e8",[[0,"taro-live-player-core"]]],["p-1fbf755f",[[0,"taro-live-pusher-core"]]],["p-c6d14c2b",[[0,"taro-map-core"]]],["p-14484d41",[[0,"taro-match-media-core"]]],["p-917185f3",[[0,"taro-movable-area-core"]]],["p-ee1ffbb0",[[0,"taro-movable-view-core"]]],["p-b640bd56",[[0,"taro-navigation-bar-core"]]],["p-3b067d1f",[[0,"taro-navigator-core",{hoverClass:[1,"hover-class"],url:[1],openType:[1,"open-type"],isHover:[4,"is-hover"],delta:[2]},[[0,"click","onClick"]]]]],["p-e56a303b",[[0,"taro-official-account-core"]]],["p-68246408",[[0,"taro-open-data-core"]]],["p-085c4322",[[0,"taro-page-container-core"]]],["p-3e7aced1",[[0,"taro-page-meta-core"]]],["p-0afc53da",[[0,"taro-picker-view-column-core",{col:[1],initialPosition:[1,"initial-position"],paddingVertical:[2,"padding-vertical"],isInit:[32],isMove:[32]},[[1,"scroll","onScroll"],[1,"mouseup","onMouseEnd"],[1,"mouseout","onMouseEnd"],[1,"mouseleave","onMouseEnd"],[1,"touchend","onTouchEnd"]]]]],["p-88e3bc92",[[4,"taro-picker-view-core",{indicatorStyle:[1,"indicator-style"],indicatorClass:[1,"indicator-class"],value:[16],maskStyle:[1,"mask-style"],maskClass:[1,"mask-class"]},[[0,"onselect","onSelect"],[0,"onselectstart","onSelectStart"],[0,"onselectend","onPickerColEnd"]]]]],["p-06352f55",[[0,"taro-progress-core",{percent:[2],showInfo:[4,"show-info"],borderRadius:[8,"border-radius"],fontSize:[8,"font-size"],strokeWidth:[8,"stroke-width"],activeColor:[1,"active-color"],backgroundColor:[1,"background-color"],active:[4]}]]],["p-3e1e4626",[[4,"taro-pull-to-refresh",{prefixCls:[1,"prefix-cls"],distanceToRefresh:[2,"distance-to-refresh"],damping:[2],indicator:[16],currSt:[32],dragOnEdge:[32]}]]],["p-55646f03",[[0,"taro-rich-text-core",{nodes:[1]}]]],["p-f5377a15",[[4,"taro-scroll-view-core",{scrollX:[4,"scroll-x"],scrollY:[4,"scroll-y"],upperThreshold:[8,"upper-threshold"],lowerThreshold:[8,"lower-threshold"],mpScrollTop:[8,"scroll-top"],mpScrollLeft:[8,"scroll-left"],mpScrollIntoView:[1,"scroll-into-view"],scrollWithAnimation:[4,"scroll-with-animation"]}]]],["p-b455351e",[[0,"taro-share-element-core"]]],["p-7f8ddefe",[[0,"taro-slider-core",{min:[2],max:[2],step:[2],disabled:[4],value:[1026],activeColor:[1,"active-color"],backgroundColor:[1,"background-color"],blockSize:[2,"block-size"],blockColor:[1,"block-color"],showValue:[4,"show-value"],name:[1],val:[32],totalWidth:[32],touching:[32],ogX:[32],touchId:[32],percent:[32],ogPercent:[32],isWillLoadCalled:[32]}]]],["p-f425f3b5",[[0,"taro-slot-core"]]],["p-58cbfd17",[[0,"taro-switch-core",{type:[1],checked:[4],color:[1],name:[1],disabled:[4],nativeProps:[16],isChecked:[32],isWillLoadCalled:[32]}]]],["p-1d5fa0f3",[[0,"taro-tabbar",{conf:[16],list:[32],borderStyle:[32],backgroundColor:[32],color:[32],selectedColor:[32],selectedIndex:[32],status:[32]}]]],["p-8ca394d6",[[4,"taro-text-core",{selectable:[4]}]]],["p-34d60fc8",[[0,"taro-textarea-core",{value:[1],placeholder:[1],disabled:[4],maxlength:[2],autoFocus:[4,"auto-focus"],autoHeight:[4,"auto-height"],name:[1],nativeProps:[16],line:[32]}]]],["p-1e44fcfd",[[4,"taro-view-core",{animation:[1],hoverClass:[1,"hover-class"],hoverStartTime:[2,"hover-start-time"],hoverStayTime:[2,"hover-stay-time"],hover:[32],touch:[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]]]]],["p-9ff180ae",[[0,"taro-voip-room-core"]]],["p-c0875abf",[[0,"taro-web-view-core",{src:[1]}]]],["p-e5fdbc1c",[[4,"taro-picker-core",{mode:[1],disabled:[4],range:[16],rangeKey:[1,"range-key"],value:[8],start:[1],end:[1],fields:[1],name:[1],pickerValue:[32],height:[32],hidden:[32],fadeOut:[32],isWillLoadCalled:[32]}],[0,"taro-picker-group",{mode:[1],range:[16],rangeKey:[1,"range-key"],height:[2],columnId:[1,"column-id"],updateHeight:[16],onColumnChange:[16],updateDay:[16],startY:[32],preY:[32],hadMove:[32],touchEnd:[32],isMove:[32]},[[1,"mousedown","onMouseDown"],[1,"mousemove","onMouseMove"],[1,"mouseup","onMouseMoveEnd"],[1,"mouseleave","onMouseMoveEnd"],[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]]]]],["p-9eb01395",[[0,"taro-video-core",{src:[1],duration:[2],controls:[4],autoplay:[4],loop:[4],muted:[4],initialTime:[2,"initial-time"],poster:[1],objectFit:[1,"object-fit"],showProgress:[4,"show-progress"],showFullscreenBtn:[4,"show-fullscreen-btn"],showPlayBtn:[4,"show-play-btn"],showCenterPlayBtn:[4,"show-center-play-btn"],showMuteBtn:[4,"show-mute-btn"],danmuList:[16],danmuBtn:[4,"danmu-btn"],enableDanmu:[4,"enable-danmu"],enablePlayGesture:[4,"enable-play-gesture"],enableProgressGesture:[4,"enable-progress-gesture"],vslideGesture:[4,"vslide-gesture"],vslideGestureInFullscreen:[4,"vslide-gesture-in-fullscreen"],nativeProps:[16],_duration:[32],_enableDanmu:[32],isPlaying:[32],isFirst:[32],isFullScreen:[32],fullScreenTimestamp:[32],isMute:[32],play:[64],pause:[64],stop:[64],seek:[64],requestFullScreen:[64],exitFullScreen:[64]},[[5,"touchmove","onDocumentTouchMove"],[5,"touchend","onDocumentTouchEnd"],[5,"touchcancel","onDocumentTouchEnd"]]],[4,"taro-video-control",{controls:[4],currentTime:[2,"current-time"],duration:[2],isPlaying:[4,"is-playing"],pauseFunc:[16],playFunc:[16],seekFunc:[16],showPlayBtn:[4,"show-play-btn"],showProgress:[4,"show-progress"],setProgressBall:[64],toggleVisibility:[64],getIsDraggingProgressBall:[64],setCurrentTime:[64]},[[5,"touchmove","onDocumentTouchMove"],[5,"touchend","onDocumentTouchEnd"],[5,"touchcancel","onDocumentTouchEnd"]]],[0,"taro-video-danmu",{enable:[4],danmuList:[32],sendDanmu:[64],tick:[64]}]]]],e)));
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export declare const formatTime: (time?: number | undefined) => string;
|
|
2
2
|
export declare const calcDist: (x: number, y: number) => number;
|
|
3
3
|
export declare const normalizeNumber: (number: number) => number;
|
|
4
|
-
|
|
5
|
-
* @returns: {requestFullscreen: 'requestFullscreen', exitFullscreen: 'exitFullscreen', ...}
|
|
6
|
-
*/
|
|
4
|
+
export declare let scene: string;
|
|
7
5
|
export declare const screenFn: Record<string, any>;
|
|
8
6
|
export declare const isHls: (url: any) => boolean;
|
|
@@ -23,7 +23,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
23
23
|
import React, { createElement, createRef } from 'react'; // eslint-disable-next-line
|
|
24
24
|
|
|
25
25
|
var h = React.createElement;
|
|
26
|
-
var SCROLL_VIEW = 'taro-scroll-view-core';
|
|
26
|
+
var SCROLL_VIEW = 'taro-scroll-view-core';
|
|
27
|
+
var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i; // 为了不要覆盖 wc 中 host 内置的 class 和 stencil 加入的 class
|
|
27
28
|
|
|
28
29
|
function getClassName(wc, prevProps, props) {
|
|
29
30
|
var classList = Array.from(wc.classList);
|
|
@@ -48,8 +49,10 @@ function updateStyle(dom, key, val) {
|
|
|
48
49
|
if (/^--/.test(key)) {
|
|
49
50
|
// css variable
|
|
50
51
|
dom.style.setProperty(key, val);
|
|
51
|
-
} else {
|
|
52
|
+
} else if (typeof val !== 'number' || IS_NON_DIMENSIONAL.test(key)) {
|
|
52
53
|
dom.style[key] = val;
|
|
54
|
+
} else {
|
|
55
|
+
dom.style[key] = val + 'px';
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/components",
|
|
3
|
-
"version": "3.5.0-beta.
|
|
3
|
+
"version": "3.5.0-beta.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "dist/index.js",
|
|
6
6
|
"main:h5": "dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@stencil/core": "~2.13.0",
|
|
43
43
|
"@stencil/sass": "1.5.2",
|
|
44
|
-
"@tarojs/taro": "3.5.0-beta.
|
|
44
|
+
"@tarojs/taro": "3.5.0-beta.4",
|
|
45
45
|
"better-scroll": "^1.14.1",
|
|
46
46
|
"classnames": "^2.2.5",
|
|
47
47
|
"hls.js": "^1.1.5",
|
|
@@ -54,7 +54,11 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"jquery": "^3.4.1",
|
|
56
56
|
"karmatic": "^2.1.0",
|
|
57
|
+
"react": "^17.0.2",
|
|
58
|
+
"react-dom": "^17.0.2",
|
|
57
59
|
"simulant": "^0.2.2",
|
|
60
|
+
"style-loader": "1.3.0",
|
|
61
|
+
"webpack": "4.46.0",
|
|
58
62
|
"workbox-build": "4.3.1"
|
|
59
63
|
},
|
|
60
64
|
"peerDependenciesMeta": {
|
|
@@ -68,5 +72,5 @@
|
|
|
68
72
|
"optional": true
|
|
69
73
|
}
|
|
70
74
|
},
|
|
71
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "7aca7841ed7e2af1b182ff5d24e91f44730ce783"
|
|
72
76
|
}
|
package/types/ScrollView.d.ts
CHANGED
|
@@ -225,15 +225,15 @@ declare namespace ScrollViewProps {
|
|
|
225
225
|
* const Threshold = 20
|
|
226
226
|
* const vStyleA = {
|
|
227
227
|
* height: '150px',
|
|
228
|
-
* '
|
|
228
|
+
* 'backgroundColor': 'rgb(26, 173, 25)'
|
|
229
229
|
* }
|
|
230
230
|
* const vStyleB = {
|
|
231
231
|
* height: '150px',
|
|
232
|
-
* '
|
|
232
|
+
* 'backgroundColor': 'rgb(39,130,215)'
|
|
233
233
|
* }
|
|
234
234
|
* const vStyleC = {
|
|
235
235
|
* height: '150px',
|
|
236
|
-
* '
|
|
236
|
+
* 'backgroundColor': 'rgb(241,241,241)',
|
|
237
237
|
* color: '#333'
|
|
238
238
|
* }
|
|
239
239
|
* return (
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __spreadArray=this&&this.__spreadArray||function(e,t){for(var r=0,a=t.length,o=e.length;r<a;r++,o++)e[o]=t[r];return e};System.register(["./p-44996bd6.system.js","@tarojs/taro","./p-5f4d0d5b.system.js"],(function(e){"use strict";var t,r,a,o,n,i,s;return{setters:[function(e){t=e.h;r=e.r;a=e.c;o=e.H;n=e.g},function(e){i=e.default},function(e){s=e.c}],execute:function(){var l=function(e){var t=e||"";var r;var a={path:null,query:null,fragment:null};r=t.indexOf("#");if(r>-1){a.fragment=t.substring(r+1);t=t.substring(0,r)}r=t.indexOf("?");if(r>-1){a.query=t.substring(r+1);t=t.substring(0,r)}a.path=t;return a};function d(e){return e.charAt(0)==="/"}function b(e,t){for(var r=t,a=r+1,o=e.length;a<o;r+=1,a+=1){e[r]=e[a]}e.pop()}function h(e,t){if(t===undefined)t="";var r=e&&e.split("/")||[];var a=t&&t.split("/")||[];var o=e&&d(e);var n=t&&d(t);var i=o||n;if(e&&d(e)){a=r}else if(r.length){a.pop();a=a.concat(r)}if(!a.length)return"/";var s;if(a.length){var l=a[a.length-1];s=l==="."||l===".."||l===""}else{s=false}var h=0;for(var f=a.length;f>=0;f--){var c=a[f];if(c==="."){b(a,f)}else if(c===".."){b(a,f);h++}else if(h){b(a,f);h--}}if(!i)for(;h--;h)a.unshift("..");if(i&&a[0]!==""&&(!a[0]||!d(a[0])))a.unshift("");var u=a.join("/");if(s&&u.substr(-1)!=="/")u+="/";return u}var f=function(e){var r=e.index,a=e.isSelected,o=a===void 0?false:a,n=e.textColor,i=e.iconPath,l=e.badgeText,d=e.showRedDot,b=d===void 0?false:d,h=e.text,f=e.onSelect;var c=s("weui-tabbar__item",{"weui-bar__item_on":o});var u={position:"absolute",top:"-2px",right:"-13px"};var v={position:"absolute",top:"0",right:"-6px"};function g(){f(r)}return t("a",{key:r,href:"javascript:;",class:c,onClick:g},t("span",{style:{display:"inline-block",position:"relative"}},t("img",{src:i,alt:"",class:"weui-tabbar__icon"}),!!l&&t("span",{class:"weui-badge taro-tabbar-badge",style:u},l),b&&t("span",{class:"weui-badge weui-badge_dot",style:v})),t("p",{class:"weui-tabbar__label",style:{color:n}},h))};var c="html,body{height:100%}#app{height:100%}.taro-tabbar__border-white::before{border-top-color:#fff !important}.taro-tabbar__container{display:-ms-flexbox;display:flex;overflow:hidden;-ms-flex-direction:column;flex-direction:column;height:100%}.taro-tabbar__panel{overflow:auto;position:relative;-ms-flex:1;flex:1;-webkit-overflow-scrolling:auto}.taro-tabbar__tabbar{position:relative;width:100%;height:50px;-webkit-transition:bottom 0.2s, top 0.2s;transition:bottom 0.2s, top 0.2s}.taro-tabbar__tabbar-top{top:0}.taro-tabbar__tabbar-bottom{bottom:0;margin-bottom:constant(safe-area-inset-bottom);margin-bottom:env(safe-area-inset-bottom)}.taro-tabbar__tabbar-hide{display:none}.taro-tabbar__tabbar-slideout{top:-52px;-ms-flex:0 0;flex:0 0}.taro-tabbar__panel+.taro-tabbar__tabbar-slideout{top:auto;bottom:-52px}";var u=function(e){if(e===void 0){e=""}return e[0]==="/"?e:"/"+e};var v=function(e,t){if(e===void 0){e=""}if(t===void 0){t=""}return new RegExp("^"+t+"(\\/|\\?|#|$)","i").test(e)};var g=function(e,t){if(e===void 0){e=""}if(t===void 0){t=""}return v(e,t)?e.substr(t.length):e};var _=function(e,t){if(e===void 0){e=""}if(t===void 0){t=""}return e.includes(t)?e.substring(0,e.length-t.length):e};var p=0;var m=1;var T=2;var B="taro-tabbar__tabbar";var H="taro-tabbar__tabbar-hide";var x="taro-tabbar__tabbar-slideout";var w=e("taro_tabbar",function(){function e(e){var t=this;r(this,e);this.onLongPress=a(this,"longpress",7);this.homePage="";this.customRoutes=[];this.tabbarPos="bottom";this.selectedIndex=-1;this.status=p;this.getOriginUrl=function(e){var r=t.customRoutes.filter((function(t){var r=t[1];var a=l(r).path;var o=l(e).path;return a===o}));return _(r.length?r[0][0]:e,".html")};this.getSelectedIndex=function(e){var r=-1;t.list.forEach((function(t,a){var o=t.pagePath;var n=l(e).path;var i=l(o).path;if(n===i){r=a}}));return r};this.switchTab=function(e){t.selectedIndex=e;i.switchTab({url:t.list[e].pagePath})};this.switchTabHandler=function(e){var r=e.url,a=e.successHandler,o=e.errorHandler;var n=t.getOriginUrl(t.getCurrentUrl()||t.homePage);var i=h(r,n);var s=t.getSelectedIndex(i);if(s>-1){t.switchTab(s);a({errMsg:"switchTab:ok"})}else{o({errMsg:'switchTab:fail page "'+i+'" is not found'})}};this.routerChangeHandler=function(e){var r;var a=(r=e===null||e===void 0?void 0:e.toLocation)===null||r===void 0?void 0:r.path;var o;if(typeof a==="string"){var n=t.conf.basename||"/";o=g(u(a||t.homePage),n)}else{o=t.getCurrentUrl()}t.selectedIndex=t.getSelectedIndex(t.getOriginUrl(o))};this.setTabBarBadgeHandler=function(e){var r=e.index,a=e.text,o=e.successHandler,n=e.errorHandler;var i=__spreadArray([],t.list);if(r in i){i[r].showRedDot=false;i[r].badgeText=a;o({errMsg:"setTabBarBadge:ok"})}else{n({errMsg:"setTabBarBadge:fail tabbar item not found"})}t.list=i};this.removeTabBarBadgeHandler=function(e){var r=e.index,a=e.successHandler,o=e.errorHandler;var n=__spreadArray([],t.list);if(r in n){n[r].badgeText=null;n[r].badgeText=null;a({errMsg:"removeTabBarBadge:ok"})}else{o({errMsg:"removeTabBarBadge:fail tabbar item not found"})}t.list=n};this.showTabBarRedDotHandler=function(e){var r=e.index,a=e.successHandler,o=e.errorHandler;var n=__spreadArray([],t.list);if(r in n){n[r].badgeText=null;n[r].showRedDot=true;a({errMsg:"showTabBarRedDot:ok"})}else{o({errMsg:"showTabBarRedDot:fail tabbar item not found"})}t.list=n};this.hideTabBarRedDotHandler=function(e){var r=e.index,a=e.successHandler,o=e.errorHandler;var n=__spreadArray([],t.list);if(r in n){n[r].showRedDot=false;a({errMsg:"hideTabBarRedDot:ok"})}else{o({errMsg:"hideTabBarRedDot:fail tabbar item not found"})}t.list=n};this.showTabBarHandler=function(e){var r=e.successHandler;t.status=p;r({errMsg:"showTabBar:ok"})};this.hideTabBarHandler=function(e){var r=e.animation,a=e.successHandler;t.status=r?T:m;a({errMsg:"hideTabBar:ok"})};this.setTabBarStyleHandler=function(e){var r=e.color,a=e.selectedColor,o=e.backgroundColor,n=e.borderStyle,i=e.successHandler;if(o)t.backgroundColor=o;if(n)t.borderStyle=n;if(r)t.color=r;if(a)t.selectedColor=a;i({errMsg:"setTabBarStyle:ok"})};this.setTabBarItemHandler=function(e){var r=e.index,a=e.iconPath,o=e.selectedIconPath,n=e.text,i=e.successHandler,s=e.errorHandler;var l=__spreadArray([],t.list);if(r in l){if(a)l[r].iconPath=a;if(o)l[r].selectedIconPath=o;if(n)l[r].text=n;i({errMsg:"setTabBarItem:ok"})}else{s({errMsg:"setTabBarItem:fail tabbar item not found"})}t.list=l};var o=this.conf.list;var n=this.conf.customRoutes;if(Object.prototype.toString.call(o)!=="[object Array]"||o.length<2||o.length>5){throw new Error("tabBar 配置错误")}this.homePage=u(this.conf.homePage);var s=function(e){var t;var r=n[e];e=u(e);if(typeof r==="string"){d.customRoutes.push([e,u(r)])}else if((r===null||r===void 0?void 0:r.length)>0){(t=d.customRoutes).push.apply(t,r.map((function(t){return[e,u(t)]})))}};var d=this;for(var b in n){s(b)}o.forEach((function(e){if(e.pagePath.indexOf("/")!==0){e.pagePath="/"+e.pagePath}}));this.list=o;this.borderStyle=this.conf.borderStyle;this.backgroundColor=this.conf.backgroundColor;this.color=this.conf.color;this.selectedColor=this.conf.selectedColor}e.prototype.getCurrentUrl=function(){var e=this.conf.mode;var t=this.conf.basename||"/";var r;if(e==="hash"){var a=window.location.href;var o=a.indexOf("#");r=o===-1?"":a.substring(o+1)}else{r=location.pathname}var n=u(g(r,t));return decodeURI(n==="/"?this.homePage:n)};e.prototype.bindEvent=function(){i.eventCenter.on("__taroRouterChange",this.routerChangeHandler);i.eventCenter.on("__taroSwitchTab",this.switchTabHandler);i.eventCenter.on("__taroSetTabBarBadge",this.setTabBarBadgeHandler);i.eventCenter.on("__taroRemoveTabBarBadge",this.removeTabBarBadgeHandler);i.eventCenter.on("__taroShowTabBarRedDotHandler",this.showTabBarRedDotHandler);i.eventCenter.on("__taroHideTabBarRedDotHandler",this.hideTabBarRedDotHandler);i.eventCenter.on("__taroShowTabBar",this.showTabBarHandler);i.eventCenter.on("__taroHideTabBar",this.hideTabBarHandler);i.eventCenter.on("__taroSetTabBarStyle",this.setTabBarStyleHandler);i.eventCenter.on("__taroSetTabBarItem",this.setTabBarItemHandler)};e.prototype.removeEvent=function(){i.eventCenter.off("__taroRouterChange",this.routerChangeHandler);i.eventCenter.off("__taroSwitchTab",this.switchTabHandler);i.eventCenter.off("__taroSetTabBarBadge",this.setTabBarBadgeHandler);i.eventCenter.off("__taroRemoveTabBarBadge",this.removeTabBarBadgeHandler);i.eventCenter.off("__taroShowTabBarRedDotHandler",this.showTabBarRedDotHandler);i.eventCenter.off("__taroHideTabBarRedDotHandler",this.hideTabBarRedDotHandler);i.eventCenter.off("__taroShowTabBar",this.showTabBarHandler);i.eventCenter.off("__taroHideTabBar",this.hideTabBarHandler);i.eventCenter.off("__taroSetTabBarStyle",this.setTabBarStyleHandler);i.eventCenter.off("__taroSetTabBarItem",this.setTabBarItemHandler)};e.prototype.componentDidLoad=function(){this.tabbarPos=this.tabbar.nextElementSibling?"top":"bottom";this.bindEvent();this.routerChangeHandler()};e.prototype.disconnectedCallback=function(){this.removeEvent()};e.prototype.render=function(){var e,r;var a=this;var n=this.tabbarPos,i=n===void 0?"bottom":n;var l=this.status;var d=s("weui-tabbar",(e={},e["taro-tabbar__border-"+(this.borderStyle||"black")]=true,e));var b=this.selectedIndex===-1||l===m;var h=l===T;return t(o,{class:s(B,B+"-"+i,(r={},r[H]=b,r[x]=h,r))},t("div",{class:d,style:{backgroundColor:this.backgroundColor||"",height:"inherit"}},this.list.map((function(e,r){var o=a.selectedIndex===r;var n;var i;if(o){n=a.selectedColor||"";i=e.selectedIconPath}else{n=a.color||"";i=e.iconPath}return t(f,{index:r,onSelect:a.switchTab.bind(a),isSelected:o,textColor:n,iconPath:i,text:e.text,badgeText:e.badgeText,showRedDot:e.showRedDot})}))))};Object.defineProperty(e.prototype,"tabbar",{get:function(){return n(this)},enumerable:false,configurable:true});return e}());w.style=c}}}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as t,r as a,c as r,H as e,g as s}from"./p-8c7cf814.js";import o from"@tarojs/taro";import{c as i}from"./p-7e5d2d7a.js";const n=t=>{let a,r=t||"";const e={path:null,query:null,fragment:null};return a=r.indexOf("#"),a>-1&&(e.fragment=r.substring(a+1),r=r.substring(0,a)),a=r.indexOf("?"),a>-1&&(e.query=r.substring(a+1),r=r.substring(0,a)),e.path=r,e};function h(t){return"/"===t.charAt(0)}function b(t,a){for(var r=a,e=r+1,s=t.length;e<s;r+=1,e+=1)t[r]=t[e];t.pop()}const l=({index:a,isSelected:r=!1,textColor:e,iconPath:s,badgeText:o,showRedDot:n=!1,text:h,onSelect:b})=>{const l=i("weui-tabbar__item",{"weui-bar__item_on":r});return t("a",{key:a,href:"javascript:;",class:l,onClick:function(){b(a)}},t("span",{style:{display:"inline-block",position:"relative"}},t("img",{src:s,alt:"",class:"weui-tabbar__icon"}),!!o&&t("span",{class:"weui-badge taro-tabbar-badge",style:{position:"absolute",top:"-2px",right:"-13px"}},o),n&&t("span",{class:"weui-badge weui-badge_dot",style:{position:"absolute",top:"0",right:"-6px"}})),t("p",{class:"weui-tabbar__label",style:{color:e}},h))},d=(t="")=>"/"===t[0]?t:`/${t}`,c=(t="",a="")=>((t="",a="")=>new RegExp("^"+a+"(\\/|\\?|#|$)","i").test(t))(t,a)?t.substr(a.length):t;let _=class{constructor(t){a(this,t),this.onLongPress=r(this,"longpress",7),this.homePage="",this.customRoutes=[],this.tabbarPos="bottom",this.selectedIndex=-1,this.status=0,this.getOriginUrl=t=>{const a=this.customRoutes.filter((([,a])=>n(a).path===n(t).path));return((t="",a="")=>t.includes(a)?t.substring(0,t.length-a.length):t)(a.length?a[0][0]:t,".html")},this.getSelectedIndex=t=>{let a=-1;return this.list.forEach((({pagePath:r},e)=>{n(t).path===n(r).path&&(a=e)})),a},this.switchTab=t=>{this.selectedIndex=t,o.switchTab({url:this.list[t].pagePath})},this.switchTabHandler=({url:t,successHandler:a,errorHandler:r})=>{const e=function(t,a){void 0===a&&(a="");var r,e=t&&t.split("/")||[],s=a&&a.split("/")||[],o=t&&h(t),i=a&&h(a),n=o||i;if(t&&h(t)?s=e:e.length&&(s.pop(),s=s.concat(e)),!s.length)return"/";if(s.length){var l=s[s.length-1];r="."===l||".."===l||""===l}else r=!1;for(var d=0,c=s.length;c>=0;c--){var _=s[c];"."===_?b(s,c):".."===_?(b(s,c),d++):d&&(b(s,c),d--)}if(!n)for(;d--;d)s.unshift("..");!n||""===s[0]||s[0]&&h(s[0])||s.unshift("");var u=s.join("/");return r&&"/"!==u.substr(-1)&&(u+="/"),u}(t,this.getOriginUrl(this.getCurrentUrl()||this.homePage)),s=this.getSelectedIndex(e);s>-1?(this.switchTab(s),a({errMsg:"switchTab:ok"})):r({errMsg:`switchTab:fail page "${e}" is not found`})},this.routerChangeHandler=t=>{var a;const r=null===(a=null==t?void 0:t.toLocation)||void 0===a?void 0:a.path;let e;if("string"==typeof r){const t=this.conf.basename||"/";e=c(d(r||this.homePage),t)}else e=this.getCurrentUrl();this.selectedIndex=this.getSelectedIndex(this.getOriginUrl(e))},this.setTabBarBadgeHandler=({index:t,text:a,successHandler:r,errorHandler:e})=>{const s=[...this.list];t in s?(s[t].showRedDot=!1,s[t].badgeText=a,r({errMsg:"setTabBarBadge:ok"})):e({errMsg:"setTabBarBadge:fail tabbar item not found"}),this.list=s},this.removeTabBarBadgeHandler=({index:t,successHandler:a,errorHandler:r})=>{const e=[...this.list];t in e?(e[t].badgeText=null,e[t].badgeText=null,a({errMsg:"removeTabBarBadge:ok"})):r({errMsg:"removeTabBarBadge:fail tabbar item not found"}),this.list=e},this.showTabBarRedDotHandler=({index:t,successHandler:a,errorHandler:r})=>{const e=[...this.list];t in e?(e[t].badgeText=null,e[t].showRedDot=!0,a({errMsg:"showTabBarRedDot:ok"})):r({errMsg:"showTabBarRedDot:fail tabbar item not found"}),this.list=e},this.hideTabBarRedDotHandler=({index:t,successHandler:a,errorHandler:r})=>{const e=[...this.list];t in e?(e[t].showRedDot=!1,a({errMsg:"hideTabBarRedDot:ok"})):r({errMsg:"hideTabBarRedDot:fail tabbar item not found"}),this.list=e},this.showTabBarHandler=({successHandler:t})=>{this.status=0,t({errMsg:"showTabBar:ok"})},this.hideTabBarHandler=({animation:t,successHandler:a})=>{this.status=t?2:1,a({errMsg:"hideTabBar:ok"})},this.setTabBarStyleHandler=({color:t,selectedColor:a,backgroundColor:r,borderStyle:e,successHandler:s})=>{r&&(this.backgroundColor=r),e&&(this.borderStyle=e),t&&(this.color=t),a&&(this.selectedColor=a),s({errMsg:"setTabBarStyle:ok"})},this.setTabBarItemHandler=({index:t,iconPath:a,selectedIconPath:r,text:e,successHandler:s,errorHandler:o})=>{const i=[...this.list];t in i?(a&&(i[t].iconPath=a),r&&(i[t].selectedIconPath=r),e&&(i[t].text=e),s({errMsg:"setTabBarItem:ok"})):o({errMsg:"setTabBarItem:fail tabbar item not found"}),this.list=i};const e=this.conf.list,s=this.conf.customRoutes;if("[object Array]"!==Object.prototype.toString.call(e)||e.length<2||e.length>5)throw new Error("tabBar 配置错误");this.homePage=d(this.conf.homePage);for(let t in s){const a=s[t];t=d(t),"string"==typeof a?this.customRoutes.push([t,d(a)]):(null==a?void 0:a.length)>0&&this.customRoutes.push(...a.map((a=>[t,d(a)])))}e.forEach((t=>{0!==t.pagePath.indexOf("/")&&(t.pagePath="/"+t.pagePath)})),this.list=e,this.borderStyle=this.conf.borderStyle,this.backgroundColor=this.conf.backgroundColor,this.color=this.conf.color,this.selectedColor=this.conf.selectedColor}getCurrentUrl(){const t=this.conf.basename||"/";let a;if("hash"===this.conf.mode){const t=window.location.href,r=t.indexOf("#");a=-1===r?"":t.substring(r+1)}else a=location.pathname;const r=d(c(a,t));return decodeURI("/"===r?this.homePage:r)}bindEvent(){o.eventCenter.on("__taroRouterChange",this.routerChangeHandler),o.eventCenter.on("__taroSwitchTab",this.switchTabHandler),o.eventCenter.on("__taroSetTabBarBadge",this.setTabBarBadgeHandler),o.eventCenter.on("__taroRemoveTabBarBadge",this.removeTabBarBadgeHandler),o.eventCenter.on("__taroShowTabBarRedDotHandler",this.showTabBarRedDotHandler),o.eventCenter.on("__taroHideTabBarRedDotHandler",this.hideTabBarRedDotHandler),o.eventCenter.on("__taroShowTabBar",this.showTabBarHandler),o.eventCenter.on("__taroHideTabBar",this.hideTabBarHandler),o.eventCenter.on("__taroSetTabBarStyle",this.setTabBarStyleHandler),o.eventCenter.on("__taroSetTabBarItem",this.setTabBarItemHandler)}removeEvent(){o.eventCenter.off("__taroRouterChange",this.routerChangeHandler),o.eventCenter.off("__taroSwitchTab",this.switchTabHandler),o.eventCenter.off("__taroSetTabBarBadge",this.setTabBarBadgeHandler),o.eventCenter.off("__taroRemoveTabBarBadge",this.removeTabBarBadgeHandler),o.eventCenter.off("__taroShowTabBarRedDotHandler",this.showTabBarRedDotHandler),o.eventCenter.off("__taroHideTabBarRedDotHandler",this.hideTabBarRedDotHandler),o.eventCenter.off("__taroShowTabBar",this.showTabBarHandler),o.eventCenter.off("__taroHideTabBar",this.hideTabBarHandler),o.eventCenter.off("__taroSetTabBarStyle",this.setTabBarStyleHandler),o.eventCenter.off("__taroSetTabBarItem",this.setTabBarItemHandler)}componentDidLoad(){this.tabbarPos=this.tabbar.nextElementSibling?"top":"bottom",this.bindEvent(),this.routerChangeHandler()}disconnectedCallback(){this.removeEvent()}render(){const{tabbarPos:a="bottom"}=this,r=this.status,s=i("weui-tabbar",{[`taro-tabbar__border-${this.borderStyle||"black"}`]:!0});return t(e,{class:i("taro-tabbar__tabbar",`taro-tabbar__tabbar-${a}`,{"taro-tabbar__tabbar-hide":-1===this.selectedIndex||1===r,"taro-tabbar__tabbar-slideout":2===r})},t("div",{class:s,style:{backgroundColor:this.backgroundColor||"",height:"inherit"}},this.list.map(((a,r)=>{const e=this.selectedIndex===r;let s,o;return e?(s=this.selectedColor||"",o=a.selectedIconPath):(s=this.color||"",o=a.iconPath),t(l,{index:r,onSelect:this.switchTab.bind(this),isSelected:e,textColor:s,iconPath:o,text:a.text,badgeText:a.badgeText,showRedDot:a.showRedDot})}))))}get tabbar(){return s(this)}};_.style="html,body{height:100%}#app{height:100%}.taro-tabbar__border-white::before{border-top-color:#fff !important}.taro-tabbar__container{display:-ms-flexbox;display:flex;overflow:hidden;-ms-flex-direction:column;flex-direction:column;height:100%}.taro-tabbar__panel{overflow:auto;position:relative;-ms-flex:1;flex:1;-webkit-overflow-scrolling:auto}.taro-tabbar__tabbar{position:relative;width:100%;height:50px;-webkit-transition:bottom 0.2s, top 0.2s;transition:bottom 0.2s, top 0.2s}.taro-tabbar__tabbar-top{top:0}.taro-tabbar__tabbar-bottom{bottom:0;margin-bottom:constant(safe-area-inset-bottom);margin-bottom:env(safe-area-inset-bottom)}.taro-tabbar__tabbar-hide{display:none}.taro-tabbar__tabbar-slideout{top:-52px;-ms-flex:0 0;flex:0 0}.taro-tabbar__panel+.taro-tabbar__tabbar-slideout{top:auto;bottom:-52px}";export{_ as taro_tabbar}
|