@tarojs/components-react 4.2.1-beta.2 → 4.2.1-beta.3
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/components/image/index.js +3 -5
- package/dist/components/image/index.js.map +1 -1
- package/dist/components/picker/index.js +38 -110
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/picker/picker-group.js +127 -477
- package/dist/components/picker/picker-group.js.map +1 -1
- package/dist/components/refresher/index.js +5 -5
- package/dist/components/refresher/index.js.map +1 -1
- package/dist/components/scroll-view/index.js +36 -80
- package/dist/components/scroll-view/index.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/original/components/image/index.js +3 -5
- package/dist/original/components/image/index.js.map +1 -1
- package/dist/original/components/image/style/index.scss +1 -5
- package/dist/original/components/picker/index.js +38 -110
- package/dist/original/components/picker/index.js.map +1 -1
- package/dist/original/components/picker/picker-group.js +127 -477
- package/dist/original/components/picker/picker-group.js.map +1 -1
- package/dist/original/components/picker/style/index.scss +8 -9
- package/dist/original/components/refresher/index.js +5 -5
- package/dist/original/components/refresher/index.js.map +1 -1
- package/dist/original/components/scroll-view/index.js +36 -80
- package/dist/original/components/scroll-view/index.js.map +1 -1
- package/dist/original/index.js +2 -6
- package/dist/original/index.js.map +1 -1
- package/dist/solid/components/image/index.js +3 -5
- package/dist/solid/components/image/index.js.map +1 -1
- package/dist/solid/components/picker/index.js +45 -121
- package/dist/solid/components/picker/index.js.map +1 -1
- package/dist/solid/components/picker/picker-group.js +151 -500
- package/dist/solid/components/picker/picker-group.js.map +1 -1
- package/dist/solid/components/refresher/index.js +5 -5
- package/dist/solid/components/refresher/index.js.map +1 -1
- package/dist/solid/components/scroll-view/index.js +40 -84
- package/dist/solid/components/scroll-view/index.js.map +1 -1
- package/dist/solid/index.css +1 -1
- package/dist/solid/index.js +1 -1
- package/package.json +6 -8
- package/dist/components/map/MapContext.js +0 -628
- package/dist/components/map/MapContext.js.map +0 -1
- package/dist/components/map/MapCustomCallout.js +0 -91
- package/dist/components/map/MapCustomCallout.js.map +0 -1
- package/dist/components/map/common.js +0 -4
- package/dist/components/map/common.js.map +0 -1
- package/dist/components/map/createMapContext.js +0 -34
- package/dist/components/map/createMapContext.js.map +0 -1
- package/dist/components/map/handler.js +0 -50
- package/dist/components/map/handler.js.map +0 -1
- package/dist/components/map/index.js +0 -329
- package/dist/components/map/index.js.map +0 -1
- package/dist/components/switch/index.js +0 -125
- package/dist/components/switch/index.js.map +0 -1
- package/dist/components/switch/style/index.scss.js +0 -4
- package/dist/components/switch/style/index.scss.js.map +0 -1
- package/dist/contexts/ScrollElementContext.js +0 -6
- package/dist/contexts/ScrollElementContext.js.map +0 -1
- package/dist/original/components/map/MapContext.js +0 -628
- package/dist/original/components/map/MapContext.js.map +0 -1
- package/dist/original/components/map/MapCustomCallout.js +0 -91
- package/dist/original/components/map/MapCustomCallout.js.map +0 -1
- package/dist/original/components/map/common.js +0 -4
- package/dist/original/components/map/common.js.map +0 -1
- package/dist/original/components/map/createMapContext.js +0 -34
- package/dist/original/components/map/createMapContext.js.map +0 -1
- package/dist/original/components/map/handler.js +0 -50
- package/dist/original/components/map/handler.js.map +0 -1
- package/dist/original/components/map/index.js +0 -329
- package/dist/original/components/map/index.js.map +0 -1
- package/dist/original/components/switch/index.js +0 -125
- package/dist/original/components/switch/index.js.map +0 -1
- package/dist/original/components/switch/style/index.scss +0 -35
- package/dist/original/contexts/ScrollElementContext.js +0 -6
- package/dist/original/contexts/ScrollElementContext.js.map +0 -1
- package/dist/solid/contexts/ScrollElementContext.js +0 -6
- package/dist/solid/contexts/ScrollElementContext.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/scroll-view/index.tsx"],"sourcesContent":["import './style/index.scss'\n\nimport { isFunction } from '@tarojs/shared'\nimport classNames from 'classnames'\n\nimport { ScrollElementContext } from '../../contexts/ScrollElementContext'\nimport { createForwardRefComponent, throttle } from '../../utils'\nimport { useEffect, useRef, useState } from '../../utils/hooks'\n\nimport type React from 'react'\n\nfunction easeOutScroll (from = 0, to = 0, callback) {\n if (from === to || typeof from !== 'number') {\n return\n }\n const change = to - from\n const dur = 500\n const sTime = +new Date()\n function linear (t, b, c, d) {\n return (c * t) / d + b\n }\n const isLarger = to >= from\n\n function step () {\n from = linear(+new Date() - sTime, from, change, dur)\n if ((isLarger && from >= to) || (!isLarger && to >= from)) {\n callback(to)\n return\n }\n callback(from)\n requestAnimationFrame(step)\n }\n step()\n}\n\n/** 未开启的滚动轴使用 nearest 避免原生 scrollIntoView 沿该轴滚动整页 */\nfunction scrollIntoView (\n id = '',\n animated = true,\n scrollX = false,\n scrollY = false,\n scrollIntoViewAlignment?: ScrollLogicalPosition\n) {\n document.querySelector(`#${id}`)?.scrollIntoView({\n behavior: animated ? 'smooth' : 'auto',\n block: scrollY ? (scrollIntoViewAlignment || 'center') : 'nearest',\n inline: scrollX ? (scrollIntoViewAlignment || 'start') : 'nearest'\n })\n}\n\nfunction scrollVertical (container, scrollTop, top, isAnimation) {\n if (isAnimation) {\n easeOutScroll(scrollTop.current, top, pos => {\n if (container.current) container.current.scrollTop = pos\n })\n } else {\n if (container.current) container.current.scrollTop = top\n }\n scrollTop.current = top\n}\n\nfunction scrollHorizontal (container, scrollLeft, left, isAnimation) {\n if (isAnimation) {\n easeOutScroll(scrollLeft.current, left, pos => {\n if (container.current) container.current.scrollLeft = pos\n })\n } else {\n if (container.current) container.current.scrollLeft = left\n }\n scrollLeft.current = left\n}\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n scrollX: boolean\n scrollY: boolean\n upperThreshold: number\n lowerThreshold: number\n scrollTop: number\n scrollLeft: number\n scrollIntoView?: string\n scrollIntoViewAlignment?: ScrollLogicalPosition\n scrollWithAnimation: boolean\n enableBackToTop?: boolean\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n onScrollToUpper: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollToLower: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScroll: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollStart?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollEnd?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchMove: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchStart?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchEnd?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n showScrollbar?: boolean // 新增参数,默认true\n enhanced?: boolean // 新增参数,默认false\n /** 嵌套滚动:内容在滚动容器中的起始偏移(固定头部等场景) */\n startOffset?: number\n}\n\n/** H5 等环境下 scrollTop 为整数,与带亚像素的受控值比较时允许该误差,避免反复 set scrollTop 与 scrollIntoView 打架 */\nconst CONTROLLED_SCROLL_EPSILON = 0.5\n\nfunction ScrollView (props: IProps) {\n const _scrollTop = useRef<any>(null)\n const _scrollLeft = useRef<any>(null)\n const container = useRef<any>(null)\n const scrollEndTimerRef = useRef<NodeJS.Timeout | null>(null)\n const isScrollingRef = useRef<boolean>(false)\n const isInitializedRef = useRef<boolean>(false)\n /** 与 props.scrollIntoView 比对,同 id 时只走受控 scrollTop,避免与上次锚点反复互顶 */\n const lastAppliedScrollIntoViewIdRef = useRef<string | null>(null)\n const [containerHeight, setContainerHeight] = useState(0)\n const onTouchMove = (e) => {\n e.stopPropagation()\n }\n\n const applyControlledScrollTopLeft = (p: IProps) => {\n const isAnimation = !!p.scrollWithAnimation\n const eps = CONTROLLED_SCROLL_EPSILON\n if (p.scrollY && typeof p.scrollTop === 'number' &&\n (_scrollTop.current === null || Math.abs(p.scrollTop - _scrollTop.current) >= eps)) {\n setTimeout(() => scrollVertical(container, _scrollTop, p.scrollTop, isAnimation), 10)\n }\n if (p.scrollX && typeof p.scrollLeft === 'number' &&\n (_scrollLeft.current === null || Math.abs(p.scrollLeft - _scrollLeft.current) >= eps)) {\n setTimeout(() => scrollHorizontal(container, _scrollLeft, p.scrollLeft, isAnimation), 10)\n }\n }\n\n const handleScroll = (props: IProps, isInit = false) => {\n if (\n props.scrollIntoView &&\n typeof props.scrollIntoView === 'string' &&\n document &&\n document.querySelector &&\n document.querySelector(`#${props.scrollIntoView}`)\n ) {\n if (isInit) {\n setTimeout(\n () =>\n scrollIntoView(\n props.scrollIntoView,\n props.scrollWithAnimation,\n !!props.scrollX,\n !!props.scrollY,\n props.scrollIntoViewAlignment\n ),\n 500\n )\n } else {\n scrollIntoView(\n props.scrollIntoView,\n props.scrollWithAnimation,\n !!props.scrollX,\n !!props.scrollY,\n props.scrollIntoViewAlignment\n )\n }\n } else {\n applyControlledScrollTopLeft(props)\n }\n }\n\n useEffect(() => {\n handleScroll(props, true)\n isInitializedRef.current = true\n }, [])\n\n // scrollTop / scrollLeft / scrollIntoView 受控同步(跳过 mount 时的 init effect)\n useEffect(() => {\n if (!isInitializedRef.current || !container.current) return\n\n const sitv = props.scrollIntoView\n const sitvOk = Boolean(\n sitv &&\n typeof sitv === 'string' &&\n document &&\n document.querySelector &&\n document.querySelector(`#${sitv}`)\n )\n\n if (sitvOk) {\n if (sitv !== lastAppliedScrollIntoViewIdRef.current) {\n scrollIntoView(\n sitv,\n props.scrollWithAnimation,\n !!props.scrollX,\n !!props.scrollY,\n props.scrollIntoViewAlignment\n )\n lastAppliedScrollIntoViewIdRef.current = typeof sitv === 'string' ? sitv : null\n } else {\n applyControlledScrollTopLeft(props)\n }\n } else {\n lastAppliedScrollIntoViewIdRef.current = null\n applyControlledScrollTopLeft(props)\n }\n }, [\n props.scrollTop,\n props.scrollLeft,\n props.scrollIntoView,\n props.scrollIntoViewAlignment,\n props.scrollWithAnimation,\n props.scrollX,\n props.scrollY\n ])\n\n const {\n className,\n style = {},\n onScroll,\n onScrollToUpper,\n onScrollToLower,\n scrollX,\n scrollY,\n showScrollbar = true, // 默认显示滚动条\n enhanced = false // 默认不增强\n } = props\n let { upperThreshold = 50, lowerThreshold = 50 } = props\n const cls = classNames(\n 'taro-scroll',\n {\n 'taro-scroll-view__scroll-x': scrollX,\n 'taro-scroll-view__scroll-y': scrollY,\n 'taro-scroll--hidebar': enhanced === true && showScrollbar === false,\n 'taro-scroll--enhanced': enhanced === true\n },\n className\n )\n upperThreshold = Number(upperThreshold)\n lowerThreshold = Number(lowerThreshold)\n const upperAndLower = e => {\n if (!container.current) return\n const { offsetWidth, offsetHeight, scrollLeft, scrollTop, scrollHeight, scrollWidth } = container.current\n if (\n onScrollToLower &&\n ((props.scrollY && offsetHeight + scrollTop + lowerThreshold >= scrollHeight) ||\n (props.scrollX && offsetWidth + scrollLeft + lowerThreshold >= scrollWidth))\n ) {\n onScrollToLower(e)\n }\n if (\n onScrollToUpper &&\n ((props.scrollY && scrollTop <= upperThreshold) || (props.scrollX && scrollLeft <= upperThreshold))\n ) {\n onScrollToUpper(e)\n }\n }\n const upperAndLowerThrottle = throttle(upperAndLower, 200)\n const _onScroll = e => {\n const { scrollLeft, scrollTop, scrollHeight, scrollWidth } = container.current\n _scrollLeft.current = scrollLeft\n _scrollTop.current = scrollTop\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n writable: true,\n value: {\n scrollLeft,\n scrollTop,\n scrollHeight,\n scrollWidth\n }\n })\n\n // 处理滚动开始\n if (!isScrollingRef.current) {\n isScrollingRef.current = true\n if (props.onScrollStart) {\n props.onScrollStart(e)\n }\n }\n\n // 清除滚动结束定时器\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n scrollEndTimerRef.current = null\n }\n\n // 设置滚动结束定时器(150ms 无滚动事件后触发)\n if (props.onScrollEnd) {\n scrollEndTimerRef.current = setTimeout(() => {\n if (isScrollingRef.current) {\n isScrollingRef.current = false\n props.onScrollEnd?.(e)\n }\n scrollEndTimerRef.current = null\n }, 150)\n }\n\n upperAndLowerThrottle(e)\n onScroll && onScroll(e)\n }\n const _onTouchMove = e => {\n isFunction(props.onTouchMove) ? props.onTouchMove(e) : onTouchMove(e)\n }\n const _onTouchStart = e => {\n if (isFunction(props.onTouchStart)) {\n props.onTouchStart(e)\n }\n }\n const _onTouchEnd = e => {\n if (isFunction(props.onTouchEnd)) {\n props.onTouchEnd(e)\n }\n }\n // 清理定时器\n useEffect(() => {\n return () => {\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n scrollEndTimerRef.current = null\n }\n }\n }, [])\n\n // ScrollElementContext:嵌套滚动时向子组件提供 scrollRef、containerHeight、startOffset\n useEffect(() => {\n const el = container.current\n if (!el) return\n const update = () => {\n if (container.current) {\n setContainerHeight(container.current.clientHeight)\n }\n }\n update()\n const ro = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(update) : null\n if (ro) {\n ro.observe(el)\n return () => ro.disconnect()\n }\n }, [])\n\n const scrollElementContextValue = {\n scrollRef: container,\n containerHeight,\n startOffset: props.startOffset ?? 0,\n }\n\n return (\n <ScrollElementContext.Provider value={scrollElementContextValue}>\n <div\n ref={e => {\n if (e) {\n container.current = e\n if (props.forwardedRef) props.forwardedRef.current = e\n }\n }}\n style={style}\n className={cls}\n onScroll={_onScroll}\n onTouchMove={_onTouchMove}\n onTouchStart={_onTouchStart}\n onTouchEnd={_onTouchEnd}\n >\n {props.children}\n </div>\n </ScrollElementContext.Provider>\n )\n}\n\nexport default createForwardRefComponent(ScrollView)\n"],"names":["easeOutScroll","from","arguments","length","undefined","to","callback","change","dur","sTime","Date","linear","t","b","c","d","isLarger","step","requestAnimationFrame","scrollIntoView","id","animated","scrollX","scrollY","scrollIntoViewAlignment","_a","document","querySelector","behavior","block","inline","scrollVertical","container","scrollTop","top","isAnimation","current","pos","scrollHorizontal","scrollLeft","left","CONTROLLED_SCROLL_EPSILON","ScrollView","props","_scrollTop","useRef","_scrollLeft","scrollEndTimerRef","isScrollingRef","isInitializedRef","lastAppliedScrollIntoViewIdRef","containerHeight","setContainerHeight","useState","onTouchMove","e","stopPropagation","applyControlledScrollTopLeft","p","scrollWithAnimation","eps","Math","abs","setTimeout","handleScroll","isInit","useEffect","sitv","sitvOk","Boolean","className","style","onScroll","onScrollToUpper","onScrollToLower","showScrollbar","enhanced","upperThreshold","lowerThreshold","cls","classNames","Number","upperAndLower","offsetWidth","offsetHeight","scrollHeight","scrollWidth","upperAndLowerThrottle","throttle","_onScroll","Object","defineProperty","enumerable","writable","value","onScrollStart","clearTimeout","onScrollEnd","call","_onTouchMove","isFunction","_onTouchStart","onTouchStart","_onTouchEnd","onTouchEnd","el","update","clientHeight","ro","ResizeObserver","observe","disconnect","scrollElementContextValue","scrollRef","startOffset","_jsx","ScrollElementContext","Provider","children","ref","forwardedRef","createForwardRefComponent"],"mappings":";;;;;;;;AAWA,SAASA,aAAaA,GAA4B;AAAA,EAAA,IAA1BC,IAAI,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,CAAC;AAAA,EAAA,IAAEG,EAAE,GAAAH,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,CAAC;EAAA,IAAEI,QAAQ,GAAAJ,SAAA,CAAAC,MAAA,GAAAD,CAAAA,GAAAA,SAAA,MAAAE,SAAA;EAChD,IAAIH,IAAI,KAAKI,EAAE,IAAI,OAAOJ,IAAI,KAAK,QAAQ,EAAE;AAC3C,IAAA;AACF;AACA,EAAA,MAAMM,MAAM,GAAGF,EAAE,GAAGJ,IAAI;EACxB,MAAMO,GAAG,GAAG,GAAG;AACf,EAAA,MAAMC,KAAK,GAAG,CAAC,IAAIC,IAAI,EAAE;EACzB,SAASC,MAAMA,CAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAA;AACzB,IAAA,OAAQD,CAAC,GAAGF,CAAC,GAAIG,C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}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/scroll-view/index.tsx"],"sourcesContent":["import './style/index.scss'\n\nimport { isFunction } from '@tarojs/shared'\nimport classNames from 'classnames'\n\nimport { createForwardRefComponent, throttle } from '../../utils'\nimport { useEffect, useRef } from '../../utils/hooks'\n\nimport type React from 'react'\n\nfunction easeOutScroll (from = 0, to = 0, callback) {\n if (from === to || typeof from !== 'number') {\n return\n }\n const change = to - from\n const dur = 500\n const sTime = +new Date()\n function linear (t, b, c, d) {\n return (c * t) / d + b\n }\n const isLarger = to >= from\n\n function step () {\n from = linear(+new Date() - sTime, from, change, dur)\n if ((isLarger && from >= to) || (!isLarger && to >= from)) {\n callback(to)\n return\n }\n callback(from)\n requestAnimationFrame(step)\n }\n step()\n}\n\nfunction scrollIntoView (id = '', isHorizontal = false, animated = true, scrollIntoViewAlignment?: ScrollLogicalPosition) {\n document.querySelector(`#${id}`)?.scrollIntoView({\n behavior: animated ? 'smooth' : 'auto',\n block: !isHorizontal ? (scrollIntoViewAlignment || 'center') : 'center',\n inline: isHorizontal ? (scrollIntoViewAlignment || 'start') : 'start'\n })\n}\n\nfunction scrollVertical (container, scrollTop, top, isAnimation) {\n if (isAnimation) {\n easeOutScroll(scrollTop.current, top, pos => {\n if (container.current) container.current.scrollTop = pos\n })\n } else {\n if (container.current) container.current.scrollTop = top\n }\n scrollTop.current = top\n}\n\nfunction scrollHorizontal (container, scrollLeft, left, isAnimation) {\n if (isAnimation) {\n easeOutScroll(scrollLeft.current, left, pos => {\n if (container.current) container.current.scrollLeft = pos\n })\n } else {\n if (container.current) container.current.scrollLeft = left\n }\n scrollLeft.current = left\n}\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n scrollX: boolean\n scrollY: boolean\n upperThreshold: number\n lowerThreshold: number\n scrollTop: number\n scrollLeft: number\n scrollIntoView?: string\n scrollIntoViewAlignment?: ScrollLogicalPosition\n scrollWithAnimation: boolean\n enableBackToTop?: boolean\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n onScrollToUpper: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollToLower: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScroll: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollStart?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onScrollEnd?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchMove: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchStart?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n onTouchEnd?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void\n showScrollbar?: boolean // 新增参数,默认true\n enhanced?: boolean // 新增参数,默认false\n}\n\nfunction ScrollView (props: IProps) {\n const _scrollTop = useRef<any>(null)\n const _scrollLeft = useRef<any>(null)\n const container = useRef<any>(null)\n const scrollEndTimerRef = useRef<NodeJS.Timeout | null>(null)\n const isScrollingRef = useRef<boolean>(false)\n const isInitializedRef = useRef<boolean>(false)\n const onTouchMove = (e) => {\n e.stopPropagation()\n }\n\n const handleScroll = (props: IProps, isInit = false) => {\n // scrollIntoView\n if (\n props.scrollIntoView &&\n typeof props.scrollIntoView === 'string' &&\n document &&\n document.querySelector &&\n document.querySelector(`#${props.scrollIntoView}`)\n ) {\n const isHorizontal = props.scrollX && !props.scrollY\n if (isInit) {\n setTimeout(() => scrollIntoView(props.scrollIntoView, props.scrollWithAnimation, isHorizontal, props.scrollIntoViewAlignment), 500)\n } else {\n scrollIntoView(props.scrollIntoView, props.scrollWithAnimation, isHorizontal, props.scrollIntoViewAlignment)\n }\n } else {\n const isAnimation = !!props.scrollWithAnimation\n // Y 轴滚动\n if (props.scrollY && typeof props.scrollTop === 'number' && props.scrollTop !== _scrollTop.current) {\n setTimeout(() => scrollVertical(container, _scrollTop, props.scrollTop, isAnimation), 10)\n }\n // X 轴滚动\n if (props.scrollX && typeof props.scrollLeft === 'number' && props.scrollLeft !== _scrollLeft.current) {\n setTimeout(() => scrollHorizontal(container, _scrollLeft, props.scrollLeft, isAnimation), 10)\n }\n }\n }\n\n useEffect(() => {\n handleScroll(props, true)\n isInitializedRef.current = true\n }, [])\n\n // 监听 scrollTop、scrollLeft、scrollIntoView 的变化(排除初始化)\n useEffect(() => {\n if (isInitializedRef.current && container.current) {\n handleScroll(props, false)\n }\n }, [props.scrollTop, props.scrollLeft, props.scrollIntoView])\n\n const {\n className,\n style = {},\n onScroll,\n onScrollToUpper,\n onScrollToLower,\n scrollX,\n scrollY,\n showScrollbar = true, // 默认显示滚动条\n enhanced = false // 默认不增强\n } = props\n let { upperThreshold = 50, lowerThreshold = 50 } = props\n const cls = classNames(\n 'taro-scroll',\n {\n 'taro-scroll-view__scroll-x': scrollX,\n 'taro-scroll-view__scroll-y': scrollY,\n 'taro-scroll--hidebar': enhanced === true && showScrollbar === false,\n 'taro-scroll--enhanced': enhanced === true\n },\n className\n )\n upperThreshold = Number(upperThreshold)\n lowerThreshold = Number(lowerThreshold)\n const upperAndLower = e => {\n if (!container.current) return\n const { offsetWidth, offsetHeight, scrollLeft, scrollTop, scrollHeight, scrollWidth } = container.current\n if (\n onScrollToLower &&\n ((props.scrollY && offsetHeight + scrollTop + lowerThreshold >= scrollHeight) ||\n (props.scrollX && offsetWidth + scrollLeft + lowerThreshold >= scrollWidth))\n ) {\n onScrollToLower(e)\n }\n if (\n onScrollToUpper &&\n ((props.scrollY && scrollTop <= upperThreshold) || (props.scrollX && scrollLeft <= upperThreshold))\n ) {\n onScrollToUpper(e)\n }\n }\n const upperAndLowerThrottle = throttle(upperAndLower, 200)\n const _onScroll = e => {\n const { scrollLeft, scrollTop, scrollHeight, scrollWidth } = container.current\n _scrollLeft.current = scrollLeft\n _scrollTop.current = scrollTop\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n writable: true,\n value: {\n scrollLeft,\n scrollTop,\n scrollHeight,\n scrollWidth\n }\n })\n\n // 处理滚动开始\n if (!isScrollingRef.current) {\n isScrollingRef.current = true\n if (props.onScrollStart) {\n props.onScrollStart(e)\n }\n }\n\n // 清除滚动结束定时器\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n scrollEndTimerRef.current = null\n }\n\n // 设置滚动结束定时器(150ms 无滚动事件后触发)\n if (props.onScrollEnd) {\n scrollEndTimerRef.current = setTimeout(() => {\n if (isScrollingRef.current) {\n isScrollingRef.current = false\n props.onScrollEnd?.(e)\n }\n scrollEndTimerRef.current = null\n }, 150)\n }\n\n upperAndLowerThrottle(e)\n onScroll && onScroll(e)\n }\n const _onTouchMove = e => {\n isFunction(props.onTouchMove) ? props.onTouchMove(e) : onTouchMove(e)\n }\n const _onTouchStart = e => {\n if (isFunction(props.onTouchStart)) {\n props.onTouchStart(e)\n }\n }\n const _onTouchEnd = e => {\n if (isFunction(props.onTouchEnd)) {\n props.onTouchEnd(e)\n }\n }\n // 清理定时器\n useEffect(() => {\n return () => {\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n scrollEndTimerRef.current = null\n }\n }\n }, [])\n\n return (\n <div\n ref={e => {\n if (e) {\n container.current = e\n if (props.forwardedRef) props.forwardedRef.current = e\n }\n }}\n style={style}\n className={cls}\n onScroll={_onScroll}\n onTouchMove={_onTouchMove}\n onTouchStart={_onTouchStart}\n onTouchEnd={_onTouchEnd}\n >\n {props.children}\n </div>\n )\n}\n\nexport default createForwardRefComponent(ScrollView)\n"],"names":["easeOutScroll","from","arguments","length","undefined","to","callback","change","dur","sTime","Date","linear","t","b","c","d","isLarger","step","requestAnimationFrame","scrollIntoView","id","isHorizontal","animated","scrollIntoViewAlignment","_a","document","querySelector","behavior","block","inline","scrollVertical","container","scrollTop","top","isAnimation","current","pos","scrollHorizontal","scrollLeft","left","ScrollView","props","_scrollTop","useRef","_scrollLeft","scrollEndTimerRef","isScrollingRef","isInitializedRef","onTouchMove","e","stopPropagation","handleScroll","isInit","scrollX","scrollY","setTimeout","scrollWithAnimation","useEffect","className","style","onScroll","onScrollToUpper","onScrollToLower","showScrollbar","enhanced","upperThreshold","lowerThreshold","cls","classNames","Number","upperAndLower","offsetWidth","offsetHeight","scrollHeight","scrollWidth","upperAndLowerThrottle","throttle","_onScroll","Object","defineProperty","enumerable","writable","value","onScrollStart","clearTimeout","onScrollEnd","call","_onTouchMove","isFunction","_onTouchStart","onTouchStart","_onTouchEnd","onTouchEnd","_jsx","ref","forwardedRef","children","createForwardRefComponent"],"mappings":";;;;;;;AAUA,SAASA,aAAaA,GAA4B;AAAA,EAAA,IAA1BC,IAAI,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,CAAC;AAAA,EAAA,IAAEG,EAAE,GAAAH,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,CAAC;EAAA,IAAEI,QAAQ,GAAAJ,SAAA,CAAAC,MAAA,GAAAD,CAAAA,GAAAA,SAAA,MAAAE,SAAA;EAChD,IAAIH,IAAI,KAAKI,EAAE,IAAI,OAAOJ,IAAI,KAAK,QAAQ,EAAE;AAC3C,IAAA;AACF;AACA,EAAA,MAAMM,MAAM,GAAGF,EAAE,GAAGJ,IAAI;EACxB,MAAMO,GAAG,GAAG,GAAG;AACf,EAAA,MAAMC,KAAK,GAAG,CAAC,IAAIC,IAAI,EAAE;EACzB,SAASC,MAAMA,CAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAA;AACzB,IAAA,OAAQD,CAAC,GAAGF,CAAC,GAAIG,CAAC,GAAGF,CAAC;AACxB;AACA,EAAA,MAAMG,QAAQ,GAAGX,EAAE,IAAIJ,IAAI;EAE3B,SAASgB,IAAIA,GAAA;AACXhB,IAAAA,IAAI,GAAGU,MAAM,CAAC,CAAC,IAAID,IAAI,EAAE,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it-keyframes weuiLoading{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes weuiLoading{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.taro-button-core.taro-btn-loading .weui-loading{animation:weuiLoading 1s steps(12) infinite;background:transparent url(https://img13.360buyimg.com/imagetools/jfs/t1/353674/27/5761/14397/690ac1cfFf6bf0e2c/77727d0791bacf8e.png) no-repeat;background-size:cover;display:inline-block;height:22px;width:22px}.taro-button-core.taro-btn-loading .weui-loading.weui-btn_primary,.taro-button-core.taro-btn-loading .weui-loading.weui-btn_warn{color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-loading .weui-loading.weui-btn_primary{background-color:#179b16}.taro-button-core.taro-btn-loading .weui-loading.weui-btn_warn{background-color:#ce3c39}.taro-button-core.taro-btn-loading.taro-btn-mini .weui-loading{display:inline-block;height:16px;vertical-align:middle;width:16px}.taro-button-core{-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;appearance:none;background-color:#f8f8f8;border:1px solid rgba(0,0,0,.2);border-radius:10px;box-sizing:border-box;color:#000;display:flex;font-size:18px;justify-content:center;outline:0;overflow:hidden;padding:0 14px;position:relative;text-decoration:none;width:100%}.taro-button-core:focus{outline:0}.taro-button-core:not(.taro-btn-disabled):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core+.taro-button-core{margin-top:15px}.taro-button-core.taro-btn-default{background-color:#f8f8f8;color:#000}.taro-button-core.taro-btn-default:not(.taro-btn-disabled):visited{color:#000}.taro-button-core.taro-btn-default:not(.taro-btn-disabled):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core.taro-btn-mini{display:inline-block;font-size:13px;padding:0 26px;vertical-align:middle;width:auto}.taro-button-core.taro-btn-plain,.taro-button-core.taro-btn-plain.taro-btn-default,.taro-button-core.taro-btn-plain.taro-btn-primary,.taro-button-core.taro-btn-plain.taro-btn-warn{background-color:transparent;border-width:1px}.taro-button-core.taro-btn-disabled{color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-disabled.taro-btn-default{background-color:#f7f7f7;color:rgba(0,0,0,.3)}.taro-button-core.taro-btn-disabled.taro-btn-primary{background-color:#9ed99d}.taro-button-core.taro-btn-disabled.taro-btn-warn{background-color:#ec8b89}.taro-button-core.taro-btn-loading.taro-btn-primary,.taro-button-core.taro-btn-loading.taro-btn-warn{color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-loading.taro-btn-primary{background-color:#179b16}.taro-button-core.taro-btn-loading.taro-btn-warn{background-color:#ce3c39}.taro-button-core.taro-btn-plain.taro-btn-primary{border:1px solid #1aad19;color:#1aad19}.taro-button-core.taro-btn-plain.taro-btn-primary:not(.taro-btn-disabled):active{background-color:transparent;border-color:rgba(26,173,25,.6);color:rgba(26,173,25,.6)}.taro-button-core.taro-btn-plain.taro-btn-primary:after{border-width:0}.taro-button-core.taro-btn-plain.taro-btn-warn{border:1px solid #e64340;color:#e64340}.taro-button-core.taro-btn-plain.taro-btn-warn:not(.taro-btn-disabled):active{background-color:transparent;border-color:rgba(230,67,64,.6);color:rgba(230,67,64,.6)}.taro-button-core.taro-btn-plain.taro-btn-warn:after{border-width:0}.taro-button-core.taro-btn-plain,.taro-button-core.taro-btn-plain.taro-btn-default{border:1px solid #353535;color:#353535}.taro-button-core.taro-btn-plain.taro-btn-default:not(.taro-btn-disabled):active,.taro-button-core.taro-btn-plain:not(.taro-btn-disabled):active{background-color:transparent;border-color:rgba(53,53,53,.6);color:rgba(53,53,53,.6)}.taro-button-core.taro-btn-plain.taro-btn-default:after,.taro-button-core.taro-btn-plain:after{border-width:0}.taro-button-core.taro-btn-primary{background-color:#1aad19;color:#fff}.taro-button-core.taro-btn-primary:not(.taro-btn-disabled):visited{color:#fff}.taro-button-core.taro-btn-primary:not(.taro-btn-disabled):active{background-color:#179b16;color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-warn{background-color:#e64340;color:#fff}.taro-button-core.taro-btn-warn:not(.taro-btn-disabled):visited{color:#fff}.taro-button-core.taro-btn-warn:not(.taro-btn-disabled):active{background-color:#ce3c39;color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-plain.taro-btn-disabled.taro-btn-default,.taro-button-core.taro-btn-plain.taro-btn-disabled.taro-btn-primary,.taro-button-core.taro-btn-plain.taro-btn-disabled.taro-btn-warn{background-color:#f7f7f7;border:1px solid rgba(0,0,0,.2);color:rgba(0,0,0,.3)}.weui-icon-circle:before{content:"\ea01"}.weui-icon-download:before{content:"\ea02"}.weui-icon-info:before{content:"\ea03"}.weui-icon-safe-success:before{content:"\ea04"}.weui-icon-safe-warn:before{content:"\ea05"}.weui-icon-success:before{content:"\ea06"}.weui-icon-success-circle:before{content:"\ea07"}.weui-icon-success-no-circle:before{content:"\ea08"}.weui-icon-waiting:before{content:"\ea09"}.weui-icon-waiting-circle:before{content:"\ea0a"}.weui-icon-warn:before{content:"\ea0b"}.weui-icon-info-circle:before{content:"\ea0c"}.weui-icon-cancel:before{content:"\ea0d"}.weui-icon-search:before{content:"\ea0e"}.weui-icon-clear:before{content:"\ea0f"}.weui-icon-back:before{content:"\ea10"}.weui-icon-delete:before{content:"\ea11"}.weui-icon-success{color:#09bb07;font-size:23px}.weui-icon-waiting{color:#10aeff;font-size:23px}.weui-icon-warn{color:#f43530;font-size:23px}.weui-icon-info{color:#10aeff;font-size:23px}.weui-icon-success-circle,.weui-icon-success-no-circle{color:#09bb07;font-size:23px}.weui-icon-waiting-circle{color:#10aeff;font-size:23px}.weui-icon-circle{color:#c9c9c9;font-size:23px}.weui-icon-download,.weui-icon-info-circle{color:#09bb07;font-size:23px}.weui-icon-safe-success{color:#09bb07}.weui-icon-safe-warn{color:#ffbe00}.weui-icon-cancel{color:#f43530;font-size:22px}.weui-icon-clear,.weui-icon-search{color:#b2b2b2;font-size:14px}.weui-icon-delete.weui-icon_gallery-delete{color:#fff;font-size:22px}.weui-icon_msg{font-size:93px}.weui-icon_msg.weui-icon-warn{color:#f76260}.weui-icon_msg-primary{font-size:93px}.weui-icon_msg-primary.weui-icon-warn{color:#ffbe00}img[src=""]{opacity:0}.taro-img{display:inline-block;font-size:0;overflow:hidden;position:relative}.taro-img--with-default-host-size{height:240px;width:320px}.taro-img.taro-img__widthfix,.taro-img__mode-heightfix{height:100%}.taro-img__mode-scaletofill{height:100%;width:100%}.taro-img__mode-aspectfit{height:100%;object-fit:contain;width:100%}.taro-img__mode-aspectfill{height:100%;object-fit:cover;width:100%}.taro-img__mode-widthfix{width:100%}.taro-img__mode-bottom,.taro-img__mode-top{left:50%;position:absolute;transform:translate(-50%)}.taro-img__mode-bottom{bottom:0}.taro-img__mode-center{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.taro-img__mode-left,.taro-img__mode-right{position:absolute;top:50%;transform:translateY(-50%)}.taro-img__mode-right{right:0}.taro-img__mode-topright{position:absolute;right:0}.taro-img__mode-bottomleft{bottom:0;position:absolute}.taro-img__mode-bottomright{bottom:0;position:absolute;right:0}.taro-input-core{display:block}.weui-input{-webkit-appearance:none;background-color:transparent;border:0;color:inherit;font-size:inherit;height:1.4705882353em;line-height:1.4705882353;outline:0;width:100%}.weui-input::-webkit-inner-spin-button,.weui-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.taro-picker__overlay{position:fixed;z-index:1000}.taro-picker__mask-overlay,.taro-picker__overlay{bottom:0;height:100%;left:0;right:0;top:0;width:100%}.taro-picker__mask-overlay{position:absolute;z-index:1001}.taro-picker__overlay.taro-picker__overlay--theme-light .taro-picker__mask-overlay{background-color:rgba(0,0,0,.6)}.taro-picker__overlay.taro-picker__overlay--theme-dark .taro-picker__mask-overlay{background-color:hsla(0,0%,8%,.7)}.taro-picker{bottom:0;font-size:14px;left:0;position:absolute;width:100%;z-index:1002}.taro-picker__hd{align-items:center;display:flex;font-size:17px;height:44px;justify-content:space-between;padding:0;position:relative}.taro-picker__hd:after{bottom:0;content:"";height:1px;left:0;position:absolute;transform:scaleY(.5);width:100%}.taro-picker__action{flex:0 0 auto;font-size:14px;height:44px;line-height:44px;padding:0 10px}.taro-picker__title{font-size:16px;font-weight:500;left:50%;max-width:40%;overflow:hidden;position:absolute;text-overflow:ellipsis;top:50%;transform:translate(-50%,-50%);white-space:nowrap}.taro-picker__bd{box-sizing:border-box;display:flex;flex:1;height:238px;overflow:hidden;width:100%}.taro-picker-theme-light{background-color:#e5e5e5}.taro-picker-theme-light .taro-picker__hd{background-color:#fff}.taro-picker-theme-light .taro-picker__hd:after{background-color:#e5e5e5}.taro-picker-theme-light .taro-picker__action{color:#ff0f23}.taro-picker-theme-light .taro-picker__action:first-child{color:#888}.taro-picker-theme-light .taro-picker__title{color:#000}.taro-picker-theme-light .taro-picker__bd{background-color:#fff}.taro-picker-theme-light .taro-picker__indicator{border-bottom:1px solid #e5e5e5;border-top:1px solid #e5e5e5}.taro-picker-theme-light .taro-picker__mask{background:linear-gradient(180deg,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6) 40%,hsla(0,0%,100%,0) 45%,hsla(0,0%,100%,0) 55%,hsla(0,0%,100%,.6) 60%,hsla(0,0%,100%,.95))}.taro-picker-theme-light .taro-picker__item{color:#000}.taro-picker-theme-light .taro-picker__item--selected{color:#ff0f23}.taro-picker-theme-light .taro-picker__item--disabled{color:#999}.taro-picker-theme-dark{background-color:hsla(0,0%,100%,.06)}.taro-picker-theme-dark .taro-picker__hd{background-color:#1f1f1f}.taro-picker-theme-dark .taro-picker__hd:after{background-color:hsla(0,0%,100%,.06)}.taro-picker-theme-dark .taro-picker__action{color:#ff0f23}.taro-picker-theme-dark .taro-picker__action:first-child{color:#818181}.taro-picker-theme-dark .taro-picker__title{color:#e6e6e6}.taro-picker-theme-dark .taro-picker__bd{background-color:#1f1f1f}.taro-picker-theme-dark .taro-picker__indicator{border-bottom:1px solid hsla(0,0%,100%,.06);border-top:1px solid hsla(0,0%,100%,.06)}.taro-picker-theme-dark .taro-picker__mask{background:linear-gradient(180deg,rgba(31,31,31,.95),rgba(31,31,31,.6) 40%,rgba(31,31,31,0) 45%,rgba(31,31,31,0) 55%,rgba(31,31,31,.6) 60%,rgba(31,31,31,.95))}.taro-picker-theme-dark .taro-picker__item{color:#e6e6e6}.taro-picker-theme-dark .taro-picker__item--selected{color:#ff0f23}.taro-picker-theme-dark .taro-picker__item--disabled{color:#999}.taro-picker__group{align-items:center;box-sizing:border-box;display:flex;flex:1;height:100%;justify-content:center;min-width:0;position:relative}.taro-picker__group--date .taro-picker__columns{display:flex;height:100%;width:100%}.taro-picker__mask{height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:1}.taro-picker__indicator{box-sizing:border-box;height:34px;left:0;position:absolute;top:50%;transform:translateY(-50%);width:100%;z-index:1002}.taro-picker__content{box-sizing:border-box;height:100%;width:100%}.taro-picker__item{align-items:center;box-sizing:border-box;display:flex;font-size:16px;height:34px;justify-content:center;line-height:34px;overflow:hidden;padding:0 8px;text-align:center;text-overflow:ellipsis;white-space:nowrap;width:100%}.taro-picker__item--selected{font-weight:500}.taro-picker__column{flex:1;margin:0 8px}.taro-picker__column:first-child{margin-left:0}.taro-picker__column:last-child{margin-right:0}.taro-picker__item--custom{align-items:center;color:#888;display:flex;font-weight:400;justify-content:center;text-align:center}@keyframes taro-picker__slide-up{0%{transform:translate3d(0,100%,0)}to{transform:translateZ(0)}}@keyframes taro-picker__slide-down{0%{transform:translateZ(0)}to{transform:translate3d(0,100%,0)}}@keyframes taro-picker__fade-in{0%{opacity:0}to{opacity:1}}@keyframes taro-picker__fade-out{0%{opacity:1}to{opacity:0}}.rmc-pull-to-refresh-content{transform-origin:left top 0}.rmc-pull-to-refresh-content-wrapper{min-height:100%}.rmc-pull-to-refresh-transition{transition:transform .3s}@keyframes rmc-pull-to-refresh-indicator{50%{opacity:.2}to{opacity:1}}.rmc-pull-to-refresh-indicator{height:30px;line-height:10px;text-align:center}.rmc-pull-to-refresh-indicator>div{animation-fill-mode:both;animation:rmc-pull-to-refresh-indicator .5s linear 0s infinite;background-color:grey;border-radius:100%;display:inline-block;height:6px;margin:3px;width:6px}.rmc-pull-to-refresh-indicator>div:nth-child(0){animation-delay:-.1s!important}.rmc-pull-to-refresh-indicator>div:first-child{animation-delay:-.2s!important}.rmc-pull-to-refresh-indicator>div:nth-child(2){animation-delay:-.3s!important}.rmc-pull-to-refresh-down .rmc-pull-to-refresh-indicator{margin-top:-25px}.taro-scroll{-webkit-overflow-scrolling:auto}.taro-scroll--hidebar::-webkit-scrollbar{display:none}.taro-scroll-view{overflow:hidden}.taro-scroll-view__scroll-x{overflow-x:scroll;overflow-y:hidden}.taro-scroll-view__scroll-y{overflow-x:hidden;overflow-y:scroll}.swiper-container-wrapper{height:150px}.swiper-container{height:100%;overflow:visible;position:relative}.taro-switch{cursor:pointer;display:inline-block;position:relative}.taro-switch--disabled{cursor:not-allowed;opacity:.5}.taro-switch--type-switch{border:1px solid #dfdfdf;box-sizing:border-box}.taro-switch--type-switch .taro-switch__thumb{background-color:#fff;border-radius:50%;box-shadow:0 1px 3px rgba(0,0,0,.4);left:1px;position:absolute;top:1px}.taro-switch--type-checkbox{border:1px solid #c9c9c9;box-sizing:border-box}.taro-switch--type-checkbox .taro-switch__checkmark{left:50%;position:absolute;top:50%}.taro-text{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.taro-text__selectable{-moz-user-select:text;-webkit-user-select:text;-ms-user-select:text;user-select:text}
|
|
1
|
+
@-webkit-keyframes weuiLoading{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes weuiLoading{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.taro-button-core.taro-btn-loading .weui-loading{animation:weuiLoading 1s steps(12) infinite;background:transparent url(https://img13.360buyimg.com/imagetools/jfs/t1/353674/27/5761/14397/690ac1cfFf6bf0e2c/77727d0791bacf8e.png) no-repeat;background-size:cover;display:inline-block;height:22px;width:22px}.taro-button-core.taro-btn-loading .weui-loading.weui-btn_primary,.taro-button-core.taro-btn-loading .weui-loading.weui-btn_warn{color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-loading .weui-loading.weui-btn_primary{background-color:#179b16}.taro-button-core.taro-btn-loading .weui-loading.weui-btn_warn{background-color:#ce3c39}.taro-button-core.taro-btn-loading.taro-btn-mini .weui-loading{display:inline-block;height:16px;vertical-align:middle;width:16px}.taro-button-core{-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;appearance:none;background-color:#f8f8f8;border:1px solid rgba(0,0,0,.2);border-radius:10px;box-sizing:border-box;color:#000;display:flex;font-size:18px;justify-content:center;outline:0;overflow:hidden;padding:0 14px;position:relative;text-decoration:none;width:100%}.taro-button-core:focus{outline:0}.taro-button-core:not(.taro-btn-disabled):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core+.taro-button-core{margin-top:15px}.taro-button-core.taro-btn-default{background-color:#f8f8f8;color:#000}.taro-button-core.taro-btn-default:not(.taro-btn-disabled):visited{color:#000}.taro-button-core.taro-btn-default:not(.taro-btn-disabled):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core.taro-btn-mini{display:inline-block;font-size:13px;padding:0 26px;vertical-align:middle;width:auto}.taro-button-core.taro-btn-plain,.taro-button-core.taro-btn-plain.taro-btn-default,.taro-button-core.taro-btn-plain.taro-btn-primary,.taro-button-core.taro-btn-plain.taro-btn-warn{background-color:transparent;border-width:1px}.taro-button-core.taro-btn-disabled{color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-disabled.taro-btn-default{background-color:#f7f7f7;color:rgba(0,0,0,.3)}.taro-button-core.taro-btn-disabled.taro-btn-primary{background-color:#9ed99d}.taro-button-core.taro-btn-disabled.taro-btn-warn{background-color:#ec8b89}.taro-button-core.taro-btn-loading.taro-btn-primary,.taro-button-core.taro-btn-loading.taro-btn-warn{color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-loading.taro-btn-primary{background-color:#179b16}.taro-button-core.taro-btn-loading.taro-btn-warn{background-color:#ce3c39}.taro-button-core.taro-btn-plain.taro-btn-primary{border:1px solid #1aad19;color:#1aad19}.taro-button-core.taro-btn-plain.taro-btn-primary:not(.taro-btn-disabled):active{background-color:transparent;border-color:rgba(26,173,25,.6);color:rgba(26,173,25,.6)}.taro-button-core.taro-btn-plain.taro-btn-primary:after{border-width:0}.taro-button-core.taro-btn-plain.taro-btn-warn{border:1px solid #e64340;color:#e64340}.taro-button-core.taro-btn-plain.taro-btn-warn:not(.taro-btn-disabled):active{background-color:transparent;border-color:rgba(230,67,64,.6);color:rgba(230,67,64,.6)}.taro-button-core.taro-btn-plain.taro-btn-warn:after{border-width:0}.taro-button-core.taro-btn-plain,.taro-button-core.taro-btn-plain.taro-btn-default{border:1px solid #353535;color:#353535}.taro-button-core.taro-btn-plain.taro-btn-default:not(.taro-btn-disabled):active,.taro-button-core.taro-btn-plain:not(.taro-btn-disabled):active{background-color:transparent;border-color:rgba(53,53,53,.6);color:rgba(53,53,53,.6)}.taro-button-core.taro-btn-plain.taro-btn-default:after,.taro-button-core.taro-btn-plain:after{border-width:0}.taro-button-core.taro-btn-primary{background-color:#1aad19;color:#fff}.taro-button-core.taro-btn-primary:not(.taro-btn-disabled):visited{color:#fff}.taro-button-core.taro-btn-primary:not(.taro-btn-disabled):active{background-color:#179b16;color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-warn{background-color:#e64340;color:#fff}.taro-button-core.taro-btn-warn:not(.taro-btn-disabled):visited{color:#fff}.taro-button-core.taro-btn-warn:not(.taro-btn-disabled):active{background-color:#ce3c39;color:hsla(0,0%,100%,.6)}.taro-button-core.taro-btn-plain.taro-btn-disabled.taro-btn-default,.taro-button-core.taro-btn-plain.taro-btn-disabled.taro-btn-primary,.taro-button-core.taro-btn-plain.taro-btn-disabled.taro-btn-warn{background-color:#f7f7f7;border:1px solid rgba(0,0,0,.2);color:rgba(0,0,0,.3)}.weui-icon-circle:before{content:"\ea01"}.weui-icon-download:before{content:"\ea02"}.weui-icon-info:before{content:"\ea03"}.weui-icon-safe-success:before{content:"\ea04"}.weui-icon-safe-warn:before{content:"\ea05"}.weui-icon-success:before{content:"\ea06"}.weui-icon-success-circle:before{content:"\ea07"}.weui-icon-success-no-circle:before{content:"\ea08"}.weui-icon-waiting:before{content:"\ea09"}.weui-icon-waiting-circle:before{content:"\ea0a"}.weui-icon-warn:before{content:"\ea0b"}.weui-icon-info-circle:before{content:"\ea0c"}.weui-icon-cancel:before{content:"\ea0d"}.weui-icon-search:before{content:"\ea0e"}.weui-icon-clear:before{content:"\ea0f"}.weui-icon-back:before{content:"\ea10"}.weui-icon-delete:before{content:"\ea11"}.weui-icon-success{color:#09bb07;font-size:23px}.weui-icon-waiting{color:#10aeff;font-size:23px}.weui-icon-warn{color:#f43530;font-size:23px}.weui-icon-info{color:#10aeff;font-size:23px}.weui-icon-success-circle,.weui-icon-success-no-circle{color:#09bb07;font-size:23px}.weui-icon-waiting-circle{color:#10aeff;font-size:23px}.weui-icon-circle{color:#c9c9c9;font-size:23px}.weui-icon-download,.weui-icon-info-circle{color:#09bb07;font-size:23px}.weui-icon-safe-success{color:#09bb07}.weui-icon-safe-warn{color:#ffbe00}.weui-icon-cancel{color:#f43530;font-size:22px}.weui-icon-clear,.weui-icon-search{color:#b2b2b2;font-size:14px}.weui-icon-delete.weui-icon_gallery-delete{color:#fff;font-size:22px}.weui-icon_msg{font-size:93px}.weui-icon_msg.weui-icon-warn{color:#f76260}.weui-icon_msg-primary{font-size:93px}.weui-icon_msg-primary.weui-icon-warn{color:#ffbe00}img[src=""]{opacity:0}.taro-img{display:inline-block;font-size:0;height:240px;overflow:hidden;position:relative;width:320px}.taro-img.taro-img__widthfix,.taro-img__mode-heightfix{height:100%}.taro-img__mode-scaletofill{height:100%;width:100%}.taro-img__mode-aspectfit{height:100%;object-fit:contain;width:100%}.taro-img__mode-aspectfill{height:100%;object-fit:cover;width:100%}.taro-img__mode-widthfix{width:100%}.taro-img__mode-bottom,.taro-img__mode-top{left:50%;position:absolute;transform:translate(-50%)}.taro-img__mode-bottom{bottom:0}.taro-img__mode-center{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.taro-img__mode-left,.taro-img__mode-right{position:absolute;top:50%;transform:translateY(-50%)}.taro-img__mode-right{right:0}.taro-img__mode-topright{position:absolute;right:0}.taro-img__mode-bottomleft{bottom:0;position:absolute}.taro-img__mode-bottomright{bottom:0;position:absolute;right:0}.taro-input-core{display:block}.weui-input{-webkit-appearance:none;background-color:transparent;border:0;color:inherit;font-size:inherit;height:1.4705882353em;line-height:1.4705882353;outline:0;width:100%}.weui-input::-webkit-inner-spin-button,.weui-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.taro-picker__overlay{position:fixed;z-index:1000}.taro-picker__mask-overlay,.taro-picker__overlay{bottom:0;height:100%;left:0;right:0;top:0;width:100%}.taro-picker__mask-overlay{position:absolute;z-index:1001}.taro-picker{bottom:0;font-size:14px;left:0;position:absolute;width:100%;z-index:1002}.taro-picker__hd{align-items:center;display:flex;font-size:17px;height:44px;justify-content:space-between;padding:0;position:relative}.taro-picker__hd:after{bottom:0;content:"";height:1px;left:0;position:absolute;transform:scaleY(.5);width:100%}.taro-picker__action{flex:0 0 auto;font-size:14px;height:44px;line-height:44px;padding:0 10px}.taro-picker__title{font-size:16px;font-weight:500;left:50%;max-width:40%;overflow:hidden;position:absolute;text-overflow:ellipsis;top:50%;transform:translate(-50%,-50%);white-space:nowrap}.taro-picker__bd{box-sizing:border-box;display:flex;flex:1;height:238px;overflow:hidden;width:100%}.taro-picker-theme-light{background-color:#e5e5e5}.taro-picker-theme-light .taro-picker__mask-overlay{background-color:rgba(0,0,0,.6)}.taro-picker-theme-light .taro-picker__hd{background-color:#fff}.taro-picker-theme-light .taro-picker__hd:after{background-color:#e5e5e5}.taro-picker-theme-light .taro-picker__action{color:#ff0f23}.taro-picker-theme-light .taro-picker__action:first-child{color:#888}.taro-picker-theme-light .taro-picker__title{color:#000}.taro-picker-theme-light .taro-picker__bd{background-color:#fff}.taro-picker-theme-light .taro-picker__indicator{border-bottom:1px solid #e5e5e5;border-top:1px solid #e5e5e5}.taro-picker-theme-light .taro-picker__mask{background:linear-gradient(180deg,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6) 40%,hsla(0,0%,100%,0) 45%,hsla(0,0%,100%,0) 55%,hsla(0,0%,100%,.6) 60%,hsla(0,0%,100%,.95))}.taro-picker-theme-light .taro-picker__item{color:#000}.taro-picker-theme-light .taro-picker__item--selected{color:#ff0f23}.taro-picker-theme-light .taro-picker__item--disabled{color:#999}.taro-picker-theme-dark{background-color:hsla(0,0%,100%,.06)}.taro-picker-theme-dark .taro-picker__mask-overlay{background-color:hsla(0,0%,8%,.7)}.taro-picker-theme-dark .taro-picker__hd{background-color:#1f1f1f}.taro-picker-theme-dark .taro-picker__hd:after{background-color:hsla(0,0%,100%,.06)}.taro-picker-theme-dark .taro-picker__action{color:#ff0f23}.taro-picker-theme-dark .taro-picker__action:first-child{color:#818181}.taro-picker-theme-dark .taro-picker__title{color:#e6e6e6}.taro-picker-theme-dark .taro-picker__bd{background-color:#1f1f1f}.taro-picker-theme-dark .taro-picker__indicator{border-bottom:1px solid hsla(0,0%,100%,.06);border-top:1px solid hsla(0,0%,100%,.06)}.taro-picker-theme-dark .taro-picker__mask{background:linear-gradient(180deg,rgba(31,31,31,.95),rgba(31,31,31,.6) 40%,rgba(31,31,31,0) 45%,rgba(31,31,31,0) 55%,rgba(31,31,31,.6) 60%,rgba(31,31,31,.95))}.taro-picker-theme-dark .taro-picker__item{color:#e6e6e6}.taro-picker-theme-dark .taro-picker__item--selected{color:#ff0f23}.taro-picker-theme-dark .taro-picker__item--disabled{color:#999}.taro-picker__group{align-items:center;box-sizing:border-box;display:flex;flex:1;height:100%;justify-content:center;min-width:0;position:relative}.taro-picker__group--date .taro-picker__columns{display:flex;height:100%;width:100%}.taro-picker__mask{height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:1}.taro-picker__indicator{box-sizing:border-box;height:34px;left:0;position:absolute;top:50%;transform:translateY(-50%);width:100%;z-index:1002}.taro-picker__content{box-sizing:border-box;height:100%;width:100%}.taro-picker__item{align-items:center;box-sizing:border-box;display:flex;font-size:16px;height:34px;justify-content:center;line-height:34px;overflow:hidden;padding:0 8px;text-align:center;text-overflow:ellipsis;white-space:nowrap;width:100%}.taro-picker__item--selected{font-weight:500}.taro-picker__column{flex:1;margin:0 8px}.taro-picker__column:first-child{margin-left:0}.taro-picker__column:last-child{margin-right:0}.taro-picker__item--custom{align-items:center;color:#888;display:flex;font-weight:400;justify-content:center;text-align:center}@keyframes taro-picker__slide-up{0%{transform:translate3d(0,100%,0)}to{transform:translateZ(0)}}@keyframes taro-picker__slide-down{0%{transform:translateZ(0)}to{transform:translate3d(0,100%,0)}}@keyframes taro-picker__fade-in{0%{opacity:0}to{opacity:1}}@keyframes taro-picker__fade-out{0%{opacity:1}to{opacity:0}}.rmc-pull-to-refresh-content{transform-origin:left top 0}.rmc-pull-to-refresh-content-wrapper{min-height:100%}.rmc-pull-to-refresh-transition{transition:transform .3s}@keyframes rmc-pull-to-refresh-indicator{50%{opacity:.2}to{opacity:1}}.rmc-pull-to-refresh-indicator{height:30px;line-height:10px;text-align:center}.rmc-pull-to-refresh-indicator>div{animation-fill-mode:both;animation:rmc-pull-to-refresh-indicator .5s linear 0s infinite;background-color:grey;border-radius:100%;display:inline-block;height:6px;margin:3px;width:6px}.rmc-pull-to-refresh-indicator>div:nth-child(0){animation-delay:-.1s!important}.rmc-pull-to-refresh-indicator>div:first-child{animation-delay:-.2s!important}.rmc-pull-to-refresh-indicator>div:nth-child(2){animation-delay:-.3s!important}.rmc-pull-to-refresh-down .rmc-pull-to-refresh-indicator{margin-top:-25px}.taro-scroll{-webkit-overflow-scrolling:auto}.taro-scroll--hidebar::-webkit-scrollbar{display:none}.taro-scroll-view{overflow:hidden}.taro-scroll-view__scroll-x{overflow-x:scroll;overflow-y:hidden}.taro-scroll-view__scroll-y{overflow-x:hidden;overflow-y:scroll}.swiper-container-wrapper{height:150px}.swiper-container{height:100%;overflow:visible;position:relative}.taro-text{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.taro-text__selectable{-moz-user-select:text;-webkit-user-select:text;-ms-user-select:text;user-select:text}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
export { Ad, AdCustom, AnimationVideo, AnimationView, ArCamera, Audio, AwemeData, Block, Camera, Canvas, ChannelLive, ChannelVideo, Checkbox, CheckboxGroup, CommentDetail, CommentList, ContactButton, CoverImage, CoverView, CustomWrapper, DraggableSheet, Editor, FollowSwan, Form, FunctionalPageNavigator, GridBuilder, GridView, InlinePaymentPanel, KeyboardAccessory, Label, Lifestyle, Like, ListBuilder, ListView, LivePlayer, LivePusher, Login, Lottie, MatchMedia, MovableArea, MovableView, NativeSlot, NavigationBar, Navigator, NestedScrollBody, NestedScrollHeader, OfficialAccount, OpenContainer, OpenData, PageContainer, PageMeta, PickerView, PickerViewColumn, Progress, Radio, RadioGroup, RichText, RootPortal, RtcRoom, RtcRoomItem, Script, ShareElement, Slider, Slot, Snapshot, Span, Tabs, Textarea, Video, VoipRoom, WebView } from '@tarojs/components/lib/react';
|
|
1
|
+
export { Ad, AdCustom, AnimationVideo, AnimationView, ArCamera, Audio, AwemeData, Block, Camera, Canvas, ChannelLive, ChannelVideo, Checkbox, CheckboxGroup, CommentDetail, CommentList, ContactButton, CoverImage, CoverView, CustomWrapper, DraggableSheet, Editor, FollowSwan, Form, FunctionalPageNavigator, GridBuilder, GridView, InlinePaymentPanel, KeyboardAccessory, Label, Lifestyle, Like, ListBuilder, ListView, LivePlayer, LivePusher, Login, Lottie, Map, MatchMedia, MovableArea, MovableView, NativeSlot, NavigationBar, Navigator, NestedScrollBody, NestedScrollHeader, OfficialAccount, OpenContainer, OpenData, PageContainer, PageMeta, PickerView, PickerViewColumn, Progress, Radio, RadioGroup, RichText, RootPortal, RtcRoom, RtcRoomItem, Script, ShareElement, Slider, Slot, Snapshot, Span, Switch, Tabs, Textarea, Video, VoipRoom, WebView } from '@tarojs/components/lib/react';
|
|
2
2
|
export { default as Button } from './components/button/index.js';
|
|
3
3
|
export { default as Icon } from './components/icon/index.js';
|
|
4
4
|
export { default as Image } from './components/image/index.js';
|
|
5
5
|
export { default as Input } from './components/input/index.js';
|
|
6
|
-
export { default as Map } from './components/map/index.js';
|
|
7
6
|
export { default as Picker } from './components/picker/index.js';
|
|
8
7
|
export { default as PullDownRefresh } from './components/pull-down-refresh/index.js';
|
|
9
|
-
export { Refresher } from './components/refresher/index.js';
|
|
10
|
-
export { ScrollElementContext } from './contexts/ScrollElementContext.js';
|
|
8
|
+
export { default as Refresher } from './components/refresher/index.js';
|
|
11
9
|
export { default as ScrollView } from './components/scroll-view/index.js';
|
|
12
10
|
export { Swiper, SwiperItem } from './components/swiper/index.js';
|
|
13
|
-
export { default as Switch } from './components/switch/index.js';
|
|
14
11
|
export { default as Text } from './components/text/index.js';
|
|
15
12
|
export { default as View } from './components/view/index.js';
|
|
16
|
-
export { createMapContext } from './components/map/createMapContext.js';
|
|
17
13
|
|
|
18
14
|
/* eslint-disable simple-import-sort/exports */
|
|
19
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.react.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/exports */\nexport { Ad } from '@tarojs/components/lib/react'\nexport { AdCustom } from '@tarojs/components/lib/react'\nexport { AnimationVideo } from '@tarojs/components/lib/react'\nexport { AnimationView } from '@tarojs/components/lib/react'\nexport { ArCamera } from '@tarojs/components/lib/react'\nexport { Audio } from '@tarojs/components/lib/react'\nexport { AwemeData } from '@tarojs/components/lib/react'\nexport { Block } from '@tarojs/components/lib/react'\nexport { default as Button } from './components/button'\nexport { Camera } from '@tarojs/components/lib/react'\nexport { Canvas } from '@tarojs/components/lib/react'\nexport { ChannelLive } from '@tarojs/components/lib/react'\nexport { ChannelVideo } from '@tarojs/components/lib/react'\nexport { Checkbox, CheckboxGroup } from '@tarojs/components/lib/react'\nexport { CommentDetail, CommentList } from '@tarojs/components/lib/react'\nexport { ContactButton } from '@tarojs/components/lib/react'\nexport { CoverImage } from '@tarojs/components/lib/react'\nexport { CoverView } from '@tarojs/components/lib/react'\nexport { CustomWrapper } from '@tarojs/components/lib/react'\nexport { DraggableSheet } from '@tarojs/components/lib/react'\nexport { Editor } from '@tarojs/components/lib/react'\nexport { FollowSwan } from '@tarojs/components/lib/react'\nexport { Form } from '@tarojs/components/lib/react'\nexport { FunctionalPageNavigator } from '@tarojs/components/lib/react'\nexport { GridView } from '@tarojs/components/lib/react'\nexport { GridBuilder } from '@tarojs/components/lib/react'\nexport { default as Icon } from './components/icon'\nexport { default as Image } from './components/image'\nexport { InlinePaymentPanel } from '@tarojs/components/lib/react'\nexport { default as Input } from './components/input'\nexport { KeyboardAccessory } from '@tarojs/components/lib/react'\nexport { Label } from '@tarojs/components/lib/react'\nexport { Lifestyle } from '@tarojs/components/lib/react'\nexport { Like } from '@tarojs/components/lib/react'\nexport { LivePlayer } from '@tarojs/components/lib/react'\nexport { LivePusher } from '@tarojs/components/lib/react'\nexport { ListBuilder } from '@tarojs/components/lib/react'\nexport { ListView } from '@tarojs/components/lib/react'\nexport { Login } from '@tarojs/components/lib/react'\nexport { Lottie } from '@tarojs/components/lib/react'\nexport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.react.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/exports */\nexport { Ad } from '@tarojs/components/lib/react'\nexport { AdCustom } from '@tarojs/components/lib/react'\nexport { AnimationVideo } from '@tarojs/components/lib/react'\nexport { AnimationView } from '@tarojs/components/lib/react'\nexport { ArCamera } from '@tarojs/components/lib/react'\nexport { Audio } from '@tarojs/components/lib/react'\nexport { AwemeData } from '@tarojs/components/lib/react'\nexport { Block } from '@tarojs/components/lib/react'\nexport { default as Button } from './components/button'\nexport { Camera } from '@tarojs/components/lib/react'\nexport { Canvas } from '@tarojs/components/lib/react'\nexport { ChannelLive } from '@tarojs/components/lib/react'\nexport { ChannelVideo } from '@tarojs/components/lib/react'\nexport { Checkbox, CheckboxGroup } from '@tarojs/components/lib/react'\nexport { CommentDetail, CommentList } from '@tarojs/components/lib/react'\nexport { ContactButton } from '@tarojs/components/lib/react'\nexport { CoverImage } from '@tarojs/components/lib/react'\nexport { CoverView } from '@tarojs/components/lib/react'\nexport { CustomWrapper } from '@tarojs/components/lib/react'\nexport { DraggableSheet } from '@tarojs/components/lib/react'\nexport { Editor } from '@tarojs/components/lib/react'\nexport { FollowSwan } from '@tarojs/components/lib/react'\nexport { Form } from '@tarojs/components/lib/react'\nexport { FunctionalPageNavigator } from '@tarojs/components/lib/react'\nexport { GridView } from '@tarojs/components/lib/react'\nexport { GridBuilder } from '@tarojs/components/lib/react'\nexport { default as Icon } from './components/icon'\nexport { default as Image } from './components/image'\nexport { InlinePaymentPanel } from '@tarojs/components/lib/react'\nexport { default as Input } from './components/input'\nexport { KeyboardAccessory } from '@tarojs/components/lib/react'\nexport { Label } from '@tarojs/components/lib/react'\nexport { Lifestyle } from '@tarojs/components/lib/react'\nexport { Like } from '@tarojs/components/lib/react'\nexport { LivePlayer } from '@tarojs/components/lib/react'\nexport { LivePusher } from '@tarojs/components/lib/react'\nexport { ListBuilder } from '@tarojs/components/lib/react'\nexport { ListView } from '@tarojs/components/lib/react'\nexport { Login } from '@tarojs/components/lib/react'\nexport { Lottie } from '@tarojs/components/lib/react'\nexport { Map } from '@tarojs/components/lib/react'\nexport { MatchMedia } from '@tarojs/components/lib/react'\nexport { MovableArea, MovableView } from '@tarojs/components/lib/react'\nexport { NavigationBar } from '@tarojs/components/lib/react'\nexport { Navigator } from '@tarojs/components/lib/react'\nexport { NestedScrollBody } from '@tarojs/components/lib/react'\nexport { NestedScrollHeader } from '@tarojs/components/lib/react'\nexport { OfficialAccount } from '@tarojs/components/lib/react'\nexport { OpenData } from '@tarojs/components/lib/react'\nexport { OpenContainer } from '@tarojs/components/lib/react'\nexport { PageContainer } from '@tarojs/components/lib/react'\nexport { PageMeta } from '@tarojs/components/lib/react'\nexport { default as Picker } from './components/picker'\nexport { PickerView, PickerViewColumn } from '@tarojs/components/lib/react'\nexport { Progress } from '@tarojs/components/lib/react'\nexport { default as PullDownRefresh } from './components/pull-down-refresh'\n// export { PullToRefresh } from '@tarojs/components/lib/react'\nexport { default as Refresher } from './components/refresher'\nexport { Radio, RadioGroup } from '@tarojs/components/lib/react'\nexport { RichText } from '@tarojs/components/lib/react'\nexport { RootPortal } from '@tarojs/components/lib/react'\nexport { RtcRoom, RtcRoomItem } from '@tarojs/components/lib/react'\nexport { Script } from '@tarojs/components/lib/react'\nexport { default as ScrollView } from './components/scroll-view'\nexport { ShareElement } from '@tarojs/components/lib/react'\nexport { Slider } from '@tarojs/components/lib/react'\nexport { Snapshot } from '@tarojs/components/lib/react'\nexport { Span } from '@tarojs/components/lib/react'\nexport { NativeSlot, Slot } from '@tarojs/components/lib/react'\nexport { Swiper, SwiperItem } from './components/swiper'\nexport { Switch } from '@tarojs/components/lib/react'\nexport { Tabs } from '@tarojs/components/lib/react'\nexport { default as Text } from './components/text'\nexport { Textarea } from '@tarojs/components/lib/react'\nexport { Video } from '@tarojs/components/lib/react'\nexport { default as View } from './components/view'\nexport { VoipRoom } from '@tarojs/components/lib/react'\nexport { WebView } from '@tarojs/components/lib/react'\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA"}
|
|
@@ -11,18 +11,16 @@ function Image(props) {
|
|
|
11
11
|
const [, setIsLoaded] = useState(false);
|
|
12
12
|
const {
|
|
13
13
|
className,
|
|
14
|
-
style,
|
|
14
|
+
style = {},
|
|
15
15
|
src,
|
|
16
16
|
mode,
|
|
17
17
|
onError,
|
|
18
18
|
lazyLoad,
|
|
19
19
|
imgProps,
|
|
20
|
-
forwardedRef
|
|
21
|
-
disableDefaultSize = false
|
|
20
|
+
forwardedRef
|
|
22
21
|
} = props,
|
|
23
|
-
reset = __rest(props, ["className", "style", "src", "mode", "onError", "lazyLoad", "imgProps", "forwardedRef"
|
|
22
|
+
reset = __rest(props, ["className", "style", "src", "mode", "onError", "lazyLoad", "imgProps", "forwardedRef"]);
|
|
24
23
|
const cls = classNames('taro-img', {
|
|
25
|
-
'taro-img--with-default-host-size': !disableDefaultSize,
|
|
26
24
|
'taro-img__widthfix': mode === 'widthFix'
|
|
27
25
|
}, className);
|
|
28
26
|
const imgCls = classNames('taro-img__mode-' + (mode || 'scaleToFill').toLowerCase().replace(/\s/g, ''));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/image/index.tsx"],"sourcesContent":["import './style/index.scss'\n\nimport classNames from 'classnames'\n\nimport { createForwardRefComponent } from '../../utils'\nimport { useCallback, useEffect, useRef, useState } from '../../utils/hooks'\n\nimport type React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n src: string\n mode: string\n onError: () => void\n onLoad: (e) => void\n lazyLoad?: boolean\n imgProps?: Record<string, any>\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/image/index.tsx"],"sourcesContent":["import './style/index.scss'\n\nimport classNames from 'classnames'\n\nimport { createForwardRefComponent } from '../../utils'\nimport { useCallback, useEffect, useRef, useState } from '../../utils/hooks'\n\nimport type React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n src: string\n mode: string\n onError: () => void\n onLoad: (e) => void\n lazyLoad?: boolean\n imgProps?: Record<string, any>\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n}\n\nfunction Image (props: IProps) {\n const imgRef = useRef<HTMLImageElement | null>(null)\n const observer = useRef<Partial<IntersectionObserver>>({})\n const [, setIsLoaded] = useState(false)\n const {\n className,\n style = {},\n src,\n mode,\n onError,\n lazyLoad,\n imgProps,\n forwardedRef,\n ...reset\n } = props\n\n const cls = classNames(\n 'taro-img',\n {\n 'taro-img__widthfix': mode === 'widthFix'\n },\n className\n )\n const imgCls = classNames(\n 'taro-img__mode-' +\n (mode || 'scaleToFill').toLowerCase().replace(/\\s/g, '')\n )\n\n const imageOnLoad = useCallback((e) => {\n const { onLoad } = props\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n writable: true,\n value: {\n width: e.target.width,\n height: e.target.height\n }\n })\n\n onLoad && onLoad(e)\n }, [props])\n\n useEffect(() => {\n if (lazyLoad) {\n observer.current = new IntersectionObserver(\n entries => {\n // 异步 api 关系\n if (entries[entries.length - 1].isIntersecting) {\n setIsLoaded(true)\n // findDOMNode(this).children[0].src = src\n imgRef.current!.src = src\n }\n },\n {\n rootMargin: '300px 0px'\n }\n )\n observer.current.observe?.(imgRef.current!)\n }\n\n return () => {\n observer.current?.disconnect?.()\n }\n }, [lazyLoad, src])\n\n return (\n <div className={cls} style={style} ref={forwardedRef} {...reset}>\n {lazyLoad ? (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n data-src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n ) : (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n )}\n </div>\n )\n}\n\nexport default createForwardRefComponent(Image)\n"],"names":["Image","props","imgRef","useRef","observer","setIsLoaded","useState","className","style","src","mode","onError","lazyLoad","imgProps","forwardedRef","reset","__rest","cls","classNames","imgCls","toLowerCase","replace","imageOnLoad","useCallback","e","onLoad","Object","defineProperty","enumerable","writable","value","width","target","height","useEffect","current","IntersectionObserver","entries","length","isIntersecting","rootMargin","_b","_a","observe","call","disconnect","_jsx","ref","children","img","createForwardRefComponent"],"mappings":";;;;;;;AAmBA,SAASA,KAAKA,CAAEC,KAAa,EAAA;AAC3B,EAAA,MAAMC,MAAM,GAAGC,MAAM,CAA0B,IAAI,CAAC;AACpD,EAAA,MAAMC,QAAQ,GAAGD,MAAM,CAAgC,EAAE,CAAC;AAC1D,EAAA,MAAM,GAAGE,WAAW,CAAC,GAA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EE,GAAG,IAAK/C,MAAM,CAACiC,OAAO,GAAGc,GAAK;AACnC1C,MAAAA,SAAS,EAAEY,MAAO;AAClBV,MAAAA,GAAG,EAAEA,GAAI;AACTgB,MAAAA,MAAM,EAAEH,WAAY;AACpBX,MAAAA,OAAO,EAAEA,OAAQ;MAAA,GACbE;KACJ;AACH,GACE,CAAC;AAEV;AAEA,YAAeqC,yBAAyB,CAAClD,KAAK,CAAC;;;;"}
|
|
@@ -2,17 +2,13 @@ img[src=''] {
|
|
|
2
2
|
opacity: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
/* 默认占位宽高仅挂在 .taro-img--with-default-host-size(由 disableDefaultSize 控制是否挂载),与业务 class 同为单类优先级 */
|
|
6
5
|
.taro-img {
|
|
7
6
|
display: inline-block;
|
|
8
7
|
overflow: hidden;
|
|
9
8
|
position: relative;
|
|
10
|
-
font-size: 0;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.taro-img--with-default-host-size {
|
|
14
9
|
width: 320px;
|
|
15
10
|
height: 240px;
|
|
11
|
+
font-size: 0;
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
.taro-img.taro-img__widthfix {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
2
|
import './style/index.scss';
|
|
3
3
|
import { View } from '@tarojs/components';
|
|
4
|
-
import Taro from '@tarojs/taro';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import React__default from 'react';
|
|
7
6
|
import { verifyValue, verifyTime, hoursRange, minutesRange, verifyDate, getYearRange, getMonthRange, getDayRange, compareTime, omit } from '../../utils/index.js';
|
|
@@ -128,13 +127,12 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
128
127
|
children,
|
|
129
128
|
formType,
|
|
130
129
|
lang,
|
|
131
|
-
theme = 'light'
|
|
132
|
-
enableClickItemScroll = true
|
|
130
|
+
theme = 'light'
|
|
133
131
|
} = props,
|
|
134
|
-
restProps = __rest(props, ["mode", "disabled", "range", "rangeKey", "value", "start", "end", "fields", "headerText", "level", "regionData", "textProps", "colors", "onChange", "onColumnChange", "onCancel", "children", "formType", "lang", "theme"
|
|
132
|
+
restProps = __rest(props, ["mode", "disabled", "range", "rangeKey", "value", "start", "end", "fields", "headerText", "level", "regionData", "textProps", "colors", "onChange", "onColumnChange", "onCancel", "children", "formType", "lang", "theme"]);
|
|
135
133
|
const indexRef = React__default.useRef([]);
|
|
136
134
|
const pickerDateRef = React__default.useRef();
|
|
137
|
-
//
|
|
135
|
+
// 记录是否是用户滚动
|
|
138
136
|
const isInitializationCompletedRef = React__default.useRef(false);
|
|
139
137
|
const [state, setState] = React__default.useState({
|
|
140
138
|
pickerValue: value || EMPTY_ARRAY,
|
|
@@ -143,45 +141,14 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
143
141
|
hidden: true,
|
|
144
142
|
fadeOut: false,
|
|
145
143
|
isWillLoadCalled: false,
|
|
146
|
-
|
|
147
|
-
a11yTimeLimitNonce: 0
|
|
144
|
+
timestamp: 0 // 用以部分模式下强制刷新组件的的时间戳,多用于反复限位
|
|
148
145
|
});
|
|
149
|
-
// 安全区域底部距离
|
|
150
|
-
const [safeAreaBottom, setSafeAreaBottom] = React__default.useState(0);
|
|
151
146
|
// 在组件内部
|
|
152
147
|
const [columnsCount, setColumnsCount] = React__default.useState(() => getRegionColumnsCount(level));
|
|
153
148
|
// 只在level变化时更新列数
|
|
154
149
|
React__default.useEffect(() => {
|
|
155
150
|
setColumnsCount(getRegionColumnsCount(level));
|
|
156
151
|
}, [level]);
|
|
157
|
-
// 更新安全区域
|
|
158
|
-
const updateSafeArea = React__default.useCallback(() => {
|
|
159
|
-
try {
|
|
160
|
-
const systemInfo = Taro.getSystemInfoSync();
|
|
161
|
-
const {
|
|
162
|
-
safeArea,
|
|
163
|
-
windowHeight
|
|
164
|
-
} = systemInfo;
|
|
165
|
-
if (safeArea && windowHeight) {
|
|
166
|
-
const lengthScaleRatio = systemInfo.lengthScaleRatio || 1;
|
|
167
|
-
const bottom = (windowHeight - safeArea.bottom) / lengthScaleRatio;
|
|
168
|
-
setSafeAreaBottom(Math.max(0, bottom));
|
|
169
|
-
}
|
|
170
|
-
} catch (e) {
|
|
171
|
-
// H5 环境或其他异常情况,不设置安全区域
|
|
172
|
-
setSafeAreaBottom(0);
|
|
173
|
-
}
|
|
174
|
-
}, []);
|
|
175
|
-
// 初始化安全区域
|
|
176
|
-
React__default.useEffect(() => {
|
|
177
|
-
updateSafeArea();
|
|
178
|
-
}, [updateSafeArea]);
|
|
179
|
-
// 监听窗口变化(导航方式切换等)
|
|
180
|
-
React__default.useEffect(() => {
|
|
181
|
-
const handleResize = () => updateSafeArea();
|
|
182
|
-
window.addEventListener('resize', handleResize);
|
|
183
|
-
return () => window.removeEventListener('resize', handleResize);
|
|
184
|
-
}, [updateSafeArea]);
|
|
185
152
|
// 获取当前索引数组
|
|
186
153
|
const getIndices = React__default.useCallback(() => {
|
|
187
154
|
return indexRef.current;
|
|
@@ -232,36 +199,25 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
232
199
|
const monthRange = getMonthRange(_start, _end, currentYear);
|
|
233
200
|
const dayRange = getDayRange(_start, _end, currentYear, currentMonth);
|
|
234
201
|
indexRef.current = [yearRange.indexOf(currentYear), monthRange.indexOf(currentMonth), dayRange.indexOf(currentDay)];
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
202
|
+
if (!pickerDateRef.current || pickerDateRef.current._value.getTime() !== _value.getTime() || pickerDateRef.current._start.getTime() !== _start.getTime() || pickerDateRef.current._end.getTime() !== _end.getTime()) {
|
|
203
|
+
pickerDateRef.current = {
|
|
204
|
+
_value,
|
|
205
|
+
_start,
|
|
206
|
+
_end,
|
|
207
|
+
_updateValue: [currentYear, currentMonth, currentDay]
|
|
208
|
+
};
|
|
209
|
+
}
|
|
242
210
|
} else if (mode === 'region') {
|
|
243
211
|
// region 模式处理 - 验证数据
|
|
244
212
|
if (!regionData) {
|
|
245
213
|
console.error('Picker: regionData is required for region mode');
|
|
246
|
-
indexRef.current =
|
|
247
|
-
length: columnsCount
|
|
248
|
-
}, () => 0);
|
|
249
|
-
setState(prev => Object.assign(Object.assign({}, prev), {
|
|
250
|
-
selectedIndices: [...indexRef.current],
|
|
251
|
-
pickerValue: value || EMPTY_ARRAY
|
|
252
|
-
}));
|
|
214
|
+
indexRef.current = [0];
|
|
253
215
|
return;
|
|
254
216
|
}
|
|
255
217
|
const validation = validateRegionData(regionData, 'Picker');
|
|
256
218
|
if (!validation.valid) {
|
|
257
219
|
console.error(validation.error);
|
|
258
|
-
indexRef.current =
|
|
259
|
-
length: columnsCount
|
|
260
|
-
}, () => 0);
|
|
261
|
-
setState(prev => Object.assign(Object.assign({}, prev), {
|
|
262
|
-
selectedIndices: [...indexRef.current],
|
|
263
|
-
pickerValue: value || EMPTY_ARRAY
|
|
264
|
-
}));
|
|
220
|
+
indexRef.current = [0];
|
|
265
221
|
return;
|
|
266
222
|
}
|
|
267
223
|
// 获取列数
|
|
@@ -308,16 +264,16 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
308
264
|
handleProps();
|
|
309
265
|
}
|
|
310
266
|
}, [handleProps, state.isWillLoadCalled, JSON.stringify(value)]);
|
|
311
|
-
//
|
|
267
|
+
// 显示 Picker
|
|
312
268
|
const showPicker = React__default.useCallback(() => {
|
|
313
269
|
if (disabled) return;
|
|
314
270
|
isInitializationCompletedRef.current = false;
|
|
315
|
-
|
|
271
|
+
const newIndices = getIndices();
|
|
316
272
|
setState(prev => Object.assign(Object.assign({}, prev), {
|
|
317
|
-
|
|
318
|
-
|
|
273
|
+
selectedIndices: newIndices,
|
|
274
|
+
hidden: false
|
|
319
275
|
}));
|
|
320
|
-
}, [disabled,
|
|
276
|
+
}, [disabled, getIndices]);
|
|
321
277
|
// 隐藏 Picker
|
|
322
278
|
const hidePicker = React__default.useCallback(() => {
|
|
323
279
|
isInitializationCompletedRef.current = false;
|
|
@@ -392,11 +348,11 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
392
348
|
finalIndices = [...newIndices];
|
|
393
349
|
hasLimited = true;
|
|
394
350
|
}
|
|
351
|
+
// 触发限位,更新状态,其它状态不用主动触发滚动
|
|
395
352
|
if (hasLimited) {
|
|
396
353
|
setState(prev => Object.assign(Object.assign({}, prev), {
|
|
397
354
|
selectedIndices: finalIndices,
|
|
398
|
-
|
|
399
|
-
a11yTimeLimitNonce: prev.a11yTimeLimitNonce + 1
|
|
355
|
+
timestamp: Date.now()
|
|
400
356
|
}));
|
|
401
357
|
} else {
|
|
402
358
|
setState(prev => Object.assign(Object.assign({}, prev), {
|
|
@@ -629,17 +585,11 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
629
585
|
}
|
|
630
586
|
});
|
|
631
587
|
}, [onColumnChange]);
|
|
632
|
-
|
|
633
|
-
setState(prev => Object.assign(Object.assign({}, prev), {
|
|
634
|
-
a11yTimeLimitColumnId: null
|
|
635
|
-
}));
|
|
636
|
-
}, []);
|
|
637
|
-
// 取消时按 props 回同步索引,避免与 value 脱节
|
|
588
|
+
// 处理取消
|
|
638
589
|
const handleCancel = React__default.useCallback(() => {
|
|
639
|
-
handleProps();
|
|
640
590
|
hidePicker();
|
|
641
591
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
642
|
-
}, [
|
|
592
|
+
}, [hidePicker, onCancel]);
|
|
643
593
|
// 渲染选择器组
|
|
644
594
|
const renderPickerGroup = React__default.useMemo(() => {
|
|
645
595
|
switch (mode) {
|
|
@@ -653,16 +603,11 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
653
603
|
columnId: String(index),
|
|
654
604
|
selectedIndex: state.selectedIndices[index] // 传递对应列的selectedIndex
|
|
655
605
|
,
|
|
656
|
-
colors: colors
|
|
657
|
-
enableClickItemScroll: enableClickItemScroll
|
|
606
|
+
colors: colors
|
|
658
607
|
}, index));
|
|
659
608
|
}
|
|
660
609
|
case 'time':
|
|
661
610
|
{
|
|
662
|
-
const timeA11yLimitFocus = state.a11yTimeLimitColumnId != null ? {
|
|
663
|
-
nonce: state.a11yTimeLimitNonce,
|
|
664
|
-
columnId: state.a11yTimeLimitColumnId
|
|
665
|
-
} : null;
|
|
666
611
|
return [/*#__PURE__*/jsx(PickerGroup, {
|
|
667
612
|
mode: "time",
|
|
668
613
|
range: hoursRange,
|
|
@@ -670,24 +615,16 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
670
615
|
columnId: "0",
|
|
671
616
|
selectedIndex: state.selectedIndices[0] // 传递小时列的selectedIndex
|
|
672
617
|
,
|
|
673
|
-
colors: colors
|
|
674
|
-
|
|
675
|
-
onTimeA11yLimitFocusConsumed: consumeTimeA11yLimitFocus,
|
|
676
|
-
timeA11yLimitEventNonce: state.a11yTimeLimitNonce,
|
|
677
|
-
enableClickItemScroll: enableClickItemScroll
|
|
678
|
-
}, "hour"), /*#__PURE__*/jsx(PickerGroup, {
|
|
618
|
+
colors: colors
|
|
619
|
+
}, `hour-${state.timestamp}`), /*#__PURE__*/jsx(PickerGroup, {
|
|
679
620
|
mode: "time",
|
|
680
621
|
range: minutesRange,
|
|
681
622
|
updateIndex: updateIndex,
|
|
682
623
|
columnId: "1",
|
|
683
624
|
selectedIndex: state.selectedIndices[1] // 传递分钟列的selectedIndex
|
|
684
625
|
,
|
|
685
|
-
colors: colors
|
|
686
|
-
|
|
687
|
-
onTimeA11yLimitFocusConsumed: consumeTimeA11yLimitFocus,
|
|
688
|
-
timeA11yLimitEventNonce: state.a11yTimeLimitNonce,
|
|
689
|
-
enableClickItemScroll: enableClickItemScroll
|
|
690
|
-
}, "minute")];
|
|
626
|
+
colors: colors
|
|
627
|
+
}, `minute-${state.timestamp}`)];
|
|
691
628
|
}
|
|
692
629
|
case 'date':
|
|
693
630
|
{
|
|
@@ -712,8 +649,7 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
712
649
|
columnId: "0",
|
|
713
650
|
selectedIndex: state.selectedIndices[0] // 传递年份列的selectedIndex
|
|
714
651
|
,
|
|
715
|
-
colors: colors
|
|
716
|
-
enableClickItemScroll: enableClickItemScroll
|
|
652
|
+
colors: colors
|
|
717
653
|
}, `year`)];
|
|
718
654
|
if (fields === 'month' || fields === 'day') {
|
|
719
655
|
renderView.push(/*#__PURE__*/jsx(PickerGroup, {
|
|
@@ -724,8 +660,7 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
724
660
|
columnId: "1",
|
|
725
661
|
selectedIndex: state.selectedIndices[1] // 传递月份列的selectedIndex
|
|
726
662
|
,
|
|
727
|
-
colors: colors
|
|
728
|
-
enableClickItemScroll: enableClickItemScroll
|
|
663
|
+
colors: colors
|
|
729
664
|
}, `month`));
|
|
730
665
|
}
|
|
731
666
|
if (fields === 'day') {
|
|
@@ -737,8 +672,7 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
737
672
|
columnId: "2",
|
|
738
673
|
selectedIndex: state.selectedIndices[2] // 传递日期列的selectedIndex
|
|
739
674
|
,
|
|
740
|
-
colors: colors
|
|
741
|
-
enableClickItemScroll: enableClickItemScroll
|
|
675
|
+
colors: colors
|
|
742
676
|
}, `day`));
|
|
743
677
|
}
|
|
744
678
|
return renderView;
|
|
@@ -773,8 +707,7 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
773
707
|
updateIndex: updateIndex,
|
|
774
708
|
columnId: String(i),
|
|
775
709
|
selectedIndex: state.selectedIndices[i],
|
|
776
|
-
colors: colors
|
|
777
|
-
enableClickItemScroll: enableClickItemScroll
|
|
710
|
+
colors: colors
|
|
778
711
|
}, `region-${i}`));
|
|
779
712
|
}
|
|
780
713
|
return columns;
|
|
@@ -787,11 +720,10 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
787
720
|
columnId: "0",
|
|
788
721
|
selectedIndex: state.selectedIndices[0] // 传递selector模式的selectedIndex
|
|
789
722
|
,
|
|
790
|
-
colors: colors
|
|
791
|
-
enableClickItemScroll: enableClickItemScroll
|
|
723
|
+
colors: colors
|
|
792
724
|
});
|
|
793
725
|
}
|
|
794
|
-
}, [mode, range, rangeKey, fields, updateIndex, updateDay, handleColumnChange, pickerDateRef.current, level, regionData, state.selectedIndices,
|
|
726
|
+
}, [mode, range, rangeKey, fields, updateIndex, updateDay, handleColumnChange, pickerDateRef.current, level, regionData, state.selectedIndices, columnsCount, lang, colors]);
|
|
795
727
|
// 动画类名控制逻辑
|
|
796
728
|
const clsMask = classNames('taro-picker__mask-overlay', 'taro-picker__animate-fade-in', {
|
|
797
729
|
'taro-picker__animate-fade-out': state.fadeOut
|
|
@@ -805,9 +737,6 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
805
737
|
const titleStyle = colors.titleColor ? {
|
|
806
738
|
color: colors.titleColor
|
|
807
739
|
} : null;
|
|
808
|
-
const maskOverlayStyle = colors.maskColor ? {
|
|
809
|
-
backgroundColor: colors.maskColor
|
|
810
|
-
} : undefined;
|
|
811
740
|
// 暴露方法给外部
|
|
812
741
|
React__default.useImperativeHandle(ref, () => ({
|
|
813
742
|
showPicker,
|
|
@@ -826,16 +755,15 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
826
755
|
onClick: showPicker,
|
|
827
756
|
children: children
|
|
828
757
|
}), !state.hidden && /*#__PURE__*/jsxs(View, {
|
|
829
|
-
className:
|
|
758
|
+
className: "taro-picker__overlay",
|
|
830
759
|
children: [/*#__PURE__*/jsx(View, {
|
|
831
760
|
className: clsMask,
|
|
832
|
-
style: maskOverlayStyle,
|
|
833
761
|
onClick: handleCancel
|
|
834
762
|
}), /*#__PURE__*/jsxs(View, {
|
|
835
763
|
className: clsSlider,
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
}),
|
|
764
|
+
...(backgroundStyle ? {
|
|
765
|
+
style: backgroundStyle
|
|
766
|
+
} : {}),
|
|
839
767
|
children: [/*#__PURE__*/jsxs(View, {
|
|
840
768
|
className: "taro-picker__hd",
|
|
841
769
|
...(backgroundStyle ? {
|